[
  {
    "path": "README.md",
    "content": "# mapshaper-plus\n\nGenerate geojson files for [Apache ECharts (incubating)](https://github.com/apache/incubator-echarts) Map,base on mapshaper\n\n基于[mapshaper](https://github.com/mbloch/mapshaper)对geojson地图数据的坐标信息进行压缩编码，并提供可直接生成压缩编码后的echarts map数据格式\n\n通过`mapshaper-plus`可以直接将`shp`格式数据转换为压缩后的echarts数据\n\n## Demo\n\nhttps://giscafer.github.io/mapshaper-plus/\n\n## Description\n\n**介绍** ——[mapshaper](https://github.com/mbloch/mapshaper)可以将多种数据格式（Shapefile, GeoJSON, TopoJSON\n和 Zip files）导入后，对地图的编辑和导出（Shapefile, GeoJSON, TopoJSON, DSV, SVG），功能强大和简单易用。\n\n`mapshaper-plus`是在`mapshaper`基础上拓展对地图坐标信息的压缩编码，很大程度上减小了文件的代码行数和字节大小：譬如一个贵州省的数据，原始的`geojson`数据会在`30M`左右，但在对坐标信息压缩编码后，仅为`1.4M`。\n\n**背景** ——在做echarts图表统计时，需要自制地图数据，但官方没有提供一个平台可以直接将`shp文件`转化为压缩后的`json`或`js`格式的地图文件，而`mapshaper`导出的json数据没有压缩，数据量过大。\n\n使用可以访问[mapshaper-plus在线demo](http://giscafer.github.io/mapshaper-plus/)\n\n## Screenshot\n\n![导出压缩版的数据](https://raw.githubusercontent.com/giscafer/mapshaper-plus/master/images/echarts01.png)\n\n## License\n\nmapshaper is licensed under MPL 2.0. and mapshaper-plus is licensed under MIT.\n\n> Blog [giscafer.com](http://giscafer.com) &nbsp;&middot;&nbsp;\n> GitHub [@giscafer](https://github.com/giscafer) &nbsp;&middot;&nbsp;\n> Weibo [@Nickbing Lao](https://weibo.com/laohoubin)\n\n"
  },
  {
    "path": "codecs.js",
    "content": "/// wrapper for pako (https://github.com/nodeca/pako)\n\n/* globals pako */\n(function(global) {\n\t\"use strict\";\n\n\tfunction Codec(isDeflater, options) {\n\t\tvar newOptions = { raw: true, chunkSize: 1024 * 1024 };\n\t\tif (options && typeof options.level === 'number')\n\t\t\tnewOptions.level = options.level;\n\t\tthis._backEnd = isDeflater?\n\t\t\tnew pako.Deflate(newOptions) :\n\t\t\tnew pako.Inflate(newOptions);\n\t\tthis._chunks = [];\n\t\tthis._dataLength = 0;\n\t\tthis._backEnd.onData = this._onData.bind(this);\n\t}\n\tCodec.prototype._onData = function _onData(chunk) {\n\t\tthis._chunks.push(chunk);\n\t\tthis._dataLength += chunk.length;\n\t};\n\tCodec.prototype._fetchData = function _fetchData() {\n\t\tvar be = this._backEnd;\n\t\tif (be.err !== 0)\n\t\t\tthrow new Error(be.msg);\n\t\tvar chunks = this._chunks;\n\t\tvar data;\n\t\tif (chunks.length === 1)\n\t\t\tdata = chunks[0];\n\t\telse if (chunks.length > 1) {\n\t\t\tdata = new Uint8Array(this._dataLength);\n\t\t\tfor (var i = 0, n = chunks.length, off = 0; i < n; i++) {\n\t\t\t\tvar chunk = chunks[i];\n\t\t\t\tdata.set(chunk, off);\n\t\t\t\toff += chunk.length;\n\t\t\t}\n\t\t}\n\t\tchunks.length = 0;\n\t\tthis._dataLength = 0;\n\t\treturn data;\n\t};\n\tCodec.prototype.append = function append(bytes, onprogress) {\n\t\tthis._backEnd.push(bytes, false);\n\t\treturn this._fetchData();\n\t};\n\tCodec.prototype.flush = function flush() {\n\t\tthis._backEnd.push(new Uint8Array(0), true);\n\t\treturn this._fetchData();\n\t};\n\n\tfunction Deflater(options) {\n\t\tCodec.call(this, true, options);\n\t}\n\tDeflater.prototype = Object.create(Codec.prototype);\n\tfunction Inflater() {\n\t\tCodec.call(this, false);\n\t}\n\tInflater.prototype = Object.create(Codec.prototype);\n\n\t// 'zip' may not be defined in z-worker and some tests\n\tvar env = global.zip || global;\n\tenv.Deflater = env._pako_Deflater = Deflater;\n\tenv.Inflater = env._pako_Inflater = Inflater;\n})(this);"
  },
  {
    "path": "deflate.js",
    "content": "/*\n Copyright (c) 2013 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright \n notice, this list of conditions and the following disclaimer in \n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * This program is based on JZlib 1.0.2 ymnk, JCraft,Inc.\n * JZlib is based on zlib-1.1.3, so all credit should go authors\n * Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)\n * and contributors of zlib.\n */\n\n(function(global) {\n\t\"use strict\";\n\n\t// Global\n\n\tvar MAX_BITS = 15;\n\tvar D_CODES = 30;\n\tvar BL_CODES = 19;\n\n\tvar LENGTH_CODES = 29;\n\tvar LITERALS = 256;\n\tvar L_CODES = (LITERALS + 1 + LENGTH_CODES);\n\tvar HEAP_SIZE = (2 * L_CODES + 1);\n\n\tvar END_BLOCK = 256;\n\n\t// Bit length codes must not exceed MAX_BL_BITS bits\n\tvar MAX_BL_BITS = 7;\n\n\t// repeat previous bit length 3-6 times (2 bits of repeat count)\n\tvar REP_3_6 = 16;\n\n\t// repeat a zero length 3-10 times (3 bits of repeat count)\n\tvar REPZ_3_10 = 17;\n\n\t// repeat a zero length 11-138 times (7 bits of repeat count)\n\tvar REPZ_11_138 = 18;\n\n\t// The lengths of the bit length codes are sent in order of decreasing\n\t// probability, to avoid transmitting the lengths for unused bit\n\t// length codes.\n\n\tvar Buf_size = 8 * 2;\n\n\t// JZlib version : \"1.0.2\"\n\tvar Z_DEFAULT_COMPRESSION = -1;\n\n\t// compression strategy\n\tvar Z_FILTERED = 1;\n\tvar Z_HUFFMAN_ONLY = 2;\n\tvar Z_DEFAULT_STRATEGY = 0;\n\n\tvar Z_NO_FLUSH = 0;\n\tvar Z_PARTIAL_FLUSH = 1;\n\tvar Z_FULL_FLUSH = 3;\n\tvar Z_FINISH = 4;\n\n\tvar Z_OK = 0;\n\tvar Z_STREAM_END = 1;\n\tvar Z_NEED_DICT = 2;\n\tvar Z_STREAM_ERROR = -2;\n\tvar Z_DATA_ERROR = -3;\n\tvar Z_BUF_ERROR = -5;\n\n\t// Tree\n\n\t// see definition of array dist_code below\n\tvar _dist_code = [ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,\n\t\t\t10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,\n\t\t\t12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,\n\t\t\t13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\n\t\t\t14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,\n\t\t\t14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,\n\t\t\t15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19,\n\t\t\t20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n\t\t\t24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,\n\t\t\t26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n\t\t\t27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,\n\t\t\t28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29,\n\t\t\t29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,\n\t\t\t29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 ];\n\n\tfunction Tree() {\n\t\tvar that = this;\n\n\t\t// dyn_tree; // the dynamic tree\n\t\t// max_code; // largest code with non zero frequency\n\t\t// stat_desc; // the corresponding static tree\n\n\t\t// Compute the optimal bit lengths for a tree and update the total bit\n\t\t// length\n\t\t// for the current block.\n\t\t// IN assertion: the fields freq and dad are set, heap[heap_max] and\n\t\t// above are the tree nodes sorted by increasing frequency.\n\t\t// OUT assertions: the field len is set to the optimal bit length, the\n\t\t// array bl_count contains the frequencies for each bit length.\n\t\t// The length opt_len is updated; static_len is also updated if stree is\n\t\t// not null.\n\t\tfunction gen_bitlen(s) {\n\t\t\tvar tree = that.dyn_tree;\n\t\t\tvar stree = that.stat_desc.static_tree;\n\t\t\tvar extra = that.stat_desc.extra_bits;\n\t\t\tvar base = that.stat_desc.extra_base;\n\t\t\tvar max_length = that.stat_desc.max_length;\n\t\t\tvar h; // heap index\n\t\t\tvar n, m; // iterate over the tree elements\n\t\t\tvar bits; // bit length\n\t\t\tvar xbits; // extra bits\n\t\t\tvar f; // frequency\n\t\t\tvar overflow = 0; // number of elements with bit length too large\n\n\t\t\tfor (bits = 0; bits <= MAX_BITS; bits++)\n\t\t\t\ts.bl_count[bits] = 0;\n\n\t\t\t// In a first pass, compute the optimal bit lengths (which may\n\t\t\t// overflow in the case of the bit length tree).\n\t\t\ttree[s.heap[s.heap_max] * 2 + 1] = 0; // root of the heap\n\n\t\t\tfor (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n\t\t\t\tn = s.heap[h];\n\t\t\t\tbits = tree[tree[n * 2 + 1] * 2 + 1] + 1;\n\t\t\t\tif (bits > max_length) {\n\t\t\t\t\tbits = max_length;\n\t\t\t\t\toverflow++;\n\t\t\t\t}\n\t\t\t\ttree[n * 2 + 1] = bits;\n\t\t\t\t// We overwrite tree[n*2+1] which is no longer needed\n\n\t\t\t\tif (n > that.max_code)\n\t\t\t\t\tcontinue; // not a leaf node\n\n\t\t\t\ts.bl_count[bits]++;\n\t\t\t\txbits = 0;\n\t\t\t\tif (n >= base)\n\t\t\t\t\txbits = extra[n - base];\n\t\t\t\tf = tree[n * 2];\n\t\t\t\ts.opt_len += f * (bits + xbits);\n\t\t\t\tif (stree)\n\t\t\t\t\ts.static_len += f * (stree[n * 2 + 1] + xbits);\n\t\t\t}\n\t\t\tif (overflow === 0)\n\t\t\t\treturn;\n\n\t\t\t// This happens for example on obj2 and pic of the Calgary corpus\n\t\t\t// Find the first bit length which could increase:\n\t\t\tdo {\n\t\t\t\tbits = max_length - 1;\n\t\t\t\twhile (s.bl_count[bits] === 0)\n\t\t\t\t\tbits--;\n\t\t\t\ts.bl_count[bits]--; // move one leaf down the tree\n\t\t\t\ts.bl_count[bits + 1] += 2; // move one overflow item as its brother\n\t\t\t\ts.bl_count[max_length]--;\n\t\t\t\t// The brother of the overflow item also moves one step up,\n\t\t\t\t// but this does not affect bl_count[max_length]\n\t\t\t\toverflow -= 2;\n\t\t\t} while (overflow > 0);\n\n\t\t\tfor (bits = max_length; bits !== 0; bits--) {\n\t\t\t\tn = s.bl_count[bits];\n\t\t\t\twhile (n !== 0) {\n\t\t\t\t\tm = s.heap[--h];\n\t\t\t\t\tif (m > that.max_code)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (tree[m * 2 + 1] != bits) {\n\t\t\t\t\t\ts.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2];\n\t\t\t\t\t\ttree[m * 2 + 1] = bits;\n\t\t\t\t\t}\n\t\t\t\t\tn--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Reverse the first len bits of a code, using straightforward code (a\n\t\t// faster\n\t\t// method would use a table)\n\t\t// IN assertion: 1 <= len <= 15\n\t\tfunction bi_reverse(code, // the value to invert\n\t\tlen // its bit length\n\t\t) {\n\t\t\tvar res = 0;\n\t\t\tdo {\n\t\t\t\tres |= code & 1;\n\t\t\t\tcode >>>= 1;\n\t\t\t\tres <<= 1;\n\t\t\t} while (--len > 0);\n\t\t\treturn res >>> 1;\n\t\t}\n\n\t\t// Generate the codes for a given tree and bit counts (which need not be\n\t\t// optimal).\n\t\t// IN assertion: the array bl_count contains the bit length statistics for\n\t\t// the given tree and the field len is set for all tree elements.\n\t\t// OUT assertion: the field code is set for all tree elements of non\n\t\t// zero code length.\n\t\tfunction gen_codes(tree, // the tree to decorate\n\t\tmax_code, // largest code with non zero frequency\n\t\tbl_count // number of codes at each bit length\n\t\t) {\n\t\t\tvar next_code = []; // next code value for each\n\t\t\t// bit length\n\t\t\tvar code = 0; // running code value\n\t\t\tvar bits; // bit index\n\t\t\tvar n; // code index\n\t\t\tvar len;\n\n\t\t\t// The distribution counts are first used to generate the code values\n\t\t\t// without bit reversal.\n\t\t\tfor (bits = 1; bits <= MAX_BITS; bits++) {\n\t\t\t\tnext_code[bits] = code = ((code + bl_count[bits - 1]) << 1);\n\t\t\t}\n\n\t\t\t// Check that the bit counts in bl_count are consistent. The last code\n\t\t\t// must be all ones.\n\t\t\t// Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n\t\t\t// \"inconsistent bit counts\");\n\t\t\t// Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n\t\t\tfor (n = 0; n <= max_code; n++) {\n\t\t\t\tlen = tree[n * 2 + 1];\n\t\t\t\tif (len === 0)\n\t\t\t\t\tcontinue;\n\t\t\t\t// Now reverse the bits\n\t\t\t\ttree[n * 2] = bi_reverse(next_code[len]++, len);\n\t\t\t}\n\t\t}\n\n\t\t// Construct one Huffman tree and assigns the code bit strings and lengths.\n\t\t// Update the total bit length for the current block.\n\t\t// IN assertion: the field freq is set for all tree elements.\n\t\t// OUT assertions: the fields len and code are set to the optimal bit length\n\t\t// and corresponding code. The length opt_len is updated; static_len is\n\t\t// also updated if stree is not null. The field max_code is set.\n\t\tthat.build_tree = function(s) {\n\t\t\tvar tree = that.dyn_tree;\n\t\t\tvar stree = that.stat_desc.static_tree;\n\t\t\tvar elems = that.stat_desc.elems;\n\t\t\tvar n, m; // iterate over heap elements\n\t\t\tvar max_code = -1; // largest code with non zero frequency\n\t\t\tvar node; // new node being created\n\n\t\t\t// Construct the initial heap, with least frequent element in\n\t\t\t// heap[1]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n\t\t\t// heap[0] is not used.\n\t\t\ts.heap_len = 0;\n\t\t\ts.heap_max = HEAP_SIZE;\n\n\t\t\tfor (n = 0; n < elems; n++) {\n\t\t\t\tif (tree[n * 2] !== 0) {\n\t\t\t\t\ts.heap[++s.heap_len] = max_code = n;\n\t\t\t\t\ts.depth[n] = 0;\n\t\t\t\t} else {\n\t\t\t\t\ttree[n * 2 + 1] = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// The pkzip format requires that at least one distance code exists,\n\t\t\t// and that at least one bit should be sent even if there is only one\n\t\t\t// possible code. So to avoid special checks later on we force at least\n\t\t\t// two codes of non zero frequency.\n\t\t\twhile (s.heap_len < 2) {\n\t\t\t\tnode = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;\n\t\t\t\ttree[node * 2] = 1;\n\t\t\t\ts.depth[node] = 0;\n\t\t\t\ts.opt_len--;\n\t\t\t\tif (stree)\n\t\t\t\t\ts.static_len -= stree[node * 2 + 1];\n\t\t\t\t// node is 0 or 1 so it does not have extra bits\n\t\t\t}\n\t\t\tthat.max_code = max_code;\n\n\t\t\t// The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n\t\t\t// establish sub-heaps of increasing lengths:\n\n\t\t\tfor (n = Math.floor(s.heap_len / 2); n >= 1; n--)\n\t\t\t\ts.pqdownheap(tree, n);\n\n\t\t\t// Construct the Huffman tree by repeatedly combining the least two\n\t\t\t// frequent nodes.\n\n\t\t\tnode = elems; // next internal node of the tree\n\t\t\tdo {\n\t\t\t\t// n = node of least frequency\n\t\t\t\tn = s.heap[1];\n\t\t\t\ts.heap[1] = s.heap[s.heap_len--];\n\t\t\t\ts.pqdownheap(tree, 1);\n\t\t\t\tm = s.heap[1]; // m = node of next least frequency\n\n\t\t\t\ts.heap[--s.heap_max] = n; // keep the nodes sorted by frequency\n\t\t\t\ts.heap[--s.heap_max] = m;\n\n\t\t\t\t// Create a new node father of n and m\n\t\t\t\ttree[node * 2] = (tree[n * 2] + tree[m * 2]);\n\t\t\t\ts.depth[node] = Math.max(s.depth[n], s.depth[m]) + 1;\n\t\t\t\ttree[n * 2 + 1] = tree[m * 2 + 1] = node;\n\n\t\t\t\t// and insert the new node in the heap\n\t\t\t\ts.heap[1] = node++;\n\t\t\t\ts.pqdownheap(tree, 1);\n\t\t\t} while (s.heap_len >= 2);\n\n\t\t\ts.heap[--s.heap_max] = s.heap[1];\n\n\t\t\t// At this point, the fields freq and dad are set. We can now\n\t\t\t// generate the bit lengths.\n\n\t\t\tgen_bitlen(s);\n\n\t\t\t// The field len is now set, we can generate the bit codes\n\t\t\tgen_codes(tree, that.max_code, s.bl_count);\n\t\t};\n\n\t}\n\n\tTree._length_code = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16,\n\t\t\t16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20,\n\t\t\t20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,\n\t\t\t22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n\t\t\t24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,\n\t\t\t25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,\n\t\t\t26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 ];\n\n\tTree.base_length = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 ];\n\n\tTree.base_dist = [ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384,\n\t\t\t24576 ];\n\n\t// Mapping from a distance to a distance code. dist is the distance - 1 and\n\t// must not have side effects. _dist_code[256] and _dist_code[257] are never\n\t// used.\n\tTree.d_code = function(dist) {\n\t\treturn ((dist) < 256 ? _dist_code[dist] : _dist_code[256 + ((dist) >>> 7)]);\n\t};\n\n\t// extra bits for each length code\n\tTree.extra_lbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 ];\n\n\t// extra bits for each distance code\n\tTree.extra_dbits = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 ];\n\n\t// extra bits for each bit length code\n\tTree.extra_blbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 ];\n\n\tTree.bl_order = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\t// StaticTree\n\n\tfunction StaticTree(static_tree, extra_bits, extra_base, elems, max_length) {\n\t\tvar that = this;\n\t\tthat.static_tree = static_tree;\n\t\tthat.extra_bits = extra_bits;\n\t\tthat.extra_base = extra_base;\n\t\tthat.elems = elems;\n\t\tthat.max_length = max_length;\n\t}\n\n\tStaticTree.static_ltree = [ 12, 8, 140, 8, 76, 8, 204, 8, 44, 8, 172, 8, 108, 8, 236, 8, 28, 8, 156, 8, 92, 8, 220, 8, 60, 8, 188, 8, 124, 8, 252, 8, 2, 8,\n\t\t\t130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8, 18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8, 10, 8, 138, 8, 74, 8, 202, 8, 42,\n\t\t\t8, 170, 8, 106, 8, 234, 8, 26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8, 6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8,\n\t\t\t22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8, 14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8, 30, 8, 158, 8, 94, 8,\n\t\t\t222, 8, 62, 8, 190, 8, 126, 8, 254, 8, 1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8, 17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113,\n\t\t\t8, 241, 8, 9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8, 25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8, 5, 8, 133, 8,\n\t\t\t69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8, 21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8, 13, 8, 141, 8, 77, 8, 205, 8, 45, 8,\n\t\t\t173, 8, 109, 8, 237, 8, 29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8, 19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9,\n\t\t\t51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9, 11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9, 43, 9, 299, 9, 171, 9,\n\t\t\t427, 9, 107, 9, 363, 9, 235, 9, 491, 9, 27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9, 59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379,\n\t\t\t9, 251, 9, 507, 9, 7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9, 39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9, 23,\n\t\t\t9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9, 55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9, 15, 9, 271, 9, 143, 9,\n\t\t\t399, 9, 79, 9, 335, 9, 207, 9, 463, 9, 47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9, 31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9,\n\t\t\t223, 9, 479, 9, 63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9, 0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7, 8, 7, 72, 7,\n\t\t\t40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7, 4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7, 3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8,\n\t\t\t99, 8, 227, 8 ];\n\n\tStaticTree.static_dtree = [ 0, 5, 16, 5, 8, 5, 24, 5, 4, 5, 20, 5, 12, 5, 28, 5, 2, 5, 18, 5, 10, 5, 26, 5, 6, 5, 22, 5, 14, 5, 30, 5, 1, 5, 17, 5, 9, 5,\n\t\t\t25, 5, 5, 5, 21, 5, 13, 5, 29, 5, 3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5 ];\n\n\tStaticTree.static_l_desc = new StaticTree(StaticTree.static_ltree, Tree.extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n\n\tStaticTree.static_d_desc = new StaticTree(StaticTree.static_dtree, Tree.extra_dbits, 0, D_CODES, MAX_BITS);\n\n\tStaticTree.static_bl_desc = new StaticTree(null, Tree.extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n\t// Deflate\n\n\tvar MAX_MEM_LEVEL = 9;\n\tvar DEF_MEM_LEVEL = 8;\n\n\tfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\t\tvar that = this;\n\t\tthat.good_length = good_length;\n\t\tthat.max_lazy = max_lazy;\n\t\tthat.nice_length = nice_length;\n\t\tthat.max_chain = max_chain;\n\t\tthat.func = func;\n\t}\n\n\tvar STORED = 0;\n\tvar FAST = 1;\n\tvar SLOW = 2;\n\tvar config_table = [ new Config(0, 0, 0, 0, STORED), new Config(4, 4, 8, 4, FAST), new Config(4, 5, 16, 8, FAST), new Config(4, 6, 32, 32, FAST),\n\t\t\tnew Config(4, 4, 16, 16, SLOW), new Config(8, 16, 32, 32, SLOW), new Config(8, 16, 128, 128, SLOW), new Config(8, 32, 128, 256, SLOW),\n\t\t\tnew Config(32, 128, 258, 1024, SLOW), new Config(32, 258, 258, 4096, SLOW) ];\n\n\tvar z_errmsg = [ \"need dictionary\", // Z_NEED_DICT\n\t// 2\n\t\"stream end\", // Z_STREAM_END 1\n\t\"\", // Z_OK 0\n\t\"\", // Z_ERRNO (-1)\n\t\"stream error\", // Z_STREAM_ERROR (-2)\n\t\"data error\", // Z_DATA_ERROR (-3)\n\t\"\", // Z_MEM_ERROR (-4)\n\t\"buffer error\", // Z_BUF_ERROR (-5)\n\t\"\",// Z_VERSION_ERROR (-6)\n\t\"\" ];\n\n\t// block not completed, need more input or more output\n\tvar NeedMore = 0;\n\n\t// block flush performed\n\tvar BlockDone = 1;\n\n\t// finish started, need only more output at next deflate\n\tvar FinishStarted = 2;\n\n\t// finish done, accept no more input or output\n\tvar FinishDone = 3;\n\n\t// preset dictionary flag in zlib header\n\tvar PRESET_DICT = 0x20;\n\n\tvar INIT_STATE = 42;\n\tvar BUSY_STATE = 113;\n\tvar FINISH_STATE = 666;\n\n\t// The deflate compression method\n\tvar Z_DEFLATED = 8;\n\n\tvar STORED_BLOCK = 0;\n\tvar STATIC_TREES = 1;\n\tvar DYN_TREES = 2;\n\n\tvar MIN_MATCH = 3;\n\tvar MAX_MATCH = 258;\n\tvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\n\tfunction smaller(tree, n, m, depth) {\n\t\tvar tn2 = tree[n * 2];\n\t\tvar tm2 = tree[m * 2];\n\t\treturn (tn2 < tm2 || (tn2 == tm2 && depth[n] <= depth[m]));\n\t}\n\n\tfunction Deflate() {\n\n\t\tvar that = this;\n\t\tvar strm; // pointer back to this zlib stream\n\t\tvar status; // as the name implies\n\t\t// pending_buf; // output still pending\n\t\tvar pending_buf_size; // size of pending_buf\n\t\t// pending_out; // next pending byte to output to the stream\n\t\t// pending; // nb of bytes in the pending buffer\n\t\tvar method; // STORED (for zip only) or DEFLATED\n\t\tvar last_flush; // value of flush param for previous deflate call\n\n\t\tvar w_size; // LZ77 window size (32K by default)\n\t\tvar w_bits; // log2(w_size) (8..16)\n\t\tvar w_mask; // w_size - 1\n\n\t\tvar window;\n\t\t// Sliding window. Input bytes are read into the second half of the window,\n\t\t// and move to the first half later to keep a dictionary of at least wSize\n\t\t// bytes. With this organization, matches are limited to a distance of\n\t\t// wSize-MAX_MATCH bytes, but this ensures that IO is always\n\t\t// performed with a length multiple of the block size. Also, it limits\n\t\t// the window size to 64K, which is quite useful on MSDOS.\n\t\t// To do: use the user input buffer as sliding window.\n\n\t\tvar window_size;\n\t\t// Actual size of window: 2*wSize, except when the user input buffer\n\t\t// is directly used as sliding window.\n\n\t\tvar prev;\n\t\t// Link to older string with same hash index. To limit the size of this\n\t\t// array to 64K, this link is maintained only for the last 32K strings.\n\t\t// An index in this array is thus a window index modulo 32K.\n\n\t\tvar head; // Heads of the hash chains or NIL.\n\n\t\tvar ins_h; // hash index of string to be inserted\n\t\tvar hash_size; // number of elements in hash table\n\t\tvar hash_bits; // log2(hash_size)\n\t\tvar hash_mask; // hash_size-1\n\n\t\t// Number of bits by which ins_h must be shifted at each input\n\t\t// step. It must be such that after MIN_MATCH steps, the oldest\n\t\t// byte no longer takes part in the hash key, that is:\n\t\t// hash_shift * MIN_MATCH >= hash_bits\n\t\tvar hash_shift;\n\n\t\t// Window position at the beginning of the current output block. Gets\n\t\t// negative when the window is moved backwards.\n\n\t\tvar block_start;\n\n\t\tvar match_length; // length of best match\n\t\tvar prev_match; // previous match\n\t\tvar match_available; // set if previous match exists\n\t\tvar strstart; // start of string to insert\n\t\tvar match_start; // start of matching string\n\t\tvar lookahead; // number of valid bytes ahead in window\n\n\t\t// Length of the best match at previous step. Matches not greater than this\n\t\t// are discarded. This is used in the lazy match evaluation.\n\t\tvar prev_length;\n\n\t\t// To speed up deflation, hash chains are never searched beyond this\n\t\t// length. A higher limit improves compression ratio but degrades the speed.\n\t\tvar max_chain_length;\n\n\t\t// Attempt to find a better match only when the current match is strictly\n\t\t// smaller than this value. This mechanism is used only for compression\n\t\t// levels >= 4.\n\t\tvar max_lazy_match;\n\n\t\t// Insert new strings in the hash table only if the match length is not\n\t\t// greater than this length. This saves time but degrades compression.\n\t\t// max_insert_length is used only for compression levels <= 3.\n\n\t\tvar level; // compression level (1..9)\n\t\tvar strategy; // favor or force Huffman coding\n\n\t\t// Use a faster search when the previous match is longer than this\n\t\tvar good_match;\n\n\t\t// Stop searching when current match exceeds this\n\t\tvar nice_match;\n\n\t\tvar dyn_ltree; // literal and length tree\n\t\tvar dyn_dtree; // distance tree\n\t\tvar bl_tree; // Huffman tree for bit lengths\n\n\t\tvar l_desc = new Tree(); // desc for literal tree\n\t\tvar d_desc = new Tree(); // desc for distance tree\n\t\tvar bl_desc = new Tree(); // desc for bit length tree\n\n\t\t// that.heap_len; // number of elements in the heap\n\t\t// that.heap_max; // element of largest frequency\n\t\t// The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n\t\t// The same heap array is used to build all trees.\n\n\t\t// Depth of each subtree used as tie breaker for trees of equal frequency\n\t\tthat.depth = [];\n\n\t\tvar l_buf; // index for literals or lengths */\n\n\t\t// Size of match buffer for literals/lengths. There are 4 reasons for\n\t\t// limiting lit_bufsize to 64K:\n\t\t// - frequencies can be kept in 16 bit counters\n\t\t// - if compression is not successful for the first block, all input\n\t\t// data is still in the window so we can still emit a stored block even\n\t\t// when input comes from standard input. (This can also be done for\n\t\t// all blocks if lit_bufsize is not greater than 32K.)\n\t\t// - if compression is not successful for a file smaller than 64K, we can\n\t\t// even emit a stored file instead of a stored block (saving 5 bytes).\n\t\t// This is applicable only for zip (not gzip or zlib).\n\t\t// - creating new Huffman trees less frequently may not provide fast\n\t\t// adaptation to changes in the input data statistics. (Take for\n\t\t// example a binary file with poorly compressible code followed by\n\t\t// a highly compressible string table.) Smaller buffer sizes give\n\t\t// fast adaptation but have of course the overhead of transmitting\n\t\t// trees more frequently.\n\t\t// - I can't count above 4\n\t\tvar lit_bufsize;\n\n\t\tvar last_lit; // running index in l_buf\n\n\t\t// Buffer for distances. To simplify the code, d_buf and l_buf have\n\t\t// the same number of elements. To use different lengths, an extra flag\n\t\t// array would be necessary.\n\n\t\tvar d_buf; // index of pendig_buf\n\n\t\t// that.opt_len; // bit length of current block with optimal trees\n\t\t// that.static_len; // bit length of current block with static trees\n\t\tvar matches; // number of string matches in current block\n\t\tvar last_eob_len; // bit length of EOB code for last block\n\n\t\t// Output buffer. bits are inserted starting at the bottom (least\n\t\t// significant bits).\n\t\tvar bi_buf;\n\n\t\t// Number of valid bits in bi_buf. All bits above the last valid bit\n\t\t// are always zero.\n\t\tvar bi_valid;\n\n\t\t// number of codes at each bit length for an optimal tree\n\t\tthat.bl_count = [];\n\n\t\t// heap used to build the Huffman trees\n\t\tthat.heap = [];\n\n\t\tdyn_ltree = [];\n\t\tdyn_dtree = [];\n\t\tbl_tree = [];\n\n\t\tfunction lm_init() {\n\t\t\tvar i;\n\t\t\twindow_size = 2 * w_size;\n\n\t\t\thead[hash_size - 1] = 0;\n\t\t\tfor (i = 0; i < hash_size - 1; i++) {\n\t\t\t\thead[i] = 0;\n\t\t\t}\n\n\t\t\t// Set the default configuration parameters:\n\t\t\tmax_lazy_match = config_table[level].max_lazy;\n\t\t\tgood_match = config_table[level].good_length;\n\t\t\tnice_match = config_table[level].nice_length;\n\t\t\tmax_chain_length = config_table[level].max_chain;\n\n\t\t\tstrstart = 0;\n\t\t\tblock_start = 0;\n\t\t\tlookahead = 0;\n\t\t\tmatch_length = prev_length = MIN_MATCH - 1;\n\t\t\tmatch_available = 0;\n\t\t\tins_h = 0;\n\t\t}\n\n\t\tfunction init_block() {\n\t\t\tvar i;\n\t\t\t// Initialize the trees.\n\t\t\tfor (i = 0; i < L_CODES; i++)\n\t\t\t\tdyn_ltree[i * 2] = 0;\n\t\t\tfor (i = 0; i < D_CODES; i++)\n\t\t\t\tdyn_dtree[i * 2] = 0;\n\t\t\tfor (i = 0; i < BL_CODES; i++)\n\t\t\t\tbl_tree[i * 2] = 0;\n\n\t\t\tdyn_ltree[END_BLOCK * 2] = 1;\n\t\t\tthat.opt_len = that.static_len = 0;\n\t\t\tlast_lit = matches = 0;\n\t\t}\n\n\t\t// Initialize the tree data structures for a new zlib stream.\n\t\tfunction tr_init() {\n\n\t\t\tl_desc.dyn_tree = dyn_ltree;\n\t\t\tl_desc.stat_desc = StaticTree.static_l_desc;\n\n\t\t\td_desc.dyn_tree = dyn_dtree;\n\t\t\td_desc.stat_desc = StaticTree.static_d_desc;\n\n\t\t\tbl_desc.dyn_tree = bl_tree;\n\t\t\tbl_desc.stat_desc = StaticTree.static_bl_desc;\n\n\t\t\tbi_buf = 0;\n\t\t\tbi_valid = 0;\n\t\t\tlast_eob_len = 8; // enough lookahead for inflate\n\n\t\t\t// Initialize the first block of the first file:\n\t\t\tinit_block();\n\t\t}\n\n\t\t// Restore the heap property by moving down the tree starting at node k,\n\t\t// exchanging a node with the smallest of its two sons if necessary,\n\t\t// stopping\n\t\t// when the heap property is re-established (each father smaller than its\n\t\t// two sons).\n\t\tthat.pqdownheap = function(tree, // the tree to restore\n\t\tk // node to move down\n\t\t) {\n\t\t\tvar heap = that.heap;\n\t\t\tvar v = heap[k];\n\t\t\tvar j = k << 1; // left son of k\n\t\t\twhile (j <= that.heap_len) {\n\t\t\t\t// Set j to the smallest of the two sons:\n\t\t\t\tif (j < that.heap_len && smaller(tree, heap[j + 1], heap[j], that.depth)) {\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\t// Exit if v is smaller than both sons\n\t\t\t\tif (smaller(tree, v, heap[j], that.depth))\n\t\t\t\t\tbreak;\n\n\t\t\t\t// Exchange v with the smallest son\n\t\t\t\theap[k] = heap[j];\n\t\t\t\tk = j;\n\t\t\t\t// And continue down the tree, setting j to the left son of k\n\t\t\t\tj <<= 1;\n\t\t\t}\n\t\t\theap[k] = v;\n\t\t};\n\n\t\t// Scan a literal or distance tree to determine the frequencies of the codes\n\t\t// in the bit length tree.\n\t\tfunction scan_tree(tree,// the tree to be scanned\n\t\tmax_code // and its largest code of non zero frequency\n\t\t) {\n\t\t\tvar n; // iterates over all tree elements\n\t\t\tvar prevlen = -1; // last emitted length\n\t\t\tvar curlen; // length of current code\n\t\t\tvar nextlen = tree[0 * 2 + 1]; // length of next code\n\t\t\tvar count = 0; // repeat count of the current code\n\t\t\tvar max_count = 7; // max repeat count\n\t\t\tvar min_count = 4; // min repeat count\n\n\t\t\tif (nextlen === 0) {\n\t\t\t\tmax_count = 138;\n\t\t\t\tmin_count = 3;\n\t\t\t}\n\t\t\ttree[(max_code + 1) * 2 + 1] = 0xffff; // guard\n\n\t\t\tfor (n = 0; n <= max_code; n++) {\n\t\t\t\tcurlen = nextlen;\n\t\t\t\tnextlen = tree[(n + 1) * 2 + 1];\n\t\t\t\tif (++count < max_count && curlen == nextlen) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (count < min_count) {\n\t\t\t\t\tbl_tree[curlen * 2] += count;\n\t\t\t\t} else if (curlen !== 0) {\n\t\t\t\t\tif (curlen != prevlen)\n\t\t\t\t\t\tbl_tree[curlen * 2]++;\n\t\t\t\t\tbl_tree[REP_3_6 * 2]++;\n\t\t\t\t} else if (count <= 10) {\n\t\t\t\t\tbl_tree[REPZ_3_10 * 2]++;\n\t\t\t\t} else {\n\t\t\t\t\tbl_tree[REPZ_11_138 * 2]++;\n\t\t\t\t}\n\t\t\t\tcount = 0;\n\t\t\t\tprevlen = curlen;\n\t\t\t\tif (nextlen === 0) {\n\t\t\t\t\tmax_count = 138;\n\t\t\t\t\tmin_count = 3;\n\t\t\t\t} else if (curlen == nextlen) {\n\t\t\t\t\tmax_count = 6;\n\t\t\t\t\tmin_count = 3;\n\t\t\t\t} else {\n\t\t\t\t\tmax_count = 7;\n\t\t\t\t\tmin_count = 4;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Construct the Huffman tree for the bit lengths and return the index in\n\t\t// bl_order of the last bit length code to send.\n\t\tfunction build_bl_tree() {\n\t\t\tvar max_blindex; // index of last bit length code of non zero freq\n\n\t\t\t// Determine the bit length frequencies for literal and distance trees\n\t\t\tscan_tree(dyn_ltree, l_desc.max_code);\n\t\t\tscan_tree(dyn_dtree, d_desc.max_code);\n\n\t\t\t// Build the bit length tree:\n\t\t\tbl_desc.build_tree(that);\n\t\t\t// opt_len now includes the length of the tree representations, except\n\t\t\t// the lengths of the bit lengths codes and the 5+5+4 bits for the\n\t\t\t// counts.\n\n\t\t\t// Determine the number of bit length codes to send. The pkzip format\n\t\t\t// requires that at least 4 bit length codes be sent. (appnote.txt says\n\t\t\t// 3 but the actual value used is 4.)\n\t\t\tfor (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n\t\t\t\tif (bl_tree[Tree.bl_order[max_blindex] * 2 + 1] !== 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Update opt_len to include the bit length tree and counts\n\t\t\tthat.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n\n\t\t\treturn max_blindex;\n\t\t}\n\n\t\t// Output a byte on the stream.\n\t\t// IN assertion: there is enough room in pending_buf.\n\t\tfunction put_byte(p) {\n\t\t\tthat.pending_buf[that.pending++] = p;\n\t\t}\n\n\t\tfunction put_short(w) {\n\t\t\tput_byte(w & 0xff);\n\t\t\tput_byte((w >>> 8) & 0xff);\n\t\t}\n\n\t\tfunction putShortMSB(b) {\n\t\t\tput_byte((b >> 8) & 0xff);\n\t\t\tput_byte((b & 0xff) & 0xff);\n\t\t}\n\n\t\tfunction send_bits(value, length) {\n\t\t\tvar val, len = length;\n\t\t\tif (bi_valid > Buf_size - len) {\n\t\t\t\tval = value;\n\t\t\t\t// bi_buf |= (val << bi_valid);\n\t\t\t\tbi_buf |= ((val << bi_valid) & 0xffff);\n\t\t\t\tput_short(bi_buf);\n\t\t\t\tbi_buf = val >>> (Buf_size - bi_valid);\n\t\t\t\tbi_valid += len - Buf_size;\n\t\t\t} else {\n\t\t\t\t// bi_buf |= (value) << bi_valid;\n\t\t\t\tbi_buf |= (((value) << bi_valid) & 0xffff);\n\t\t\t\tbi_valid += len;\n\t\t\t}\n\t\t}\n\n\t\tfunction send_code(c, tree) {\n\t\t\tvar c2 = c * 2;\n\t\t\tsend_bits(tree[c2] & 0xffff, tree[c2 + 1] & 0xffff);\n\t\t}\n\n\t\t// Send a literal or distance tree in compressed form, using the codes in\n\t\t// bl_tree.\n\t\tfunction send_tree(tree,// the tree to be sent\n\t\tmax_code // and its largest code of non zero frequency\n\t\t) {\n\t\t\tvar n; // iterates over all tree elements\n\t\t\tvar prevlen = -1; // last emitted length\n\t\t\tvar curlen; // length of current code\n\t\t\tvar nextlen = tree[0 * 2 + 1]; // length of next code\n\t\t\tvar count = 0; // repeat count of the current code\n\t\t\tvar max_count = 7; // max repeat count\n\t\t\tvar min_count = 4; // min repeat count\n\n\t\t\tif (nextlen === 0) {\n\t\t\t\tmax_count = 138;\n\t\t\t\tmin_count = 3;\n\t\t\t}\n\n\t\t\tfor (n = 0; n <= max_code; n++) {\n\t\t\t\tcurlen = nextlen;\n\t\t\t\tnextlen = tree[(n + 1) * 2 + 1];\n\t\t\t\tif (++count < max_count && curlen == nextlen) {\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (count < min_count) {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tsend_code(curlen, bl_tree);\n\t\t\t\t\t} while (--count !== 0);\n\t\t\t\t} else if (curlen !== 0) {\n\t\t\t\t\tif (curlen != prevlen) {\n\t\t\t\t\t\tsend_code(curlen, bl_tree);\n\t\t\t\t\t\tcount--;\n\t\t\t\t\t}\n\t\t\t\t\tsend_code(REP_3_6, bl_tree);\n\t\t\t\t\tsend_bits(count - 3, 2);\n\t\t\t\t} else if (count <= 10) {\n\t\t\t\t\tsend_code(REPZ_3_10, bl_tree);\n\t\t\t\t\tsend_bits(count - 3, 3);\n\t\t\t\t} else {\n\t\t\t\t\tsend_code(REPZ_11_138, bl_tree);\n\t\t\t\t\tsend_bits(count - 11, 7);\n\t\t\t\t}\n\t\t\t\tcount = 0;\n\t\t\t\tprevlen = curlen;\n\t\t\t\tif (nextlen === 0) {\n\t\t\t\t\tmax_count = 138;\n\t\t\t\t\tmin_count = 3;\n\t\t\t\t} else if (curlen == nextlen) {\n\t\t\t\t\tmax_count = 6;\n\t\t\t\t\tmin_count = 3;\n\t\t\t\t} else {\n\t\t\t\t\tmax_count = 7;\n\t\t\t\t\tmin_count = 4;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Send the header for a block using dynamic Huffman trees: the counts, the\n\t\t// lengths of the bit length codes, the literal tree and the distance tree.\n\t\t// IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n\t\tfunction send_all_trees(lcodes, dcodes, blcodes) {\n\t\t\tvar rank; // index in bl_order\n\n\t\t\tsend_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt\n\t\t\tsend_bits(dcodes - 1, 5);\n\t\t\tsend_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt\n\t\t\tfor (rank = 0; rank < blcodes; rank++) {\n\t\t\t\tsend_bits(bl_tree[Tree.bl_order[rank] * 2 + 1], 3);\n\t\t\t}\n\t\t\tsend_tree(dyn_ltree, lcodes - 1); // literal tree\n\t\t\tsend_tree(dyn_dtree, dcodes - 1); // distance tree\n\t\t}\n\n\t\t// Flush the bit buffer, keeping at most 7 bits in it.\n\t\tfunction bi_flush() {\n\t\t\tif (bi_valid == 16) {\n\t\t\t\tput_short(bi_buf);\n\t\t\t\tbi_buf = 0;\n\t\t\t\tbi_valid = 0;\n\t\t\t} else if (bi_valid >= 8) {\n\t\t\t\tput_byte(bi_buf & 0xff);\n\t\t\t\tbi_buf >>>= 8;\n\t\t\t\tbi_valid -= 8;\n\t\t\t}\n\t\t}\n\n\t\t// Send one empty static block to give enough lookahead for inflate.\n\t\t// This takes 10 bits, of which 7 may remain in the bit buffer.\n\t\t// The current inflate code requires 9 bits of lookahead. If the\n\t\t// last two codes for the previous block (real code plus EOB) were coded\n\t\t// on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode\n\t\t// the last real code. In this case we send two empty static blocks instead\n\t\t// of one. (There are no problems if the previous block is stored or fixed.)\n\t\t// To simplify the code, we assume the worst case of last real code encoded\n\t\t// on one bit only.\n\t\tfunction _tr_align() {\n\t\t\tsend_bits(STATIC_TREES << 1, 3);\n\t\t\tsend_code(END_BLOCK, StaticTree.static_ltree);\n\n\t\t\tbi_flush();\n\n\t\t\t// Of the 10 bits for the empty block, we have already sent\n\t\t\t// (10 - bi_valid) bits. The lookahead for the last real code (before\n\t\t\t// the EOB of the previous block) was thus at least one plus the length\n\t\t\t// of the EOB plus what we have just sent of the empty static block.\n\t\t\tif (1 + last_eob_len + 10 - bi_valid < 9) {\n\t\t\t\tsend_bits(STATIC_TREES << 1, 3);\n\t\t\t\tsend_code(END_BLOCK, StaticTree.static_ltree);\n\t\t\t\tbi_flush();\n\t\t\t}\n\t\t\tlast_eob_len = 7;\n\t\t}\n\n\t\t// Save the match info and tally the frequency counts. Return true if\n\t\t// the current block must be flushed.\n\t\tfunction _tr_tally(dist, // distance of matched string\n\t\tlc // match length-MIN_MATCH or unmatched char (if dist==0)\n\t\t) {\n\t\t\tvar out_length, in_length, dcode;\n\t\t\tthat.pending_buf[d_buf + last_lit * 2] = (dist >>> 8) & 0xff;\n\t\t\tthat.pending_buf[d_buf + last_lit * 2 + 1] = dist & 0xff;\n\n\t\t\tthat.pending_buf[l_buf + last_lit] = lc & 0xff;\n\t\t\tlast_lit++;\n\n\t\t\tif (dist === 0) {\n\t\t\t\t// lc is the unmatched char\n\t\t\t\tdyn_ltree[lc * 2]++;\n\t\t\t} else {\n\t\t\t\tmatches++;\n\t\t\t\t// Here, lc is the match length - MIN_MATCH\n\t\t\t\tdist--; // dist = match distance - 1\n\t\t\t\tdyn_ltree[(Tree._length_code[lc] + LITERALS + 1) * 2]++;\n\t\t\t\tdyn_dtree[Tree.d_code(dist) * 2]++;\n\t\t\t}\n\n\t\t\tif ((last_lit & 0x1fff) === 0 && level > 2) {\n\t\t\t\t// Compute an upper bound for the compressed length\n\t\t\t\tout_length = last_lit * 8;\n\t\t\t\tin_length = strstart - block_start;\n\t\t\t\tfor (dcode = 0; dcode < D_CODES; dcode++) {\n\t\t\t\t\tout_length += dyn_dtree[dcode * 2] * (5 + Tree.extra_dbits[dcode]);\n\t\t\t\t}\n\t\t\t\tout_length >>>= 3;\n\t\t\t\tif ((matches < Math.floor(last_lit / 2)) && out_length < Math.floor(in_length / 2))\n\t\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn (last_lit == lit_bufsize - 1);\n\t\t\t// We avoid equality with lit_bufsize because of wraparound at 64K\n\t\t\t// on 16 bit machines and because stored blocks are restricted to\n\t\t\t// 64K-1 bytes.\n\t\t}\n\n\t\t// Send the block data compressed using the given Huffman trees\n\t\tfunction compress_block(ltree, dtree) {\n\t\t\tvar dist; // distance of matched string\n\t\t\tvar lc; // match length or unmatched char (if dist === 0)\n\t\t\tvar lx = 0; // running index in l_buf\n\t\t\tvar code; // the code to send\n\t\t\tvar extra; // number of extra bits to send\n\n\t\t\tif (last_lit !== 0) {\n\t\t\t\tdo {\n\t\t\t\t\tdist = ((that.pending_buf[d_buf + lx * 2] << 8) & 0xff00) | (that.pending_buf[d_buf + lx * 2 + 1] & 0xff);\n\t\t\t\t\tlc = (that.pending_buf[l_buf + lx]) & 0xff;\n\t\t\t\t\tlx++;\n\n\t\t\t\t\tif (dist === 0) {\n\t\t\t\t\t\tsend_code(lc, ltree); // send a literal byte\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Here, lc is the match length - MIN_MATCH\n\t\t\t\t\t\tcode = Tree._length_code[lc];\n\n\t\t\t\t\t\tsend_code(code + LITERALS + 1, ltree); // send the length\n\t\t\t\t\t\t// code\n\t\t\t\t\t\textra = Tree.extra_lbits[code];\n\t\t\t\t\t\tif (extra !== 0) {\n\t\t\t\t\t\t\tlc -= Tree.base_length[code];\n\t\t\t\t\t\t\tsend_bits(lc, extra); // send the extra length bits\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdist--; // dist is now the match distance - 1\n\t\t\t\t\t\tcode = Tree.d_code(dist);\n\n\t\t\t\t\t\tsend_code(code, dtree); // send the distance code\n\t\t\t\t\t\textra = Tree.extra_dbits[code];\n\t\t\t\t\t\tif (extra !== 0) {\n\t\t\t\t\t\t\tdist -= Tree.base_dist[code];\n\t\t\t\t\t\t\tsend_bits(dist, extra); // send the extra distance bits\n\t\t\t\t\t\t}\n\t\t\t\t\t} // literal or match pair ?\n\n\t\t\t\t\t// Check that the overlay between pending_buf and d_buf+l_buf is\n\t\t\t\t\t// ok:\n\t\t\t\t} while (lx < last_lit);\n\t\t\t}\n\n\t\t\tsend_code(END_BLOCK, ltree);\n\t\t\tlast_eob_len = ltree[END_BLOCK * 2 + 1];\n\t\t}\n\n\t\t// Flush the bit buffer and align the output on a byte boundary\n\t\tfunction bi_windup() {\n\t\t\tif (bi_valid > 8) {\n\t\t\t\tput_short(bi_buf);\n\t\t\t} else if (bi_valid > 0) {\n\t\t\t\tput_byte(bi_buf & 0xff);\n\t\t\t}\n\t\t\tbi_buf = 0;\n\t\t\tbi_valid = 0;\n\t\t}\n\n\t\t// Copy a stored block, storing first the length and its\n\t\t// one's complement if requested.\n\t\tfunction copy_block(buf, // the input data\n\t\tlen, // its length\n\t\theader // true if block header must be written\n\t\t) {\n\t\t\tbi_windup(); // align on byte boundary\n\t\t\tlast_eob_len = 8; // enough lookahead for inflate\n\n\t\t\tif (header) {\n\t\t\t\tput_short(len);\n\t\t\t\tput_short(~len);\n\t\t\t}\n\n\t\t\tthat.pending_buf.set(window.subarray(buf, buf + len), that.pending);\n\t\t\tthat.pending += len;\n\t\t}\n\n\t\t// Send a stored block\n\t\tfunction _tr_stored_block(buf, // input block\n\t\tstored_len, // length of input block\n\t\teof // true if this is the last block for a file\n\t\t) {\n\t\t\tsend_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3); // send block type\n\t\t\tcopy_block(buf, stored_len, true); // with header\n\t\t}\n\n\t\t// Determine the best encoding for the current block: dynamic trees, static\n\t\t// trees or store, and output the encoded block to the zip file.\n\t\tfunction _tr_flush_block(buf, // input block, or NULL if too old\n\t\tstored_len, // length of input block\n\t\teof // true if this is the last block for a file\n\t\t) {\n\t\t\tvar opt_lenb, static_lenb;// opt_len and static_len in bytes\n\t\t\tvar max_blindex = 0; // index of last bit length code of non zero freq\n\n\t\t\t// Build the Huffman trees unless a stored block is forced\n\t\t\tif (level > 0) {\n\t\t\t\t// Construct the literal and distance trees\n\t\t\t\tl_desc.build_tree(that);\n\n\t\t\t\td_desc.build_tree(that);\n\n\t\t\t\t// At this point, opt_len and static_len are the total bit lengths\n\t\t\t\t// of\n\t\t\t\t// the compressed block data, excluding the tree representations.\n\n\t\t\t\t// Build the bit length tree for the above two trees, and get the\n\t\t\t\t// index\n\t\t\t\t// in bl_order of the last bit length code to send.\n\t\t\t\tmax_blindex = build_bl_tree();\n\n\t\t\t\t// Determine the best encoding. Compute first the block length in\n\t\t\t\t// bytes\n\t\t\t\topt_lenb = (that.opt_len + 3 + 7) >>> 3;\n\t\t\t\tstatic_lenb = (that.static_len + 3 + 7) >>> 3;\n\n\t\t\t\tif (static_lenb <= opt_lenb)\n\t\t\t\t\topt_lenb = static_lenb;\n\t\t\t} else {\n\t\t\t\topt_lenb = static_lenb = stored_len + 5; // force a stored block\n\t\t\t}\n\n\t\t\tif ((stored_len + 4 <= opt_lenb) && buf != -1) {\n\t\t\t\t// 4: two words for the lengths\n\t\t\t\t// The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n\t\t\t\t// Otherwise we can't have processed more than WSIZE input bytes\n\t\t\t\t// since\n\t\t\t\t// the last block flush, because compression would have been\n\t\t\t\t// successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n\t\t\t\t// transform a block into a stored block.\n\t\t\t\t_tr_stored_block(buf, stored_len, eof);\n\t\t\t} else if (static_lenb == opt_lenb) {\n\t\t\t\tsend_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3);\n\t\t\t\tcompress_block(StaticTree.static_ltree, StaticTree.static_dtree);\n\t\t\t} else {\n\t\t\t\tsend_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3);\n\t\t\t\tsend_all_trees(l_desc.max_code + 1, d_desc.max_code + 1, max_blindex + 1);\n\t\t\t\tcompress_block(dyn_ltree, dyn_dtree);\n\t\t\t}\n\n\t\t\t// The above check is made mod 2^32, for files larger than 512 MB\n\t\t\t// and uLong implemented on 32 bits.\n\n\t\t\tinit_block();\n\n\t\t\tif (eof) {\n\t\t\t\tbi_windup();\n\t\t\t}\n\t\t}\n\n\t\tfunction flush_block_only(eof) {\n\t\t\t_tr_flush_block(block_start >= 0 ? block_start : -1, strstart - block_start, eof);\n\t\t\tblock_start = strstart;\n\t\t\tstrm.flush_pending();\n\t\t}\n\n\t\t// Fill the window when the lookahead becomes insufficient.\n\t\t// Updates strstart and lookahead.\n\t\t//\n\t\t// IN assertion: lookahead < MIN_LOOKAHEAD\n\t\t// OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n\t\t// At least one byte has been read, or avail_in === 0; reads are\n\t\t// performed for at least two bytes (required for the zip translate_eol\n\t\t// option -- not supported here).\n\t\tfunction fill_window() {\n\t\t\tvar n, m;\n\t\t\tvar p;\n\t\t\tvar more; // Amount of free space at the end of the window.\n\n\t\t\tdo {\n\t\t\t\tmore = (window_size - lookahead - strstart);\n\n\t\t\t\t// Deal with !@#$% 64K limit:\n\t\t\t\tif (more === 0 && strstart === 0 && lookahead === 0) {\n\t\t\t\t\tmore = w_size;\n\t\t\t\t} else if (more == -1) {\n\t\t\t\t\t// Very unlikely, but possible on 16 bit machine if strstart ==\n\t\t\t\t\t// 0\n\t\t\t\t\t// and lookahead == 1 (input done one byte at time)\n\t\t\t\t\tmore--;\n\n\t\t\t\t\t// If the window is almost full and there is insufficient\n\t\t\t\t\t// lookahead,\n\t\t\t\t\t// move the upper half to the lower one to make room in the\n\t\t\t\t\t// upper half.\n\t\t\t\t} else if (strstart >= w_size + w_size - MIN_LOOKAHEAD) {\n\t\t\t\t\twindow.set(window.subarray(w_size, w_size + w_size), 0);\n\n\t\t\t\t\tmatch_start -= w_size;\n\t\t\t\t\tstrstart -= w_size; // we now have strstart >= MAX_DIST\n\t\t\t\t\tblock_start -= w_size;\n\n\t\t\t\t\t// Slide the hash table (could be avoided with 32 bit values\n\t\t\t\t\t// at the expense of memory usage). We slide even when level ==\n\t\t\t\t\t// 0\n\t\t\t\t\t// to keep the hash table consistent if we switch back to level\n\t\t\t\t\t// > 0\n\t\t\t\t\t// later. (Using level 0 permanently is not an optimal usage of\n\t\t\t\t\t// zlib, so we don't care about this pathological case.)\n\n\t\t\t\t\tn = hash_size;\n\t\t\t\t\tp = n;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tm = (head[--p] & 0xffff);\n\t\t\t\t\t\thead[p] = (m >= w_size ? m - w_size : 0);\n\t\t\t\t\t} while (--n !== 0);\n\n\t\t\t\t\tn = w_size;\n\t\t\t\t\tp = n;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tm = (prev[--p] & 0xffff);\n\t\t\t\t\t\tprev[p] = (m >= w_size ? m - w_size : 0);\n\t\t\t\t\t\t// If n is not on any hash chain, prev[n] is garbage but\n\t\t\t\t\t\t// its value will never be used.\n\t\t\t\t\t} while (--n !== 0);\n\t\t\t\t\tmore += w_size;\n\t\t\t\t}\n\n\t\t\t\tif (strm.avail_in === 0)\n\t\t\t\t\treturn;\n\n\t\t\t\t// If there was no sliding:\n\t\t\t\t// strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n\t\t\t\t// more == window_size - lookahead - strstart\n\t\t\t\t// => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n\t\t\t\t// => more >= window_size - 2*WSIZE + 2\n\t\t\t\t// In the BIG_MEM or MMAP case (not yet supported),\n\t\t\t\t// window_size == input_size + MIN_LOOKAHEAD &&\n\t\t\t\t// strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n\t\t\t\t// Otherwise, window_size == 2*WSIZE so more >= 2.\n\t\t\t\t// If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n\n\t\t\t\tn = strm.read_buf(window, strstart + lookahead, more);\n\t\t\t\tlookahead += n;\n\n\t\t\t\t// Initialize the hash value now that we have some input:\n\t\t\t\tif (lookahead >= MIN_MATCH) {\n\t\t\t\t\tins_h = window[strstart] & 0xff;\n\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;\n\t\t\t\t}\n\t\t\t\t// If the whole input has less than MIN_MATCH bytes, ins_h is\n\t\t\t\t// garbage,\n\t\t\t\t// but this is not important since only literal bytes will be\n\t\t\t\t// emitted.\n\t\t\t} while (lookahead < MIN_LOOKAHEAD && strm.avail_in !== 0);\n\t\t}\n\n\t\t// Copy without compression as much as possible from the input stream,\n\t\t// return\n\t\t// the current block state.\n\t\t// This function does not insert new strings in the dictionary since\n\t\t// uncompressible data is probably not useful. This function is used\n\t\t// only for the level=0 compression option.\n\t\t// NOTE: this function should be optimized to avoid extra copying from\n\t\t// window to pending_buf.\n\t\tfunction deflate_stored(flush) {\n\t\t\t// Stored blocks are limited to 0xffff bytes, pending_buf is limited\n\t\t\t// to pending_buf_size, and each stored block has a 5 byte header:\n\n\t\t\tvar max_block_size = 0xffff;\n\t\t\tvar max_start;\n\n\t\t\tif (max_block_size > pending_buf_size - 5) {\n\t\t\t\tmax_block_size = pending_buf_size - 5;\n\t\t\t}\n\n\t\t\t// Copy as much as possible from input to output:\n\t\t\twhile (true) {\n\t\t\t\t// Fill the window as much as possible:\n\t\t\t\tif (lookahead <= 1) {\n\t\t\t\t\tfill_window();\n\t\t\t\t\tif (lookahead === 0 && flush == Z_NO_FLUSH)\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t\tif (lookahead === 0)\n\t\t\t\t\t\tbreak; // flush the current block\n\t\t\t\t}\n\n\t\t\t\tstrstart += lookahead;\n\t\t\t\tlookahead = 0;\n\n\t\t\t\t// Emit a stored block if pending_buf will be full:\n\t\t\t\tmax_start = block_start + max_block_size;\n\t\t\t\tif (strstart === 0 || strstart >= max_start) {\n\t\t\t\t\t// strstart === 0 is possible when wraparound on 16-bit machine\n\t\t\t\t\tlookahead = (strstart - max_start);\n\t\t\t\t\tstrstart = max_start;\n\n\t\t\t\t\tflush_block_only(false);\n\t\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\t\treturn NeedMore;\n\n\t\t\t\t}\n\n\t\t\t\t// Flush if we may have to slide, otherwise block_start may become\n\t\t\t\t// negative and the data will be gone:\n\t\t\t\tif (strstart - block_start >= w_size - MIN_LOOKAHEAD) {\n\t\t\t\t\tflush_block_only(false);\n\t\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tflush_block_only(flush == Z_FINISH);\n\t\t\tif (strm.avail_out === 0)\n\t\t\t\treturn (flush == Z_FINISH) ? FinishStarted : NeedMore;\n\n\t\t\treturn flush == Z_FINISH ? FinishDone : BlockDone;\n\t\t}\n\n\t\tfunction longest_match(cur_match) {\n\t\t\tvar chain_length = max_chain_length; // max hash chain length\n\t\t\tvar scan = strstart; // current string\n\t\t\tvar match; // matched string\n\t\t\tvar len; // length of current match\n\t\t\tvar best_len = prev_length; // best match length so far\n\t\t\tvar limit = strstart > (w_size - MIN_LOOKAHEAD) ? strstart - (w_size - MIN_LOOKAHEAD) : 0;\n\t\t\tvar _nice_match = nice_match;\n\n\t\t\t// Stop when cur_match becomes <= limit. To simplify the code,\n\t\t\t// we prevent matches with the string of window index 0.\n\n\t\t\tvar wmask = w_mask;\n\n\t\t\tvar strend = strstart + MAX_MATCH;\n\t\t\tvar scan_end1 = window[scan + best_len - 1];\n\t\t\tvar scan_end = window[scan + best_len];\n\n\t\t\t// The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of\n\t\t\t// 16.\n\t\t\t// It is easy to get rid of this optimization if necessary.\n\n\t\t\t// Do not waste too much time if we already have a good match:\n\t\t\tif (prev_length >= good_match) {\n\t\t\t\tchain_length >>= 2;\n\t\t\t}\n\n\t\t\t// Do not look for matches beyond the end of the input. This is\n\t\t\t// necessary\n\t\t\t// to make deflate deterministic.\n\t\t\tif (_nice_match > lookahead)\n\t\t\t\t_nice_match = lookahead;\n\n\t\t\tdo {\n\t\t\t\tmatch = cur_match;\n\n\t\t\t\t// Skip to next match if the match length cannot increase\n\t\t\t\t// or if the match length is less than 2:\n\t\t\t\tif (window[match + best_len] != scan_end || window[match + best_len - 1] != scan_end1 || window[match] != window[scan]\n\t\t\t\t\t\t|| window[++match] != window[scan + 1])\n\t\t\t\t\tcontinue;\n\n\t\t\t\t// The check at best_len-1 can be removed because it will be made\n\t\t\t\t// again later. (This heuristic is not always a win.)\n\t\t\t\t// It is not necessary to compare scan[2] and match[2] since they\n\t\t\t\t// are always equal when the other bytes match, given that\n\t\t\t\t// the hash keys are equal and that HASH_BITS >= 8.\n\t\t\t\tscan += 2;\n\t\t\t\tmatch++;\n\n\t\t\t\t// We check for insufficient lookahead only every 8th comparison;\n\t\t\t\t// the 256th check will be made at strstart+258.\n\t\t\t\tdo {\n\t\t\t\t} while (window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match]\n\t\t\t\t\t\t&& window[++scan] == window[++match] && window[++scan] == window[++match] && window[++scan] == window[++match]\n\t\t\t\t\t\t&& window[++scan] == window[++match] && window[++scan] == window[++match] && scan < strend);\n\n\t\t\t\tlen = MAX_MATCH - (strend - scan);\n\t\t\t\tscan = strend - MAX_MATCH;\n\n\t\t\t\tif (len > best_len) {\n\t\t\t\t\tmatch_start = cur_match;\n\t\t\t\t\tbest_len = len;\n\t\t\t\t\tif (len >= _nice_match)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tscan_end1 = window[scan + best_len - 1];\n\t\t\t\t\tscan_end = window[scan + best_len];\n\t\t\t\t}\n\n\t\t\t} while ((cur_match = (prev[cur_match & wmask] & 0xffff)) > limit && --chain_length !== 0);\n\n\t\t\tif (best_len <= lookahead)\n\t\t\t\treturn best_len;\n\t\t\treturn lookahead;\n\t\t}\n\n\t\t// Compress as much as possible from the input stream, return the current\n\t\t// block state.\n\t\t// This function does not perform lazy evaluation of matches and inserts\n\t\t// new strings in the dictionary only for unmatched strings or for short\n\t\t// matches. It is used only for the fast compression options.\n\t\tfunction deflate_fast(flush) {\n\t\t\t// short hash_head = 0; // head of the hash chain\n\t\t\tvar hash_head = 0; // head of the hash chain\n\t\t\tvar bflush; // set if current block must be flushed\n\n\t\t\twhile (true) {\n\t\t\t\t// Make sure that we always have enough lookahead, except\n\t\t\t\t// at the end of the input file. We need MAX_MATCH bytes\n\t\t\t\t// for the next match, plus MIN_MATCH bytes to insert the\n\t\t\t\t// string following the next match.\n\t\t\t\tif (lookahead < MIN_LOOKAHEAD) {\n\t\t\t\t\tfill_window();\n\t\t\t\t\tif (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t\t}\n\t\t\t\t\tif (lookahead === 0)\n\t\t\t\t\t\tbreak; // flush the current block\n\t\t\t\t}\n\n\t\t\t\t// Insert the string window[strstart .. strstart+2] in the\n\t\t\t\t// dictionary, and set hash_head to the head of the hash chain:\n\t\t\t\tif (lookahead >= MIN_MATCH) {\n\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\n\t\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\t\thead[ins_h] = strstart;\n\t\t\t\t}\n\n\t\t\t\t// Find the longest match, discarding those <= prev_length.\n\t\t\t\t// At this point we have always match_length < MIN_MATCH\n\n\t\t\t\tif (hash_head !== 0 && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) {\n\t\t\t\t\t// To simplify the code, we prevent matches with the string\n\t\t\t\t\t// of window index 0 (in particular we have to avoid a match\n\t\t\t\t\t// of the string with itself at the start of the input file).\n\t\t\t\t\tif (strategy != Z_HUFFMAN_ONLY) {\n\t\t\t\t\t\tmatch_length = longest_match(hash_head);\n\t\t\t\t\t}\n\t\t\t\t\t// longest_match() sets match_start\n\t\t\t\t}\n\t\t\t\tif (match_length >= MIN_MATCH) {\n\t\t\t\t\t// check_match(strstart, match_start, match_length);\n\n\t\t\t\t\tbflush = _tr_tally(strstart - match_start, match_length - MIN_MATCH);\n\n\t\t\t\t\tlookahead -= match_length;\n\n\t\t\t\t\t// Insert new strings in the hash table only if the match length\n\t\t\t\t\t// is not too large. This saves time but degrades compression.\n\t\t\t\t\tif (match_length <= max_lazy_match && lookahead >= MIN_MATCH) {\n\t\t\t\t\t\tmatch_length--; // string at strstart already in hash table\n\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\tstrstart++;\n\n\t\t\t\t\t\t\tins_h = ((ins_h << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\t\t\t\thead[ins_h] = strstart;\n\n\t\t\t\t\t\t\t// strstart never exceeds WSIZE-MAX_MATCH, so there are\n\t\t\t\t\t\t\t// always MIN_MATCH bytes ahead.\n\t\t\t\t\t\t} while (--match_length !== 0);\n\t\t\t\t\t\tstrstart++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstrstart += match_length;\n\t\t\t\t\t\tmatch_length = 0;\n\t\t\t\t\t\tins_h = window[strstart] & 0xff;\n\n\t\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;\n\t\t\t\t\t\t// If lookahead < MIN_MATCH, ins_h is garbage, but it does\n\t\t\t\t\t\t// not\n\t\t\t\t\t\t// matter since it will be recomputed at next deflate call.\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// No match, output a literal byte\n\n\t\t\t\t\tbflush = _tr_tally(0, window[strstart] & 0xff);\n\t\t\t\t\tlookahead--;\n\t\t\t\t\tstrstart++;\n\t\t\t\t}\n\t\t\t\tif (bflush) {\n\n\t\t\t\t\tflush_block_only(false);\n\t\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tflush_block_only(flush == Z_FINISH);\n\t\t\tif (strm.avail_out === 0) {\n\t\t\t\tif (flush == Z_FINISH)\n\t\t\t\t\treturn FinishStarted;\n\t\t\t\telse\n\t\t\t\t\treturn NeedMore;\n\t\t\t}\n\t\t\treturn flush == Z_FINISH ? FinishDone : BlockDone;\n\t\t}\n\n\t\t// Same as above, but achieves better compression. We use a lazy\n\t\t// evaluation for matches: a match is finally adopted only if there is\n\t\t// no better match at the next window position.\n\t\tfunction deflate_slow(flush) {\n\t\t\t// short hash_head = 0; // head of hash chain\n\t\t\tvar hash_head = 0; // head of hash chain\n\t\t\tvar bflush; // set if current block must be flushed\n\t\t\tvar max_insert;\n\n\t\t\t// Process the input block.\n\t\t\twhile (true) {\n\t\t\t\t// Make sure that we always have enough lookahead, except\n\t\t\t\t// at the end of the input file. We need MAX_MATCH bytes\n\t\t\t\t// for the next match, plus MIN_MATCH bytes to insert the\n\t\t\t\t// string following the next match.\n\n\t\t\t\tif (lookahead < MIN_LOOKAHEAD) {\n\t\t\t\t\tfill_window();\n\t\t\t\t\tif (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t\t}\n\t\t\t\t\tif (lookahead === 0)\n\t\t\t\t\t\tbreak; // flush the current block\n\t\t\t\t}\n\n\t\t\t\t// Insert the string window[strstart .. strstart+2] in the\n\t\t\t\t// dictionary, and set hash_head to the head of the hash chain:\n\n\t\t\t\tif (lookahead >= MIN_MATCH) {\n\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\t\thead[ins_h] = strstart;\n\t\t\t\t}\n\n\t\t\t\t// Find the longest match, discarding those <= prev_length.\n\t\t\t\tprev_length = match_length;\n\t\t\t\tprev_match = match_start;\n\t\t\t\tmatch_length = MIN_MATCH - 1;\n\n\t\t\t\tif (hash_head !== 0 && prev_length < max_lazy_match && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD) {\n\t\t\t\t\t// To simplify the code, we prevent matches with the string\n\t\t\t\t\t// of window index 0 (in particular we have to avoid a match\n\t\t\t\t\t// of the string with itself at the start of the input file).\n\n\t\t\t\t\tif (strategy != Z_HUFFMAN_ONLY) {\n\t\t\t\t\t\tmatch_length = longest_match(hash_head);\n\t\t\t\t\t}\n\t\t\t\t\t// longest_match() sets match_start\n\n\t\t\t\t\tif (match_length <= 5 && (strategy == Z_FILTERED || (match_length == MIN_MATCH && strstart - match_start > 4096))) {\n\n\t\t\t\t\t\t// If prev_match is also MIN_MATCH, match_start is garbage\n\t\t\t\t\t\t// but we will ignore the current match anyway.\n\t\t\t\t\t\tmatch_length = MIN_MATCH - 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If there was a match at the previous step and the current\n\t\t\t\t// match is not better, output the previous match:\n\t\t\t\tif (prev_length >= MIN_MATCH && match_length <= prev_length) {\n\t\t\t\t\tmax_insert = strstart + lookahead - MIN_MATCH;\n\t\t\t\t\t// Do not insert strings in hash table beyond this.\n\n\t\t\t\t\t// check_match(strstart-1, prev_match, prev_length);\n\n\t\t\t\t\tbflush = _tr_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH);\n\n\t\t\t\t\t// Insert in hash table all strings up to the end of the match.\n\t\t\t\t\t// strstart-1 and strstart are already inserted. If there is not\n\t\t\t\t\t// enough lookahead, the last two strings are not inserted in\n\t\t\t\t\t// the hash table.\n\t\t\t\t\tlookahead -= prev_length - 1;\n\t\t\t\t\tprev_length -= 2;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (++strstart <= max_insert) {\n\t\t\t\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\t\t\t\t// prev[strstart&w_mask]=hash_head=head[ins_h];\n\t\t\t\t\t\t\thash_head = (head[ins_h] & 0xffff);\n\t\t\t\t\t\t\tprev[strstart & w_mask] = head[ins_h];\n\t\t\t\t\t\t\thead[ins_h] = strstart;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while (--prev_length !== 0);\n\t\t\t\t\tmatch_available = 0;\n\t\t\t\t\tmatch_length = MIN_MATCH - 1;\n\t\t\t\t\tstrstart++;\n\n\t\t\t\t\tif (bflush) {\n\t\t\t\t\t\tflush_block_only(false);\n\t\t\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t\t}\n\t\t\t\t} else if (match_available !== 0) {\n\n\t\t\t\t\t// If there was no match at the previous position, output a\n\t\t\t\t\t// single literal. If there was a match but the current match\n\t\t\t\t\t// is longer, truncate the previous match to a single literal.\n\n\t\t\t\t\tbflush = _tr_tally(0, window[strstart - 1] & 0xff);\n\n\t\t\t\t\tif (bflush) {\n\t\t\t\t\t\tflush_block_only(false);\n\t\t\t\t\t}\n\t\t\t\t\tstrstart++;\n\t\t\t\t\tlookahead--;\n\t\t\t\t\tif (strm.avail_out === 0)\n\t\t\t\t\t\treturn NeedMore;\n\t\t\t\t} else {\n\t\t\t\t\t// There is no previous match to compare with, wait for\n\t\t\t\t\t// the next step to decide.\n\n\t\t\t\t\tmatch_available = 1;\n\t\t\t\t\tstrstart++;\n\t\t\t\t\tlookahead--;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (match_available !== 0) {\n\t\t\t\tbflush = _tr_tally(0, window[strstart - 1] & 0xff);\n\t\t\t\tmatch_available = 0;\n\t\t\t}\n\t\t\tflush_block_only(flush == Z_FINISH);\n\n\t\t\tif (strm.avail_out === 0) {\n\t\t\t\tif (flush == Z_FINISH)\n\t\t\t\t\treturn FinishStarted;\n\t\t\t\telse\n\t\t\t\t\treturn NeedMore;\n\t\t\t}\n\n\t\t\treturn flush == Z_FINISH ? FinishDone : BlockDone;\n\t\t}\n\n\t\tfunction deflateReset(strm) {\n\t\t\tstrm.total_in = strm.total_out = 0;\n\t\t\tstrm.msg = null; //\n\t\t\t\n\t\t\tthat.pending = 0;\n\t\t\tthat.pending_out = 0;\n\n\t\t\tstatus = BUSY_STATE;\n\n\t\t\tlast_flush = Z_NO_FLUSH;\n\n\t\t\ttr_init();\n\t\t\tlm_init();\n\t\t\treturn Z_OK;\n\t\t}\n\n\t\tthat.deflateInit = function(strm, _level, bits, _method, memLevel, _strategy) {\n\t\t\tif (!_method)\n\t\t\t\t_method = Z_DEFLATED;\n\t\t\tif (!memLevel)\n\t\t\t\tmemLevel = DEF_MEM_LEVEL;\n\t\t\tif (!_strategy)\n\t\t\t\t_strategy = Z_DEFAULT_STRATEGY;\n\n\t\t\t// byte[] my_version=ZLIB_VERSION;\n\n\t\t\t//\n\t\t\t// if (!version || version[0] != my_version[0]\n\t\t\t// || stream_size != sizeof(z_stream)) {\n\t\t\t// return Z_VERSION_ERROR;\n\t\t\t// }\n\n\t\t\tstrm.msg = null;\n\n\t\t\tif (_level == Z_DEFAULT_COMPRESSION)\n\t\t\t\t_level = 6;\n\n\t\t\tif (memLevel < 1 || memLevel > MAX_MEM_LEVEL || _method != Z_DEFLATED || bits < 9 || bits > 15 || _level < 0 || _level > 9 || _strategy < 0\n\t\t\t\t\t|| _strategy > Z_HUFFMAN_ONLY) {\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\n\t\t\tstrm.dstate = that;\n\n\t\t\tw_bits = bits;\n\t\t\tw_size = 1 << w_bits;\n\t\t\tw_mask = w_size - 1;\n\n\t\t\thash_bits = memLevel + 7;\n\t\t\thash_size = 1 << hash_bits;\n\t\t\thash_mask = hash_size - 1;\n\t\t\thash_shift = Math.floor((hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n\t\t\twindow = new Uint8Array(w_size * 2);\n\t\t\tprev = [];\n\t\t\thead = [];\n\n\t\t\tlit_bufsize = 1 << (memLevel + 6); // 16K elements by default\n\n\t\t\t// We overlay pending_buf and d_buf+l_buf. This works since the average\n\t\t\t// output size for (length,distance) codes is <= 24 bits.\n\t\t\tthat.pending_buf = new Uint8Array(lit_bufsize * 4);\n\t\t\tpending_buf_size = lit_bufsize * 4;\n\n\t\t\td_buf = Math.floor(lit_bufsize / 2);\n\t\t\tl_buf = (1 + 2) * lit_bufsize;\n\n\t\t\tlevel = _level;\n\n\t\t\tstrategy = _strategy;\n\t\t\tmethod = _method & 0xff;\n\n\t\t\treturn deflateReset(strm);\n\t\t};\n\n\t\tthat.deflateEnd = function() {\n\t\t\tif (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE) {\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\t\t\t// Deallocate in reverse order of allocations:\n\t\t\tthat.pending_buf = null;\n\t\t\thead = null;\n\t\t\tprev = null;\n\t\t\twindow = null;\n\t\t\t// free\n\t\t\tthat.dstate = null;\n\t\t\treturn status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;\n\t\t};\n\n\t\tthat.deflateParams = function(strm, _level, _strategy) {\n\t\t\tvar err = Z_OK;\n\n\t\t\tif (_level == Z_DEFAULT_COMPRESSION) {\n\t\t\t\t_level = 6;\n\t\t\t}\n\t\t\tif (_level < 0 || _level > 9 || _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\n\t\t\tif (config_table[level].func != config_table[_level].func && strm.total_in !== 0) {\n\t\t\t\t// Flush the last buffer:\n\t\t\t\terr = strm.deflate(Z_PARTIAL_FLUSH);\n\t\t\t}\n\n\t\t\tif (level != _level) {\n\t\t\t\tlevel = _level;\n\t\t\t\tmax_lazy_match = config_table[level].max_lazy;\n\t\t\t\tgood_match = config_table[level].good_length;\n\t\t\t\tnice_match = config_table[level].nice_length;\n\t\t\t\tmax_chain_length = config_table[level].max_chain;\n\t\t\t}\n\t\t\tstrategy = _strategy;\n\t\t\treturn err;\n\t\t};\n\n\t\tthat.deflateSetDictionary = function(strm, dictionary, dictLength) {\n\t\t\tvar length = dictLength;\n\t\t\tvar n, index = 0;\n\n\t\t\tif (!dictionary || status != INIT_STATE)\n\t\t\t\treturn Z_STREAM_ERROR;\n\n\t\t\tif (length < MIN_MATCH)\n\t\t\t\treturn Z_OK;\n\t\t\tif (length > w_size - MIN_LOOKAHEAD) {\n\t\t\t\tlength = w_size - MIN_LOOKAHEAD;\n\t\t\t\tindex = dictLength - length; // use the tail of the dictionary\n\t\t\t}\n\t\t\twindow.set(dictionary.subarray(index, index + length), 0);\n\n\t\t\tstrstart = length;\n\t\t\tblock_start = length;\n\n\t\t\t// Insert all strings in the hash table (except for the last two bytes).\n\t\t\t// s->lookahead stays null, so s->ins_h will be recomputed at the next\n\t\t\t// call of fill_window.\n\n\t\t\tins_h = window[0] & 0xff;\n\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[1] & 0xff)) & hash_mask;\n\n\t\t\tfor (n = 0; n <= length - MIN_MATCH; n++) {\n\t\t\t\tins_h = (((ins_h) << hash_shift) ^ (window[(n) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;\n\t\t\t\tprev[n & w_mask] = head[ins_h];\n\t\t\t\thead[ins_h] = n;\n\t\t\t}\n\t\t\treturn Z_OK;\n\t\t};\n\n\t\tthat.deflate = function(_strm, flush) {\n\t\t\tvar i, header, level_flags, old_flush, bstate;\n\n\t\t\tif (flush > Z_FINISH || flush < 0) {\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\n\t\t\tif (!_strm.next_out || (!_strm.next_in && _strm.avail_in !== 0) || (status == FINISH_STATE && flush != Z_FINISH)) {\n\t\t\t\t_strm.msg = z_errmsg[Z_NEED_DICT - (Z_STREAM_ERROR)];\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\t\t\tif (_strm.avail_out === 0) {\n\t\t\t\t_strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];\n\t\t\t\treturn Z_BUF_ERROR;\n\t\t\t}\n\n\t\t\tstrm = _strm; // just in case\n\t\t\told_flush = last_flush;\n\t\t\tlast_flush = flush;\n\n\t\t\t// Write the zlib header\n\t\t\tif (status == INIT_STATE) {\n\t\t\t\theader = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8;\n\t\t\t\tlevel_flags = ((level - 1) & 0xff) >> 1;\n\n\t\t\t\tif (level_flags > 3)\n\t\t\t\t\tlevel_flags = 3;\n\t\t\t\theader |= (level_flags << 6);\n\t\t\t\tif (strstart !== 0)\n\t\t\t\t\theader |= PRESET_DICT;\n\t\t\t\theader += 31 - (header % 31);\n\n\t\t\t\tstatus = BUSY_STATE;\n\t\t\t\tputShortMSB(header);\n\t\t\t}\n\n\t\t\t// Flush as much pending output as possible\n\t\t\tif (that.pending !== 0) {\n\t\t\t\tstrm.flush_pending();\n\t\t\t\tif (strm.avail_out === 0) {\n\t\t\t\t\t// console.log(\" avail_out==0\");\n\t\t\t\t\t// Since avail_out is 0, deflate will be called again with\n\t\t\t\t\t// more output space, but possibly with both pending and\n\t\t\t\t\t// avail_in equal to zero. There won't be anything to do,\n\t\t\t\t\t// but this is not an error situation so make sure we\n\t\t\t\t\t// return OK instead of BUF_ERROR at next call of deflate:\n\t\t\t\t\tlast_flush = -1;\n\t\t\t\t\treturn Z_OK;\n\t\t\t\t}\n\n\t\t\t\t// Make sure there is something to do and avoid duplicate\n\t\t\t\t// consecutive\n\t\t\t\t// flushes. For repeated and useless calls with Z_FINISH, we keep\n\t\t\t\t// returning Z_STREAM_END instead of Z_BUFF_ERROR.\n\t\t\t} else if (strm.avail_in === 0 && flush <= old_flush && flush != Z_FINISH) {\n\t\t\t\tstrm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];\n\t\t\t\treturn Z_BUF_ERROR;\n\t\t\t}\n\n\t\t\t// User must not provide more input after the first FINISH:\n\t\t\tif (status == FINISH_STATE && strm.avail_in !== 0) {\n\t\t\t\t_strm.msg = z_errmsg[Z_NEED_DICT - (Z_BUF_ERROR)];\n\t\t\t\treturn Z_BUF_ERROR;\n\t\t\t}\n\n\t\t\t// Start a new block or continue the current one.\n\t\t\tif (strm.avail_in !== 0 || lookahead !== 0 || (flush != Z_NO_FLUSH && status != FINISH_STATE)) {\n\t\t\t\tbstate = -1;\n\t\t\t\tswitch (config_table[level].func) {\n\t\t\t\tcase STORED:\n\t\t\t\t\tbstate = deflate_stored(flush);\n\t\t\t\t\tbreak;\n\t\t\t\tcase FAST:\n\t\t\t\t\tbstate = deflate_fast(flush);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SLOW:\n\t\t\t\t\tbstate = deflate_slow(flush);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t}\n\n\t\t\t\tif (bstate == FinishStarted || bstate == FinishDone) {\n\t\t\t\t\tstatus = FINISH_STATE;\n\t\t\t\t}\n\t\t\t\tif (bstate == NeedMore || bstate == FinishStarted) {\n\t\t\t\t\tif (strm.avail_out === 0) {\n\t\t\t\t\t\tlast_flush = -1; // avoid BUF_ERROR next call, see above\n\t\t\t\t\t}\n\t\t\t\t\treturn Z_OK;\n\t\t\t\t\t// If flush != Z_NO_FLUSH && avail_out === 0, the next call\n\t\t\t\t\t// of deflate should use the same flush parameter to make sure\n\t\t\t\t\t// that the flush is complete. So we don't have to output an\n\t\t\t\t\t// empty block here, this will be done at next call. This also\n\t\t\t\t\t// ensures that for a very small output buffer, we emit at most\n\t\t\t\t\t// one empty block.\n\t\t\t\t}\n\n\t\t\t\tif (bstate == BlockDone) {\n\t\t\t\t\tif (flush == Z_PARTIAL_FLUSH) {\n\t\t\t\t\t\t_tr_align();\n\t\t\t\t\t} else { // FULL_FLUSH or SYNC_FLUSH\n\t\t\t\t\t\t_tr_stored_block(0, 0, false);\n\t\t\t\t\t\t// For a full flush, this empty block will be recognized\n\t\t\t\t\t\t// as a special marker by inflate_sync().\n\t\t\t\t\t\tif (flush == Z_FULL_FLUSH) {\n\t\t\t\t\t\t\t// state.head[s.hash_size-1]=0;\n\t\t\t\t\t\t\tfor (i = 0; i < hash_size/*-1*/; i++)\n\t\t\t\t\t\t\t\t// forget history\n\t\t\t\t\t\t\t\thead[i] = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tstrm.flush_pending();\n\t\t\t\t\tif (strm.avail_out === 0) {\n\t\t\t\t\t\tlast_flush = -1; // avoid BUF_ERROR at next call, see above\n\t\t\t\t\t\treturn Z_OK;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (flush != Z_FINISH)\n\t\t\t\treturn Z_OK;\n\t\t\treturn Z_STREAM_END;\n\t\t};\n\t}\n\n\t// ZStream\n\n\tfunction ZStream() {\n\t\tvar that = this;\n\t\tthat.next_in_index = 0;\n\t\tthat.next_out_index = 0;\n\t\t// that.next_in; // next input byte\n\t\tthat.avail_in = 0; // number of bytes available at next_in\n\t\tthat.total_in = 0; // total nb of input bytes read so far\n\t\t// that.next_out; // next output byte should be put there\n\t\tthat.avail_out = 0; // remaining free space at next_out\n\t\tthat.total_out = 0; // total nb of bytes output so far\n\t\t// that.msg;\n\t\t// that.dstate;\n\t}\n\n\tZStream.prototype = {\n\t\tdeflateInit : function(level, bits) {\n\t\t\tvar that = this;\n\t\t\tthat.dstate = new Deflate();\n\t\t\tif (!bits)\n\t\t\t\tbits = MAX_BITS;\n\t\t\treturn that.dstate.deflateInit(that, level, bits);\n\t\t},\n\n\t\tdeflate : function(flush) {\n\t\t\tvar that = this;\n\t\t\tif (!that.dstate) {\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\t}\n\t\t\treturn that.dstate.deflate(that, flush);\n\t\t},\n\n\t\tdeflateEnd : function() {\n\t\t\tvar that = this;\n\t\t\tif (!that.dstate)\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\tvar ret = that.dstate.deflateEnd();\n\t\t\tthat.dstate = null;\n\t\t\treturn ret;\n\t\t},\n\n\t\tdeflateParams : function(level, strategy) {\n\t\t\tvar that = this;\n\t\t\tif (!that.dstate)\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\treturn that.dstate.deflateParams(that, level, strategy);\n\t\t},\n\n\t\tdeflateSetDictionary : function(dictionary, dictLength) {\n\t\t\tvar that = this;\n\t\t\tif (!that.dstate)\n\t\t\t\treturn Z_STREAM_ERROR;\n\t\t\treturn that.dstate.deflateSetDictionary(that, dictionary, dictLength);\n\t\t},\n\n\t\t// Read a new buffer from the current input stream, update the\n\t\t// total number of bytes read. All deflate() input goes through\n\t\t// this function so some applications may wish to modify it to avoid\n\t\t// allocating a large strm->next_in buffer and copying from it.\n\t\t// (See also flush_pending()).\n\t\tread_buf : function(buf, start, size) {\n\t\t\tvar that = this;\n\t\t\tvar len = that.avail_in;\n\t\t\tif (len > size)\n\t\t\t\tlen = size;\n\t\t\tif (len === 0)\n\t\t\t\treturn 0;\n\t\t\tthat.avail_in -= len;\n\t\t\tbuf.set(that.next_in.subarray(that.next_in_index, that.next_in_index + len), start);\n\t\t\tthat.next_in_index += len;\n\t\t\tthat.total_in += len;\n\t\t\treturn len;\n\t\t},\n\n\t\t// Flush as much pending output as possible. All deflate() output goes\n\t\t// through this function so some applications may wish to modify it\n\t\t// to avoid allocating a large strm->next_out buffer and copying into it.\n\t\t// (See also read_buf()).\n\t\tflush_pending : function() {\n\t\t\tvar that = this;\n\t\t\tvar len = that.dstate.pending;\n\n\t\t\tif (len > that.avail_out)\n\t\t\t\tlen = that.avail_out;\n\t\t\tif (len === 0)\n\t\t\t\treturn;\n\n\t\t\t// if (that.dstate.pending_buf.length <= that.dstate.pending_out || that.next_out.length <= that.next_out_index\n\t\t\t// || that.dstate.pending_buf.length < (that.dstate.pending_out + len) || that.next_out.length < (that.next_out_index +\n\t\t\t// len)) {\n\t\t\t// console.log(that.dstate.pending_buf.length + \", \" + that.dstate.pending_out + \", \" + that.next_out.length + \", \" +\n\t\t\t// that.next_out_index + \", \" + len);\n\t\t\t// console.log(\"avail_out=\" + that.avail_out);\n\t\t\t// }\n\n\t\t\tthat.next_out.set(that.dstate.pending_buf.subarray(that.dstate.pending_out, that.dstate.pending_out + len), that.next_out_index);\n\n\t\t\tthat.next_out_index += len;\n\t\t\tthat.dstate.pending_out += len;\n\t\t\tthat.total_out += len;\n\t\t\tthat.avail_out -= len;\n\t\t\tthat.dstate.pending -= len;\n\t\t\tif (that.dstate.pending === 0) {\n\t\t\t\tthat.dstate.pending_out = 0;\n\t\t\t}\n\t\t}\n\t};\n\n\t// Deflater\n\n\tfunction Deflater(options) {\n\t\tvar that = this;\n\t\tvar z = new ZStream();\n\t\tvar bufsize = 512;\n\t\tvar flush = Z_NO_FLUSH;\n\t\tvar buf = new Uint8Array(bufsize);\n\t\tvar level = options ? options.level : Z_DEFAULT_COMPRESSION;\n\t\tif (typeof level == \"undefined\")\n\t\t\tlevel = Z_DEFAULT_COMPRESSION;\n\t\tz.deflateInit(level);\n\t\tz.next_out = buf;\n\n\t\tthat.append = function(data, onprogress) {\n\t\t\tvar err, buffers = [], lastIndex = 0, bufferIndex = 0, bufferSize = 0, array;\n\t\t\tif (!data.length)\n\t\t\t\treturn;\n\t\t\tz.next_in_index = 0;\n\t\t\tz.next_in = data;\n\t\t\tz.avail_in = data.length;\n\t\t\tdo {\n\t\t\t\tz.next_out_index = 0;\n\t\t\t\tz.avail_out = bufsize;\n\t\t\t\terr = z.deflate(flush);\n\t\t\t\tif (err != Z_OK)\n\t\t\t\t\tthrow new Error(\"deflating: \" + z.msg);\n\t\t\t\tif (z.next_out_index)\n\t\t\t\t\tif (z.next_out_index == bufsize)\n\t\t\t\t\t\tbuffers.push(new Uint8Array(buf));\n\t\t\t\t\telse\n\t\t\t\t\t\tbuffers.push(new Uint8Array(buf.subarray(0, z.next_out_index)));\n\t\t\t\tbufferSize += z.next_out_index;\n\t\t\t\tif (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) {\n\t\t\t\t\tonprogress(z.next_in_index);\n\t\t\t\t\tlastIndex = z.next_in_index;\n\t\t\t\t}\n\t\t\t} while (z.avail_in > 0 || z.avail_out === 0);\n\t\t\tarray = new Uint8Array(bufferSize);\n\t\t\tbuffers.forEach(function(chunk) {\n\t\t\t\tarray.set(chunk, bufferIndex);\n\t\t\t\tbufferIndex += chunk.length;\n\t\t\t});\n\t\t\treturn array;\n\t\t};\n\t\tthat.flush = function() {\n\t\t\tvar err, buffers = [], bufferIndex = 0, bufferSize = 0, array;\n\t\t\tdo {\n\t\t\t\tz.next_out_index = 0;\n\t\t\t\tz.avail_out = bufsize;\n\t\t\t\terr = z.deflate(Z_FINISH);\n\t\t\t\tif (err != Z_STREAM_END && err != Z_OK)\n\t\t\t\t\tthrow new Error(\"deflating: \" + z.msg);\n\t\t\t\tif (bufsize - z.avail_out > 0)\n\t\t\t\t\tbuffers.push(new Uint8Array(buf.subarray(0, z.next_out_index)));\n\t\t\t\tbufferSize += z.next_out_index;\n\t\t\t} while (z.avail_in > 0 || z.avail_out === 0);\n\t\t\tz.deflateEnd();\n\t\t\tarray = new Uint8Array(bufferSize);\n\t\t\tbuffers.forEach(function(chunk) {\n\t\t\t\tarray.set(chunk, bufferIndex);\n\t\t\t\tbufferIndex += chunk.length;\n\t\t\t});\n\t\t\treturn array;\n\t\t};\n\t}\n\n\t// 'zip' may not be defined in z-worker and some tests\n\tvar env = global.zip || global;\n\tenv.Deflater = env._jzlib_Deflater = Deflater;\n})(this);\n"
  },
  {
    "path": "elements.css",
    "content": "\n/* Hide Firefox's indicator when images are loading */\nimg:-moz-loading {\n    visibility: hidden;\n}\n\n/* ------ UTILITY ---------- */\n\n.hidden {\n\tdisplay: none;\n}\n\ndiv.tip {\n\tcolor: #555;\n\tfont-weight: normal;\n\ttext-align: left;\n\tposition: relative;\n\tdisplay: inline-block;\n\tfont-size: 13px;\n\tline-height: 1.45;\n\tbackground: #fff;\n\tborder: 1px solid #a2a2a2;\n\tborder-radius: 6px;\n\tpadding: 8px 11px 9px 11px;\n\tbottom: 0px;\n\tleft: -50%;\n\tmargin-right: 9px;\n\twhite-space: pre;\n\tbox-shadow: 0 0px 10px rgba(0, 0, 0, 0.15);\n}\n\n/* tail */\n.tip:after, .tip:before {\n\ttop: 100%;\n\tborder: solid transparent;\n\tcontent: \" \";\n\theight: 0;\n\twidth: 0;\n\tposition: absolute;\n\tpointer-events: none;\n}\n\n/* tail fg */\n.tip:after {\n\tborder-color: rgba(136, 183, 213, 0);\n\tborder-top-color: #fff;\n\tborder-width: 8px;\n\tleft: 50%;\n\tmargin-left: -8px;\n}\n\n/* tail bg */\n.tip:before {\n\tborder-color: rgba(194, 225, 245, 0);\n\tborder-top-color: #999;\n\tborder-width: 9px;\n\tleft: 50%;\n\tmargin-left: -9px;\n}\n\n\n.tip-button {\n\tfloat: right;\n\tmargin-top: 2px;\n\tdisplay:inline-block;\n\tposition: relative;\n\tz-index: 500;\n\tcursor: pointer;\n\ttext-align: center;\n\tfont-size: 13px;\n\tline-height: 1;\n\tfont-weight: normal;\n\tcolor: #799FCB;\n}\n\n.tip-button .tip-anchor {\n\tbottom: 24px;\n\tleft: 8px;\n}\n\n.tip-anchor {\n\tvisibility: hidden;\n\tposition: absolute;\n\tbottom: 0;\n\tleft: 0;\n}\n\n.tip-button:hover {\n\tfont-weight: bold;\n\tcolor: #033D6D;\n}\n\n.tip-button:hover * {\n\tvisibility: visible;\n}\n\n.clicktext {\n\tdisplay:inline-block;\n\tline-height: 1;\n\tcursor: pointer;\n\tborder: none;\n\toutline: none;\n\tpadding: 0;\n\tmargin: 0;\n\ttext-decoration:none;\n\ttext-indent: 0px;\n}\n\n.file-control {\n\tposition: absolute;\n\ttop: -1000px;\n}\n\n/* -------- BUTTONS ---------- */\n\n.header-btn {\n\tcolor: #fff;\n\tborder: none;\n\tpadding: 3px 7px 4px 7px;\n\tborder-radius: 3px;\n\tmargin-top: 5px;\n}\n\n.page-header .header-btn.disabled,\n.page-header .header-btn.disabled:hover {\n\tbackground-color: transparent;\n}\n\n.page-header .header-btn.active {\n\tbackground-color: black;\n}\n\n.btn.active {\n\tcursor: pointer;\n}\n\n.btn.selected,\n.btn.selected:hover {\n\tcolor: #aaa;\n\tbackground: none;\n}\n\n.btn.inline-btn:hover:not(.selected) {\n\tbackground-color: #FFFCDC;\n}\n\n.btn {\n\ttext-align: center;\n\tpadding: 4px 7px 5px 7px;\n\tborder-radius: 4px;\n\tline-height: 1;\n\tdisplay: inline-block;\n\tcursor: pointer;\n}\n\n.btn.disabled {\n\tcursor: default;\n}\n\n\n.dialog-btn {\n\tdisplay: inline-block;\n\tmargin-bottom: 4px;\n\tmargin-top: 1px;\n\tfont-size: 13px;\n\tcolor: white;\n\tmin-width: 28px;\n}\n\n.inline-btn {\n\tmargin: 0;\n\tborder: 1px solid #999;\n\tpadding: 1px 4px 3px 3px;\n}\n\n.text-btn {\n\tcursor: pointer;\n}\n\n.text-btn.disabled {\n\tcursor: auto;\n\tcolor: #999;\n}\n\n\n"
  },
  {
    "path": "encode.js",
    "content": "/**\n * https://github.com/giscafer/mapshaper-plus\n * 对坐标数据进行加密\n * @author giscafer\n * @version 1.0\n * @date    2016-06-04T01:48:33+0800\n * 参考：https://github.com/ecomfe/echarts/blob/8eeb7e5abe207d0536c62ce1f4ddecc6adfdf85e/src/util/mapData/rawData/encode.js\n */\n!(function (name, definition) {\n    var hasDefine = typeof define === 'funciton',\n        hasExports = typeof module !== 'undefined' && module.exports;\n    if (hasDefine) {\n        //AMD/CMD\n        define(difinition);\n    } else if (hasExports) {\n        //Node.js\n        module.exports = definition();\n    } else {\n        this[name] = definition();\n    }\n})('Encoder', function () {\n    function Encoder() { }\n\n    Encoder.prototype.convert2Echarts = function (rawStr, fileName, type) {\n        var results = \"\";\n        var json = JSON.parse(rawStr);\n        // Meta tag\n        json.UTF8Encoding = true;\n        var features = json.features;\n        // console.log(json);\n        if (features) {\n            features.forEach(function (feature) {\n                var encodeOffsets = feature.geometry.encodeOffsets = [];\n                var coordinates = feature.geometry.coordinates;\n                if (feature.geometry.type === 'Polygon') {\n                    coordinates.forEach(function (coordinate, idx) {\n                        coordinates[idx] = encodePolygon(\n                            coordinate, encodeOffsets[idx] = []\n                        );\n                    });\n                } else if (feature.geometry.type === 'MultiPolygon') {\n                    coordinates.forEach(function (polygon, idx1) {\n                        encodeOffsets[idx1] = [];\n                        polygon.forEach(function (coordinate, idx2) {\n                            coordinates[idx1][idx2] = encodePolygon(\n                                coordinate, encodeOffsets[idx1][idx2] = []\n                            );\n                        });\n                    });\n                }\n            });\n        } else {\n            var geometries = json.geometries;\n            geometries.forEach(function (geometry) {\n                var encodeOffsets = geometry.encodeOffsets = [];\n                var coordinates = geometry.coordinates;\n                if (geometry.type === 'Polygon') {\n                    coordinates.forEach(function (coordinate, idx) {\n                        coordinates[idx] = encodePolygon(\n                            coordinate, encodeOffsets[idx] = []\n                        );\n                    });\n                } else if (geometry.type === 'MultiPolygon') {\n                    coordinates.forEach(function (polygon, idx1) {\n                        encodeOffsets[idx1] = [];\n                        polygon.forEach(function (coordinate, idx2) {\n                            coordinates[idx1][idx2] = encodePolygon(\n                                coordinate, encodeOffsets[idx1][idx2] = []\n                            );\n                        });\n                    });\n                }\n            });\n        }\n\n        if (type === 'json') {\n            results = JSON.stringify(json);\n        } else {\n            results = addEchartsJsWrapper(JSON.stringify(json), fileName);\n        }\n        return results;\n    };\n    function encodePolygon(coordinate, encodeOffsets) {\n        var result = '';\n\n        var prevX = quantize(coordinate[0][0]);\n        var prevY = quantize(coordinate[0][1]);\n        // Store the origin offset\n        encodeOffsets[0] = prevX;\n        encodeOffsets[1] = prevY;\n\n        for (var i = 0; i < coordinate.length; i++) {\n            var point = coordinate[i];\n            result += encode(point[0], prevX);\n            result += encode(point[1], prevY);\n\n            prevX = quantize(point[0]);\n            prevY = quantize(point[1]);\n        }\n\n        return result;\n    }\n\n    function addAMDWrapper(jsonStr) {\n        return ['define(function() {',\n            '    return ' + jsonStr + ';',\n            '});'].join('\\n');\n    }\n\n    function addEchartsJsWrapper(jsonStr, fileName) {\n        return ['(function (root, factory) {',\n            \"   if (typeof define === 'function' && define.amd) {\",\n            \"       define(['exports', 'echarts'], factory);\",\n            \"   } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {\",\n            \"       factory(exports, require('echarts'));\",\n            \"   } else {\",\n            \"       factory({}, root.echarts);\",\n            \"   }\",\n            \" }(this, function (exports, echarts) {\",\n            \"       var log = function (msg) {\",\n            \"           if (typeof console !== 'undefined') {\",\n            \"               console && console.error && console.error(msg);\",\n            \"           }\",\n            \"       }\",\n            \" if (!echarts) {\",\n            \"       log('ECharts is not Loaded');\",\n            \"           return;\",\n            \"       }\",\n            \" if (!echarts.registerMap) {\",\n            \"       log('ECharts Map is not loaded')\",\n            \"       return;\",\n            \" }\",\n            \"  echarts.registerMap('\" + fileName + \"',\" + jsonStr,\n            '  )}));'].join('\\n');\n    }\n\n    function encode(val, prev) {\n        // Quantization\n        val = quantize(val);\n        // var tmp = val;\n        // Delta\n        val = val - prev;\n\n        if (((val << 1) ^ (val >> 15)) + 64 === 8232) {\n            //WTF, 8232 will get syntax error in js code\n            val--;\n        }\n        // ZigZag\n        val = (val << 1) ^ (val >> 15);\n        // add offset and get unicode\n        return String.fromCharCode(val + 64);\n        // var tmp = {'tmp' : str};\n        // try{\n        //     eval(\"(\" + JSON.stringify(tmp) + \")\");\n        // }catch(e) {\n        //     console.log(val + 64);\n        // }\n    }\n\n    function quantize(val) {\n        return Math.ceil(val * 1024);\n    }\n    return new Encoder();\n});\n\n"
  },
  {
    "path": "index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>mapshaper plus</title>\n\t<meta name=\"Description\" content=\"A tool for topologically aware shape simplification. Reads and writes Shapefile, GeoJSON and TopoJSON formats.\" />\n\t<meta charset=\"UTF-8\">\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n\t<link rel=\"stylesheet\" href=\"page.css\">\n\t<link rel=\"stylesheet\" href=\"elements.css\">\n\t<link rel=\"icon\"\n      type=\"image/png\"\n      href=\"images/icon.png\">\n</head>\n<body class=\"theme2\">\n<div class=\"hidden\">\n\t<svg version=\"1.1\" id=\"home-icon\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\"\n\t\t y=\"0px\" width=\"14px\" height=\"19px\" viewBox=\"0 0 14 16\">\n\t<g>\n\t\t<polygon points=\"13,7 13,6 12,6 12,5 11,5 11,4 10,4 10,3 9,3 9,2 8,2 8,1 6,1 6,2 5,2 5,3 4,3 4,4 3,4 3,5 2,5 \n\t\t\t2,6 1,6 1,7 0,7 0,9 2,9 2,14 6,14 6,10 8,10 8,14 12,14 12,9 14,9 14,7\"/>\n\t</g>\n\t</svg>\n\t<svg version=\"1.1\" id=\"zoom-in-icon\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\"\n\t\t y=\"0px\" width=\"14px\" height=\"21px\" viewBox=\"0 0 14 14\">\n\t<g>\n\t\t<polygon points=\"13,5 9,5 9,1 5,1 5,5 1,5 1,9 5,9 5,13 9,13 9,9 13,9\"/>\n\t</g>\n\t</svg>\n\t<svg version=\"1.1\" id=\"zoom-out-icon\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\"\n\t\t y=\"0px\" width=\"14px\" height=\"16px\" viewBox=\"0 -1 14 10\">\n\t<g>\n\t\t<polygon points=\"1,1 13,1 13,5 1,5 1,1\" />\n\t</g>\n\t</svg>\n<svg version=\"1.1\" id=\"info-icon2\"\n\t xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"13px\" height=\"18px\"\n\t viewBox=\"-510 390 13 18\" xml:space=\"preserve\">\n<circle fill=\"#30D4EF\" cx=\"-503.4\" cy=\"392.8\" r=\"2.7\"/>\n<rect x=\"-508\" y=\"405\" fill=\"#30D4EF\" width=\"10\" height=\"3\"/>\n<rect x=\"-507\" y=\"398\" fill=\"#30D4EF\" width=\"6\" height=\"3\"/>\n<rect x=\"-505\" y=\"400\" fill=\"#30D4EF\" width=\"4\" height=\"6\"/>\n</svg>\n\n</div>\n\n<div id=\"coordinate-info\" class=\"colored-text selectable\"></div>\n<a href=\"https://github.com/giscafer/mapshaper-plus\" target=\"_blank\"><div id=\"fork-me\"></div></a>\n<div class=\"page-header\">\n\t<div class=\"mapshaper-logo\">map<span class=\"logo-highlight\">shaper plus</span></div>\n\n\t<div id=\"layer-control-btn\"><span class=\"btn header-btn layer-name\"></span></div>\n\n\t<div id=\"simplify-control-wrapper\"><div id=\"simplify-control\"><div class=\"header-btn btn\" id=\"simplify-settings-btn\">Settings</div>\n\t\t<div class=\"slider\">\n\t\t\t<div class=\"handle\"><img src=\"images/slider_handle_v1.png\" alt=\"\"/></div>\n\t\t\t<div class=\"track\"></div>\n\t\t</div>\n\t\t<input type=\"text\" value=\"label\" class=\"clicktext\" />\n\t</div></div>\n\t<div id=\"mode-buttons\">\n\t\t<span id=\"simplify-btn\" class=\"header-btn btn\">Simplify</span><span class=\"separator\"></span><span id=\"console-btn\" class=\"header-btn btn\">Console</span><span class=\"separator\"></span><span id=\"export-btn\" class=\"header-btn btn\">Export</span>\n\t</div>\n</div>\n\n<div id=\"mshp-not-supported\" class=\"main-area\">\n\t<div class=\"info-box\">\n\t<h3>Unfortunately, mapshaper can't run in <span class=\"unsupported-browser\">this web browser</span></h3>\n\t<div>For best results, try <a href=\"https://www.google.com/chrome/browser/desktop/\">Google Chrome</a> or <a href=\"http://www.mozilla.org/en-US/firefox/new/\">Mozilla Firefox</a>.</div>\n\t</div>\n</div>\n\n<div id=\"layer-control\" class=\"main-area popup-dialog\">\n\t<div class=\"info-box\">\n\t\t<div id=\"layer-menu\">\n\t\t\t<h3>Layers</h3>\n\t\t\t<div class=\"layer-list\"></div>\n\t\t\t<div><div id=\"add-file-btn\" class=\"dialog-btn btn\">Add a file</div></div>\n\t\t</div>\n\t</div>\n</div>\n\n<div id=\"export-options\" class=\"main-area popup-dialog\">\n\t<div class=\"info-box\">\n\t\t<h3>Export menu</h3>\n\t\t<div style=\"height:3px\"></div>\n\t\t<div id=\"export-layers\">\n\t\t\t<h4>Layers</h4>\n\t\t\t<div id=\"export-layer-list\" class=\"option-menu\"></div>\n\t\t</div>\n\t\t<h4>File format</h4>\n\t\t<div id=\"export-formats\" class=\"option-menu\">\n\t\t</div>\n\n\t\t<div class=\"option-menu\"><input type=\"text\" class=\"advanced-options\" placeholder=\"command line options\" /><div class=\"tip-button\">?<div class=\"tip-anchor\">\n\t\t<div class=\"tip\">Enter options from the command line\ninterface. Examples: \"bbox\" \"no-quantization\"\n\"precision=0.001\"</div></div></div></div>\n\t\t<div class=\"cancel-btn btn dialog-btn\">Cancel</div>\n\t\t<div id=\"save-btn\" class=\"btn dialog-btn\">Export</div>\n\t</div>\n</div>\n\n<div id=\"simplify-options\" class=\"main-area popup-dialog\">\n\t<div class=\"info-box\">\n\t\t<h3>Simplification menu</h3>\n\t\t<div class=\"option-menu\">\n\t\t\t<div><label for=\"import-retain-opt\"><input type=\"checkbox\" class=\"checkbox\" id=\"import-retain-opt\"/>prevent shape removal</label>\n\t\t\t\t\t\t\t<div class=\"tip-button\">?<div class=\"tip-anchor\">\n\t\t\t<div class=\"tip\">Prevent small polygon features from\ndisappearing at high simplification. Keeps\nthe largest ring of multi-ring features.\n</div></div></div></div>\n\t\t\t<div id=\"planar-opt-wrapper\"><label for=\"planar-opt\"><input type=\"checkbox\" class=\"checkbox\" id=\"planar-opt\"/>use planar geometry</label>\n\t\t\t\t\t\t\t<div class=\"tip-button\">?<div class=\"tip-anchor\">\n\t\t\t<div class=\"tip\">Interpret x, y values as Cartesian coordinates\non a plane, rather than longitude, latitude\ncoordinates on a sphere.\n</div></div></div></div>\n\t\t</div>\n\n\t\t\t<h4>Method</h4>\n\t\t\t<div class=\"option-menu\">\n\n\t\t\t<div><label><input type=\"radio\" name=\"method\" value=\"dp\" class=\"radio\">Douglas-Peucker</label><div class=\"tip-button\">?<div class=\"tip-anchor\">\n<div class=\"tip\">Simplified lines remain within a set\ndistance of original lines. Good for\nthinning dense points, but spikes\ntend to form at high simplification.</div></div></div>\n\t\t\t</div>\t\t\t\n\n\t\t\t<div><label><input type=\"radio\" name=\"method\" value=\"visvalingam\" class=\"radio\">Visvalingam / effective area</label><div class=\"tip-button\">?<div class=\"tip-anchor\">\n<div class=\"tip\">Lines are simplified by iteratively\nremoving the point that forms\nthe least-area triangle with two\nadjacent points.</div></div></div>\n\t\t\t</div>\n\n\t\t\t<div><label><input type=\"radio\" name=\"method\" value=\"weighted_visvalingam\" class=\"radio\">Visvalingam / weighted area</label><div class=\"tip-button\">?<div class=\"tip-anchor\">\n<div class=\"tip\">Points located at the vertex\nof more acute angles are\npreferentially removed, for\na smoother appearance.</div></div></div></div>\n\n\n\t\t</div> <!-- option menu -->\n\n\t\t<div>\n\t\t\t<div class=\"cancel-btn btn dialog-btn\">Cancel</div>\n\t\t\t<div class=\"submit-btn btn dialog-btn\">Apply</div>\n\t\t</div>\n\t</div> <!-- .info-box -->\n</div> <!-- #simplify-options -->\n\n<div id=\"import-options\" class=\"main-area popup-dialog\">\n\t<div class=\"info-box\">\n\t\t<div id=\"import-intro\">\n\t\t\t<h3>Edit a file</h3>\n<p>Drag and drop or  <span class=\"inline-btn btn\" id=\"file-selection-btn\"><span class=\"label-text\">select</span></span> one or more files\nto import. Shapefile, GeoJSON, TopoJSON\nand Zip files are supported.\n</p>\n\t\t</div>\n\t\t<h4>Import options</h4>\n\t\t<div class=\"option-menu\">\n\n\t\t\t<div><label for=\"repair-intersections-opt\"><input type=\"checkbox\" checked class=\"checkbox\" id=\"repair-intersections-opt\"/>detect line intersections</label>\n\t\t\t<div class=\"tip-button\">?<div class=\"tip-anchor\">\n<div class=\"tip\">Detect line intersections, including\nself-intersections, to help identify\ntopological errors in a dataset.</div></div></div></div>\n\n\t\t\t<div><label for=\"snap-points-opt\"><input type=\"checkbox\" class=\"checkbox\" id=\"snap-points-opt\" />snap vertices</label>\n\t\t\t<div class=\"tip-button\">?<div class=\"tip-anchor\">\n<div class=\"tip\">Fix topology errors by snapping\ntogether points with nearly identical\ncoordinates. This option does not\napply to TopoJSON files.</div></div></div></div>\n<div style=\"height:5px\"></div>\n<div><input type=\"text\" class=\"advanced-options\" placeholder=\"command line options\" /><div class=\"tip-button\">?<div class=\"tip-anchor\">\n<div class=\"tip\">Enter options from the command line\ninterface. Examples: \"no-topology\"\n\"encoding=big5\"</div></div></div></div>\n\n\t\t</div>\n\n\t\t<div id=\"dropped-file-list\">\n\t\t\t<h3>Files</h3>\n\t\t\t<div class=\"file-list\"></div>\n\t\t</div>\n\n\t\t<div id=\"import-buttons\" class=\"hidden\">\n\t\t\t<div class=\"cancel-btn btn dialog-btn\">Cancel</div>\n\t\t\t<div class=\"add-btn btn dialog-btn\">Add file</div>\n\t\t\t<div class=\"submit-btn btn dialog-btn\">Import</div>\n\t\t</div>\n\n\t</div> <!-- .info-box -->\n</div> <!-- import-options -->\n\n<!-- TODO: remove #mshp-main-page without causing the map to jitter when resized -->\n<div id=\"mshp-main-page\">\n\t<div id=\"console\" class=\"main-area\">\n\t\t<div id=\"console-window\"><div id=\"console-buffer\" class=\"selectable\"></div></div>\n\t</div>\n\t<div id=\"mshp-main-map\" class=\"main-area\">\n\t\t<div id=\"intersection-display\">\n\t\t\t<div id=\"intersection-count\">0 line intersections</div>\n\t\t\t<div id=\"repair-btn\" class=\"text-btn colored-text\">Repair</div>\n\t\t</div>\n\t\t<div id=\"map-layers\"></div>\n\t</div>\n</div>\n<script src=\"encode.js\" type=\"text/javascript\"></script>\n<script src=\"zip.js\" type=\"text/javascript\"></script>\n<script src=\"mapshaper.js\" type=\"text/javascript\"></script>\n<script src=\"manifest.js\" type=\"text/javascript\"></script>\n<script src=\"mapshaper-gui.js\" type=\"text/javascript\"></script>\n</body>\n</html>"
  },
  {
    "path": "manifest.js",
    "content": "/* replaced by a file manifest by mapshaper-gui server */"
  },
  {
    "path": "mapshaper-gui.js",
    "content": "(function(){\n\nvar api = mapshaper; // assuming mapshaper is in global scope\nvar utils = api.utils;\nvar gui = api.gui = {};\nvar cli = api.cli;\nvar geom = api.geom;\nvar MapShaper = api.internal;\nvar Bounds = api.internal.Bounds;\nvar APIError = api.internal.APIError;\nvar message = api.internal.message;\n\n// Replace error function in mapshaper lib\nvar error = MapShaper.error = function() {\n  stop.apply(null, utils.toArray(arguments));\n};\n\n// replace stop function\nvar stop = MapShaper.stop = function() {\n  // Show a popup error message, then throw an error\n  var msg = gui.formatMessageArgs(arguments);\n  gui.alert(msg);\n  throw new Error(msg);\n};\n\n\nfunction Handler(type, target, callback, listener, priority) {\n  this.type = type;\n  this.callback = callback;\n  this.listener = listener || null;\n  this.priority = priority || 0;\n  this.target = target;\n}\n\nHandler.prototype.trigger = function(evt) {\n  if (!evt) {\n    evt = new EventData(this.type);\n    evt.target = this.target;\n  } else if (evt.target != this.target || evt.type != this.type) {\n    error(\"[Handler] event target/type have changed.\");\n  }\n  this.callback.call(this.listener, evt);\n}\n\nfunction EventData(type, target, data) {\n  this.type = type;\n  this.target = target;\n  if (data) {\n    utils.defaults(this, data);\n    this.data = data;\n  }\n}\n\nEventData.prototype.stopPropagation = function() {\n  this.__stop__ = true;\n};\n\n//  Base class for objects that dispatch events\nfunction EventDispatcher() {}\n\n\n// @obj (optional) data object, gets mixed into event\n// @listener (optional) dispatch event only to this object\nEventDispatcher.prototype.dispatchEvent = function(type, obj, listener) {\n  var evt;\n  // TODO: check for bugs if handlers are removed elsewhere while firing\n  var handlers = this._handlers;\n  if (handlers) {\n    for (var i = 0, len = handlers.length; i < len; i++) {\n      var handler = handlers[i];\n      if (handler.type == type && (!listener || listener == handler.listener)) {\n        if (!evt) {\n          evt = new EventData(type, this, obj);\n        }\n        else if (evt.__stop__) {\n            break;\n        }\n        handler.trigger(evt);\n      }\n    }\n  }\n};\n\nEventDispatcher.prototype.addEventListener =\nEventDispatcher.prototype.on = function(type, callback, context, priority) {\n  context = context || this;\n  priority = priority || 0;\n  var handler = new Handler(type, this, callback, context, priority);\n  // Insert the new event in the array of handlers according to its priority.\n  var handlers = this._handlers || (this._handlers = []);\n  var i = handlers.length;\n  while (--i >= 0 && handlers[i].priority < handler.priority) {}\n  handlers.splice(i+1, 0, handler);\n  return this;\n};\n\n// Remove an event handler.\n// @param {string} type Event type to match.\n// @param {function(BoundEvent)} callback Event handler function to match.\n// @param {*=} context Execution context of the event handler to match.\n// @return {number} Returns number of handlers removed (expect 0 or 1).\nEventDispatcher.prototype.removeEventListener = function(type, callback, context) {\n  context = context || this;\n  var count = this.removeEventListeners(type, callback, context);\n  return count;\n};\n\n// Remove event handlers; passing arguments can limit which listeners to remove\n// Returns nmber of handlers removed.\nEventDispatcher.prototype.removeEventListeners = function(type, callback, context) {\n  var handlers = this._handlers;\n  var newArr = [];\n  var count = 0;\n  for (var i = 0; handlers && i < handlers.length; i++) {\n    var evt = handlers[i];\n    if ((!type || type == evt.type) &&\n      (!callback || callback == evt.callback) &&\n      (!context || context == evt.listener)) {\n      count += 1;\n    }\n    else {\n      newArr.push(evt);\n    }\n  }\n  this._handlers = newArr;\n  return count;\n};\n\nEventDispatcher.prototype.countEventListeners = function(type) {\n  var handlers = this._handlers,\n    len = handlers && handlers.length || 0,\n    count = 0;\n  if (!type) return len;\n  for (var i = 0; i < len; i++) {\n    if (handlers[i].type === type) count++;\n  }\n  return count;\n};\n\n\n\nvar Env = (function() {\n  var inNode = typeof module !== 'undefined' && !!module.exports;\n  var inBrowser = typeof window !== 'undefined' && !inNode;\n  var inPhantom = inBrowser && !!(window.phantom && window.phantom.exit);\n  var ieVersion = inBrowser && /MSIE ([0-9]+)/.exec(navigator.appVersion) && parseInt(RegExp.$1) || NaN;\n\n  return {\n    iPhone : inBrowser && !!(navigator.userAgent.match(/iPhone/i)),\n    iPad : inBrowser && !!(navigator.userAgent.match(/iPad/i)),\n    canvas: inBrowser && !!document.createElement('canvas').getContext,\n    inNode : inNode,\n    inPhantom : inPhantom,\n    inBrowser: inBrowser,\n    ieVersion: ieVersion,\n    ie: !isNaN(ieVersion)\n  };\n})();\n\n\nvar Browser = {\n  getPageXY: function(el) {\n    var x = 0, y = 0;\n    if (el.getBoundingClientRect) {\n      var box = el.getBoundingClientRect();\n      x = box.left - Browser.pageXToViewportX(0);\n      y = box.top - Browser.pageYToViewportY(0);\n    }\n    else {\n      var fixed = Browser.elementIsFixed(el);\n\n      while (el) {\n        x += el.offsetLeft || 0;\n        y += el.offsetTop || 0;\n        el = el.offsetParent;\n      }\n\n      if (fixed) {\n        var offsX = -Browser.pageXToViewportX(0);\n        var offsY = -Browser.pageYToViewportY(0);\n        x += offsX;\n        y += offsY;\n      }\n    }\n\n    var obj = {x:x, y:y};\n    return obj;\n  },\n\n  elementIsFixed: function(el) {\n    // get top-level offsetParent that isn't body (cf. Firefox)\n    var body = document.body;\n    while (el && el != body) {\n      var parent = el;\n      el = el.offsetParent;\n    }\n\n    // Look for position:fixed in the computed style of the top offsetParent.\n    // var styleObj = parent && (parent.currentStyle || window.getComputedStyle && window.getComputedStyle(parent, '')) || {};\n    var styleObj = parent && Browser.getElementStyle(parent) || {};\n    return styleObj['position'] == 'fixed';\n  },\n\n  pageXToViewportX: function(x) {\n    return x - window.pageXOffset;\n  },\n\n  pageYToViewportY: function(y) {\n    return y - window.pageYOffset;\n  },\n\n  getElementStyle: function(el) {\n    return el.currentStyle || window.getComputedStyle && window.getComputedStyle(el, '') || {};\n  },\n\n  getClassNameRxp: function(cname) {\n    return new RegExp(\"(^|\\\\s)\" + cname + \"(\\\\s|$)\");\n  },\n\n  hasClass: function(el, cname) {\n    var rxp = this.getClassNameRxp(cname);\n    return el && rxp.test(el.className);\n  },\n\n  addClass: function(el, cname) {\n    var classes = el.className;\n    if (!classes) {\n      classes = cname;\n    }\n    else if (!this.hasClass(el, cname)) {\n      classes = classes + ' ' + cname;\n    }\n    el.className = classes;\n  },\n\n  removeClass: function(el, cname) {\n    var rxp = this.getClassNameRxp(cname);\n    el.className = el.className.replace(rxp, \"$2\");\n  },\n\n  replaceClass: function(el, c1, c2) {\n    var r1 = this.getClassNameRxp(c1);\n    el.className = el.className.replace(r1, '$1' + c2 + '$2');\n  },\n\n  mergeCSS: function(s1, s2) {\n    var div = this._cssdiv;\n    if (!div) {\n      div = this._cssdiv = document.createElement('div');\n    }\n    div.style.cssText = s1 + \";\" + s2; // extra ';' for ie, which may leave off final ';'\n    return div.style.cssText;\n  },\n\n  addCSS: function(el, css) {\n    el.style.cssText = Browser.mergeCSS(el.style.cssText, css);\n  },\n\n  // Return: HTML node reference or null\n  // Receive: node reference or id or \"#\" + id\n  getElement: function(ref) {\n    var el;\n    if (typeof ref == 'string') {\n      if (ref.charAt(0) == '#') {\n        ref = ref.substr(1);\n      }\n      if (ref == 'body') {\n        el = document.getElementsByTagName('body')[0];\n      }\n      else {\n        el = document.getElementById(ref);\n      }\n    }\n    else if (ref && ref.nodeType !== void 0) {\n      el = ref;\n    }\n    return el || null;\n  },\n\n  undraggable: function(el) {\n    el.ondragstart = function(){return false;};\n    el.draggable = false;\n  }\n\n};\n\nBrowser.onload = function(handler) {\n  if (document.readyState == 'complete') {\n    handler();\n  } else {\n    window.addEventListener('load', handler);\n  }\n};\n\n\n// See https://github.com/janl/mustache.js/blob/master/mustache.js\nutils.htmlEscape = (function() {\n  var entityMap = {\n    '&': '&amp;',\n    '<': '&lt;',\n    '>': '&gt;',\n    '\"': '&quot;',\n    \"'\": '&#39;',\n    '/': '&#x2F;'\n  };\n  return function(s) {\n    return String(s).replace(/[&<>\"'\\/]/g, function(s) {\n      return entityMap[s];\n    });\n  };\n}());\n\n\nvar classSelectorRE = /^\\.([\\w-]+)$/,\n    idSelectorRE = /^#([\\w-]+)$/,\n    tagSelectorRE = /^[\\w-]+$/,\n    tagOrIdSelectorRE = /^#?[\\w-]+$/;\n\nfunction Elements(sel) {\n  if ((this instanceof Elements) == false) {\n    return new Elements(sel);\n  }\n  this.elements = [];\n  this.select(sel);\n  this.tmp = new El();\n}\n\nElements.prototype = {\n  size: function() {\n    return this.elements.length;\n  },\n\n  select: function(sel) {\n    this.elements = Elements.__select(sel);\n    return this;\n  },\n\n  addClass: function(className) {\n    this.forEach(function(el) { el.addClass(className); });\n    return this;\n  },\n\n  removeClass: function(className) {\n    this.forEach(function(el) { el.removeClass(className); })\n    return this;\n  },\n\n  forEach: function(callback, ctx) {\n    var tmp = this.tmp;\n    for (var i=0, len=this.elements.length; i<len; i++) {\n      tmp.el = this.elements[i];\n      callback.call(ctx, tmp, i);\n    }\n    return this;\n  }\n};\n\nElements.__select = function(selector, root) {\n  root = root || document;\n  var els;\n  if (classSelectorRE.test(selector)) {\n    els = Elements.__getElementsByClassName(RegExp.$1, root);\n  }\n  else if (tagSelectorRE.test(selector)) {\n    els = root.getElementsByTagName(selector);\n  }\n  else if (document.querySelectorAll) {\n    try {\n      els = root.querySelectorAll(selector)\n    } catch (e) {\n      error(\"Invalid selector:\", selector);\n    }\n  } else {\n    error(\"This browser doesn't support CSS query selectors\");\n  }\n  return utils.toArray(els);\n}\n\nElements.__getElementsByClassName = function(cname, node) {\n  if (node.getElementsByClassName) {\n    return node.getElementsByClassName(cname);\n  }\n  var a = [];\n  var re = new RegExp('(^| )'+cname+'( |$)');\n  var els = node.getElementsByTagName(\"*\");\n  for (var i=0, j=els.length; i<j; i++)\n    if (re.test(els[i].className)) a.push(els[i]);\n  return a;\n};\n\n// Converts dash-separated names (e.g. background-color) to camelCase (e.g. backgroundColor)\n// Doesn't change names that are already camelCase\n//\nEl.toCamelCase = function(str) {\n  var cc = str.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase() });\n  return cc;\n};\n\nEl.fromCamelCase = function(str) {\n  var dashed = str.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n  return dashed;\n};\n\nEl.setStyle = function(el, name, val) {\n  var jsName = El.toCamelCase(name);\n  if (el.style[jsName] == void 0) {\n    trace(\"[Element.setStyle()] css property:\", jsName);\n    return;\n  }\n  var cssVal = val;\n  if (isFinite(val)) {\n    cssVal = String(val); // problem if converted to scientific notation\n    if (jsName != 'opacity' && jsName != 'zIndex') {\n      cssVal += \"px\";\n    }\n  }\n  el.style[jsName] = cssVal;\n}\n\nEl.findAll = function(sel, root) {\n  return Elements.__select(sel, root);\n};\n\nfunction El(ref) {\n  if (!ref) error(\"Element() needs a reference\");\n  if (ref instanceof El) {\n    return ref;\n  }\n  else if (this instanceof El === false) {\n    return new El(ref);\n  }\n\n  var node;\n  if (utils.isString(ref)) {\n    if (El.isHTML(ref)) {\n      var parent = El('div').html(ref).node();\n      node = parent.childNodes.length  == 1 ? parent.childNodes[0] : parent;\n    } else if (tagOrIdSelectorRE.test(ref)) {\n      node = Browser.getElement(ref) || document.createElement(ref); // TODO: detect type of argument\n    } else {\n      node = Elements.__select(ref)[0];\n    }\n  } else if (ref.tagName) {\n    node = ref;\n  }\n  if (!node) error(\"Unmatched element selector:\", ref);\n  this.el = node;\n}\n\nutils.inherit(El, EventDispatcher); //\n\nEl.removeAll = function(sel) {\n  var arr = Elements.__select(sel);\n  utils.forEach(arr, function(el) {\n    El(el).remove();\n  });\n};\n\nEl.isHTML = function(str) {\n  return str && str[0] == '<'; // TODO: improve\n};\n\nutils.extend(El.prototype, {\n\n  clone: function() {\n    var el = this.el.cloneNode(true);\n    if (el.nodeName == 'SCRIPT') {\n      // Assume scripts are templates and convert to divs, so children\n      //    can\n      el = El('div').addClass(el.className).html(el.innerHTML).node();\n    }\n    el.id = utils.getUniqueName();\n    this.el = el;\n    return this;\n  },\n\n  node: function() {\n    return this.el;\n  },\n\n  width: function() {\n   return this.el.offsetWidth;\n  },\n\n  height: function() {\n    return this.el.offsetHeight;\n  },\n\n  top: function() {\n    return this.el.offsetTop;\n  },\n\n  left: function() {\n    return this.el.offsetLeft;\n  },\n\n  // Apply inline css styles to this Element, either as string or object.\n  //\n  css: function(css, val) {\n    if (val != null) {\n      El.setStyle(this.el, css, val);\n    }\n    else if (utils.isString(css)) {\n      Browser.addCSS(this.el, css);\n    }\n    else if (utils.isObject(css)) {\n      utils.forEachProperty(css, function(val, key) {\n        El.setStyle(this.el, key, val);\n      }, this);\n    }\n    return this;\n  },\n\n  attr: function(obj, value) {\n    if (utils.isString(obj)) {\n      if (arguments.length == 1) {\n        return this.el.getAttribute(obj);\n      }\n      this.el[obj] = value;\n    }\n    else if (!value) {\n      Opts.copyAllParams(this.el, obj);\n    }\n    return this;\n  },\n\n\n  remove: function(sel) {\n    this.el.parentNode && this.el.parentNode.removeChild(this.el);\n    return this;\n  },\n\n  addClass: function(className) {\n    Browser.addClass(this.el, className);\n    return this;\n  },\n\n  removeClass: function(className) {\n    Browser.removeClass(this.el, className);\n    return this;\n  },\n\n  classed: function(className, b) {\n    this[b ? 'addClass' : 'removeClass'](className);\n    return this;\n  },\n\n  hasClass: function(className) {\n    return Browser.hasClass(this.el, className);\n  },\n\n  toggleClass: function(cname) {\n    if (this.hasClass(cname)) {\n      this.removeClass(cname);\n    } else {\n      this.addClass(cname);\n    }\n  },\n\n  computedStyle: function() {\n    return Browser.getElementStyle(this.el);\n  },\n\n  visible: function() {\n    if (this._hidden !== undefined) {\n      return !this._hidden;\n    }\n    var style = this.computedStyle();\n    return style.display != 'none' && style.visibility != 'hidden';\n  },\n\n  showCSS: function(css) {\n    if (!css) {\n      return this._showCSS || \"display:block;\";\n    }\n    this._showCSS = css;\n    return this;\n  },\n\n  hideCSS: function(css) {\n    if (!css) {\n      return this._hideCSS || \"display:none;\";\n    }\n    this._hideCSS = css;\n    return this;\n  },\n\n  hide: function(css) {\n    if (this.visible()) {\n      this.css(css || this.hideCSS());\n      this._hidden = true;\n    }\n    return this;\n  },\n\n  show: function(css) {\n    if (!this.visible()) {\n      this.css(css || this.showCSS());\n      this._hidden = false;\n    }\n    return this;\n  },\n\n  html: function(html) {\n    if (arguments.length == 0) {\n      return this.el.innerHTML;\n    } else {\n      this.el.innerHTML = html;\n      return this;\n    }\n  },\n\n  text: function(str) {\n    this.html(utils.htmlEscape(str));\n    return this;\n  },\n\n  // Shorthand for attr('id', <name>)\n  id: function(id) {\n    if (id) {\n      this.el.id = id;\n      return this;\n    }\n    return this.el.id;\n  },\n\n  findChild: function(sel) {\n    var node = Elements.__select(sel, this.el)[0];\n    if (!node) error(\"Unmatched selector:\", sel);\n    return new El(node);\n  },\n\n  appendTo: function(ref) {\n    var parent = ref instanceof El ? ref.el : Browser.getElement(ref);\n    if (this._sibs) {\n      for (var i=0, len=this._sibs.length; i<len; i++) {\n        parent.appendChild(this._sibs[i]);\n      }\n    }\n    parent.appendChild(this.el);\n    return this;\n  },\n\n  nextSibling: function() {\n    return this.el.nextSibling ? new El(this.el.nextSibling) : null;\n  },\n\n  newSibling: function(tagName) {\n    var el = this.el,\n        sib = document.createElement(tagName),\n        e = new El(sib),\n        par = el.parentNode;\n    if (par) {\n      el.nextSibling ? par.insertBefore(sib, el.nextSibling) : par.appendChild(sib);\n    } else {\n      e._sibs = this._sibs || [];\n      e._sibs.push(el);\n    }\n    return e;\n  },\n\n  firstChild: function() {\n    var ch = this.el.firstChild;\n    while (ch.nodeType != 1) { // skip text nodes\n      ch = ch.nextSibling;\n    }\n    return new El(ch);\n  },\n\n  appendChild: function(ref) {\n    var el = El(ref);\n    this.el.appendChild(el.el);\n    return this;\n  },\n\n  newChild: function(tagName) {\n    var ch = document.createElement(tagName);\n    this.el.appendChild(ch);\n    return new El(ch);\n  },\n\n  // Traverse to parent node\n  parent: function() {\n    var p = this.el && this.el.parentNode;\n    return p ? new El(p) : null;\n  },\n\n  findParent: function(tagName) {\n    var p = this.el && this.el.parentNode;\n    if (tagName) {\n      tagName = tagName.toUpperCase();\n      while (p && p.tagName != tagName) {\n        p = p.parentNode;\n      }\n    }\n    return p ? new El(p) : null;\n  },\n\n  // Remove all children of this element\n  //\n  empty: function() {\n    this.el.innerHTML = '';\n    return this;\n  }\n\n});\n\n// use DOM handler for certain events\n// TODO: find a better way distinguising DOM events and other events registered on El\n// e.g. different methods\n//\n//El.prototype.__domevents = utils.arrayToIndex(\"click,mousedown,mousemove,mouseup\".split(','));\nEl.prototype.__on = El.prototype.on;\nEl.prototype.on = function(type, func, ctx) {\n  if (ctx) {\n    error(\"[El#on()] Third argument no longer supported.\");\n  }\n  if (this.constructor == El) {\n    this.el.addEventListener(type, func);\n  } else {\n    this.__on.apply(this, arguments);\n  }\n  return this;\n};\n\nEl.prototype.__removeEventListener = El.prototype.removeEventListener;\nEl.prototype.removeEventListener = function(type, func) {\n  if (this.constructor == El) {\n    this.el.removeEventListener(type, func);\n  } else {\n    this.__removeEventListener.apply(this, arguments);\n  }\n  return this;\n};\n\n\nfunction ElementPosition(ref) {\n  var self = this,\n      el = El(ref),\n      pageX = 0,\n      pageY = 0,\n      width = 0,\n      height = 0;\n\n  el.on('mouseover', update);\n  window.onorientationchange && window.addEventListener('orientationchange', update);\n  window.addEventListener('scroll', update);\n  window.addEventListener('resize', update);\n\n  // trigger an update, e.g. when map container is resized\n  this.update = function() {\n    update();\n  };\n\n  this.resize = function(w, h) {\n    el.css('width', w).css('height', h);\n    update();\n  };\n\n  this.width = function() { return width };\n  this.height = function() { return height };\n  this.position = function() {\n    return {\n      element: el.node(),\n      pageX: pageX,\n      pageY: pageY,\n      width: width,\n      height: height\n    };\n  };\n\n  function update() {\n    var div = el.node(),\n        xy = Browser.getPageXY(div),\n        w = div.clientWidth,\n        h = div.clientHeight,\n        x = xy.x,\n        y = xy.y,\n        resized = w != width || h != height,\n        moved = x != pageX || y != pageY;\n    if (resized || moved) {\n      pageX = x, pageY = y, width = w, height = h;\n      self.dispatchEvent('change', self.position());\n      if (resized) {\n        self.dispatchEvent('resize', self.position());\n      }\n    }\n  }\n  update();\n}\n\nutils.inherit(ElementPosition, EventDispatcher);\n\n\nfunction getTimerFunction() {\n  return typeof requestAnimationFrame == 'function' ?\n    requestAnimationFrame : function(cb) {setTimeout(cb, 25);};\n}\n\nfunction Timer() {\n  var self = this,\n      running = false,\n      busy = false,\n      tickTime, startTime, duration;\n\n  this.start = function(ms) {\n    var now = +new Date();\n    duration = ms || Infinity;\n    startTime = now;\n    running = true;\n    if (!busy) startTick(now);\n  };\n\n  this.stop = function() {\n    running = false;\n  };\n\n  function startTick(now) {\n    busy = true;\n    tickTime = now;\n    getTimerFunction()(onTick);\n  }\n\n  function onTick() {\n    var now = +new Date(),\n        elapsed = now - startTime,\n        pct = Math.min((elapsed + 10) / duration, 1),\n        done = pct >= 1;\n    if (!running) { // interrupted\n      busy = false;\n      return;\n    }\n    if (done) running = false;\n    self.dispatchEvent('tick', {\n      elapsed: elapsed,\n      pct: pct,\n      done: done,\n      time: now,\n      tickTime: now - tickTime\n    });\n    busy = false;\n    if (running) startTick(now);\n  }\n}\n\nutils.inherit(Timer, EventDispatcher);\n\nfunction Tween(ease) {\n  var self = this,\n      timer = new Timer(),\n      start, end;\n\n  timer.on('tick', onTick);\n\n  this.start = function(a, b, duration) {\n    start = a;\n    end = b;\n    timer.start(duration || 500);\n  };\n\n  function onTick(e) {\n    var pct = ease ? ease(e.pct) : e.pct,\n        val = end * pct + start * (1 - pct);\n    self.dispatchEvent('change', {value: val});\n  }\n}\n\nutils.inherit(Tween, EventDispatcher);\n\nTween.sineInOut = function(n) {\n  return 0.5 - Math.cos(n * Math.PI) / 2;\n};\n\nTween.quadraticOut = function(n) {\n  return 1 - Math.pow((1 - n), 2);\n};\n\n\n// @mouse: MouseArea object\nfunction MouseWheel(mouse) {\n  var self = this,\n      prevWheelTime = 0,\n      currDirection = 0,\n      timer = new Timer().addEventListener('tick', onTick),\n      sustainTime = 60,\n      fadeTime = 80;\n\n  if (window.onmousewheel !== undefined) { // ie, webkit\n    window.addEventListener('mousewheel', handleWheel);\n  } else { // firefox\n    window.addEventListener('DOMMouseScroll', handleWheel);\n  }\n\n  function handleWheel(evt) {\n    var direction;\n    if (evt.wheelDelta) {\n      direction = evt.wheelDelta > 0 ? 1 : -1;\n    } else if (evt.detail) {\n      direction = evt.detail > 0 ? -1 : 1;\n    }\n    if (!mouse.isOver() || !direction) return;\n    evt.preventDefault();\n    prevWheelTime = +new Date();\n    if (!currDirection) {\n      self.dispatchEvent('mousewheelstart');\n    }\n    currDirection = direction;\n    timer.start(sustainTime + fadeTime);\n  }\n\n  function onTick(evt) {\n    var elapsed = evt.time - prevWheelTime,\n        fadeElapsed = elapsed - sustainTime,\n        scale = evt.tickTime / 25,\n        obj;\n    if (evt.done) {\n      currDirection = 0;\n    } else {\n      if (fadeElapsed > 0) {\n        // Decelerate if the timer fires during 'fade time' (for smoother zooming)\n        scale *= Tween.quadraticOut((fadeTime - fadeElapsed) / fadeTime);\n      }\n      obj = utils.extend({direction: currDirection, multiplier: scale}, mouse.mouseData());\n      self.dispatchEvent('mousewheel', obj);\n    }\n  }\n}\n\nutils.inherit(MouseWheel, EventDispatcher);\n\n\nfunction MouseArea(element) {\n  var pos = new ElementPosition(element),\n      _areaPos = pos.position(),\n      _self = this,\n      _dragging = false,\n      _isOver = false,\n      _prevEvt,\n      // _moveEvt,\n      _downEvt;\n\n  pos.on('change', function() {_areaPos = pos.position()});\n  // TODO: think about touch events\n  document.addEventListener('mousemove', onMouseMove);\n  document.addEventListener('mousedown', onMouseDown);\n  document.addEventListener('mouseup', onMouseUp);\n  element.addEventListener('mouseover', onAreaEnter);\n  element.addEventListener('mousemove', onAreaEnter);\n  element.addEventListener('mouseout', onAreaOut);\n  element.addEventListener('mousedown', onAreaDown);\n  element.addEventListener('dblclick', onAreaDblClick);\n\n  function onAreaDown(e) {\n    e.preventDefault(); // prevent text selection cursor on drag\n  }\n\n  function onAreaEnter() {\n    if (!_isOver) {\n      _isOver = true;\n      _self.dispatchEvent('enter');\n    }\n  }\n\n  function onAreaOut(e) {\n    _isOver = false;\n    _self.dispatchEvent('leave');\n  }\n\n  function onMouseUp(e) {\n    var evt = procMouseEvent(e),\n        elapsed, dx, dy;\n    if (_dragging) {\n      _dragging = false;\n      _self.dispatchEvent('dragend', evt);\n    }\n    if (_downEvt) {\n      elapsed = evt.time - _downEvt.time;\n      dx = evt.pageX - _downEvt.pageX;\n      dy = evt.pageY - _downEvt.pageY;\n      if (_isOver && elapsed < 500 && Math.sqrt(dx * dx + dy * dy) < 6) {\n        _self.dispatchEvent('click', evt);\n      }\n      _downEvt = null;\n    }\n  }\n\n  function onMouseDown(e) {\n   if (e.button != 2 && e.which != 3) { // ignore right-click\n      _downEvt = procMouseEvent(e);\n    }\n  }\n\n  function onMouseMove(e) {\n    var evt = procMouseEvent(e);\n    if (!_dragging && _downEvt && _downEvt.hover) {\n      _dragging = true;\n      _self.dispatchEvent('dragstart', evt);\n    }\n\n    if (_dragging) {\n      var obj = {\n        dragX: evt.pageX - _downEvt.pageX,\n        dragY: evt.pageY - _downEvt.pageY\n      };\n      _self.dispatchEvent('drag', utils.extend(obj, evt));\n    } else {\n      _self.dispatchEvent('hover', evt);\n    }\n  }\n\n  function onAreaDblClick(e) {\n    if (_isOver) _self.dispatchEvent('dblclick', procMouseEvent(e));\n  }\n\n  function procMouseEvent(e) {\n    var pageX = e.pageX,\n        pageY = e.pageY,\n        prev = _prevEvt;\n    _prevEvt = {\n      shiftKey: e.shiftKey,\n      time: +new Date,\n      pageX: pageX,\n      pageY: pageY,\n      hover: _isOver,\n      x: pageX - _areaPos.pageX,\n      y: pageY - _areaPos.pageY,\n      dx: prev ? pageX - prev.pageX : 0,\n      dy: prev ? pageY - prev.pageY : 0\n    };\n    return _prevEvt;\n  }\n\n  this.isOver = function() {\n    return _isOver;\n  }\n\n  this.isDown = function() {\n    return !!_downEvt;\n  }\n\n  this.mouseData = function() {\n    return utils.extend({}, _prevEvt);\n  }\n}\n\nutils.inherit(MouseArea, EventDispatcher);\n\n\n\n\nfunction ErrorMessages(model) {\n  var el;\n  model.addMode('alert', function() {}, turnOff);\n\n  function turnOff() {\n    if (el) {\n      el.remove();\n      el = null;\n    }\n  }\n\n  return function(str) {\n    var infoBox;\n    if (el) return;\n    el = El('div').appendTo('body').addClass('error-wrapper');\n    infoBox = El('div').appendTo(el).addClass('error-box info-box');\n    El('p').addClass('error-message').appendTo(infoBox).html(str);\n    El('div').addClass(\"btn dialog-btn\").appendTo(infoBox).html('close').on('click', model.clearMode);\n    model.enterMode('alert');\n  };\n}\n\n\n\n\napi.enableLogging();\n\ngui.browserIsSupported = function() {\n  return typeof ArrayBuffer != 'undefined' &&\n      typeof Blob != 'undefined' && typeof File != 'undefined';\n};\n\ngui.formatMessageArgs = function(args) {\n  // remove cli annotation (if present)\n  return MapShaper.formatLogArgs(args).replace(/^\\[[^\\]]+\\] ?/, '');\n};\n\ngui.handleDirectEvent = function(cb) {\n  return function(e) {\n    if (e.target == this) cb();\n  };\n};\n\ngui.getInputElement = function() {\n  var el = document.activeElement;\n  return (el && (el.tagName == 'INPUT' || el.contentEditable == 'true')) ? el : null;\n};\n\ngui.selectElement = function(el) {\n  var range = document.createRange(),\n      sel = getSelection();\n  range.selectNodeContents(el);\n  sel.removeAllRanges();\n  sel.addRange(range);\n};\n\ngui.blurActiveElement = function() {\n  var el = gui.getInputElement();\n  if (el) el.blur();\n};\n\n// Filter out delayed click events, e.g. so users can highlight and copy text\ngui.onClick = function(el, cb) {\n  var time;\n  el.on('mousedown', function() {\n    time = +new Date();\n  });\n  el.on('mouseup', function(e) {\n    if (+new Date() - time < 300) cb(e);\n  });\n};\n\n\n\n\n// TODO: switch all ClickText to ClickText2\n\n// @ref Reference to an element containing a text node\nfunction ClickText2(ref) {\n  var self = this;\n  var selected = false;\n  var el = El(ref).on('mousedown', init);\n\n  function init() {\n    el.removeEventListener('mousedown', init);\n    el.attr('contentEditable', true)\n    .attr('spellcheck', false)\n    .attr('autocorrect', false)\n    .on('focus', function(e) {\n      el.addClass('editing');\n      selected = false;\n    }).on('blur', function(e) {\n      el.removeClass('editing');\n      self.dispatchEvent('change');\n      getSelection().removeAllRanges();\n    }).on('keydown', function(e) {\n      if (e.keyCode == 13) { // enter\n        e.stopPropagation();\n        e.preventDefault();\n        this.blur();\n      }\n    }).on('click', function(e) {\n      if (!selected && getSelection().isCollapsed) {\n        gui.selectElement(el.node());\n      }\n      selected = true;\n      e.stopPropagation();\n    });\n  }\n\n  this.value = function(str) {\n    if (utils.isString(str)) {\n      el.node().textContent = str;\n    } else {\n      return el.node().textContent;\n    }\n  };\n}\n\nutils.inherit(ClickText2, EventDispatcher);\n\n// @ref reference to a text input element\nfunction ClickText(ref) {\n  var _el = El(ref);\n  var _self = this;\n  var _max = Infinity,\n      _min = -Infinity,\n      _formatter = function(v) {return String(v);},\n      _validator = function(v) {return !isNaN(v);},\n      _parser = function(s) {return parseFloat(s);},\n      _value = 0;\n\n  _el.on('blur', onblur);\n  _el.on('keydown', onpress);\n\n  function onpress(e) {\n    if (e.keyCode == 27) { // esc\n      _self.value(_value); // reset input field to current value\n      _el.el.blur();\n    } else if (e.keyCode == 13) { // enter\n      _el.el.blur();\n    }\n  }\n\n  // Validate input contents.\n  // Update internal value and fire 'change' if valid\n  //\n  function onblur() {\n    var val = _parser(_el.el.value);\n    if (val === _value) {\n      // return;\n    }\n    if (_validator(val)) {\n      _self.value(val);\n      _self.dispatchEvent('change', {value:_self.value()});\n    } else {\n      _self.value(_value);\n      _self.dispatchEvent('error'); // TODO: improve\n    }\n  }\n\n  this.bounds = function(min, max) {\n    _min = min;\n    _max = max;\n    return this;\n  };\n\n  this.validator = function(f) {\n    _validator = f;\n    return this;\n  };\n\n  this.formatter = function(f) {\n    _formatter = f;\n    return this;\n  };\n\n  this.parser = function(f) {\n    _parser = f;\n    return this;\n  };\n\n  this.value = function(arg) {\n    if (arg == void 0) {\n      // var valStr = this.el.value;\n      // return _parser ? _parser(valStr) : parseFloat(valStr);\n      return _value;\n    }\n    var val = utils.clamp(arg, _min, _max);\n    if (!_validator(val)) {\n      error(\"ClickText#value() invalid value:\", arg);\n    } else {\n      _value = val;\n    }\n    _el.el.value = _formatter(val);\n    return this;\n  };\n}\n\nutils.inherit(ClickText, EventDispatcher);\n\n\nfunction Checkbox(ref) {\n  var _el = El(ref);\n}\n\nutils.inherit(Checkbox, EventDispatcher);\n\nfunction SimpleButton(ref) {\n  var _el = El(ref),\n      _self = this,\n      _active = !_el.hasClass('disabled');\n\n  _el.on('click', function(e) {\n    if (_active) _self.dispatchEvent('click');\n    return false;\n  });\n\n  this.active = function(a) {\n    if (a === void 0) return _active;\n    if (a !== _active) {\n      _active = a;\n      _el.toggleClass('disabled');\n    }\n    return this;\n  };\n}\n\nutils.inherit(SimpleButton, EventDispatcher);\n\n\n\n\nfunction ModeButton(el, name, model) {\n  var btn = El(el),\n      active = false;\n  model.on('mode', function(e) {\n    active = e.name == name;\n    if (active) {\n      btn.addClass('active');\n    } else {\n      btn.removeClass('active');\n    }\n  });\n\n  btn.on('click', function() {\n    model.enterMode(active ? null : name);\n  });\n}\n\n\n\n\nfunction draggable(ref) {\n  var xdown, ydown;\n  var el = El(ref),\n      dragging = false,\n      obj = new EventDispatcher();\n  Browser.undraggable(el.node());\n  el.on('mousedown', function(e) {\n    xdown = e.pageX;\n    ydown = e.pageY;\n    window.addEventListener('mousemove', onmove);\n    window.addEventListener('mouseup', onrelease);\n  });\n\n  function onrelease(e) {\n    window.removeEventListener('mousemove', onmove);\n    window.removeEventListener('mouseup', onrelease);\n    if (dragging) {\n      dragging = false;\n      obj.dispatchEvent('dragend');\n    }\n  }\n\n  function onmove(e) {\n    if (!dragging) {\n      dragging = true;\n      obj.dispatchEvent('dragstart');\n    }\n    obj.dispatchEvent('drag', {dx: e.pageX - xdown, dy: e.pageY - ydown});\n  }\n  return obj;\n}\n\nfunction Slider(ref, opts) {\n  var _el = El(ref);\n  var _self = this;\n  var defaults = {\n    space: 7\n  };\n  opts = utils.extend(defaults, opts);\n\n  var _pct = 0;\n  var _track,\n      _handle,\n      _handleLeft = opts.space;\n\n  function size() {\n    return _track ? _track.width() - opts.space * 2 : 0;\n  }\n\n  this.track = function(ref) {\n    if (ref && !_track) {\n      _track = El(ref);\n      _handleLeft = _track.el.offsetLeft + opts.space;\n      updateHandlePos();\n    }\n    return _track;\n  };\n\n  this.handle = function(ref) {\n    var startX;\n    if (ref && !_handle) {\n      _handle = El(ref);\n      draggable(_handle)\n        .on('drag', function(e) {\n          setHandlePos(startX + e.dx, true);\n        })\n        .on('dragstart', function(e) {\n          startX = position();\n          _self.dispatchEvent('start');\n        })\n        .on('dragend', function(e) {\n          _self.dispatchEvent('end');\n        });\n      updateHandlePos();\n    }\n    return _handle;\n  };\n\n  function position() {\n    return Math.round(_pct * size());\n  }\n\n  this.pct = function(pct) {\n    if (pct >= 0 && pct <= 1) {\n      _pct = pct;\n      updateHandlePos();\n    }\n    return _pct;\n  };\n\n  function setHandlePos(x, fire) {\n    x = utils.clamp(x, 0, size());\n    var pct = x / size();\n    if (pct != _pct) {\n      _pct = pct;\n      _handle.css('left', _handleLeft + x);\n      _self.dispatchEvent('change', {pct: _pct});\n    }\n  }\n\n  function updateHandlePos() {\n    var x = _handleLeft + Math.round(position());\n    if (_handle) _handle.css('left', x);\n  }\n}\n\nutils.inherit(Slider, EventDispatcher);\n\n\n\nvar SimplifyControl = function(model) {\n  var control = new EventDispatcher();\n  var _value = 1;\n  var el = El('#simplify-control-wrapper');\n  var menu = El('#simplify-options');\n  var slider, text;\n\n  new SimpleButton('#simplify-options .submit-btn').on('click', onSubmit);\n  new SimpleButton('#simplify-options .cancel-btn').on('click', function() {\n    if (el.visible()) {\n      // cancel just hides menu if slider is visible\n      menu.hide();\n    } else {\n      model.clearMode();\n    }\n  });\n  new SimpleButton('#simplify-settings-btn').on('click', function() {\n    if (menu.visible()) {\n      menu.hide();\n    } else {\n      initMenu();\n    }\n  });\n\n  new ModeButton('#simplify-btn', 'simplify', model);\n  model.addMode('simplify', turnOn, turnOff);\n  model.on('select', function() {\n    if (model.getMode() == 'simplify') model.clearMode();\n  });\n\n  // exit simplify mode when user clicks off the visible part of the menu\n  menu.on('click', gui.handleDirectEvent(model.clearMode));\n\n  slider = new Slider(\"#simplify-control .slider\");\n  slider.handle(\"#simplify-control .handle\");\n  slider.track(\"#simplify-control .track\");\n  slider.on('change', function(e) {\n    var pct = fromSliderPct(e.pct);\n    text.value(pct);\n    onchange(pct);\n  });\n  slider.on('start', function(e) {\n    control.dispatchEvent('simplify-start');\n  }).on('end', function(e) {\n    control.dispatchEvent('simplify-end');\n  });\n\n  text = new ClickText(\"#simplify-control .clicktext\");\n  text.bounds(0, 1);\n  text.formatter(function(val) {\n    if (isNaN(val)) return '-';\n    var pct = val * 100;\n    var decimals = 0;\n    if (pct <= 0) decimals = 1;\n    else if (pct < 0.001) decimals = 4;\n    else if (pct < 0.01) decimals = 3;\n    else if (pct < 1) decimals = 2;\n    else if (pct < 100) decimals = 1;\n    return utils.formatNumber(pct, decimals) + \"%\";\n  });\n\n  text.parser(function(s) {\n    return parseFloat(s) / 100;\n  });\n\n  text.value(0);\n  text.on('change', function(e) {\n    var pct = e.value;\n    slider.pct(toSliderPct(pct));\n    control.dispatchEvent('simplify-start');\n    onchange(pct);\n    control.dispatchEvent('simplify-end');\n  });\n\n  function turnOn() {\n    var target = model.getEditingLayer();\n    if (!MapShaper.layerHasPaths(target.layer)) {\n      gui.alert(\"This layer can not be simplified\");\n      return;\n    }\n    if (target.dataset.arcs.getVertexData().zz) {\n      // TODO: try to avoid calculating pct (slow);\n      showSlider(); // need to show slider before setting; TODO: fix\n      control.value(target.dataset.arcs.getRetainedPct());\n    } else {\n      initMenu();\n    }\n  }\n\n  function initMenu() {\n    var dataset = model.getEditingLayer().dataset;\n    var showPlanarOpt = !dataset.arcs.isPlanar();\n    var opts = MapShaper.getStandardSimplifyOpts(dataset, dataset.info && dataset.info.simplify);\n    El('#planar-opt-wrapper').node().style.display = showPlanarOpt ? 'block' : 'none';\n    El('#planar-opt').node().checked = !opts.spherical;\n    El(\"#import-retain-opt\").node().checked = opts.keep_shapes;\n    El(\"#simplify-options input[value=\" + opts.method + \"]\").node().checked = true;\n    menu.show();\n  }\n\n  function turnOff() {\n    menu.hide();\n    control.reset();\n  }\n\n  function onSubmit() {\n    var dataset = model.getEditingLayer().dataset;\n    var showMsg = dataset.arcs && dataset.arcs.getPointCount() > 1e6;\n    var delay = 0;\n    if (showMsg) {\n      delay = 35;\n      gui.showProgressMessage('Calculating');\n    }\n    menu.hide();\n    setTimeout(function() {\n      var opts = getSimplifyOptions();\n      mapshaper.simplify(dataset, opts);\n      model.updated({\n        // use presimplify flag if no vertices are removed\n        // (to trigger map redraw without recalculating intersections)\n        presimplify: opts.pct == 1,\n        simplify: opts.pct < 1\n      });\n      showSlider();\n      gui.clearProgressMessage();\n    }, delay);\n  }\n\n  function showSlider() {\n    el.show();\n    El('body').addClass('simplify'); // for resizing, hiding layer label, etc.\n  }\n\n  function getSimplifyOptions() {\n    var method = El('#simplify-options input[name=method]:checked').attr('value') || null;\n    return {\n      method: method,\n      pct: _value,\n      no_repair: true,\n      keep_shapes: !!El(\"#import-retain-opt\").node().checked,\n      planar: !!El('#planar-opt').node().checked\n    };\n  }\n\n  function toSliderPct(p) {\n    p = Math.sqrt(p);\n    var pct = 1 - p;\n    return pct;\n  }\n\n  function fromSliderPct(p) {\n    var pct = 1 - p;\n    return pct * pct;\n  }\n\n  function onchange(val) {\n    if (_value != val) {\n      _value = val;\n      control.dispatchEvent('change', {value:val});\n    }\n  }\n\n  control.reset = function() {\n    control.value(1);\n    el.hide();\n    menu.hide();\n    El('body').removeClass('simplify');\n  };\n\n  control.value = function(val) {\n    if (!isNaN(val)) {\n      // TODO: validate\n      _value = val;\n      slider.pct(toSliderPct(val));\n      text.value(val);\n    }\n    return _value;\n  };\n\n  control.value(_value);\n  return control;\n};\n\n\n// Assume zip.js is loaded and zip is defined globally\nzip.workerScripts = {\n  // deflater: ['z-worker.js', 'deflate.js'], // use zip.js deflater\n  // TODO: find out why it was necessary to rename pako_deflate.min.js\n  deflater: ['z-worker.js', 'pako.deflate.js', 'codecs.js'],\n  inflater: ['z-worker.js', 'pako.inflate.js', 'codecs.js']\n};\n\n// @file: Zip file\n// @cb: function(err, <files>)\n//\ngui.readZipFile = function(file, cb) {\n  var _files = [];\n  zip.createReader(new zip.BlobReader(file), importZipContent, onError);\n\n  function onError(err) {\n    cb(err);\n  }\n\n  function onDone() {\n    cb(null, _files);\n  }\n\n  function importZipContent(reader) {\n    var _entries;\n    reader.getEntries(readEntries);\n\n    function readEntries(entries) {\n      _entries = entries || [];\n      readNext();\n    }\n\n    function readNext() {\n      if (_entries.length > 0) {\n        readEntry(_entries.pop());\n      } else {\n        reader.close();\n        onDone();\n      }\n    }\n\n    function readEntry(entry) {\n      var filename = entry.filename,\n          isValid = !entry.directory && gui.isReadableFileType(filename) &&\n              !/^__MACOSX/.test(filename); // ignore \"resource-force\" files\n      if (isValid) {\n        entry.getData(new zip.BlobWriter(), function(file) {\n          file.name = filename; // Give the Blob a name, like a File object\n          _files.push(file);\n          readNext();\n        });\n      } else {\n        readNext();\n      }\n    }\n  }\n};\n\n\n\n\ngui.showProgressMessage = function(msg) {\n  if (!gui.progressMessage) {\n    gui.progressMessage = El('div').id('progress-message')\n      .appendTo('body');\n  }\n  El('<div>').text(msg).appendTo(gui.progressMessage.empty().show());\n};\n\ngui.clearProgressMessage = function() {\n  if (gui.progressMessage) gui.progressMessage.hide();\n};\n\n\n\n\ngui.parseFreeformOptions = function(raw, cmd) {\n  var str = raw.trim(),\n      parsed;\n  if (!str) {\n    return {};\n  }\n  if (!/^-/.test(str)) {\n    str = '-' + cmd + ' ' + str;\n  }\n  parsed =  MapShaper.parseCommands(str);\n  if (!parsed.length || parsed[0].name != cmd) {\n    stop(\"Unable to parse command line options\");\n  }\n  return parsed[0].options;\n};\n\n\n\n\n// tests if filename is a type that can be used\ngui.isReadableFileType = function(filename) {\n  var ext = utils.getFileExtension(filename).toLowerCase();\n  return !!MapShaper.guessInputFileType(filename) || MapShaper.couldBeDsvFile(filename) ||\n    MapShaper.isZipFile(filename);\n};\n\n// @cb function(<FileList>)\nfunction DropControl(cb) {\n  var el = El('body');\n  el.on('dragleave', ondrag);\n  el.on('dragover', ondrag);\n  el.on('drop', ondrop);\n  function ondrag(e) {\n    // blocking drag events enables drop event\n    e.preventDefault();\n  }\n  function ondrop(e) {\n    e.preventDefault();\n    cb(e.dataTransfer.files);\n  }\n}\n\n// @el DOM element for select button\n// @cb function(<FileList>)\nfunction FileChooser(el, cb) {\n  var btn = El(el).on('click', function() {\n    input.el.click();\n  });\n  var input = El('form')\n    .addClass('file-control').appendTo('body')\n    .newChild('input')\n    .attr('type', 'file')\n    .attr('multiple', 'multiple')\n    .on('change', onchange);\n\n  function onchange(e) {\n    var files = e.target.files;\n    // files may be undefined (e.g. if user presses 'cancel' after a file has been selected)\n    if (files) {\n      // disable the button while files are being processed\n      btn.addClass('selected');\n      input.attr('disabled', true);\n      cb(files);\n      btn.removeClass('selected');\n      input.attr('disabled', false);\n    }\n  }\n}\n\nfunction ImportControl(model) {\n  new SimpleButton('#import-buttons .submit-btn').on('click', submitFiles);\n  new SimpleButton('#import-buttons .cancel-btn').on('click', model.clearMode);\n  var importCount = 0;\n  var queuedFiles = [];\n\n  model.addMode('import', turnOn, turnOff);\n  new DropControl(receiveFiles);\n  new FileChooser('#file-selection-btn', receiveFiles);\n  new FileChooser('#import-buttons .add-btn', receiveFiles);\n  new FileChooser('#add-file-btn', receiveFiles);\n  model.enterMode('import');\n  model.on('mode', function(e) {\n    // re-open import opts if leaving alert or console modes and nothing has been imported yet\n    if (!e.name && importCount === 0) {\n      model.enterMode('import');\n    }\n  });\n\n  function findMatchingShp(filename) {\n    var shpName = utils.replaceFileExtension(filename, 'shp');\n    return model.getDatasets().filter(function(d) {\n      return shpName == d.info.input_files[0];\n    });\n  }\n\n  function turnOn() {\n    if (mapshaper.manifest) {\n      downloadFiles(mapshaper.manifest);\n      mapshaper.manifest = null;\n    } else {\n      El('#import-options').show();\n    }\n  }\n\n  function close() {\n    El('#fork-me').hide();\n    El('#import-intro').hide(); // only show intro before first import\n    El('#import-buttons').show();\n    El('#import-options').hide();\n  }\n\n  function turnOff() {\n    gui.clearProgressMessage();\n    clearFiles();\n    close();\n  }\n\n  function clearFiles() {\n    queuedFiles = [];\n    El('#dropped-file-list .file-list').empty();\n    El('#dropped-file-list').hide();\n  }\n\n  function addFiles(files) {\n    var index = {};\n    queuedFiles = queuedFiles.concat(files).reduce(function(memo, f) {\n      // filter out unreadable types and dupes\n      if (gui.isReadableFileType(f.name) && f.name in index === false) {\n        index[f.name] = true;\n        memo.push(f);\n      }\n      return memo;\n    }, []);\n    // sort alphabetically by filename\n    queuedFiles.sort(function(a, b) {\n      return a.name > b.name ? 1 : -1;\n    });\n  }\n\n  function showQueuedFiles() {\n    var list = El('#dropped-file-list .file-list').empty();\n    El('#dropped-file-list').show();\n    queuedFiles.forEach(function(f) {\n      El('<p>').text(f.name).appendTo(El(\"#dropped-file-list .file-list\"));\n    });\n  }\n\n  function receiveFiles(files) {\n    var prevSize = queuedFiles.length;\n    addFiles(utils.toArray(files));\n    if (queuedFiles.length === 0) return;\n    model.enterMode('import');\n    if (importCount === 0 && prevSize === 0 && containsImmediateFile(queuedFiles)) {\n      // if the first batch of files will be imported, process right away\n      submitFiles();\n    } else {\n      showQueuedFiles();\n      El('#import-buttons').show();\n    }\n  }\n\n  // Check if an array of File objects contains a file that should be imported right away\n  function containsImmediateFile(files) {\n    return utils.some(files, function(f) {\n        var type = MapShaper.guessInputFileType(f.name);\n        return type == 'shp' || type == 'json';\n    });\n  }\n\n  function submitFiles() {\n    close();\n    readNext();\n  }\n\n  function readNext() {\n    if (queuedFiles.length > 0) {\n      readFile(queuedFiles.pop()); // read in rev. alphabetic order, so .shp comes before .dbf\n    } else {\n      model.clearMode();\n    }\n  }\n\n  function getImportOpts() {\n    var freeform = El('#import-options .advanced-options').node().value,\n        opts = gui.parseFreeformOptions(freeform, 'i');\n    opts.no_repair = !El(\"#repair-intersections-opt\").node().checked;\n    opts.auto_snap = !!El(\"#snap-points-opt\").node().checked;\n    return opts;\n  }\n\n  function loadFile(file, cb) {\n    var reader = new FileReader(),\n        isBinary = MapShaper.isBinaryFile(file.name);\n    // no callback on error -- fix?\n    reader.onload = function(e) {\n      cb(null, reader.result);\n    };\n    if (isBinary) {\n      reader.readAsArrayBuffer(file);\n    } else {\n      // TODO: improve to handle encodings, etc.\n      reader.readAsText(file, 'UTF-8');\n    }\n  }\n\n  // @file a File object\n  function readFile(file) {\n    if (MapShaper.isZipFile(file.name)) {\n      readZipFile(file);\n    } else {\n      loadFile(file, function(err, content) {\n        if (err) {\n          readNext();\n        } else {\n          readFileContent(file.name, content);\n        }\n      });\n    }\n  }\n\n  function readFileContent(name, content) {\n    var type = MapShaper.guessInputType(name, content),\n        importOpts = getImportOpts(),\n        matches = findMatchingShp(name),\n        dataset, lyr;\n\n    // TODO: refactor\n    if (type == 'dbf' && matches.length > 0) {\n      // find an imported .shp layer that is missing attribute data\n      // (if multiple matches, try to use the most recently imported one)\n      dataset = matches.reduce(function(memo, d) {\n        if (!d.layers[0].data) {\n          memo = d;\n        }\n        return memo;\n      }, null);\n      if (dataset) {\n        lyr = dataset.layers[0];\n        lyr.data = new MapShaper.ShapefileTable(content, importOpts.encoding);\n        if (lyr.shapes && lyr.data.size() != lyr.shapes.length) {\n          stop(\"Different number of records in .shp and .dbf files\");\n        }\n        if (!lyr.geometry_type) {\n          // kludge: trigger display of table cells if .shp has null geometry\n          model.updated(null, lyr, dataset);\n        }\n        readNext();\n        return;\n      }\n    }\n\n    if (type == 'prj') {\n      // assumes that .shp has been imported first\n      matches.forEach(function(d) {\n        if (!d.info.output_prj && !d.info.input_prj) {\n          d.info.input_prj = content;\n        }\n      });\n      readNext();\n      return;\n    }\n\n    importFileContent(type, name, content, importOpts);\n  }\n\n  function importFileContent(type, path, content, importOpts) {\n    var size = content.byteLength || content.length, // ArrayBuffer or string\n        showMsg = size > 4e7, // don't show message if dataset is small\n        delay = 0;\n    importOpts.files = [path]; // TODO: try to remove this\n    if (showMsg) {\n      gui.showProgressMessage('Importing');\n      delay = 35;\n    }\n    setTimeout(function() {\n      var dataset = MapShaper.importFileContent(content, path, importOpts);\n      dataset.info.no_repair = importOpts.no_repair;\n      model.addDataset(dataset);\n      importCount++;\n      readNext();\n    }, delay);\n  }\n\n  function readZipFile(file) {\n    gui.showProgressMessage('Importing');\n    setTimeout(function() {\n      gui.readZipFile(file, function(err, files) {\n        if (err) {\n          console.log(\"Zip file loading failed:\");\n          throw err;\n        }\n        // don't try to import .txt files from zip files\n        // (these would be parsed as dsv and throw errows)\n        files = files.filter(function(f) {\n          return !/\\.txt$/i.test(f.name);\n        });\n        addFiles(files);\n        readNext();\n      });\n    }, 35);\n  }\n\n  function downloadFiles(paths, opts) {\n    paths = paths.filter(function(f) {\n      return gui.isReadableFileType(f);\n    });\n    utils.reduceAsync(paths, [], downloadNextFile, function(err, files) {\n      if (err || !files.length) {\n        model.clearMode();\n      } else {\n        addFiles(files);\n        submitFiles();\n      }\n    });\n  }\n\n  function downloadNextFile(memo, filepath, next) {\n    var req = new XMLHttpRequest();\n    req.responseType = 'blob';\n    req.addEventListener('load', function(e) {\n      var blob = req.response;\n      blob.name = filepath;\n      memo.push(blob);\n      next(null, memo);\n    });\n    req.addEventListener('error', function(e) {\n      next('error');\n    });\n    req.open('GET', '/data/' + filepath);\n    req.send();\n  }\n}\n\n\n\n\n// Export buttons and their behavior\nvar ExportControl = function(model) {\n  var downloadSupport = typeof URL != 'undefined' && URL.createObjectURL &&\n    typeof document.createElement(\"a\").download != \"undefined\" ||\n    !!window.navigator.msSaveBlob;\n  var unsupportedMsg = \"Exporting is not supported in this browser\";\n  var menu = El('#export-options').on('click', gui.handleDirectEvent(model.clearMode));\n  var datasets = []; // array of exportable layers grouped by dataset\n  var anchor, blobUrl;\n  new SimpleButton('#export-options .cancel-btn').on('click', model.clearMode);\n\n  if (!downloadSupport) {\n    El('#export-btn').on('click', function() {\n      gui.alert(unsupportedMsg);\n    });\n\n    MapShaper.writeFiles = function() {\n      error(unsupportedMsg);\n    };\n  } else {\n    anchor = menu.newChild('a').attr('href', '#').node();\n    initExportButton();\n    model.addMode('export', turnOn, turnOff);\n    new ModeButton('#export-btn', 'export', model);\n\n    MapShaper.writeFiles = function(files, opts, done) {\n     \n      if (!utils.isArray(files) || files.length === 0) {\n        done(\"Nothing to export\");\n      }else if (opts.isEchartsType) {\n        var content=\"\";\n        var fileFormat=\".json\";\n        var filename=files[0].filename.replace('.json','');\n        if(opts.isEchartsType==='json'){\n           fileFormat=\".json\";\n           content=Encoder.convert2Echarts(files[0].content, filename,'json');\n        }else{\n            fileFormat=\".js\";\n           content=Encoder.convert2Echarts(files[0].content, filename,'js');\n        }\n        saveBlob(filename+fileFormat, new Blob([content]), done);\n      }else if (files.length == 1) {\n        saveBlob(files[0].filename, new Blob([files[0].content]), done);\n      } else {\n        filename = utils.getCommonFileBase(utils.pluck(files, 'filename')) || \"output\";\n        saveZipFile(filename + \".zip\", files, done);\n      }\n    };\n  }\n\n  function initLayerMenu() {\n    // init layer menu with current editing layer selected\n    var list = El('#export-layer-list').empty();\n    var template = '<label><input type=\"checkbox\" checked> %s</label>';\n    var datasets = model.getDatasets().map(initDataset);\n    var hideLayers = datasets.length == 1 && datasets[0].layers.length < 2;\n    El('#export-layers').css('display', hideLayers ? 'none' : 'block');\n    return datasets;\n\n    function initDataset(dataset) {\n      var layers = dataset.layers.map(function(lyr) {\n        var html = utils.format(template, lyr.name || '[unnamed layer]');\n        var box = El('div').html(html).appendTo(list).findChild('input').node();\n        return {\n          checkbox: box,\n          layer: lyr\n        };\n      });\n      return {\n        dataset: dataset,\n        layers: layers\n      };\n    }\n  }\n\n  function getInputFormats() {\n    return model.getDatasets().reduce(function(memo, d) {\n      var fmt = d.info && d.info.input_format;\n      if (fmt) memo.push(fmt);\n      return memo;\n    }, []);\n  }\n\n  function getDefaultExportFormat() {\n    var dataset = model.getEditingLayer().dataset;\n    return dataset.info && dataset.info.input_format || 'geojson';\n  }\n\n  function initFormatMenu() {\n    var defaults = ['shapefile', 'geojson', 'topojson', 'dsv','svg','echartsmapjson','echartsmapjs'];\n    var formats = utils.uniq(defaults.concat(getInputFormats()));\n    var items = formats.map(function(fmt) {\n      return utils.format('<div><label><input type=\"radio\" name=\"format\" value=\"%s\"' +\n        ' class=\"radio\">%s</label></div>', fmt, MapShaper.getFormatName(fmt));\n    });\n    El('#export-formats').html(items.join('\\n'));\n    El('#export-formats input[value=\"' + getDefaultExportFormat() + '\"]').node().checked = true;\n  }\n\n  function turnOn() {\n    datasets = initLayerMenu();\n    initFormatMenu();\n    menu.show();\n  }\n\n  function turnOff() {\n    menu.hide();\n  }\n\n  function getSelectedFormat() {\n    return El('#export-formats input:checked').node().value;\n  }\n\n  function getSelectedLayers() {\n    var selections = datasets.reduce(function(memo, obj) {\n      var dataset = obj.dataset;\n      var selection = obj.layers.reduce(reduceLayer, []);\n      if (selection.length > 0) {\n        memo.push(utils.defaults({layers: selection}, dataset));\n      }\n      return memo;\n    }, []);\n\n    function reduceLayer(memo, obj) {\n      if (obj.checkbox.checked) {\n        // shallow-copy layer, so uniqified filenames do not affect original layers\n        memo.push(utils.extend({}, obj.layer));\n      }\n      return memo;\n    }\n    return selections;\n  }\n\n  function initExportButton() {\n    new SimpleButton('#save-btn').on('click', function() {\n      gui.showProgressMessage('Exporting');\n      model.clearMode();\n      setTimeout(function() {\n        exportMenuSelection(function(err) {\n          if (err) {\n            if (utils.isString(err)) {\n              gui.alert(err);\n            } else {\n              // stack seems to change if Error is logged directly\n              console.error(err.stack);\n              gui.alert(\"Export failed for an unknown reason\");\n            }\n          }\n          // hide message after a delay, so it doesn't just flash for an instant.\n          setTimeout(gui.clearProgressMessage, err ? 0 : 400);\n        });\n      }, 20);\n    });\n  }\n\n  // @done function(string|Error|null)\n  function exportMenuSelection(done) {\n    var opts, files, datasets;\n    try {\n      opts = gui.parseFreeformOptions(El('#export-options .advanced-options').node().value, 'o');\n      if (!opts.format) opts.format = getSelectedFormat();\n      if(opts.format==='echartsmapjson'){\n          opts.format='geojson';\n          opts.isEchartsType='json';\n      }else if(opts.format==='echartsmapjs'){\n          opts.format='geojson';\n          opts.isEchartsType='js';\n      }\n      // ignoring command line \"target\" option\n      datasets = getSelectedLayers();\n      if (isMultiLayerFormat(opts.format)) {\n        // merge multiple datasets into one for export as SVG or TopoJSON\n        if (datasets.length > 1) {\n          datasets = [MapShaper.mergeDatasetsForExport(datasets)];\n          if (opts.format == 'topojson') {\n            // Build topology, in case user has loaded several\n            // files derived from the same source, with matching coordinates\n            // (Downsides: useless work if geometry is unrelated;\n            // could create many small arcs if layers are partially related)\n            api.buildTopology(datasets[0]);\n          }\n          // KLUDGE let exporter know that cloning is not needed\n          // (because shape data was deep-copied during merge)\n          opts.cloned = true;\n        }\n      } else {\n        MapShaper.assignUniqueLayerNames2(datasets);\n      }\n      files = datasets.reduce(function(memo, dataset) {\n        var output = MapShaper.exportFileContent(dataset, opts);\n        return memo.concat(output);\n      }, []);\n      // multiple output files will be zipped, need unique names\n      MapShaper.assignUniqueFileNames(files);\n    } catch(e) {\n      return done(e);\n    }\n    MapShaper.writeFiles(files, opts, done);\n  }\n\n  function isMultiLayerFormat(fmt) {\n    return fmt == 'svg' || fmt == 'topojson';\n  }\n\n  function saveBlob(filename, blob, done) {\n    if (window.navigator.msSaveBlob) {\n      window.navigator.msSaveBlob(blob, filename);\n      done();\n    }\n    try {\n      // revoke previous download url, if any. TODO: do this when download completes (how?)\n      if (blobUrl) URL.revokeObjectURL(blobUrl);\n      blobUrl = URL.createObjectURL(blob);\n    } catch(e) {\n      done(\"Mapshaper can't export files from this browser. Try switching to Chrome or Firefox.\");\n      return;\n    }\n\n    // TODO: handle errors\n    anchor.href = blobUrl;\n    anchor.download = filename;\n    var clickEvent = document.createEvent(\"MouseEvent\");\n    clickEvent.initMouseEvent(\"click\", true, true, window, 0, 0, 0, 0, 0, false,\n        false, false, false, 0, null);\n    anchor.dispatchEvent(clickEvent);\n    done();\n  }\n\n  function saveZipFile(zipfileName, files, done) {\n    var toAdd = files;\n    try {\n      zip.createWriter(new zip.BlobWriter(\"application/zip\"), addFile, zipError);\n    } catch(e) {\n      // TODO: show proper error message, not alert\n      done(\"This browser doesn't support Zip file creation.\");\n    }\n\n    function zipError(msg) {\n      var str = \"Error creating Zip file\";\n      if (msg) {\n        str += \": \" + (msg.message || msg);\n      }\n      done(str);\n    }\n\n    function addFile(archive) {\n      if (toAdd.length === 0) {\n        archive.close(function(blob) {\n          saveBlob(zipfileName, blob, done);\n        });\n      } else {\n        var obj = toAdd.pop(),\n            blob = new Blob([obj.content]);\n        archive.add(obj.filename, new zip.BlobReader(blob), function() {addFile(archive);});\n      }\n    }\n  }\n};\n\n\n\n\nfunction RepairControl(model, map) {\n  var el = El(\"#intersection-display\"),\n      readout = el.findChild(\"#intersection-count\"),\n      btn = el.findChild(\"#repair-btn\"),\n      _self = this,\n      _dataset, _currXX;\n\n  model.on('update', function(e) {\n    if (e.flags.simplify || e.flags.proj || e.flags.arc_count) {\n      // these changes require nulling out any cached intersection data and recalculating\n      if (_dataset) {\n        _dataset.info.intersections = null;\n        _dataset = null;\n        _self.hide();\n      }\n      delayedUpdate();\n    } else if (e.flags.select) {\n      _self.hide();\n      if (!e.flags.import) {\n        // Don't recalculate if a dataset was just imported -- another layer may be\n        // selected right away.\n        reset();\n        delayedUpdate();\n      }\n    }\n  });\n\n  model.on('mode', function(e) {\n    if (e.prev == 'import') {\n      // update if import just finished and a new dataset is being edited\n      delayedUpdate();\n    }\n  });\n\n  btn.on('click', function() {\n    var fixed = MapShaper.repairIntersections(_dataset.arcs, _currXX);\n    showIntersections(fixed);\n    btn.addClass('disabled');\n    model.updated({repair: true});\n  });\n\n  this.hide = function() {\n    el.hide();\n    map.setHighlightLayer(null);\n  };\n\n  // Detect and display intersections for current level of arc simplification\n  this.update = function() {\n    var XX, showBtn, pct;\n    if (!_dataset) return;\n    if (_dataset.arcs.getRetainedInterval() > 0) {\n      // TODO: cache these intersections\n      XX = MapShaper.findSegmentIntersections(_dataset.arcs);\n      showBtn = XX.length > 0;\n    } else { // no simplification\n      XX = _dataset.info.intersections;\n      if (!XX) {\n        // cache intersections at 0 simplification, to avoid recalculating\n        // every time the simplification slider is set to 100% or the layer is selected at 100%\n        XX = _dataset.info.intersections = MapShaper.findSegmentIntersections(_dataset.arcs);\n      }\n      showBtn = false;\n    }\n    el.show();\n    showIntersections(XX);\n    btn.classed('disabled', !showBtn);\n  };\n\n  function delayedUpdate() {\n    setTimeout(function() {\n      var e = model.getEditingLayer();\n      if (e.dataset && e.dataset != _dataset && !e.dataset.info.no_repair &&\n          MapShaper.layerHasPaths(e.layer)) {\n        _dataset = e.dataset;\n        _self.update();\n      }\n    }, 10);\n  }\n\n  function reset() {\n    _dataset = null;\n    _currXX = null;\n    _self.hide();\n  }\n\n  function showIntersections(XX) {\n    var n = XX.length, pointLyr;\n    _currXX = XX;\n    if (n > 0) {\n      pointLyr = {geometry_type: 'point', shapes: [MapShaper.getIntersectionPoints(XX)]};\n      map.setHighlightLayer(pointLyr, {layers:[pointLyr]});\n      readout.text(utils.format(\"%s line intersection%s\", n, utils.pluralSuffix(n)));\n    } else {\n      map.setHighlightLayer(null);\n      readout.text('');\n    }\n  }\n}\n\nutils.inherit(RepairControl, EventDispatcher);\n\n\n\n\nfunction LayerControl(model) {\n  var el = El(\"#layer-control\").on('click', gui.handleDirectEvent(model.clearMode));\n  var buttonLabel = El('#layer-control-btn .layer-name');\n  var isOpen = false;\n\n  new ModeButton('#layer-control-btn .header-btn', 'layer_menu', model);\n  model.addMode('layer_menu', turnOn, turnOff);\n  model.on('update', function(e) {\n    updateBtn();\n    if (isOpen) render();\n  });\n\n  function turnOn() {\n    isOpen = true;\n    render();\n    el.show();\n  }\n\n  function turnOff() {\n    isOpen = false;\n    el.hide();\n  }\n\n  function updateBtn() {\n    var name = model.getEditingLayer().layer.name || \"[unnamed layer]\";\n    buttonLabel.html(name + \" &nbsp;&#9660;\");\n  }\n\n  function render() {\n    var list = El('#layer-control .layer-list');\n    if (isOpen) {\n      list.hide().empty();\n      model.forEachLayer(function(lyr, dataset) {\n        list.appendChild(renderLayer(lyr, dataset));\n      });\n      list.show();\n    }\n  }\n\n  function describeLyr(lyr) {\n    var n = MapShaper.getFeatureCount(lyr),\n        str, type;\n    if (lyr.data && !lyr.shapes) {\n      type = 'data record';\n    } else if (lyr.geometry_type) {\n      type = lyr.geometry_type + ' feature';\n    }\n    if (type) {\n      str = utils.format('%,d %s%s', n, type, utils.pluralSuffix(n));\n    } else {\n      str = \"[empty]\";\n    }\n    return str;\n  }\n\n  function describeSrc(lyr, dataset) {\n    var file = dataset.info.input_files[0] || '';\n    if (utils.endsWith(file, '.shp') && !lyr.data && lyr == dataset.layers[0]) {\n      file += \" (missing .dbf)\";\n    }\n    return file;\n  }\n\n  function getDisplayName(name) {\n    return name || '[unnamed]';\n  }\n\n  function renderLayer(lyr, dataset) {\n    var editLyr = model.getEditingLayer().layer;\n    var entry = El('div').addClass('layer-item').classed('active', lyr == editLyr);\n    var html = rowHTML('name', '<span class=\"layer-name colored-text dot-underline\">' + getDisplayName(lyr.name) + '</span>');\n    html += rowHTML('source file', describeSrc(lyr, dataset));\n    html += rowHTML('contents', describeLyr(lyr));\n    html += '<img src=\"images/close.png\">';\n    entry.html(html);\n    // init delete button\n    entry.findChild('img').on('mouseup', function(e) {\n        e.stopPropagation();\n        deleteLayer(lyr, dataset);\n      });\n    // init name editor\n    new ClickText2(entry.findChild('.layer-name'))\n      .on('change', function(e) {\n        var str = cleanLayerName(this.value());\n        this.value(getDisplayName(str));\n        lyr.name = str;\n        updateBtn();\n      });\n    // init click-to-select\n    gui.onClick(entry, function() {\n      if (!gui.getInputElement()) { // don't select if user is typing\n        model.clearMode();\n        if (lyr != editLyr) {\n          model.updated({select: true}, lyr, dataset);\n        }\n      }\n    });\n    return entry;\n  }\n\n  function deleteLayer(lyr, dataset) {\n    var otherLyr = model.findAnotherLayer(lyr);\n    if (otherLyr) {\n      turnOff(); // avoid rendering twice\n      if (model.getEditingLayer().layer == lyr) {\n        // switch to a different layer if deleted layer was selected\n        model.selectLayer(otherLyr.layer, otherLyr.dataset);\n      }\n      model.deleteLayer(lyr, dataset);\n      turnOn();\n    } else {\n      // refresh browser if deleted layer was the last layer\n      window.location.href = window.location.href.toString();\n    }\n  }\n\n  function cleanLayerName(raw) {\n    return raw.replace(/[\\n\\t/\\\\]/g, '')\n      .replace(/^[\\.\\s]+/, '').replace(/[\\.\\s]+$/, '');\n  }\n\n  function rowHTML(c1, c2) {\n    return utils.format('<div class=\"row\"><div class=\"col1\">%s</div>' +\n      '<div class=\"col2\">%s</div></div>', c1, c2);\n  }\n}\n\n\n\n\n// These functions could be called when validating i/o options; TODO: avoid this\ncli.isFile =\ncli.isDirectory = function(name) {return false;};\n\ncli.validateOutputDir = function() {};\n\n// Replaces functions for reading from files with functions that try to match\n// already-loaded datasets.\n//\nfunction ImportFileProxy(model) {\n  // Try to match an imported dataset or layer.\n  // TODO: think about handling import options\n  function find(src) {\n    var datasets = model.getDatasets();\n    var retn = datasets.reduce(function(memo, d) {\n      var lyr;\n      if (memo) return memo; // already found a match\n      // try to match import filename of this dataset\n      if (d.info.input_files[0] == src) return d;\n      // try to match name of a layer in this dataset\n      lyr = utils.find(d.layers, function(lyr) {return lyr.name == src;});\n      return lyr ? MapShaper.isolateLayer(lyr, d) : null;\n    }, null);\n    if (!retn) stop(\"Missing data layer [\" + src + \"]\");\n    return retn;\n  }\n\n  api.importFile = function(src, opts) {\n    var dataset = find(src);\n    // Aeturn a copy with layers duplicated, so changes won't affect original layers\n    // This makes an (unsafe) assumption that the dataset arcs won't be changed...\n    // need to rethink this.\n    return utils.defaults({\n      layers: dataset.layers.map(MapShaper.copyLayer)\n    }, dataset);\n  };\n\n  api.importDataTable = function(src, opts) {\n    var dataset = find(src);\n    return dataset.layers[0].data;\n  };\n}\n\n\n\n\ngui.getPixelRatio = function() {\n  var deviceRatio = window.devicePixelRatio || window.webkitDevicePixelRatio || 1;\n  return deviceRatio > 1 ? 2 : 1;\n};\n\nfunction DisplayCanvas() {\n  var _self = El('canvas'),\n      _canvas = _self.node(),\n      _ctx = _canvas.getContext('2d'),\n      _ext;\n\n  _self.prep = function(extent) {\n    var w = extent.width(),\n        h = extent.height(),\n        pixRatio = gui.getPixelRatio();\n    _ctx.clearRect(0, 0, _canvas.width, _canvas.height);\n    _canvas.width = w * pixRatio;\n    _canvas.height = h * pixRatio;\n    _self.classed('retina', pixRatio == 2);\n    _self.show();\n    _ext = extent;\n  };\n\n  _self.drawPathShapes = function(shapes, arcs, style) {\n    var start = getPathStart(style, _ext),\n        draw = getShapePencil(arcs, _ext),\n        end = getPathEnd(style);\n    for (var i=0, n=shapes.length; i<n; i++) {\n      start(_ctx, i);\n      draw(shapes[i], _ctx);\n      end(_ctx);\n    }\n  };\n\n  _self.drawSquareDots = function(shapes, style) {\n    var t = getScaledTransform(_ext),\n        pixRatio = gui.getPixelRatio(),\n        size = (style.dotSize || 3) * pixRatio,\n        styler = style.styler || null,\n        shp, p;\n\n    _ctx.fillStyle = style.dotColor || \"black\";\n    // TODO: don't try to draw offscreen points\n    for (var i=0, n=shapes.length; i<n; i++) {\n      if (styler !== null) {\n        styler(style, i);\n        size = style.dotSize * pixRatio;\n        _ctx.fillStyle = style.dotColor;\n      }\n      shp = shapes[i];\n      for (var j=0, m=shp ? shp.length : 0; j<m; j++) {\n        if (!shp) continue;\n        p = shp[j];\n        drawSquare(p[0] * t.mx + t.bx, p[1] * t.my + t.by, size, _ctx);\n      }\n    }\n  };\n\n  _self.drawPoints = function(shapes, style) {\n    var t = getScaledTransform(_ext),\n        pixRatio = gui.getPixelRatio(),\n        start = getPathStart(style, _ext),\n        end = getPathEnd(style),\n        shp, p;\n\n    for (var i=0, n=shapes.length; i<n; i++) {\n      shp = shapes[i];\n      start(_ctx, i);\n      if (!shp || style.radius > 0 === false) continue;\n      for (var j=0, m=shp ? shp.length : 0; j<m; j++) {\n        p = shp[j];\n        drawCircle(p[0] * t.mx + t.bx, p[1] * t.my + t.by, style.radius * pixRatio, _ctx);\n      }\n      end(_ctx);\n    }\n  };\n\n  _self.drawArcs = function(arcs, flags, style) {\n    var darkStyle = {strokeWidth: style.strokeWidth, strokeColor: style.strokeColors[1]},\n        lightStyle = {strokeWidth: style.strokeWidth, strokeColor: style.strokeColors[0]};\n    setArcVisibility(flags, arcs);\n    drawFlaggedArcs(2, flags, lightStyle, arcs);\n    drawFlaggedArcs(3, flags, darkStyle, arcs);\n  };\n\n  function setArcVisibility(flags, arcs) {\n    var minPathLen = 0.5 * _ext.getPixelSize(),\n        geoBounds = _ext.getBounds(),\n        geoBBox = geoBounds.toArray(),\n        allIn = geoBounds.contains(arcs.getBounds()),\n        visible;\n    // don't continue dropping paths if user zooms out farther than full extent\n    if (_ext.scale() < 1) minPathLen *= _ext.scale();\n    for (var i=0, n=arcs.size(); i<n; i++) {\n      visible = !arcs.arcIsSmaller(i, minPathLen) && (allIn ||\n          arcs.arcIntersectsBBox(i, geoBBox));\n      // mark visible arcs by setting second flag bit to 1\n      flags[i] = (flags[i] & 1) | (visible ? 2 : 0);\n    }\n  }\n\n  function drawFlaggedArcs(flag, flags, style, arcs) {\n    var start = getPathStart(style, _ext),\n        end = getPathEnd(style),\n        t = getScaledTransform(_ext),\n        ctx = _ctx,\n        n = 25, // render paths in batches of this size (an optimization)\n        count = 0;\n    start(ctx);\n    for (i=0, n=arcs.size(); i<n; i++) {\n      if (flags[i] != flag) continue;\n      if (++count % n === 0) {\n        end(ctx);\n        start(ctx);\n      }\n      drawPath(arcs.getArcIter(i), t, ctx);\n    }\n    end(ctx);\n  }\n\n  return _self;\n}\n\nfunction getScaledTransform(ext) {\n  return ext.getTransform(gui.getPixelRatio());\n}\n\nfunction drawCircle(x, y, radius, ctx) {\n  if (radius > 0) {\n    ctx.moveTo(x + radius, y);\n    ctx.arc(x, y, radius, 0, Math.PI * 2, true);\n  }\n}\n\nfunction drawSquare(x, y, size, ctx) {\n  if (size > 0) {\n    var offs = size / 2;\n    x = Math.round(x - offs);\n    y = Math.round(y - offs);\n    ctx.fillRect(x, y, size, size);\n  }\n}\n\nfunction drawPath(vec, t, ctx) {\n  var minLen = gui.getPixelRatio() > 1 ? 1 : 0.6,\n      x, y, xp, yp;\n  if (!vec.hasNext()) return;\n  x = xp = vec.x * t.mx + t.bx;\n  y = yp = vec.y * t.my + t.by;\n  ctx.moveTo(x, y);\n  while (vec.hasNext()) {\n    x = vec.x * t.mx + t.bx;\n    y = vec.y * t.my + t.by;\n    if (Math.abs(x - xp) > minLen || Math.abs(y - yp) > minLen) {\n      ctx.lineTo(x, y);\n      xp = x;\n      yp = y;\n    }\n  }\n  if (x != xp || y != yp) {\n    ctx.lineTo(x, y);\n  }\n}\n\nfunction getShapePencil(arcs, ext) {\n  var t = getScaledTransform(ext);\n  return function(shp, ctx) {\n    var iter = new MapShaper.ShapeIter(arcs);\n    if (!shp) return;\n    for (var i=0; i<shp.length; i++) {\n      iter.init(shp[i]);\n      drawPath(iter, t, ctx);\n    }\n  };\n}\n\nfunction getPathStart(style, ext) {\n  var mapScale = ext.scale(),\n      styler = style.styler || null,\n      pixRatio = gui.getPixelRatio(),\n      lineScale = 1;\n\n  // vary line width according to zoom ratio; for performance and clarity,\n  // don't start thickening lines until zoomed quite far in.\n  if (mapScale < 1) {\n    lineScale *= Math.pow(mapScale, 0.6);\n  } else if (mapScale > 60) {\n    lineScale *= Math.pow(mapScale - 59, 0.18);\n  }\n\n  return function(ctx, i) {\n    var strokeWidth;\n    ctx.beginPath();\n    if (styler) {\n      styler(style, i);\n    }\n    if (style.opacity >= 0) {\n      ctx.globalAlpha = style.opacity;\n    }\n    if (style.strokeWidth > 0) {\n      strokeWidth = style.strokeWidth;\n      if (pixRatio > 1) {\n        // bump up thin lines on retina, but not to more than 1px (too slow)\n        strokeWidth = strokeWidth < 1 ? 1 : strokeWidth * pixRatio;\n      }\n      ctx.lineCap = 'round';\n      ctx.lineJoin = 'round';\n      ctx.lineWidth = strokeWidth * lineScale;\n      ctx.strokeStyle = style.strokeColor;\n    }\n    if (style.fillColor) {\n      ctx.fillStyle = style.fillColor;\n    }\n  };\n}\n\nfunction getPathEnd(style) {\n  return function(ctx) {\n    if (style.fillColor) ctx.fill();\n    if (style.strokeWidth > 0) ctx.stroke();\n    if (style.opacity >= 0) ctx.globalAlpha = 1;\n    ctx.closePath();\n  };\n}\n\n\n\n\n// A wrapper for ArcCollection that filters paths to speed up rendering.\n//\nfunction FilteredArcCollection(unfilteredArcs) {\n  var sortedThresholds,\n      filteredArcs,\n      filteredSegLen;\n\n  init();\n\n  function init() {\n    var size = unfilteredArcs.getPointCount(),\n        cutoff = 5e5,\n        nth;\n    sortedThresholds = filteredArcs = null;\n    if (!!unfilteredArcs.getVertexData().zz) {\n      // If we have simplification data...\n      // Sort simplification thresholds for all non-endpoint vertices\n      // for quick conversion of simplification percentage to threshold value.\n      // For large datasets, use every nth point, for faster sorting.\n      nth = Math.ceil(size / cutoff);\n      sortedThresholds = unfilteredArcs.getRemovableThresholds(nth);\n      utils.quicksort(sortedThresholds, false);\n      // For large datasets, create a filtered copy of the data for faster rendering\n      if (size > cutoff) {\n        filteredArcs = initFilteredArcs(unfilteredArcs, sortedThresholds);\n        filteredSegLen = MapShaper.getAvgSegment(filteredArcs);\n      }\n    } else {\n      if (size > cutoff) {\n        // generate filtered arcs when no simplification data is present\n        filteredSegLen = MapShaper.getAvgSegment(unfilteredArcs) * 4;\n        filteredArcs = MapShaper.simplifyArcsFast(unfilteredArcs, filteredSegLen);\n      }\n    }\n  }\n\n  // Use simplification data to create a low-detail copy of arcs, for faster\n  // rendering when zoomed-out.\n  function initFilteredArcs(arcs, sortedThresholds) {\n    var filterPct = 0.08;\n    var currInterval = arcs.getRetainedInterval();\n    var filterZ = sortedThresholds[Math.floor(filterPct * sortedThresholds.length)];\n    var filteredArcs = arcs.setRetainedInterval(filterZ).getFilteredCopy();\n    arcs.setRetainedInterval(currInterval); // reset current simplification\n    return filteredArcs;\n  }\n\n  this.getArcCollection = function(ext) {\n    refreshFilteredArcs();\n    // Use a filtered version of arcs at small scales\n    var unitsPerPixel = 1/ext.getTransform().mx,\n        useFiltering = filteredArcs && unitsPerPixel > filteredSegLen * 1.5;\n    return useFiltering ? filteredArcs : unfilteredArcs;\n  };\n\n  function refreshFilteredArcs() {\n    if (filteredArcs) {\n      if (filteredArcs.size() != unfilteredArcs.size()) {\n        init();\n      }\n      filteredArcs.setRetainedInterval(unfilteredArcs.getRetainedInterval());\n    }\n  }\n\n  this.size = function() {return unfilteredArcs.size();};\n\n  this.setRetainedPct = function(pct) {\n    if (sortedThresholds) {\n      var z = sortedThresholds[Math.floor(pct * sortedThresholds.length)];\n      z = MapShaper.clampIntervalByPct(z, pct);\n      // this.setRetainedInterval(z);\n      unfilteredArcs.setRetainedInterval(z);\n    } else {\n      unfilteredArcs.setRetainedPct(pct);\n    }\n  };\n}\n\n\n\n\ngui.getDisplayLayerForTable = function(table) {\n  var n = table.size(),\n      cellWidth = 12,\n      cellHeight = 5,\n      gutter = 6,\n      arcs = [],\n      shapes = [],\n      lyr = {shapes: shapes},\n      data = {layer: lyr},\n      aspectRatio = 1.1,\n      usePoints = false,\n      x, y, col, row, blockSize;\n\n  if (n > 10000) {\n    usePoints = true;\n    gutter = 0;\n    cellWidth = 4;\n    cellHeight = 4;\n    aspectRatio = 1.45;\n  } else if (n > 5000) {\n    cellWidth = 5;\n    gutter = 3;\n    aspectRatio = 1.45;\n  } else if (n > 1000) {\n    gutter = 3;\n    cellWidth = 8;\n    aspectRatio = 1.3;\n  }\n\n  if (n < 25) {\n    blockSize = n;\n  } else {\n    blockSize = Math.sqrt(n * (cellWidth + gutter) / cellHeight / aspectRatio) | 0;\n  }\n\n  for (var i=0; i<n; i++) {\n    row = i % blockSize;\n    col = Math.floor(i / blockSize);\n    x = col * (cellWidth + gutter);\n    y = cellHeight * (blockSize - row);\n    if (usePoints) {\n      shapes.push([[x, y]]);\n    } else {\n      arcs.push(getArc(x, y, cellWidth, cellHeight));\n      shapes.push([[i]]);\n    }\n  }\n\n  if (usePoints) {\n    lyr.geometry_type = 'point';\n  } else {\n    data.arcs = new MapShaper.ArcCollection(arcs);\n    lyr.geometry_type = 'polygon';\n  }\n  lyr.data = table;\n\n  function getArc(x, y, w, h) {\n    return [[x, y], [x + w, y], [x + w, y - h], [x, y - h], [x, y]];\n  }\n\n  return data;\n};\n\n\n\n\nfunction DisplayLayer(lyr, dataset, ext) {\n  var _displayBounds;\n\n  init();\n\n  this.setStyle = function(o) {\n    lyr.display.style = o;\n  };\n\n  this.getBounds = function() {\n    return _displayBounds;\n  };\n\n  this.setRetainedPct = function(pct) {\n    var arcs = dataset.filteredArcs || dataset.arcs;\n    if (arcs) {\n      arcs.setRetainedPct(pct);\n    }\n  };\n\n  this.updateStyle = function(style) {\n    var o = this.getDisplayLayer();\n    // arc style\n    if (o.dataset.arcs) {\n      lyr.display.arcFlags = new Uint8Array(o.dataset.arcs.size());\n      if (MapShaper.layerHasPaths(o.layer)) {\n        initArcFlags(o.layer.shapes, lyr.display.arcFlags);\n      }\n    }\n  };\n\n  // @ext map extent\n  this.getDisplayLayer = function() {\n    var arcs = lyr.display.arcs,\n        layer = lyr.display.layer || lyr;\n    if (!arcs) {\n      // use filtered arcs if available & map extent is known\n      arcs = dataset.filteredArcs ?\n        dataset.filteredArcs.getArcCollection(ext) : dataset.arcs;\n    }\n    return {\n      layer: layer,\n      dataset: {arcs: arcs},\n      geographic: layer == lyr // false if using table-only shapes\n    };\n  };\n\n  this.draw = function(canv, style) {\n    style = style || lyr.display.style;\n    if (style.type == 'outline') {\n      this.drawStructure(canv, style);\n    } else {\n      this.drawShapes(canv, style);\n    }\n  };\n\n  this.drawStructure = function(canv, style) {\n    var obj = this.getDisplayLayer(ext);\n    var arcs = obj.dataset.arcs;\n    if (arcs && lyr.display.arcFlags) {\n      canv.drawArcs(arcs, lyr.display.arcFlags, style);\n    }\n    if (obj.layer.geometry_type == 'point') {\n      canv.drawSquareDots(obj.layer.shapes, style);\n    }\n  };\n\n  this.drawShapes = function(canv, style) {\n    var obj = this.getDisplayLayer(ext);\n    var lyr = style.ids ? filterLayer(obj.layer, style.ids) : obj.layer;\n    if (lyr.geometry_type == 'point') {\n      if (style.type == 'styled') {\n        canv.drawPoints(lyr.shapes, style);\n      } else {\n        canv.drawSquareDots(lyr.shapes, style);\n      }\n    } else {\n      canv.drawPathShapes(lyr.shapes, obj.dataset.arcs, style);\n    }\n  };\n\n  function filterLayer(lyr, ids) {\n    if (lyr.shapes) {\n      shapes = ids.map(function(id) {\n        return lyr.shapes[id];\n      });\n      return utils.defaults({shapes: shapes}, lyr);\n    }\n    return lyr;\n  }\n\n  function initArcFlags(shapes, arr) {\n    // Arcs belonging to at least one path are flagged 1, others 0\n    MapShaper.countArcsInShapes(shapes, arr);\n    for (var i=0, n=arr.length; i<n; i++) {\n      arr[i] = arr[i] === 0 ? 0 : 1;\n    }\n  }\n\n  function init() {\n    var display = lyr.display = lyr.display || {};\n\n    // init filtered arcs, if needed\n    if (MapShaper.layerHasPaths(lyr) && !dataset.filteredArcs) {\n      dataset.filteredArcs = new FilteredArcCollection(dataset.arcs);\n    }\n\n    // init table shapes, if needed\n    if (lyr.data && !lyr.geometry_type) {\n      if (!display.layer || display.layer.shapes.length != lyr.data.size()) {\n        utils.extend(display, gui.getDisplayLayerForTable(lyr.data));\n      }\n    } else if (display.layer) {\n      delete display.layer;\n      delete display.arcs;\n    }\n\n    _displayBounds = getDisplayBounds(display.layer || lyr, display.arcs || dataset.arcs);\n  }\n}\n\nfunction getDisplayBounds(lyr, arcs) {\n  var arcBounds = arcs ? arcs.getBounds() : new Bounds(),\n      bounds = arcBounds, // default display extent: all arcs in the dataset\n      lyrBounds;\n\n  if (lyr.geometry_type == 'point') {\n    lyrBounds = MapShaper.getLayerBounds(lyr);\n    if (lyrBounds && lyrBounds.hasBounds()) {\n      if (lyrBounds.area() > 0 || arcBounds.area() === 0) {\n        bounds = lyrBounds;\n      }\n      // if a point layer has no extent (e.g. contains only a single point),\n      // then use arc bounds (if present), to match any path layers in the dataset.\n    }\n  }\n\n  // If a layer has collapsed, inflate it by a default amount\n  if (bounds.width() === 0) {\n    bounds.xmin = (bounds.centerX() || 0) - 1;\n    bounds.xmax = bounds.xmin + 2;\n  }\n  if (bounds.height() === 0) {\n    bounds.ymin = (bounds.centerY() || 0) - 1;\n    bounds.ymax = bounds.ymin + 2;\n  }\n  return bounds;\n}\n\n\n\n\nfunction HighlightBox(el) {\n  var stroke = 2,\n      box = El('div').addClass('zoom-box').appendTo(el).hide();\n  this.show = function(x1, y1, x2, y2) {\n    var w = Math.abs(x1 - x2),\n        h = Math.abs(y1 - y2);\n    box.css({\n      top: Math.min(y1, y2),\n      left: Math.min(x1, x2),\n      width: Math.max(w - stroke * 2, 1),\n      height: Math.max(h - stroke * 2, 1)\n    });\n    box.show();\n  };\n  this.hide = function() {\n    box.hide();\n  };\n}\n\n\n\n\ngui.addSidebarButton = function(iconId) {\n  var btn = El('div').addClass('nav-btn')\n    .on('dblclick', function(e) {e.stopPropagation();}); // block dblclick zoom\n  btn.appendChild(iconId);\n  btn.appendTo('#nav-buttons');\n  return btn;\n};\n\nfunction MapNav(root, ext, mouse) {\n  var wheel = new MouseWheel(mouse),\n      zoomBox = new HighlightBox('body'),\n      buttons = El('div').id('nav-buttons').appendTo(root),\n      zoomTween = new Tween(Tween.sineInOut),\n      shiftDrag = false,\n      zoomScale = 2.5,\n      dragStartEvt, _fx, _fy; // zoom foci, [0,1]\n\n  gui.addSidebarButton(\"#home-icon\").on('click', function() {ext.reset();});\n  gui.addSidebarButton(\"#zoom-in-icon\").on('click', zoomIn);\n  gui.addSidebarButton(\"#zoom-out-icon\").on('click', zoomOut);\n\n  zoomTween.on('change', function(e) {\n    ext.rescale(e.value, _fx, _fy);\n  });\n\n  mouse.on('dblclick', function(e) {\n    zoomByPct(zoomScale, e.x / ext.width(), e.y / ext.height());\n  });\n\n  mouse.on('dragstart', function(e) {\n    shiftDrag = !!e.shiftKey;\n    if (shiftDrag) {\n      dragStartEvt = e;\n    }\n  });\n\n  mouse.on('drag', function(e) {\n    if (shiftDrag) {\n      zoomBox.show(e.pageX, e.pageY, dragStartEvt.pageX, dragStartEvt.pageY);\n    } else {\n      ext.pan(e.dx, e.dy);\n    }\n  });\n\n  mouse.on('dragend', function(e) {\n    var bounds;\n    if (shiftDrag) {\n      shiftDrag = false;\n      bounds = new Bounds(e.x, e.y, dragStartEvt.x, dragStartEvt.y);\n      zoomBox.hide();\n      if (bounds.width() > 5 && bounds.height() > 5) {\n        zoomToBox(bounds);\n      }\n    }\n  });\n\n  wheel.on('mousewheel', function(e) {\n    var k = 1 + (0.11 * e.multiplier),\n        delta = e.direction > 0 ? k : 1 / k;\n    ext.rescale(ext.scale() * delta, e.x / ext.width(), e.y / ext.height());\n  });\n\n  function zoomIn() {\n    zoomByPct(zoomScale, 0.5, 0.5);\n  }\n\n  function zoomOut() {\n    zoomByPct(1/zoomScale, 0.5, 0.5);\n  }\n\n  // @box Bounds with pixels from t,l corner of map area.\n  function zoomToBox(box) {\n    var pct = Math.max(box.width() / ext.width(), box.height() / ext.height()),\n        fx = box.centerX() / ext.width() * (1 + pct) - pct / 2,\n        fy = box.centerY() / ext.height() * (1 + pct) - pct / 2;\n    zoomByPct(1 / pct, fx, fy);\n  }\n\n  // @pct Change in scale (2 = 2x zoom)\n  // @fx, @fy zoom focus, [0, 1]\n  function zoomByPct(pct, fx, fy) {\n    _fx = fx;\n    _fy = fy;\n    zoomTween.start(ext.scale(), ext.scale() * pct, 400);\n  }\n\n}\n\n\n\n\nfunction MapExtent(el) {\n  var _position = new ElementPosition(el),\n      _scale = 1,\n      _cx,\n      _cy,\n      _contentBounds;\n\n  _position.on('resize', function() {\n    this.dispatchEvent('change');\n    this.dispatchEvent('navigate');\n    this.dispatchEvent('resize');\n  }, this);\n\n  this.reset = function(force) {\n    this.recenter(_contentBounds.centerX(), _contentBounds.centerY(), 1, force);\n  };\n\n  this.recenter = function(cx, cy, scale, force) {\n    if (!scale) scale = _scale;\n    if (force || !(cx == _cx && cy == _cy && scale == _scale)) {\n      _cx = cx;\n      _cy = cy;\n      _scale = scale;\n      this.dispatchEvent('change');\n      this.dispatchEvent('navigate');\n    }\n  };\n\n  this.pan = function(xpix, ypix) {\n    var t = this.getTransform();\n    this.recenter(_cx - xpix / t.mx, _cy - ypix / t.my);\n  };\n\n  // Zoom to @scale (a multiple of the map's full scale)\n  // @xpct, @ypct: optional focus, [0-1]...\n  this.rescale = function(scale, xpct, ypct) {\n    if (arguments.length < 3) {\n      xpct = 0.5;\n      ypct = 0.5;\n    }\n    var b = this.getBounds(),\n        fx = b.xmin + xpct * b.width(),\n        fy = b.ymax - ypct * b.height(),\n        dx = b.centerX() - fx,\n        dy = b.centerY() - fy,\n        ds = _scale / scale,\n        dx2 = dx * ds,\n        dy2 = dy * ds,\n        cx = fx + dx2,\n        cy = fy + dy2;\n    this.recenter(cx, cy, scale);\n  };\n\n  this.resize = _position.resize;\n  this.width = _position.width;\n  this.height = _position.height;\n  this.position = _position.position;\n\n  // get zoom factor (1 == full extent, 2 == 2x zoom, etc.)\n  this.scale = function() {\n    return _scale;\n  };\n\n  this.getPixelSize = function() {\n    return 1 / this.getTransform().mx;\n  };\n\n  // Get params for converting geographic coords to pixel coords\n  this.getTransform = function(pixScale) {\n    // get transform (y-flipped);\n    var viewBounds = new Bounds(0, 0, _position.width(), _position.height());\n    if (pixScale) {\n      viewBounds.xmax *= pixScale;\n      viewBounds.ymax *= pixScale;\n    }\n    return this.getBounds().getTransform(viewBounds, true);\n  };\n\n  this.getBounds = function() {\n    if (!_contentBounds) return new Bounds();\n    return centerAlign(calcBounds(_cx, _cy, _scale));\n  };\n\n  // Update the extent of 'full' zoom without navigating the current view\n  this.setBounds = function(b) {\n    var prev = _contentBounds;\n    _contentBounds = b;\n    if (prev) {\n      _scale = _scale * centerAlign(b).width() / centerAlign(prev).width();\n    } else {\n      _cx = b.centerX();\n      _cy = b.centerY();\n    }\n  };\n\n  function getPadding(size) {\n    return size * 0.020 + 4;\n  }\n\n  function calcBounds(cx, cy, scale) {\n    var w = _contentBounds.width() / scale,\n        h = _contentBounds.height() / scale;\n    return new Bounds(cx - w/2, cy - h/2, cx + w/2, cy + h/2);\n  }\n\n  // Receive: Geographic bounds of content to be centered in the map\n  // Return: Geographic bounds of map window centered on @_contentBounds,\n  //    with padding applied\n  function centerAlign(_contentBounds) {\n    var bounds = _contentBounds.clone(),\n        wpix = _position.width(),\n        hpix = _position.height(),\n        xmarg = getPadding(wpix),\n        ymarg = getPadding(hpix),\n        xpad, ypad;\n    wpix -= 2 * xmarg;\n    hpix -= 2 * ymarg;\n    if (wpix <= 0 || hpix <= 0) {\n      return new Bounds(0, 0, 0, 0);\n    }\n    bounds.fillOut(wpix / hpix);\n    xpad = bounds.width() / wpix * xmarg;\n    ypad = bounds.height() / hpix * ymarg;\n    bounds.padBounds(xpad, ypad, xpad, ypad);\n    return bounds;\n  }\n}\n\nutils.inherit(MapExtent, EventDispatcher);\n\n\n\n\nfunction HitControl(ext, mouse) {\n  var self = new EventDispatcher();\n  var prevHits = [];\n  var active = false;\n  var tests = {\n    polygon: polygonTest,\n    polyline: polylineTest,\n    point: pointTest\n  };\n  var coords = El('#coordinate-info').hide();\n  var lyr, target, test;\n\n  ext.on('change', function() {\n    // shapes may change along with map scale\n    target = lyr ? lyr.getDisplayLayer() : null;\n  });\n\n  self.setLayer = function(o) {\n    lyr = o;\n    target = o.getDisplayLayer();\n    test = tests[target.layer.geometry_type];\n    coords.hide();\n  };\n\n  self.start = function() {\n    active = true;\n  };\n\n  self.stop = function() {\n    if (active) {\n      hover([]);\n      coords.text('').hide();\n      active = false;\n    }\n  };\n\n  mouse.on('click', function(e) {\n    if (!active || !target) return;\n    trigger('click', prevHits);\n    gui.selectElement(coords.node());\n  });\n\n  // DISABLING: This causes problems when hovering over the info panel\n  // Deselect hover shape when pointer leaves hover area\n  //mouse.on('leave', function(e) {\n  // hover(-1);\n  //});\n\n  mouse.on('hover', function(e) {\n    var p, decimals;\n    if (!active || !target) return;\n    p = ext.getTransform().invert().transform(e.x, e.y);\n    if (target.geographic) {\n      // update coordinate readout if displaying geographic shapes\n      decimals = getCoordPrecision(ext.getBounds());\n      coords.text(p[0].toFixed(decimals) + ', ' + p[1].toFixed(decimals)).show();\n    }\n    if (test && e.hover) {\n      hover(test(p[0], p[1]));\n    }\n  });\n\n  // Convert pixel distance to distance in coordinate units.\n  function getHitBuffer(pix) {\n    var dist = pix / ext.getTransform().mx,\n        scale = ext.scale();\n    if (scale < 1) dist *= scale; // reduce hit threshold when zoomed out\n    return dist;\n  }\n\n  function getCoordPrecision(bounds) {\n    var min = Math.min(Math.abs(bounds.xmax), Math.abs(bounds.ymax)),\n        decimals = Math.ceil(Math.log(min) / Math.LN10);\n    return Math.max(0, 7 - decimals);\n  }\n\n  function polygonTest(x, y) {\n    var dist = getHitBuffer(5),\n        cands = findHitCandidates(x, y, dist),\n        hits = [],\n        cand, hitId;\n    for (var i=0; i<cands.length; i++) {\n      cand = cands[i];\n      if (geom.testPointInPolygon(x, y, cand.shape, target.dataset.arcs)) {\n        hits.push(cand.id);\n      }\n    }\n    if (cands.length > 0 && hits.length === 0) {\n      // secondary detection: proximity, if not inside a polygon\n      hits = findNearestCandidates(x, y, dist, cands, target.dataset.arcs);\n    }\n    return hits;\n  }\n\n  function polylineTest(x, y) {\n    var dist = getHitBuffer(15),\n        cands = findHitCandidates(x, y, dist);\n    return findNearestCandidates(x, y, dist, cands, target.dataset.arcs);\n  }\n\n  function findNearestCandidates(x, y, dist, cands, arcs) {\n    var hits = [],\n        cand, candDist;\n    for (var i=0; i<cands.length; i++) {\n      cand = cands[i];\n      candDist = geom.getPointToShapeDistance(x, y, cand.shape, arcs);\n      if (candDist < dist) {\n        hits = [cand.id];\n        dist = candDist;\n      } else if (candDist == dist) {\n        hits.push(cand.id);\n      }\n    }\n    return hits;\n  }\n\n  function pointTest(x, y) {\n    var dist = getHitBuffer(25),\n        limitSq = dist * dist,\n        hits = [];\n    MapShaper.forEachPoint(target.layer.shapes, function(p, id) {\n      var distSq = geom.distanceSq(x, y, p[0], p[1]);\n      if (distSq < limitSq) {\n        hits = [id];\n        limitSq = distSq;\n      } else if (distSq == limitSq) {\n        hits.push(id);\n      }\n    });\n    return hits;\n  }\n\n  function getProperties(id) {\n    return target.layer.data ? target.layer.data.getRecordAt(id) : {};\n  }\n\n  function sameIds(a, b) {\n    if (a.length != b.length) return false;\n    for (var i=0; i<a.length; i++) {\n      if (a[i] !== b[i]) return false;\n    }\n    return true;\n  }\n\n  function trigger(event, hits) {\n    self.dispatchEvent(event, {\n      ids: hits,\n      id: hits.length > 0 ? hits[0] : -1\n    });\n  }\n\n  function hover(hits) {\n    if (!sameIds(hits, prevHits)) {\n      prevHits = hits;\n      El('#map-layers').classed('hover', hits.length > 0);\n      trigger('hover', hits);\n    }\n  }\n\n  function findHitCandidates(x, y, dist) {\n    var arcs = target.dataset.arcs,\n        index = {},\n        cands = [],\n        bbox = [];\n    target.layer.shapes.forEach(function(shp, shpId) {\n      var cand;\n      for (var i = 0, n = shp && shp.length; i < n; i++) {\n        arcs.getSimpleShapeBounds2(shp[i], bbox);\n        if (x + dist < bbox[0] || x - dist > bbox[2] ||\n          y + dist < bbox[1] || y - dist > bbox[3]) {\n          continue; // bbox non-intersection\n        }\n        cand = index[shpId];\n        if (!cand) {\n          cand = index[shpId] = {shape: [], id: shpId};\n          cands.push(cand);\n        }\n        cand.shape.push(shp[i]);\n      }\n    });\n    return cands;\n  }\n\n  return self;\n}\n\n\n\n\n\nfunction Popup() {\n  var parent = El('#mshp-main-map');\n  var el = El('div').addClass('popup').appendTo(parent).hide();\n  // var head = El('div').addClass('popup-head').appendTo(el).text('Feature 1 of 5  next prev');\n  var content = El('div').addClass('popup-content').appendTo(el);\n\n  this.show = function(rec, table, editable) {\n    var maxHeight = parent.node().clientHeight - 36;\n    this.hide(); // clean up if panel is already open\n    render(content, rec, table, editable);\n    el.show();\n    if (content.node().clientHeight > maxHeight) {\n      content.css('height:' + maxHeight + 'px');\n    }\n  };\n\n  this.hide = function() {\n    // make sure any pending edits are made before re-rendering popup\n    // TODO: only blur popup fields\n    gui.blurActiveElement();\n    content.empty();\n    content.node().removeAttribute('style'); // remove inline height\n    el.hide();\n  };\n\n  function render(el, rec, table, editable) {\n    var tableEl = El('table').addClass('selectable'),\n        rows = 0;\n    utils.forEachProperty(rec, function(v, k) {\n      var type = MapShaper.getFieldType(v, k, table);\n      renderRow(tableEl, rec, k, type, editable);\n      rows++;\n    });\n    if (rows > 0) {\n      tableEl.appendTo(el);\n    } else {\n      el.html('<div class=\"note\">This layer is missing attribute data.</div>');\n    }\n  }\n\n  function renderRow(table, rec, key, type, editable) {\n    var rowHtml = '<td class=\"field-name\">%s</td><td><span class=\"value\">%s</span> </td>';\n    var val = rec[key];\n    var cell = El('tr')\n        .appendTo(table)\n        .html(utils.format(rowHtml, key, utils.htmlEscape(val)))\n        .findChild('.value');\n    setFieldClass(cell, val, type);\n    if (editable) {\n      editItem(cell, rec, key, type);\n    }\n  }\n\n  function setFieldClass(el, val, type) {\n    var isNum = type ? type == 'number' : utils.isNumber(val);\n    var isNully = val === undefined || val === null || val !== val;\n    var isEmpty = val === '';\n    el.classed('num-field', isNum);\n    el.classed('null-value', isNully);\n    el.classed('empty', isEmpty);\n  }\n\n  function editItem(el, rec, key, type) {\n    var input = new ClickText2(el),\n        strval = String(rec[key]),\n        parser = MapShaper.getInputParser(type);\n    el.parent().addClass('editable-cell');\n    el.addClass('colored-text dot-underline');\n    input.on('change', function(e) {\n      var val2 = parser(input.value()),\n          strval2 = String(val2);\n      if (strval == strval2) {\n        // contents unchanged\n      } else if (val2 === null) {\n        // invalid value; revert to previous value\n        input.value(strval);\n      } else {\n        // field content has changed;\n        strval = strval2;\n        rec[key] = val2;\n        input.value(strval);\n        setFieldClass(el, val2, type);\n      }\n    });\n  }\n}\n\nMapShaper.inputParsers = {\n  string: function(raw) {\n    return raw;\n  },\n  number: function(raw) {\n    var val = Number(raw);\n    if (raw == 'NaN') {\n      val = NaN;\n    } else if (isNaN(val)) {\n      val = null;\n    }\n    return val;\n  },\n  boolean: function(raw) {\n    var val = null;\n    if (raw == 'true') {\n      val = true;\n    } else if (raw == 'false') {\n      val = false;\n    }\n    return val;\n  },\n  multiple: function(raw) {\n    var val = Number(raw);\n    return isNaN(val) ? raw : val;\n  }\n};\n\nMapShaper.getInputParser = function(type) {\n  return MapShaper.inputParsers[type || 'multiple'];\n};\n\nMapShaper.getValueType = function(val) {\n  var type = null;\n  if (utils.isString(val)) {\n    type = 'string';\n  } else if (utils.isNumber(val)) {\n    type = 'number';\n  } else if (utils.isBoolean(val)) {\n    type = 'boolean';\n  }\n  return type;\n};\n\nMapShaper.getColumnType = function(key, table) {\n  var records = table.getRecords(),\n      type = null;\n  for (var i=0, n=records.length; i<n; i++) {\n    type = MapShaper.getValueType(records[i][key]);\n    if (type) break;\n  }\n  return type;\n};\n\nMapShaper.getFieldType = function(val, key, table) {\n  // if a field has a null value, look at entire column to identify type\n  return MapShaper.getValueType(val) || MapShaper.getColumnType(key, table);\n};\n\n\n\n\nfunction InspectionControl(model, hit) {\n  var _popup = new Popup();\n  var _inspecting = false;\n  var _pinned = false;\n  var _highId = -1;\n  var _selectionIds = null;\n  var btn = gui.addSidebarButton(\"#info-icon2\").on('click', function() {\n    if (_inspecting) turnOff(); else turnOn();\n  });\n  var _self = new EventDispatcher();\n  var _shapes, _lyr;\n\n  _self.updateLayer = function(o) {\n    var shapes = o.getDisplayLayer().layer.shapes;\n    if (_inspecting) {\n      // kludge: check if shapes have changed\n      if (_shapes == shapes) {\n        // kludge: re-display the inspector, in case data changed\n        inspect(_highId, _pinned);\n      } else {\n        _selectionIds = null;\n        inspect(-1, false);\n      }\n    }\n    hit.setLayer(o);\n    _shapes = shapes;\n    _lyr = o;\n  };\n\n  // replace cli inspect command\n  api.inspect = function(lyr, arcs, opts) {\n    var ids;\n    if (lyr != model.getEditingLayer().layer) {\n      error(\"Only the active layer can be targeted\");\n    }\n    ids = MapShaper.selectFeatures(lyr, arcs, opts);\n    if (ids.length === 0) {\n      message(\"No features were selected\");\n      return;\n    }\n    _selectionIds = ids;\n    turnOn();\n    inspect(ids[0], true);\n  };\n\n  document.addEventListener('keydown', function(e) {\n    var kc = e.keyCode, n, id;\n    if (!_inspecting) return;\n\n    // esc key closes (unless in an editing mode)\n    if (e.keyCode == 27 && _inspecting && !model.getMode()) {\n      turnOff();\n\n    // arrow keys advance pinned feature unless user is editing text.\n    } else if ((kc == 37 || kc == 39) && _pinned && !gui.getInputElement()) {\n      n = MapShaper.getFeatureCount(_lyr.getDisplayLayer().layer);\n      if (n > 1) {\n        if (kc == 37) {\n          id = (_highId + n - 1) % n;\n        } else {\n          id = (_highId + 1) % n;\n        }\n        inspect(id, true);\n        e.stopPropagation();\n      }\n    }\n  }, !!'capture'); // preempt the layer control's arrow key handler\n\n  hit.on('click', function(e) {\n    var id = e.id;\n    var pin = false;\n    if (_pinned && id == _highId) {\n      // clicking on pinned shape: unpin\n    } else if (!_pinned && id > -1) {\n      // clicking on unpinned shape while unpinned: pin\n      pin = true;\n    } else if (_pinned && id > -1) {\n      // clicking on unpinned shape while pinned: pin new shape\n      pin = true;\n    } else if (!_pinned && id == -1) {\n      // clicking off the layer while pinned: unpin and deselect\n    }\n    inspect(id, pin, e.ids);\n  });\n\n  hit.on('hover', function(e) {\n    var id = e.id;\n    if (!_inspecting || _pinned) return;\n    inspect(id, false, e.ids);\n  });\n\n  function showInspector(id, editable) {\n    var o = _lyr.getDisplayLayer();\n    var table = o.layer.data || null;\n    var rec = table ? table.getRecordAt(id) : {};\n    _popup.show(rec, table, editable);\n  }\n\n  // @id Id of a feature in the active layer, or -1\n  function inspect(id, pin, ids) {\n    if (!_inspecting) return;\n    if (id > -1) {\n      showInspector(id, pin);\n    } else {\n      _popup.hide();\n    }\n    _highId = id;\n    _pinned = pin;\n    _self.dispatchEvent('change', {\n      selection_ids: _selectionIds || [],\n      hover_ids: ids || [],\n      id: id,\n      pinned: pin\n    });\n  }\n\n  function turnOn() {\n    btn.addClass('selected');\n    _inspecting = true;\n    hit.start();\n  }\n\n  function turnOff() {\n    btn.removeClass('selected');\n    hit.stop();\n    _selectionIds = null;\n    inspect(-1); // clear the map\n    _inspecting = false;\n  }\n\n  return _self;\n}\n\n\n\n\nvar MapStyle = (function() {\n  var darkStroke = \"#334\",\n      lightStroke = \"#b2d83a\",\n      pink = \"#f74b80\",  // dark\n      pink2 = \"rgba(239, 0, 86, 0.16)\", // \"#ffd9e7\", // medium\n      gold = \"#efc100\",\n      black = \"black\",\n      selectionFill = \"rgba(237, 214, 0, 0.12)\",\n      hoverFill = \"rgba(255, 117, 165, 0.18)\",\n      outlineStyle = {\n        type: 'outline',\n        strokeColors: [lightStroke, darkStroke],\n        strokeWidth: 0.7,\n        dotColor: \"#223\"\n      },\n      highStyle = {\n        dotColor: \"#F24400\"\n      },\n      hoverStyles = {\n        polygon: {\n          fillColor: hoverFill,\n          strokeColor: black,\n          strokeWidth: 1.2\n        }, point:  {\n          dotColor: black,\n          dotSize: 8\n        }, polyline:  {\n          strokeColor: black,\n          strokeWidth: 2.5\n        }\n      },\n      selectionStyles = {\n        polygon: {\n          fillColor: selectionFill,\n          strokeColor: gold,\n          strokeWidth: 1\n        }, point:  {\n          dotColor: gold,\n          dotSize: 6\n        }, polyline:  {\n          strokeColor: gold,\n          strokeWidth: 1.8\n        }\n      },\n      selectionHoverStyles = {\n        polygon: {\n          fillColor: selectionFill,\n          strokeColor: black,\n          strokeWidth: 1.2\n        }, point:  {\n          dotColor: black,\n          dotSize: 6\n        }, polyline:  {\n          strokeColor: black,\n          strokeWidth: 2.5\n        }\n      },\n      pinnedStyles = {\n        polygon: {\n          fillColor: pink2,\n          strokeColor: pink,\n          strokeWidth: 1.8\n        }, point:  {\n          dotColor: pink,\n          dotSize: 8\n        }, polyline:  {\n          strokeColor: pink,\n          strokeWidth: 3\n        }\n      };\n\n  return {\n    getHighlightStyle: function() {\n      return highStyle;\n    },\n    getActiveStyle: function(lyr) {\n      var style;\n      if (MapShaper.layerHasSvgDisplayStyle(lyr)) {\n        style = MapShaper.getSvgDisplayStyle(lyr);\n      } else {\n        style = utils.extend({}, outlineStyle);\n        style.dotSize = calcDotSize(MapShaper.countPointsInLayer(lyr));\n      }\n      return style;\n    },\n    getOverlayStyle: getOverlayStyle\n  };\n\n  function calcDotSize(n) {\n    return n < 20 && 5 || n < 500 && 4 || n < 50000 && 3 || 2;\n  }\n\n  function getOverlayStyle(lyr, o) {\n    var type = lyr.geometry_type;\n    var topId = o.id;\n    var ids = [];\n    var styles = [];\n    var styler = function(o, i) {\n      utils.extend(o, styles[i]);\n    };\n    var overlayStyle = {\n      styler: styler\n    };\n    // first layer: selected feature(s)\n    o.selection_ids.forEach(function(i) {\n      // skip features in a higher layer\n      if (i == topId || o.hover_ids.indexOf(i) > -1) return;\n      ids.push(i);\n      styles.push(selectionStyles[type]);\n    });\n    // second layer: hover feature(s)\n    o.hover_ids.forEach(function(i) {\n      var style;\n      if (i == topId) return;\n      style = o.selection_ids.indexOf(i) > -1 ? selectionHoverStyles[type] : hoverStyles[type];\n      ids.push(i);\n      styles.push(style);\n    });\n    // top layer: highlighted feature\n    if (topId > -1) {\n      var isPinned = o.pinned;\n      var inSelection = o.selection_ids.indexOf(topId) > -1;\n      var style;\n      if (isPinned) {\n        style = pinnedStyles[type];\n      } else if (inSelection) {\n        style = selectionHoverStyles[type]; // TODO: differentiate from other hover ids\n      } else {\n        style = hoverStyles[type]; // TODO: differentiate from other hover ids\n      }\n      ids.push(topId);\n      styles.push(style);\n    }\n\n    if (MapShaper.layerHasSvgDisplayStyle(lyr)) {\n      if (type == 'point') {\n        overlayStyle = MapShaper.wrapHoverStyle(MapShaper.getSvgDisplayStyle(lyr), overlayStyle);\n      }\n      overlayStyle.type = 'styled';\n    }\n    overlayStyle.ids = ids;\n    return ids.length > 0 ? overlayStyle : null;\n  }\n\n}());\n\n// Modify style to use scaled circle instead of dot symbol\nMapShaper.wrapHoverStyle = function(style, hoverStyle) {\n  var styler = function(obj, i) {\n    var dotColor;\n    style.styler(obj, i);\n    if (hoverStyle.styler) {\n      hoverStyle.styler(obj, i);\n    }\n    dotColor = obj.dotColor;\n    if (obj.radius && dotColor) {\n      obj.radius += 1.5;\n      obj.fillColor = dotColor;\n      obj.strokeColor = dotColor;\n      obj.opacity = 1;\n    }\n  };\n  return {styler: styler};\n};\n\nMapShaper.getSvgDisplayStyle = function(lyr) {\n  var records = lyr.data.getRecords(),\n      fields = MapShaper.getSvgStyleFields(lyr),\n      index = MapShaper.svgStyles;\n  var styler = function(style, i) {\n    var f, key, val;\n    for (var j=0; j<fields.length; j++) {\n      f = fields[j];\n      key = index[f];\n      val = records[i][f];\n      if (val == 'none') {\n        val = 'transparent'; // canvas equivalent\n      }\n      style[key] = val;\n    }\n\n    // TODO: make sure canvas rendering matches svg output\n    if (('strokeWidth' in style) && !style.strokeColor) {\n      style.strokeColor = 'black';\n    } else if (!('strokeWidth' in style) && style.strokeColor) {\n      style.strokeWidth = 1;\n    }\n    if (('radius' in style) && !style.strokeColor && !style.fillColor &&\n      lyr.geometry_type == 'point') {\n      style.fillColor = 'black';\n    }\n  };\n  return {styler: styler, type: 'styled'};\n};\n\n\n\n\nMapShaper.getBoundsOverlap = function(bb1, bb2) {\n  var area = 0;\n  if (bb1.intersects(bb2)) {\n    area = (Math.min(bb1.xmax, bb2.xmax) - Math.max(bb1.xmin, bb2.xmin)) *\n      (Math.min(bb1.ymax, bb2.ymax) - Math.max(bb1.ymin, bb2.ymin));\n  }\n  return area;\n};\n\n// Test if map should be re-framed to show updated layer\ngui.mapNeedsReset = function(newBounds, prevBounds, mapBounds) {\n  if (!prevBounds) return true;\n  if (prevBounds.xmin === 0 || newBounds.xmin === 0) return true; // kludge to handle tables\n  // TODO: consider similarity of prev and next bounds\n  //var overlapPct = 2 * MapShaper.getBoundsOverlap(newBounds, prevBounds) /\n  //    (newBounds.area() + prevBounds.area());\n  var boundsChanged = !prevBounds.equals(newBounds);\n  var intersects = newBounds.intersects(mapBounds);\n  // TODO: compare only intersecting portion of layer with map bounds\n  var areaRatio = newBounds.area() / mapBounds.area();\n  if (!boundsChanged) return false; // don't reset if layer extent hasn't changed\n  if (!intersects) return true; // reset if layer is out-of-view\n  return areaRatio > 500 || areaRatio < 0.05; // reset if layer is not at a viewable scale\n};\n\nfunction MshpMap(model) {\n  var _root = El('#mshp-main-map'),\n      _layers = El('#map-layers'),\n      _ext = new MapExtent(_layers),\n      _mouse = new MouseArea(_layers.node()),\n      _nav = new MapNav(_root, _ext, _mouse),\n      _inspector = new InspectionControl(model, new HitControl(_ext, _mouse));\n\n  var _activeCanv = new DisplayCanvas().appendTo(_layers), // data layer shapes\n      _overlayCanv = new DisplayCanvas().appendTo(_layers), // hover and selection shapes\n      _annotationCanv = new DisplayCanvas().appendTo(_layers), // used for line intersections\n      _annotationLyr, _annotationStyle,\n      _activeLyr, _activeStyle, _overlayStyle;\n\n  _ext.on('change', drawLayers);\n\n  _inspector.on('change', function(e) {\n    var lyr = _activeLyr.getDisplayLayer().layer;\n    _overlayStyle = MapStyle.getOverlayStyle(lyr, e);\n    drawLayer(_activeLyr, _overlayCanv, _overlayStyle);\n  });\n\n  model.on('select', function(e) {\n    _annotationStyle = null;\n    _overlayStyle = null;\n  });\n\n  model.on('update', function(e) {\n    var prevBounds = _activeLyr ?_activeLyr.getBounds() : null,\n        needReset = false;\n\n    if (arcsMayHaveChanged(e.flags)) {\n      // regenerate filtered arcs when simplification thresholds are calculated\n      // or arcs are updated\n      delete e.dataset.filteredArcs;\n\n      // reset simplification after projection (thresholds have changed)\n      // TODO: preserve simplification pct (need to record pct before change)\n      if (e.flags.proj && e.dataset.arcs) {\n        e.dataset.arcs.setRetainedPct(1);\n      }\n    }\n\n    _activeLyr = initActiveLayer(e);\n    needReset = gui.mapNeedsReset(_activeLyr.getBounds(), prevBounds, _ext.getBounds());\n    _ext.setBounds(_activeLyr.getBounds()); // update map extent to match bounds of active group\n    if (needReset) {\n      // zoom to full view of the active layer and redraw\n      _ext.reset(true);\n    } else {\n      // refresh without navigating\n      drawLayers();\n    }\n  });\n\n  this.setHighlightLayer = function(lyr, dataset) {\n    if (lyr) {\n      _annotationLyr = new DisplayLayer(lyr, dataset, _ext);\n      _annotationStyle = MapStyle.getHighlightStyle();\n      drawLayer(_annotationLyr, _annotationCanv, _annotationStyle);\n    } else {\n      _annotationStyle = null;\n      _annotationLyr = null;\n    }\n  };\n\n  // lightweight way to update simplification of display lines\n  // TODO: consider handling this as a model update\n  this.setSimplifyPct = function(pct) {\n    _activeLyr.setRetainedPct(pct);\n    drawLayers();\n  };\n\n  function initActiveLayer(o) {\n    var lyr = new DisplayLayer(o.layer, o.dataset, _ext);\n    _inspector.updateLayer(lyr);\n    _activeStyle = MapStyle.getActiveStyle(lyr.getDisplayLayer().layer);\n    lyr.updateStyle(_activeStyle);\n    return lyr;\n  }\n\n  // Test if an update may have affected the visible shape of arcs\n  // @flags Flags from update event\n  function arcsMayHaveChanged(flags) {\n    return flags.presimplify || flags.simplify || flags.proj ||\n        flags.arc_count || flags.repair;\n  }\n\n  function drawLayers() {\n    drawLayer(_activeLyr, _overlayCanv, _overlayStyle);\n    drawLayer(_activeLyr, _activeCanv, _activeStyle);\n    drawLayer(_annotationLyr, _annotationCanv, _annotationStyle);\n  }\n\n  function drawLayer(lyr, canv, style) {\n    if (style) {\n      canv.prep(_ext);\n      lyr.draw(canv, style);\n    } else {\n      canv.hide();\n    }\n\n  }\n}\n\nutils.inherit(MshpMap, EventDispatcher);\n\n\n\n\nfunction Console(model) {\n  var CURSOR = '$ ';\n  var PROMPT = 'Enter mapshaper commands or type \"tips\" for examples and console help';\n  var el = El('#console').hide();\n  var content = El('#console-buffer');\n  var log = El('div').id('console-log').appendTo(content);\n  var line = El('div').id('command-line').appendTo(content).text(CURSOR);\n  var input = El('span').appendTo(line)\n    .addClass('input-field')\n    .attr('spellcheck', false)\n    .attr('autocorrect', false)\n    .attr('contentEditable', true)\n    .on('focus', receiveFocus)\n    .on('paste', onPaste);\n  var history = [];\n  var historyId = 0;\n  var _isOpen = false;\n  var _error = MapShaper.error; // save default error functions...\n  var _stop = MapShaper.stop;\n\n  // capture all messages to this console, whether open or closed\n  message = MapShaper.message = consoleMessage;\n\n  message(PROMPT);\n  document.addEventListener('keydown', onKeyDown);\n  new ModeButton('#console-btn', 'console', model);\n  model.addMode('console', turnOn, turnOff);\n\n  gui.onClick(content, function(e) {\n    var targ = El(e.target);\n    if (gui.getInputElement() || targ.hasClass('console-message')) {\n      // don't focus if user is typing or user clicks content area\n    } else {\n      input.node().focus();\n    }\n  });\n\n  function toLog(str, cname) {\n    var msg = El('div').text(str).appendTo(log);\n    if (cname) {\n      msg.addClass(cname);\n    }\n    scrollDown();\n  }\n\n  function turnOn() {\n    if (!_isOpen && !!model.getEditingLayer()) {\n      _isOpen = true;\n      stop = MapShaper.stop = consoleStop;\n      error = MapShaper.error = consoleError;\n      el.show();\n      input.node().focus();\n    }\n  }\n\n  function turnOff() {\n    if (_isOpen) {\n      _isOpen = false;\n      stop = MapShaper.stop = _stop; // restore original error functions\n      error = MapShaper.error = _error;\n      el.hide();\n      input.node().blur();\n    }\n  }\n\n  function onPaste(e) {\n    // paste plain text (remove any copied HTML tags)\n    e.preventDefault();\n    var str = (e.originalEvent || e).clipboardData.getData('text/plain');\n    document.execCommand(\"insertHTML\", false, str);\n  }\n\n  function receiveFocus() {\n    placeCursor();\n  }\n\n  function placeCursor() {\n    var el = input.node();\n    var range, selection;\n    if (readCommandLine().length > 0) {\n      // move cursor to end of text\n      range = document.createRange();\n      range.selectNodeContents(el);\n      range.collapse(false); //collapse the range to the end point.\n      selection = window.getSelection();\n      selection.removeAllRanges();\n      selection.addRange(range);\n    }\n  }\n\n  function scrollDown() {\n    var el = content.parent().node();\n    el.scrollTop = el.scrollHeight;\n  }\n\n  function metaKey(e) {\n    return e.metaKey || e.ctrlKey || e.altKey;\n  }\n\n  function onKeyDown(e) {\n    var kc = e.keyCode,\n        inputEl = gui.getInputElement(),\n        typing = !!inputEl,\n        typingInConsole = inputEl && inputEl == input.node(),\n        inputText = readCommandLine(),\n        capture = false;\n\n    // esc key\n    if (kc == 27) {\n      if (typing) {\n        inputEl.blur();\n      }\n      model.clearMode(); // esc escapes other modes as well\n      capture = true;\n\n    // l/r arrow keys while not typing in a text field\n    } else if ((kc == 37 || kc == 39) && (!typing || typingInConsole && !inputText)) {\n      if (kc == 37) {\n        model.selectPrevLayer();\n      } else {\n        model.selectNextLayer();\n      }\n\n    // delete key while not inputting text\n    } else if (kc == 8 && !typing) {\n      capture = true; // prevent delete from leaving page\n\n    // any key while console is open\n    } else if (_isOpen) {\n      capture = true;\n      if (kc == 13) { // enter\n        submit();\n      } else if (kc == 9) { // tab\n        tabComplete();\n      } else if (kc == 38) {\n        back();\n      } else if (kc == 40) {\n        forward();\n      } else if (kc == 32 && (!typing || (inputText === '' && typingInConsole))) {\n        // space bar closes if nothing has been typed\n        model.clearMode();\n      } else if (!typing && e.target != input.node() && !metaKey(e)) {\n        // typing returns focus, unless a meta key is down (to allow Cmd-C copy)\n        // or user is typing in a different input area somewhere\n        input.node().focus();\n        capture = false;\n      } else {\n        // normal typing\n        capture = false;\n      }\n\n    // space bar while not inputting text\n    } else if (!typing && kc == 32) {\n      // space bar opens console, unless typing in an input field or editable el\n      capture = true;\n      model.enterMode('console');\n    }\n\n    if (capture) {\n      e.preventDefault();\n    }\n  }\n\n  // tab-completion for field names\n  function tabComplete() {\n    var line = readCommandLine(),\n        match = /\\w+$/.exec(line),\n        stub = match ? match[0] : '',\n        lyr = model.getEditingLayer().layer,\n        names, name;\n    if (stub && lyr.data) {\n      names = findCompletions(stub, lyr.data.getFields());\n      if (names.length > 0) {\n        name = utils.getCommonFileBase(names);\n        if (name.length > stub.length) {\n          toCommandLine(line.substring(0, match.index) + name);\n        }\n      }\n    }\n  }\n\n  function findCompletions(str, fields) {\n    return fields.filter(function(name) {\n      return name.indexOf(str) === 0;\n    });\n  }\n\n  function readCommandLine() {\n    return input.node().textContent.trim();\n  }\n\n  function toCommandLine(str) {\n    input.node().textContent = str.trim();\n    placeCursor();\n  }\n\n  function peekHistory(i) {\n    var idx = history.length - 1 - (i || 0);\n    return idx >= 0 ? history[idx] : null;\n  }\n\n  function toHistory(str) {\n    if (historyId > 0) { // if we're back in the history stack\n      if (peekHistory() === '') {\n        // remove empty string (which may have been appended when user started going back)\n        history.pop();\n      }\n      historyId = 0; // move back to the top of the stack\n    }\n    if (str && str != peekHistory()) {\n      history.push(str);\n    }\n  }\n\n  function fromHistory() {\n    toCommandLine(peekHistory(historyId));\n  }\n\n  function back() {\n    if (history.length === 0) return;\n    if (historyId === 0) {\n      history.push(readCommandLine());\n    }\n    historyId = Math.min(history.length - 1, historyId + 1);\n    fromHistory();\n  }\n\n  function forward() {\n    if (historyId <= 0) return;\n    historyId--;\n    fromHistory();\n    if (historyId === 0) {\n      history.pop();\n    }\n  }\n\n  function clear() {\n    log.empty();\n    scrollDown();\n  }\n\n  function getCommandFlags(commands) {\n    return commands.reduce(function(memo, cmd) {\n      memo[cmd.name] = true;\n      return memo;\n    }, {});\n  }\n\n  function submit() {\n    var cmd = readCommandLine();\n    toCommandLine('');\n    toLog(CURSOR + cmd);\n    if (cmd) {\n      if (cmd == 'clear') {\n        clear();\n      } else if (cmd == 'tips') {\n        printExamples();\n      } else if (cmd == 'layers') {\n        message(\"Available layers:\",\n          MapShaper.getFormattedLayerList(model.getEditingLayer().dataset.layers));\n      } else if (cmd == 'close' || cmd == 'exit' || cmd == 'quit') {\n        model.clearMode();\n      } else if (cmd) {\n        runMapshaperCommands(cmd);\n      }\n      toHistory(cmd);\n    }\n  }\n\n  function runMapshaperCommands(str) {\n    var commands, target;\n    try {\n      commands = MapShaper.parseConsoleCommands(str);\n      commands = MapShaper.runAndRemoveInfoCommands(commands);\n      target = model.getEditingLayer();\n    } catch (e) {\n      return onError(e);\n    }\n    if (target.layer && commands.length > 0) {\n      applyParsedCommands(commands, target.layer, target.dataset);\n    }\n  }\n\n  function applyParsedCommands(commands, lyr, dataset) {\n    var lyrId = dataset.layers.indexOf(lyr),\n        prevArcCount = dataset.arcs ? dataset.arcs.size() : 0;\n\n    // most commands should target the currently edited layer unless\n    // user has specified a different target\n    commands.forEach(function(cmd) {\n      if (!cmd.options.target && cmd.name != 'rename-layers' &&\n          cmd.name != 'merge-layers') {\n        cmd.options.target = String(lyrId);\n      }\n    });\n\n    MapShaper.runParsedCommands(commands, dataset, function(err) {\n      var flags = getCommandFlags(commands),\n          outputLyr = getOutputLayer(lyrId, dataset, commands);\n      if (prevArcCount > 0 && dataset.arcs.size() != prevArcCount) {\n        // kludge to signal map that filtered arcs need refreshing\n        flags.arc_count = true;\n      }\n      model.updated(flags, outputLyr, dataset);\n      // signal the map to update even if an error has occured, because the\n      // commands may have partially succeeded and changes may have occured to\n      // the data.\n      if (err) onError(err);\n    });\n  }\n\n  // try to get the output layer from the last console command\n  // (if multiple layers are output, pick one of the output layers)\n  // @lyrId  index of the currently edited layer\n  function getOutputLayer(lyrId, dataset, commands) {\n    var lastCmd = commands[commands.length-1],\n        layers = dataset.layers,\n        lyr;\n    if (lastCmd.options.no_replace) {\n      // pick last layer if a new layer has been created\n      // (new layers should be appended to the list of layers -- need to test)\n      lyr = layers[layers.length-1];\n    } else {\n      // use the layer in the same position as the currently selected layer;\n      // this may not be the output layer if a different layer was explicitly\n      // targeted.\n      lyr = layers[lyrId] || layers[0];\n    }\n    return lyr;\n  }\n\n  function onError(err) {\n    if (utils.isString(err)) {\n      stop(err);\n    } else if (err.name == 'APIError') {\n      // stop() has already been called, don't need to log\n    } else if (err.name) {\n      // log stack trace to browser console\n      console.error(err.stack);\n      // log to console window\n      warning(err.message);\n    }\n  }\n\n  function consoleStop() {\n    var msg = gui.formatMessageArgs(arguments);\n    warning(msg);\n    throw new APIError(msg);\n  }\n\n  function warning() {\n    var msg = gui.formatMessageArgs(arguments);\n    toLog(msg, 'console-error');\n  }\n\n  function consoleMessage() {\n    var msg = gui.formatMessageArgs(arguments);\n    toLog(msg, 'console-message');\n  }\n\n  function consoleError() {\n    var msg = gui.formatMessageArgs(arguments);\n    throw new Error(msg);\n  }\n\n  function printExample(comment, command) {\n    toLog(comment, 'console-message');\n    toLog(command, 'console-example');\n  }\n\n  function printExamples() {\n    printExample(\"See a list of all console commands\", \"$ help\");\n    printExample(\"Get help using a single command\", \"$ help innerlines\");\n    printExample(\"Get information about the active data layer\", \"$ info\");\n    printExample(\"Delete one state from a national dataset\",\"$ filter 'STATE != \\\"Alaska\\\"'\");\n    printExample(\"Aggregate counties to states by dissolving shared edges\" ,\"$ dissolve 'STATE'\");\n    printExample(\"Clear the console\", \"$ clear\");\n  }\n}\n\n\n\n\nfunction Model() {\n  var datasets = [],\n      self = this,\n      mode = null,\n      editing;\n\n  this.forEachLayer = function(cb) {\n    var i = 0;\n    datasets.forEach(function(dataset) {\n      dataset.layers.forEach(function(lyr) {\n        cb(lyr, dataset, i++);\n      });\n    });\n  };\n\n  this.deleteLayer = function(lyr, dataset) {\n    var layers = dataset.layers;\n    layers.splice(layers.indexOf(lyr), 1);\n    if (layers.length === 0) {\n      this.removeDataset(dataset);\n    }\n  };\n\n  this.findLayer = function(target) {\n    var found = null;\n    this.forEachLayer(function(lyr, dataset) {\n      if (lyr == target) {\n        found = layerObject(lyr, dataset);\n      }\n    });\n    return found;\n  };\n\n  this.findAnotherLayer = function(target) {\n    var layers = this.getLayers(),\n        found = null;\n    if (layers.length > 1) {\n      found = layers[0].layer == target ? layers[1] : layers[0];\n    }\n    return found;\n  };\n\n  this.removeDataset = function(target) {\n    if (target == (editing && editing.dataset)) {\n      error(\"Can't remove dataset while editing\");\n    }\n    datasets = datasets.filter(function(d) {\n      return d != target;\n    });\n  };\n\n  this.getDatasets = function() {\n    return datasets;\n  };\n\n  this.getLayers = function() {\n    var layers = [];\n    this.forEachLayer(function(lyr, dataset) {\n      layers.push(layerObject(lyr, dataset));\n    });\n    return layers;\n  };\n\n  this.selectNextLayer = function() {\n    var layers = this.getLayers(),\n        idx = indexOfLayer(editing.layer, layers),\n        next;\n    if (layers.length > 1 && idx > -1) {\n      next = layers[(idx + 1) % layers.length];\n      this.selectLayer(next.layer, next.dataset);\n    }\n  };\n\n  this.selectPrevLayer = function() {\n    var layers = this.getLayers(),\n        idx = indexOfLayer(editing.layer, layers),\n        prev;\n    if (layers.length > 1 && idx > -1) {\n      prev = layers[idx === 0 ? layers.length - 1 : idx - 1];\n      this.selectLayer(prev.layer, prev.dataset);\n    }\n  };\n\n  this.selectLayer = function(lyr, dataset) {\n    this.updated({select: true}, lyr, dataset);\n  };\n\n  this.addDataset = function(dataset) {\n    this.updated({select: true, import: true}, dataset.layers[0], dataset);\n  };\n\n  this.updated = function(flags, lyr, dataset) {\n    var e;\n    flags = flags || {};\n    if (lyr && dataset && (!editing || editing.layer != lyr)) {\n      setEditingLayer(lyr, dataset);\n      flags.select = true;\n    }\n    if (editing) {\n      if (flags.select) {\n        this.dispatchEvent('select', editing);\n      }\n      e = utils.extend({flags: flags}, editing);\n      this.dispatchEvent('update', e);\n    }\n  };\n\n  this.getEditingLayer = function() {\n    return editing || {};\n  };\n\n  this.getMode = function() {\n    return mode;\n  };\n\n  // return a function to trigger this mode\n  this.addMode = function(name, enter, exit) {\n    this.on('mode', function(e) {\n      if (e.prev == name) {\n        exit();\n      }\n      if (e.name == name) {\n        enter();\n      }\n    });\n  };\n\n  this.addMode(null, function() {}, function() {}); // null mode\n\n  this.clearMode = function() {\n    self.enterMode(null);\n  };\n\n  this.enterMode = function(next) {\n    var prev = mode;\n    if (next != prev) {\n      mode = next;\n      self.dispatchEvent('mode', {name: next, prev: prev});\n    }\n  };\n\n  function setEditingLayer(lyr, dataset) {\n    if (editing && editing.layer == lyr) {\n      return;\n    }\n    if (dataset.layers.indexOf(lyr) == -1) {\n      error(\"Selected layer not found\");\n    }\n    if (datasets.indexOf(dataset) == -1) {\n      datasets.push(dataset);\n    }\n    editing = layerObject(lyr, dataset);\n  }\n\n  function layerObject(lyr, dataset) {\n    return {\n      layer: lyr,\n      dataset: dataset\n    };\n  }\n\n  function indexOfLayer(lyr, layers) {\n    var idx = -1;\n    layers.forEach(function(o, i) {\n      if (o.layer == lyr) idx = i;\n    });\n    return idx;\n  }\n}\n\nutils.inherit(Model, EventDispatcher);\n\n\n\n\nBrowser.onload(function() {\n  if (!gui.browserIsSupported()) {\n    El(\"#mshp-not-supported\").show();\n    return;\n  }\n  gui.startEditing();\n  if (window.location.hostname == 'localhost') {\n    window.addEventListener('beforeunload', function() {\n      // send termination signal for mapshaper-gui\n      var req = new XMLHttpRequest();\n      req.open('GET', '/close');\n      req.send();\n    });\n  }\n});\n\ngui.startEditing = function() {\n  var model = new Model(),\n      dataLoaded = false,\n      map, repair, simplify;\n  gui.startEditing = function() {};\n  gui.alert = new ErrorMessages(model);\n  map = new MshpMap(model);\n  repair = new RepairControl(model, map);\n  simplify = new SimplifyControl(model);\n  new ImportFileProxy(model);\n  new ImportControl(model);\n  new ExportControl(model);\n  new LayerControl(model);\n\n  model.on('select', function() {\n    if (!dataLoaded) {\n      dataLoaded = true;\n      El('#mode-buttons').show();\n      El('#nav-buttons').show();\n      new Console(model);\n    }\n  });\n  // TODO: untangle dependencies between SimplifyControl, RepairControl and Map\n  simplify.on('simplify-start', function() {\n    repair.hide();\n  });\n  simplify.on('simplify-end', function() {\n    repair.update();\n  });\n  simplify.on('change', function(e) {\n    map.setSimplifyPct(e.value);\n  });\n};\n\n}());\n"
  },
  {
    "path": "mapshaper.js",
    "content": "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n(function (Buffer){\n(function(){\nvar VERSION = '0.3.25';\n\nvar error = function() {\n  var msg = Utils.toArray(arguments).join(' ');\n  throw new Error(msg);\n};\n\nvar utils = {\n  getUniqueName: function(prefix) {\n    var n = Utils.__uniqcount || 0;\n    Utils.__uniqcount = n + 1;\n    return (prefix || \"__id_\") + n;\n  },\n\n  isFunction: function(obj) {\n    return typeof obj == 'function';\n  },\n\n  isObject: function(obj) {\n    return obj === Object(obj); // via underscore\n  },\n\n  clamp: function(val, min, max) {\n    return val < min ? min : (val > max ? max : val);\n  },\n\n  interpolate: function(val1, val2, pct) {\n    return val1 * (1-pct) + val2 * pct;\n  },\n\n  isArray: function(obj) {\n    return Array.isArray(obj);\n  },\n\n  // NaN -> true\n  isNumber: function(obj) {\n    // return toString.call(obj) == '[object Number]'; // ie8 breaks?\n    return obj != null && obj.constructor == Number;\n  },\n\n  isInteger: function(obj) {\n    return Utils.isNumber(obj) && ((obj | 0) === obj);\n  },\n\n  isString: function(obj) {\n    return obj != null && obj.toString === String.prototype.toString;\n    // TODO: replace w/ something better.\n  },\n\n  isBoolean: function(obj) {\n    return obj === true || obj === false;\n  },\n\n  // Convert an array-like object to an Array, or make a copy if @obj is an Array\n  toArray: function(obj) {\n    var arr;\n    if (!Utils.isArrayLike(obj)) error(\"Utils.toArray() requires an array-like object\");\n    try {\n      arr = Array.prototype.slice.call(obj, 0); // breaks in ie8\n    } catch(e) {\n      // support ie8\n      arr = [];\n      for (var i=0, n=obj.length; i<n; i++) {\n        arr[i] = obj[i];\n      }\n    }\n    return arr;\n  },\n\n  // Array like: has length property, is numerically indexed and mutable.\n  // TODO: try to detect objects with length property but no indexed data elements\n  isArrayLike: function(obj) {\n    if (!obj) return false;\n    if (Utils.isArray(obj)) return true;\n    if (Utils.isString(obj)) return false;\n    if (obj.length === 0) return true;\n    if (obj.length > 0) return true;\n    return false;\n  },\n\n  // See https://raw.github.com/kvz/phpjs/master/functions/strings/addslashes.js\n  addslashes: function(str) {\n    return (str + '').replace(/[\\\\\"']/g, '\\\\$&').replace(/\\u0000/g, '\\\\0');\n  },\n\n  // Escape a literal string to use in a regexp.\n  // Ref.: http://simonwillison.net/2006/Jan/20/escape/\n  regexEscape: function(str) {\n    return str.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n  },\n\n  defaults: function(dest) {\n    for (var i=1, n=arguments.length; i<n; i++) {\n      var src = arguments[i] || {};\n      for (var key in src) {\n        if (key in dest === false && src.hasOwnProperty(key)) {\n          dest[key] = src[key];\n        }\n      }\n    }\n    return dest;\n  },\n\n  extend: function(o) {\n    var dest = o || {},\n        n = arguments.length,\n        key, i, src;\n    for (i=1; i<n; i++) {\n      src = arguments[i] || {};\n      for (key in src) {\n        if (src.hasOwnProperty(key)) {\n          dest[key] = src[key];\n        }\n      }\n    }\n    return dest;\n  },\n\n  // Pseudoclassical inheritance\n  //\n  // Inherit from a Parent function:\n  //    Utils.inherit(Child, Parent);\n  // Call parent's constructor (inside child constructor):\n  //    this.__super__([args...]);\n  inherit: function(targ, src) {\n    var f = function() {\n      if (this.__super__ == f) {\n        // add __super__ of parent to front of lookup chain\n        // so parent class constructor can call its parent using this.__super__\n        this.__super__ = src.prototype.__super__;\n        // call parent constructor function. this.__super__ now points to parent-of-parent\n        src.apply(this, arguments);\n        // remove temp __super__, expose targ.prototype.__super__ again\n        delete this.__super__;\n      }\n    };\n\n    f.prototype = src.prototype || src; // added || src to allow inheriting from objects as well as functions\n    // Extend targ prototype instead of wiping it out --\n    //   in case inherit() is called after targ.prototype = {stuff}; statement\n    targ.prototype = Utils.extend(new f(), targ.prototype); //\n    targ.prototype.constructor = targ;\n    targ.prototype.__super__ = f;\n  },\n\n  // Inherit from a parent, call the parent's constructor, optionally extend\n  // prototype with optional additional arguments\n  subclass: function(parent) {\n    var child = function() {\n      this.__super__.apply(this, Utils.toArray(arguments));\n    };\n    Utils.inherit(child, parent);\n    for (var i=1; i<arguments.length; i++) {\n      Utils.extend(child.prototype, arguments[i]);\n    }\n    return child;\n  }\n\n};\n\nvar Utils = utils;\n\n\nvar Env = (function() {\n  var inNode = typeof module !== 'undefined' && !!module.exports;\n  var inBrowser = typeof window !== 'undefined' && !inNode;\n  var inPhantom = inBrowser && !!(window.phantom && window.phantom.exit);\n  var ieVersion = inBrowser && /MSIE ([0-9]+)/.exec(navigator.appVersion) && parseInt(RegExp.$1) || NaN;\n\n  return {\n    iPhone : inBrowser && !!(navigator.userAgent.match(/iPhone/i)),\n    iPad : inBrowser && !!(navigator.userAgent.match(/iPad/i)),\n    canvas: inBrowser && !!document.createElement('canvas').getContext,\n    inNode : inNode,\n    inPhantom : inPhantom,\n    inBrowser: inBrowser,\n    ieVersion: ieVersion,\n    ie: !isNaN(ieVersion)\n  };\n})();\n\n\n// Support for timing using T.start() and T.stop(\"message\")\n//\nvar T = {\n  stack: [],\n  verbose: true,\n\n  start: function(msg) {\n    if (T.verbose && msg) verbose(T.prefix() + msg);\n    T.stack.push(+new Date);\n  },\n\n  // Stop timing, print a message if T.verbose == true\n  stop: function(note) {\n    var startTime = T.stack.pop();\n    var elapsed = (+new Date - startTime);\n    if (T.verbose) {\n      var msg =  T.prefix() + elapsed + 'ms';\n      if (note) {\n        msg += \" \" + note;\n      }\n      verbose(msg);\n    }\n    return elapsed;\n  },\n\n  prefix: function() {\n    var str = \"- \",\n        level = this.stack.length;\n    while (level--) str = \"-\" + str;\n    return str;\n  }\n};\n\n\n// Append elements of @src array to @dest array\nutils.merge = function(dest, src) {\n  if (!utils.isArray(dest) || !utils.isArray(src)) {\n    error(\"Usage: utils.merge(destArray, srcArray);\")\n  }\n  if (src.length > 0) {\n    dest.push.apply(dest, src);\n  }\n  return dest;\n};\n\n// Returns elements in arr and not in other\n// (similar to underscore diff)\nutils.difference = function(arr, other) {\n  var index = utils.arrayToIndex(other);\n  return arr.filter(function(el) {\n    return !Object.prototype.hasOwnProperty.call(index, el);\n  });\n};\n\n// Test a string or array-like object for existence of substring or element\nutils.contains = function(container, item) {\n  if (utils.isString(container)) {\n    return container.indexOf(item) != -1;\n  }\n  else if (utils.isArrayLike(container)) {\n    return utils.indexOf(container, item) != -1;\n  }\n  error(\"Expected Array or String argument\");\n};\n\nutils.some = function(arr, test) {\n  return arr.reduce(function(val, item) {\n    return val || test(item); // TODO: short-circuit?\n  }, false);\n};\n\nutils.every = function(arr, test) {\n  return arr.reduce(function(val, item) {\n    return val && test(item);\n  }, true);\n};\n\nutils.find = function(arr, test, ctx) {\n  var matches = arr.filter(test, ctx);\n  return matches.length === 0 ? null : matches[0];\n};\n\nutils.indexOf = function(arr, item, prop) {\n  if (prop) error(\"utils.indexOf() No longer supports property argument\");\n  var nan = !(item === item);\n  for (var i = 0, len = arr.length || 0; i < len; i++) {\n    if (arr[i] === item) return i;\n    if (nan && !(arr[i] === arr[i])) return i;\n  }\n  return -1;\n};\n\nutils.range = function(len, start, inc) {\n  var arr = [],\n      v = start === void 0 ? 0 : start,\n      i = inc === void 0 ? 1 : inc;\n  while(len--) {\n    arr.push(v);\n    v += i;\n  }\n  return arr;\n};\n\nutils.repeat = function(times, func) {\n  var values = [],\n      val;\n  for (var i=0; i<times; i++) {\n    val = func(i);\n    if (val !== void 0) {\n      values[i] = val;\n    }\n  }\n  return values.length > 0 ? values : void 0;\n};\n\n// Calc sum, skip falsy and NaN values\n// Assumes: no other non-numeric objects in array\n//\nutils.sum = function(arr, info) {\n  if (!utils.isArrayLike(arr)) error (\"utils.sum() expects an array, received:\", arr);\n  var tot = 0,\n      nan = 0,\n      val;\n  for (var i=0, n=arr.length; i<n; i++) {\n    val = arr[i];\n    if (val) {\n      tot += val;\n    } else if (isNaN(val)) {\n      nan++;\n    }\n  }\n  if (info) {\n    info.nan = nan;\n  }\n  return tot;\n};\n\n// Calculate min and max values of an array, ignoring NaN values\nutils.getArrayBounds = function(arr) {\n  var min = Infinity,\n    max = -Infinity,\n    nan = 0, val;\n  for (var i=0, len=arr.length; i<len; i++) {\n    val = arr[i];\n    if (val !== val) nan++;\n    if (val < min) min = val;\n    if (val > max) max = val;\n  }\n  return {\n    min: min,\n    max: max,\n    nan: nan\n  };\n};\n\nutils.uniq = function(src) {\n  var index = {};\n  return src.reduce(function(memo, el) {\n    if (el in index === false) {\n      index[el] = true;\n      memo.push(el);\n    }\n    return memo;\n  }, []);\n};\n\nutils.pluck = function(arr, key) {\n  return arr.map(function(obj) {\n    return obj[key];\n  });\n};\n\nutils.countValues = function(arr) {\n  return arr.reduce(function(memo, val) {\n    memo[val] = (val in memo) ? memo[val] + 1 : 1;\n    return memo;\n  }, {});\n};\n\nutils.indexOn = function(arr, k) {\n  return arr.reduce(function(index, o) {\n    index[o[k]] = o;\n    return index;\n  }, {});\n};\n\nutils.groupBy = function(arr, k) {\n  return arr.reduce(function(index, o) {\n    var keyval = o[k];\n    if (keyval in index) {\n      index[keyval].push(o);\n    } else {\n      index[keyval] = [o]\n    }\n    return index;\n  }, {});\n};\n\nutils.arrayToIndex = function(arr, val) {\n  var init = arguments.length > 1;\n  return arr.reduce(function(index, key) {\n    index[key] = init ? val : true;\n    return index;\n  }, {});\n};\n\n// Support for iterating over array-like objects, like typed arrays\nutils.forEach = function(arr, func, ctx) {\n  if (!utils.isArrayLike(arr)) {\n    throw new Error(\"#forEach() takes an array-like argument. \" + arr);\n  }\n  for (var i=0, n=arr.length; i < n; i++) {\n    func.call(ctx, arr[i], i);\n  }\n};\n\nutils.forEachProperty = function(o, func, ctx) {\n  Object.keys(o).forEach(function(key) {\n    func.call(ctx, o[key], key);\n  });\n};\n\nutils.initializeArray = function(arr, init) {\n  for (var i=0, len=arr.length; i<len; i++) {\n    arr[i] = init;\n  }\n  return arr;\n};\n\nutils.replaceArray = function(arr, arr2) {\n  arr.splice(0, arr.length);\n  arr.push.apply(arr, arr2);\n};\n\n\nUtils.repeatString = function(src, n) {\n  var str = \"\";\n  for (var i=0; i<n; i++)\n    str += src;\n  return str;\n};\n\nUtils.pluralSuffix = function(count) {\n  return count != 1 ? 's' : '';\n};\n\nUtils.endsWith = function(str, ending) {\n    return str.indexOf(ending, str.length - ending.length) !== -1;\n};\n\nUtils.lpad = function(str, size, pad) {\n  pad = pad || ' ';\n  str = String(str);\n  return Utils.repeatString(pad, size - str.length) + str;\n};\n\nUtils.rpad = function(str, size, pad) {\n  pad = pad || ' ';\n  str = String(str);\n  return str + Utils.repeatString(pad, size - str.length);\n};\n\nUtils.trim = function(str) {\n  return Utils.ltrim(Utils.rtrim(str));\n};\n\nvar ltrimRxp = /^\\s+/;\nUtils.ltrim = function(str) {\n  return str.replace(ltrimRxp, '');\n};\n\nvar rtrimRxp = /\\s+$/;\nUtils.rtrim = function(str) {\n  return str.replace(rtrimRxp, '');\n};\n\nUtils.addThousandsSep = function(str) {\n  var fmt = '',\n      start = str[0] == '-' ? 1 : 0,\n      dec = str.indexOf('.'),\n      end = str.length,\n      ins = (dec == -1 ? end : dec) - 3;\n  while (ins > start) {\n    fmt = ',' + str.substring(ins, end) + fmt;\n    end = ins;\n    ins -= 3;\n  }\n  return str.substring(0, end) + fmt;\n};\n\nUtils.numToStr = function(num, decimals) {\n  return decimals >= 0 ? num.toFixed(decimals) : String(num);\n};\n\nUtils.formatNumber = function(num, decimals, nullStr, showPos) {\n  var fmt;\n  if (isNaN(num)) {\n    fmt = nullStr || '-';\n  } else {\n    fmt = Utils.numToStr(num, decimals);\n    fmt = Utils.addThousandsSep(fmt);\n    if (showPos && parseFloat(fmt) > 0) {\n      fmt = \"+\" + fmt;\n    }\n  }\n  return fmt;\n};\n\n\n\nfunction Transform() {\n  this.mx = this.my = 1;\n  this.bx = this.by = 0;\n}\n\nTransform.prototype.isNull = function() {\n  return !this.mx || !this.my || isNaN(this.bx) || isNaN(this.by);\n};\n\nTransform.prototype.invert = function() {\n  var inv = new Transform();\n  inv.mx = 1 / this.mx;\n  inv.my = 1 / this.my;\n  //inv.bx = -this.bx * inv.mx;\n  //inv.by = -this.by * inv.my;\n  inv.bx = -this.bx / this.mx;\n  inv.by = -this.by / this.my;\n  return inv;\n};\n\n\nTransform.prototype.transform = function(x, y, xy) {\n  xy = xy || [];\n  xy[0] = x * this.mx + this.bx;\n  xy[1] = y * this.my + this.by;\n  return xy;\n};\n\nTransform.prototype.toString = function() {\n  return Utils.toString(Utils.extend({}, this));\n};\n\n\nfunction Bounds() {\n  if (arguments.length > 0) {\n    this.setBounds.apply(this, arguments);\n  }\n}\n\nBounds.prototype.toString = function() {\n  return JSON.stringify({\n    xmin: this.xmin,\n    xmax: this.xmax,\n    ymin: this.ymin,\n    ymax: this.ymax\n  });\n};\n\nBounds.prototype.toArray = function() {\n  return this.hasBounds() ? [this.xmin, this.ymin, this.xmax, this.ymax] : [];\n};\n\nBounds.prototype.hasBounds = function() {\n  return this.xmin <= this.xmax && this.ymin <= this.ymax;\n};\n\nBounds.prototype.sameBounds =\nBounds.prototype.equals = function(bb) {\n  return bb && this.xmin === bb.xmin && this.xmax === bb.xmax &&\n    this.ymin === bb.ymin && this.ymax === bb.ymax;\n};\n\nBounds.prototype.width = function() {\n  return (this.xmax - this.xmin) || 0;\n};\n\nBounds.prototype.height = function() {\n  return (this.ymax - this.ymin) || 0;\n};\n\nBounds.prototype.area = function() {\n  return this.width() * this.height() || 0;\n};\n\nBounds.prototype.empty = function() {\n  this.xmin = this.ymin = this.xmax = this.ymax = void 0;\n  return this;\n};\n\nBounds.prototype.setBounds = function(a, b, c, d) {\n  if (arguments.length == 1) {\n    // assume first arg is a Bounds or array\n    if (Utils.isArrayLike(a)) {\n      b = a[1];\n      c = a[2];\n      d = a[3];\n      a = a[0];\n    } else {\n      b = a.ymin;\n      c = a.xmax;\n      d = a.ymax;\n      a = a.xmin;\n    }\n  }\n\n  this.xmin = a;\n  this.ymin = b;\n  this.xmax = c;\n  this.ymax = d;\n  if (a > c || b > d) this.update();\n  // error(\"Bounds#setBounds() min/max reversed:\", a, b, c, d);\n  return this;\n};\n\n\nBounds.prototype.centerX = function() {\n  var x = (this.xmin + this.xmax) * 0.5;\n  return x;\n};\n\nBounds.prototype.centerY = function() {\n  var y = (this.ymax + this.ymin) * 0.5;\n  return y;\n};\n\nBounds.prototype.containsPoint = function(x, y) {\n  if (x >= this.xmin && x <= this.xmax &&\n    y <= this.ymax && y >= this.ymin) {\n    return true;\n  }\n  return false;\n};\n\n// intended to speed up slightly bubble symbol detection; could use intersects() instead\n// TODO: fix false positive where circle is just outside a corner of the box\nBounds.prototype.containsBufferedPoint =\nBounds.prototype.containsCircle = function(x, y, buf) {\n  if ( x + buf > this.xmin && x - buf < this.xmax ) {\n    if ( y - buf < this.ymax && y + buf > this.ymin ) {\n      return true;\n    }\n  }\n  return false;\n};\n\nBounds.prototype.intersects = function(bb) {\n  if (bb.xmin <= this.xmax && bb.xmax >= this.xmin &&\n    bb.ymax >= this.ymin && bb.ymin <= this.ymax) {\n    return true;\n  }\n  return false;\n};\n\nBounds.prototype.contains = function(bb) {\n  if (bb.xmin >= this.xmin && bb.ymax <= this.ymax &&\n    bb.xmax <= this.xmax && bb.ymin >= this.ymin) {\n    return true;\n  }\n  return false;\n};\n\nBounds.prototype.shift = function(x, y) {\n  this.setBounds(this.xmin + x,\n    this.ymin + y, this.xmax + x, this.ymax + y);\n};\n\nBounds.prototype.padBounds = function(a, b, c, d) {\n  this.xmin -= a;\n  this.ymin -= b;\n  this.xmax += c;\n  this.ymax += d;\n};\n\n// Rescale the bounding box by a fraction. TODO: implement focus.\n// @param {number} pct Fraction of original extents\n// @param {number} pctY Optional amount to scale Y\n//\nBounds.prototype.scale = function(pct, pctY) { /*, focusX, focusY*/\n  var halfWidth = (this.xmax - this.xmin) * 0.5;\n  var halfHeight = (this.ymax - this.ymin) * 0.5;\n  var kx = pct - 1;\n  var ky = pctY === undefined ? kx : pctY - 1;\n  this.xmin -= halfWidth * kx;\n  this.ymin -= halfHeight * ky;\n  this.xmax += halfWidth * kx;\n  this.ymax += halfHeight * ky;\n};\n\n// Return a bounding box with the same extent as this one.\nBounds.prototype.cloneBounds = // alias so child classes can override clone()\nBounds.prototype.clone = function() {\n  return new Bounds(this.xmin, this.ymin, this.xmax, this.ymax);\n};\n\nBounds.prototype.clearBounds = function() {\n  this.setBounds(new Bounds());\n};\n\nBounds.prototype.mergePoint = function(x, y) {\n  if (this.xmin === void 0) {\n    this.setBounds(x, y, x, y);\n  } else {\n    // this works even if x,y are NaN\n    if (x < this.xmin)  this.xmin = x;\n    else if (x > this.xmax)  this.xmax = x;\n\n    if (y < this.ymin) this.ymin = y;\n    else if (y > this.ymax) this.ymax = y;\n  }\n};\n\n// expands either x or y dimension to match @aspect (width/height ratio)\n// @focusX, @focusY (optional): expansion focus, as a fraction of width and height\nBounds.prototype.fillOut = function(aspect, focusX, focusY) {\n  if (arguments.length < 3) {\n    focusX = 0.5;\n    focusY = 0.5;\n  }\n  var w = this.width(),\n      h = this.height(),\n      currAspect = w / h,\n      pad;\n  if (isNaN(aspect) || aspect <= 0) {\n    // error condition; don't pad\n  } else if (currAspect < aspect) { // fill out x dimension\n    pad = h * aspect - w;\n    this.xmin -= (1 - focusX) * pad;\n    this.xmax += focusX * pad;\n  } else {\n    pad = w / aspect - h;\n    this.ymin -= (1 - focusY) * pad;\n    this.ymax += focusY * pad;\n  }\n  return this;\n};\n\nBounds.prototype.update = function() {\n  var tmp;\n  if (this.xmin > this.xmax) {\n    tmp = this.xmin;\n    this.xmin = this.xmax;\n    this.xmax = tmp;\n  }\n  if (this.ymin > this.ymax) {\n    tmp = this.ymin;\n    this.ymin = this.ymax;\n    this.ymax = tmp;\n  }\n};\n\nBounds.prototype.transform = function(t) {\n  this.xmin = this.xmin * t.mx + t.bx;\n  this.xmax = this.xmax * t.mx + t.bx;\n  this.ymin = this.ymin * t.my + t.by;\n  this.ymax = this.ymax * t.my + t.by;\n  this.update();\n  return this;\n};\n\n// Returns a Transform object for mapping this onto Bounds @b2\n// @flipY (optional) Flip y-axis coords, for converting to/from pixel coords\n//\nBounds.prototype.getTransform = function(b2, flipY) {\n  var t = new Transform();\n  t.mx = b2.width() / this.width();\n  t.bx = b2.xmin - t.mx * this.xmin;\n  if (flipY) {\n    t.my = -b2.height() / this.height();\n    t.by = b2.ymax - t.my * this.ymin;\n  } else {\n    t.my = b2.height() / this.height();\n    t.by = b2.ymin - t.my * this.ymin;\n  }\n  return t;\n};\n\nBounds.prototype.mergeCircle = function(x, y, r) {\n  if (r < 0) r = -r;\n  this.mergeBounds([x - r, y - r, x + r, y + r]);\n};\n\nBounds.prototype.mergeBounds = function(bb) {\n  var a, b, c, d;\n  if (bb instanceof Bounds) {\n    a = bb.xmin, b = bb.ymin, c = bb.xmax, d = bb.ymax;\n  } else if (arguments.length == 4) {\n    a = arguments[0];\n    b = arguments[1];\n    c = arguments[2];\n    d = arguments[3];\n  } else if (bb.length == 4) {\n    // assume array: [xmin, ymin, xmax, ymax]\n    a = bb[0], b = bb[1], c = bb[2], d = bb[3];\n  } else {\n    error(\"Bounds#mergeBounds() invalid argument:\", bb);\n  }\n\n  if (this.xmin === void 0) {\n    this.setBounds(a, b, c, d);\n  } else {\n    if (a < this.xmin) this.xmin = a;\n    if (b < this.ymin) this.ymin = b;\n    if (c > this.xmax) this.xmax = c;\n    if (d > this.ymax) this.ymax = d;\n  }\n  return this;\n};\n\n\n// Sort an array of objects based on one or more properties.\n// Usage: Utils.sortOn(array, key1, asc?[, key2, asc? ...])\n//\nUtils.sortOn = function(arr) {\n  var comparators = [];\n  for (var i=1; i<arguments.length; i+=2) {\n    comparators.push(Utils.getKeyComparator(arguments[i], arguments[i+1]));\n  }\n  arr.sort(function(a, b) {\n    var cmp = 0,\n        i = 0,\n        n = comparators.length;\n    while (i < n && cmp === 0) {\n      cmp = comparators[i](a, b);\n      i++;\n    }\n    return cmp;\n  });\n  return arr;\n};\n\n// Sort array of values that can be compared with < > operators (strings, numbers)\n// null, undefined and NaN are sorted to the end of the array\n//\nUtils.genericSort = function(arr, asc) {\n  var compare = Utils.getGenericComparator(asc);\n  Array.prototype.sort.call(arr, compare);\n  return arr;\n};\n\nUtils.sortOnKey = function(arr, getter, asc) {\n  var compare = Utils.getGenericComparator(asc !== false) // asc is default\n  arr.sort(function(a, b) {\n    return compare(getter(a), getter(b));\n  });\n};\n\n// Stashes keys in a temp array (better if calculating key is expensive).\nUtils.sortOnKey2 = function(arr, getKey, asc) {\n  Utils.sortArrayByKeys(arr, arr.map(getKey), asc);\n};\n\nUtils.sortArrayByKeys = function(arr, keys, asc) {\n  var ids = Utils.getSortedIds(keys, asc);\n  Utils.reorderArray(arr, ids);\n};\n\nUtils.getSortedIds = function(arr, asc) {\n  var ids = Utils.range(arr.length);\n  Utils.sortArrayIndex(ids, arr, asc);\n  return ids;\n};\n\nUtils.sortArrayIndex = function(ids, arr, asc) {\n  var compare = Utils.getGenericComparator(asc);\n  ids.sort(function(i, j) {\n    // added i, j comparison to guarantee that sort is stable\n    var cmp = compare(arr[i], arr[j]);\n    return cmp > 0 || cmp === 0 && i < j ? 1 : -1;\n  });\n};\n\nUtils.reorderArray = function(arr, idxs) {\n  var len = idxs.length;\n  var arr2 = [];\n  for (var i=0; i<len; i++) {\n    var idx = idxs[i];\n    if (idx < 0 || idx >= len) error(\"Out-of-bounds array idx\");\n    arr2[i] = arr[idx];\n  }\n  Utils.replaceArray(arr, arr2);\n};\n\nUtils.getKeyComparator = function(key, asc) {\n  var compare = Utils.getGenericComparator(asc);\n  return function(a, b) {\n    return compare(a[key], b[key]);\n  };\n};\n\nUtils.getGenericComparator = function(asc) {\n  asc = asc !== false;\n  return function(a, b) {\n    var retn = 0;\n    if (b == null) {\n      retn = a == null ? 0 : -1;\n    } else if (a == null) {\n      retn = 1;\n    } else if (a < b) {\n      retn = asc ? -1 : 1;\n    } else if (a > b) {\n      retn = asc ? 1 : -1;\n    } else if (a !== a) {\n      retn = 1;\n    } else if (b !== b) {\n      retn = -1;\n    }\n    return retn;\n  };\n};\n\n\n\n// Generic in-place sort (null, NaN, undefined not handled)\nUtils.quicksort = function(arr, asc) {\n  Utils.quicksortPartition(arr, 0, arr.length-1);\n  if (asc === false) Array.prototype.reverse.call(arr); // Works with typed arrays\n  return arr;\n};\n\n// Moved out of Utils.quicksort() (saw >100% speedup in Chrome with deep recursion)\nUtils.quicksortPartition = function (a, lo, hi) {\n  var i = lo,\n      j = hi,\n      pivot, tmp;\n  while (i < hi) {\n    pivot = a[lo + hi >> 1]; // avoid n^2 performance on sorted arrays\n    while (i <= j) {\n      while (a[i] < pivot) i++;\n      while (a[j] > pivot) j--;\n      if (i <= j) {\n        tmp = a[i];\n        a[i] = a[j];\n        a[j] = tmp;\n        i++;\n        j--;\n      }\n    }\n    if (lo < j) Utils.quicksortPartition(a, lo, j);\n    lo = i;\n    j = hi;\n  }\n};\n\n\nUtils.findRankByValue = function(arr, value) {\n  if (isNaN(value)) return arr.length;\n  var rank = 1;\n  for (var i=0, n=arr.length; i<n; i++) {\n    if (value > arr[i]) rank++;\n  }\n  return rank;\n}\n\nUtils.findValueByPct = function(arr, pct) {\n  var rank = Math.ceil((1-pct) * (arr.length));\n  return Utils.findValueByRank(arr, rank);\n};\n\n// See http://ndevilla.free.fr/median/median/src/wirth.c\n// Elements of @arr are reordered\n//\nUtils.findValueByRank = function(arr, rank) {\n  if (!arr.length || rank < 1 || rank > arr.length) error(\"[findValueByRank()] invalid input\");\n\n  rank = Utils.clamp(rank | 0, 1, arr.length);\n  var k = rank - 1, // conv. rank to array index\n      n = arr.length,\n      l = 0,\n      m = n - 1,\n      i, j, val, tmp;\n\n  while (l < m) {\n    val = arr[k];\n    i = l;\n    j = m;\n    do {\n      while (arr[i] < val) {i++;}\n      while (val < arr[j]) {j--;}\n      if (i <= j) {\n        tmp = arr[i];\n        arr[i] = arr[j];\n        arr[j] = tmp;\n        i++;\n        j--;\n      }\n    } while (i <= j);\n    if (j < k) l = i;\n    if (k < i) m = j;\n  }\n  return arr[k];\n};\n\n//\n//\nUtils.findMedian = function(arr) {\n  var n = arr.length,\n      rank = Math.floor(n / 2) + 1,\n      median = Utils.findValueByRank(arr, rank);\n  if ((n & 1) == 0) {\n    median = (median + Utils.findValueByRank(arr, rank - 1)) / 2;\n  }\n  return median;\n};\n\n\n// Wrapper for DataView class for more convenient reading and writing of\n//   binary data; Remembers endianness and read/write position.\n// Has convenience methods for copying from buffers, etc.\n//\nfunction BinArray(buf, le) {\n  if (Utils.isNumber(buf)) {\n    buf = new ArrayBuffer(buf);\n  } else if (Env.inNode && buf instanceof Buffer == true) {\n    // Since node 0.10, DataView constructor doesn't accept Buffers,\n    //   so need to copy Buffer to ArrayBuffer\n    buf = BinArray.toArrayBuffer(buf);\n  }\n  if (buf instanceof ArrayBuffer == false) {\n    error(\"BinArray constructor takes an integer, ArrayBuffer or Buffer argument\");\n  }\n  this._buffer = buf;\n  this._bytes = new Uint8Array(buf);\n  this._view = new DataView(buf);\n  this._idx = 0;\n  this._le = le !== false;\n}\n\nBinArray.bufferToUintArray = function(buf, wordLen) {\n  if (wordLen == 4) return new Uint32Array(buf);\n  if (wordLen == 2) return new Uint16Array(buf);\n  if (wordLen == 1) return new Uint8Array(buf);\n  error(\"BinArray.bufferToUintArray() invalid word length:\", wordLen)\n};\n\nBinArray.uintSize = function(i) {\n  return i & 1 || i & 2 || 4;\n};\n\nBinArray.bufferCopy = function(dest, destId, src, srcId, bytes) {\n  srcId = srcId || 0;\n  bytes = bytes || src.byteLength - srcId;\n  if (dest.byteLength - destId < bytes)\n    error(\"Buffer overflow; tried to write:\", bytes);\n\n  // When possible, copy buffer data in multi-byte chunks... Added this for faster copying of\n  // shapefile data, which is aligned to 32 bits.\n  var wordSize = Math.min(BinArray.uintSize(bytes), BinArray.uintSize(srcId),\n      BinArray.uintSize(dest.byteLength), BinArray.uintSize(destId),\n      BinArray.uintSize(src.byteLength));\n\n  var srcArr = BinArray.bufferToUintArray(src, wordSize),\n      destArr = BinArray.bufferToUintArray(dest, wordSize),\n      count = bytes / wordSize,\n      i = srcId / wordSize,\n      j = destId / wordSize;\n\n  while (count--) {\n    destArr[j++] = srcArr[i++];\n  }\n  return bytes;\n};\n\nBinArray.toArrayBuffer = function(src) {\n  var n = src.length,\n      dest = new ArrayBuffer(n),\n      view = new Uint8Array(dest);\n  for (var i=0; i<n; i++) {\n      view[i] = src[i];\n  }\n  return dest;\n};\n\n// Return length in bytes of an ArrayBuffer or Buffer\n//\nBinArray.bufferSize = function(buf) {\n  return (buf instanceof ArrayBuffer ?  buf.byteLength : buf.length | 0);\n};\n\nUtils.buffersAreIdentical = function(a, b) {\n  var alen = BinArray.bufferSize(a);\n  var blen = BinArray.bufferSize(b);\n  if (alen != blen) {\n    return false;\n  }\n  for (var i=0; i<alen; i++) {\n    if (a[i] !== b[i]) {\n      return false;\n    }\n  }\n  return true;\n};\n\nBinArray.prototype = {\n  size: function() {\n    return this._buffer.byteLength;\n  },\n\n  littleEndian: function() {\n    this._le = true;\n    return this;\n  },\n\n  bigEndian: function() {\n    this._le = false;\n    return this;\n  },\n\n  buffer: function() {\n    return this._buffer;\n  },\n\n  bytesLeft: function() {\n    return this._buffer.byteLength - this._idx;\n  },\n\n  skipBytes: function(bytes) {\n    this._idx += (bytes + 0);\n    return this;\n  },\n\n  readUint8: function() {\n    return this._bytes[this._idx++];\n  },\n\n  writeUint8: function(val) {\n    this._bytes[this._idx++] = val;\n    return this;\n  },\n\n  readInt8: function() {\n    return this._view.getInt8(this._idx++);\n  },\n\n  writeInt8: function(val) {\n    this._view.setInt8(this._idx++, val);\n    return this;\n  },\n\n  readUint16: function() {\n    var val = this._view.getUint16(this._idx, this._le);\n    this._idx += 2;\n    return val;\n  },\n\n  writeUint16: function(val) {\n    this._view.setUint16(this._idx, val, this._le);\n    this._idx += 2;\n    return this;\n  },\n\n  readUint32: function() {\n    var val = this._view.getUint32(this._idx, this._le);\n    this._idx += 4;\n    return val;\n  },\n\n  writeUint32: function(val) {\n    this._view.setUint32(this._idx, val, this._le);\n    this._idx += 4;\n    return this;\n  },\n\n  readInt32: function() {\n    var val = this._view.getInt32(this._idx, this._le);\n    this._idx += 4;\n    return val;\n  },\n\n  writeInt32: function(val) {\n    this._view.setInt32(this._idx, val, this._le);\n    this._idx += 4;\n    return this;\n  },\n\n  readFloat64: function() {\n    var val = this._view.getFloat64(this._idx, this._le);\n    this._idx += 8;\n    return val;\n  },\n\n  writeFloat64: function(val) {\n    this._view.setFloat64(this._idx, val, this._le);\n    this._idx += 8;\n    return this;\n  },\n\n  // Returns a Float64Array containing @len doubles\n  //\n  readFloat64Array: function(len) {\n    var bytes = len * 8,\n        i = this._idx,\n        buf = this._buffer,\n        arr;\n    // Inconsistent: first is a view, second a copy...\n    if (i % 8 === 0) {\n      arr = new Float64Array(buf, i, len);\n    } else if (buf.slice) {\n      arr = new Float64Array(buf.slice(i, i + bytes));\n    } else { // ie10, etc\n      var dest = new ArrayBuffer(bytes);\n      BinArray.bufferCopy(dest, 0, buf, i, bytes);\n      arr = new Float64Array(dest);\n    }\n    this._idx += bytes;\n    return arr;\n  },\n\n  readUint32Array: function(len) {\n    var arr = [];\n    for (var i=0; i<len; i++) {\n      arr.push(this.readUint32());\n    }\n    return arr;\n  },\n\n  peek: function(i) {\n    return this._view.getUint8(i >= 0 ? i : this._idx);\n  },\n\n  position: function(i) {\n    if (i != null) {\n      this._idx = i;\n      return this;\n    }\n    return this._idx;\n  },\n\n  readCString: function(fixedLen, asciiOnly) {\n    var str = \"\",\n        count = fixedLen >= 0 ? fixedLen : this.bytesLeft();\n    while (count > 0) {\n      var byteVal = this.readUint8();\n      count--;\n      if (byteVal == 0) {\n        break;\n      } else if (byteVal > 127 && asciiOnly) {\n        str = null;\n        break;\n      }\n      str += String.fromCharCode(byteVal);\n    }\n\n    if (fixedLen > 0 && count > 0) {\n      this.skipBytes(count);\n    }\n    return str;\n  },\n\n  writeString: function(str, maxLen) {\n    var bytesWritten = 0,\n        charsToWrite = str.length,\n        cval;\n    if (maxLen) {\n      charsToWrite = Math.min(charsToWrite, maxLen);\n    }\n    for (var i=0; i<charsToWrite; i++) {\n      cval = str.charCodeAt(i);\n      if (cval > 127) {\n        trace(\"#writeCString() Unicode value beyond ascii range\")\n        cval = '?'.charCodeAt(0);\n      }\n      this.writeUint8(cval);\n      bytesWritten++;\n    }\n    return bytesWritten;\n  },\n\n  writeCString: function(str, fixedLen) {\n    var maxChars = fixedLen ? fixedLen - 1 : null,\n        bytesWritten = this.writeString(str, maxChars);\n\n    this.writeUint8(0); // terminator\n    bytesWritten++;\n\n    if (fixedLen) {\n      while (bytesWritten < fixedLen) {\n        this.writeUint8(0);\n        bytesWritten++;\n      }\n    }\n    return this;\n  },\n\n  writeBuffer: function(buf, bytes, startIdx) {\n    this._idx += BinArray.bufferCopy(this._buffer, this._idx, buf, startIdx, bytes);\n    return this;\n  }\n};\n\n\n/*\nA simplified version of printf formatting\nFormat codes: %[flags][width][.precision]type\n\nsupported flags:\n  +   add '+' before positive numbers\n  0   left-pad with '0'\n  '   Add thousands separator\nwidth: 1 to many\nprecision: .(1 to many)\ntype:\n  s     string\n  di    integers\n  f     decimal numbers\n  xX    hexidecimal (unsigned)\n  %     literal '%'\n\nExamples:\n  code    val    formatted\n  %+d     1      '+1'\n  %4i     32     '  32'\n  %04i    32     '0032'\n  %x      255    'ff'\n  %.2f    0.125  '0.13'\n  %'f     1000   '1,000'\n*/\n\n// Usage: Utils.format(formatString, [values])\n// Tip: When reusing the same format many times, use Utils.formatter() for 5x - 10x better performance\n//\nUtils.format = function(fmt) {\n  var fn = Utils.formatter(fmt);\n  var str = fn.apply(null, Array.prototype.slice.call(arguments, 1));\n  return str;\n};\n\nfunction formatValue(val, matches) {\n  var flags = matches[1];\n  var padding = matches[2];\n  var decimals = matches[3] ? parseInt(matches[3].substr(1)) : void 0;\n  var type = matches[4];\n  var isString = type == 's',\n      isHex = type == 'x' || type == 'X',\n      isInt = type == 'd' || type == 'i',\n      isFloat = type == 'f',\n      isNumber = !isString;\n\n  var sign = \"\",\n      padDigits = 0,\n      isZero = false,\n      isNeg = false;\n\n  var str;\n  if (isString) {\n    str = String(val);\n  }\n  else if (isHex) {\n    str = val.toString(16);\n    if (type == 'X')\n      str = str.toUpperCase();\n  }\n  else if (isNumber) {\n    str = Utils.numToStr(val, isInt ? 0 : decimals);\n    if (str[0] == '-') {\n      isNeg = true;\n      str = str.substr(1);\n    }\n    isZero = parseFloat(str) == 0;\n    if (flags.indexOf(\"'\") != -1 || flags.indexOf(',') != -1) {\n      str = Utils.addThousandsSep(str);\n    }\n    if (!isZero) { // BUG: sign is added when num rounds to 0\n      if (isNeg) {\n        sign = \"\\u2212\"; // U+2212\n      } else if (flags.indexOf('+') != -1) {\n        sign = '+';\n      }\n    }\n  }\n\n  if (padding) {\n    var strLen = str.length + sign.length;\n    var minWidth = parseInt(padding, 10);\n    if (strLen < minWidth) {\n      padDigits = minWidth - strLen;\n      var padChar = flags.indexOf('0') == -1 ? ' ' : '0';\n      var padStr = Utils.repeatString(padChar, padDigits);\n    }\n  }\n\n  if (padDigits == 0) {\n    str = sign + str;\n  } else if (padChar == '0') {\n    str = sign + padStr + str;\n  } else {\n    str = padStr + sign + str;\n  }\n  return str;\n}\n\n// Get a function for interpolating formatted values into a string.\nUtils.formatter = function(fmt) {\n  var codeRxp = /%([\\',+0]*)([1-9]?)((?:\\.[1-9])?)([sdifxX%])/g;\n  var literals = [],\n      formatCodes = [],\n      startIdx = 0,\n      prefix = \"\",\n      literal,\n      matches;\n\n  while (matches=codeRxp.exec(fmt)) {\n    literal = fmt.substring(startIdx, codeRxp.lastIndex - matches[0].length);\n    if (matches[0] == '%%') {\n      prefix += literal + '%';\n    } else {\n      literals.push(prefix + literal);\n      prefix = '';\n      formatCodes.push(matches);\n    }\n    startIdx = codeRxp.lastIndex;\n  }\n  literals.push(prefix + fmt.substr(startIdx));\n\n  return function() {\n    var str = literals[0],\n        n = arguments.length;\n    if (n != formatCodes.length) {\n      error(\"[format()] Data does not match format string; format:\", fmt, \"data:\", arguments);\n    }\n    for (var i=0; i<n; i++) {\n      str += formatValue(arguments[i], formatCodes[i]) + literals[i+1];\n    }\n    return str;\n  };\n};\n\n\n\n\n\n\nutils.wildcardToRegExp = function(name) {\n  var rxp = name.split('*').map(function(str) {\n    return utils.regexEscape(str);\n  }).join('.*');\n  return new RegExp('^' + rxp + '$');\n};\n\nutils.expandoBuffer = function(constructor, rate) {\n  var capacity = 0,\n      k = rate >= 1 ? rate : 1.2,\n      buf;\n  return function(size) {\n    if (size > capacity) {\n      capacity = Math.ceil(size * k);\n      buf = new constructor(capacity);\n    }\n    return buf;\n  };\n};\n\nutils.copyElements = function(src, i, dest, j, n, rev) {\n  if (src === dest && j > i) error (\"copy error\");\n  var inc = 1,\n      offs = 0;\n  if (rev) {\n    inc = -1;\n    offs = n - 1;\n  }\n  for (var k=0; k<n; k++, offs += inc) {\n    dest[k + j] = src[i + offs];\n  }\n};\n\nutils.extendBuffer = function(src, newLen, copyLen) {\n  var len = Math.max(src.length, newLen);\n  var n = copyLen || src.length;\n  var dest = new src.constructor(len);\n  utils.copyElements(src, 0, dest, 0, n);\n  return dest;\n};\n\nutils.mergeNames = function(name1, name2) {\n  var merged = \"\";\n  if (name1 && name2) {\n    merged = utils.findStringPrefix(name1, name2).replace(/[-_]$/, '');\n  }\n  return merged;\n};\n\nutils.findStringPrefix = function(a, b) {\n  var i = 0;\n  for (var n=a.length; i<n; i++) {\n    if (a[i] !== b[i]) break;\n  }\n  return a.substr(0, i);\n};\n\n// Similar to isFinite() but does not convert strings or other types\nutils.isFiniteNumber = function(val) {\n  return val === 0 || !!val && val.constructor == Number && val !== Infinity && val !== -Infinity;\n};\n\n\n\n\nvar api = {};\nvar MapShaper = {\n  VERSION: VERSION, // export version\n  LOGGING: false,\n  TRACING: false,\n  VERBOSE: false\n};\n\nnew Float64Array(1); // workaround for https://github.com/nodejs/node/issues/6006\n\nfunction error() {\n  MapShaper.error.apply(null, utils.toArray(arguments));\n}\n\n// Handle an error caused by invalid input or misuse of API\nfunction stop() {\n  MapShaper.stop.apply(null, utils.toArray(arguments));\n}\n\nfunction APIError(msg) {\n  var err = new Error(msg);\n  err.name = 'APIError';\n  return err;\n}\n\nfunction message() {\n  MapShaper.message.apply(null, utils.toArray(arguments));\n}\n\nfunction verbose() {\n  if (MapShaper.VERBOSE && MapShaper.LOGGING) {\n    MapShaper.logArgs(arguments);\n  }\n}\n\nfunction trace() {\n  if (MapShaper.TRACING) {\n    MapShaper.logArgs(arguments);\n  }\n}\n\nfunction absArcId(arcId) {\n  return arcId >= 0 ? arcId : ~arcId;\n}\n\napi.enableLogging = function() {\n  MapShaper.LOGGING = true;\n  return api;\n};\n\napi.printError = function(err) {\n  var msg;\n  if (utils.isString(err)) {\n    err = new APIError(err);\n  }\n  if (MapShaper.LOGGING && err.name == 'APIError') {\n    msg = err.message;\n    if (!/Error/.test(msg)) {\n      msg = \"Error: \" + msg;\n    }\n    message(msg);\n    message(\"Run mapshaper -h to view help\");\n  } else {\n    throw err;\n  }\n};\n\nMapShaper.error = function() {\n  var msg = Utils.toArray(arguments).join(' ');\n  throw new Error(msg);\n};\n\nMapShaper.stop = function() {\n  throw new APIError(MapShaper.formatLogArgs(arguments));\n};\n\nMapShaper.message = function() {\n  if (MapShaper.LOGGING) {\n    MapShaper.logArgs(arguments);\n  }\n};\n\nMapShaper.formatLogArgs = function(args) {\n  return utils.toArray(args).join(' ');\n};\n\n// Format an array of (preferably short) strings in columns for console logging.\nMapShaper.formatStringsAsGrid = function(arr) {\n  // TODO: variable column width\n  var longest = arr.reduce(function(len, str) {\n        return Math.max(len, str.length);\n      }, 0),\n      colWidth = longest + 2,\n      perLine = Math.floor(80 / colWidth) || 1;\n  return arr.reduce(function(memo, name, i) {\n    var col = i % perLine;\n    if (i > 0 && col === 0) memo += '\\n';\n    if (col < perLine - 1) { // right-pad all but rightmost column\n      name = utils.rpad(name, colWidth - 2, ' ');\n    }\n    return memo +  '  ' + name;\n  }, '');\n};\n\nMapShaper.logArgs = function(args) {\n  if (utils.isArrayLike(args)) {\n    (console.error || console.log).call(console, MapShaper.formatLogArgs(args));\n  }\n};\n\nMapShaper.getWorldBounds = function(e) {\n  e = utils.isFiniteNumber(e) ? e : 1e-10;\n  return [-180 + e, -90 + e, 180 - e, 90 - e];\n};\n\nMapShaper.probablyDecimalDegreeBounds = function(b) {\n  var world = MapShaper.getWorldBounds(-1), // add a bit of excess\n      bbox = (b instanceof Bounds) ? b.toArray() : b;\n  return containsBounds(world, bbox);\n};\n\nMapShaper.layerHasGeometry = function(lyr) {\n  return MapShaper.layerHasPaths(lyr) || MapShaper.layerHasPoints(lyr);\n};\n\nMapShaper.layerHasPaths = function(lyr) {\n  return (lyr.geometry_type == 'polygon' || lyr.geometry_type == 'polyline') &&\n    MapShaper.layerHasNonNullShapes(lyr);\n};\n\nMapShaper.layerHasPoints = function(lyr) {\n  return lyr.geometry_type == 'point' && MapShaper.layerHasNonNullShapes(lyr);\n};\n\nMapShaper.layerHasNonNullShapes = function(lyr) {\n  return utils.some(lyr.shapes || [], function(shp) {\n    return !!shp;\n  });\n};\n\nMapShaper.requireDataFields = function(table, fields, cmd) {\n  var prefix = cmd ? '[' + cmd + '] ' : '';\n  if (!table) {\n    stop(prefix + \"Missing attribute data\");\n  }\n  var dataFields = table.getFields(),\n      missingFields = utils.difference(fields, dataFields);\n  if (missingFields.length > 0) {\n    stop(prefix + \"Table is missing one or more fields:\\n\",\n        missingFields, \"\\nExisting fields:\", '\\n' + MapShaper.formatStringsAsGrid(dataFields));\n  }\n};\n\nMapShaper.requirePolygonLayer = function(lyr, msg) {\n  if (!lyr || lyr.geometry_type !== 'polygon') stop(msg || \"Expected a polygon layer\");\n};\n\nMapShaper.requirePathLayer = function(lyr, msg) {\n  if (!lyr || !MapShaper.layerHasPaths(lyr)) stop(msg || \"Expected a polygon or polyline layer\");\n};\n\n\n\n\nvar R = 6378137;\nvar D2R = Math.PI / 180;\n\n// Equirectangular projection\nfunction degreesToMeters(deg) {\n  return deg * D2R * R;\n}\n\nfunction distance3D(ax, ay, az, bx, by, bz) {\n  var dx = ax - bx,\n    dy = ay - by,\n    dz = az - bz;\n  return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\nfunction distanceSq(ax, ay, bx, by) {\n  var dx = ax - bx,\n      dy = ay - by;\n  return dx * dx + dy * dy;\n}\n\nfunction distance2D(ax, ay, bx, by) {\n  var dx = ax - bx,\n      dy = ay - by;\n  return Math.sqrt(dx * dx + dy * dy);\n}\n\nfunction distanceSq3D(ax, ay, az, bx, by, bz) {\n  var dx = ax - bx,\n      dy = ay - by,\n      dz = az - bz;\n  return dx * dx + dy * dy + dz * dz;\n}\n\nfunction getRoundingFunction(inc) {\n  if (!utils.isNumber(inc) || inc === 0) {\n    error(\"Rounding increment must be a non-zero number.\");\n  }\n  var inv = 1 / inc;\n  if (inv > 1) inv = Math.round(inv);\n  return function(x) {\n    return Math.round(x * inv) / inv;\n    // these alternatives show rounding error after JSON.stringify()\n    // return Math.round(x / inc) / inv;\n    // return Math.round(x / inc) * inc;\n    // return Math.round(x * inv) * inc;\n  };\n}\n\n// Return id of nearest point to x, y, among x0, y0, x1, y1, ...\nfunction nearestPoint(x, y, x0, y0) {\n  var minIdx = -1,\n      minDist = Infinity,\n      dist;\n  for (var i = 0, j = 2, n = arguments.length; j < n; i++, j += 2) {\n    dist = distanceSq(x, y, arguments[j], arguments[j+1]);\n    if (dist < minDist) {\n      minDist = dist;\n      minIdx = i;\n    }\n  }\n  return minIdx;\n}\n\nfunction lineIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y) {\n  var den = determinant2D(s1p2x - s1p1x, s1p2y - s1p1y, s2p2x - s2p1x, s2p2y - s2p1y);\n  if (den === 0) return null;\n  var m = orient2D(s2p1x, s2p1y, s2p2x, s2p2y, s1p1x, s1p1y) / den;\n  var x = s1p1x + m * (s1p2x - s1p1x);\n  var y = s1p1y + m * (s1p2y - s1p1y);\n  return [x, y];\n}\n\n// Get intersection point if segments are non-collinear, else return null\n// Assumes that segments intersect\nfunction crossIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y) {\n  var p = lineIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y);\n  var nearest;\n  if (p) {\n    // Re-order operands so intersection point is closest to s1p1 (better precision)\n    // Source: Jonathan Shewchuk http://www.cs.berkeley.edu/~jrs/meshpapers/robnotes.pdf\n    nearest = nearestPoint(p[0], p[1], s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y);\n    if (nearest == 1) {\n      // use b a c d\n      p = lineIntersection(s1p2x, s1p2y, s1p1x, s1p1y, s2p1x, s2p1y, s2p2x, s2p2y);\n    } else if (nearest == 2) {\n      // use c d a b\n      p = lineIntersection(s2p1x, s2p1y, s2p2x, s2p2y, s1p1x, s1p1y, s1p2x, s1p2y);\n    } else if (nearest == 3) {\n      // use d c a b\n      p = lineIntersection(s2p2x, s2p2y, s2p1x, s2p1y, s1p1x, s1p1y, s1p2x, s1p2y);\n    }\n  }\n  return p;\n}\n\n// Source: Sedgewick, _Algorithms in C_\n// (Tried various other functions that failed owing to floating point errors)\nfunction segmentHit(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y) {\n  return orient2D(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y) *\n      orient2D(s1p1x, s1p1y, s1p2x, s1p2y, s2p2x, s2p2y) <= 0 &&\n      orient2D(s2p1x, s2p1y, s2p2x, s2p2y, s1p1x, s1p1y) *\n      orient2D(s2p1x, s2p1y, s2p2x, s2p2y, s1p2x, s1p2y) <= 0;\n}\n\nfunction inside(x, minX, maxX) {\n  return x > minX && x < maxX;\n}\n\nfunction sortSeg(x1, y1, x2, y2) {\n  return x1 < x2 || x1 == x2 && y1 < y2 ? [x1, y1, x2, y2] : [x2, y2, x1, y1];\n}\n\n// Assume segments s1 and s2 are collinear and overlap; find one or two internal endpoints points\n// TODO: refactor\nfunction collinearIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y) {\n  var minX = Math.min(s1p1x, s1p2x, s2p1x, s2p2x),\n      maxX = Math.max(s1p1x, s1p2x, s2p1x, s2p2x),\n      minY = Math.min(s1p1y, s1p2y, s2p1y, s2p2y),\n      maxY = Math.max(s1p1y, s1p2y, s2p1y, s2p2y),\n      useY = maxY - minY > maxX - minX,\n      coords = [];\n\n  if (useY ? inside(s1p1y, minY, maxY) : inside(s1p1x, minX, maxX)) {\n    coords.push(s1p1x, s1p1y);\n  }\n  if (useY ? inside(s1p2y, minY, maxY) : inside(s1p2x, minX, maxX)) {\n    coords.push(s1p2x, s1p2y);\n  }\n  if (useY ? inside(s2p1y, minY, maxY) : inside(s2p1x, minX, maxX)) {\n    coords.push(s2p1x, s2p1y);\n  }\n  if (useY ? inside(s2p2y, minY, maxY) : inside(s2p2x, minX, maxX)) {\n    coords.push(s2p2x, s2p2y);\n  }\n  if (coords.length != 2 && coords.length != 4) {\n    // e.g. congruent segments\n    trace(\"Invalid collinear segment intersection\", coords);\n    coords = null;\n  } else if (coords.length == 4 && coords[0] == coords[2] && coords[1] == coords[3]) {\n    // segs that meet in the middle don't count\n    coords = null;\n  }\n  return coords;\n}\n\nfunction endpointHit(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y) {\n  return s1p1x == s2p1x && s1p1y == s2p1y || s1p1x == s2p2x && s1p1y == s2p2y ||\n          s1p2x == s2p1x && s1p2y == s2p1y || s1p2x == s2p2x && s1p2y == s2p2y;\n}\n\n// Find intersections between two 2D segments.\n// Return [x, y] point if segments intersect at a single point or are overlapping+collinear\n//   and one endpoint is inside overlapping portion\n// Return [x1, y1, x2, y2] if segments are overlapping+collinear and have two endpoints inside overlapping portion\n// Return null if segments do not touch\nfunction segmentIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y) {\n  var hit = segmentHit(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y),\n      p = null;\n  if (hit) {\n    p = crossIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y);\n    if (!p) { // colinear if p is null\n      p = collinearIntersection(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y);\n    } else if (endpointHit(s1p1x, s1p1y, s1p2x, s1p2y, s2p1x, s2p1y, s2p2x, s2p2y)) {\n      p = null; // filter out segments that only intersect at an endpoint\n    }\n  }\n  return p;\n}\n\n// Determinant of matrix\n//  | a  b |\n//  | c  d |\nfunction determinant2D(a, b, c, d) {\n  return a * d - b * c;\n}\n\n// Source: Jonathan Shewchuk http://www.cs.berkeley.edu/~jrs/meshpapers/robnotes.pdf\nfunction orient2D(x0, y0, x1, y1, x2, y2) {\n  return determinant2D(x0 - x2, y0 - y2, x1 - x2, y1 - y2);\n}\n\n// atan2() makes this function fairly slow, replaced by ~2x faster formula\nfunction innerAngle2(ax, ay, bx, by, cx, cy) {\n  var a1 = Math.atan2(ay - by, ax - bx),\n      a2 = Math.atan2(cy - by, cx - bx),\n      a3 = Math.abs(a1 - a2);\n  if (a3 > Math.PI) {\n    a3 = 2 * Math.PI - a3;\n  }\n  return a3;\n}\n\n// Return angle abc in range [0, 2PI) or NaN if angle is invalid\n// (e.g. if length of ab or bc is 0)\n/*\nfunction signedAngle2(ax, ay, bx, by, cx, cy) {\n  var a1 = Math.atan2(ay - by, ax - bx),\n      a2 = Math.atan2(cy - by, cx - bx),\n      a3 = a2 - a1;\n\n  if (ax == bx && ay == by || bx == cx && by == cy) {\n    a3 = NaN; // Use NaN for invalid angles\n  } else if (a3 >= Math.PI * 2) {\n    a3 = 2 * Math.PI - a3;\n  } else if (a3 < 0) {\n    a3 = a3 + 2 * Math.PI;\n  }\n  return a3;\n}\n*/\n\nfunction standardAngle(a) {\n  var twoPI = Math.PI * 2;\n  while (a < 0) {\n    a += twoPI;\n  }\n  while (a >= twoPI) {\n    a -= twoPI;\n  }\n  return a;\n}\n\nfunction signedAngle(ax, ay, bx, by, cx, cy) {\n  if (ax == bx && ay == by || bx == cx && by == cy) {\n    return NaN; // Use NaN for invalid angles\n  }\n  var abx = ax - bx,\n      aby = ay - by,\n      cbx = cx - bx,\n      cby = cy - by,\n      dotp = abx * cbx + aby * cby,\n      crossp = abx * cby - aby * cbx,\n      a = Math.atan2(crossp, dotp);\n  return standardAngle(a);\n}\n\n// Calc bearing in radians at lng1, lat1\nfunction bearing(lng1, lat1, lng2, lat2) {\n  var D2R = Math.PI / 180;\n  lng1 *= D2R;\n  lng2 *= D2R;\n  lat1 *= D2R;\n  lat2 *= D2R;\n  var y = Math.sin(lng2-lng1) * Math.cos(lat2),\n      x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(lng2-lng1);\n  return Math.atan2(y, x);\n}\n\n// Calc angle of turn from ab to bc, in range [0, 2PI)\n// Receive lat-lng values in degrees\nfunction signedAngleSph(alng, alat, blng, blat, clng, clat) {\n  if (alng == blng && alat == blat || blng == clng && blat == clat) {\n    return NaN;\n  }\n  var b1 = bearing(blng, blat, alng, alat), // calc bearing at b\n      b2 = bearing(blng, blat, clng, clat),\n      a = Math.PI * 2 + b1 - b2;\n  return standardAngle(a);\n}\n\n/*\n// Convert arrays of lng and lat coords (xsrc, ysrc) into\n// x, y, z coords (meters) on the most common spherical Earth model.\n//\nfunction convLngLatToSph(xsrc, ysrc, xbuf, ybuf, zbuf) {\n  var deg2rad = Math.PI / 180,\n      r = R;\n  for (var i=0, len=xsrc.length; i<len; i++) {\n    var lng = xsrc[i] * deg2rad,\n        lat = ysrc[i] * deg2rad,\n        cosLat = Math.cos(lat);\n    xbuf[i] = Math.cos(lng) * cosLat * r;\n    ybuf[i] = Math.sin(lng) * cosLat * r;\n    zbuf[i] = Math.sin(lat) * r;\n  }\n}\n*/\n\n// Convert arrays of lng and lat coords (xsrc, ysrc) into\n// x, y, z coords (meters) on the most common spherical Earth model.\n//\nfunction convLngLatToSph(xsrc, ysrc, xbuf, ybuf, zbuf) {\n  var p = [];\n  for (var i=0, len=xsrc.length; i<len; i++) {\n    lngLatToXYZ(xsrc[i], ysrc[i], p);\n    xbuf[i] = p[0];\n    ybuf[i] = p[1];\n    zbuf[i] = p[2];\n  }\n}\n\nfunction xyzToLngLat(x, y, z, p) {\n  var d = distance3D(0, 0, 0, x, y, z); // normalize\n  var lat = Math.asin(z / d) / D2R;\n  var lng = Math.atan2(y / d, x / d) / D2R;\n  p[0] = lng;\n  p[1] = lat;\n}\n\nfunction lngLatToXYZ(lng, lat, p) {\n  var cosLat;\n  lng *= D2R;\n  lat *= D2R;\n  cosLat = Math.cos(lat);\n  p[0] = Math.cos(lng) * cosLat * R;\n  p[1] = Math.sin(lng) * cosLat * R;\n  p[2] = Math.sin(lat) * R;\n}\n\n// Haversine formula (well conditioned at small distances)\nfunction sphericalDistance(lam1, phi1, lam2, phi2) {\n  var dlam = lam2 - lam1,\n      dphi = phi2 - phi1,\n      a = Math.sin(dphi / 2) * Math.sin(dphi / 2) +\n          Math.cos(phi1) * Math.cos(phi2) *\n          Math.sin(dlam / 2) * Math.sin(dlam / 2),\n      c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n  return c;\n}\n\n// Receive: coords in decimal degrees;\n// Return: distance in meters on spherical earth\nfunction greatCircleDistance(lng1, lat1, lng2, lat2) {\n  var D2R = Math.PI / 180,\n      dist = sphericalDistance(lng1 * D2R, lat1 * D2R, lng2 * D2R, lat2 * D2R);\n  return dist * R;\n}\n\n// TODO: make this safe for small angles\nfunction innerAngle(ax, ay, bx, by, cx, cy) {\n  var ab = distance2D(ax, ay, bx, by),\n      bc = distance2D(bx, by, cx, cy),\n      theta, dotp;\n  if (ab === 0 || bc === 0) {\n    theta = 0;\n  } else {\n    dotp = ((ax - bx) * (cx - bx) + (ay - by) * (cy - by)) / (ab * bc);\n    if (dotp >= 1 - 1e-14) {\n      theta = 0;\n    } else if (dotp <= -1 + 1e-14) {\n      theta = Math.PI;\n    } else {\n      theta = Math.acos(dotp); // consider using other formula at small dp\n    }\n  }\n  return theta;\n}\n\nfunction innerAngle3D(ax, ay, az, bx, by, bz, cx, cy, cz) {\n  var ab = distance3D(ax, ay, az, bx, by, bz),\n      bc = distance3D(bx, by, bz, cx, cy, cz),\n      theta, dotp;\n  if (ab === 0 || bc === 0) {\n    theta = 0;\n  } else {\n    dotp = ((ax - bx) * (cx - bx) + (ay - by) * (cy - by) + (az - bz) * (cz - bz)) / (ab * bc);\n    if (dotp >= 1) {\n      theta = 0;\n    } else if (dotp <= -1) {\n      theta = Math.PI;\n    } else {\n      theta = Math.acos(dotp); // consider using other formula at small dp\n    }\n  }\n  return theta;\n}\n\nfunction triangleArea(ax, ay, bx, by, cx, cy) {\n  var area = Math.abs(((ay - cy) * (bx - cx) + (by - cy) * (cx - ax)) / 2);\n  return area;\n}\n\nfunction detSq(ax, ay, bx, by, cx, cy) {\n  var det = ax * by - ax * cy + bx * cy - bx * ay + cx * ay - cx * by;\n  return det * det;\n}\n\nfunction cosine(ax, ay, bx, by, cx, cy) {\n  var den = distance2D(ax, ay, bx, by) * distance2D(bx, by, cx, cy),\n      cos = 0;\n  if (den > 0) {\n    cos = ((ax - bx) * (cx - bx) + (ay - by) * (cy - by)) / den;\n    if (cos > 1) cos = 1; // handle fp rounding error\n    else if (cos < -1) cos = -1;\n  }\n  return cos;\n}\n\nfunction cosine3D(ax, ay, az, bx, by, bz, cx, cy, cz) {\n  var den = distance3D(ax, ay, az, bx, by, bz) * distance3D(bx, by, bz, cx, cy, cz),\n      cos = 0;\n  if (den > 0) {\n    cos = ((ax - bx) * (cx - bx) + (ay - by) * (cy - by) + (az - bz) * (cz - bz)) / den;\n    if (cos > 1) cos = 1; // handle fp rounding error\n    else if (cos < -1) cos = -1;\n  }\n  return cos;\n}\n\nfunction triangleArea3D(ax, ay, az, bx, by, bz, cx, cy, cz) {\n  var area = 0.5 * Math.sqrt(detSq(ax, ay, bx, by, cx, cy) +\n    detSq(ax, az, bx, bz, cx, cz) + detSq(ay, az, by, bz, cy, cz));\n  return area;\n}\n\n// Given point B and segment AC, return the squared distance from B to the\n// nearest point on AC\n// Receive the squared length of segments AB, BC, AC\n//\nfunction apexDistSq(ab2, bc2, ac2) {\n  var dist2;\n  if (ac2 === 0) {\n    dist2 = ab2;\n  } else if (ab2 >= bc2 + ac2) {\n    dist2 = bc2;\n  } else if (bc2 >= ab2 + ac2) {\n    dist2 = ab2;\n  } else {\n    var dval = (ab2 + ac2 - bc2);\n    dist2 = ab2 -  dval * dval / ac2  * 0.25;\n  }\n  if (dist2 < 0) {\n    dist2 = 0;\n  }\n  return dist2;\n}\n\nfunction pointSegDistSq(ax, ay, bx, by, cx, cy) {\n  var ab2 = distanceSq(ax, ay, bx, by),\n      ac2 = distanceSq(ax, ay, cx, cy),\n      bc2 = distanceSq(bx, by, cx, cy);\n  return apexDistSq(ab2, ac2, bc2);\n}\n\nfunction pointSegDistSq3D(ax, ay, az, bx, by, bz, cx, cy, cz) {\n  var ab2 = distanceSq3D(ax, ay, az, bx, by, bz),\n      ac2 = distanceSq3D(ax, ay, az, cx, cy, cz),\n      bc2 = distanceSq3D(bx, by, bz, cx, cy, cz);\n  return apexDistSq(ab2, ac2, bc2);\n}\n\nMapShaper.calcArcBounds = function(xx, yy, start, len) {\n  var i = start | 0,\n      n = isNaN(len) ? xx.length - i : len + i,\n      x, y, xmin, ymin, xmax, ymax;\n  if (n > 0) {\n    xmin = xmax = xx[i];\n    ymin = ymax = yy[i];\n  }\n  for (i++; i<n; i++) {\n    x = xx[i];\n    y = yy[i];\n    if (x < xmin) xmin = x;\n    if (x > xmax) xmax = x;\n    if (y < ymin) ymin = y;\n    if (y > ymax) ymax = y;\n  }\n  return [xmin, ymin, xmax, ymax];\n};\n\nMapShaper.reversePathCoords = function(arr, start, len) {\n  var i = start,\n      j = start + len - 1,\n      tmp;\n  while (i < j) {\n    tmp = arr[i];\n    arr[i] = arr[j];\n    arr[j] = tmp;\n    i++;\n    j--;\n  }\n};\n\n// merge B into A\nfunction mergeBounds(a, b) {\n  if (b[0] < a[0]) a[0] = b[0];\n  if (b[1] < a[1]) a[1] = b[1];\n  if (b[2] > a[2]) a[2] = b[2];\n  if (b[3] > a[3]) a[3] = b[3];\n}\n\nfunction containsBounds(a, b) {\n  return a[0] <= b[0] && a[2] >= b[2] && a[1] <= b[1] && a[3] >= b[3];\n}\n\nfunction boundsArea(b) {\n  return (b[2] - b[0]) * (b[3] - b[1]);\n}\n\n// export functions so they can be tested\nvar geom = {\n  R: R,\n  D2R: D2R,\n  degreesToMeters: degreesToMeters,\n  getRoundingFunction: getRoundingFunction,\n  segmentHit: segmentHit,\n  segmentIntersection: segmentIntersection,\n  distanceSq: distanceSq,\n  distance3D: distance3D,\n  innerAngle: innerAngle,\n  innerAngle2: innerAngle2,\n  signedAngle: signedAngle,\n  bearing: bearing,\n  signedAngleSph: signedAngleSph,\n  standardAngle: standardAngle,\n  convLngLatToSph: convLngLatToSph,\n  lngLatToXYZ: lngLatToXYZ,\n  xyzToLngLat: xyzToLngLat,\n  sphericalDistance: sphericalDistance,\n  greatCircleDistance: greatCircleDistance,\n  pointSegDistSq: pointSegDistSq,\n  pointSegDistSq3D: pointSegDistSq3D,\n  innerAngle3D: innerAngle3D,\n  triangleArea: triangleArea,\n  triangleArea3D: triangleArea3D,\n  cosine: cosine,\n  cosine3D: cosine3D\n};\n\n\n\n// Constructor takes arrays of coords: xx, yy, zz (optional)\n//\n// Iterate over the points of an arc\n// properties: x, y\n// method: hasNext()\n// usage:\n//   while (iter.hasNext()) {\n//     iter.x, iter.y; // do something w/ x & y\n//   }\n//\nfunction ArcIter(xx, yy) {\n  this._i = 0;\n  this._n = 0;\n  this._inc = 1;\n  this._xx = xx;\n  this._yy = yy;\n  this.i = 0;\n  this.x = 0;\n  this.y = 0;\n}\n\nArcIter.prototype.init = function(i, len, fw) {\n  if (fw) {\n    this._i = i;\n    this._inc = 1;\n  } else {\n    this._i = i + len - 1;\n    this._inc = -1;\n  }\n  this._n = len;\n  return this;\n};\n\nArcIter.prototype.hasNext = function() {\n  var i = this._i;\n  if (this._n > 0) {\n    this._i = i + this._inc;\n    this.x = this._xx[i];\n    this.y = this._yy[i];\n    this.i = i;\n    this._n--;\n    return true;\n  }\n  return false;\n};\n\nfunction FilteredArcIter(xx, yy, zz) {\n  var _zlim = 0,\n      _i = 0,\n      _inc = 1,\n      _stop = 0;\n\n  this.init = function(i, len, fw, zlim) {\n    _zlim = zlim || 0;\n    if (fw) {\n      _i = i;\n      _inc = 1;\n      _stop = i + len;\n    } else {\n      _i = i + len - 1;\n      _inc = -1;\n      _stop = i - 1;\n    }\n    return this;\n  };\n\n  this.hasNext = function() {\n    // using local vars is significantly faster when skipping many points\n    var zarr = zz,\n        i = _i,\n        j = i,\n        zlim = _zlim,\n        stop = _stop,\n        inc = _inc;\n    if (i == stop) return false;\n    do {\n      j += inc;\n    } while (j != stop && zarr[j] < zlim);\n    _i = j;\n    this.x = xx[i];\n    this.y = yy[i];\n    this.i = i;\n    return true;\n  };\n}\n\n// Iterate along a path made up of one or more arcs.\n// Similar interface to ArcIter()\n//\nfunction ShapeIter(arcs) {\n  this._arcs = arcs;\n  this._i = 0;\n  this._n = 0;\n  this.x = 0;\n  this.y = 0;\n}\n\nShapeIter.prototype.hasNext = function() {\n  var arc = this._arc;\n  if (this._i < this._n === false) {\n    return false;\n  }\n  if (arc.hasNext()) {\n    this.x = arc.x;\n    this.y = arc.y;\n    return true;\n  }\n  this.nextArc();\n  return this.hasNext();\n};\n\nShapeIter.prototype.init = function(ids) {\n  this._ids = ids;\n  this._n = ids.length;\n  this.reset();\n  return this;\n};\n\nShapeIter.prototype.nextArc = function() {\n  var i = this._i + 1;\n  if (i < this._n) {\n    this._arc = this._arcs.getArcIter(this._ids[i]);\n    if (i > 0) this._arc.hasNext(); // skip first point\n  }\n  this._i = i;\n};\n\nShapeIter.prototype.reset = function() {\n  this._i = -1;\n  this.nextArc();\n};\n\n\n\n\n// An interface for managing a collection of paths.\n// Constructor signatures:\n//\n// ArcCollection(arcs)\n//    arcs is an array of polyline arcs; each arc is an array of points: [[x0, y0], [x1, y1], ... ]\n//\n// ArcCollection(nn, xx, yy)\n//    nn is an array of arc lengths; xx, yy are arrays of concatenated coords;\nfunction ArcCollection() {\n  var _xx, _yy,  // coordinates data\n      _ii, _nn,  // indexes, sizes\n      _zz, _zlimit = 0, // simplification\n      _bb, _allBounds, // bounding boxes\n      _arcIter, _filteredArcIter; // path iterators\n\n  if (arguments.length == 1) {\n    initLegacyArcs(arguments[0]);  // want to phase this out\n  } else if (arguments.length == 3) {\n    initXYData.apply(this, arguments);\n  } else {\n    error(\"ArcCollection() Invalid arguments\");\n  }\n\n  function initLegacyArcs(arcs) {\n    var xx = [], yy = [];\n    var nn = arcs.map(function(points) {\n      var n = points ? points.length : 0;\n      for (var i=0; i<n; i++) {\n        xx.push(points[i][0]);\n        yy.push(points[i][1]);\n      }\n      return n;\n    });\n    initXYData(nn, xx, yy);\n  }\n\n  function initXYData(nn, xx, yy) {\n    var size = nn.length;\n    if (nn instanceof Array) nn = new Uint32Array(nn);\n    if (xx instanceof Array) xx = new Float64Array(xx);\n    if (yy instanceof Array) yy = new Float64Array(yy);\n    _xx = xx;\n    _yy = yy;\n    _nn = nn;\n    _zz = null;\n    _filteredArcIter = null;\n\n    // generate array of starting idxs of each arc\n    _ii = new Uint32Array(size);\n    for (var idx = 0, j=0; j<size; j++) {\n      _ii[j] = idx;\n      idx += nn[j];\n    }\n\n    if (idx != _xx.length || _xx.length != _yy.length) {\n      error(\"ArcCollection#initXYData() Counting error\");\n    }\n\n    initBounds();\n    // Pre-allocate some path iterators for repeated use.\n    _arcIter = new ArcIter(_xx, _yy);\n    return this;\n  }\n\n  function initZData(zz) {\n    if (!zz) {\n      _zz = null;\n      _filteredArcIter = null;\n    } else {\n      if (zz.length != _xx.length) error(\"ArcCollection#initZData() mismatched arrays\");\n      if (zz instanceof Array) zz = new Float64Array(zz);\n      _zz = zz;\n      _filteredArcIter = new FilteredArcIter(_xx, _yy, _zz);\n    }\n  }\n\n  function initBounds() {\n    var data = calcArcBounds(_xx, _yy, _nn);\n    _bb = data.bb;\n    _allBounds = data.bounds;\n  }\n\n  function calcArcBounds(xx, yy, nn) {\n    var numArcs = nn.length,\n        bb = new Float64Array(numArcs * 4),\n        bounds = new Bounds(),\n        arcOffs = 0,\n        arcLen,\n        j, b;\n    for (var i=0; i<numArcs; i++) {\n      arcLen = nn[i];\n      if (arcLen > 0) {\n        j = i * 4;\n        b = MapShaper.calcArcBounds(xx, yy, arcOffs, arcLen);\n        bb[j++] = b[0];\n        bb[j++] = b[1];\n        bb[j++] = b[2];\n        bb[j] = b[3];\n        arcOffs += arcLen;\n        bounds.mergeBounds(b);\n      }\n    }\n    return {\n      bb: bb,\n      bounds: bounds\n    };\n  }\n\n  this.updateVertexData = function(nn, xx, yy, zz) {\n    initXYData(nn, xx, yy);\n    initZData(zz || null);\n  };\n\n  // Give access to raw data arrays...\n  this.getVertexData = function() {\n    return {\n      xx: _xx,\n      yy: _yy,\n      zz: _zz,\n      bb: _bb,\n      nn: _nn,\n      ii: _ii\n    };\n  };\n\n  this.getCopy = function() {\n    var copy = new ArcCollection(new Int32Array(_nn), new Float64Array(_xx),\n        new Float64Array(_yy));\n    if (_zz) copy.setThresholds(new Float64Array(_zz));\n    return copy;\n  };\n\n  function getFilteredPointCount() {\n    var zz = _zz, z = _zlimit;\n    if (!zz || !z) return this.getPointCount();\n    var count = 0;\n    for (var i=0, n = zz.length; i<n; i++) {\n      if (zz[i] >= z) count++;\n    }\n    return count;\n  }\n\n  function getFilteredVertexData() {\n    var len2 = getFilteredPointCount();\n    var arcCount = _nn.length;\n    var xx2 = new Float64Array(len2),\n        yy2 = new Float64Array(len2),\n        zz2 = new Float64Array(len2),\n        nn2 = new Int32Array(arcCount),\n        i=0, i2 = 0,\n        n, n2;\n\n    for (var arcId=0; arcId < arcCount; arcId++) {\n      n2 = 0;\n      n = _nn[arcId];\n      for (var end = i+n; i < end; i++) {\n        if (_zz[i] >= _zlimit) {\n          xx2[i2] = _xx[i];\n          yy2[i2] = _yy[i];\n          zz2[i2] = _zz[i];\n          i2++;\n          n2++;\n        }\n      }\n      if (n2 < 2) error(\"Collapsed arc\"); // endpoints should be z == Infinity\n      nn2[arcId] = n2;\n    }\n    return {\n      xx: xx2,\n      yy: yy2,\n      zz: zz2,\n      nn: nn2\n    };\n  }\n\n  this.getFilteredCopy = function() {\n    if (!_zz || _zlimit === 0) return this.getCopy();\n    var data = getFilteredVertexData();\n    var copy = new ArcCollection(data.nn, data.xx, data.yy);\n    copy.setThresholds(data.zz);\n    return copy;\n  };\n\n  // Return arcs as arrays of [x, y] points (intended for testing).\n  this.toArray = function() {\n    var arr = [];\n    this.forEach(function(iter) {\n      var arc = [];\n      while (iter.hasNext()) {\n        arc.push([iter.x, iter.y]);\n      }\n      arr.push(arc);\n    });\n    return arr;\n  };\n\n  this.toString = function() {\n    return JSON.stringify(this.toArray());\n  };\n\n  // @cb function(i, j, xx, yy)\n  this.forEachArcSegment = function(arcId, cb) {\n    var fw = arcId >= 0,\n        absId = fw ? arcId : ~arcId,\n        zlim = this.getRetainedInterval(),\n        n = _nn[absId],\n        step = fw ? 1 : -1,\n        v1 = fw ? _ii[absId] : _ii[absId] + n - 1,\n        v2 = v1,\n        count = 0;\n\n    for (var j = 1; j < n; j++) {\n      v2 += step;\n      if (zlim === 0 || _zz[v2] >= zlim) {\n        cb(v1, v2, _xx, _yy);\n        v1 = v2;\n        count++;\n      }\n    }\n    return count;\n  };\n\n  // @cb function(i, j, xx, yy)\n  this.forEachSegment = function(cb) {\n    var count = 0;\n    for (var i=0, n=this.size(); i<n; i++) {\n      count += this.forEachArcSegment(i, cb);\n    }\n    return count;\n  };\n\n  this.transformPoints = function(f) {\n    var xx = _xx, yy = _yy, p;\n    for (var i=0, n=xx.length; i<n; i++) {\n      p = f(xx[i], yy[i]);\n      xx[i] = p[0];\n      yy[i] = p[1];\n    }\n    initBounds();\n  };\n\n  // Return an ArcIter object for each path in the dataset\n  //\n  this.forEach = function(cb) {\n    for (var i=0, n=this.size(); i<n; i++) {\n      cb(this.getArcIter(i), i);\n    }\n  };\n\n  // Iterate over arcs with access to low-level data\n  //\n  this.forEach2 = function(cb) {\n    for (var arcId=0, n=this.size(); arcId<n; arcId++) {\n      cb(_ii[arcId], _nn[arcId], _xx, _yy, _zz, arcId);\n    }\n  };\n\n  this.forEach3 = function(cb) {\n    var start, end, xx, yy, zz;\n    for (var arcId=0, n=this.size(); arcId<n; arcId++) {\n      start = _ii[arcId];\n      end = start + _nn[arcId];\n      xx = _xx.subarray(start, end);\n      yy = _yy.subarray(start, end);\n      if (_zz) zz = _zz.subarray(start, end);\n      cb(xx, yy, zz, arcId);\n    }\n  };\n\n  // Remove arcs that don't pass a filter test and re-index arcs\n  // Return array mapping original arc ids to re-indexed ids. If arr[n] == -1\n  // then arc n was removed. arr[n] == m indicates that the arc at n was\n  // moved to index m.\n  // Return null if no arcs were re-indexed (and no arcs were removed)\n  //\n  this.filter = function(cb) {\n    var map = new Int32Array(this.size()),\n        goodArcs = 0,\n        goodPoints = 0;\n    for (var i=0, n=this.size(); i<n; i++) {\n      if (cb(this.getArcIter(i), i)) {\n        map[i] = goodArcs++;\n        goodPoints += _nn[i];\n      } else {\n        map[i] = -1;\n      }\n    }\n    if (goodArcs === this.size()) {\n      return null;\n    } else {\n      condenseArcs(map);\n      if (goodArcs === 0) {\n        // no remaining arcs\n      }\n      return map;\n    }\n  };\n\n  function condenseArcs(map) {\n    var goodPoints = 0,\n        goodArcs = 0,\n        copyElements = utils.copyElements,\n        k, arcLen;\n    for (var i=0, n=map.length; i<n; i++) {\n      k = map[i];\n      arcLen = _nn[i];\n      if (k > -1) {\n        copyElements(_xx, _ii[i], _xx, goodPoints, arcLen);\n        copyElements(_yy, _ii[i], _yy, goodPoints, arcLen);\n        if (_zz) copyElements(_zz, _ii[i], _zz, goodPoints, arcLen);\n        _nn[k] = arcLen;\n        goodPoints += arcLen;\n        goodArcs++;\n      }\n    }\n\n    initXYData(_nn.subarray(0, goodArcs), _xx.subarray(0, goodPoints),\n        _yy.subarray(0, goodPoints));\n    if (_zz) initZData(_zz.subarray(0, goodPoints));\n  }\n\n  this.dedupCoords = function() {\n    var arcId = 0, i = 0, i2 = 0,\n        arcCount = this.size(),\n        zz = _zz,\n        arcLen, arcLen2;\n    while (arcId < arcCount) {\n      arcLen = _nn[arcId];\n      arcLen2 = MapShaper.dedupArcCoords(i, i2, arcLen, _xx, _yy, zz);\n      _nn[arcId] = arcLen2;\n      i += arcLen;\n      i2 += arcLen2;\n      arcId++;\n    }\n    if (i > i2) {\n      initXYData(_nn, _xx.subarray(0, i2), _yy.subarray(0, i2));\n      if (zz) initZData(zz.subarray(0, i2));\n    }\n    return i - i2;\n  };\n\n  this.getVertex = function(arcId, nth) {\n    var i = this.indexOfVertex(arcId, nth);\n    return {\n      x: _xx[i],\n      y: _yy[i]\n    };\n  };\n\n  this.indexOfVertex = function(arcId, nth) {\n    var absId = arcId < 0 ? ~arcId : arcId,\n        len = _nn[absId];\n    if (nth < 0) nth = len + nth;\n    if (absId != arcId) nth = len - nth - 1;\n    if (nth < 0 || nth >= len) error(\"[ArcCollection] out-of-range vertex id\");\n    return _ii[absId] + nth;\n  };\n\n  // Test whether the vertex at index @idx is the endpoint of an arc\n  this.pointIsEndpoint = function(idx) {\n    var ii = _ii,\n        nn = _nn;\n    for (var j=0, n=ii.length; j<n; j++) {\n      if (idx === ii[j] || idx === ii[j] + nn[j] - 1) return true;\n    }\n    return false;\n  };\n\n  // Tests if arc endpoints have same x, y coords\n  // (arc may still have collapsed);\n  this.arcIsClosed = function(arcId) {\n    var i = this.indexOfVertex(arcId, 0),\n        j = this.indexOfVertex(arcId, -1);\n    return i != j && _xx[i] == _xx[j] && _yy[i] == _yy[j];\n  };\n\n  // Tests if first and last segments mirror each other\n  // A 3-vertex arc with same endpoints tests true\n  this.arcIsLollipop = function(arcId) {\n    var len = this.getArcLength(arcId),\n        i, j;\n    if (len <= 2 || !this.arcIsClosed(arcId)) return false;\n    i = this.indexOfVertex(arcId, 1);\n    j = this.indexOfVertex(arcId, -2);\n    return _xx[i] == _xx[j] && _yy[i] == _yy[j];\n  };\n\n  this.arcIsDegenerate = function(arcId) {\n    var iter = this.getArcIter(arcId);\n    var i = 0,\n        x, y;\n    while (iter.hasNext()) {\n      if (i > 0) {\n        if (x != iter.x || y != iter.y) return false;\n      }\n      x = iter.x;\n      y = iter.y;\n      i++;\n    }\n    return true;\n  };\n\n  this.getArcLength = function(arcId) {\n    return _nn[absArcId(arcId)];\n  };\n\n  this.getArcIter = function(arcId) {\n    var fw = arcId >= 0,\n        i = fw ? arcId : ~arcId,\n        iter = _zz && _zlimit ? _filteredArcIter : _arcIter;\n    if (i >= _nn.length) {\n      error(\"#getArcId() out-of-range arc id:\", arcId);\n    }\n    return iter.init(_ii[i], _nn[i], fw, _zlimit);\n  };\n\n  this.getShapeIter = function(ids) {\n    return new ShapeIter(this).init(ids);\n  };\n\n  // Add simplification data to the dataset\n  // @thresholds is either a single typed array or an array of arrays of removal thresholds for each arc;\n  //\n  this.setThresholds = function(thresholds) {\n    var n = this.getPointCount(),\n        zz = null;\n    if (!thresholds) {\n      // nop\n    } else if (thresholds.length == n) {\n      zz = thresholds;\n    } else if (thresholds.length == this.size()) {\n      zz = flattenThresholds(thresholds, n);\n    } else {\n      error(\"Invalid threshold data\");\n    }\n    initZData(zz);\n    return this;\n  };\n\n  function flattenThresholds(arr, n) {\n    var zz = new Float64Array(n),\n        i = 0;\n    arr.forEach(function(arr) {\n      for (var j=0, n=arr.length; j<n; i++, j++) {\n        zz[i] = arr[j];\n      }\n    });\n    if (i != n) error(\"Mismatched thresholds\");\n    return zz;\n  }\n\n  // bake in current simplification level, if any\n  this.flatten = function() {\n    if (_zlimit > 0) {\n      var data = getFilteredVertexData();\n      this.updateVertexData(data.nn, data.xx, data.yy);\n      _zlimit = 0;\n    } else {\n      _zz = null;\n    }\n  };\n\n  this.getRetainedInterval = function() {\n    return _zlimit;\n  };\n\n  this.setRetainedInterval = function(z) {\n    _zlimit = z;\n    return this;\n  };\n\n  this.getRetainedPct = function() {\n    return this.getPctByThreshold(_zlimit);\n  };\n\n  this.setRetainedPct = function(pct) {\n    if (pct >= 1) {\n      _zlimit = 0;\n    } else {\n      _zlimit = this.getThresholdByPct(pct);\n      _zlimit = MapShaper.clampIntervalByPct(_zlimit, pct);\n    }\n    return this;\n  };\n\n  // Return array of z-values that can be removed for simplification\n  //\n  this.getRemovableThresholds = function(nth) {\n    if (!_zz) error(\"[arcs] Missing simplification data.\");\n    var skip = nth | 1,\n        arr = new Float64Array(Math.ceil(_zz.length / skip)),\n        z;\n    for (var i=0, j=0, n=this.getPointCount(); i<n; i+=skip) {\n      z = _zz[i];\n      if (z != Infinity) {\n        arr[j++] = z;\n      }\n    }\n    return arr.subarray(0, j);\n  };\n\n  this.getArcThresholds = function(arcId) {\n    if (!(arcId >= 0 && arcId < this.size())) {\n      error(\"[arcs] Invalid arc id:\", arcId);\n    }\n    var start = _ii[arcId],\n        end = start + _nn[arcId];\n    return _zz.subarray(start, end);\n  };\n\n  this.getPctByThreshold = function(val) {\n    var arr, rank, pct;\n    if (val > 0) {\n      arr = this.getRemovableThresholds();\n      rank = utils.findRankByValue(arr, val);\n      pct = arr.length > 0 ? 1 - (rank - 1) / arr.length : 1;\n    } else {\n      pct = 1;\n    }\n    return pct;\n  };\n\n  this.getThresholdByPct = function(pct) {\n    var tmp = this.getRemovableThresholds(),\n        rank, z;\n    if (tmp.length === 0) { // No removable points\n      rank = 0;\n    } else {\n      rank = Math.floor((1 - pct) * (tmp.length + 2));\n    }\n\n    if (rank <= 0) {\n      z = 0;\n    } else if (rank > tmp.length) {\n      z = Infinity;\n    } else {\n      z = utils.findValueByRank(tmp, rank);\n    }\n    return z;\n  };\n\n  this.arcIntersectsBBox = function(i, b1) {\n    var b2 = _bb,\n        j = i * 4;\n    return b2[j] <= b1[2] && b2[j+2] >= b1[0] && b2[j+3] >= b1[1] && b2[j+1] <= b1[3];\n  };\n\n  this.arcIsContained = function(i, b1) {\n    var b2 = _bb,\n        j = i * 4;\n    return b2[j] >= b1[0] && b2[j+2] <= b1[2] && b2[j+1] >= b1[1] && b2[j+3] <= b1[3];\n  };\n\n  this.arcIsSmaller = function(i, units) {\n    var bb = _bb,\n        j = i * 4;\n    return bb[j+2] - bb[j] < units && bb[j+3] - bb[j+1] < units;\n  };\n\n  // TODO: allow datasets in lat-lng coord range to be flagged as planar\n  this.isPlanar = function() {\n    return !MapShaper.probablyDecimalDegreeBounds(this.getBounds());\n  };\n\n  this.size = function() {\n    return _ii && _ii.length || 0;\n  };\n\n  this.getPointCount = function() {\n    return _xx && _xx.length || 0;\n  };\n\n  this.getBounds = function() {\n    return _allBounds;\n  };\n\n  this.getSimpleShapeBounds = function(arcIds, bounds) {\n    bounds = bounds || new Bounds();\n    for (var i=0, n=arcIds.length; i<n; i++) {\n      this.mergeArcBounds(arcIds[i], bounds);\n    }\n    return bounds;\n  };\n\n  this.getSimpleShapeBounds2 = function(arcIds, arr) {\n    var bbox = arr || [],\n        bb = _bb,\n        id = absArcId(arcIds[0]) * 4;\n    bbox[0] = bb[id];\n    bbox[1] = bb[++id];\n    bbox[2] = bb[++id];\n    bbox[3] = bb[++id];\n    for (var i=1, n=arcIds.length; i<n; i++) {\n      id = absArcId(arcIds[i]) * 4;\n      if (bb[id] < bbox[0]) bbox[0] = bb[id];\n      if (bb[++id] < bbox[1]) bbox[1] = bb[id];\n      if (bb[++id] > bbox[2]) bbox[2] = bb[id];\n      if (bb[++id] > bbox[3]) bbox[3] = bb[id];\n    }\n    return bbox;\n  };\n\n  this.getMultiShapeBounds = function(shapeIds, bounds) {\n    bounds = bounds || new Bounds();\n    if (shapeIds) { // handle null shapes\n      for (var i=0, n=shapeIds.length; i<n; i++) {\n        this.getSimpleShapeBounds(shapeIds[i], bounds);\n      }\n    }\n    return bounds;\n  };\n\n  this.mergeArcBounds = function(arcId, bounds) {\n    if (arcId < 0) arcId = ~arcId;\n    var offs = arcId * 4;\n    bounds.mergeBounds(_bb[offs], _bb[offs+1], _bb[offs+2], _bb[offs+3]);\n  };\n}\n\nArcCollection.prototype.inspect = function() {\n  var n = this.getPointCount(), str;\n  if (n < 50) {\n    str = JSON.stringify(this.toArray());\n  } else {\n    str = '[ArcCollection (' + this.size() + ')]';\n  }\n  return str;\n};\n\n// Remove duplicate coords and NaNs\nMapShaper.dedupArcCoords = function(src, dest, arcLen, xx, yy, zz) {\n  var n = 0, n2 = 0; // counters\n  var x, y, i, j, keep;\n  while (n < arcLen) {\n    j = src + n;\n    x = xx[j];\n    y = yy[j];\n    keep = x == x && y == y && (n2 === 0 || x != xx[j-1] || y != yy[j-1]);\n    if (keep) {\n      i = dest + n2;\n      xx[i] = x;\n      yy[i] = y;\n      n2++;\n    }\n    if (zz && n2 > 0 && (keep || zz[j] > zz[i])) {\n      zz[i] = zz[j];\n    }\n    n++;\n  }\n  return n2 > 1 ? n2 : 0;\n};\n\n\n\n\nMapShaper.countPointsInLayer = function(lyr) {\n  var count = 0;\n  if (MapShaper.layerHasPoints(lyr)) {\n    MapShaper.forEachPoint(lyr.shapes, function() {count++;});\n  }\n  return count;\n};\n\nMapShaper.forEachPoint = function(shapes, cb) {\n  shapes.forEach(function(shape, id) {\n    var n = shape ? shape.length : 0;\n    for (var i=0; i<n; i++) {\n      cb(shape[i], id);\n    }\n  });\n};\n\nMapShaper.transformPointsInLayer = function(lyr, f) {\n  if (MapShaper.layerHasPoints(lyr)) {\n    MapShaper.forEachPoint(lyr.shapes, function(p) {\n      var p2 = f(p[0], p[1]);\n      p[0] = p2[0];\n      p[1] = p2[1];\n    });\n  }\n};\n\n\n\n\n// Utility functions for working with ArcCollection and arrays of arc ids.\n\n// @counts A typed array for accumulating count of each abs arc id\n//   (assume it won't overflow)\nMapShaper.countArcsInShapes = function(shapes, counts) {\n  MapShaper.traversePaths(shapes, null, function(obj) {\n    var arcs = obj.arcs,\n        id;\n    for (var i=0; i<arcs.length; i++) {\n      id = arcs[i];\n      if (id < 0) id = ~id;\n      counts[id]++;\n    }\n  });\n};\n\n\n// Returns subset of shapes in @shapes that contain one or more arcs in @arcIds\nMapShaper.findShapesByArcId = function(shapes, arcIds, numArcs) {\n  var index = numArcs ? new Uint8Array(numArcs) : [],\n      found = [];\n  arcIds.forEach(function(id) {\n    index[absArcId(id)] = 1;\n  });\n  shapes.forEach(function(shp, shpId) {\n    var isHit = false;\n    MapShaper.forEachArcId(shp || [], function(id) {\n      isHit = isHit || index[absArcId(id)] == 1;\n    });\n    if (isHit) {\n      found.push(shpId);\n    }\n  });\n  return found;\n};\n\n// @shp An element of the layer.shapes array\n//   (may be null, or, depending on layer type, an array of points or an array of arrays of arc ids)\nMapShaper.cloneShape = function(shp) {\n  if (!shp) return null;\n  return shp.map(function(part) {\n    return part.concat();\n  });\n};\n\nMapShaper.cloneShapes = function(arr) {\n  return utils.isArray(arr) ? arr.map(MapShaper.cloneShape) : null;\n};\n\n// a and b are arrays of arc ids\nMapShaper.pathsAreIdentical = function(a, b) {\n  if (a.length != b.length) return false;\n  for (var i=0, n=a.length; i<n; i++) {\n    if (a[i] != b[i]) return false;\n  }\n  return true;\n};\n\nMapShaper.reversePath = function(ids) {\n  ids.reverse();\n  for (var i=0, n=ids.length; i<n; i++) {\n    ids[i] = ~ids[i];\n  }\n};\n\nMapShaper.clampIntervalByPct = function(z, pct) {\n  if (pct <= 0) z = Infinity;\n  else if (pct >= 1) z = 0;\n  return z;\n};\n\nMapShaper.findNextRemovableVertices = function(zz, zlim, start, end) {\n  var i = MapShaper.findNextRemovableVertex(zz, zlim, start, end),\n      arr, k;\n  if (i > -1) {\n    k = zz[i];\n    arr = [i];\n    while (++i < end) {\n      if (zz[i] == k) {\n        arr.push(i);\n      }\n    }\n  }\n  return arr || null;\n};\n\n// Return id of the vertex between @start and @end with the highest\n// threshold that is less than @zlim, or -1 if none\n//\nMapShaper.findNextRemovableVertex = function(zz, zlim, start, end) {\n  var tmp, jz = 0, j = -1, z;\n  if (start > end) {\n    tmp = start;\n    start = end;\n    end = tmp;\n  }\n  for (var i=start+1; i<end; i++) {\n    z = zz[i];\n    if (z < zlim && z > jz) {\n      j = i;\n      jz = z;\n    }\n  }\n  return j;\n};\n\n// Visit each arc id in a shape (array of array of arc ids)\n// Use non-undefined return values of callback @cb as replacements.\nMapShaper.forEachArcId = function(arr, cb) {\n  var item;\n  for (var i=0; i<arr.length; i++) {\n    item = arr[i];\n    if (item instanceof Array) {\n      MapShaper.forEachArcId(item, cb);\n    } else if (utils.isInteger(item)) {\n      var val = cb(item);\n      if (val !== void 0) {\n        arr[i] = val;\n      }\n    } else if (item) {\n      error(\"Non-integer arc id in:\", arr);\n    }\n  }\n};\n\nMapShaper.forEachPath = function(paths, cb) {\n  MapShaper.editPaths(paths, cb);\n};\n\n// @cb: function(path, i, paths)\n//\nMapShaper.editPaths = function(paths, cb) {\n  if (!paths) return null; // null shape\n  if (!utils.isArray(paths)) error(\"[editPaths()] Expected an array, found:\", arr);\n  var nulls = 0,\n      n = paths.length,\n      retn;\n\n  for (var i=0; i<n; i++) {\n    retn = cb(paths[i], i, paths);\n    if (retn === null) {\n      nulls++;\n      paths[i] = null;\n    } else if (utils.isArray(retn)) {\n      paths[i] = retn;\n    }\n  }\n  if (nulls == n) {\n    return null;\n  } else if (nulls > 0) {\n    return paths.filter(function(ids) {return !!ids;});\n  } else {\n    return paths;\n  }\n};\n\nMapShaper.forEachPathSegment = function(shape, arcs, cb) {\n  MapShaper.forEachArcId(shape, function(arcId) {\n    arcs.forEachArcSegment(arcId, cb);\n  });\n};\n\nMapShaper.traversePaths = function traversePaths(shapes, cbArc, cbPart, cbShape) {\n  var segId = 0;\n  shapes.forEach(function(parts, shapeId) {\n    if (!parts || parts.length === 0) return; // null shape\n    var arcIds, arcId;\n    if (cbShape) {\n      cbShape(shapeId);\n    }\n    for (var i=0, m=parts.length; i<m; i++) {\n      arcIds = parts[i];\n      if (cbPart) {\n        cbPart({\n          i: i,\n          shapeId: shapeId,\n          shape: parts,\n          arcs: arcIds\n        });\n      }\n\n      if (cbArc) {\n        for (var j=0, n=arcIds.length; j<n; j++, segId++) {\n          arcId = arcIds[j];\n          cbArc({\n            i: j,\n            shapeId: shapeId,\n            partId: i,\n            arcId: arcId,\n            segId: segId\n          });\n        }\n      }\n    }\n  });\n};\n\nMapShaper.arcHasLength = function(id, coords) {\n  var iter = coords.getArcIter(id), x, y;\n  if (iter.hasNext()) {\n    x = iter.x;\n    y = iter.y;\n    while (iter.hasNext()) {\n      if (iter.x != x || iter.y != y) return true;\n    }\n  }\n  return false;\n};\n\nMapShaper.filterEmptyArcs = function(shape, coords) {\n  if (!shape) return null;\n  var shape2 = [];\n  shape.forEach(function(ids) {\n    var path = [];\n    for (var i=0; i<ids.length; i++) {\n      if (MapShaper.arcHasLength(ids[i], coords)) {\n        path.push(ids[i]);\n      }\n    }\n    if (path.length > 0) shape2.push(path);\n  });\n  return shape2.length > 0 ? shape2 : null;\n};\n\n// Bundle holes with their containing rings for Topo/GeoJSON polygon export.\n// Assumes outer rings are CW and inner (hole) rings are CCW.\n// @paths array of objects with path metadata -- see MapShaper.exportPathData()\n//\n// TODO: Improve reliability. Currently uses winding order, area and bbox to\n//   identify holes and their enclosures -- could be confused by strange\n//   geometry.\n//\nMapShaper.groupPolygonRings = function(paths) {\n  var pos = [],\n      neg = [];\n  if (paths) {\n    paths.forEach(function(path) {\n      if (path.area > 0) {\n        pos.push(path);\n      } else if (path.area < 0) {\n        neg.push(path);\n      } else {\n        // verbose(\"Zero-area ring, skipping\");\n      }\n    });\n  }\n\n  var output = pos.map(function(part) {\n    return [part];\n  });\n\n  neg.forEach(function(hole) {\n    var containerId = -1,\n        containerArea = 0;\n    for (var i=0, n=pos.length; i<n; i++) {\n      var part = pos[i],\n          contained = part.bounds.contains(hole.bounds) && part.area > -hole.area;\n      if (contained && (containerArea === 0 || part.area < containerArea)) {\n        containerArea = part.area;\n        containerId = i;\n      }\n    }\n    if (containerId == -1) {\n      verbose(\"[groupPolygonRings()] polygon hole is missing a containing ring, dropping.\");\n    } else {\n      output[containerId].push(hole);\n    }\n  });\n  return output;\n};\n\nMapShaper.getPathMetadata = function(shape, arcs, type) {\n  return (shape || []).map(function(ids) {\n    if (!utils.isArray(ids)) throw new Error(\"expected array\");\n    return {\n      ids: ids,\n      area: type == 'polygon' ? geom.getPlanarPathArea(ids, arcs) : 0,\n      bounds: arcs.getSimpleShapeBounds(ids)\n    };\n  });\n};\n\nMapShaper.quantizeArcs = function(arcs, quanta) {\n  // Snap coordinates to a grid of @quanta locations on both axes\n  // This may snap nearby points to the same coordinates.\n  // Consider a cleanup pass to remove dupes, make sure collapsed arcs are\n  //   removed on export.\n  //\n  var bb1 = arcs.getBounds(),\n      bb2 = new Bounds(0, 0, quanta-1, quanta-1),\n      fw = bb1.getTransform(bb2),\n      inv = fw.invert();\n\n  arcs.transformPoints(function(x, y) {\n    var p = fw.transform(x, y);\n    return inv.transform(Math.round(p[0]), Math.round(p[1]));\n  });\n};\n\n\n\n\n// utility functions for datasets and layers\n\n// clone all layers, make a filtered copy of arcs\nMapShaper.copyDataset = function(dataset) {\n  var d2 = utils.extend({}, dataset);\n  d2.layers = d2.layers.map(MapShaper.copyLayer);\n  if (d2.arcs) {\n    d2.arcs = d2.arcs.getFilteredCopy();\n  }\n  return d2;\n};\n\n// clone coordinate data, shallow-copy attribute data\nMapShaper.copyDatasetForExport = function(dataset) {\n  var d2 = utils.extend({}, dataset);\n  d2.layers = d2.layers.map(MapShaper.copyLayerShapes);\n  if (d2.arcs) {\n    d2.arcs = d2.arcs.getFilteredCopy();\n  }\n  return d2;\n};\n\n// make a stub copy if the no_replace option is given, else pass thru src layer\nMapShaper.getOutputLayer = function(src, opts) {\n  return opts && opts.no_replace ? {geometry_type: src.geometry_type} : src;\n};\n\n// Make a deep copy of a layer\nMapShaper.copyLayer = function(lyr) {\n  var copy = MapShaper.copyLayerShapes(lyr);\n  if (copy.data) {\n    copy.data = copy.data.clone();\n  }\n  return copy;\n};\n\nMapShaper.copyLayerShapes = function(lyr) {\n  var copy = utils.extend({}, lyr);\n    if (lyr.shapes) {\n      copy.shapes = MapShaper.cloneShapes(lyr.shapes);\n    }\n    return copy;\n};\n\nMapShaper.getDatasetBounds = function(data) {\n  var bounds = new Bounds();\n  data.layers.forEach(function(lyr) {\n    var lyrbb = MapShaper.getLayerBounds(lyr, data.arcs);\n    if (lyrbb) bounds.mergeBounds(lyrbb);\n  });\n  return bounds;\n};\n\nMapShaper.datasetHasPaths = function(dataset) {\n  return utils.some(dataset.layers, function(lyr) {\n    return MapShaper.layerHasPaths(lyr);\n  });\n};\n\nMapShaper.countMultiPartFeatures = function(shapes) {\n  var count = 0;\n  for (var i=0, n=shapes.length; i<n; i++) {\n    if (shapes[i] && shapes[i].length > 1) count++;\n  }\n  return count;\n};\n\nMapShaper.getFeatureCount = function(lyr) {\n  var count = 0;\n  if (lyr.data) {\n    count = lyr.data.size();\n  } else if (lyr.shapes) {\n    count = lyr.shapes.length;\n  }\n  return count;\n};\n\nMapShaper.getLayerBounds = function(lyr, arcs) {\n  var bounds = null;\n  if (lyr.geometry_type == 'point') {\n    bounds = new Bounds();\n    MapShaper.forEachPoint(lyr.shapes, function(p) {\n      bounds.mergePoint(p[0], p[1]);\n    });\n  } else if (lyr.geometry_type == 'polygon' || lyr.geometry_type == 'polyline') {\n    bounds = MapShaper.getPathBounds(lyr.shapes, arcs);\n  } else {\n    // just return null if layer has no bounds\n    // error(\"Layer is missing a valid geometry type\");\n  }\n  return bounds;\n};\n\nMapShaper.getPathBounds = function(shapes, arcs) {\n  var bounds = new Bounds();\n  MapShaper.forEachArcId(shapes, function(id) {\n    arcs.mergeArcBounds(id, bounds);\n  });\n  return bounds;\n};\n\n// replace cut layers in-sequence (to maintain layer indexes)\n// append any additional new layers\nMapShaper.replaceLayers = function(dataset, cutLayers, newLayers) {\n  // modify a copy in case cutLayers == dataset.layers\n  var currLayers = dataset.layers.concat();\n  utils.repeat(Math.max(cutLayers.length, newLayers.length), function(i) {\n    var cutLyr = cutLayers[i],\n        newLyr = newLayers[i],\n        idx = cutLyr ? currLayers.indexOf(cutLyr) : currLayers.length;\n\n    if (cutLyr) {\n      currLayers.splice(idx, 1);\n    }\n    if (newLyr) {\n      currLayers.splice(idx, 0, newLyr);\n    }\n  });\n  dataset.layers = currLayers;\n};\n\nMapShaper.isolateLayer = function(layer, dataset) {\n  return utils.defaults({\n    layers: dataset.layers.filter(function(lyr) {return lyr == layer;})\n  }, dataset);\n};\n\n// @target is a layer identifier or a comma-sep. list of identifiers\n// an identifier is a literal name, a name containing \"*\" wildcard or\n// a 0-based array index\nMapShaper.findMatchingLayers = function(layers, target) {\n  var ii = [];\n  String(target).split(',').forEach(function(id) {\n    var i = Number(id),\n        rxp = utils.wildcardToRegExp(id);\n    if (utils.isInteger(i)) {\n      ii.push(i); // TODO: handle out-of-range index\n    } else {\n      layers.forEach(function(lyr, i) {\n        if (rxp.test(lyr.name)) ii.push(i);\n      });\n    }\n  });\n\n  ii = utils.uniq(ii); // remove dupes\n  return ii.map(function(i) {\n    return layers[i];\n  });\n};\n\n// Transform the points in a dataset in-place; don't clean up corrupted shapes\nMapShaper.transformPoints = function(dataset, f) {\n  if (dataset.arcs) {\n    dataset.arcs.transformPoints(f);\n  }\n  dataset.layers.forEach(function(lyr) {\n    if (MapShaper.layerHasPoints(lyr)) {\n      MapShaper.transformPointsInLayer(lyr, f);\n    }\n  });\n};\n\nMapShaper.initDataTable = function(lyr) {\n  lyr.data = new DataTable(MapShaper.getFeatureCount(lyr));\n};\n\n\n\n\n// Return average segment length (with simplification)\nMapShaper.getAvgSegment = function(arcs) {\n  var sum = 0;\n  var count = arcs.forEachSegment(function(i, j, xx, yy) {\n    var dx = xx[i] - xx[j],\n        dy = yy[i] - yy[j];\n    sum += Math.sqrt(dx * dx + dy * dy);\n  });\n  return sum / count || 0;\n};\n\n// Return average magnitudes of dx, dy (with simplification)\nMapShaper.getAvgSegment2 = function(arcs) {\n  var dx = 0, dy = 0;\n  var count = arcs.forEachSegment(function(i, j, xx, yy) {\n    dx += Math.abs(xx[i] - xx[j]);\n    dy += Math.abs(yy[i] - yy[j]);\n  });\n  return [dx / count || 0, dy / count || 0];\n};\n\n\n// Return average magnitudes of dx, dy (with simplification)\n/*\nthis.getAvgSegmentSph2 = function() {\n  var sumx = 0, sumy = 0;\n  var count = this.forEachSegment(function(i, j, xx, yy) {\n    var lat1 = yy[i],\n        lat2 = yy[j];\n    sumy += geom.degreesToMeters(Math.abs(lat1 - lat2));\n    sumx += geom.degreesToMeters(Math.abs(xx[i] - xx[j]) *\n        Math.cos((lat1 + lat2) * 0.5 * geom.D2R);\n  });\n  return [sumx / count || 0, sumy / count || 0];\n};\n*/\n\n\n\n// @xx array of x coords\n// @ids an array of segment endpoint ids [a0, b0, a1, b1, ...]\n// Sort @ids in place so that xx[a(n)] <= xx[b(n)] and xx[a(n)] <= xx[a(n+1)]\nMapShaper.sortSegmentIds = function(xx, ids) {\n  MapShaper.orderSegmentIds(xx, ids);\n  MapShaper.quicksortSegmentIds(xx, ids, 0, ids.length-2);\n};\n\nMapShaper.orderSegmentIds = function(xx, ids, spherical) {\n  function swap(i, j) {\n    var tmp = ids[i];\n    ids[i] = ids[j];\n    ids[j] = tmp;\n  }\n  for (var i=0, n=ids.length; i<n; i+=2) {\n    if (xx[ids[i]] > xx[ids[i+1]]) {\n      swap(i, i+1);\n    }\n  }\n};\n\nMapShaper.insertionSortSegmentIds = function(arr, ids, start, end) {\n  var id, id2;\n  for (var j = start + 2; j <= end; j+=2) {\n    id = ids[j];\n    id2 = ids[j+1];\n    for (var i = j - 2; i >= start && arr[id] < arr[ids[i]]; i-=2) {\n      ids[i+2] = ids[i];\n      ids[i+3] = ids[i+1];\n    }\n    ids[i+2] = id;\n    ids[i+3] = id2;\n  }\n};\n\nMapShaper.quicksortSegmentIds = function (a, ids, lo, hi) {\n  var i = lo,\n      j = hi,\n      pivot, tmp;\n  while (i < hi) {\n    pivot = a[ids[(lo + hi >> 2) << 1]]; // avoid n^2 performance on sorted arrays\n    while (i <= j) {\n      while (a[ids[i]] < pivot) i+=2;\n      while (a[ids[j]] > pivot) j-=2;\n      if (i <= j) {\n        tmp = ids[i];\n        ids[i] = ids[j];\n        ids[j] = tmp;\n        tmp = ids[i+1];\n        ids[i+1] = ids[j+1];\n        ids[j+1] = tmp;\n        i+=2;\n        j-=2;\n      }\n    }\n\n    if (j - lo < 40) MapShaper.insertionSortSegmentIds(a, ids, lo, j);\n    else MapShaper.quicksortSegmentIds(a, ids, lo, j);\n    if (hi - i < 40) {\n      MapShaper.insertionSortSegmentIds(a, ids, i, hi);\n      return;\n    }\n    lo = i;\n    j = hi;\n  }\n};\n\n\n\n\n// Convert an array of intersections into an ArcCollection (for display)\n//\nMapShaper.getIntersectionPoints = function(intersections) {\n  return intersections.map(function(obj) {\n        return [obj.x, obj.y];\n      });\n};\n\n// Identify intersecting segments in an ArcCollection\n//\n// To find all intersections:\n// 1. Assign each segment to one or more horizontal stripes/bins\n// 2. Find intersections inside each stripe\n// 3. Concat and dedup\n//\nMapShaper.findSegmentIntersections = (function() {\n\n  // Re-use buffer for temp data -- Chrome's gc starts bogging down\n  // if large buffers are repeatedly created.\n  var buf;\n  function getUint32Array(count) {\n    var bytes = count * 4;\n    if (!buf || buf.byteLength < bytes) {\n      buf = new ArrayBuffer(bytes);\n    }\n    return new Uint32Array(buf, 0, count);\n  }\n\n  return function(arcs) {\n    var bounds = arcs.getBounds(),\n        // TODO: handle spherical bounds\n        spherical = !arcs.isPlanar() &&\n            containsBounds(MapShaper.getWorldBounds(), bounds.toArray()),\n        ymin = bounds.ymin,\n        yrange = bounds.ymax - ymin,\n        stripeCount = MapShaper.calcSegmentIntersectionStripeCount(arcs),\n        stripeSizes = new Uint32Array(stripeCount),\n        stripeId = stripeCount > 1 ? multiStripeId : singleStripeId,\n        i;\n\n    function multiStripeId(y) {\n      return Math.floor((stripeCount-1) * (y - ymin) / yrange);\n    }\n\n    function singleStripeId(y) {return 0;}\n\n    // Count segments in each stripe\n    arcs.forEachSegment(function(id1, id2, xx, yy) {\n      var s1 = stripeId(yy[id1]),\n          s2 = stripeId(yy[id2]);\n      while (true) {\n        stripeSizes[s1] = stripeSizes[s1] + 2;\n        if (s1 == s2) break;\n        s1 += s2 > s1 ? 1 : -1;\n      }\n    });\n\n    // Allocate arrays for segments in each stripe\n    var stripeData = getUint32Array(utils.sum(stripeSizes)),\n        offs = 0;\n    var stripes = [];\n    utils.forEach(stripeSizes, function(stripeSize) {\n      var start = offs;\n      offs += stripeSize;\n      stripes.push(stripeData.subarray(start, offs));\n    });\n    // Assign segment ids to each stripe\n    utils.initializeArray(stripeSizes, 0);\n\n    arcs.forEachSegment(function(id1, id2, xx, yy) {\n      var s1 = stripeId(yy[id1]),\n          s2 = stripeId(yy[id2]),\n          count, stripe;\n      while (true) {\n        count = stripeSizes[s1];\n        stripeSizes[s1] = count + 2;\n        stripe = stripes[s1];\n        stripe[count] = id1;\n        stripe[count+1] = id2;\n        if (s1 == s2) break;\n        s1 += s2 > s1 ? 1 : -1;\n      }\n    });\n\n    // Detect intersections among segments in each stripe.\n    var raw = arcs.getVertexData(),\n        intersections = [],\n        arr;\n    for (i=0; i<stripeCount; i++) {\n      arr = MapShaper.intersectSegments(stripes[i], raw.xx, raw.yy, spherical);\n      if (arr.length > 0) {\n        intersections.push.apply(intersections, arr);\n      }\n    }\n    return MapShaper.dedupIntersections(intersections);\n  };\n})();\n\nMapShaper.sortIntersections = function(arr) {\n  arr.sort(function(a, b) {\n    return a.x - b.x || a.y - b.y;\n  });\n};\n\nMapShaper.dedupIntersections = function(arr) {\n  var index = {};\n  return arr.filter(function(o) {\n    var key = MapShaper.getIntersectionKey(o);\n    if (key in index) {\n      return false;\n    }\n    index[key] = true;\n    return true;\n  });\n};\n\n// Get an indexable key from an intersection object\n// Assumes that vertex ids of o.a and o.b are sorted\nMapShaper.getIntersectionKey = function(o) {\n  return o.a.join(',') + ';' + o.b.join(',');\n};\n\nMapShaper.calcSegmentIntersectionStripeCount = function(arcs) {\n  var yrange = arcs.getBounds().height(),\n      segLen = MapShaper.getAvgSegment2(arcs)[1],\n      count = 1;\n  if (segLen > 0 && yrange > 0) {\n    count = Math.ceil(yrange / segLen / 20);\n  }\n  return count || 1;\n};\n\n// Find intersections among a group of line segments\n//\n// TODO: handle case where a segment starts and ends at the same point (i.e. duplicate coords);\n//\n// @ids: Array of indexes: [s0p0, s0p1, s1p0, s1p1, ...] where xx[sip0] <= xx[sip1]\n// @xx, @yy: Arrays of x- and y-coordinates\n//\nMapShaper.intersectSegments = function(ids, xx, yy, spherical) {\n  var lim = ids.length - 2,\n      intersections = [];\n  var s1p1, s1p2, s2p1, s2p2,\n      s1p1x, s1p2x, s2p1x, s2p2x,\n      s1p1y, s1p2y, s2p1y, s2p2y,\n      hit, seg1, seg2, i, j;\n\n  // Sort segments by xmin, to allow efficient exclusion of segments with\n  // non-overlapping x extents.\n  MapShaper.sortSegmentIds(xx, ids); // sort by ascending xmin\n\n  i = 0;\n  while (i < lim) {\n    s1p1 = ids[i];\n    s1p2 = ids[i+1];\n    s1p1x = xx[s1p1];\n    s1p2x = xx[s1p2];\n    s1p1y = yy[s1p1];\n    s1p2y = yy[s1p2];\n    // count++;\n\n    j = i;\n    while (j < lim) {\n      j += 2;\n      s2p1 = ids[j];\n      s2p1x = xx[s2p1];\n\n      if (s1p2x < s2p1x) break; // x extent of seg 2 is greater than seg 1: done with seg 1\n      //if (s1p2x <= s2p1x) break; // this misses point-segment intersections when s1 or s2 is vertical\n\n      s2p1y = yy[s2p1];\n      s2p2 = ids[j+1];\n      s2p2x = xx[s2p2];\n      s2p2y = yy[s2p2];\n\n      // skip segments with non-overlapping y ranges\n      if (s1p1y >= s2p1y) {\n        if (s1p1y > s2p2y && s1p2y > s2p1y && s1p2y > s2p2y) continue;\n      } else {\n        if (s1p1y < s2p2y && s1p2y < s2p1y && s1p2y < s2p2y) continue;\n      }\n\n      // skip segments that are adjacent in a path (optimization)\n      // TODO: consider if this eliminates some cases that should\n      // be detected, e.g. spikes formed by unequal segments\n      if (s1p1 == s2p1 || s1p1 == s2p2 || s1p2 == s2p1 || s1p2 == s2p2) {\n        continue;\n      }\n\n      // test two candidate segments for intersection\n      hit = segmentIntersection(s1p1x, s1p1y, s1p2x, s1p2y,\n          s2p1x, s2p1y, s2p2x, s2p2y);\n      if (hit) {\n        seg1 = [s1p1, s1p2];\n        seg2 = [s2p1, s2p2];\n        intersections.push(MapShaper.formatIntersection(hit, seg1, seg2, xx, yy));\n        if (hit.length == 4) {\n          intersections.push(MapShaper.formatIntersection(hit.slice(2), seg1, seg2, xx, yy));\n        }\n      }\n    }\n    i += 2;\n  }\n  return intersections;\n\n  // @p is an [x, y] location along a segment defined by ids @id1 and @id2\n  // return array [i, j] where i and j are the same endpoint ids with i <= j\n  // if @p coincides with an endpoint, return the id of that endpoint twice\n  function getEndpointIds(id1, id2, p) {\n    var i = id1 < id2 ? id1 : id2,\n        j = i === id1 ? id2 : id1;\n    if (xx[i] == p[0] && yy[i] == p[1]) {\n      j = i;\n    } else if (xx[j] == p[0] && yy[j] == p[1]) {\n      i = j;\n    }\n    return [i, j];\n  }\n};\n\nMapShaper.formatIntersection = function(xy, s1, s2, xx, yy) {\n  var x = xy[0],\n      y = xy[1],\n      a, b;\n  s1 = MapShaper.formatIntersectingSegment(x, y, s1[0], s1[1], xx, yy);\n  s2 = MapShaper.formatIntersectingSegment(x, y, s2[0], s2[1], xx, yy);\n  a = s1[0] < s2[0] ? s1 : s2;\n  b = a == s1 ? s2 : s1;\n  return {x: x, y: y, a: a, b: b};\n};\n\nMapShaper.formatIntersectingSegment = function(x, y, id1, id2, xx, yy) {\n  var i = id1 < id2 ? id1 : id2,\n      j = i === id1 ? id2 : id1;\n  if (xx[i] == x && yy[i] == y) {\n    j = i;\n  } else if (xx[j] == x && yy[j] == y) {\n    i = j;\n  }\n  return [i, j];\n};\n\n\n\n\n// Calculations for planar geometry of shapes\n// TODO: consider 3D versions of some of these\n\ngeom.getPlanarShapeArea = function(shp, arcs) {\n  return (shp || []).reduce(function(area, ids) {\n    return area + geom.getPlanarPathArea(ids, arcs);\n  }, 0);\n};\n\ngeom.getSphericalShapeArea = function(shp, arcs) {\n  if (arcs.isPlanar()) {\n    error(\"[getSphericalShapeArea()] Function requires decimal degree coordinates\");\n  }\n  return (shp || []).reduce(function(area, ids) {\n    return area + geom.getSphericalPathArea(ids, arcs);\n  }, 0);\n};\n\n// Return path with the largest (area) bounding box\n// @shp array of array of arc ids\n// @arcs ArcCollection\ngeom.getMaxPath = function(shp, arcs) {\n  var maxArea = 0;\n  return (shp || []).reduce(function(maxPath, path) {\n    var bbArea = arcs.getSimpleShapeBounds(path).area();\n    if (bbArea > maxArea) {\n      maxArea = bbArea;\n      maxPath = path;\n    }\n    return maxPath;\n  }, null);\n};\n\n// @ids array of arc ids\n// @arcs ArcCollection\ngeom.getAvgPathXY = function(ids, arcs) {\n  var iter = arcs.getShapeIter(ids);\n  if (!iter.hasNext()) return null;\n  var x0 = iter.x,\n      y0 = iter.y,\n      count = 0,\n      sumX = 0,\n      sumY = 0;\n  while (iter.hasNext()) {\n    count++;\n    sumX += iter.x;\n    sumY += iter.y;\n  }\n  if (count === 0 || iter.x !== x0 || iter.y !== y0) {\n    sumX += x0;\n    sumY += y0;\n    count++;\n  }\n  return {\n    x: sumX / count,\n    y: sumY / count\n  };\n};\n\n// Return true if point is inside or on boundary of a shape\n//\ngeom.testPointInPolygon = function(x, y, shp, arcs) {\n  var isIn = false,\n      isOn = false;\n  if (shp) {\n    shp.forEach(function(ids) {\n      var inRing = geom.testPointInRing(x, y, ids, arcs);\n      if (inRing == 1) {\n        isIn = !isIn;\n      } else if (inRing == -1) {\n        isOn = true;\n      }\n    });\n  }\n  return isOn || isIn;\n};\n\n\ngeom.getPointToPathDistance = function(px, py, ids, arcs) {\n  var iter = arcs.getShapeIter(ids);\n  if (!iter.hasNext()) return Infinity;\n  var ax = iter.x,\n      ay = iter.y,\n      paSq = distanceSq(px, py, ax, ay),\n      pPathSq = paSq,\n      pbSq, abSq,\n      bx, by;\n\n  while (iter.hasNext()) {\n    bx = iter.x;\n    by = iter.y;\n    pbSq = distanceSq(px, py, bx, by);\n    abSq = distanceSq(ax, ay, bx, by);\n    pPathSq = Math.min(pPathSq, apexDistSq(paSq, pbSq, abSq));\n    ax = bx;\n    ay = by;\n    paSq = pbSq;\n  }\n  return Math.sqrt(pPathSq);\n};\n\ngeom.getYIntercept = function(x, ax, ay, bx, by) {\n  return ay + (x - ax) * (by - ay) / (bx - ax);\n};\n\ngeom.getXIntercept = function(y, ax, ay, bx, by) {\n  return ax + (y - ay) * (bx - ax) / (by - ay);\n};\n\n// Return unsigned distance of a point to a shape\n//\ngeom.getPointToShapeDistance = function(x, y, shp, arcs) {\n  var minDist = (shp || []).reduce(function(minDist, ids) {\n    var pathDist = geom.getPointToPathDistance(x, y, ids, arcs);\n    return Math.min(minDist, pathDist);\n  }, Infinity);\n  return minDist;\n};\n\n// Test if point (x, y) is inside, outside or on the boundary of a polygon ring\n// Return 0: outside; 1: inside; -1: on boundary\n//\ngeom.testPointInRing = function(x, y, ids, arcs) {\n  /*\n  // arcs.getSimpleShapeBounds() doesn't apply simplification, can't use here\n  //// wait, why not? simplifcation shoudn't expand bounds, so this test makes sense\n  if (!arcs.getSimpleShapeBounds(ids).containsPoint(x, y)) {\n    return false;\n  }\n  */\n  var isIn = false,\n      isOn = false;\n  MapShaper.forEachPathSegment(ids, arcs, function(a, b, xx, yy) {\n    var result = geom.testRayIntersection(x, y, xx[a], yy[a], xx[b], yy[b]);\n    if (result == 1) {\n      isIn = !isIn;\n    } else if (isNaN(result)) {\n      isOn = true;\n    }\n  });\n  return isOn ? -1 : (isIn ? 1 : 0);\n};\n\n// test if a vertical ray originating at (x, y) intersects a segment\n// returns 1 if intersection, 0 if no intersection, NaN if point touches segment\n// (Special rules apply to endpoint intersections, to support point-in-polygon testing.)\ngeom.testRayIntersection = function(x, y, ax, ay, bx, by) {\n  var val = geom.getRayIntersection(x, y, ax, ay, bx, by);\n  if (val != val) {\n    return NaN;\n  }\n  return val == -Infinity ? 0 : 1;\n};\n\ngeom.getRayIntersection = function(x, y, ax, ay, bx, by) {\n  var hit = -Infinity, // default: no hit\n      yInt;\n\n  // case: p is entirely above, left or right of segment\n  if (x < ax && x < bx || x > ax && x > bx || y > ay && y > by) {\n      // no intersection\n  }\n  // case: px aligned with a segment vertex\n  else if (x === ax || x === bx) {\n    // case: vertical segment or collapsed segment\n    if (x === ax && x === bx) {\n      // p is on segment\n      if (y == ay || y == by || y > ay != y > by) {\n        hit = NaN;\n      }\n      // else: no hit\n    }\n    // case: px equal to ax (only)\n    else if (x === ax) {\n      if (y === ay) {\n        hit = NaN;\n      } else if (bx < ax && y < ay) {\n        // only score hit if px aligned to rightmost endpoint\n        hit = ay;\n      }\n    }\n    // case: px equal to bx (only)\n    else {\n      if (y === by) {\n        hit = NaN;\n      } else if (ax < bx && y < by) {\n        // only score hit if px aligned to rightmost endpoint\n        hit = by;\n      }\n    }\n  // case: px is between endpoints\n  } else {\n    yInt = geom.getYIntercept(x, ax, ay, bx, by);\n    if (yInt > y) {\n      hit = yInt;\n    } else if (yInt == y) {\n      hit = NaN;\n    }\n  }\n  return hit;\n};\n\ngeom.getSphericalPathArea = function(ids, arcs) {\n  var iter = arcs.getShapeIter(ids),\n      sum = 0,\n      started = false,\n      deg2rad = Math.PI / 180,\n      x, y, xp, yp;\n  while (iter.hasNext()) {\n    x = iter.x * deg2rad;\n    y = Math.sin(iter.y * deg2rad);\n    if (started) {\n      sum += (x - xp) * (2 + y + yp);\n    } else {\n      started = true;\n    }\n    xp = x;\n    yp = y;\n  }\n  return sum / 2 * 6378137 * 6378137;\n};\n\n// Get path area from an array of [x, y] points\n// TODO: consider removing duplication with getPathArea(), e.g. by\n//   wrapping points in an iterator.\n//\ngeom.getPlanarPathArea2 = function(points) {\n  var sum = 0,\n      ax, ay, bx, by, dx, dy, p;\n  for (var i=0, n=points.length; i<n; i++) {\n    p = points[i];\n    if (i === 0) {\n      ax = 0;\n      ay = 0;\n      dx = -p[0];\n      dy = -p[1];\n    } else {\n      ax = p[0] + dx;\n      ay = p[1] + dy;\n      sum += ax * by - bx * ay;\n    }\n    bx = ax;\n    by = ay;\n  }\n  return sum / 2;\n};\n\ngeom.getPlanarPathArea = function(ids, arcs) {\n  var iter = arcs.getShapeIter(ids),\n      sum = 0,\n      ax, ay, bx, by, dx, dy;\n  if (iter.hasNext()) {\n    ax = 0;\n    ay = 0;\n    dx = -iter.x;\n    dy = -iter.y;\n    while (iter.hasNext()) {\n      bx = ax;\n      by = ay;\n      ax = iter.x + dx;\n      ay = iter.y + dy;\n      sum += ax * by - bx * ay;\n    }\n  }\n  return sum / 2;\n};\n\ngeom.countVerticesInPath = function(ids, arcs) {\n  var iter = arcs.getShapeIter(ids),\n      count = 0;\n  while (iter.hasNext()) count++;\n  return count;\n};\n\ngeom.getPathBounds = function(points) {\n  var bounds = new Bounds();\n  for (var i=0, n=points.length; i<n; i++) {\n    bounds.mergePoint(points[i][0], points[i][1]);\n  }\n  return bounds;\n};\n\ngeom.transposePoints = function(points) {\n  var xx = [], yy = [], n=points.length;\n  for (var i=0; i<n; i++) {\n    xx.push(points[i][0]);\n    yy.push(points[i][1]);\n  }\n  return [xx, yy];\n};\n\ngeom.calcPathLen = (function() {\n  var len;\n  function addSegLen(i, j, xx, yy) {\n    len += distance2D(xx[i], yy[i], xx[j], yy[j]);\n  }\n  return function(path, arcs) {\n    len = 0;\n    for (var i=0, n=path.length; i<n; i++) {\n      arcs.forEachArcSegment(path[i], addSegLen);\n    }\n    return len;\n  };\n}());\n\n\n\n\n// PolygonIndex indexes the coordinates in one polygon feature for efficient\n// point-in-polygon tests\n\nfunction PolygonIndex(shape, arcs, opts) {\n  var data = arcs.getVertexData(),\n      polygonBounds = arcs.getMultiShapeBounds(shape),\n      boundsLeft,\n      xminIds, xmaxIds, // vertex ids of segment endpoints\n      bucketCount,\n      bucketOffsets,\n      bucketWidth;\n\n  init();\n\n  // Return 0 if outside, 1 if inside, -1 if on boundary\n  this.pointInPolygon = function(x, y) {\n    if (!polygonBounds.containsPoint(x, y)) {\n      return false;\n    }\n    var bucketId = getBucketId(x);\n    var count = countCrosses(x, y, bucketId);\n    if (bucketId > 0) {\n      count += countCrosses(x, y, bucketId - 1);\n    }\n    count += countCrosses(x, y, bucketCount); // check oflo bucket\n    if (isNaN(count)) return -1;\n    return count % 2 == 1 ? 1 : 0;\n  };\n\n  function countCrosses(x, y, bucketId) {\n    var offs = bucketOffsets[bucketId],\n        count = 0,\n        xx = data.xx,\n        yy = data.yy,\n        n, a, b;\n    if (bucketId == bucketCount) { // oflo bucket\n      n = xminIds.length - offs;\n    } else {\n      n = bucketOffsets[bucketId + 1] - offs;\n    }\n    for (var i=0; i<n; i++) {\n      a = xminIds[i + offs];\n      b = xmaxIds[i + offs];\n      count += geom.testRayIntersection(x, y, xx[a], yy[a], xx[b], yy[b]);\n    }\n    return count;\n  }\n\n  function getBucketId(x) {\n    var i = Math.floor((x - boundsLeft) / bucketWidth);\n    if (i < 0) i = 0;\n    if (i >= bucketCount) i = bucketCount - 1;\n    return i;\n  }\n\n  function getBucketCount(segCount) {\n    // default is 100 segs per bucket (average)\n    var buckets = opts && opts.buckets > 0 ? opts.buckets : segCount / 100;\n    return Math.ceil(buckets);\n  }\n\n  function init() {\n    var xx = data.xx,\n        segCount = 0,\n        segId = 0,\n        bucketId = -1,\n        prevBucketId,\n        segments,\n        head, tail,\n        a, b, i, j, xmin, xmax;\n\n    // get array of segments as [s0p0, s0p1, s1p0, s1p1, ...], sorted by xmin coordinate\n    MapShaper.forEachPathSegment(shape, arcs, function() {\n      segCount++;\n    });\n    segments = new Uint32Array(segCount * 2);\n    i = 0;\n    MapShaper.forEachPathSegment(shape, arcs, function(a, b, xx, yy) {\n      segments[i++] = a;\n      segments[i++] = b;\n    });\n    MapShaper.sortSegmentIds(xx, segments);\n\n    // assign segments to buckets according to xmin coordinate\n    xminIds = new Uint32Array(segCount);\n    xmaxIds = new Uint32Array(segCount);\n    bucketCount = getBucketCount(segCount);\n    bucketOffsets = new Uint32Array(bucketCount + 1); // add an oflo bucket\n    boundsLeft = xx[segments[0]]; // xmin of first segment\n    bucketWidth = (xx[segments[segments.length - 2]] - boundsLeft) / bucketCount;\n    head = 0; // insertion index for next segment in the current bucket\n    tail = segCount - 1; // insertion index for next segment in oflo bucket\n\n    while (segId < segCount) {\n      j = segId * 2;\n      a = segments[j];\n      b = segments[j+1];\n      xmin = xx[a];\n      xmax = xx[b];\n      prevBucketId = bucketId;\n      bucketId = getBucketId(xmin);\n\n      while (bucketId > prevBucketId) {\n        prevBucketId++;\n        bucketOffsets[prevBucketId] = head;\n      }\n\n      if (xmax - xmin >= 0 === false) error(\"Invalid segment\");\n      if (getBucketId(xmax) - bucketId > 1) {\n        // if segment extends to more than two buckets, put it in the oflo bucket\n        xminIds[tail] = a;\n        xmaxIds[tail] = b;\n        tail--; // oflo bucket fills from right to left\n      } else {\n        // else place segment in a bucket based on x coord of leftmost endpoint\n        xminIds[head] = a;\n        xmaxIds[head] = b;\n        head++;\n      }\n      segId++;\n    }\n    bucketOffsets[bucketCount] = head;\n    if (head != tail + 1) error(\"Segment indexing error\");\n  }\n}\n\n\n\n\nfunction PathIndex(shapes, arcs) {\n  var _index;\n  // var totalArea = arcs.getBounds().area();\n  var totalArea = MapShaper.getPathBounds(shapes, arcs).area();\n  init(shapes);\n\n  function init(shapes) {\n    var boxes = [];\n\n    shapes.forEach(function(shp, shpId) {\n      var n = shp ? shp.length : 0;\n      for (var i=0; i<n; i++) {\n        addPath(shp[i], shpId);\n      }\n    });\n\n    _index = require('rbush')();\n    _index.load(boxes);\n\n    function addPath(ids, shpId) {\n      var bounds = arcs.getSimpleShapeBounds(ids);\n      var bbox = bounds.toArray();\n      bbox.ids = ids;\n      bbox.bounds = bounds;\n      bbox.id = shpId;\n      boxes.push(bbox);\n      // TODO: Better test for whether or not to index a path\n      if (bounds.area() > totalArea * 0.02) {\n        bbox.index = new PolygonIndex([ids], arcs);\n      }\n    }\n  }\n\n  this.findEnclosingShape = function(p) {\n    var shpId = -1;\n    var shapes = findPointHitShapes(p);\n    shapes.forEach(function(paths) {\n      if (testPointInRings(p, paths)) {\n        shpId = paths[0].id;\n      }\n    });\n    return shpId;\n  };\n\n  this.pointIsEnclosed = function(p) {\n    return testPointInRings(p, findPointHitRings(p));\n  };\n\n  this.arcIsEnclosed = function(arcId) {\n    return this.pointIsEnclosed(getTestPoint(arcId));\n  };\n\n  // Test if a polygon ring is contained within an indexed ring\n  // Not a true polygon-in-polygon test\n  // Assumes that the target ring does not cross an indexed ring at any point\n  // or share a segment with an indexed ring. (Intersecting rings should have\n  // been detected previously).\n  //\n  this.pathIsEnclosed = function(pathIds) {\n    var arcId = pathIds[0];\n    var p = getTestPoint(arcId);\n    return this.pointIsEnclosed(p);\n  };\n\n  // return array of paths that are contained within a path, or null if none\n  // @pathIds Array of arc ids comprising a closed path\n  this.findEnclosedPaths = function(pathIds) {\n    var pathBounds = arcs.getSimpleShapeBounds(pathIds),\n        cands = _index.search(pathBounds.toArray()),\n        paths = [],\n        index;\n\n    if (cands.length > 6) {\n      index = new PolygonIndex([pathIds], arcs);\n    }\n\n\n    cands.forEach(function(cand) {\n      var p = getTestPoint(cand.ids[0]);\n      var isEnclosed = index ?\n        index.pointInPolygon(p[0], p[1]) : pathContainsPoint(pathIds, pathBounds, p);\n      if (isEnclosed) {\n        paths.push(cand.ids);\n      }\n    });\n    return paths.length > 0 ? paths : null;\n  };\n\n  this.findPathsInsideShape = function(shape) {\n    var paths = [];\n    shape.forEach(function(ids) {\n      var enclosed = this.findEnclosedPaths(ids);\n      if (enclosed) {\n        paths = xorArrays(paths, enclosed);\n      }\n    }, this);\n    return paths.length > 0 ? paths : null;\n  };\n\n  function testPointInRings(p, cands) {\n    var isOn = false,\n        isIn = false;\n    cands.forEach(function(cand) {\n      var inRing = cand.index ?\n        cand.index.pointInPolygon(p[0], p[1]) :\n        pathContainsPoint(cand.ids, cand.bounds, p);\n      if (inRing == -1) {\n        isOn = true;\n      } else if (inRing == 1) {\n        isIn = !isIn;\n      }\n    });\n    return isOn || isIn;\n  }\n\n  function findPointHitShapes(p) {\n    var rings = findPointHitRings(p),\n        shapes = [],\n        shape, bbox;\n    if (rings.length > 0) {\n      rings.sort(function(a, b) {return a.id - b.id;});\n      for (var i=0; i<rings.length; i++) {\n        bbox = rings[i];\n        if (i === 0 || bbox.id != rings[i-1].id) {\n          shapes.push(shape=[]);\n        }\n        shape.push(bbox);\n      }\n    }\n    return shapes;\n  }\n\n  function findPointHitRings(p) {\n    var x = p[0],\n        y = p[1];\n    return _index.search([x, y, x, y]);\n  }\n\n  function getTestPoint(arcId) {\n    // test point halfway along first segment because ring might still be\n    // enclosed if a segment endpoint touches an indexed ring.\n    var p0 = arcs.getVertex(arcId, 0),\n        p1 = arcs.getVertex(arcId, 1);\n    return [(p0.x + p1.x) / 2, (p0.y + p1.y) / 2];\n  }\n\n  function pathContainsPoint(pathIds, pathBounds, p) {\n    if (pathBounds.containsPoint(p[0], p[1]) === false) return 0;\n    // A contains B iff some point on B is inside A\n    return geom.testPointInRing(p[0], p[1], pathIds, arcs);\n  }\n\n  function xorArrays(a, b) {\n    var xor = [];\n    a.forEach(function(el) {\n      if (b.indexOf(el) == -1) xor.push(el);\n    });\n    b.forEach(function(el) {\n      if (xor.indexOf(el) == -1) xor.push(el);\n    });\n    return xor;\n  }\n}\n\n\n\n\n// @arcs ArcCollection\n// @filter Optional filter function, arcIds that return false are excluded\n//\nfunction NodeCollection(arcs, filter) {\n  if (utils.isArray(arcs)) {\n    arcs = new ArcCollection(arcs);\n  }\n  var arcData = arcs.getVertexData(),\n      nn = arcData.nn,\n      xx = arcData.xx,\n      yy = arcData.yy;\n\n  var nodeData = MapShaper.findNodeTopology(arcs, filter);\n\n  if (nn.length * 2 != nodeData.chains.length) error(\"[NodeCollection] count error\");\n\n  // TODO: could check that arc collection hasn't been modified, using accessor function\n  Object.defineProperty(this, 'arcs', {value: arcs});\n\n  this.toArray = function() {\n    var flags = new Uint8Array(nodeData.xx.length),\n        nodes = [];\n    utils.forEach(nodeData.chains, function(next, i) {\n      if (flags[i] == 1) return;\n      nodes.push([nodeData.xx[i], nodeData.yy[i]]);\n      while (flags[next] != 1) {\n        flags[next] = 1;\n        next = nodeData.chains[next];\n      }\n    });\n    return nodes;\n  };\n\n  this.size = function() {\n    return this.toArray().length;\n  };\n\n  this.debugNode = function(arcId) {\n    if (!MapShaper.TRACING) return;\n    var ids = [arcId];\n    this.forEachConnectedArc(arcId, function(id) {\n      ids.push(id);\n    });\n\n    message(\"node ids:\",  ids);\n    ids.forEach(printArc);\n\n    function printArc(id) {\n      var str = id + \": \";\n      var len = arcs.getArcLength(id);\n      if (len > 0) {\n        var p1 = arcs.getVertex(id, -1);\n        str += utils.format(\"[%f, %f]\", p1.x, p1.y);\n        if (len > 1) {\n          var p2 = arcs.getVertex(id, -2);\n          str += utils.format(\", [%f, %f]\", p2.x, p2.y);\n          if (len > 2) {\n            var p3 = arcs.getVertex(id, 0);\n            str += utils.format(\", [%f, %f]\", p3.x, p3.y);\n          }\n          str += \" len: \" + distance2D(p1.x, p1.y, p2.x, p2.y);\n        }\n      } else {\n        str = \"[]\";\n      }\n      message(str);\n    }\n  };\n\n  this.forEachConnectedArc = function(arcId, cb) {\n    var nextId = nextConnectedArc(arcId),\n        i = 0;\n    while (nextId != arcId) {\n      cb(nextId, i++);\n      nextId = nextConnectedArc(nextId);\n    }\n  };\n\n  // Returns the id of the first identical arc or @arcId if none found\n  // TODO: find a better function name\n  this.findMatchingArc = function(arcId) {\n    var verbose = arcId ==  -12794 || arcId == 19610;\n    var nextId = nextConnectedArc(arcId),\n        match = arcId;\n    while (nextId != arcId) {\n      if (testArcMatch(arcId, nextId)) {\n        if (absArcId(nextId) < absArcId(match)) match = nextId;\n      }\n      nextId = nextConnectedArc(nextId);\n    }\n    if (match != arcId) {\n      trace(\"found identical arc:\", arcId, \"->\", match);\n      // this.debugNode(arcId);\n    }\n    return match;\n  };\n\n  function testArcMatch(a, b) {\n    var absA = a >= 0 ? a : ~a,\n        absB = b >= 0 ? b : ~b,\n        lenA = nn[absA];\n    if (lenA < 2) {\n      // Don't throw error on collapsed arcs -- assume they will be handled\n      //   appropriately downstream.\n      // error(\"[testArcMatch() defective arc; len:\", lenA);\n      return false;\n    }\n    if (lenA != nn[absB]) return false;\n    if (testVertexMatch(a, b, -1) &&\n        testVertexMatch(a, b, 1) &&\n        testVertexMatch(a, b, -2)) {\n      return true;\n    }\n    return false;\n  }\n\n  function testVertexMatch(a, b, i) {\n    var ai = arcs.indexOfVertex(a, i),\n        bi = arcs.indexOfVertex(b, i);\n    return xx[ai] == xx[bi] && yy[ai] == yy[bi];\n  }\n\n  // return arcId of next arc in the chain, pointed towards the shared vertex\n  function nextConnectedArc(arcId) {\n    var fw = arcId >= 0,\n        absId = fw ? arcId : ~arcId,\n        nodeId = fw ? absId * 2 + 1: absId * 2, // if fw, use end, if rev, use start\n        chainedId = nodeData.chains[nodeId],\n        nextAbsId = chainedId >> 1,\n        nextArcId = chainedId & 1 == 1 ? nextAbsId : ~nextAbsId;\n\n    if (chainedId < 0 || chainedId >= nodeData.chains.length) error(\"out-of-range chain id\");\n    if (absId >= nn.length) error(\"out-of-range arc id\");\n    if (nodeData.chains.length <= nodeId) error(\"out-of-bounds node id\");\n    return nextArcId;\n  }\n\n  // expose for testing\n  this.internal = {\n    testArcMatch: testArcMatch,\n    testVertexMatch: testVertexMatch\n  };\n}\n\nMapShaper.findNodeTopology = function(arcs, filter) {\n  var n = arcs.size() * 2,\n      xx2 = new Float64Array(n),\n      yy2 = new Float64Array(n),\n      ids2 = new Int32Array(n);\n\n  arcs.forEach2(function(i, n, xx, yy, zz, arcId) {\n    if (filter && !filter(arcId)) {\n      return;\n    }\n    var start = i,\n        end = i + n - 1,\n        start2 = arcId * 2,\n        end2 = start2 + 1;\n    xx2[start2] = xx[start];\n    yy2[start2] = yy[start];\n    ids2[start2] = arcId;\n    xx2[end2] = xx[end];\n    yy2[end2] = yy[end];\n    ids2[end2] = arcId;\n  });\n\n  var chains = initPointChains(xx2, yy2);\n  return {\n    xx: xx2,\n    yy: yy2,\n    ids: ids2,\n    chains: chains\n  };\n};\n\n\n\n\n// Return function for splitting self-intersecting polygon rings\n// Returned function receives a single path, returns an array of paths\n// Assumes that any intersections occur at vertices, not along segments\n// (requires that MapShaper.divideArcs() has already been run)\n//\nMapShaper.getSelfIntersectionSplitter = function(nodes) {\n\n  function contains(arr, el) {\n    for (var i=0, n=arr.length; i<n; i++) {\n      if (arr[i] === el) return true;\n    }\n    return false;\n  }\n\n  // If arc @enterId enters a node with more than one open routes leading out:\n  //   return array of sub-paths\n  // else return null\n  function dividePathAtNode(path, enterId) {\n    var count = 0,\n        subPaths = null,\n        exitIds, firstExitId;\n    nodes.forEachConnectedArc(enterId, function(arcId) {\n      var exitId = ~arcId;\n      // TODO: remove performance bottleneck\n      // contains() is faster than native array.indexOf(), could do better.\n      // if (path.indexOf(exitId) > -1) { // ignore arcs that are not on this path\n      if (contains(path, exitId)) { // ignore arcs that are not on this path\n        if (count === 0) {\n          firstExitId = exitId;\n        } else if (count === 1) {\n          exitIds = [firstExitId, exitId];\n        } else {\n          exitIds.push(exitId);\n        }\n        count++;\n      }\n    });\n    if (exitIds) {\n      subPaths = MapShaper.splitPathByIds(path, exitIds);\n      // recursively divide each sub-path\n      return subPaths.reduce(function(memo, subPath) {\n        return memo.concat(dividePath(subPath));\n      }, []);\n    }\n    return null;\n  }\n\n  function dividePath(path) {\n    var subPaths = null;\n    for (var i=0; i<path.length - 1; i++) { // don't need to check last arc\n      subPaths = dividePathAtNode(path, path[i]);\n      if (subPaths) {\n        return subPaths;\n      }\n    }\n    // indivisible path -- remove any spikes\n    MapShaper.removeSpikesInPath(path);\n    return path.length > 0 ? [path] : [];\n  }\n\n  return dividePath;\n};\n\n// @path An array of arc ids\n// @ids An array of two or more start ids\nMapShaper.splitPathByIds = function(path, ids) {\n  var n = ids.length;\n  var ii = ids.map(function(id) {\n    var idx = path.indexOf(id);\n    if (idx == -1) error(\"[splitPathByIds()] Path is missing id:\", id);\n    return idx;\n  });\n  utils.genericSort(ii, true);\n  var subPaths = ii.map(function(idx, i) {\n    var split;\n    if (i == n-1) {\n      // place first path item first\n      split = path.slice(0, ii[0]).concat(path.slice(idx));\n    } else {\n      split = path.slice(idx, ii[i+1]);\n    }\n    return split;\n  });\n\n  // make sure first sub-path starts with arc at path[0]\n  if (ii[0] !== 0) {\n    subPaths.unshift(subPaths.pop());\n  }\n  if (subPaths[0][0] !== path[0]) {\n    error(\"[splitPathByIds()] Indexing error\");\n  }\n  return subPaths;\n};\n\n\n\n\n// Functions for redrawing polygons for clipping / erasing / flattening / division\n\nMapShaper.setBits = function(src, flags, mask) {\n  return (src & ~mask) | (flags & mask);\n};\n\nMapShaper.andBits = function(src, flags, mask) {\n  return src & (~mask | flags);\n};\n\nMapShaper.setRouteBits = function(bits, id, flags) {\n  var abs = absArcId(id),\n      mask;\n  if (abs == id) { // fw\n    mask = ~3;\n  } else {\n    mask = ~0x30;\n    bits = bits << 4;\n  }\n  flags[abs] &= (bits | mask);\n};\n\nMapShaper.getRouteBits = function(id, flags) {\n  var abs = absArcId(id),\n      bits = flags[abs];\n  if (abs != id) bits = bits >> 4;\n  return bits & 7;\n};\n\n\n// enable arc pathways in a single shape or array of shapes\n// Uses 8 bits to control traversal of each arc\n// 0-3: forward arc; 4-7: rev arc\n// 0: fw path is visible\n// 1: fw path is open for traversal\n// ...\n//\nMapShaper.openArcRoutes = function(arcIds, arcs, flags, fwd, rev, dissolve, orBits) {\n  MapShaper.forEachArcId(arcIds, function(id) {\n    var isInv = id < 0,\n        absId = isInv ? ~id : id,\n        currFlag = flags[absId],\n        openFwd = isInv ? rev : fwd,\n        openRev = isInv ? fwd : rev,\n        newFlag = currFlag;\n\n    // error condition: lollipop arcs can cause problems; ignore these\n    if (arcs.arcIsLollipop(id)) {\n      trace('lollipop');\n      newFlag = 0; // unset (i.e. make invisible)\n    } else {\n      if (openFwd) {\n        newFlag |= 3; // visible / open\n      }\n      if (openRev) {\n        newFlag |= 0x30; // visible / open\n      }\n\n      // placing this in front of dissolve - dissolve has to be able to hide\n      // arcs that are set to visible\n      if (orBits > 0) {\n        newFlag |= orBits;\n      }\n\n      // dissolve hides arcs that have both fw and rev pathways open\n      if (dissolve && (newFlag & 0x22) === 0x22) {\n        newFlag &= ~0x11; // make invisible\n      }\n    }\n\n    flags[absId] = newFlag;\n  });\n};\n\nMapShaper.closeArcRoutes = function(arcIds, arcs, flags, fwd, rev, hide) {\n  MapShaper.forEachArcId(arcIds, function(id) {\n    var isInv = id < 0,\n        absId = isInv ? ~id : id,\n        currFlag = flags[absId],\n        mask = 0xff,\n        closeFwd = isInv ? rev : fwd,\n        closeRev = isInv ? fwd : rev;\n\n    if (closeFwd) {\n      if (hide) mask &= ~1;\n      mask ^= 0x2;\n    }\n    if (closeRev) {\n      if (hide) mask &= ~0x10;\n      mask ^= 0x20;\n    }\n\n    flags[absId] = currFlag & mask;\n  });\n};\n\n// Return a function for generating a path across a field of intersecting arcs\n// TODO: add option to calculate angle on sphere for lat-lng coords\n//\nMapShaper.getPathFinder = function(nodes, useRoute, routeIsVisible, chooseRoute, spherical) {\n  var arcs = nodes.arcs,\n      coords = arcs.getVertexData(),\n      xx = coords.xx,\n      yy = coords.yy,\n      calcAngle = spherical ? geom.signedAngleSph : geom.signedAngle;\n\n  function getNextArc(prevId) {\n    var ai = arcs.indexOfVertex(prevId, -2),\n        ax = xx[ai],\n        ay = yy[ai],\n        bi = arcs.indexOfVertex(prevId, -1),\n        bx = xx[bi],\n        by = yy[bi],\n        nextId = NaN,\n        nextAngle = 0;\n\n    nodes.forEachConnectedArc(prevId, function(candId) {\n      if (!routeIsVisible(~candId)) return;\n      if (arcs.getArcLength(candId) < 2) error(\"[pathfinder] defective arc\");\n\n      var ci = arcs.indexOfVertex(candId, -2),\n          cx = xx[ci],\n          cy = yy[ci],\n\n          // sanity check: make sure both arcs share the same vertex;\n          di = arcs.indexOfVertex(candId, -1),\n          dx = xx[di],\n          dy = yy[di],\n          candAngle;\n      if (dx !== bx || dy !== by) {\n        message(\"cd:\", cx, cy, dx, dy, 'arc:', candId);\n        error(\"Error in node topology\");\n      }\n\n      candAngle = calcAngle(ax, ay, bx, by, cx, cy);\n\n      if (candAngle > 0) {\n        if (nextAngle === 0) {\n          nextId = candId;\n          nextAngle = candAngle;\n        } else {\n          var choice = chooseRoute(~nextId, nextAngle, ~candId, candAngle, prevId);\n          if (choice == 2) {\n            nextId = candId;\n            nextAngle = candAngle;\n          }\n        }\n      } else {\n        // candAngle is NaN or 0\n        trace(\"#getNextArc() Invalid angle; id:\", candId, \"angle:\", candAngle);\n        nodes.debugNode(prevId);\n      }\n    });\n\n    if (nextId === prevId) {\n      // TODO: confirm that this can't happen\n      nodes.debugNode(prevId);\n      error(\"#getNextArc() nextId === prevId\");\n    }\n    return ~nextId; // reverse arc to point onwards\n  }\n\n  return function(startId) {\n    var path = [],\n        nextId, msg,\n        candId = startId,\n        verbose = false;\n\n    do {\n      if (verbose) msg = (nextId === undefined ? \" \" : \"  \" + nextId) + \" -> \" + candId;\n      if (useRoute(candId)) {\n        path.push(candId);\n        nextId = candId;\n        if (verbose) message(msg);\n        candId = getNextArc(nextId);\n        if (verbose && candId == startId ) message(\"  o\", geom.getPlanarPathArea(path, arcs));\n      } else {\n        if (verbose) message(msg + \" x\");\n        return null;\n      }\n\n      if (candId == ~nextId) {\n        trace(\"dead-end\"); // TODO: handle or prevent this error condition\n        return null;\n      }\n    } while (candId != startId);\n    return path.length === 0 ? null : path;\n  };\n};\n\n// types: \"dissolve\" \"flatten\"\n// Returns a function for flattening or dissolving a collection of rings\n// Assumes rings are oriented in CW direction\n//\nMapShaper.getRingIntersector = function(nodes, type, flags, spherical) {\n  var arcs = nodes.arcs;\n  var findPath = MapShaper.getPathFinder(nodes, useRoute, routeIsActive, chooseRoute, spherical);\n  flags = flags || new Uint8Array(arcs.size());\n\n  return function(rings) {\n    var dissolve = type == 'dissolve',\n        openFwd = true,\n        openRev = type == 'flatten',\n        output;\n    // even single rings get transformed (e.g. to remove spikes)\n    if (rings.length > 0) {\n      output = [];\n      MapShaper.openArcRoutes(rings, arcs, flags, openFwd, openRev, dissolve);\n      MapShaper.forEachPath(rings, function(ids) {\n        var path;\n        for (var i=0, n=ids.length; i<n; i++) {\n          path = findPath(ids[i]);\n          if (path) {\n            output.push(path);\n          }\n        }\n      });\n      MapShaper.closeArcRoutes(rings, arcs, flags, openFwd, openRev, true);\n    } else {\n      output = rings;\n    }\n    return output;\n  };\n\n  function chooseRoute(id1, angle1, id2, angle2, prevId) {\n    var route = 1;\n    if (angle1 == angle2) {\n      trace(\"[chooseRoute()] parallel routes, unsure which to choose\");\n      //MapShaper.debugRoute(id1, id2, nodes.arcs);\n    } else if (angle2 < angle1) {\n      route = 2;\n    }\n    return route;\n  }\n\n  function routeIsActive(arcId) {\n    var bits = MapShaper.getRouteBits(arcId, flags);\n    return (bits & 1) == 1;\n  }\n\n  function useRoute(arcId) {\n    var route = MapShaper.getRouteBits(arcId, flags),\n        isOpen = false;\n\n    if (route == 3) {\n      isOpen = true;\n      MapShaper.setRouteBits(1, arcId, flags); // close the path, leave visible\n    }\n\n    return isOpen;\n  }\n};\n\nMapShaper.debugFlags = function(flags) {\n  var arr = [];\n  utils.forEach(flags, function(flag) {\n    arr.push(bitsToString(flag));\n  });\n  message(arr);\n\n  function bitsToString(bits) {\n    var str = \"\";\n    for (var i=0; i<8; i++) {\n      str += (bits & (1 << i)) > 0 ? \"1\" : \"0\";\n      if (i < 7) str += ' ';\n      if (i == 3) str += ' ';\n    }\n    return str;\n  }\n};\n\n/*\n// Print info about two arcs whose first segments are parallel\n//\nMapShaper.debugRoute = function(id1, id2, arcs) {\n  var n1 = arcs.getArcLength(id1),\n      n2 = arcs.getArcLength(id2),\n      len1 = 0,\n      len2 = 0,\n      p1, p2, pp1, pp2, ppp1, ppp2,\n      angle1, angle2;\n\n      console.log(\"chooseRoute() lengths:\", n1, n2, 'ids:', id1, id2);\n  for (var i=0; i<n1 && i<n2; i++) {\n    p1 = arcs.getVertex(id1, i);\n    p2 = arcs.getVertex(id2, i);\n    if (i === 0) {\n      if (p1.x != p2.x || p1.y != p2.y) {\n        error(\"chooseRoute() Routes should originate at the same point)\");\n      }\n    }\n\n    if (i > 1) {\n      angle1 = signedAngle(ppp1.x, ppp1.y, pp1.x, pp1.y, p1.x, p1.y);\n      angle2 = signedAngle(ppp2.x, ppp2.y, pp2.x, pp2.y, p2.x, p2.y);\n\n      console.log(\"angles:\", angle1, angle2, 'lens:', len1, len2);\n      // return;\n    }\n\n    if (i >= 1) {\n      len1 += distance2D(p1.x, p1.y, pp1.x, pp1.y);\n      len2 += distance2D(p2.x, p2.y, pp2.x, pp2.y);\n    }\n\n    if (i == 1 && (n1 == 2 || n2 == 2)) {\n      console.log(\"arc1:\", pp1, p1, \"len:\", len1);\n      console.log(\"arc2:\", pp2, p2, \"len:\", len2);\n    }\n\n    ppp1 = pp1;\n    ppp2 = pp2;\n    pp1 = p1;\n    pp2 = p2;\n  }\n  return 1;\n};\n*/\n\n\n\n\n// Returns a function that separates rings in a polygon into space-enclosing rings\n// and holes. Also fixes self-intersections.\n//\nMapShaper.getHoleDivider = function(nodes, spherical) {\n  var split = MapShaper.getSelfIntersectionSplitter(nodes);\n\n  return function(rings, cw, ccw) {\n    var pathArea = spherical ? geom.getSphericalPathArea : geom.getPlanarPathArea;\n    MapShaper.forEachPath(rings, function(ringIds) {\n      var splitRings = split(ringIds);\n      if (splitRings.length === 0) {\n        trace(\"[getRingDivider()] Defective path:\", ringIds);\n      }\n      splitRings.forEach(function(ringIds, i) {\n        var ringArea = pathArea(ringIds, nodes.arcs);\n        if (ringArea > 0) {\n          cw.push(ringIds);\n        } else if (ringArea < 0) {\n          ccw.push(ringIds);\n        }\n      });\n    });\n  };\n};\n\n\n\n\n// clean polygon or polyline shapes, in-place\n//\nMapShaper.cleanShapes = function(shapes, arcs, type) {\n  for (var i=0, n=shapes.length; i<n; i++) {\n    shapes[i] = MapShaper.cleanShape(shapes[i], arcs, type);\n  }\n};\n\n// Remove defective arcs and zero-area polygon rings\n// Remove simple polygon spikes of form: [..., id, ~id, ...]\n// Don't remove duplicate points\n// Don't check winding order of polygon rings\nMapShaper.cleanShape = function(shape, arcs, type) {\n  return MapShaper.editPaths(shape, function(path) {\n    var cleaned = MapShaper.cleanPath(path, arcs);\n    if (type == 'polygon' && cleaned) {\n      MapShaper.removeSpikesInPath(cleaned); // assumed by divideArcs()\n      if (geom.getPlanarPathArea(cleaned, arcs) === 0) {\n        cleaned = null;\n      }\n    }\n    return cleaned;\n  });\n};\n\nMapShaper.cleanPath = function(path, arcs) {\n  var nulls = 0;\n  for (var i=0, n=path.length; i<n; i++) {\n    if (arcs.arcIsDegenerate(path[i])) {\n      nulls++;\n      path[i] = null;\n    }\n  }\n  return nulls > 0 ? path.filter(function(id) {return id !== null;}) : path;\n};\n\n// Remove pairs of ids where id[n] == ~id[n+1] or id[0] == ~id[n-1];\n// (in place)\nMapShaper.removeSpikesInPath = function(ids) {\n  var n = ids.length;\n  if (n >= 2) {\n    if (ids[0] == ~ids[n-1]) {\n      ids.pop();\n      ids.shift();\n    } else {\n      for (var i=1; i<n; i++) {\n        if (ids[i-1] == ~ids[i]) {\n          ids.splice(i-1, 2);\n          break;\n        }\n      }\n    }\n    if (ids.length < n) {\n      MapShaper.removeSpikesInPath(ids);\n    }\n  }\n};\n\n\n// TODO: Need to rethink polygon repair: these function can cause problems\n// when part of a self-intersecting polygon is removed\n//\nMapShaper.repairPolygonGeometry = function(layers, dataset, opts) {\n  var nodes = MapShaper.divideArcs(dataset);\n  layers.forEach(function(lyr) {\n    MapShaper.repairSelfIntersections(lyr, nodes);\n  });\n  return layers;\n};\n\n// Remove any small shapes formed by twists in each ring\n// // OOPS, NO // Retain only the part with largest area\n// // this causes problems when a cut-off hole has a matching ring in another polygon\n// TODO: consider cases where cut-off parts should be retained\n//\nMapShaper.repairSelfIntersections = function(lyr, nodes) {\n  var splitter = MapShaper.getSelfIntersectionSplitter(nodes);\n\n  lyr.shapes = lyr.shapes.map(function(shp, i) {\n    return cleanPolygon(shp);\n  });\n\n  function cleanPolygon(shp) {\n    var cleanedPolygon = [];\n    MapShaper.forEachPath(shp, function(ids) {\n      // TODO: consider returning null if path can't be split\n      var splitIds = splitter(ids);\n      if (splitIds.length === 0) {\n        error(\"[cleanPolygon()] Defective path:\", ids);\n      } else if (splitIds.length == 1) {\n        cleanedPolygon.push(splitIds[0]);\n      } else {\n        var shapeArea = geom.getPlanarPathArea(ids, nodes.arcs),\n            sign = shapeArea > 0 ? 1 : -1,\n            mainRing;\n\n        var maxArea = splitIds.reduce(function(max, ringIds, i) {\n          var pathArea = geom.getPlanarPathArea(ringIds, nodes.arcs) * sign;\n          if (pathArea > max) {\n            mainRing = ringIds;\n            max = pathArea;\n          }\n          return max;\n        }, 0);\n\n        if (mainRing) {\n          cleanedPolygon.push(mainRing);\n        }\n      }\n    });\n    return cleanedPolygon.length > 0 ? cleanedPolygon : null;\n  }\n};\n\n\n\n\n// Functions for dividing polygons and polygons at points where arc-segments intersect\n\n// Divide a collection of arcs at points where segments intersect\n// and re-index the paths of all the layers that reference the arc collection.\n// (in-place)\nMapShaper.divideArcs = function(dataset) {\n  var arcs = dataset.arcs;\n  T.start();\n  T.start();\n  var snapDist = MapShaper.getHighPrecisionSnapInterval(arcs);\n  var snapCount = MapShaper.snapCoordsByInterval(arcs, snapDist);\n  var dupeCount = arcs.dedupCoords();\n  T.stop('snap points');\n  if (snapCount > 0 || dupeCount > 0) {\n    T.start();\n    // Detect topology again if coordinates have changed\n    api.buildTopology(dataset);\n    T.stop('rebuild topology');\n  }\n\n  // clip arcs at points where segments intersect\n  T.start();\n  var map = MapShaper.insertClippingPoints(arcs);\n  T.stop('insert clipping points');\n  T.start();\n  // update arc ids in arc-based layers and clean up arc geometry\n  // to remove degenerate arcs and duplicate points\n  var nodes = new NodeCollection(arcs);\n  dataset.layers.forEach(function(lyr) {\n    if (MapShaper.layerHasPaths(lyr)) {\n      MapShaper.updateArcIds(lyr.shapes, map, nodes);\n      // TODO: consider alternative -- avoid creating degenerate arcs\n      // in insertClippingPoints()\n      MapShaper.cleanShapes(lyr.shapes, arcs, lyr.geometry_type);\n    }\n  });\n  T.stop('update arc ids / clean geometry');\n  T.stop(\"divide arcs\");\n  return nodes;\n};\n\nMapShaper.updateArcIds = function(shapes, map, nodes) {\n  var arcCount = nodes.arcs.size(),\n      shape2;\n  for (var i=0; i<shapes.length; i++) {\n    shape2 = [];\n    MapShaper.forEachPath(shapes[i], remapPathIds);\n    shapes[i] = shape2;\n  }\n\n  function remapPathIds(ids) {\n    if (!ids) return; // null shape\n    var ids2 = [];\n    for (var j=0; j<ids.length; j++) {\n      remapArcId(ids[j], ids2);\n    }\n    shape2.push(ids2);\n  }\n\n  function remapArcId(id, ids) {\n    var rev = id < 0,\n        absId = rev ? ~id : id,\n        min = map[absId],\n        max = (absId >= map.length - 1 ? arcCount : map[absId + 1]) - 1,\n        id2;\n    do {\n      if (rev) {\n        id2 = ~max;\n        max--;\n      } else {\n        id2 = min;\n        min++;\n      }\n      // If there are duplicate arcs, always use the same one\n      if (nodes) {\n        id2 = nodes.findMatchingArc(id2);\n      }\n      ids.push(id2);\n    } while (max - min >= 0);\n  }\n};\n\n// divide a collection of arcs at points where line segments cross each other\n// @arcs ArcCollection\n// returns array that maps original arc ids to new arc ids\nMapShaper.insertClippingPoints = function(arcs) {\n  var points = MapShaper.findClippingPoints(arcs),\n      p;\n  // TODO: avoid some or all of the following if no points need to be added\n\n  // original arc data\n  var pointTotal0 = arcs.getPointCount(),\n      arcTotal0 = arcs.size(),\n      data = arcs.getVertexData(),\n      xx0 = data.xx,\n      yy0 = data.yy,\n      nn0 = data.nn,\n      i0 = 0,\n      n0, arcLen0;\n\n  // new arc data\n  var pointTotal1 = pointTotal0 + points.length * 2,\n      xx1 = new Float64Array(pointTotal1),\n      yy1 = new Float64Array(pointTotal1),\n      nn1 = [],  // number of arcs may vary\n      i1 = 0,\n      n1;\n\n  var map = new Uint32Array(arcTotal0);\n\n  // sort from last point to first point\n  points.sort(function(a, b) {\n    return b.i - a.i || b.pct - a.pct;\n  });\n  p = points.pop();\n\n  for (var id0=0, id1=0; id0 < arcTotal0; id0++) {\n    arcLen0 = nn0[id0];\n    map[id0] = id1;\n    n0 = 0;\n    n1 = 0;\n    while (n0 < arcLen0) {\n      n1++;\n      xx1[i1] = xx0[i0];\n      yy1[i1++] = yy0[i0];\n      while (p && p.i === i0) {\n        xx1[i1] = p.x;\n        yy1[i1++] = p.y;\n        n1++;\n        nn1[id1++] = n1; // end current arc at intersection\n        n1 = 0;          // begin new arc\n\n        xx1[i1] = p.x;\n        yy1[i1++] = p.y;\n        n1++;\n        p = points.pop();\n      }\n      n0++;\n      i0++;\n    }\n    nn1[id1++] = n1;\n  }\n\n  if (i1 != pointTotal1) error(\"[insertClippingPoints()] Counting error\");\n  arcs.updateVertexData(nn1, xx1, yy1, null);\n\n  // segment-point intersections create duplicate points\n  // TODO: consider removing call to dedupCoords() -- empty arcs are removed by cleanShapes()\n  arcs.dedupCoords();\n  return map;\n};\n\nMapShaper.findClippingPoints = function(arcs) {\n  var intersections = MapShaper.findSegmentIntersections(arcs),\n      data = arcs.getVertexData(),\n      xx = data.xx,\n      yy = data.yy,\n      points = [];\n\n  intersections.forEach(function(o) {\n    var p1 = getSegmentIntersection(o.x, o.y, o.a),\n        p2 = getSegmentIntersection(o.x, o.y, o.b);\n    if (p1) points.push(p1);\n    if (p2) points.push(p2);\n  });\n\n  // remove 1. points that are at arc endpoints and 2. duplicate points\n  // (kludgy -- look into preventing these cases, which are caused by T intersections)\n  var index = {};\n  return points.filter(function(p) {\n    var key = p.i + \",\" + p.pct;\n    if (key in index) return false;\n    index[key] = true;\n    if (p.pct <= 0 && arcs.pointIsEndpoint(p.i) ||\n        p.pct >= 1 && arcs.pointIsEndpoint(p.j)) {\n      return false;\n    }\n    return true;\n  });\n\n  function getSegmentIntersection(x, y, ids) {\n    var i = ids[0],\n        j = ids[1],\n        dx = xx[j] - xx[i],\n        dy = yy[j] - yy[i],\n        pct;\n    if (i > j) error(\"[findClippingPoints()] Out-of-sequence arc ids\");\n    if (dx === 0 && dy === 0) {\n      pct = 0;\n    } else if (Math.abs(dy) > Math.abs(dx)) {\n      pct = (y - yy[i]) / dy;\n    } else {\n      pct = (x - xx[i]) / dx;\n    }\n\n    if (pct < 0 || pct > 1) {\n      verbose(\"[findClippingPoints()] Off-segment intersection (caused by rounding error\");\n      trace(\"pct:\", pct, \"dx:\", dx, \"dy:\", dy, 'x:', x, 'y:', y, 'xx[i]:', xx[i], 'xx[j]:', xx[j], 'yy[i]:', yy[i], 'yy[j]:', yy[j]);\n      trace(\"xpct:\", (x - xx[i]) / dx, 'ypct:', (y - yy[i]) / dy);\n      if (pct < 0) pct = 0;\n      if (pct > 1) pct = 1;\n    }\n\n    return {\n        pct: pct,\n        i: i,\n        j: j,\n        x: x,\n        y: y\n      };\n  }\n};\n\n\n\n\n// List of encodings supported by iconv-lite:\n// https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings\n\n// Return list of supported encodings\nMapShaper.getEncodings = function() {\n  var iconv = require('iconv-lite');\n  iconv.encodingExists('ascii'); // make iconv load its encodings\n  return Object.keys(iconv.encodings);\n};\n\nMapShaper.validateEncoding = function(enc) {\n  if (!MapShaper.encodingIsSupported(enc)) {\n    stop(\"Unknown encoding:\", enc, \"\\nRun the -encodings command see a list of supported encodings\");\n  }\n  return enc;\n};\n\nMapShaper.encodingIsSupported = function(raw) {\n  var enc = MapShaper.standardizeEncodingName(raw);\n  return utils.contains(MapShaper.getEncodings(), enc);\n};\n\n// @buf a Node Buffer\nMapShaper.decodeString = function(buf, encoding) {\n  var iconv = require('iconv-lite'),\n      str = iconv.decode(buf, encoding);\n  // remove BOM if present\n  if (str.charCodeAt(0) == 0xfeff) {\n    str = str.substr(1);\n  }\n  return str;\n};\n\n// Ex. convert UTF-8 to utf8\nMapShaper.standardizeEncodingName = function(enc) {\n  return enc.toLowerCase().replace(/[_-]/g, '');\n};\n\nMapShaper.printEncodings = function() {\n  var encodings = MapShaper.getEncodings().filter(function(name) {\n    // filter out some aliases and non-applicable encodings\n    return !/^(_|cs|internal|ibm|isoir|singlebyte|table|[0-9]|l[0-9]|windows)/.test(name);\n  });\n  encodings.sort();\n  message(\"Supported encodings:\");\n  message(MapShaper.formatStringsAsGrid(encodings));\n};\n\n\n\n\n// Try to detect the encoding of some sample text.\n// Returns an encoding name or null.\n// @samples Array of buffers containing sample text fields\n// TODO: Improve reliability and number of detectable encodings.\nMapShaper.detectEncoding = function(samples) {\n  var encoding = null;\n  if (MapShaper.looksLikeUtf8(samples)) {\n    encoding = 'utf8';\n  } else if (MapShaper.looksLikeWin1252(samples)) {\n    // Win1252 is the same as Latin1, except it replaces a block of control\n    // characters with n-dash, Euro and other glyphs. Encountered in-the-wild\n    // in Natural Earth (airports.dbf uses n-dash).\n    encoding = 'win1252';\n  }\n  return encoding;\n};\n\n// Convert an array of text samples to a single string using a given encoding\nMapShaper.decodeSamples = function(enc, samples) {\n  return samples.map(function(buf) {\n    return MapShaper.decodeString(buf, enc).trim();\n  }).join('\\n');\n};\n\nMapShaper.formatSamples = function(str) {\n  return MapShaper.formatStringsAsGrid(str.split('\\n'));\n};\n\n// Quick-and-dirty win1251 detection: decoded string contains mostly common ascii\n// chars and almost no chars other than word chars + punctuation.\n// This excludes encodings like Greek, Cyrillic or Thai, but\n// is susceptible to false positives with encodings like codepage 1250 (\"Eastern\n// European\").\nMapShaper.looksLikeWin1252 = function(samples) {\n  var ascii = 'abcdefghijklmnopqrstuvwxyz0123456789.\\'\"?+-\\n,:;/|_$% ', //common l.c. ascii chars\n      extended = 'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ°–', // common extended\n      str = MapShaper.decodeSamples('win1252', samples),\n      asciiScore = MapShaper.getCharScore(str, ascii),\n      totalScore = MapShaper.getCharScore(str, extended + ascii);\n  return totalScore > 0.97 && asciiScore > 0.7;\n};\n\n// Accept string if it doesn't contain the \"replacement character\"\nMapShaper.looksLikeUtf8 = function(samples) {\n  var str = MapShaper.decodeSamples('utf8', samples);\n  return str.indexOf('\\ufffd') == -1;\n};\n\n// Calc percentage of chars in a string that are present in a second string\n// @chars String of chars to look for in @str\nMapShaper.getCharScore = function(str, chars) {\n  var index = {},\n      count = 0,\n      score;\n  str = str.toLowerCase();\n  for (var i=0, n=chars.length; i<n; i++) {\n    index[chars[i]] = 1;\n  }\n  for (i=0, n=str.length; i<n; i++) {\n    count += index[str[i]] || 0;\n  }\n  return count / str.length;\n};\n\n\n\n\n\nMapShaper.deleteFields = function(table, test) {\n  table.getFields().forEach(function(name) {\n    if (test(name)) {\n      table.deleteField(name);\n    }\n  });\n};\n\nMapShaper.isInvalidFieldName = function(f) {\n  // Reject empty and all-whitespace strings. TODO: consider other criteria\n  return /^\\s*$/.test(f);\n};\n\n// Resolve name conflicts in field names by appending numbers\n// @fields Array of field names\n// @maxLen (optional) Maximum chars in name\n//\nMapShaper.getUniqFieldNames = function(fields, maxLen) {\n  var used = {};\n  return fields.map(function(name) {\n    var i = 0,\n        validName;\n    do {\n      validName = MapShaper.adjustFieldName(name, maxLen, i);\n      i++;\n    } while (validName in used);\n    used[validName] = true;\n    return validName;\n  });\n};\n\n// Truncate and/or uniqify a name (if relevant params are present)\nMapShaper.adjustFieldName = function(name, maxLen, i) {\n  var name2, suff;\n  maxLen = maxLen || 256;\n  if (!i) {\n    name2 = name.substr(0, maxLen);\n  } else {\n    suff = String(i);\n    if (suff.length == 1) {\n      suff = '_' + suff;\n    }\n    name2 = name.substr(0, maxLen - suff.length) + suff;\n  }\n  return name2;\n};\n\n\n\n\n// DBF format references:\n// http://www.dbf2002.com/dbf-file-format.html\n// http://www.digitalpreservation.gov/formats/fdd/fdd000325.shtml\n// http://www.clicketyclick.dk/databases/xbase/format/index.html\n// http://www.clicketyclick.dk/databases/xbase/format/data_types.html\n\nvar Dbf = {};\n\n// source: http://webhelp.esri.com/arcpad/8.0/referenceguide/index.htm#locales/task_code.htm\nDbf.languageIds = [0x01,'437',0x02,'850',0x03,'1252',0x08,'865',0x09,'437',0x0A,'850',0x0B,'437',0x0D,'437',0x0E,'850',0x0F,'437',0x10,'850',0x11,'437',0x12,'850',0x13,'932',0x14,'850',0x15,'437',0x16,'850',0x17,'865',0x18,'437',0x19,'437',0x1A,'850',0x1B,'437',0x1C,'863',0x1D,'850',0x1F,'852',0x22,'852',0x23,'852',0x24,'860',0x25,'850',0x26,'866',0x37,'850',0x40,'852',0x4D,'936',0x4E,'949',0x4F,'950',0x50,'874',0x57,'1252',0x58,'1252',0x59,'1252',0x64,'852',0x65,'866',0x66,'865',0x67,'861',0x6A,'737',0x6B,'857',0x6C,'863',0x78,'950',0x79,'949',0x7A,'936',0x7B,'932',0x7C,'874',0x86,'737',0x87,'852',0x88,'857',0xC8,'1250',0xC9,'1251',0xCA,'1254',0xCB,'1253',0xCC,'1257'];\n\n// Language & Language family names for some code pages\nDbf.encodingNames = {\n  '932': \"Japanese\",\n  '936': \"Simplified Chinese\",\n  '950': \"Traditional Chinese\",\n  '1252': \"Western European\",\n  '949': \"Korean\",\n  '874': \"Thai\",\n  '1250': \"Eastern European\",\n  '1251': \"Russian\",\n  '1254': \"Turkish\",\n  '1253': \"Greek\",\n  '1257': \"Baltic\"\n};\n\nDbf.ENCODING_PROMPT =\n  \"To avoid corrupted text, re-import using the \\\"encoding=\\\" option.\\n\" +\n  \"To see a list of supported encodings, run the \\\"encodings\\\" command.\";\n\nDbf.lookupCodePage = function(lid) {\n  var i = Dbf.languageIds.indexOf(lid);\n  return i == -1 ? null : Dbf.languageIds[i+1];\n};\n\nDbf.readAsciiString = function(bin, size) {\n  var require7bit = Env.inNode;\n  var str = bin.readCString(size, require7bit);\n  if (str === null) {\n    stop(\"DBF file contains non-ascii text.\\n\" + Dbf.ENCODING_PROMPT);\n  }\n  return utils.trim(str);\n};\n\nDbf.readStringBytes = function(bin, size, buf) {\n  var count = 0, c;\n  for (var i=0; i<size; i++) {\n    c = bin.readUint8();\n    if (c === 0) break; // C string-terminator (observed in-the-wild)\n    if (count > 0 || c != 32) { // ignore leading spaces (e.g. DBF numbers)\n      buf[count++] = c;\n    }\n  }\n  // ignore trailing spaces (DBF string fields are typically r-padded w/ spaces)\n  while (count > 0 && buf[count-1] == 32) {\n    count--;\n  }\n  return count;\n};\n\nDbf.getAsciiStringReader = function() {\n  var buf = new Uint8Array(256); // new Buffer(256);\n  return function readAsciiString(bin, size) {\n    var str = '',\n        n = Dbf.readStringBytes(bin, size, buf);\n    for (var i=0; i<n; i++) {\n      str += String.fromCharCode(buf[i]);\n    }\n    return str;\n  };\n};\n\nDbf.getEncodedStringReader = function(encoding) {\n  var buf = new Buffer(256),\n      isUtf8 = MapShaper.standardizeEncodingName(encoding) == 'utf8';\n  return function readEncodedString(bin, size) {\n    var i = Dbf.readStringBytes(bin, size, buf),\n        str;\n    if (i === 0) {\n      str = '';\n    } else if (isUtf8) {\n      str = buf.toString('utf8', 0, i);\n    } else {\n      str = MapShaper.decodeString(buf.slice(0, i), encoding); // slice references same memory\n    }\n    return str;\n  };\n};\n\nDbf.getStringReader = function(encoding) {\n  if (!encoding || encoding === 'ascii') {\n    return Dbf.getAsciiStringReader();\n    // return Dbf.readAsciiString;\n  } else if (Env.inNode) {\n    return Dbf.getEncodedStringReader(encoding);\n  } else {\n    // TODO: user browserify or other means of decoding string data in the browser\n    error(\"[Dbf.getStringReader()] Non-ascii encodings only supported in Node.\");\n  }\n};\n\nDbf.bufferContainsHighBit = function(buf, n) {\n  for (var i=0; i<n; i++) {\n    if (buf[i] >= 128) return true;\n  }\n  return false;\n};\n\nDbf.getNumberReader = function() {\n  var read = Dbf.getAsciiStringReader();\n  return function readNumber(bin, size) {\n    var str = read(bin, size);\n    var val;\n    if (str.indexOf(',') >= 0) {\n      str = str.replace(',', '.'); // handle comma decimal separator\n    }\n    val = parseFloat(str);\n    return isNaN(val) ? null : val;\n  };\n};\n\nDbf.readInt = function(bin, size) {\n  return bin.readInt32();\n};\n\nDbf.readBool = function(bin, size) {\n  var c = bin.readCString(size),\n      val = null;\n  if (/[ty]/i.test(c)) val = true;\n  else if (/[fn]/i.test(c)) val = false;\n  return val;\n};\n\nDbf.readDate = function(bin, size) {\n  var str = bin.readCString(size),\n      yr = str.substr(0, 4),\n      mo = str.substr(4, 2),\n      day = str.substr(6, 2);\n  return new Date(Date.UTC(+yr, +mo - 1, +day));\n};\n\n// cf. http://code.google.com/p/stringencoding/\n//\n// @src is a Buffer or ArrayBuffer or filename\n//\nfunction DbfReader(src, encodingArg) {\n  if (utils.isString(src)) {\n    error(\"[DbfReader] Expected a buffer, not a string\");\n  }\n  var bin = new BinArray(src);\n  var header = readHeader(bin);\n  var encoding = encodingArg || null;\n\n  this.size = function() {return header.recordCount;};\n\n  this.readRow = function(i) {\n    // create record reader on-the-fly\n    // (delays encoding detection until we need to read data)\n    return getRecordReader(header.fields)(i);\n  };\n\n  this.getFields = getFieldNames;\n\n  this.getBuffer = function() {return bin.buffer();};\n\n  this.deleteField = function(f) {\n    header.fields = header.fields.filter(function(field) {\n      return field.name != f;\n    });\n  };\n\n  this.readRows = function() {\n    var reader = getRecordReader(header.fields);\n    var data = [];\n    for (var r=0, n=this.size(); r<n; r++) {\n      data.push(reader(r));\n    }\n    return data;\n  };\n\n  function readHeader(bin) {\n    bin.position(0).littleEndian();\n    var header = {\n      version: bin.readInt8(),\n      updateYear: bin.readUint8(),\n      updateMonth: bin.readUint8(),\n      updateDay: bin.readUint8(),\n      recordCount: bin.readUint32(),\n      dataOffset: bin.readUint16(),\n      recordSize: bin.readUint16(),\n      incompleteTransaction: bin.skipBytes(2).readUint8(),\n      encrypted: bin.readUint8(),\n      mdx: bin.skipBytes(12).readUint8(),\n      ldid: bin.readUint8()\n    };\n    var colOffs = 1; // first column starts on second byte of record\n    var field;\n    bin.skipBytes(2);\n    header.fields = [];\n\n    // Detect header terminator (LF is standard, CR has been seen in the wild)\n    while (bin.peek() != 0x0D && bin.peek() != 0x0A && bin.position() < header.dataOffset - 1) {\n      field = readFieldHeader(bin);\n      field.columnOffset = colOffs;\n      header.fields.push(field);\n      colOffs += field.size;\n    }\n    if (colOffs != header.recordSize) {\n      error(\"Record length mismatch; header:\", header.recordSize, \"detected:\", colOffs);\n    }\n    if (bin.peek() != 0x0D) {\n      message('[dbf] Found a non-standard header terminator (' + bin.peek() + '). DBF file may be corrupted.');\n    }\n\n    // Uniqify header names\n    MapShaper.getUniqFieldNames(utils.pluck(header.fields, 'name')).forEach(function(name2, i) {\n      header.fields[i].name = name2;\n    });\n\n    return header;\n  }\n\n  function readFieldHeader(bin) {\n    return {\n      name: bin.readCString(11),\n      type: String.fromCharCode(bin.readUint8()),\n      address: bin.readUint32(),\n      size: bin.readUint8(),\n      decimals: bin.readUint8(),\n      id: bin.skipBytes(2).readUint8(),\n      position: bin.skipBytes(2).readUint8(),\n      indexFlag: bin.skipBytes(7).readUint8()\n    };\n  }\n\n  function getFieldNames() {\n    return utils.pluck(header.fields, 'name');\n  }\n\n  function getRowOffset(r) {\n    return header.dataOffset + header.recordSize * r;\n  }\n\n  function getEncoding() {\n    if (!encoding) {\n      encoding = findStringEncoding();\n      if (!encoding) {\n        // fall back to utf8 if detection fails (so GUI can continue without further errors)\n        encoding = 'utf8';\n        stop(\"Unable to auto-detect the text encoding of the DBF file.\\n\" + Dbf.ENCODING_PROMPT);\n      }\n    }\n    return encoding;\n  }\n\n  // Create new record objects using object literal syntax\n  // (Much faster in v8 and other engines than assigning a series of properties\n  //  to an object)\n  function getRecordConstructor() {\n    var args = getFieldNames().map(function(name, i) {\n          return JSON.stringify(name) + ': arguments[' + i + ']';\n        });\n    return new Function('return {' + args.join(',') + '};');\n  }\n\n  function findEofPos(bin) {\n    var pos = bin.size() - 1;\n    if (bin.peek(pos) != 0x1A) { // last byte may or may not be EOF\n      pos++;\n    }\n    return pos;\n  }\n\n  function getRecordReader(fields) {\n    var readers = fields.map(getFieldReader),\n        eofOffs = findEofPos(bin),\n        create = getRecordConstructor(),\n        values = [];\n\n    return function readRow(r) {\n      var offs = getRowOffset(r),\n          fieldOffs, field;\n      for (var c=0, cols=fields.length; c<cols; c++) {\n        field = fields[c];\n        fieldOffs = offs + field.columnOffset;\n        if (fieldOffs + field.size > eofOffs) {\n          stop('[dbf] Invalid DBF file: encountered end-of-file while reading data');\n        }\n        bin.position(fieldOffs);\n        values[c] = readers[c](bin, field.size);\n      }\n      return create.apply(null, values);\n    };\n  }\n\n  // @f Field metadata from dbf header\n  function getFieldReader(f) {\n    var type = f.type,\n        r = null;\n    if (type == 'I') {\n      r = Dbf.readInt;\n    } else if (type == 'F' || type == 'N') {\n      r = Dbf.getNumberReader();\n    } else if (type == 'L') {\n      r = Dbf.readBool;\n    } else if (type == 'D') {\n      r = Dbf.readDate;\n    } else if (type == 'C') {\n      r = Dbf.getStringReader(getEncoding());\n    } else {\n      message(\"[dbf] Field \\\"\" + field.name + \"\\\" has an unsupported type (\" + field.type + \") -- converting to null values\");\n      r = function() {return null;};\n    }\n    return r;\n  }\n\n  function findStringEncoding() {\n    var ldid = header.ldid,\n        codepage = Dbf.lookupCodePage(ldid),\n        samples = getNonAsciiSamples(50),\n        only7bit = samples.length === 0,\n        encoding, msg;\n\n    // First, check the ldid (language driver id) (an obsolete way to specify which\n    // codepage to use for text encoding.)\n    // ArcGIS up to v.10.1 sets ldid and encoding based on the 'locale' of the\n    // user's Windows system :P\n    //\n    if (codepage && ldid != 87) {\n      // if 8-bit data is found and codepage is detected, use the codepage,\n      // except ldid 87, which some GIS software uses regardless of encoding.\n      encoding = codepage;\n    } else if (only7bit) {\n      // Text with no 8-bit chars should be compatible with 7-bit ascii\n      // (Most encodings are supersets of ascii)\n      encoding = 'ascii';\n    }\n\n    // As a last resort, try to guess the encoding:\n    if (!encoding) {\n      encoding = MapShaper.detectEncoding(samples);\n    }\n\n    // Show a sample of decoded text if non-ascii-range text has been found\n    if (encoding && samples.length > 0) {\n      msg = \"Detected DBF text encoding: \" + encoding;\n      if (encoding in Dbf.encodingNames) {\n        msg += \" (\" + Dbf.encodingNames[encoding] + \")\";\n      }\n      message(msg);\n      msg = MapShaper.decodeSamples(encoding, samples);\n      msg = MapShaper.formatStringsAsGrid(msg.split('\\n'));\n      message(\"Sample text containing non-ascii characters:\" + (msg.length > 60 ? '\\n' : '') + msg);\n    }\n    return encoding;\n  }\n\n  // Return up to @size buffers containing text samples\n  // with at least one byte outside the 7-bit ascii range.\n  function getNonAsciiSamples(size) {\n    var samples = [];\n    var stringFields = header.fields.filter(function(f) {\n      return f.type == 'C';\n    });\n    var buf = new Buffer(256);\n    var index = {};\n    var f, chars, sample, hash;\n    for (var r=0, rows=header.recordCount; r<rows; r++) {\n      for (var c=0, cols=stringFields.length; c<cols; c++) {\n        if (samples.length >= size) break;\n        f = stringFields[c];\n        bin.position(getRowOffset(r) + f.columnOffset);\n        chars = Dbf.readStringBytes(bin, f.size, buf);\n        if (chars > 0 && Dbf.bufferContainsHighBit(buf, chars)) {\n          sample = new Buffer(buf.slice(0, chars)); //\n          hash = sample.toString('hex');\n          if (hash in index === false) { // avoid duplicate samples\n            index[hash] = true;\n            samples.push(sample);\n          }\n        }\n      }\n    }\n    return samples;\n  }\n\n}\n\n\n\n\nDbf.MAX_STRING_LEN = 254;\n\nDbf.exportRecords = function(arr, encoding) {\n  encoding = encoding || 'ascii';\n  var fields = Dbf.getFieldNames(arr);\n  var uniqFields = MapShaper.getUniqFieldNames(fields, 10);\n  var rows = arr.length;\n  var fieldData = fields.map(function(name) {\n    return Dbf.getFieldInfo(arr, name, encoding);\n  });\n\n  var headerBytes = Dbf.getHeaderSize(fieldData.length),\n      recordBytes = Dbf.getRecordSize(utils.pluck(fieldData, 'size')),\n      fileBytes = headerBytes + rows * recordBytes + 1;\n\n  var buffer = new ArrayBuffer(fileBytes);\n  var bin = new BinArray(buffer).littleEndian();\n  var now = new Date();\n\n  // write header\n  bin.writeUint8(3);\n  bin.writeUint8(now.getFullYear() - 1900);\n  bin.writeUint8(now.getMonth() + 1);\n  bin.writeUint8(now.getDate());\n  bin.writeUint32(rows);\n  bin.writeUint16(headerBytes);\n  bin.writeUint16(recordBytes);\n  bin.skipBytes(17);\n  bin.writeUint8(0); // language flag; TODO: improve this\n  bin.skipBytes(2);\n\n  // field subrecords\n  fieldData.reduce(function(recordOffset, obj, i) {\n    var fieldName = uniqFields[i];\n    bin.writeCString(fieldName, 11);\n    bin.writeUint8(obj.type.charCodeAt(0));\n    bin.writeUint32(recordOffset);\n    bin.writeUint8(obj.size);\n    bin.writeUint8(obj.decimals);\n    bin.skipBytes(14);\n    return recordOffset + obj.size;\n  }, 1);\n\n  bin.writeUint8(0x0d); // \"field descriptor terminator\"\n  if (bin.position() != headerBytes) {\n    error(\"Dbf#exportRecords() header size mismatch; expected:\", headerBytes, \"written:\", bin.position());\n  }\n\n  arr.forEach(function(rec, i) {\n    var start = bin.position();\n    bin.writeUint8(0x20); // delete flag; 0x20 valid 0x2a deleted\n    for (var j=0, n=fieldData.length; j<n; j++) {\n      fieldData[j].write(i, bin);\n    }\n    if (bin.position() - start != recordBytes) {\n      error(\"#exportRecords() Error exporting record:\", rec);\n    }\n  });\n\n  bin.writeUint8(0x1a); // end-of-file\n\n  if (bin.position() != fileBytes) {\n    error(\"Dbf#exportRecords() file size mismatch; expected:\", fileBytes, \"written:\", bin.position());\n  }\n  return buffer;\n};\n\n\nDbf.getFieldNames = function(records) {\n  if (!records || !records.length) {\n    return [];\n  }\n  var names = Object.keys(records[0]);\n  names.sort(); // kludge: sorting gives correct order when truncating fields\n  return names;\n};\n\n\nDbf.getHeaderSize = function(numFields) {\n  return 33 + numFields * 32;\n};\n\nDbf.getRecordSize = function(fieldSizes) {\n  return utils.sum(fieldSizes) + 1; // delete byte plus data bytes\n};\n\n/*\nDbf.getValidFieldName = function(name) {\n  // TODO: handle non-ascii chars in name\n  return name.substr(0, 10); // max 10 chars\n};\n*/\n\nDbf.initNumericField = function(info, arr, name) {\n  var MAX_FIELD_SIZE = 18,\n      size;\n\n  data = this.getNumericFieldInfo(arr, name);\n  info.decimals = data.decimals;\n  size = Math.max(data.max.toFixed(info.decimals).length,\n      data.min.toFixed(info.decimals).length);\n  if (size > MAX_FIELD_SIZE) {\n    size = MAX_FIELD_SIZE;\n    info.decimals -= size - MAX_FIELD_SIZE;\n    if (info.decimals < 0) {\n      error (\"Dbf#getFieldInfo() Out-of-range error.\");\n    }\n  }\n  info.size = size;\n\n  var formatter = Dbf.getDecimalFormatter(size, info.decimals);\n  info.write = function(i, bin) {\n    var rec = arr[i],\n        str = formatter(rec[name]);\n    if (str.length < size) {\n      str = utils.lpad(str, size, ' ');\n    }\n    bin.writeString(str, size);\n  };\n};\n\nDbf.initBooleanField = function(info, arr, name) {\n  info.size = 1;\n  info.write = function(i, bin) {\n    var val = arr[i][name],\n        c;\n    if (val === true) c = 'T';\n    else if (val === false) c = 'F';\n    else c = '?';\n    bin.writeString(c);\n  };\n};\n\nDbf.initDateField = function(info, arr, name) {\n  info.size = 8;\n  info.write = function(i, bin) {\n    var d = arr[i][name],\n        str;\n    if (d instanceof Date === false) {\n      str = '00000000';\n    } else {\n      str = utils.lpad(d.getUTCFullYear(), 4, '0') +\n            utils.lpad(d.getUTCMonth() + 1, 2, '0') +\n            utils.lpad(d.getUTCDate(), 2, '0');\n    }\n    bin.writeString(str);\n  };\n};\n\nDbf.initStringField = function(info, arr, name, encoding) {\n  var formatter = Dbf.getStringWriter(encoding);\n  var size = 0;\n  var values = arr.map(function(rec) {\n    var buf = formatter(rec[name]);\n    size = Math.max(size, buf.byteLength);\n    return buf;\n  });\n  info.size = size;\n  info.write = function(i, bin) {\n    var buf = values[i],\n        bytes = Math.min(size, buf.byteLength),\n        idx = bin.position();\n    bin.writeBuffer(buf, bytes, 0);\n    bin.position(idx + size);\n  };\n};\n\nDbf.getFieldInfo = function(arr, name, encoding) {\n  var type = this.discoverFieldType(arr, name),\n      info = {\n        name: name,\n        type: type,\n        decimals: 0\n      };\n  if (type == 'N') {\n    Dbf.initNumericField(info, arr, name);\n  } else if (type == 'C') {\n    Dbf.initStringField(info, arr, name, encoding);\n  } else if (type == 'L') {\n    Dbf.initBooleanField(info, arr, name);\n  } else if (type == 'D') {\n    Dbf.initDateField(info, arr, name);\n  } else {\n    // Treat null fields as empty numeric fields; this way, they will be imported\n    // again as nulls.\n    info.size = 0;\n    info.type = 'N';\n    info.write = function() {};\n  }\n  return info;\n};\n\nDbf.discoverFieldType = function(arr, name) {\n  var val;\n  for (var i=0, n=arr.length; i<n; i++) {\n    val = arr[i][name];\n    if (utils.isString(val)) return \"C\";\n    if (utils.isNumber(val)) return \"N\";\n    if (utils.isBoolean(val)) return \"L\";\n    if (val instanceof Date) return \"D\";\n  }\n  return null;\n};\n\nDbf.getDecimalFormatter = function(size, decimals) {\n  // TODO: find better way to handle nulls\n  var nullValue = ' '; // ArcGIS may use 0\n  return function(val) {\n    // TODO: handle invalid values better\n    var valid = utils.isFiniteNumber(val),\n        strval = valid ? val.toFixed(decimals) : String(nullValue);\n    return utils.lpad(strval, size, ' ');\n  };\n};\n\nDbf.getNumericFieldInfo = function(arr, name) {\n  var maxDecimals = 0,\n      limit = 15,\n      min = Infinity,\n      max = -Infinity,\n      k = 1,\n      val, decimals;\n  for (var i=0, n=arr.length; i<n; i++) {\n    val = arr[i][name];\n    if (!utils.isFiniteNumber(val)) {\n      continue;\n    }\n    decimals = 0;\n    if (val < min) min = val;\n    if (val > max) max = val;\n    while (val * k % 1 !== 0) {\n      if (decimals == limit) {\n        // TODO: verify limit, remove oflo message, round overflowing values\n        // trace (\"#getNumericFieldInfo() Number field overflow; value:\", val);\n        break;\n      }\n      decimals++;\n      k *= 10;\n    }\n    if (decimals > maxDecimals) maxDecimals = decimals;\n  }\n  return {\n    decimals: maxDecimals,\n    min: min,\n    max: max\n  };\n};\n\n// Return function to convert a JS str to an ArrayBuffer containing encoded str.\nDbf.getStringWriter = function(encoding) {\n  if (encoding === 'ascii') {\n    return Dbf.getStringWriterAscii();\n  } else {\n    return Dbf.getStringWriterEncoded(encoding);\n  }\n};\n\n// TODO: handle non-ascii chars. Option: switch to\n// utf8 encoding if non-ascii chars are found.\nDbf.getStringWriterAscii = function() {\n  return function(val) {\n    var str = String(val),\n        n = Math.min(str.length, Dbf.MAX_STRING_LEN),\n        dest = new ArrayBuffer(n),\n        view = new Uint8ClampedArray(dest);\n    for (var i=0; i<n; i++) {\n      view[i] = str.charCodeAt(i);\n    }\n    return dest;\n  };\n};\n\nDbf.getStringWriterEncoded = function(encoding) {\n  var iconv = require('iconv-lite');\n  return function(val) {\n    var buf = iconv.encode(val, encoding);\n    if (buf.length >= Dbf.MAX_STRING_LEN) {\n      buf = Dbf.truncateEncodedString(buf, encoding, Dbf.MAX_STRING_LEN);\n    }\n    return BinArray.toArrayBuffer(buf);\n  };\n};\n\n// try to remove partial multi-byte characters from the end of an encoded string.\nDbf.truncateEncodedString = function(buf, encoding, maxLen) {\n  var truncated = buf.slice(0, maxLen);\n  var len = maxLen;\n  var tmp, str;\n  while (len > 0 && len >= maxLen - 3) {\n    tmp = len == maxLen ? truncated : buf.slice(0, len);\n    str = MapShaper.decodeString(tmp, encoding);\n    if (str.charAt(str.length-1) != '\\ufffd') {\n      truncated = tmp;\n      break;\n    }\n    len--;\n  }\n  return truncated;\n};\n\n\n\n\nvar dataFieldRxp = /^[a-zA-Z_][a-zA-Z_0-9]*$/;\n\nfunction DataTable(obj) {\n  var records;\n  if (utils.isArray(obj)) {\n    records = obj;\n  } else {\n    records = [];\n    // integer object: create empty records\n    if (utils.isInteger(obj)) {\n      for (var i=0; i<obj; i++) {\n        records.push({});\n      }\n    } else if (obj) {\n      error(\"[DataTable] Invalid constructor argument:\", obj);\n    }\n  }\n\n  this.exportAsDbf = function(encoding) {\n    return Dbf.exportRecords(records, encoding);\n  };\n\n  this.getRecords = function() {\n    return records;\n  };\n\n  this.getRecordAt = function(i) {\n    return records[i];\n  };\n}\n\nvar dataTableProto = {\n  fieldExists: function(name) {\n    return utils.contains(this.getFields(), name);\n  },\n\n  exportAsJSON: function() {\n    return JSON.stringify(this.getRecords());\n  },\n\n  addField: function(name, init) {\n    var useFunction = utils.isFunction(init);\n    if (!utils.isNumber(init) && !utils.isString(init) && !useFunction) {\n      error(\"DataTable#addField() requires a string, number or function for initialization\");\n    }\n    if (this.fieldExists(name)) error(\"DataTable#addField() tried to add a field that already exists:\", name);\n    if (!dataFieldRxp.test(name)) error(\"DataTable#addField() invalid field name:\", name);\n\n    this.getRecords().forEach(function(obj, i) {\n      obj[name] = useFunction ? init(obj, i) : init;\n    });\n  },\n\n  addIdField: function() {\n    this.addField('FID', function(obj, i) {\n      return i;\n    });\n  },\n\n  deleteField: function(f) {\n    this.getRecords().forEach(function(o) {\n      delete o[f];\n    });\n  },\n\n  getFields: function() {\n    var records = this.getRecords(),\n        first = records[0];\n    return first ? Object.keys(first) : [];\n  },\n\n  update: function(f) {\n    var records = this.getRecords();\n    for (var i=0, n=records.length; i<n; i++) {\n      records[i] = f(records[i], i);\n    }\n  },\n\n  clone: function() {\n    // TODO: this could be sped up using a record constructor function\n    // (see getRecordConstructor() in DbfReader)\n    var records2 = this.getRecords().map(function(rec) {\n      return utils.extend({}, rec);\n    });\n    return new DataTable(records2);\n  },\n\n  size: function() {\n    return this.getRecords().length;\n  }\n};\n\nutils.extend(DataTable.prototype, dataTableProto);\n\n\n\n\n// Return a function to convert original feature ids into ids of combined features\n// Use categorical classification (a different id for each unique value)\nMapShaper.getCategoryClassifier = function(field, data) {\n  if (!field) return function(i) {return 0;};\n  if (!data || !data.fieldExists(field)) {\n    stop(\"[dissolve] Data table is missing field:\", field);\n  }\n  var index = {},\n      count = 0,\n      records = data.getRecords();\n  return function(i) {\n    var val = String(records[i][field]);\n    if (val in index === false) {\n      index[val] = count++;\n    }\n    return index[val];\n  };\n};\n\n// Return a properties array for a set of aggregated features\n//\n// @properties input records\n// @getGroupId()  converts input record id to id of aggregated record\n//\nMapShaper.aggregateDataRecords = function(properties, getGroupId, opts) {\n  var arr = [];\n  var sumFields = opts.sum_fields || [],\n      copyFields = opts.copy_fields || [];\n\n  if (opts.field) {\n    copyFields.push(opts.field);\n  }\n\n  properties.forEach(function(rec, i) {\n    if (!rec) return;\n    var idx = getGroupId(i),\n        dissolveRec;\n\n    if (idx in arr) {\n      dissolveRec = arr[idx];\n    } else {\n      arr[idx] = dissolveRec = {};\n      copyFields.forEach(function(f) {\n        dissolveRec[f] = rec[f];\n      });\n    }\n\n    sumFields.forEach(function(f) {\n      // TODO: handle strings\n      dissolveRec[f] = (rec[f] || 0) + (dissolveRec[f] || 0);\n    });\n  });\n  return arr;\n};\n\n\n\n\nMapShaper.simplifyArcsFast = function(arcs, dist) {\n  var xx = [],\n      yy = [],\n      nn = [],\n      count;\n  for (var i=0, n=arcs.size(); i<n; i++) {\n    count = MapShaper.simplifyPathFast([i], arcs, dist, xx, yy);\n    if (count == 1) {\n      count = 0;\n      xx.pop();\n      yy.pop();\n    }\n    nn.push(count);\n  }\n  return new ArcCollection(nn, xx, yy);\n};\n\nMapShaper.simplifyPolygonFast = function(shp, arcs, dist) {\n  if (!shp || !dist) return null;\n  var xx = [],\n      yy = [],\n      nn = [],\n      shp2 = [];\n\n  shp.forEach(function(path) {\n    var count = MapShaper.simplifyPathFast(path, arcs, dist, xx, yy);\n    while (count < 4 && count > 0) {\n      xx.pop();\n      yy.pop();\n      count--;\n    }\n    if (count > 0) {\n      shp2.push([nn.length]);\n      nn.push(count);\n    }\n  });\n  return {\n    shape: shp2.length > 0 ? shp2 : null,\n    arcs: new ArcCollection(nn, xx, yy)\n  };\n};\n\nMapShaper.simplifyPathFast = function(path, arcs, dist, xx, yy) {\n  var iter = arcs.getShapeIter(path),\n      count = 0,\n      prevX, prevY, x, y;\n  while (iter.hasNext()) {\n    x = iter.x;\n    y = iter.y;\n    if (count === 0 || distance2D(x, y, prevX, prevY) > dist) {\n      xx.push(x);\n      yy.push(y);\n      prevX = x;\n      prevY = y;\n      count++;\n    }\n  }\n  if (x != prevX || y != prevY) {\n    xx.push(x);\n    yy.push(y);\n    count++;\n  }\n  return count;\n};\n\n\n\n\n// Get the centroid of the largest ring of a polygon\n// TODO: Include holes in the calculation\n// TODO: Add option to find centroid of all rings, not just the largest\ngeom.getShapeCentroid = function(shp, arcs) {\n  var maxPath = geom.getMaxPath(shp, arcs);\n  return maxPath ? geom.getPathCentroid(maxPath, arcs) : null;\n};\n\ngeom.getPathCentroid = function(ids, arcs) {\n  var iter = arcs.getShapeIter(ids),\n      sum = 0,\n      sumX = 0,\n      sumY = 0,\n      ax, ay, tmp, area;\n  if (!iter.hasNext()) return null;\n  ax = iter.x;\n  ay = iter.y;\n  while (iter.hasNext()) {\n    tmp = ax * iter.y - ay * iter.x;\n    sum += tmp;\n    sumX += tmp * (iter.x + ax);\n    sumY += tmp * (iter.y + ay);\n    ax = iter.x;\n    ay = iter.y;\n  }\n  area = sum / 2;\n  if (area === 0) {\n    return geom.getAvgPathXY(ids, arcs);\n  } else return {\n    x: sumX / (6 * area),\n    y: sumY / (6 * area)\n  };\n};\n\n// Find a point inside a polygon and located away from the polygon edge\n// Method:\n// - get the largest ring of the polygon\n// - get an array of x-values distributed along the horizontal extent of the ring\n// - for each x:\n//     intersect a vertical line with the polygon at x\n//     find midpoints of each intersecting segment\n// - for each midpoint:\n//     adjust point vertically to maximize weighted distance from polygon edge\n// - return the adjusted point having the maximum weighted distance from the edge\n//\n// (distance is weighted to slightly favor points near centroid)\n//\ngeom.findInteriorPoint = function(shp, arcs) {\n  var maxPath = shp && geom.getMaxPath(shp, arcs),\n      pathBounds = maxPath && arcs.getSimpleShapeBounds(maxPath),\n      thresh, simple;\n  if (!pathBounds || !pathBounds.hasBounds() || pathBounds.area() === 0) {\n    return null;\n  }\n  thresh = Math.sqrt(pathBounds.area()) * 0.01;\n  simple = MapShaper.simplifyPolygonFast(shp, arcs, thresh);\n  if (!simple.shape) {\n    return null; // collapsed shape\n  }\n  return geom.findInteriorPoint2(simple.shape, simple.arcs);\n};\n\n// Assumes: shp is a polygon with at least one space-enclosing ring\ngeom.findInteriorPoint2 = function(shp, arcs) {\n  var maxPath = geom.getMaxPath(shp, arcs);\n  var pathBounds = arcs.getSimpleShapeBounds(maxPath);\n  var centroid = geom.getPathCentroid(maxPath, arcs);\n  var weight = MapShaper.getPointWeightingFunction(centroid, pathBounds);\n  var area = geom.getPlanarPathArea(maxPath, arcs);\n  var hrange, lbound, rbound, focus, htics, hstep, p, p2;\n\n  // Limit test area if shape is simple and squarish\n  if (shp.length == 1 && area * 1.2 > pathBounds.area()) {\n    htics = 5;\n    focus = 0.2;\n  } else if (shp.length == 1 && area * 1.7 > pathBounds.area()) {\n    htics = 7;\n    focus = 0.4;\n  } else {\n    htics = 11;\n    focus = 0.5;\n  }\n  hrange = pathBounds.width() * focus;\n  lbound = centroid.x - hrange / 2;\n  rbound = lbound + hrange;\n  hstep = hrange / htics;\n\n  // Find a best-fit point\n  p = MapShaper.probeForBestInteriorPoint(shp, arcs, lbound, rbound, htics, weight);\n  if (!p) {\n    verbose(\"[points inner] failed, falling back to centroid\");\n   p = centroid;\n  } else {\n    // Look for even better fit close to best-fit point\n    p2 = MapShaper.probeForBestInteriorPoint(shp, arcs, p.x - hstep / 2,\n        p.x + hstep / 2, 2, weight);\n    if (p2.distance > p.distance) {\n      p = p2;\n    }\n  }\n  return p;\n};\n\nMapShaper.getPointWeightingFunction = function(centroid, pathBounds) {\n  // Get a factor for weighting a candidate point\n  // Points closer to the centroid are slightly preferred\n  var referenceDist = Math.max(pathBounds.width(), pathBounds.height()) / 2;\n  return function(x, y) {\n    var offset = distance2D(centroid.x, centroid.y, x, y);\n    return 1 - Math.min(0.6 * offset / referenceDist, 0.25);\n  };\n};\n\nMapShaper.findInteriorPointCandidates = function(shp, arcs, xx) {\n  var ymin = arcs.getBounds().ymin - 1;\n  return xx.reduce(function(memo, x) {\n    var cands = MapShaper.findHitCandidates(x, ymin, shp, arcs);\n    return memo.concat(cands);\n  }, []);\n};\n\nMapShaper.probeForBestInteriorPoint = function(shp, arcs, lbound, rbound, htics, weight) {\n  var tics = MapShaper.getInnerTics(lbound, rbound, htics);\n  var interval = (rbound - lbound) / htics;\n  // Get candidate points, distributed along x-axis\n  var candidates = MapShaper.findInteriorPointCandidates(shp, arcs, tics);\n  var bestP, adjustedP, candP;\n\n  // Sort candidates so points at the center of longer segments are tried first\n  candidates.forEach(function(p) {\n    p.interval *= weight(p.x, p.y);\n  });\n  candidates.sort(function(a, b) {\n    return b.interval - a.interval;\n  });\n\n  for (var i=0; i<candidates.length; i++) {\n    candP = candidates[i];\n    // Optimization: Stop searching if weighted half-segment length of remaining\n    //   points is less than the weighted edge distance of the best candidate\n    if (bestP && bestP.distance > candP.interval) {\n      break;\n    }\n    adjustedP = MapShaper.getAdjustedPoint(candP.x, candP.y, shp, arcs, interval, weight);\n\n    if (!bestP || adjustedP.distance > bestP.distance) {\n      bestP = adjustedP;\n    }\n  }\n  return bestP;\n};\n\n// [x, y] is a point assumed to be inside a polygon @shp\n// Try to move the point farther from the polygon edge\nMapShaper.getAdjustedPoint = function(x, y, shp, arcs, vstep, weight) {\n  var p = {\n    x: x,\n    y: y,\n    distance: geom.getPointToShapeDistance(x, y, shp, arcs) * weight(x, y)\n  };\n  MapShaper.scanForBetterPoint(p, shp, arcs, vstep, weight); // scan up\n  MapShaper.scanForBetterPoint(p, shp, arcs, -vstep, weight); // scan down\n  return p;\n};\n\n// Try to find a better-fit point than @p by scanning vertically\n// Modify p in-place\nMapShaper.scanForBetterPoint = function(p, shp, arcs, vstep, weight) {\n  var x = p.x,\n      y = p.y,\n      dmax = p.distance,\n      d;\n\n  while (true) {\n    y += vstep;\n    d = geom.getPointToShapeDistance(x, y, shp, arcs) * weight(x, y);\n    // overcome vary small local minima\n    if (d > dmax * 0.90 && geom.testPointInPolygon(x, y, shp, arcs)) {\n      if (d > dmax) {\n        p.distance = dmax = d;\n        p.y = y;\n      }\n    } else {\n      break;\n    }\n  }\n};\n\n// Return array of points at the midpoint of each line segment formed by the\n//   intersection of a vertical ray at [x, y] and a polygon shape\nMapShaper.findHitCandidates = function(x, y, shp, arcs) {\n  var yy = MapShaper.findRayShapeIntersections(x, y, shp, arcs);\n  var cands = [], y1, y2, interval;\n\n  // sorting by y-coord organizes y-intercepts into interior segments\n  utils.genericSort(yy);\n  for (var i=0; i<yy.length; i+=2) {\n    y1 = yy[i];\n    y2 = yy[i+1];\n    interval = (y2 - y1) / 2;\n    if (interval > 0) {\n      cands.push({\n        y: (y1 + y2) / 2,\n        x: x,\n        interval: interval\n      });\n    }\n  }\n  return cands;\n};\n\n// Return array of y-intersections between vertical ray with origin at [x, y]\n//   and a polygon\nMapShaper.findRayShapeIntersections = function(x, y, shp, arcs) {\n  if (!shp) return [];\n  return shp.reduce(function(memo, path) {\n    var yy = MapShaper.findRayRingIntersections(x, y, path, arcs);\n    return memo.concat(yy);\n  }, []);\n};\n\n// Return array of y-intersections between vertical ray and a polygon ring\nMapShaper.findRayRingIntersections = function(x, y, path, arcs) {\n  var yints = [];\n  MapShaper.forEachPathSegment(path, arcs, function(a, b, xx, yy) {\n    var result = geom.getRayIntersection(x, y, xx[a], yy[a], xx[b], yy[b]);\n    if (result > -Infinity) {\n      yints.push(result);\n    }\n  });\n  // Ignore odd number of intersections -- probably caused by a ray that touches\n  //   but doesn't cross the ring\n  // TODO: improve method to handle edge case with two touches and no crosses.\n  if (yints.length % 2 === 1) {\n    yints = [];\n  }\n  return yints;\n};\n\n// TODO: find better home + name for this\nMapShaper.getInnerTics = function(min, max, steps) {\n  var range = max - min,\n      step = range / (steps + 1),\n      arr = [];\n  for (var i = 1; i<=steps; i++) {\n    arr.push(min + step * i);\n  }\n  return arr;\n};\n\n\n\n\n// Compiled expression returns a value\nMapShaper.compileValueExpression = function(exp, lyr, arcs) {\n  return MapShaper.compileFeatureExpression(exp, lyr, arcs, true);\n};\n\nMapShaper.compileFeatureExpression = function(rawExp, lyr, arcs, returns) {\n  var exp = rawExp || '',\n      vars = MapShaper.getAssignedVars(exp),\n      func, records;\n\n  if (vars.length > 0 && !lyr.data) {\n    MapShaper.initDataTable(lyr);\n  }\n\n  records = lyr.data ? lyr.data.getRecords() : [];\n  func = MapShaper.getExpressionFunction(exp, lyr, arcs, returns);\n  return function(recId) {\n    var record = records[recId];\n    if (!record) {\n      record = records[recId] = {};\n    }\n    // initialize new fields to null so assignments work\n    for (var i=0; i<vars.length; i++) {\n      if (vars[i] in record === false) {\n        record[vars[i]] = null;\n      }\n    }\n    return func(record, recId);\n  };\n};\n\nMapShaper.getAssignedVars = function(exp) {\n  var rxp = /[A-Za-z_][A-Za-z0-9_]*(?= *=[^=])/g;\n  return exp.match(rxp) || [];\n};\n\nMapShaper.getExpressionFunction = function(exp, lyr, arcs, returns) {\n  var env = MapShaper.getExpressionContext(lyr, arcs);\n  var body = (returns ? 'return ' : '') + exp;\n  var func;\n  try {\n    func = new Function(\"record,env\", \"with(env){with(record){ \" + body + \"}}\");\n  } catch(e) {\n    stop(e.name, \"in expression [\" + exp + \"]\");\n  }\n\n  return function(rec, i) {\n    var val;\n    env.$.__setId(i);\n    try {\n      val = func.call(null, rec, env);\n    } catch(e) {\n      stop(e.name, \"in expression [\" + exp + \"]:\", e.message);\n    }\n    return val;\n  };\n};\n\nMapShaper.getExpressionContext = function(lyr, arcs) {\n  var env = MapShaper.getBaseContext();\n  if (lyr.data) {\n    // default to null values when a data field is missing\n    lyr.data.getFields().forEach(function(f) {\n      env[f] = null;\n    });\n  }\n  env.$ = new FeatureExpressionContext(lyr, arcs);\n  return env;\n};\n\nMapShaper.getBaseContext = function() {\n  var obj = {};\n  // Mask global properties (is this effective/worth doing?)\n  (function() {\n    for (var key in this) {\n      obj[key] = null;\n    }\n  }());\n  obj.console = console;\n  return obj;\n};\n\n\nfunction addGetters(obj, getters) {\n  Object.keys(getters).forEach(function(name) {\n    Object.defineProperty(obj, name, {get: getters[name]});\n  });\n}\n\nfunction FeatureExpressionContext(lyr, arcs) {\n  var hasData = !!lyr.data,\n      hasPoints = MapShaper.layerHasPoints(lyr),\n      hasPaths = arcs && MapShaper.layerHasPaths(lyr),\n      _isPlanar,\n      _self = this,\n      _centroid, _innerXY, _xy,\n      _record, _records,\n      _id, _ids, _bounds;\n\n  if (hasData) {\n    _records = lyr.data.getRecords();\n    Object.defineProperty(this, 'properties',\n      {set: function(obj) {\n        if (utils.isObject(obj)) {\n          _records[_id] = obj;\n        } else {\n          stop(\"Can't assign non-object to $.properties\");\n        }\n      }, get: function() {\n        var rec = _records[_id];\n        if (!rec) {\n          rec = _records[_id] = {};\n        }\n        return rec;\n      }});\n  }\n\n  if (hasPaths) {\n    _isPlanar = arcs.isPlanar();\n    addGetters(this, {\n      // TODO: count hole/s + containing ring as one part\n      partCount: function() {\n        return _ids ? _ids.length : 0;\n      },\n      isNull: function() {\n        return this.partCount === 0;\n      },\n      bounds: function() {\n        return shapeBounds().toArray();\n      },\n      height: function() {\n        return shapeBounds().height();\n      },\n      width: function() {\n        return shapeBounds().width();\n      }\n    });\n\n    if (lyr.geometry_type == 'polygon') {\n      addGetters(this, {\n        area: function() {\n          return _isPlanar ? geom.getPlanarShapeArea(_ids, arcs) : geom.getSphericalShapeArea(_ids, arcs);\n        },\n        originalArea: function() {\n          var i = arcs.getRetainedInterval(),\n              area;\n          arcs.setRetainedInterval(0);\n          area = _self.area;\n          arcs.setRetainedInterval(i);\n          return area;\n        },\n        centroidX: function() {\n          var p = centroid();\n          return p ? p.x : null;\n        },\n        centroidY: function() {\n          var p = centroid();\n          return p ? p.y : null;\n        },\n        innerX: function() {\n          var p = innerXY();\n          return p ? p.x : null;\n        },\n        innerY: function() {\n          var p = innerXY();\n          return p ? p.y : null;\n        }\n      });\n    }\n\n  } else if (hasPoints) {\n    // TODO: add functions like bounds, isNull, pointCount\n    Object.defineProperty(this, 'coordinates',\n      {set: function(obj) {\n        if (!obj || utils.isArray(obj)) {\n          lyr.shapes[_id] = obj || null;\n        } else {\n          stop(\"Can't assign non-array to $.coordinates\");\n        }\n      }, get: function() {\n        return lyr.shapes[_id] || null;\n      }});\n\n    addGetters(this, {\n      x: function() {\n        xy();\n        return _xy ? _xy[0] : null;\n      },\n      y: function() {\n        xy();\n        return _xy ? _xy[1] : null;\n      }\n    });\n  }\n\n  // all contexts have $.id\n  addGetters(this, {id: function() { return _id; }});\n\n  this.__setId = function(id) {\n    _id = id;\n    if (hasPaths) {\n      _bounds = null;\n      _centroid = null;\n      _innerXY = null;\n      _ids = lyr.shapes[id];\n    }\n    if (hasPoints) {\n      _xy = null;\n    }\n    if (hasData) {\n      _record = _records[id];\n    }\n  };\n\n  function xy() {\n    var shape = lyr.shapes[_id];\n    if (!_xy) {\n      _xy = shape && shape[0] || null;\n    }\n    return _xy;\n  }\n\n  function centroid() {\n    _centroid = _centroid || geom.getShapeCentroid(_ids, arcs);\n    return _centroid;\n  }\n\n  function innerXY() {\n    _innerXY = _innerXY || geom.findInteriorPoint(_ids, arcs);\n    return _innerXY;\n  }\n\n  function shapeBounds() {\n    if (!_bounds) {\n      _bounds = arcs.getMultiShapeBounds(_ids);\n    }\n    return _bounds;\n  }\n}\n\n\n\n\nfunction dissolvePointLayerGeometry(lyr, getGroupId, opts) {\n  var useSph = !opts.planar && MapShaper.probablyDecimalDegreeBounds(MapShaper.getLayerBounds(lyr));\n  var getWeight = opts.weight ? MapShaper.compileValueExpression(opts.weight, lyr) : null;\n  var groups = [];\n\n  // TODO: support multipoints\n  if (MapShaper.countMultiPartFeatures(lyr.shapes) !== 0) {\n    stop(\"[dissolve] Dissolving multi-part points is not supported\");\n  }\n\n  lyr.shapes.forEach(function(shp, i) {\n    var groupId = getGroupId(i);\n    var weight = getWeight ? getWeight(i) : 1;\n    var p = shp && shp[0]; // Using first point (TODO: handle multi-point features)\n    var tmp;\n    if (!p) return;\n    if (useSph) {\n      tmp = [];\n      lngLatToXYZ(p[0], p[1], tmp);\n      p = tmp;\n    }\n    groups[groupId] = reducePointCentroid(groups[groupId], p, weight);\n  });\n\n  return groups.map(function(memo) {\n    var p1, p2;\n    if (!memo) return null;\n    if (useSph) {\n      p1 = memo.centroid;\n      p2 = [];\n      xyzToLngLat(p1[0], p1[1], p1[2], p2);\n    } else {\n      p2 = memo.centroid;\n    }\n    return memo ? [p2] : null;\n  });\n}\n\nfunction reducePointCentroid(memo, p, weight) {\n  var x = p[0],\n      y = p[1],\n      sum, k;\n\n  if (x == x && y == y && weight > 0) {\n    if (!memo) {\n      memo = {sum: weight, centroid: p.concat()};\n    } else {\n      sum = memo.sum + weight;\n      k = memo.sum / sum;\n      memo.centroid[0] = k * memo.centroid[0] + weight * x / sum;\n      memo.centroid[1] = k * memo.centroid[1] + weight * y / sum;\n      if (p.length == 3) {\n        memo.centroid[2] = k * memo.centroid[2] + weight * p[2] / sum;\n      }\n      memo.sum = sum;\n    }\n  }\n  return memo;\n}\n\n\n\n\nfunction dissolvePolygonGeometry(shapes, getGroupId) {\n  var segments = dissolveFirstPass(shapes, getGroupId);\n  return dissolveSecondPass(segments, shapes, getGroupId);\n}\n\n// First pass -- identify pairs of segments that can be dissolved\nfunction dissolveFirstPass(shapes, getGroupId) {\n  var groups = [],\n      largeGroups = [],\n      segments = [],\n      ids = shapes.map(function(shp, i) {\n        return getGroupId(i);\n      });\n\n  MapShaper.traversePaths(shapes, procArc);\n  largeGroups.forEach(splitGroup);\n  return segments;\n\n  function procArc(obj) {\n    var arcId = obj.arcId,\n        idx = arcId < 0 ? ~arcId : arcId,\n        segId = segments.length,\n        group = groups[idx];\n    if (!group) {\n      group = [];\n      groups[idx] = group;\n    }\n    group.push(segId);\n    obj.group = group;\n    segments.push(obj);\n\n    // Three or more segments sharing the same arc is abnormal topology...\n    // Need to try to identify pairs of matching segments in each of these\n    // groups.\n    //\n    if (group.length == 3) {\n      largeGroups.push(group);\n    }\n  }\n\n  function findMatchingPair(group, cb) {\n    var arc1, arc2;\n    for (var i=0; i<group.length - 1; i++) {\n      arc1 = segments[group[i]];\n      for (var j=i+1; j<group.length; j++) {\n        arc2 = segments[group[j]];\n        if (cb(arc1, arc2)) {\n          return [arc1.segId, arc2.segId];\n        }\n      }\n    }\n    return null;\n  }\n\n  function checkFwExtension(arc1, arc2) {\n    return getNextSegment(arc1, segments, shapes).arcId ===\n        ~getNextSegment(arc2, segments, shapes).arcId;\n  }\n\n  function checkBwExtension(arc1, arc2) {\n    return getPrevSegment(arc1, segments, shapes).arcId ===\n        ~getPrevSegment(arc2, segments, shapes).arcId;\n  }\n\n  function checkDoubleExtension(arc1, arc2) {\n    return checkPairwiseMatch(arc1, arc2) &&\n        checkFwExtension(arc1, arc2) &&\n        checkBwExtension(arc1, arc2);\n  }\n\n  function checkSingleExtension(arc1, arc2) {\n    return checkPairwiseMatch(arc1, arc2) &&\n        (checkFwExtension(arc1, arc2) ||\n        checkBwExtension(arc1, arc2));\n  }\n\n  function checkPairwiseMatch(arc1, arc2) {\n    return arc1.arcId === ~arc2.arcId && ids[arc1.shapeId] ===\n        ids[arc2.shapeId];\n  }\n\n  function updateGroupIds(ids) {\n    ids.forEach(function(id) {\n      segments[id].group = ids;\n    });\n  }\n\n  // split a group of segments into pairs of matching segments + a residual group\n  // @group Array of segment ids\n  //\n  function splitGroup(group) {\n    // find best-match segment pair\n    var group2 = findMatchingPair(group, checkDoubleExtension) ||\n        findMatchingPair(group, checkSingleExtension) ||\n        findMatchingPair(group, checkPairwiseMatch);\n    if (group2) {\n      group = group.filter(function(i) {\n        return !utils.contains(group2, i);\n      });\n      updateGroupIds(group);\n      updateGroupIds(group2);\n      // Split again if reduced group is still large\n      if (group.length > 2) splitGroup(group);\n    }\n  }\n}\n\n// Second pass -- generate dissolved shapes\n//\nfunction dissolveSecondPass(segments, shapes, getGroupId) {\n  var dissolveShapes = [];\n  segments.forEach(procSegment);\n  return dissolveShapes;\n\n  // @obj is an arc instance\n  function procSegment(obj) {\n    if (obj.used) return;\n    var match = findDissolveArc(obj);\n    if (!match) buildRing(obj);\n  }\n\n  function addRing(arcs, i) {\n    if (i in dissolveShapes === false) {\n      dissolveShapes[i] = [];\n    }\n    dissolveShapes[i].push(arcs);\n  }\n\n  // Generate a dissolved ring\n  // @firstArc the first arc instance in the ring\n  //\n  function buildRing(firstArc) {\n    var newArcs = [firstArc.arcId],\n        nextArc = getNextArc(firstArc);\n        firstArc.used = true;\n\n    while (nextArc && nextArc != firstArc) {\n      newArcs.push(nextArc.arcId);\n      nextArc.used = true;\n      nextArc = getNextArc(nextArc);\n      if (nextArc && nextArc != firstArc && nextArc.used) error(\"buildRing() topology error\");\n    }\n\n    if (!nextArc) error(\"buildRing() traversal error\");\n    firstArc.used = true;\n    addRing(newArcs, getGroupId(firstArc.shapeId));\n  }\n\n  // Get the next arc in a dissolved polygon ring\n  // @obj an undissolvable arc instance\n  //\n  function getNextArc(obj, depth) {\n    var next = getNextSegment(obj, segments, shapes),\n        match;\n    depth = depth || 0;\n    if (next != obj) {\n      match = findDissolveArc(next);\n      if (match) {\n        if (depth > 100) {\n          error ('[dissolve] deep recursion -- unhandled topology problem');\n        }\n        // if (match.part.arcs.length == 1) {\n        if (shapes[match.shapeId][match.partId].length == 1) {\n          // case: @obj has an island inclusion -- keep traversing @obj\n          // TODO: test case if @next is first arc in the ring\n          next = getNextArc(next, depth + 1);\n        } else {\n          next = getNextArc(match, depth + 1);\n        }\n      }\n    }\n    return next;\n  }\n\n  // Look for an arc instance that can be dissolved with segment @obj\n  // (must be going the opposite direction and have same dissolve key, etc)\n  // Return matching segment or null if no match\n  //\n  function findDissolveArc(obj) {\n    var dissolveId = getGroupId(obj.shapeId), // obj.shape.dissolveKey,\n        match, matchId;\n    matchId = utils.find(obj.group, function(i) {\n      var a = obj,\n          b = segments[i];\n      if (a == b ||\n          b.used ||\n          getGroupId(b.shapeId) !== dissolveId ||\n          // don't prevent rings from dissolving with themselves (risky?)\n          // a.shapeId == b.shapeId && a.partId == b.partId ||\n          a.arcId != ~b.arcId) return false;\n      return true;\n    });\n    match = matchId === null ? null : segments[matchId];\n    return match;\n  }\n}\n\nfunction getNextSegment(seg, segments, shapes) {\n  return getSegmentByOffs(seg, segments, shapes, 1);\n}\n\nfunction getPrevSegment(seg, segments, shapes) {\n  return getSegmentByOffs(seg, segments, shapes, -1);\n}\n\nfunction getSegmentByOffs(seg, segments, shapes, offs) {\n  var arcs = shapes[seg.shapeId][seg.partId],\n      partLen = arcs.length,\n      nextOffs = (seg.i + offs) % partLen,\n      nextSeg;\n  if (nextOffs < 0) nextOffs += partLen;\n  nextSeg = segments[seg.segId - seg.i + nextOffs];\n  if (!nextSeg || nextSeg.shapeId != seg.shapeId) error(\"index error\");\n  return nextSeg;\n}\n\n\n\n\n// Generate a dissolved layer\n// @opts.field (optional) name of data field (dissolves all if falsy)\n// @opts.sum-fields (Array) (optional)\n// @opts.copy-fields (Array) (optional)\n//\napi.dissolve = function(lyr, arcs, o) {\n  var opts = o || {},\n      getGroupId = MapShaper.getCategoryClassifier(opts.field, lyr.data),\n      dissolveShapes = null,\n      dissolveData = null,\n      lyr2;\n\n  if (lyr.geometry_type == 'polygon') {\n    dissolveShapes = dissolvePolygonGeometry(lyr.shapes, getGroupId);\n  } else if (lyr.geometry_type == 'point') {\n    dissolveShapes = dissolvePointLayerGeometry(lyr, getGroupId, opts);\n  } else if (lyr.geometry_type) {\n    stop(\"[dissolve] Only point and polygon geometries can be dissolved\");\n  }\n\n  if (lyr.data) {\n    dissolveData = MapShaper.aggregateDataRecords(lyr.data.getRecords(), getGroupId, opts);\n    // replace missing shapes with nulls\n    for (var i=0, n=dissolveData.length; i<n; i++) {\n      if (dissolveShapes && !dissolveShapes[i]) {\n        dissolveShapes[i] = null;\n      }\n    }\n  }\n  lyr2 = {\n    name: opts.no_replace ? null : lyr.name,\n    shapes: dissolveShapes,\n    data: dissolveData ? new DataTable(dissolveData) : null,\n    geometry_type: lyr.geometry_type\n  };\n  if (!opts.silent) {\n    MapShaper.printDissolveMessage(lyr, lyr2);\n  }\n  return lyr2;\n};\n\nMapShaper.printDissolveMessage = function(pre, post, cmd) {\n  var n1 = MapShaper.getFeatureCount(pre),\n      n2 = MapShaper.getFeatureCount(post),\n      msg = utils.format('[%s] Dissolved %,d feature%s into %,d feature%s',\n        cmd || 'dissolve', n1, utils.pluralSuffix(n1), n2,\n        utils.pluralSuffix(n2));\n  message(msg);\n};\n\n\n\n\napi.dissolve2 = function(lyr, dataset, opts) {\n  MapShaper.requirePolygonLayer(lyr, \"[dissolve2] Expected a polygon type layer\");\n  var nodes = MapShaper.divideArcs(dataset);\n  return MapShaper.dissolvePolygonLayer(lyr, nodes, opts);\n};\n\nMapShaper.dissolvePolygonLayer = function(lyr, nodes, opts) {\n  opts = opts || {};\n  var getGroupId = MapShaper.getCategoryClassifier(opts.field, lyr.data);\n  var groups = lyr.shapes.reduce(function(groups, shape, i) {\n    var i2 = getGroupId(i);\n    if (i2 in groups === false) {\n      groups[i2] = [];\n    }\n    MapShaper.extendShape(groups[i2], shape);\n    return groups;\n  }, []);\n  var dissolve = MapShaper.getPolygonDissolver(nodes);\n  var lyr2, data2;\n\n  T.start();\n  if (lyr.data) {\n    data2 = new DataTable(MapShaper.aggregateDataRecords(lyr.data.getRecords(), getGroupId, opts));\n  }\n  lyr2 = {\n    name: opts.no_replace ? null : lyr.name,\n    data: data2,\n    shapes: groups.map(dissolve),\n    geometry_type: lyr.geometry_type\n  };\n  T.stop('dissolve2');\n  MapShaper.printDissolveMessage(lyr, lyr2, 'dissolve2');\n  return lyr2;\n};\n\nMapShaper.concatShapes = function(shapes) {\n  return shapes.reduce(function(memo, shape) {\n    MapShaper.extendShape(memo, shape);\n    return memo;\n  }, []);\n};\n\nMapShaper.extendShape = function(dest, src) {\n  if (src) {\n    for (var i=0, n=src.length; i<n; i++) {\n      dest.push(src[i]);\n    }\n  }\n};\n\nMapShaper.getPolygonDissolver = function(nodes, spherical) {\n  spherical = spherical && !nodes.arcs.isPlanar();\n  var flags = new Uint8Array(nodes.arcs.size());\n  var divide = MapShaper.getHoleDivider(nodes, spherical);\n  var flatten = MapShaper.getRingIntersector(nodes, 'flatten', flags, spherical);\n  var dissolve = MapShaper.getRingIntersector(nodes, 'dissolve', flags, spherical);\n\n  return function(shp) {\n    if (!shp) return null;\n    var cw = [],\n        ccw = [];\n\n    divide(shp, cw, ccw);\n    cw = flatten(cw);\n    ccw.forEach(MapShaper.reversePath);\n    ccw = flatten(ccw);\n    ccw.forEach(MapShaper.reversePath);\n\n    var shp2 = MapShaper.appendHolestoRings(cw, ccw);\n    var dissolved = dissolve(shp2);\n    return dissolved.length > 0 ? dissolved : null;\n  };\n};\n\n// TODO: to prevent invalid holes,\n// could erase the holes from the space-enclosing rings.\nMapShaper.appendHolestoRings = function(cw, ccw) {\n  for (var i=0, n=ccw.length; i<n; i++) {\n    cw.push(ccw[i]);\n  }\n  return cw;\n};\n\n\n\n\n// assumes layers and arcs have been prepared for clipping\nMapShaper.clipPolygons = function(targetShapes, clipShapes, nodes, type) {\n  var arcs = nodes.arcs;\n  var clipFlags = new Uint8Array(arcs.size());\n  var routeFlags = new Uint8Array(arcs.size());\n  var clipArcTouches = 0;\n  var clipArcUses = 0;\n  var usedClipArcs = [];\n  var dividePath = MapShaper.getPathFinder(nodes, useRoute, routeIsActive, chooseRoute);\n  var dissolvePolygon = MapShaper.getPolygonDissolver(nodes);\n\n  // clean each target polygon by dissolving its rings\n  targetShapes = targetShapes.map(dissolvePolygon);\n\n  // merge rings of clip/erase polygons and dissolve them all\n  clipShapes = [dissolvePolygon(MapShaper.concatShapes(clipShapes))];\n\n  // Open pathways in the clip/erase layer\n  // Need to expose clip/erase routes in both directions by setting route\n  // in both directions to visible -- this is how cut-out shapes are detected\n  // Or-ing with 0x11 makes both directions visible (so reverse paths will block)\n  MapShaper.openArcRoutes(clipShapes, arcs, clipFlags, type == 'clip', type == 'erase', !!\"dissolve\", 0x11);\n\n  var index = new PathIndex(clipShapes, arcs);\n  var clippedShapes = targetShapes.map(function(shape) {\n    if (shape) {\n      return clipPolygon(shape, type, index);\n    }\n    return null;\n  });\n\n  // add clip/erase polygons that are fully contained in a target polygon\n  // need to index only non-intersecting clip shapes\n  // (Intersecting shapes have one or more arcs that have been scanned)\n  //\n  var undividedClipShapes = findUndividedClipShapes(clipShapes);\n\n  MapShaper.closeArcRoutes(clipShapes, arcs, routeFlags, true, true); // not needed?\n  index = new PathIndex(undividedClipShapes, arcs);\n  targetShapes.forEach(function(shape, shapeId) {\n    var paths = shape ? findInteriorPaths(shape, type, index) : null;\n    if (paths) {\n      clippedShapes[shapeId] = (clippedShapes[shapeId] || []).concat(paths);\n    }\n  });\n\n  return clippedShapes;\n\n  function clipPolygon(shape, type, index) {\n    var dividedShape = [],\n        clipping = type == 'clip',\n        erasing = type == 'erase';\n\n    // open pathways for entire polygon rather than one ring at a time --\n    // need to create polygons that connect positive-space rings and holes\n    MapShaper.openArcRoutes(shape, arcs, routeFlags, true, false, false);\n\n    MapShaper.forEachPath(shape, function(ids) {\n      var path;\n      for (var i=0, n=ids.length; i<n; i++) {\n        clipArcTouches = 0;\n        clipArcUses = 0;\n        path = dividePath(ids[i]);\n        if (path) {\n          // if ring doesn't touch/intersect a clip/erase polygon, check if it is contained\n          // if (clipArcTouches === 0) {\n          // if ring doesn't incorporate an arc from the clip/erase polygon,\n          // check if it is contained (assumes clip shapes are dissolved)\n          if (clipArcTouches === 0 || clipArcUses === 0) { //\n            var contained = index.pathIsEnclosed(path);\n            if (clipping && contained || erasing && !contained) {\n              dividedShape.push(path);\n            }\n            // TODO: Consider breaking if polygon is unchanged\n          } else {\n            dividedShape.push(path);\n          }\n        }\n      }\n    });\n\n    // Clear pathways of current target shape to hidden/closed\n    MapShaper.closeArcRoutes(shape, arcs, routeFlags, true, true, true);\n    // Also clear pathways of any clip arcs that were used\n    if (usedClipArcs.length > 0) {\n      MapShaper.closeArcRoutes(usedClipArcs, arcs, routeFlags, true, true, true);\n      usedClipArcs = [];\n    }\n\n    return dividedShape.length === 0 ? null : dividedShape;\n  }\n\n  function routeIsActive(id) {\n    var fw = id >= 0,\n        abs = fw ? id : ~id,\n        visibleBit = fw ? 1 : 0x10,\n        targetBits = routeFlags[abs],\n        clipBits = clipFlags[abs];\n\n    if (clipBits > 0) clipArcTouches++;\n    return (targetBits & visibleBit) > 0 || (clipBits & visibleBit) > 0;\n  }\n\n  function useRoute(id) {\n    var fw = id >= 0,\n        abs = fw ? id : ~id,\n        targetBits = routeFlags[abs],\n        clipBits = clipFlags[abs],\n        targetRoute, clipRoute;\n\n    if (fw) {\n      targetRoute = targetBits;\n      clipRoute = clipBits;\n    } else {\n      targetRoute = targetBits >> 4;\n      clipRoute = clipBits >> 4;\n    }\n    targetRoute &= 3;\n    clipRoute &= 3;\n\n    var usable = false;\n    // var usable = targetRoute === 3 || targetRoute === 0 && clipRoute == 3;\n    if (targetRoute == 3) {\n      // special cases where clip route and target route both follow this arc\n      if (clipRoute == 1) {\n        // 1. clip/erase polygon blocks this route, not usable\n      } else if (clipRoute == 2 && type == 'erase') {\n        // 2. route is on the boundary between two erase polygons, not usable\n      } else {\n        usable = true;\n      }\n\n    } else if (targetRoute === 0 && clipRoute == 3) {\n      usedClipArcs.push(id);\n      usable = true;\n    }\n\n    if (usable) {\n      if (clipRoute == 3) {\n        clipArcUses++;\n      }\n      // Need to close all arcs after visiting them -- or could cause a cycle\n      //   on layers with strange topology\n      if (fw) {\n        targetBits = MapShaper.setBits(targetBits, 1, 3);\n      } else {\n        targetBits = MapShaper.setBits(targetBits, 0x10, 0x30);\n      }\n    }\n\n    targetBits |= fw ? 4 : 0x40; // record as visited\n    routeFlags[abs] = targetBits;\n    return usable;\n  }\n\n  function chooseRoute(id1, angle1, id2, angle2, prevId) {\n    var selection = 1;\n    if (angle1 == angle2) {\n      // less likely now that congruent arcs are prevented in updateArcIds()\n      var bits2 = MapShaper.getRouteBits(id2, routeFlags);\n      if (bits2 == 3) { // route2 follows a target layer arc; prefer it\n        selection = 2;\n      }\n    } else {\n      // prefer right-hand angle\n      if (angle2 < angle1) {\n        selection = 2;\n      }\n    }\n    return selection;\n  }\n\n  // Filter a collection of shapes to exclude paths that contain clip/erase arcs\n  // and paths that are hidden (e.g. internal boundaries)\n  function findUndividedClipShapes(clipShapes) {\n    return clipShapes.map(function(shape) {\n      var usableParts = [];\n      MapShaper.forEachPath(shape, function(ids) {\n        var pathIsClean = true,\n            pathIsVisible = false;\n        for (var i=0; i<ids.length; i++) {\n          // check if arc was used in fw or rev direction\n          if (!arcIsUnused(ids[i], routeFlags)) {\n            pathIsClean = false;\n            break;\n          }\n          // check if clip arc is visible\n          if (!pathIsVisible && arcIsVisible(ids[i], clipFlags)) {\n            pathIsVisible = true;\n          }\n        }\n        if (pathIsClean && pathIsVisible) usableParts.push(ids);\n      });\n      return usableParts.length > 0 ? usableParts : null;\n    });\n  }\n\n  // Test if arc is unused in both directions\n  // (not testing open/closed or visible/hidden)\n  function arcIsUnused(id, flags) {\n    var abs = absArcId(id),\n        flag = flags[abs];\n        return (flag & 0x44) === 0;\n  }\n\n  function arcIsVisible(id, flags) {\n    var flag = flags[absArcId(id)];\n    return (flag & 0x11) > 0;\n  }\n\n  // search for indexed clipping paths contained in a shape\n  // dissolve them if needed\n  function findInteriorPaths(shape, type, index) {\n    var enclosedPaths = index.findPathsInsideShape(shape),\n        dissolvedPaths = [];\n    if (!enclosedPaths) return null;\n    // ...\n    if (type == 'erase') enclosedPaths.forEach(MapShaper.reversePath);\n    if (enclosedPaths.length <= 1) {\n      dissolvedPaths = enclosedPaths; // no need to dissolve single-part paths\n    } else {\n      MapShaper.openArcRoutes(enclosedPaths, arcs, routeFlags, true, false, true);\n      enclosedPaths.forEach(function(ids) {\n        var path;\n        for (var j=0; j<ids.length; j++) {\n          path = dividePath(ids[j]);\n          if (path) {\n            dissolvedPaths.push(path);\n          }\n        }\n      });\n    }\n\n    return dissolvedPaths.length > 0 ? dissolvedPaths : null;\n  }\n}; // end clipPolygons()\n\n\n\n\n// Assumes: Arcs have been divided\n//\nMapShaper.clipPolylines = function(targetShapes, clipShapes, nodes, type) {\n  var index = new PathIndex(clipShapes, nodes.arcs);\n\n  return targetShapes.map(function(shp) {\n    return clipPolyline(shp);\n  });\n\n  function clipPolyline(shp) {\n    var clipped = shp.reduce(clipPath, []);\n    return clipped.length > 0 ? clipped : null;\n  }\n\n  function clipPath(memo, path) {\n    var clippedPath = null,\n        arcId, enclosed;\n    for (var i=0; i<path.length; i++) {\n      arcId = path[i];\n      enclosed = index.arcIsEnclosed(arcId);\n      if (enclosed && type == 'clip' || !enclosed && type == 'erase') {\n        if (!clippedPath) {\n          memo.push(clippedPath = []);\n        }\n        clippedPath.push(arcId);\n      } else {\n        clippedPath = null;\n      }\n    }\n    return memo;\n  }\n};\n\n\n\n\n//\nMapShaper.clipPoints = function(points, clipShapes, arcs, type) {\n  var index = new PathIndex(clipShapes, arcs);\n\n  var points2 = points.reduce(function(memo, feat) {\n    var n = feat ? feat.length : 0,\n        feat2 = [],\n        enclosed;\n\n    for (var i=0; i<n; i++) {\n      enclosed = index.findEnclosingShape(feat[i]) > -1;\n      if (type == 'clip' && enclosed || type == 'erase' && !enclosed) {\n        feat2.push(feat[i].concat());\n      }\n    }\n\n    memo.push(feat2.length > 0 ? feat2 : null);\n    return memo;\n  }, []);\n\n  return points2;\n};\n\n\n\n\n// Dissolve arcs that can be merged without affecting topology of layers\n// remove arcs that are not referenced by any layer; remap arc ids\n// in layers. (In-place).\nMapShaper.dissolveArcs = function(dataset) {\n  var arcs = dataset.arcs,\n      layers = dataset.layers.filter(MapShaper.layerHasPaths),\n      test = MapShaper.getArcDissolveTest(layers, arcs),\n      groups = [],\n      totalPoints = 0,\n      arcIndex = new Int32Array(arcs.size()), // maps old arc ids to new ids\n      arcStatus = new Uint8Array(arcs.size());\n      // arcStatus: 0 = unvisited, 1 = dropped, 2 = remapped, 3 = remapped + reversed\n  layers.forEach(function(lyr) {\n    // modify copies of the original shapes; original shapes should be unmodified\n    // (need to test this)\n    lyr.shapes = lyr.shapes.map(function(shape) {\n      return MapShaper.editPaths(shape && shape.concat(), translatePath);\n    });\n  });\n  MapShaper.dissolveArcCollection(arcs, groups, totalPoints);\n\n  function translatePath(path) {\n    var pointCount = 0;\n    var path2 = [];\n    var group, arcId, absId, arcLen, fw, arcId2;\n\n    for (var i=0, n=path.length; i<n; i++) {\n      arcId = path[i];\n      absId = absArcId(arcId);\n      fw = arcId === absId;\n\n      if (arcs.arcIsDegenerate(arcId)) {\n        // skip\n      } else if (arcStatus[absId] === 0) {\n        arcLen = arcs.getArcLength(arcId);\n\n        if (group && test(path[i-1], arcId)) {\n          if (arcLen > 0) {\n            arcLen--; // shared endpoint not counted;\n          }\n          group.push(arcId);  // arc data is appended to previous arc\n          arcStatus[absId] = 1; // arc is dropped from output\n        } else {\n          // new group (i.e. new dissolved arc)\n          group = [arcId];\n          arcIndex[absId] = groups.length;\n          groups.push(group);\n          arcStatus[absId] = fw ? 2 : 3; // 2: unchanged; 3: reversed\n        }\n        pointCount += arcLen;\n      } else {\n        group = null;\n      }\n\n      if (arcStatus[absId] > 1) {\n        // arc is retained (and renumbered) in the dissolved path.\n        arcId2 = arcIndex[absId];\n        if (fw && arcStatus[absId] == 3 || !fw && arcStatus[absId] == 2) {\n          arcId2 = ~arcId2;\n        }\n        path2.push(arcId2);\n      }\n    }\n    totalPoints += pointCount;\n    return path2;\n  }\n};\n\nMapShaper.dissolveArcCollection = function(arcs, groups, len2) {\n  var nn2 = new Uint32Array(groups.length),\n      xx2 = new Float64Array(len2),\n      yy2 = new Float64Array(len2),\n      src = arcs.getVertexData(),\n      zz2 = src.zz ? new Float64Array(len2) : null,\n      offs = 0;\n\n  groups.forEach(function(group, newId) {\n    group.forEach(function(oldId, i) {\n      extendDissolvedArc(oldId, newId);\n    });\n  });\n\n  arcs.updateVertexData(nn2, xx2, yy2, zz2);\n\n  function extendDissolvedArc(oldId, newId) {\n    var absId = absArcId(oldId),\n        rev = oldId < 0,\n        n = src.nn[absId],\n        i = src.ii[absId],\n        n2 = nn2[newId];\n\n    if (n > 0) {\n      if (n2 > 0) {\n        n--;\n        if (!rev) i++;\n      }\n      utils.copyElements(src.xx, i, xx2, offs, n, rev);\n      utils.copyElements(src.yy, i, yy2, offs, n, rev);\n      if (zz2) utils.copyElements(src.zz, i, zz2, offs, n, rev);\n      nn2[newId] += n;\n      offs += n;\n    }\n  }\n};\n\nMapShaper.getArcDissolveTest = function(layers, arcs) {\n  var nodes = MapShaper.getFilteredNodeCollection(layers, arcs),\n      count = 0,\n      lastId;\n\n  return function(id1, id2) {\n    if (id1 == id2 || id1 == ~id2) {\n      verbose(\"Unexpected arc sequence:\", id1, id2);\n      return false; // This is unexpected; don't try to dissolve, anyway\n    }\n    count = 0;\n    nodes.forEachConnectedArc(id1, countArc);\n    return count == 1 && lastId == ~id2;\n  };\n\n  function countArc(arcId, i) {\n    count++;\n    lastId = arcId;\n  }\n};\n\nMapShaper.getFilteredNodeCollection = function(layers, arcs) {\n  var counts = MapShaper.countArcReferences(layers, arcs),\n      test = function(arcId) {\n        return counts[absArcId(arcId)] > 0;\n      };\n  return new NodeCollection(arcs, test);\n};\n\nMapShaper.countArcReferences = function(layers, arcs) {\n  var counts = new Uint32Array(arcs.size());\n  layers.forEach(function(lyr) {\n    MapShaper.countArcsInShapes(lyr.shapes, counts);\n  });\n  return counts;\n};\n\n\n\n\napi.filterFeatures = function(lyr, arcs, opts) {\n  var records = lyr.data ? lyr.data.getRecords() : null,\n      shapes = lyr.shapes || null,\n      n = MapShaper.getFeatureCount(lyr),\n      filteredShapes = shapes ? [] : null,\n      filteredRecords = records ? [] : null,\n      filteredLyr = MapShaper.getOutputLayer(lyr, opts),\n      filter;\n\n  if (opts.expression) {\n    filter = MapShaper.compileValueExpression(opts.expression, lyr, arcs);\n  }\n\n  if (opts.remove_empty) {\n    filter = MapShaper.combineFilters(filter, MapShaper.getNullGeometryFilter(lyr, arcs));\n  }\n\n  if (!filter) {\n    stop(\"[filter] Missing a filter expression\");\n  }\n\n  utils.repeat(n, function(shapeId) {\n    var result = filter(shapeId);\n    if (result === true) {\n      if (shapes) filteredShapes.push(shapes[shapeId] || null);\n      if (records) filteredRecords.push(records[shapeId] || null);\n    } else if (result !== false) {\n      stop(\"[filter] Expression must return true or false\");\n    }\n  });\n\n  filteredLyr.shapes = filteredShapes;\n  filteredLyr.data = filteredRecords ? new DataTable(filteredRecords) : null;\n  if (opts.no_replace) {\n    // if adding a layer, don't share objects between source and filtered layer\n    filteredLyr = MapShaper.copyLayer(filteredLyr);\n  }\n\n  if (opts.verbose !== false) {\n    message(utils.format('[filter] Retained %,d of %,d features', MapShaper.getFeatureCount(filteredLyr), n));\n  }\n\n  return filteredLyr;\n};\n\nMapShaper.getNullGeometryFilter = function(lyr, arcs) {\n  var shapes = lyr.shapes;\n  if (lyr.geometry_type == 'polygon') {\n    return MapShaper.getEmptyPolygonFilter(shapes, arcs);\n  }\n  return function(i) {return !!shapes[i];};\n};\n\nMapShaper.getEmptyPolygonFilter = function(shapes, arcs) {\n  return function(i) {\n    var shp = shapes[i];\n    return !!shp && geom.getPlanarShapeArea(shapes[i], arcs) > 0;\n  };\n};\n\nMapShaper.combineFilters = function(a, b) {\n  return (a && b && function(id) {\n      return a(id) && b(id);\n    }) || a || b;\n};\n\n\n\n\napi.filterIslands = function(lyr, arcs, opts) {\n  var removed = 0;\n  if (lyr.geometry_type != 'polygon') {\n    return;\n  }\n\n  if (opts.min_area || opts.min_vertices) {\n    if (opts.min_area) {\n      removed += MapShaper.filterIslands(lyr, arcs, MapShaper.getMinAreaTest(opts.min_area, arcs));\n    }\n    if (opts.min_vertices) {\n      removed += MapShaper.filterIslands(lyr, arcs, MapShaper.getVertexCountTest(opts.min_vertices, arcs));\n    }\n    if (opts.remove_empty) {\n      api.filterFeatures(lyr, arcs, {remove_empty: true, verbose: false});\n    }\n    message(utils.format(\"Removed %'d island%s\", removed, utils.pluralSuffix(removed)));\n  } else {\n    message(\"[filter-islands] Missing a criterion for filtering islands; use min-area or min-vertices\");\n  }\n};\n\nMapShaper.getVertexCountTest = function(minVertices, arcs) {\n  return function(path) {\n    // first and last vertex in ring count as one\n    return geom.countVerticesInPath(path, arcs) <= minVertices;\n  };\n};\n\nMapShaper.getMinAreaTest = function(minArea, arcs) {\n  var pathArea = arcs.isPlanar() ? geom.getPlanarPathArea : geom.getSphericalPathArea;\n  return function(path) {\n    var area = pathArea(path, arcs);\n    return Math.abs(area) < minArea;\n  };\n};\n\nMapShaper.filterIslands = function(lyr, arcs, ringTest) {\n  var removed = 0;\n  var counts = new Uint8Array(arcs.size());\n  MapShaper.countArcsInShapes(lyr.shapes, counts);\n\n  var pathFilter = function(path, i, paths) {\n    if (path.length == 1) { // got an island ring\n      if (counts[absArcId(path[0])] === 1) { // and not part of a donut hole\n        if (!ringTest || ringTest(path)) { // and it meets any filtering criteria\n          // and it does not contain any holes itself\n          // O(n^2), so testing this last\n          if (!MapShaper.ringHasHoles(path, paths, arcs)) {\n            removed++;\n            return null;\n          }\n        }\n      }\n    }\n  };\n  MapShaper.filterShapes(lyr.shapes, pathFilter);\n  return removed;\n};\n\nMapShaper.ringIntersectsBBox = function(ring, bbox, arcs) {\n  for (var i=0, n=ring.length; i<n; i++) {\n    if (arcs.arcIntersectsBBox(absArcId(ring[i]), bbox)) {\n      return true;\n    }\n  }\n  return false;\n};\n\n// Assumes that ring boundaries to not cross\nMapShaper.ringHasHoles = function(ring, rings, arcs) {\n  var bbox = arcs.getSimpleShapeBounds2(ring);\n  var sibling, p;\n  for (var i=0, n=rings.length; i<n; i++) {\n    sibling = rings[i];\n    // try to avoid expensive point-in-ring test\n    if (sibling && sibling != ring && MapShaper.ringIntersectsBBox(sibling, bbox, arcs)) {\n      p = arcs.getVertex(sibling[0], 0);\n      if (geom.testPointInRing(p.x, p.y, ring, arcs)) {\n        return true;\n      }\n    }\n  }\n  return false;\n};\n\nMapShaper.filterShapes = function(shapes, pathFilter) {\n  var shapeFilter = function(paths) {\n    return MapShaper.editPaths(paths, pathFilter);\n  };\n  for (var i=0, n=shapes.length; i<n; i++) {\n    shapes[i] = shapeFilter(shapes[i]);\n  }\n};\n\n\n\n\n// Remove small-area polygon rings (very simple implementation of sliver removal)\n// TODO: more sophisticated sliver detection (e.g. could consider ratio of area to perimeter)\n// TODO: consider merging slivers into adjacent polygons to prevent gaps from forming\n// TODO: consider separate gap removal function as an alternative to merging slivers\n//\napi.filterSlivers = function(lyr, arcs, opts) {\n  if (lyr.geometry_type != 'polygon') {\n    return 0;\n  }\n  return MapShaper.filterSlivers(lyr, arcs, opts);\n};\n\nMapShaper.filterSlivers = function(lyr, arcs, opts) {\n  var ringTest = opts && opts.min_area ? MapShaper.getMinAreaTest(opts.min_area, arcs) :\n    MapShaper.getSliverTest(arcs);\n  var removed = 0;\n  var pathFilter = function(path, i, paths) {\n    if (ringTest(path)) {\n      removed++;\n      return null;\n    }\n  };\n\n  MapShaper.filterShapes(lyr.shapes, pathFilter);\n  return removed;\n};\n\nMapShaper.filterClipSlivers = function(lyr, clipLyr, arcs) {\n  var flags = new Uint8Array(arcs.size());\n  var ringTest = MapShaper.getSliverTest(arcs);\n  var removed = 0;\n  var pathFilter = function(path) {\n    var prevArcs = 0,\n        newArcs = 0;\n    for (var i=0, n=path && path.length || 0; i<n; i++) {\n      if (flags[absArcId(path[i])] > 0) {\n        newArcs++;\n      } else {\n        prevArcs++;\n      }\n    }\n    // filter paths that contain arcs from both original and clip/erase layers\n    //   and are small\n    if (newArcs > 0 && prevArcs > 0 && ringTest(path)) {\n      removed++;\n      return null;\n    }\n  };\n\n  MapShaper.countArcsInShapes(clipLyr.shapes, flags);\n  MapShaper.filterShapes(lyr.shapes, pathFilter);\n  return removed;\n};\n\nMapShaper.getSliverTest = function(arcs) {\n  var maxSliverArea = MapShaper.calcMaxSliverArea(arcs);\n  return function(path) {\n    // TODO: more sophisticated metric, perhaps considering shape\n    return Math.abs(geom.getPlanarPathArea(path, arcs)) <= maxSliverArea;\n  };\n};\n\n\n// Calculate an area threshold based on the average segment length,\n// but disregarding very long segments (i.e. bounding boxes)\n// TODO: need something more reliable\n// consider: calculating the distribution of segment lengths in one pass\n//\nMapShaper.calcMaxSliverArea = function(arcs) {\n  var k = 2,\n      dxMax = arcs.getBounds().width() / k,\n      dyMax = arcs.getBounds().height() / k,\n      count = 0,\n      mean = 0;\n  arcs.forEachSegment(function(i, j, xx, yy) {\n    var dx = Math.abs(xx[i] - xx[j]),\n        dy = Math.abs(yy[i] - yy[j]);\n    if (dx < dxMax && dy < dyMax) {\n      // TODO: write utility function for calculating mean this way\n      mean += (Math.sqrt(dx * dx + dy * dy) - mean) / ++count;\n    }\n  });\n  return mean * mean;\n};\n\n\n\n\napi.clipLayers = function(target, src, dataset, opts) {\n  return MapShaper.clipLayers(target, src, dataset, \"clip\", opts);\n};\n\napi.eraseLayers = function(target, src, dataset, opts) {\n  return MapShaper.clipLayers(target, src, dataset, \"erase\", opts);\n};\n\napi.clipLayer = function(targetLyr, src, dataset, opts) {\n  return api.clipLayers([targetLyr], src, dataset, opts)[0];\n};\n\napi.eraseLayer = function(targetLyr, src, dataset, opts) {\n  return api.eraseLayers([targetLyr], src, dataset, opts)[0];\n};\n\n// @clipSrc: layer in @dataset or filename\n// @type: 'clip' or 'erase'\nMapShaper.clipLayers = function(targetLayers, clipSrc, dataset, type, opts) {\n  var clipLyr, clipDataset;\n  opts = opts || {no_cleanup: true}; // TODO: update testing functions\n\n  // check if clip source is another layer in the same dataset\n  clipLyr = MapShaper.findClippingLayer(clipSrc, dataset);\n  if (clipLyr) {\n    clipDataset = dataset;\n  } else {\n    if (opts.bbox) {\n      // use bbox for clipping\n      clipDataset = MapShaper.convertClipBounds(opts.bbox);\n    } else {\n      // use external file for clipping (assume clipSrc is a filename)\n      clipDataset = MapShaper.loadExternalClipLayer(clipSrc, opts);\n    }\n    if (!clipDataset || clipDataset.layers.length != 1) {\n      stop(\"[clip/erase] Missing clipping data\");\n    }\n    clipLyr = clipDataset.layers[0];\n  }\n  MapShaper.requirePolygonLayer(clipLyr, \"[\" + type + \"] Requires a polygon clipping layer\");\n  return MapShaper.clipLayersByLayer(targetLayers, dataset, clipLyr, clipDataset, type, opts);\n};\n\nMapShaper.clipLayersByLayer = function(targetLayers, targetDataset, clipLyr, clipDataset, type, opts) {\n  var usingPathClip = utils.some(targetLayers, MapShaper.layerHasPaths);\n  var usingExternalDataset = targetDataset != clipDataset;\n  var nullCount = 0, sliverCount = 0,\n      nodes, outputLayers, mergedDataset;\n\n  if (usingExternalDataset) {\n    // merge external dataset with target dataset,\n    // so arcs are shared between target layers and clipping lyr\n    mergedDataset = MapShaper.mergeDatasets([targetDataset, clipDataset]);\n    api.buildTopology(mergedDataset); // identify any shared arcs between clipping layer and target dataset\n    targetDataset.arcs = mergedDataset.arcs; // replace arcs in original dataset with merged arcs\n\n  } else {\n    mergedDataset = targetDataset;\n  }\n\n  if (usingPathClip) {\n    // add vertices at all line intersections\n    nodes = MapShaper.divideArcs(mergedDataset);\n  }\n\n  outputLayers = targetLayers.map(function(targetLyr) {\n    var shapeCount = targetLyr.shapes ? targetLyr.shapes.length : 0;\n    var clippedShapes, outputLyr;\n    if (targetLyr === clipLyr) {\n      stop('[' + type + '] Can\\'t clip a layer with itself');\n    } else if (targetLyr.geometry_type == 'point') {\n      clippedShapes = MapShaper.clipPoints(targetLyr.shapes, clipLyr.shapes, mergedDataset.arcs, type);\n    } else if (targetLyr.geometry_type == 'polygon') {\n      clippedShapes = MapShaper.clipPolygons(targetLyr.shapes, clipLyr.shapes, nodes, type);\n    } else if (targetLyr.geometry_type == 'polyline') {\n      clippedShapes = MapShaper.clipPolylines(targetLyr.shapes, clipLyr.shapes, nodes, type);\n    } else {\n      stop('[' + type + '] Invalid target layer:', targetLyr.name);\n    }\n\n    outputLyr = MapShaper.getOutputLayer(targetLyr, opts);\n    if (opts.no_replace && targetLyr.data) {\n      outputLyr.data = targetLyr.data.clone();\n    }\n    outputLyr.shapes = clippedShapes;\n\n    // Remove sliver polygons\n    if (opts.remove_slivers && outputLyr.geometry_type == 'polygon') {\n      sliverCount += MapShaper.filterClipSlivers(outputLyr, clipLyr, targetDataset.arcs);\n    }\n\n    // Remove null shapes (likely removed by clipping/erasing, although possibly already present)\n    api.filterFeatures(outputLyr, targetDataset.arcs, {remove_empty: true, verbose: false});\n    nullCount += shapeCount - outputLyr.shapes.length;\n    return outputLyr;\n  });\n\n  // integrate output layers into target dataset\n  // (doing this here instead of in runCommand() to allow arc cleaning)\n  if (opts.no_replace) {\n    targetDataset.layers = targetDataset.layers.concat(outputLayers);\n  } else {\n    MapShaper.replaceLayers(targetDataset, targetLayers, outputLayers);\n  }\n\n  if (usingPathClip && !opts.no_cleanup) {\n    // Delete unused arcs, merge remaining arcs, remap arcs of retained shapes.\n    // This is to remove arcs belonging to the clipping paths from the target\n    // dataset, and to heal the cuts that were made where clipping paths\n    // crossed target paths\n    MapShaper.dissolveArcs(targetDataset);\n  }\n\n  if (nullCount && sliverCount) {\n    message(MapShaper.getClipMessage(type, nullCount, sliverCount));\n  }\n  return outputLayers;\n};\n\n\nMapShaper.getClipMessage = function(type, nullCount, sliverCount) {\n  var nullMsg = nullCount ? utils.format('%,d null feature%s', nullCount, utils.pluralSuffix(nullCount)) : '';\n  var sliverMsg = sliverCount ? utils.format('%,d sliver%s', sliverCount, utils.pluralSuffix(sliverCount)) : '';\n  if (nullMsg || sliverMsg) {\n    return utils.format('[%s] Removed %s%s%s', type, nullMsg, (nullMsg && sliverMsg ? ' and ' : ''), sliverMsg);\n  }\n  return '';\n};\n\n// see if @clipSrc is a layer in @dataset\nMapShaper.findClippingLayer = function(clipSrc, dataset) {\n  var layers, lyr;\n  if (utils.isObject(clipSrc) && utils.contains(dataset.layers, clipSrc)) {\n    lyr = clipSrc;\n  } else if (utils.isString(clipSrc)) {\n    // see if clipSrc is a layer name\n    layers = MapShaper.findMatchingLayers(dataset.layers, clipSrc);\n    if (layers.length > 1) {\n      stop(\"[clip/erase] Received more than one source layer\");\n    } else if (layers.length == 1) {\n      lyr = layers[0];\n    }\n  }\n  return lyr || null;\n};\n\n// try to load a clipping layer from a file\nMapShaper.loadExternalClipLayer = function(path, opts) {\n  // Load clip file without topology (topology is built later, together with target dataset)\n  var dataset = api.importFile(path, utils.defaults({no_topology: true}, opts));\n  if (!dataset) {\n    stop(\"Unable to find file [\" + path + \"]\");\n  }\n  if (dataset.layers.length != 1) {\n    // TODO: handle multi-layer sources, e.g. TopoJSON files\n    stop(\"Clip/erase only supports clipping with single-layer datasets\");\n  }\n  return dataset;\n};\n\nMapShaper.convertClipBounds = function(bb) {\n  var x0 = bb[0], y0 = bb[1], x1 = bb[2], y1 = bb[3],\n      arc = [[x0, y0], [x0, y1], [x1, y1], [x1, y0], [x0, y0]];\n\n  if (!(y1 > y0 && x1 > x0)) {\n    stop(\"[clip/erase] Invalid bbox (should be [xmin, ymin, xmax, ymax]):\", bb);\n  }\n  return {\n    arcs: new ArcCollection([arc]),\n    layers: [{\n      shapes: [[[0]]],\n      geometry_type: 'polygon'\n    }]\n  };\n};\n\n\n\n\nvar GeoJSON = {};\nGeoJSON.ID_FIELD = \"FID\"; // default field name of imported *JSON feature ids\n\nGeoJSON.typeLookup = {\n  LineString: 'polyline',\n  MultiLineString: 'polyline',\n  Polygon: 'polygon',\n  MultiPolygon: 'polygon',\n  Point: 'point',\n  MultiPoint: 'point'\n};\n\nGeoJSON.translateGeoJSONType = function(type) {\n  return GeoJSON.typeLookup[type] || null;\n};\n\n\n\n\n// Get function to Hash an x, y point to a non-negative integer\nfunction getXYHash(size) {\n  var buf = new ArrayBuffer(16),\n      floats = new Float64Array(buf),\n      uints = new Uint32Array(buf),\n      lim = size | 0;\n  if (lim > 0 === false) {\n    throw new Error(\"Invalid size param: \" + size);\n  }\n\n  return function(x, y) {\n    var u = uints, h;\n    floats[0] = x;\n    floats[1] = y;\n    h = u[0] ^ u[1];\n    h = h << 5 ^ h >> 7 ^ u[2] ^ u[3];\n    return (h & 0x7fffffff) % lim;\n  };\n}\n\n// Get function to Hash a single coordinate to a non-negative integer\nfunction getXHash(size) {\n  var buf = new ArrayBuffer(8),\n      floats = new Float64Array(buf),\n      uints = new Uint32Array(buf),\n      lim = size | 0;\n  if (lim > 0 === false) {\n    throw new Error(\"Invalid size param: \" + size);\n  }\n\n  return function(x) {\n    var h;\n    floats[0] = x;\n    h = uints[0] ^ uints[1];\n    h = h << 5 ^ h >> 7;\n    return (h & 0x7fffffff) % lim;\n  };\n}\n\n\n\n\n// Used for building topology\n//\nfunction ArcIndex(pointCount) {\n  var hashTableSize = Math.floor(pointCount * 0.25 + 1),\n      hash = getXYHash(hashTableSize),\n      hashTable = new Int32Array(hashTableSize),\n      chainIds = [],\n      arcs = [],\n      arcPoints = 0;\n\n  utils.initializeArray(hashTable, -1);\n\n  this.addArc = function(xx, yy) {\n    var end = xx.length - 1,\n        key = hash(xx[end], yy[end]),\n        chainId = hashTable[key],\n        arcId = arcs.length;\n    hashTable[key] = arcId;\n    arcs.push([xx, yy]);\n    arcPoints += xx.length;\n    chainIds.push(chainId);\n    return arcId;\n  };\n\n  // Look for a previously generated arc with the same sequence of coords, but in the\n  // opposite direction. (This program uses the convention of CW for space-enclosing rings, CCW for holes,\n  // so coincident boundaries should contain the same points in reverse sequence).\n  //\n  this.findMatchingArc = function(xx, yy, start, end, getNext, getPrev) {\n    // First, look for a reverse match\n    var arcId = findArcNeighbor(xx, yy, start, end, getNext);\n    if (arcId === null) {\n      // Look for forward match\n      // (Abnormal topology, but we're accepting it because in-the-wild\n      // Shapefiles sometimes have duplicate paths)\n      arcId = findArcNeighbor(xx, yy, end, start, getPrev);\n    } else {\n      arcId = ~arcId;\n    }\n    return arcId;\n  };\n\n  function findArcNeighbor(xx, yy, start, end, getNext) {\n    var next = getNext(start),\n        key = hash(xx[start], yy[start]),\n        arcId = hashTable[key],\n        arcX, arcY, len;\n\n    while (arcId != -1) {\n      // check endpoints and one segment...\n      // it would be more rigorous but slower to identify a match\n      // by comparing all segments in the coordinate sequence\n      arcX = arcs[arcId][0];\n      arcY = arcs[arcId][1];\n      len = arcX.length;\n      if (arcX[0] === xx[end] && arcX[len-1] === xx[start] && arcX[len-2] === xx[next] &&\n          arcY[0] === yy[end] && arcY[len-1] === yy[start] && arcY[len-2] === yy[next]) {\n        return arcId;\n      }\n      arcId = chainIds[arcId];\n    }\n    return null;\n  }\n\n  this.getVertexData = function() {\n    var xx = new Float64Array(arcPoints),\n        yy = new Float64Array(arcPoints),\n        nn = new Uint32Array(arcs.length),\n        copied = 0,\n        arc, len;\n    for (var i=0, n=arcs.length; i<n; i++) {\n      arc = arcs[i];\n      len = arc[0].length;\n      utils.copyElements(arc[0], 0, xx, copied, len);\n      utils.copyElements(arc[1], 0, yy, copied, len);\n      nn[i] = len;\n      copied += len;\n    }\n    return {\n      xx: xx,\n      yy: yy,\n      nn: nn\n    };\n  };\n}\n\n\n\n\nfunction initHashChains(xx, yy) {\n  // Performance doesn't improve much above ~1.3 * point count\n  var n = xx.length,\n      m = Math.floor(n * 1.3) || 1,\n      hash = getXYHash(m),\n      hashTable = new Int32Array(m),\n      chainIds = new Int32Array(n), // Array to be filled with chain data\n      key, j;\n\n  for (var i=0; i<n; i++) {\n    key = hash(xx[i], yy[i]);\n    j = hashTable[key] - 1; // coord ids are 1-based in hash table; 0 used as null value.\n    hashTable[key] = i + 1;\n    chainIds[i] = j < 0 ? i : j; // first item in a chain points to self\n  }\n  return chainIds;\n}\n\nfunction initPointChains(xx, yy) {\n  var chainIds = initHashChains(xx, yy),\n      j, next, prevMatchId, prevUnmatchId;\n\n  // disentangle, reverse and close the chains created by initHashChains()\n  for (var i = xx.length-1; i>=0; i--) {\n    next = chainIds[i];\n    if (next >= i) continue;\n    prevMatchId = i;\n    prevUnmatchId = -1;\n    do {\n      j = next;\n      next = chainIds[j];\n      if (yy[j] == yy[i] && xx[j] == xx[i]) {\n        chainIds[j] = prevMatchId;\n        prevMatchId = j;\n      } else {\n        if (prevUnmatchId > -1) {\n          chainIds[prevUnmatchId] = j;\n        }\n        prevUnmatchId = j;\n      }\n    } while (next < j);\n    if (prevUnmatchId > -1) {\n      // Make sure last unmatched entry is terminated\n      chainIds[prevUnmatchId] = prevUnmatchId;\n    }\n    chainIds[i] = prevMatchId; // close the chain\n  }\n  return chainIds;\n}\n\n\n\n\n// Converts all polygon and polyline paths in a dataset to a topological format,\n// (in-place);\napi.buildTopology = function(dataset) {\n  if (!dataset.arcs) return;\n  var raw = dataset.arcs.getVertexData(),\n      cooked = MapShaper.buildPathTopology(raw.nn, raw.xx, raw.yy);\n  dataset.arcs.updateVertexData(cooked.nn, cooked.xx, cooked.yy);\n  dataset.layers.forEach(function(lyr) {\n    if (lyr.geometry_type == 'polyline' || lyr.geometry_type == 'polygon') {\n      lyr.shapes = MapShaper.replaceArcIds(lyr.shapes, cooked.paths);\n    }\n  });\n};\n\n// buildPathTopology() converts non-topological paths into\n// a topological format\n//\n// Arguments:\n//    xx: [Array|Float64Array],   // x coords of each point in the dataset\n//    yy: [Array|Float64Array],   // y coords ...\n//    nn: [Array]  // length of each path\n//\n// (x- and y-coords of all paths are concatenated into two arrays)\n//\n// Returns:\n// {\n//    xx, yy (array)   // coordinate data\n//    nn: (array)      // points in each arc\n//    paths: (array)   // Paths are arrays of one or more arc id.\n// }\n//\n// Negative arc ids in the paths array indicate a reversal of arc -(id + 1)\n//\nMapShaper.buildPathTopology = function(nn, xx, yy) {\n  var pointCount = xx.length,\n      chainIds = initPointChains(xx, yy),\n      pathIds = initPathIds(pointCount, nn),\n      index = new ArcIndex(pointCount),\n      slice = usingTypedArrays() ? xx.subarray : Array.prototype.slice,\n      paths, retn;\n  paths = convertPaths(nn);\n  retn = index.getVertexData();\n  retn.paths = paths;\n  return retn;\n\n  function usingTypedArrays() {\n    return !!(xx.subarray && yy.subarray);\n  }\n\n  function convertPaths(nn) {\n    var paths = [],\n        pointId = 0,\n        pathLen;\n    for (var i=0, len=nn.length; i<len; i++) {\n      pathLen = nn[i];\n      paths.push(pathLen < 2 ? null : convertPath(pointId, pointId + pathLen - 1));\n      pointId += pathLen;\n    }\n    return paths;\n  }\n\n  function nextPoint(id) {\n    var partId = pathIds[id],\n        nextId = id + 1;\n    if (nextId < pointCount && pathIds[nextId] === partId) {\n      return id + 1;\n    }\n    var len = nn[partId];\n    return sameXY(id, id - len + 1) ? id - len + 2 : -1;\n  }\n\n  function prevPoint(id) {\n    var partId = pathIds[id],\n        prevId = id - 1;\n    if (prevId >= 0 && pathIds[prevId] === partId) {\n      return id - 1;\n    }\n    var len = nn[partId];\n    return sameXY(id, id + len - 1) ? id + len - 2 : -1;\n  }\n\n  function sameXY(a, b) {\n    return xx[a] == xx[b] && yy[a] == yy[b];\n  }\n\n  // Convert a non-topological path to one or more topological arcs\n  // @start, @end are ids of first and last points in the path\n  // TODO: don't allow id ~id pairs\n  //\n  function convertPath(start, end) {\n    var arcIds = [],\n        firstNodeId = -1,\n        arcStartId;\n\n    // Visit each point in the path, up to but not including the last point\n    for (var i = start; i < end; i++) {\n      if (pointIsArcEndpoint(i)) {\n        if (firstNodeId > -1) {\n          arcIds.push(addEdge(arcStartId, i));\n        } else {\n          firstNodeId = i;\n        }\n        arcStartId = i;\n      }\n    }\n\n    // Identify the final arc in the path\n    if (firstNodeId == -1) {\n      // Not in an arc, i.e. no nodes have been found...\n      // Assuming that path is either an island or is congruent with one or more rings\n      arcIds.push(addRing(start, end));\n    }\n    else if (firstNodeId == start) {\n      // path endpoint is a node;\n      if (!pointIsArcEndpoint(end)) {\n        error(\"Topology error\"); // TODO: better error handling\n      }\n      arcIds.push(addEdge(arcStartId, i));\n    } else {\n      // final arc wraps around\n      arcIds.push(addSplitEdge(arcStartId, end, start + 1, firstNodeId));\n    }\n    return arcIds;\n  }\n\n  // Test if a point @id is an endpoint of a topological path\n  function pointIsArcEndpoint(id) {\n    var id2 = chainIds[id],\n        prev = prevPoint(id),\n        next = nextPoint(id),\n        prev2, next2;\n    if (prev == -1 || next == -1) {\n      // @id is an endpoint if it is the start or end of an open path\n      return true;\n    }\n    while (id != id2) {\n      prev2 = prevPoint(id2);\n      next2 = nextPoint(id2);\n      if (prev2 == -1 || next2 == -1 || brokenEdge(prev, next, prev2, next2)) {\n        // there is a discontinuity at @id -- point is arc endpoint\n        return true;\n      }\n      id2 = chainIds[id2];\n    }\n    return false;\n  }\n\n  // a and b are two vertices with the same x, y coordinates\n  // test if the segments on either side of them are also identical\n  function brokenEdge(aprev, anext, bprev, bnext) {\n    var apx = xx[aprev],\n        anx = xx[anext],\n        bpx = xx[bprev],\n        bnx = xx[bnext],\n        apy = yy[aprev],\n        any = yy[anext],\n        bpy = yy[bprev],\n        bny = yy[bnext];\n    if (apx == bnx && anx == bpx && apy == bny && any == bpy ||\n        apx == bpx && anx == bnx && apy == bpy && any == bny) {\n      return false;\n    }\n    return true;\n  }\n\n  function mergeArcParts(src, startId, endId, startId2, endId2) {\n    var len = endId - startId + endId2 - startId2 + 2,\n        ArrayClass = usingTypedArrays() ? Float64Array : Array,\n        dest = new ArrayClass(len),\n        j = 0, i;\n    for (i=startId; i <= endId; i++) {\n      dest[j++] = src[i];\n    }\n    for (i=startId2; i <= endId2; i++) {\n      dest[j++] = src[i];\n    }\n    return dest;\n  }\n\n  function addSplitEdge(start1, end1, start2, end2) {\n    var arcId = index.findMatchingArc(xx, yy, start1, end2, nextPoint, prevPoint);\n    if (arcId === null) {\n      arcId = index.addArc(mergeArcParts(xx, start1, end1, start2, end2),\n          mergeArcParts(yy, start1, end1, start2, end2));\n    }\n    return arcId;\n  }\n\n  function addEdge(start, end) {\n    // search for a matching edge that has already been generated\n    var arcId = index.findMatchingArc(xx, yy, start, end, nextPoint, prevPoint);\n    if (arcId === null) {\n      arcId = index.addArc(slice.call(xx, start, end + 1),\n          slice.call(yy, start, end + 1));\n    }\n    return arcId;\n  }\n\n  function addRing(startId, endId) {\n    var chainId = chainIds[startId],\n        pathId = pathIds[startId],\n        arcId;\n\n    while (chainId != startId) {\n      if (pathIds[chainId] < pathId) {\n        break;\n      }\n      chainId = chainIds[chainId];\n    }\n\n    if (chainId == startId) {\n      return addEdge(startId, endId);\n    }\n\n    for (var i=startId; i<endId; i++) {\n      arcId = index.findMatchingArc(xx, yy, i, i, nextPoint, prevPoint);\n      if (arcId !== null) return arcId;\n    }\n    error(\"Unmatched ring; id:\", pathId, \"len:\", nn[pathId]);\n  }\n};\n\n\n// Create a lookup table for path ids; path ids are indexed by point id\n//\nfunction initPathIds(size, pathSizes) {\n  var pathIds = new Int32Array(size),\n      j = 0;\n  for (var pathId=0, pathCount=pathSizes.length; pathId < pathCount; pathId++) {\n    for (var i=0, n=pathSizes[pathId]; i<n; i++, j++) {\n      pathIds[j] = pathId;\n    }\n  }\n  return pathIds;\n}\n\nMapShaper.replaceArcIds = function(src, replacements) {\n  return src.map(function(shape) {\n    return replaceArcsInShape(shape, replacements);\n  });\n\n  function replaceArcsInShape(shape, replacements) {\n    if (!shape) return null;\n    return shape.map(function(path) {\n      return replaceArcsInPath(path, replacements);\n    });\n  }\n\n  function replaceArcsInPath(path, replacements) {\n    return path.reduce(function(memo, id) {\n      var abs = absArcId(id);\n      var topoPath = replacements[abs];\n      if (topoPath) {\n        if (id < 0) {\n          topoPath = topoPath.concat(); // TODO: need to copy?\n          MapShaper.reversePath(topoPath);\n        }\n        for (var i=0, n=topoPath.length; i<n; i++) {\n          memo.push(topoPath[i]);\n        }\n      }\n      return memo;\n    }, []);\n  }\n};\n\n\n\n\nMapShaper.getHighPrecisionSnapInterval = function(arcs) {\n  var bb = arcs.getBounds();\n  if (!bb.hasBounds()) return 0;\n  var maxCoord = Math.max(Math.abs(bb.xmin), Math.abs(bb.ymin),\n      Math.abs(bb.xmax), Math.abs(bb.ymax));\n  return maxCoord * 1e-14;\n};\n\nMapShaper.snapCoords = function(arcs, threshold) {\n    var avgDist = MapShaper.getAvgSegment(arcs),\n        autoSnapDist = avgDist * 0.0025,\n        snapDist = autoSnapDist;\n\n  if (threshold > 0) {\n    snapDist = threshold;\n    message(utils.format(\"Applying snapping threshold of %s -- %.6f times avg. segment length\", threshold, threshold / avgDist));\n  }\n\n  var snapCount = MapShaper.snapCoordsByInterval(arcs, snapDist);\n  if (snapCount > 0) arcs.dedupCoords();\n  message(utils.format(\"Snapped %s point%s\", snapCount, utils.pluralSuffix(snapCount)));\n};\n\n// Snap together points within a small threshold\n//\nMapShaper.snapCoordsByInterval = function(arcs, snapDist) {\n  var snapCount = 0,\n      data = arcs.getVertexData();\n\n  // Get sorted coordinate ids\n  // Consider: speed up sorting -- try bucket sort as first pass.\n  //\n  var ids = utils.sortCoordinateIds(data.xx);\n  for (var i=0, n=ids.length; i<n; i++) {\n    snapCount += snapPoint(i, snapDist, ids, data.xx, data.yy);\n  }\n  return snapCount;\n\n  function snapPoint(i, limit, ids, xx, yy) {\n    var j = i,\n        n = ids.length,\n        x = xx[ids[i]],\n        y = yy[ids[i]],\n        snaps = 0,\n        id2, dx, dy;\n\n    while (++j < n) {\n      id2 = ids[j];\n      dx = xx[id2] - x;\n      if (dx > limit) break;\n      dy = yy[id2] - y;\n      if (dx === 0 && dy === 0 || dx * dx + dy * dy > limit * limit) continue;\n      xx[id2] = x;\n      yy[id2] = y;\n      snaps++;\n    }\n    return snaps;\n  }\n};\n\nutils.sortCoordinateIds = function(a) {\n  var n = a.length,\n      ids = new Uint32Array(n);\n  for (var i=0; i<n; i++) {\n    ids[i] = i;\n  }\n  utils.quicksortIds(a, ids, 0, ids.length-1);\n  return ids;\n};\n\n/*\n// Returns array of array ids, in ascending order.\n// @a array of numbers\n//\nutils.sortCoordinateIds = function(a) {\n  return utils.bucketSortIds(a);\n};\n\n// This speeds up sorting of large datasets (~2x faster for 1e7 values)\n// worth the additional code?\nutils.bucketSortIds = function(a, n) {\n  var len = a.length,\n      ids = new Uint32Array(len),\n      bounds = utils.getArrayBounds(a),\n      buckets = Math.ceil(n > 0 ? n : len / 10),\n      counts = new Uint32Array(buckets),\n      offsets = new Uint32Array(buckets),\n      i, j, offs, count;\n\n  // get bucket sizes\n  for (i=0; i<len; i++) {\n    j = bucketId(a[i], bounds.min, bounds.max, buckets);\n    counts[j]++;\n  }\n\n  // convert counts to offsets\n  offs = 0;\n  for (i=0; i<buckets; i++) {\n    offsets[i] = offs;\n    offs += counts[i];\n  }\n\n  // assign ids to buckets\n  for (i=0; i<len; i++) {\n    j = bucketId(a[i], bounds.min, bounds.max, buckets);\n    offs = offsets[j]++;\n    ids[offs] = i;\n  }\n\n  // sort each bucket with quicksort\n  for (i = 0; i<buckets; i++) {\n    count = counts[i];\n    if (count > 1) {\n      offs = offsets[i] - count;\n      utils.quicksortIds(a, ids, offs, offs + count - 1);\n    }\n  }\n  return ids;\n\n  function bucketId(val, min, max, buckets) {\n    var id = (buckets * (val - min) / (max - min)) | 0;\n    return id < buckets ? id : buckets - 1;\n  }\n};\n*/\n\nutils.quicksortIds = function (a, ids, lo, hi) {\n  if (hi - lo > 24) {\n    var pivot = a[ids[lo + hi >> 1]],\n        i = lo,\n        j = hi,\n        tmp;\n    while (i <= j) {\n      while (a[ids[i]] < pivot) i++;\n      while (a[ids[j]] > pivot) j--;\n      if (i <= j) {\n        tmp = ids[i];\n        ids[i] = ids[j];\n        ids[j] = tmp;\n        i++;\n        j--;\n      }\n    }\n    if (j > lo) utils.quicksortIds(a, ids, lo, j);\n    if (i < hi) utils.quicksortIds(a, ids, i, hi);\n  } else {\n    utils.insertionSortIds(a, ids, lo, hi);\n  }\n};\n\nutils.insertionSortIds = function(arr, ids, start, end) {\n  var id, i, j;\n  for (j = start + 1; j <= end; j++) {\n    id = ids[j];\n    for (i = j - 1; i >= start && arr[id] < arr[ids[i]]; i--) {\n      ids[i+1] = ids[i];\n    }\n    ids[i+1] = id;\n  }\n};\n\n\n\n\n// Accumulates points in buffers until #endPath() is called\n// @drain callback: function(xarr, yarr, size) {}\n//\nfunction PathImportStream(drain) {\n  var buflen = 10000,\n      xx = new Float64Array(buflen),\n      yy = new Float64Array(buflen),\n      i = 0;\n\n  this.endPath = function() {\n    drain(xx, yy, i);\n    i = 0;\n  };\n\n  this.addPoint = function(x, y) {\n    if (i >= buflen) {\n      buflen = Math.ceil(buflen * 1.3);\n      xx = utils.extendBuffer(xx, buflen);\n      yy = utils.extendBuffer(yy, buflen);\n    }\n    xx[i] = x;\n    yy[i] = y;\n    i++;\n  };\n}\n\n// Import path data from a non-topological source (Shapefile, GeoJSON, etc)\n// in preparation for identifying topology.\n// @opts.reserved_points -- estimate of points in dataset, for pre-allocating buffers\n//\nfunction PathImporter(opts) {\n  var bufSize = opts.reserved_points > 0 ? opts.reserved_points : 20000,\n      xx = new Float64Array(bufSize),\n      yy = new Float64Array(bufSize),\n      shapes = [],\n      nn = [],\n      collectionType = opts.type || null, // possible values: polygon, polyline, point\n      round = null,\n      pathId = -1,\n      shapeId = -1,\n      pointId = 0,\n      dupeCount = 0,\n      skippedPathCount = 0,\n      openRingCount = 0;\n\n  if (opts.precision) {\n    round = getRoundingFunction(opts.precision);\n  }\n\n  // mix in #addPoint() and #endPath() methods\n  utils.extend(this, new PathImportStream(importPathCoords));\n\n  this.startShape = function() {\n    shapes[++shapeId] = null;\n  };\n\n  this.importLine = function(points) {\n    setShapeType('polyline');\n    this.importPath(points);\n  };\n\n  this.importPoints = function(points) {\n    setShapeType('point');\n    if (round) {\n      points.forEach(function(p) {\n        p[0] = round(p[0]);\n        p[1] = round(p[1]);\n      });\n    }\n    points.forEach(appendToShape);\n  };\n\n  this.importRing = function(points, isHole) {\n    var area = geom.getPlanarPathArea2(points);\n    setShapeType('polygon');\n    if (isHole === true && area > 0 || isHole === false && area < 0) {\n      verbose(\"Warning: reversing\", isHole ? \"a CW hole\" : \"a CCW ring\");\n      points.reverse();\n    }\n    this.importPath(points);\n  };\n\n  // Import an array of [x, y] Points\n  this.importPath = function importPath(points) {\n    var p;\n    for (var i=0, n=points.length; i<n; i++) {\n      p = points[i];\n      this.addPoint(p[0], p[1]);\n    }\n    this.endPath();\n  };\n\n  // Return topological shape data\n  // Apply any requested snapping and rounding\n  // Remove duplicate points, check for ring inversions\n  //\n  this.done = function() {\n    var arcs;\n    var lyr = {name: ''};\n\n    if (collectionType == 'polygon' || collectionType == 'polyline') {\n\n      if (dupeCount > 0) {\n        verbose(utils.format(\"Removed %,d duplicate point%s\", dupeCount, utils.pluralSuffix(dupeCount)));\n      }\n      if (skippedPathCount > 0) {\n        // TODO: consider showing details about type of error\n        message(utils.format(\"Removed %,d path%s with defective geometry\", skippedPathCount, utils.pluralSuffix(skippedPathCount)));\n      }\n      if (openRingCount > 0) {\n        message(utils.format(\"Closed %,d open polygon ring%s\", openRingCount, utils.pluralSuffix(openRingCount)));\n      }\n\n      if (pointId > 0) {\n        if (pointId < xx.length) {\n          xx = xx.subarray(0, pointId);\n          yy = yy.subarray(0, pointId);\n        }\n        arcs = new ArcCollection(nn, xx, yy);\n\n        if (opts.auto_snap || opts.snap_interval) {\n          MapShaper.snapCoords(arcs, opts.snap_interval);\n        }\n        // Detect and handle some geometry problems\n        // TODO: print message summarizing any changes\n        MapShaper.cleanShapes(shapes, arcs, collectionType);\n      } else {\n        message(\"No geometries were imported\");\n        collectionType = null;\n      }\n    } else if (collectionType == 'point' || collectionType === null) {\n      // pass\n    } else {\n      error(\"Unexpected collection type:\", collectionType);\n    }\n\n    // If shapes are all null, don't add a shapes array or geometry_type\n    if (collectionType) {\n      lyr.geometry_type = collectionType;\n      lyr.shapes = shapes;\n    }\n\n    return {\n      arcs: arcs || null,\n      info: {},\n      layers: [lyr]\n    };\n  };\n\n  function setShapeType(t) {\n    if (!collectionType) {\n      collectionType = t;\n    } else if (t != collectionType) {\n      stop(\"[PathImporter] Mixed feature types are not allowed\");\n    }\n  }\n\n  function checkBuffers(needed) {\n    if (needed > xx.length) {\n      var newLen = Math.max(needed, Math.ceil(xx.length * 1.5));\n      xx = utils.extendBuffer(xx, newLen, pointId);\n      yy = utils.extendBuffer(yy, newLen, pointId);\n    }\n  }\n\n  function appendToShape(part) {\n    var currShape = shapes[shapeId] || (shapes[shapeId] = []);\n    currShape.push(part);\n  }\n\n  function appendPath(n) {\n    pathId++;\n    nn[pathId] = n;\n    appendToShape([pathId]);\n  }\n\n  function importPathCoords(xsrc, ysrc, n) {\n    var count = 0;\n    var x, y, prevX, prevY;\n    checkBuffers(pointId + n);\n    for (var i=0; i<n; i++) {\n      x = xsrc[i];\n      y = ysrc[i];\n      if (round) {\n        x = round(x);\n        y = round(y);\n      }\n      if (i > 0 && x == prevX && y == prevY) {\n        dupeCount++;\n      } else {\n        xx[pointId] = x;\n        yy[pointId] = y;\n        pointId++;\n        count++;\n      }\n      prevY = y;\n      prevX = x;\n    }\n\n    // check for open rings\n    if (collectionType == 'polygon' && count > 0) {\n      if (xsrc[0] != xsrc[n-1] || ysrc[0] != ysrc[n-1]) {\n        checkBuffers(pointId + 1);\n        xx[pointId] = xsrc[0];\n        yy[pointId] = ysrc[0];\n        openRingCount++;\n        pointId++;\n        count++;\n      }\n    }\n\n    appendPath(count);\n  }\n\n}\n\n\n\n\nMapShaper.importGeoJSON = function(src, opts) {\n  var srcObj = utils.isString(src) ? JSON.parse(src) : src,\n      supportedGeometries = Object.keys(GeoJSON.pathImporters),\n      idField = opts.id_field || GeoJSON.ID_FIELD,\n      properties = null,\n      geometries, srcCollection, importer, dataset;\n\n  // Convert single feature or geometry into a collection with one member\n  if (srcObj.type == 'Feature') {\n    srcCollection = {\n      type: 'FeatureCollection',\n      features: [srcObj]\n    };\n  } else if (utils.contains(supportedGeometries, srcObj.type)) {\n    srcCollection = {\n      type: 'GeometryCollection',\n      geometries: [srcObj]\n    };\n  } else {\n    srcCollection = srcObj;\n  }\n\n  if (srcCollection.type == 'FeatureCollection') {\n    properties = [];\n    geometries = srcCollection.features.map(function(feat) {\n      var rec = feat.properties || {};\n      if ('id' in feat) {\n        rec[idField] = feat.id;\n      }\n      properties.push(rec);\n      return feat.geometry;\n    });\n  } else if (srcCollection.type == 'GeometryCollection') {\n    geometries = srcCollection.geometries;\n  } else {\n    stop(\"[i] Unsupported GeoJSON type:\", srcCollection.type);\n  }\n\n  if (!geometries) {\n    stop(\"[i] Missing geometry data\");\n  }\n\n  // Import GeoJSON geometries\n  importer = new PathImporter(opts);\n  geometries.forEach(function(geom) {\n    importer.startShape();\n    if (geom) {\n      GeoJSON.importGeometry(geom, importer);\n    }\n  });\n  dataset = importer.done();\n\n  if (properties) {\n    dataset.layers[0].data = new DataTable(properties);\n  }\n  MapShaper.importCRS(dataset, srcObj);\n\n  return dataset;\n};\n\nGeoJSON.importGeometry = function(geom, importer) {\n  var type = geom.type;\n  if (type in GeoJSON.pathImporters) {\n    GeoJSON.pathImporters[type](geom.coordinates, importer);\n  } else if (type == 'GeometryCollection') {\n    geom.geometries.forEach(function(geom) {\n      GeoJSON.importGeometry(geom, importer);\n    });\n  } else {\n    verbose(\"TopoJSON.importGeometryCollection() Unsupported geometry type:\", geom.type);\n  }\n};\n\n// Functions for importing geometry coordinates using a PathImporter\n//\nGeoJSON.pathImporters = {\n  LineString: function(coords, importer) {\n    importer.importLine(coords);\n  },\n  MultiLineString: function(coords, importer) {\n    for (var i=0; i<coords.length; i++) {\n      GeoJSON.pathImporters.LineString(coords[i], importer);\n    }\n  },\n  Polygon: function(coords, importer) {\n    for (var i=0; i<coords.length; i++) {\n      importer.importRing(coords[i], i > 0);\n    }\n  },\n  MultiPolygon: function(coords, importer) {\n    for (var i=0; i<coords.length; i++) {\n      GeoJSON.pathImporters.Polygon(coords[i], importer);\n    }\n  },\n  Point: function(coord, importer) {\n    importer.importPoints([coord]);\n  },\n  MultiPoint: function(coords, importer) {\n    importer.importPoints(coords);\n  }\n};\n\nMapShaper.importCRS = function(dataset, jsonObj) {\n  if ('crs' in jsonObj) {\n    dataset.info.input_crs = jsonObj.crs;\n  }\n};\n\n\n\n\nMapShaper.getFormattedStringify = function(numArrayKeys) {\n  var keyIndex = utils.arrayToIndex(numArrayKeys);\n  var sentinel = '\\u1000\\u2FD5\\u0310';\n  var stripRxp = new RegExp('\"' + sentinel + '|' + sentinel + '\"', 'g');\n  var indentChars = '  ';\n\n  function replace(key, val) {\n    // We want to format numerical arrays like [1, 2, 3] instead of\n    // the way JSON.stringify() behaves when applying indentation.\n    // This kludge converts arrays to strings with sentinel strings inside the\n    // surrounding quotes. At the end, the sentinel strings and quotes\n    // are replaced by array brackets.\n    if (key in keyIndex && utils.isArray(val)) {\n      var str = JSON.stringify(val);\n      // make sure the array does not contain any strings\n      if (str.indexOf('\"' == -1)) {\n        return sentinel + str.replace(/,/g, ', ') + sentinel;\n      }\n    }\n    return val;\n  }\n\n  return function(obj) {\n    var json = JSON.stringify(obj, replace, indentChars);\n    return json.replace(stripRxp, '');\n  };\n};\n\n\n\n\nMapShaper.exportPointData = function(points) {\n  var data, path;\n  if (!points || points.length === 0) {\n    data = {partCount: 0, pointCount: 0};\n  } else {\n    path = {\n      points: points,\n      pointCount: points.length,\n      bounds: geom.getPathBounds(points)\n    };\n    data = {\n      bounds: path.bounds,\n      pathData: [path],\n      partCount: 1,\n      pointCount: path.pointCount\n    };\n  }\n  return data;\n};\n\n// TODO: remove duplication with MapShaper.getPathMetadata()\nMapShaper.exportPathData = function(shape, arcs, type) {\n  // kludge until Shapefile exporting is refactored\n  if (type == 'point') return MapShaper.exportPointData(shape);\n\n  var pointCount = 0,\n      bounds = new Bounds(),\n      paths = [];\n\n  if (shape && (type == 'polyline' || type == 'polygon')) {\n    shape.forEach(function(arcIds, i) {\n      var iter = arcs.getShapeIter(arcIds),\n          path = MapShaper.exportPathCoords(iter),\n          valid = true;\n      if (type == 'polygon') {\n        path.area = geom.getPlanarPathArea2(path.points);\n        valid = path.pointCount > 3 && path.area !== 0;\n      } else if (type == 'polyline') {\n        valid = path.pointCount > 1;\n      }\n      if (valid) {\n        pointCount += path.pointCount;\n        path.bounds = geom.getPathBounds(path.points);\n        bounds.mergeBounds(path.bounds);\n        paths.push(path);\n      } else {\n        verbose(\"Skipping a collapsed\", type, \"path\");\n      }\n    });\n  }\n\n  return {\n    pointCount: pointCount,\n    pathData: paths,\n    pathCount: paths.length,\n    bounds: bounds\n  };\n};\n\nMapShaper.exportPathCoords = function(iter) {\n  var points = [],\n      i = 0,\n      x, y, prevX, prevY;\n  while (iter.hasNext()) {\n    x = iter.x;\n    y = iter.y;\n    if (i === 0 || prevX != x || prevY != y) {\n      points.push([x, y]);\n      i++;\n    }\n    prevX = x;\n    prevY = y;\n  }\n  return {\n    points: points,\n    pointCount: points.length\n  };\n};\n\n\n\n\nMapShaper.exportGeoJSON = function(dataset, opts) {\n  var extension = \"json\";\n  if (opts.output_file) {\n    // override default output extension if output filename is given\n    extension = utils.getFileExtension(opts.output_file);\n  }\n  return dataset.layers.map(function(lyr) {\n    return {\n      content: MapShaper.exportGeoJSONCollection(lyr, dataset, opts, true),\n      filename: lyr.name ? lyr.name + '.' + extension : \"\"\n    };\n  });\n};\n\nMapShaper.exportGeoJSONCollection = function(lyr, dataset, opts, asString) {\n  opts = opts || {};\n  var properties = MapShaper.exportProperties(lyr.data, opts),\n      shapes = lyr.shapes,\n      ids = MapShaper.exportIds(lyr.data, opts),\n      useFeatures = !!(properties || ids),\n      geojson = {},\n      collection, collname, bounds, stringify;\n\n  if (properties && shapes && properties.length !== shapes.length) {\n    error(\"[-o] Mismatch between number of properties and number of shapes\");\n  }\n\n  if (asString) {\n    stringify = opts.prettify ? MapShaper.getFormattedStringify(['bbox', 'coordinates']) :\n      JSON.stringify;\n  }\n\n  if (useFeatures) {\n    geojson.type = 'FeatureCollection';\n    collname = 'features';\n  } else {\n    geojson.type = 'GeometryCollection';\n    collname = 'geometries';\n  }\n\n  MapShaper.exportCRS(dataset, geojson);\n  if (opts.bbox) {\n    bounds = MapShaper.getLayerBounds(lyr, dataset.arcs);\n    if (bounds.hasBounds()) {\n      geojson.bbox = bounds.toArray();\n    }\n  }\n\n  collection = (shapes || properties || []).reduce(function(memo, o, i) {\n    var shape = shapes ? shapes[i] : null,\n        exporter = GeoJSON.exporters[lyr.geometry_type],\n        obj = shape ? exporter(shape, dataset.arcs) : null;\n    if (useFeatures) {\n      obj = {\n        type: 'Feature',\n        geometry: obj,\n        properties: properties ? properties[i] : null\n      };\n      if (ids) {\n        obj.id = ids[i];\n      }\n    } else if (!obj) {\n      return memo; // don't add null objects to GeometryCollection\n    }\n    if (asString) {\n      // stringify features as soon as they are generated, to reduce the\n      // number of JS objects in memory (so larger files can be exported)\n      obj = stringify(obj);\n    }\n    memo.push(obj);\n    return memo;\n  }, []);\n\n  if (asString) {\n    geojson[collname] = [\"$\"];\n    geojson = JSON.stringify(geojson).replace('\"$\"', '\\n' + collection.join(',\\n') + '\\n');\n  } else {\n    geojson[collname] = collection;\n  }\n  return geojson;\n};\n\n// export GeoJSON or TopoJSON point geometry\nGeoJSON.exportPointGeom = function(points, arcs) {\n  var geom = null;\n  if (points.length == 1) {\n    geom = {\n      type: \"Point\",\n      coordinates: points[0]\n    };\n  } else if (points.length > 1) {\n    geom = {\n      type: \"MultiPoint\",\n      coordinates: points\n    };\n  }\n  return geom;\n};\n\nGeoJSON.exportLineGeom = function(ids, arcs) {\n  var obj = MapShaper.exportPathData(ids, arcs, \"polyline\");\n  if (obj.pointCount === 0) return null;\n  var coords = obj.pathData.map(function(path) {\n    return path.points;\n  });\n  return coords.length == 1 ? {\n    type: \"LineString\",\n    coordinates: coords[0]\n  } : {\n    type: \"MultiLineString\",\n    coordinates: coords\n  };\n};\n\nGeoJSON.exportPolygonGeom = function(ids, arcs) {\n  var obj = MapShaper.exportPathData(ids, arcs, \"polygon\");\n  if (obj.pointCount === 0) return null;\n  var groups = MapShaper.groupPolygonRings(obj.pathData);\n  var coords = groups.map(function(paths) {\n    return paths.map(function(path) {\n      return path.points;\n    });\n  });\n  return coords.length == 1 ? {\n    type: \"Polygon\",\n    coordinates: coords[0]\n  } : {\n    type: \"MultiPolygon\",\n    coordinates: coords\n  };\n};\n\nGeoJSON.exporters = {\n  polygon: GeoJSON.exportPolygonGeom,\n  polyline: GeoJSON.exportLineGeom,\n  point: GeoJSON.exportPointGeom\n};\n\n// @jsonObj is a top-level GeoJSON or TopoJSON object\nMapShaper.exportCRS = function(dataset, jsonObj) {\n  var info = dataset.info || {};\n  if ('output_crs' in info) {\n    jsonObj.crs = info.output_crs;\n  } else if ('input_crs' in info) {\n    jsonObj.crs = info.input_crs;\n  }\n};\n\n// @opt value of id-field option (empty, string or array of strings)\n// @fields array\nMapShaper.getIdField = function(fields, opt) {\n  var ids = [];\n  if (utils.isString(opt)) {\n    ids.push(opt);\n  } else if (utils.isArray(opt)) {\n    ids = opt;\n  }\n  ids.push(GeoJSON.ID_FIELD); // default id field\n  return utils.find(ids, function(name) {\n    return utils.contains(fields, name);\n  });\n};\n\nMapShaper.exportProperties = function(table, opts) {\n  var fields = table ? table.getFields() : [],\n      idField = MapShaper.getIdField(fields, opts.id_field),\n      deleteId = idField == GeoJSON.ID_FIELD, // delete default field, not user-set fields\n      properties, records;\n  if (opts.drop_table || opts.cut_table || fields.length === 0 || deleteId && fields.length == 1) {\n    return null;\n  }\n  records = table.getRecords();\n  if (deleteId) {\n    properties = records.map(function(rec) {\n      rec = utils.extend({}, rec); // copy rec;\n      delete rec[idField];\n      return rec;\n    });\n  } else {\n    properties = records;\n  }\n  return properties;\n};\n\nMapShaper.exportIds = function(table, opts) {\n  var fields = table ? table.getFields() : [],\n      idField = MapShaper.getIdField(fields, opts.id_field);\n  if (!idField) return null;\n  return table.getRecords().map(function(rec) {\n    return idField in rec ? rec[idField] : null;\n  });\n};\n\n\n\n\n\n\n\nvar TopoJSON = {};\n\n// Iterate over all arrays of arc is in a geometry object\n// @cb callback: function(ids)\n// callback returns undefined or an array of replacement ids\n//\nTopoJSON.forEachPath = function forEachPath(obj, cb) {\n  var iterators = {\n        GeometryCollection: function(o) {o.geometries.forEach(eachGeom);},\n        LineString: function(o) {\n          var retn = cb(o.arcs);\n          if (retn) o.arcs = retn;\n        },\n        MultiLineString: function(o) {eachMultiPath(o.arcs);},\n        Polygon: function(o) {eachMultiPath(o.arcs);},\n        MultiPolygon: function(o) {o.arcs.forEach(eachMultiPath);}\n      };\n\n  eachGeom(obj);\n\n  function eachGeom(o) {\n    if (o.type in iterators) {\n      iterators[o.type](o);\n    }\n  }\n\n  function eachMultiPath(arr) {\n    var retn;\n    for (var i=0; i<arr.length; i++) {\n      retn = cb(arr[i]);\n      if (retn) arr[i] = retn;\n    }\n  }\n};\n\nTopoJSON.forEachArc = function forEachArc(obj, cb) {\n  TopoJSON.forEachPath(obj, function(ids) {\n    var retn;\n    for (var i=0; i<ids.length; i++) {\n      retn = cb(ids[i]);\n      if (utils.isInteger(retn)) {\n        ids[i] = retn;\n      }\n    }\n  });\n};\n\n\n\n\n// Convert a TopoJSON topology into mapshaper's internal format\n// Side-effect: data in topology is modified\n//\nMapShaper.importTopoJSON = function(topology, opts) {\n  var layers = [],\n      dataset, arcs;\n\n  if (utils.isString(topology)) {\n    topology = JSON.parse(topology);\n  }\n\n  if (topology.arcs && topology.arcs.length > 0) {\n    // TODO: apply transform to ArcCollection, not input arcs\n    if (topology.transform) {\n      TopoJSON.decodeArcs(topology.arcs, topology.transform);\n    }\n\n    if (opts && opts.precision) {\n      TopoJSON.roundCoords(topology.arcs, opts.precision);\n    }\n\n    arcs = new ArcCollection(topology.arcs);\n  }\n\n  utils.forEachProperty(topology.objects, function(object, name) {\n    var lyr = TopoJSON.importObject(object, opts);\n\n    if (MapShaper.layerHasPaths(lyr)) {\n      MapShaper.cleanShapes(lyr.shapes, arcs, lyr.geometry_type);\n    }\n\n    lyr.name = name;\n    layers.push(lyr);\n  });\n\n  dataset = {\n    layers: layers,\n    arcs: arcs,\n    info: {}\n  };\n\n  MapShaper.importCRS(dataset, topology);\n\n  return dataset;\n};\n\n\nTopoJSON.decodeArcs = function(arcs, transform) {\n  var mx = transform.scale[0],\n      my = transform.scale[1],\n      bx = transform.translate[0],\n      by = transform.translate[1];\n\n  arcs.forEach(function(arc) {\n    var prevX = 0,\n        prevY = 0,\n        xy, x, y;\n    for (var i=0, len=arc.length; i<len; i++) {\n      xy = arc[i];\n      x = xy[0] + prevX;\n      y = xy[1] + prevY;\n      xy[0] = x * mx + bx;\n      xy[1] = y * my + by;\n      prevX = x;\n      prevY = y;\n    }\n  });\n};\n\n// TODO: consider removing dupes...\nTopoJSON.roundCoords = function(arcs, precision) {\n  var round = getRoundingFunction(precision),\n      p;\n  arcs.forEach(function(arc) {\n    for (var i=0, len=arc.length; i<len; i++) {\n      p = arc[i];\n      p[0] = round(p[0]);\n      p[1] = round(p[1]);\n    }\n  });\n};\n\nTopoJSON.importObject = function(obj, opts) {\n  if (obj.type != 'GeometryCollection') {\n    obj = {\n      type: \"GeometryCollection\",\n      geometries: [obj]\n    };\n  }\n  return TopoJSON.importGeometryCollection(obj, opts);\n};\n\nTopoJSON.importGeometryCollection = function(obj, opts) {\n  var importer = new TopoJSON.GeometryImporter(opts);\n  obj.geometries.forEach(importer.addGeometry, importer);\n  return importer.done();\n};\n\n//\n//\nTopoJSON.GeometryImporter = function(opts) {\n  var idField = opts && opts.id_field || GeoJSON.ID_FIELD,\n      properties = [],\n      shapes = [], // topological ids\n      collectionType = null;\n\n  this.addGeometry = function(geom) {\n    var type = GeoJSON.translateGeoJSONType(geom.type),\n        shapeId = shapes.length,\n        rec = geom.properties,\n        shape = null;\n\n    if ('id' in geom) {\n      rec = rec || {};\n      rec[idField] = geom.id;\n    }\n    if (rec) {\n      properties[shapeId] = rec;\n    }\n    if (type == 'point') {\n      shape = this.importPointGeometry(geom);\n    } else if (geom.type in TopoJSON.pathImporters) {\n      shape = TopoJSON.pathImporters[geom.type](geom.arcs);\n    } else {\n      if (geom.type) {\n        verbose(\"[TopoJSON] Unknown geometry type:\", geom.type);\n      }\n      // null geometry -- ok\n    }\n    shapes.push(shape);\n    this.updateCollectionType(type);\n  };\n\n  this.importPointGeometry = function(geom) {\n    var shape = null;\n    if (geom.type == 'Point') {\n      shape = [geom.coordinates];\n    } else if (geom.type == 'MultiPoint') {\n      shape = geom.coordinates;\n    } else {\n      stop(\"Invalid TopoJSON point geometry:\", geom);\n    }\n    return shape;\n  };\n\n  this.updateCollectionType = function(type) {\n    if (!collectionType) {\n      collectionType = type;\n    } else if (type && collectionType != type) {\n      collectionType = 'mixed';\n    }\n  };\n\n  this.done = function() {\n    var lyr = {};\n    if (collectionType) {\n      lyr.geometry_type = collectionType;\n      lyr.shapes = shapes;\n    }\n    if (properties.length > 0) {\n      lyr.data = new DataTable(properties);\n    }\n    return lyr;\n  };\n};\n\nTopoJSON.pathImporters = {\n  LineString: function(arcs) {\n    return [arcs];\n  },\n  MultiLineString: function(arcs) {\n    return arcs;\n  },\n  Polygon: function(arcs) {\n    return arcs;\n  },\n  MultiPolygon: function(arcs) {\n    return arcs.reduce(function(memo, arr) {\n      return memo ? memo.concat(arr) : arr;\n    }, null);\n  }\n};\n\n\n\n\nTopoJSON.getPresimplifyFunction = function(width) {\n  var quanta = 10000,  // enough resolution for pixel-level detail at 1000px width and 10x zoom\n      k = quanta / width;\n  return function(z) {\n    // could substitute a rounding function with decimal precision\n    return z === Infinity ? 0 : Math.ceil(z * k);\n  };\n};\n\n\n\n\napi.explodeFeatures = function(lyr, arcs, opts) {\n  var properties = lyr.data ? lyr.data.getRecords() : null,\n      explodedProperties = properties ? [] : null,\n      explodedShapes = [],\n      explodedLyr = utils.extend({}, lyr);\n\n  lyr.shapes.forEach(function(shp, shpId) {\n    var exploded;\n    if (!shp) {\n      explodedShapes.push(null);\n    } else {\n      if (lyr.geometry_type == 'polygon' && shp.length > 1) {\n        exploded = MapShaper.explodePolygon(shp, arcs);\n      } else {\n        exploded = MapShaper.explodeShape(shp);\n      }\n      utils.merge(explodedShapes, exploded);\n    }\n\n    explodedLyr.shapes = explodedShapes;\n    if (explodedProperties) {\n      for (var i=0, n=exploded ? exploded.length : 1; i<n; i++) {\n        explodedProperties.push(MapShaper.cloneProperties(properties[shpId]));\n      }\n    }\n  });\n\n  explodedLyr.shapes = explodedShapes;\n  if (explodedProperties) {\n    explodedLyr.data = new DataTable(explodedProperties);\n  }\n  return explodedLyr;\n};\n\nMapShaper.explodeShape = function(shp) {\n  return shp.map(function(part) {\n    return [part.concat()];\n  });\n};\n\nMapShaper.explodePolygon = function(shape, arcs) {\n  var paths = MapShaper.getPathMetadata(shape, arcs, \"polygon\");\n  var groups = MapShaper.groupPolygonRings(paths);\n  return groups.map(function(shape) {\n    return shape.map(function(path) {\n      return path.ids;\n    });\n  });\n};\n\nMapShaper.cloneProperties = function(obj) {\n  var clone = {};\n  for (var key in obj) {\n    clone[key] = obj[key];\n  }\n  return clone;\n};\n\n\n\n\nMapShaper.exportTopoJSON = function(dataset, opts) {\n  var topology = TopoJSON.exportTopology(dataset, opts),\n      stringify = JSON.stringify,\n      filename = opts.output_file || utils.getOutputFileBase(dataset) + '.json';\n  if (opts.prettify) {\n    stringify = MapShaper.getFormattedStringify('coordinates,arcs,bbox,translate,scale'.split(','));\n  }\n  return [{\n    content: stringify(topology),\n    filename: filename\n  }];\n};\n\n// Convert a dataset object to a TopoJSON topology object\nTopoJSON.exportTopology = function(src, opts) {\n  var dataset = opts.cloned ? src : TopoJSON.copyDatasetForExport(src),\n      arcs = dataset.arcs,\n      topology = {type: \"Topology\"},\n      bounds;\n\n  // generate arcs and transform\n  if (MapShaper.datasetHasPaths(dataset)) {\n    bounds = MapShaper.getDatasetBounds(dataset);\n    if (opts.bbox && bounds.hasBounds()) {\n      topology.bbox = bounds.toArray();\n    }\n    if (opts.presimplify && !dataset.arcs.getVertexData().zz) {\n      // Calculate simplification thresholds if needed\n      api.simplify(dataset, opts);\n    }\n    if (!opts.no_quantization) {\n      topology.transform = TopoJSON.transformDataset(dataset, bounds, opts);\n    }\n    MapShaper.dissolveArcs(dataset); // dissolve/prune arcs for more compact output\n    topology.arcs = TopoJSON.exportArcs(arcs, bounds, opts);\n    if (topology.transform) {\n      TopoJSON.deltaEncodeArcs(topology.arcs);\n    }\n  } else {\n    // some datasets may lack arcs; spec seems to require an array anyway\n    topology.arcs = [];\n  }\n\n  // export layers as TopoJSON named objects\n  topology.objects = dataset.layers.reduce(function(objects, lyr, i) {\n    var name = lyr.name || \"layer\" + (i + 1);\n    objects[name] = TopoJSON.exportLayer(lyr, arcs, opts);\n    return objects;\n  }, {});\n\n  // retain crs data if relevant\n  MapShaper.exportCRS(dataset, topology);\n  return topology;\n};\n\n// TODO: switch to MapShaper.copyDatasetForExport(), which is similar but\n// deep-copies shape data.\n// Clone arc data (this gets modified in place during TopoJSON export)\n// Shallow-copy shape data in each layer (gets replaced with remapped shapes)\nTopoJSON.copyDatasetForExport = function(dataset) {\n  var copy = {info: dataset.info};\n  copy.layers = dataset.layers.map(function(lyr) {\n    var shapes = lyr.shapes ? lyr.shapes.concat() : null;\n    return utils.defaults({shapes: shapes}, lyr);\n  });\n  if (dataset.arcs) {\n    copy.arcs = dataset.arcs.getFilteredCopy();\n  }\n  return copy;\n};\n\nTopoJSON.transformDataset = function(dataset, bounds, opts) {\n  var bounds2 = TopoJSON.calcExportBounds(bounds, dataset.arcs, opts),\n      fw = bounds.getTransform(bounds2),\n      inv = fw.invert();\n\n  dataset.arcs.transformPoints(function(x, y) {\n    var p = fw.transform(x, y);\n    return [Math.round(p[0]), Math.round(p[1])];\n  });\n\n  // TODO: think about handling geometrical errors introduced by quantization,\n  // e.g. segment intersections and collapsed polygon rings.\n  return {\n    scale: [inv.mx, inv.my],\n    translate: [inv.bx, inv.by]\n  };\n};\n\n// Export arcs as arrays of [x, y] and possibly [z] coordinates\nTopoJSON.exportArcs = function(arcs, bounds, opts) {\n  var fromZ = null,\n      output = [];\n  if (opts.presimplify) {\n    fromZ = TopoJSON.getPresimplifyFunction(bounds.width());\n  }\n  arcs.forEach2(function(i, n, xx, yy, zz) {\n    var arc = [], p;\n    for (var j=i + n; i<j; i++) {\n      p = [xx[i], yy[i]];\n      if (fromZ) {\n        p.push(fromZ(zz[i]));\n      }\n      arc.push(p);\n    }\n    output.push(arc.length > 1 ? arc : null);\n  });\n  return output;\n};\n\n// Apply delta encoding in-place to an array of topojson arcs\nTopoJSON.deltaEncodeArcs = function(arcs) {\n  arcs.forEach(function(arr) {\n    var ax, ay, bx, by, p;\n    for (var i=0, n=arr.length; i<n; i++) {\n      p = arr[i];\n      bx = p[0];\n      by = p[1];\n      if (i > 0) {\n        p[0] = bx - ax;\n        p[1] = by - ay;\n      }\n      ax = bx;\n      ay = by;\n    }\n  });\n};\n\n// Calculate the x, y extents that map to an integer unit in topojson output\n// as a fraction of the x- and y- extents of the average segment.\nTopoJSON.calcExportResolution = function(arcs, k) {\n  // TODO: think about the effect of long lines, e.g. from polar cuts.\n  var xy = MapShaper.getAvgSegment2(arcs);\n  return [xy[0] * k, xy[1] * k];\n};\n\n// Calculate the bounding box of quantized topojson coordinates using one\n// of several methods.\nTopoJSON.calcExportBounds = function(bounds, arcs, opts) {\n  var unitXY, xmax, ymax;\n  if (opts.topojson_precision > 0) {\n    unitXY = TopoJSON.calcExportResolution(arcs, opts.topojson_precision);\n  } else if (opts.quantization > 0) {\n    unitXY = [bounds.width() / (opts.quantization-1), bounds.height() / (opts.quantization-1)];\n  } else if (opts.precision > 0) {\n    unitXY = [opts.precision, opts.precision];\n  } else {\n    // default -- auto quantization at 0.02 of avg. segment len\n    unitXY = TopoJSON.calcExportResolution(arcs, 0.02);\n  }\n  xmax = Math.ceil(bounds.width() / unitXY[0]);\n  ymax = Math.ceil(bounds.height() / unitXY[1]);\n  return new Bounds(0, 0, xmax, ymax);\n};\n\nTopoJSON.exportProperties = function(geometries, table, opts) {\n  var properties = MapShaper.exportProperties(table, opts),\n      ids = MapShaper.exportIds(table, opts);\n  geometries.forEach(function(geom, i) {\n    if (properties) {\n      geom.properties = properties[i];\n    }\n    if (ids) {\n      geom.id = ids[i];\n    }\n  });\n};\n\n// Export a mapshaper layer as a GeometryCollection\nTopoJSON.exportLayer = function(lyr, arcs, opts) {\n  var n = MapShaper.getFeatureCount(lyr),\n      geometries = [];\n  // initialize to null geometries\n  for (var i=0; i<n; i++) {\n    geometries[i] = {type: null};\n  }\n  if (MapShaper.layerHasGeometry(lyr)) {\n    TopoJSON.exportGeometries(geometries, lyr.shapes, arcs, lyr.geometry_type);\n  }\n  if (lyr.data) {\n    TopoJSON.exportProperties(geometries, lyr.data, opts);\n  }\n  return {\n    type: \"GeometryCollection\",\n    geometries: geometries\n  };\n};\n\nTopoJSON.exportGeometries = function(geometries, shapes, coords, type) {\n  var exporter = TopoJSON.exporters[type];\n  if (exporter && shapes) {\n    shapes.forEach(function(shape, i) {\n      if (shape && shape.length > 0) {\n        geometries[i] = exporter(shape, coords);\n      }\n    });\n  }\n};\n\nTopoJSON.exportPolygonGeom = function(shape, coords) {\n  var geom = {};\n  shape = MapShaper.filterEmptyArcs(shape, coords);\n  if (!shape || shape.length === 0) {\n    geom.type = null;\n  } else if (shape.length > 1) {\n    geom.arcs = MapShaper.explodePolygon(shape, coords);\n    if (geom.arcs.length == 1) {\n      geom.arcs = geom.arcs[0];\n      geom.type = \"Polygon\";\n    } else {\n      geom.type = \"MultiPolygon\";\n    }\n  } else {\n    geom.arcs = shape;\n    geom.type = \"Polygon\";\n  }\n  return geom;\n};\n\nTopoJSON.exportLineGeom = function(shape, coords) {\n  var geom = {};\n  shape = MapShaper.filterEmptyArcs(shape, coords);\n  if (!shape || shape.length === 0) {\n    geom.type = null;\n  } else if (shape.length == 1) {\n    geom.type = \"LineString\";\n    geom.arcs = shape[0];\n  } else {\n    geom.type = \"MultiLineString\";\n    geom.arcs = shape;\n  }\n  return geom;\n};\n\nTopoJSON.exporters = {\n  polygon: TopoJSON.exportPolygonGeom,\n  polyline: TopoJSON.exportLineGeom,\n  point: GeoJSON.exportPointGeom\n};\n\n\n\n\n\nvar ShpType = {\n  NULL: 0,\n  POINT: 1,\n  POLYLINE: 3,\n  POLYGON: 5,\n  MULTIPOINT: 8,\n  POINTZ: 11,\n  POLYLINEZ: 13,\n  POLYGONZ: 15,\n  MULTIPOINTZ: 18,\n  POINTM: 21,\n  POLYLINEM: 23,\n  POLYGONM: 25,\n  MULIPOINTM: 28,\n  MULTIPATCH: 31 // not supported\n};\n\nShpType.isPolygonType = function(t) {\n  return t == 5 || t == 15 || t == 25;\n};\n\nShpType.isPolylineType = function(t) {\n  return t == 3 || t == 13 || t == 23;\n};\n\nShpType.isMultiPartType = function(t) {\n  return ShpType.isPolygonType(t) || ShpType.isPolylineType(t);\n};\n\nShpType.isMultiPointType = function(t) {\n  return t == 8 || t == 18 || t == 28;\n};\n\nShpType.isZType = function(t) {\n  return utils.contains([11,13,15,18], t);\n};\n\nShpType.isMType = function(t) {\n  return ShpType.isZType(t) || utils.contains([21,23,25,28], t);\n};\n\nShpType.hasBounds = function(t) {\n  return ShpType.isMultiPartType(t) || ShpType.isMultiPointType(t);\n};\n\n\n\n\nMapShaper.translateShapefileType = function(shpType) {\n  if (utils.contains([ShpType.POLYGON, ShpType.POLYGONM, ShpType.POLYGONZ], shpType)) {\n    return 'polygon';\n  } else if (utils.contains([ShpType.POLYLINE, ShpType.POLYLINEM, ShpType.POLYLINEZ], shpType)) {\n    return 'polyline';\n  } else if (utils.contains([ShpType.POINT, ShpType.POINTM, ShpType.POINTZ,\n      ShpType.MULTIPOINT, ShpType.MULTIPOINTM, ShpType.MULTIPOINTZ], shpType)) {\n    return 'point';\n  }\n  return null;\n};\n\nMapShaper.isSupportedShapefileType = function(t) {\n  return utils.contains([0,1,3,5,8,11,13,15,18,21,23,25,28], t);\n};\n\nMapShaper.getShapefileType = function(type) {\n  return {\n    polygon: ShpType.POLYGON,\n    polyline: ShpType.POLYLINE,\n    point: ShpType.MULTIPOINT  // TODO: use POINT when possible\n  }[type] || ShpType.NULL;\n};\n\n\n\n\n\nvar NullRecord = function() {\n  return {\n    isNull: true,\n    pointCount: 0,\n    partCount: 0,\n    byteLength: 12\n  };\n};\n\n// Returns a constructor function for a shape record class with\n//   properties and methods for reading coordinate data.\n//\n// Record properties\n//   type, isNull, byteLength, pointCount, partCount (all types)\n//\n// Record methods\n//   read(), readPoints() (all types)\n//   readBounds(), readCoords()  (all but single point types)\n//   readPartSizes() (polygon and polyline types)\n//   readZBounds(), readZ() (Z types except POINTZ)\n//   readMBounds(), readM(), hasM() (M and Z types, except POINT[MZ])\n//\nfunction ShpRecordClass(type) {\n  var hasBounds = ShpType.hasBounds(type),\n      hasParts = ShpType.isMultiPartType(type),\n      hasZ = ShpType.isZType(type),\n      hasM = ShpType.isMType(type),\n      singlePoint = !hasBounds,\n      mzRangeBytes = singlePoint ? 0 : 16,\n      constructor;\n\n  if (type === 0) {\n    return NullRecord;\n  }\n\n  // @bin is a BinArray set to the first data byte of a shape record\n  constructor = function ShapeRecord(bin, bytes) {\n    var pos = bin.position();\n    this.id = bin.bigEndian().readUint32();\n    this.type = bin.littleEndian().skipBytes(4).readUint32();\n    if (this.type === 0) {\n      return new NullRecord();\n    }\n    if (bytes > 0 !== true || (this.type != type && this.type !== 0)) {\n      error(\"Unable to read a shape -- .shp file may be corrupted\");\n    }\n    this.byteLength = bytes; // bin.readUint32() * 2 + 8; // bytes in content section + 8 header bytes\n    if (singlePoint) {\n      this.pointCount = 1;\n      this.partCount = 1;\n    } else {\n      bin.skipBytes(32); // skip bbox\n      this.partCount = hasParts ? bin.readUint32() : 1;\n      this.pointCount = bin.readUint32();\n    }\n    this._data = function() {\n      return bin.position(pos);\n    };\n  };\n\n  // base prototype has methods shared by all Shapefile types except NULL type\n  // (Type-specific methods are mixed in below)\n  var proto = {\n    // return offset of [x, y] point data in the record\n    _xypos: function() {\n      var offs = 12; // skip header & record type\n      if (!singlePoint) offs += 4; // skip point count\n      if (hasBounds) offs += 32;\n      if (hasParts) offs += 4 * this.partCount + 4; // skip part count & index\n      return offs;\n    },\n\n    readCoords: function() {\n      if (this.pointCount === 0) return null;\n      var partSizes = this.readPartSizes(),\n          xy = this._data().skipBytes(this._xypos());\n\n      return partSizes.map(function(pointCount) {\n        return xy.readFloat64Array(pointCount * 2);\n      });\n    },\n\n    readXY: function() {\n      if (this.pointCount === 0) return new Float64Array(0);\n      return this._data().skipBytes(this._xypos()).readFloat64Array(this.pointCount * 2);\n    },\n\n    readPoints: function() {\n      var xy = this.readXY(),\n          zz = hasZ ? this.readZ() : null,\n          mm = hasM && this.hasM() ? this.readM() : null,\n          points = [], p;\n\n      for (var i=0, n=xy.length / 2; i<n; i++) {\n        p = [xy[i*2], xy[i*2+1]];\n        if (zz) p.push(zz[i]);\n        if (mm) p.push(mm[i]);\n        points.push(p);\n      }\n      return points;\n    },\n\n    // Return an array of point counts in each part\n    // Parts containing zero points are skipped (Shapefiles with zero-point\n    // parts are out-of-spec but exist in the wild).\n    readPartSizes: function() {\n      var sizes = [];\n      var partLen, startId, bin;\n      if (this.pointCount === 0) {\n        // no parts\n      } else if (this.partCount == 1) {\n        // single-part type or multi-part type with one part\n        sizes.push(this.pointCount);\n      } else {\n        // more than one part\n        startId = 0;\n        bin = this._data().skipBytes(56); // skip to second entry in part index\n        for (var i=0, n=this.partCount; i<n; i++) {\n          partLen = (i < n - 1 ? bin.readUint32() : this.pointCount) - startId;\n          if (partLen > 0) {\n            sizes.push(partLen);\n            startId += partLen;\n          }\n        }\n      }\n      return sizes;\n    }\n  };\n\n  var singlePointProto = {\n    read: function() {\n      var n = 2;\n      if (hasZ) n++;\n      if (this.hasM()) n++;\n      return this._data().skipBytes(12).readFloat64Array(n);\n    },\n\n    stream: function(sink) {\n      var src = this._data().skipBytes(12);\n      sink.addPoint(src.readFloat64(), src.readFloat64());\n      sink.endPath();\n    }\n  };\n\n  var multiCoordProto = {\n    readBounds: function() {\n      return this._data().skipBytes(12).readFloat64Array(4);\n    },\n\n    stream: function(sink) {\n      var sizes = this.readPartSizes(),\n          xy = this.readXY(),\n          i = 0, j = 0, n;\n      while (i < sizes.length) {\n        n = sizes[i];\n        while (n-- > 0) {\n          sink.addPoint(xy[j++], xy[j++]);\n        }\n        sink.endPath();\n        i++;\n      }\n      if (xy.length != j) error('Counting error');\n    },\n\n    read: function() {\n      var parts = [],\n          sizes = this.readPartSizes(),\n          points = this.readPoints();\n      for (var i=0, n = sizes.length - 1; i<n; i++) {\n        parts.push(points.splice(0, sizes[i]));\n      }\n      parts.push(points);\n      return parts;\n    }\n  };\n\n  var mProto = {\n    _mpos: function() {\n      var pos = this._xypos() + this.pointCount * 16;\n      if (hasZ) {\n        pos += this.pointCount * 8 + mzRangeBytes;\n      }\n      return pos;\n    },\n\n    readMBounds: function() {\n      return this.hasM() ? this._data().skipBytes(this._mpos()).readFloat64Array(2) : null;\n    },\n\n    // TODO: group into parts, like readCoords()\n    readM: function() {\n      return this.hasM() ? this._data().skipBytes(this._mpos() + mzRangeBytes).readFloat64Array(this.pointCount) : null;\n    },\n\n    // Test if this record contains M data\n    // (according to the Shapefile spec, M data is optional in a record)\n    //\n    hasM: function() {\n      var bytesWithoutM = this._mpos(),\n          bytesWithM = bytesWithoutM + this.pointCount * 8 + mzRangeBytes;\n      if (this.byteLength == bytesWithoutM) {\n        return false;\n      } else if (this.byteLength == bytesWithM) {\n        return true;\n      } else {\n        error(\"#hasM() Counting error\");\n      }\n    }\n  };\n\n  var zProto = {\n    _zpos: function() {\n      return this._xypos() + this.pointCount * 16;\n    },\n\n    readZBounds: function() {\n      return this._data().skipBytes(this._zpos()).readFloat64Array(2);\n    },\n\n    // TODO: group into parts, like readCoords()\n    readZ: function() {\n      return this._data().skipBytes(this._zpos() + mzRangeBytes).readFloat64Array(this.pointCount);\n    }\n  };\n\n  if (singlePoint) {\n    utils.extend(proto, singlePointProto);\n  } else {\n    utils.extend(proto, multiCoordProto);\n  }\n  if (hasZ) utils.extend(proto, zProto);\n  if (hasM) utils.extend(proto, mProto);\n\n  constructor.prototype = proto;\n  proto.constructor = constructor;\n  return constructor;\n}\n\n\n\n\nutils.replaceFileExtension = function(path, ext) {\n  var info = utils.parseLocalPath(path);\n  return info.pathbase + '.' + ext;\n};\n\nutils.getPathSep = function(path) {\n  // TODO: improve\n  return path.indexOf('/') == -1 && path.indexOf('\\\\') != -1 ? '\\\\' : '/';\n};\n\n// Parse the path to a file without using Node\n// Assumes: not a directory path\nutils.parseLocalPath = function(path) {\n  var obj = {},\n      sep = utils.getPathSep(path),\n      parts = path.split(sep),\n      i;\n\n  if (parts.length == 1) {\n    obj.filename = parts[0];\n    obj.directory = \"\";\n  } else {\n    obj.filename = parts.pop();\n    obj.directory = parts.join(sep);\n  }\n  i = obj.filename.lastIndexOf('.');\n  if (i > -1) {\n    obj.extension = obj.filename.substr(i + 1);\n    obj.basename = obj.filename.substr(0, i);\n    obj.pathbase = path.substr(0, path.lastIndexOf('.'));\n  } else {\n    obj.extension = \"\";\n    obj.basename = obj.filename;\n    obj.pathbase = path;\n  }\n  return obj;\n};\n\nutils.getFileBase = function(path) {\n  return utils.parseLocalPath(path).basename;\n};\n\nutils.getFileExtension = function(path) {\n  return utils.parseLocalPath(path).extension;\n};\n\nutils.getPathBase = function(path) {\n  return utils.parseLocalPath(path).pathbase;\n};\n\nutils.getCommonFileBase = function(names) {\n  return names.reduce(function(memo, name, i) {\n    if (i === 0) {\n      memo = utils.getFileBase(name);\n    } else {\n      memo = utils.mergeNames(memo, name);\n    }\n    return memo;\n  }, \"\");\n};\n\nutils.getOutputFileBase = function(dataset) {\n  var inputFiles = dataset.info && dataset.info.input_files;\n  return inputFiles && utils.getCommonFileBase(inputFiles) || 'output';\n};\n\n\n\n\n// Guess the type of a data file from file extension, or return null if not sure\nMapShaper.guessInputFileType = function(file) {\n  var ext = utils.getFileExtension(file || '').toLowerCase(),\n      type = null;\n  if (ext == 'dbf' || ext == 'shp' || ext == 'prj') {\n    type = ext;\n  } else if (/json$/.test(ext)) {\n    type = 'json';\n  }\n  return type;\n};\n\nMapShaper.guessInputContentType = function(content) {\n  var type = null;\n  if (utils.isString(content)) {\n    type = MapShaper.stringLooksLikeJSON(content) ? 'json' : 'text';\n  } else if (utils.isObject(content) && content.type || utils.isArray(content)) {\n    type = 'json';\n  }\n  return type;\n};\n\nMapShaper.guessInputType = function(file, content) {\n  return MapShaper.guessInputFileType(file) || MapShaper.guessInputContentType(content);\n};\n\n//\nMapShaper.stringLooksLikeJSON = function(str) {\n  return /^\\s*[{[]/.test(String(str));\n};\n\nMapShaper.couldBeDsvFile = function(name) {\n  var ext = utils.getFileExtension(name).toLowerCase();\n  return /csv|tsv|txt$/.test(ext);\n};\n\n// Infer output format by considering file name and (optional) input format\nMapShaper.inferOutputFormat = function(file, inputFormat) {\n  var ext = utils.getFileExtension(file).toLowerCase(),\n      format = null;\n  if (ext == 'shp') {\n    format = 'shapefile';\n  } else if (ext == 'dbf') {\n    format = 'dbf';\n  } else if (ext == 'svg') {\n    format = 'svg';\n  } else if (/json$/.test(ext)) {\n    format = 'geojson';\n    if (ext == 'topojson' || inputFormat == 'topojson' && ext != 'geojson') {\n      format = 'topojson';\n    } else if (ext == 'json' && inputFormat == 'json') {\n      format = 'json'; // JSON table\n    }\n  } else if (MapShaper.couldBeDsvFile(file)) {\n    format = 'dsv';\n  } else if (inputFormat) {\n    format = inputFormat;\n  }\n  return format;\n};\n\nMapShaper.isZipFile = function(file) {\n  return /\\.zip$/i.test(file);\n};\n\nMapShaper.isSupportedOutputFormat = function(fmt) {\n  var types = ['geojson', 'topojson', 'json', 'dsv', 'dbf', 'shapefile', 'svg'];\n  return types.indexOf(fmt) > -1;\n};\n\nMapShaper.getFormatName = function(fmt) {\n  return {\n    geojson: 'GeoJSON',\n    topojson: 'TopoJSON',\n    json: 'JSON records',\n    dsv: 'CSV',\n    dbf: 'DBF',\n    shapefile: 'Shapefile',\n    svg: 'SVG',\n    echartsmapjson: 'Echarts-map-json  (encode)',\n    echartsmapjs: 'Echarts-map-js  (encode)',\n  }[fmt] || '';\n};\n\n// Assumes file at @path is one of Mapshaper's supported file types\nMapShaper.isBinaryFile = function(path) {\n  var ext = utils.getFileExtension(path).toLowerCase();\n  return ext == 'shp' || ext == 'dbf' || ext == 'zip'; // GUI accepts zip files\n};\n\n// Detect extensions of some unsupported file types, for cmd line validation\nMapShaper.filenameIsUnsupportedOutputType = function(file) {\n  var rxp = /\\.(shx|prj|xls|xlsx|gdb|sbn|sbx|xml|kml)$/i;\n  return rxp.test(file);\n};\n\n\n\n\nvar cli = {};\n\ncli.isFile = function(path) {\n  var ss = cli.statSync(path);\n  return ss && ss.isFile() || false;\n};\n\ncli.fileSize = function(path) {\n  var ss = cli.statSync(path);\n  return ss && ss.size || 0;\n};\n\ncli.isDirectory = function(path) {\n  var ss = cli.statSync(path);\n  return ss && ss.isDirectory() || false;\n};\n\n// @encoding (optional) e.g. 'utf8'\ncli.readFile = function(fname, encoding) {\n  var lib = require(fname == '/dev/stdin' ? 'rw' : 'fs');\n  var content = lib.readFileSync(fname);\n  if (encoding) {\n    content = MapShaper.decodeString(content, encoding);\n  }\n  return content;\n};\n\n// @content Buffer, ArrayBuffer or string\ncli.writeFile = function(path, content) {\n  if (content instanceof ArrayBuffer) {\n    content = cli.convertArrayBuffer(content);\n  }\n  require('rw').writeFileSync(path, content);\n};\n\n// Returns Node Buffer\ncli.convertArrayBuffer = function(buf) {\n  var src = new Uint8Array(buf),\n      dest = new Buffer(src.length);\n  for (var i = 0, n=src.length; i < n; i++) {\n    dest[i] = src[i];\n  }\n  return dest;\n};\n\n// Expand any \"*\" wild cards in file name\n// (For the Windows command line; unix shells do this automatically)\ncli.expandFileName = function(name) {\n  if (name.indexOf('*') == -1) return [name];\n  var path = utils.parseLocalPath(name),\n      dir = path.directory || '.',\n      listing = require('fs').readdirSync(dir),\n      rxp = utils.wildcardToRegExp(path.filename);\n\n  return listing.reduce(function(memo, item) {\n    var path = require('path').join(dir, item);\n    if (rxp.test(item) && cli.isFile(path)) {\n      memo.push(path);\n    }\n    return memo;\n  }, []);\n};\n\n// Expand any wildcards and check that files exist.\ncli.validateInputFiles = function(files) {\n  files = files.reduce(function(memo, name) {\n    return memo.concat(cli.expandFileName(name));\n  }, []);\n  files.forEach(cli.checkFileExists);\n  return files;\n};\n\ncli.validateOutputDir = function(name) {\n  if (!cli.isDirectory(name)) {\n    error(\"Output directory not found:\", name);\n  }\n};\n\n// TODO: rename and improve\n// Want to test if a path is something readable (e.g. file or stdin)\ncli.checkFileExists = function(path) {\n  if (!cli.isFile(path) && path != '/dev/stdin') {\n    stop(\"File not found (\" + path + \")\");\n  }\n};\n\ncli.statSync = function(fpath) {\n  var obj = null;\n  try {\n    obj = require('fs').statSync(fpath);\n  } catch(e) {}\n  return obj;\n};\n\n\n\n\n// Read data from a .shp file\n// @src is an ArrayBuffer, Node.js Buffer or filename\n//\n//    // Example: iterating using #nextShape()\n//    var reader = new ShpReader(buf), s;\n//    while (s = reader.nextShape()) {\n//      // process the raw coordinate data yourself...\n//      var coords = s.readCoords(); // [[x,y,x,y,...], ...] Array of parts\n//      var zdata = s.readZ();  // [z,z,...]\n//      var mdata = s.readM();  // [m,m,...] or null\n//      // .. or read the shape into nested arrays\n//      var data = s.read();\n//    }\n//\n//    // Example: reading records using a callback\n//    var reader = new ShpReader(buf);\n//    reader.forEachShape(function(s) {\n//      var data = s.read();\n//    });\n//\nfunction ShpReader(src) {\n  if (this instanceof ShpReader === false) {\n    return new ShpReader(src);\n  }\n\n  var file = utils.isString(src) ? new FileBytes(src) : new BufferBytes(src);\n  var header = parseHeader(file.readBytes(100, 0));\n  var fileSize = file.size();\n  var RecordClass = new ShpRecordClass(header.type);\n  var recordOffs, i, skippedBytes;\n\n  reset();\n\n  this.header = function() {\n    return header;\n  };\n\n  // Callback interface: for each record in a .shp file, pass a\n  //   record object to a callback function\n  //\n  this.forEachShape = function(callback) {\n    var shape = this.nextShape();\n    while (shape) {\n      callback(shape);\n      shape = this.nextShape();\n    }\n  };\n\n  // Iterator interface for reading shape records\n  this.nextShape = function() {\n    var shape = readShapeAtOffset(recordOffs, i),\n        offs2, skipped;\n    if (!shape && recordOffs + 12 <= fileSize) {\n      // Very rarely, in-the-wild .shp files may contain junk bytes between\n      // records; it may be possible to scan past the junk to find the next record.\n      shape = huntForNextShape(recordOffs + 4, i);\n    }\n    if (shape) {\n      recordOffs += shape.byteLength;\n      if (shape.id < i) {\n        // Encountered in ne_10m_railroads.shp from natural earth v2.0.0\n        message(\"[shp] Record \" + shape.id + \" appears more than once -- possible file corruption.\");\n        return this.nextShape();\n      }\n      i++;\n    } else {\n      if (skippedBytes > 0) {\n        // Encountered in ne_10m_railroads.shp from natural earth v2.0.0\n        message(\"[shp] Skipped \" + skippedBytes + \" bytes in .shp file -- possible data loss.\");\n      }\n      file.close();\n      reset();\n    }\n    return shape;\n  };\n\n  function reset() {\n    recordOffs = 100;\n    skippedBytes = 0;\n    i = 1; // Shapefile id of first record\n  }\n\n  function parseHeader(bin) {\n    var header = {\n      signature: bin.bigEndian().readUint32(),\n      byteLength: bin.skipBytes(20).readUint32() * 2,\n      version: bin.littleEndian().readUint32(),\n      type: bin.readUint32(),\n      bounds: bin.readFloat64Array(4), // xmin, ymin, xmax, ymax\n      zbounds: bin.readFloat64Array(2),\n      mbounds: bin.readFloat64Array(2)\n    };\n\n    if (header.signature != 9994) {\n      error(\"Not a valid .shp file\");\n    }\n\n    if (!MapShaper.isSupportedShapefileType(header.type)) {\n      error(\"Unsupported .shp type:\", header.type);\n    }\n\n    if (header.byteLength != file.size()) {\n      error(\"File size of .shp doesn't match size in header\");\n    }\n\n    return header;\n  }\n\n  function readShapeAtOffset(recordOffs, i) {\n    var shape = null,\n        recordSize, recordType, recordId, goodId, goodSize, goodType, bin;\n\n    if (recordOffs + 12 <= fileSize) {\n      bin = file.readBytes(12, recordOffs);\n      recordId = bin.bigEndian().readUint32();\n      // record size is bytes in content section + 8 header bytes\n      recordSize = bin.readUint32() * 2 + 8;\n      recordType = bin.littleEndian().readUint32();\n      goodId = recordId == i; // not checking id ...\n      goodSize = recordOffs + recordSize <= fileSize && recordSize >= 12;\n      goodType = recordType === 0 || recordType == header.type;\n      if (goodSize && goodType) {\n        bin = file.readBytes(recordSize, recordOffs);\n        shape = new RecordClass(bin, recordSize);\n      }\n    }\n    return shape;\n  }\n\n  // TODO: add tests\n  // Try to scan past unreadable content to find next record\n  function huntForNextShape(start, id) {\n    var offset = start,\n        shape = null,\n        bin, recordId, recordType;\n    while (offset + 12 <= fileSize) {\n      bin = file.readBytes(12, offset);\n      recordId = bin.bigEndian().readUint32();\n      recordType = bin.littleEndian().skipBytes(4).readUint32();\n      if (recordId == id && (recordType == header.type || recordType === 0)) {\n        // we have a likely position, but may still be unparsable\n        shape = readShapeAtOffset(offset, id);\n        break;\n      }\n      offset += 4; // try next integer position\n    }\n    skippedBytes += shape ? offset - start : fileSize - start;\n    return shape;\n  }\n}\n\nShpReader.prototype.type = function() {\n  return this.header().type;\n};\n\nShpReader.prototype.getCounts = function() {\n  var counts = {\n    nullCount: 0,\n    partCount: 0,\n    shapeCount: 0,\n    pointCount: 0\n  };\n  this.forEachShape(function(shp) {\n    if (shp.isNull) counts.nullCount++;\n    counts.pointCount += shp.pointCount;\n    counts.partCount += shp.partCount;\n    counts.shapeCount++;\n  });\n  return counts;\n};\n\n// Same interface as FileBytes, for reading from a buffer instead of a file.\nfunction BufferBytes(buf) {\n  var bin = new BinArray(buf),\n      bufSize = bin.size();\n  this.readBytes = function(len, offset) {\n    if (bufSize < offset + len) error(\"Out-of-range error\");\n    bin.position(offset);\n    return bin;\n  };\n\n  this.size = function() {\n    return bufSize;\n  };\n\n  this.close = function() {};\n}\n\n// Read a binary file in chunks, to support files > 1GB in Node\nfunction FileBytes(path) {\n  var DEFAULT_BUF_SIZE = 0xffffff, // 16 MB\n      fs = require('fs'),\n      fileSize = cli.fileSize(path),\n      cacheOffs = 0,\n      cache, fd;\n\n  this.readBytes = function(len, start) {\n    if (fileSize < start + len) error(\"Out-of-range error\");\n    if (!cache || start < cacheOffs || start + len > cacheOffs + cache.size()) {\n      updateCache(len, start);\n    }\n    cache.position(start - cacheOffs);\n    return cache;\n  };\n\n  this.size = function() {\n    return fileSize;\n  };\n\n  this.close = function() {\n    if (fd) {\n      fs.closeSync(fd);\n      fd = null;\n      cache = null;\n      cacheOffs = 0;\n    }\n  };\n\n  function updateCache(len, start) {\n    var headroom = fileSize - start,\n        bufSize = Math.min(headroom, Math.max(DEFAULT_BUF_SIZE, len)),\n        buf = new Buffer(bufSize),\n        bytesRead;\n    if (!fd) fd = fs.openSync(path, 'r');\n    bytesRead = fs.readSync(fd, buf, 0, bufSize, start);\n    if (bytesRead < bufSize) error(\"Error reading file\");\n    cacheOffs = start;\n    cache = new BinArray(buf);\n  }\n}\n\n\n\n\n// Read Shapefile data from a file, ArrayBuffer or Buffer\n// @src filename or buffer\nMapShaper.importShp = function(src, opts) {\n  var reader = new ShpReader(src),\n      shpType = reader.type(),\n      type = MapShaper.translateShapefileType(shpType),\n      importOpts = utils.defaults({\n        type: type,\n        reserved_points: Math.round(reader.header().byteLength / 16)\n      }, opts),\n      importer = new PathImporter(importOpts);\n\n  if (!MapShaper.isSupportedShapefileType(shpType)) {\n    stop(\"Unsupported Shapefile type:\", shpType);\n  }\n  if (ShpType.isZType(shpType)) {\n    message(\"Warning: Shapefile Z data will be lost.\");\n  } else if (ShpType.isMType(shpType)) {\n    message(\"Warning: Shapefile M data will be lost.\");\n  }\n\n  // TODO: test cases: null shape; non-null shape with no valid parts\n  reader.forEachShape(function(shp) {\n    importer.startShape();\n    if (shp.isNull) {\n      // skip\n    } else if (type == 'point') {\n      importer.importPoints(shp.readPoints());\n    } else {\n      shp.stream(importer);\n    }\n  });\n\n  return importer.done();\n};\n\n\n\n\n// Convert a dataset to Shapefile files\nMapShaper.exportShapefile = function(dataset, opts) {\n  return dataset.layers.reduce(function(files, lyr) {\n    var prj = MapShaper.exportPrjFile(lyr, dataset);\n    files = files.concat(MapShaper.exportShpAndShxFiles(lyr, dataset, opts));\n    files = files.concat(MapShaper.exportDbfFile(lyr, dataset, opts));\n    if (prj) files.push(prj);\n    return files;\n  }, []);\n};\n\nMapShaper.exportPrjFile = function(lyr, dataset) {\n  var outputPrj = dataset.info && dataset.info.output_prj;\n  if (!outputPrj && outputPrj !== null) { // null value indicates crs is unknown\n    outputPrj = dataset.info && dataset.info.input_prj;\n  }\n  return outputPrj ? {\n    content: outputPrj,\n    filename: lyr.name + '.prj'\n  } : null;\n};\n\nMapShaper.exportShpAndShxFiles = function(layer, dataset, opts) {\n  var geomType = layer.geometry_type;\n  var shpType = MapShaper.getShapefileType(geomType);\n  var fileBytes = 100;\n  var bounds = new Bounds();\n  var shapes = layer.shapes || utils.initializeArray(new Array(MapShaper.getFeatureCount(layer)), null);\n  var shapeBuffers = shapes.map(function(shape, i) {\n    var pathData = MapShaper.exportPathData(shape, dataset.arcs, geomType);\n    var rec = MapShaper.exportShpRecord(pathData, i+1, shpType);\n    fileBytes += rec.buffer.byteLength;\n    if (rec.bounds) bounds.mergeBounds(rec.bounds);\n    return rec.buffer;\n  });\n\n  // write .shp header section\n  var shpBin = new BinArray(fileBytes, false)\n    .writeInt32(9994)\n    .skipBytes(5 * 4)\n    .writeInt32(fileBytes / 2)\n    .littleEndian()\n    .writeInt32(1000)\n    .writeInt32(shpType);\n\n  if (bounds.hasBounds()) {\n    shpBin.writeFloat64(bounds.xmin || 0) // using 0s as empty value\n      .writeFloat64(bounds.ymin || 0)\n      .writeFloat64(bounds.xmax || 0)\n      .writeFloat64(bounds.ymax || 0);\n  } else {\n    // no bounds -- assume no shapes or all null shapes -- using 0s as bbox\n    shpBin.skipBytes(4 * 8);\n  }\n\n  shpBin.skipBytes(4 * 8); // skip Z & M type bounding boxes;\n\n  // write .shx header\n  var shxBytes = 100 + shapeBuffers.length * 8;\n  var shxBin = new BinArray(shxBytes, false)\n    .writeBuffer(shpBin.buffer(), 100) // copy .shp header to .shx\n    .position(24)\n    .bigEndian()\n    .writeInt32(shxBytes/2)\n    .position(100);\n\n  // write record sections of .shp and .shx\n  shapeBuffers.forEach(function(buf, i) {\n    var shpOff = shpBin.position() / 2,\n        shpSize = (buf.byteLength - 8) / 2; // alternative: shxBin.writeBuffer(buf, 4, 4);\n    shxBin.writeInt32(shpOff);\n    shxBin.writeInt32(shpSize);\n    shpBin.writeBuffer(buf);\n  });\n\n  return [{\n      content: shpBin.buffer(),\n      filename: layer.name + \".shp\"\n    }, {\n      content: shxBin.buffer(),\n      filename: layer.name + \".shx\"\n    }];\n};\n\n// Returns an ArrayBuffer containing a Shapefile record for one shape\n//   and the bounding box of the shape.\n// TODO: remove collapsed rings, convert to null shape if necessary\n//\nMapShaper.exportShpRecord = function(data, id, shpType) {\n  var bounds = null,\n      bin = null;\n  if (data.pointCount > 0) {\n    var multiPart = ShpType.isMultiPartType(shpType),\n        partIndexIdx = 52,\n        pointsIdx = multiPart ? partIndexIdx + 4 * data.pathCount : 48,\n        recordBytes = pointsIdx + 16 * data.pointCount,\n        pointCount = 0;\n\n    bounds = data.bounds;\n    bin = new BinArray(recordBytes, false)\n      .writeInt32(id)\n      .writeInt32((recordBytes - 8) / 2)\n      .littleEndian()\n      .writeInt32(shpType)\n      .writeFloat64(bounds.xmin)\n      .writeFloat64(bounds.ymin)\n      .writeFloat64(bounds.xmax)\n      .writeFloat64(bounds.ymax);\n\n    if (multiPart) {\n      bin.writeInt32(data.pathCount);\n    } else {\n      if (data.pathData.length > 1) {\n        error(\"[exportShpRecord()] Tried to export multiple paths as type:\", shpType);\n      }\n    }\n\n    bin.writeInt32(data.pointCount);\n\n    data.pathData.forEach(function(path, i) {\n      if (multiPart) {\n        bin.position(partIndexIdx + i * 4).writeInt32(pointCount);\n      }\n      bin.position(pointsIdx + pointCount * 16);\n\n      var points = path.points;\n      for (var j=0, len=points.length; j<len; j++) {\n        bin.writeFloat64(points[j][0]);\n        bin.writeFloat64(points[j][1]);\n      }\n      pointCount += j;\n    });\n    if (data.pointCount != pointCount)\n      error(\"Shp record point count mismatch; pointCount:\",\n          pointCount, \"data.pointCount:\", data.pointCount);\n\n  } else {\n    // no data -- export null record\n    bin = new BinArray(12, false)\n      .writeInt32(id)\n      .writeInt32(2)\n      .littleEndian()\n      .writeInt32(0);\n  }\n\n  return {bounds: bounds, buffer: bin.buffer()};\n};\n\n\n\n\nMapShaper.importDbfTable = function(buf, o) {\n  var opts = o || {};\n  return new ShapefileTable(buf, opts.encoding);\n};\n\n// Implements the DataTable api for DBF file data.\n// We avoid touching the raw DBF field data if possible. This way, we don't need\n// to parse the DBF at all in common cases, like importing a Shapefile, editing\n// just the shapes and exporting in Shapefile format.\n// TODO: consider accepting just the filename, so buffer doesn't consume memory needlessly.\n//\nfunction ShapefileTable(buf, encoding) {\n  var reader = new DbfReader(buf, encoding),\n      altered = false,\n      table;\n\n  function getTable() {\n    if (!table) {\n      // export DBF records on first table access\n      table = new DataTable(reader.readRows());\n      reader = null;\n      buf = null; // null out references to DBF data for g.c.\n    }\n    return table;\n  }\n\n  this.exportAsDbf = function(encoding) {\n    // export original dbf bytes if records haven't been touched.\n    return reader && !altered ? reader.getBuffer() : getTable().exportAsDbf(encoding);\n  };\n\n  this.getRecordAt = function(i) {\n    return reader ? reader.readRow(i) : table.getRecordAt(i);\n  };\n\n  this.deleteField = function(f) {\n    if (table) {\n      table.deleteField(f);\n    } else {\n      altered = true;\n      reader.deleteField(f);\n    }\n  };\n\n  this.getRecords = function() {\n    return getTable().getRecords();\n  };\n\n  this.getFields = function() {\n    return reader ? reader.getFields() : table.getFields();\n  };\n\n  this.size = function() {\n    return reader ? reader.size() : table.size();\n  };\n}\n\nutils.extend(ShapefileTable.prototype, dataTableProto);\n\n\n\n\nMapShaper.exportDbf = function(dataset, opts) {\n  return dataset.layers.reduce(function(files, lyr) {\n    if (lyr.data) {\n      files = files.concat(MapShaper.exportDbfFile(lyr, dataset, opts));\n    }\n    return files;\n  }, []);\n};\n\nMapShaper.exportDbfFile = function(lyr, dataset, opts) {\n  var data = lyr.data,\n      buf;\n  // create empty data table if missing a table or table is being cut out\n  if (!data || opts.cut_table || opts.drop_table) {\n    data = new DataTable(lyr.shapes.length);\n  }\n  // dbfs should have at least one column; add id field if none\n  if (data.getFields().length === 0) {\n    data.addIdField();\n  }\n  buf = data.exportAsDbf(opts.encoding || 'utf8');\n  if (utils.isInteger(opts.ldid)) {\n    new Uint8Array(buf)[29] = opts.ldid; // set language driver id\n  }\n  // TODO: also export .cpg page\n  return [{\n    content: buf,\n    filename: lyr.name + '.dbf'\n  }];\n};\n\n\n\n\n\n\n\napi.svgStyle = function(lyr, dataset, opts) {\n  var keys = Object.keys(opts),\n      svgFields = MapShaper.getStyleFields(keys, MapShaper.svgStyles, MapShaper.invalidSvgTypes[lyr.geometry_type]);\n\n  svgFields.forEach(function(f) {\n    var val = opts[f];\n    var literal = null;\n    var records, func;\n    var type = MapShaper.svgStyleTypes[f];\n    if (!lyr.data) {\n      MapShaper.initDataTable(lyr);\n    }\n    if (type == 'number' && MapShaper.isSvgNumber(val)) {\n      literal = Number(val);\n    } else if (type == 'color' && MapShaper.isSvgColor(val, lyr.data.getFields())) {\n      literal = val;\n    } else if (type == 'classname' && MapShaper.isSvgClassName(val, lyr.data.getFields())) {\n      literal = val;\n    }\n    if (literal === null) {\n      func = MapShaper.compileValueExpression(val, lyr, dataset.arcs);\n    }\n\n    records = lyr.data.getRecords();\n    records.forEach(function(rec, i) {\n      rec[f] = func ? func(i) : literal;\n    });\n  });\n};\n\nMapShaper.isSvgClassName = function(str, fields) {\n  str = str.trim();\n  return (!fields || fields.indexOf(str) == -1) && /^( ?[_a-z][-_a-z0-9]*\\b)+$/i.test(str);\n};\n\nMapShaper.isSvgNumber = function(o) {\n  return utils.isFiniteNumber(o) || utils.isString(o) && /^-?[.0-9]+$/.test(o);\n};\n\nMapShaper.isSvgColor = function(str, fields) {\n  str = str.trim();\n  return (!fields || fields.indexOf(str) == -1) && /^[a-z]+$/i.test(str) ||\n    /^#[0-9a-f]+$/i.test(str) || /^rgba?\\([0-9,. ]+\\)$/.test(str);\n};\n\nMapShaper.getStyleFields = function(fields, index, blacklist) {\n  return fields.reduce(function(memo, f) {\n    if (f in index) {\n      if (!blacklist || blacklist.indexOf(f) == -1) {\n        memo.push(f);\n      }\n    }\n    return memo;\n  }, []);\n};\n\nMapShaper.getSvgStyleFields = function(lyr) {\n  var fields = lyr.data ? lyr.data.getFields() : [];\n  return MapShaper.getStyleFields(fields, MapShaper.svgStyles, MapShaper.invalidSvgTypes[lyr.geometry_type]);\n};\n\nMapShaper.layerHasSvgDisplayStyle = function(lyr) {\n  var fields = MapShaper.getSvgStyleFields(lyr);\n  return utils.difference(fields, ['opacity', 'class']).length > 0;\n};\n\nMapShaper.invalidSvgTypes = {\n  polygon: ['r'],\n  polyline: ['r', 'fill']\n};\n\nMapShaper.svgStyles = {\n  'class': 'class',\n  opacity: 'opacity',\n  r: 'radius',\n  fill: 'fillColor',\n  stroke: 'strokeColor',\n  stroke_width: 'strokeWidth'\n};\n\nMapShaper.svgStyleTypes = {\n  class: 'classname',\n  opacity: 'number',\n  r: 'number',\n  fill: 'color',\n  stroke: 'color',\n  stroke_width: 'number'\n};\n\n\n\n\nvar SVG = {};\n\nSVG.importGeoJSONFeatures = function(features) {\n  return features.map(function(obj, i) {\n    var geom = obj.type == 'Feature' ? obj.geometry : obj; // could be null\n    var geomType = geom && geom.type;\n    var svgObj;\n    if (!geomType) {\n      return {tag: 'g'}; // empty element\n    }\n    svgObj = SVG.geojsonImporters[geomType](geom.coordinates);\n    if (obj.properties) {\n      SVG.applyStyleAttributes(svgObj, geomType, obj.properties);\n    }\n    if ('id' in obj) {\n      if (!svgObj.properties) {\n        svgObj.properties = {};\n      }\n      svgObj.properties.id = obj.id;\n    }\n    return svgObj;\n  });\n};\n\nSVG.stringify = function(obj) {\n  var svg = '<' + obj.tag;\n  if (obj.properties) {\n    svg += SVG.stringifyProperties(obj.properties);\n  }\n  if (obj.children) {\n    svg += '>\\n';\n    svg += obj.children.map(SVG.stringify).join('\\n');\n    svg += '\\n</' + obj.tag + '>';\n  } else {\n    svg += '/>';\n  }\n  return svg;\n};\n\nSVG.stringifyProperties = function(o) {\n  return Object.keys(o).reduce(function(memo, key, i) {\n    var val = o[key],\n        strval = JSON.stringify(val);\n    if (strval.charAt(0) != '\"') {\n      if (!utils.isFiniteNumber(val)) {\n        // not a string or number -- skipping\n        return memo;\n      }\n      strval = '\"' + strval + '\"';\n    }\n    return memo + ' ' + key + \"=\" + strval;\n  }, '');\n};\n\n\nSVG.applyStyleAttributes = function(svgObj, geomType, rec) {\n  var properties = svgObj.properties;\n  var invalidStyles = MapShaper.invalidSvgTypes[GeoJSON.translateGeoJSONType(geomType)];\n  var fields = MapShaper.getStyleFields(Object.keys(rec), MapShaper.svgStyles, invalidStyles);\n  var k;\n  for (var i=0, n=fields.length; i<n; i++) {\n    k = fields[i];\n    SVG.setAttribute(svgObj, k.replace('_', '-'), rec[k]);\n  }\n};\n\nSVG.setAttribute = function(obj, k, v) {\n  var children, child;\n  if ((k == 'r' || k == 'class') && obj.children) {\n    // 'r' is a geometry attribute and can't be applied to a 'g' container\n    // 'class' may refer to a CSS class with a value for 'r'\n    children = obj.children;\n    for (var i=0; i<children.length; i++) {\n      child = children[i];\n      if (!child.properties) child.properties = {};\n      child.properties[k] = v;\n    }\n  } else {\n    if (!obj.properties) obj.properties = {};\n    obj.properties[k] = v;\n  }\n};\n\nSVG.importMultiGeometry = function(coords, importer) {\n  var o = {\n    tag: 'g',\n    children: []\n  };\n  for (var i=0; i<coords.length; i++) {\n    o.children.push(importer(coords[i]));\n  }\n  return o;\n};\n\nSVG.mapVertex = function(p) {\n  return p[0] + ' ' + -p[1];\n};\n\nSVG.importLineString = function(coords) {\n  var d = 'M ' + coords.map(SVG.mapVertex).join(' ');\n  return {\n    tag: 'path',\n    properties: {d: d}\n  };\n};\n\nSVG.importPoint = function(p) {\n  return {\n    tag: 'circle',\n    properties: {\n      cx: p[0],\n      cy: -p[1]\n    }\n  };\n};\n\nSVG.importPolygon = function(coords) {\n  var d, o;\n  for (var i=0; i<coords.length; i++) {\n    d = o ? o.properties.d + ' ' : '';\n    o = SVG.importLineString(coords[i]);\n    o.properties.d = d + o.properties.d + ' Z';\n  }\n  return o;\n};\n\nSVG.geojsonImporters = {\n  Point: SVG.importPoint,\n  Polygon: SVG.importPolygon,\n  LineString: SVG.importLineString,\n  MultiPoint: function(coords) {\n    return SVG.importMultiGeometry(coords, SVG.importPoint);\n  },\n  MultiLineString: function(coords) {\n    return SVG.importMultiGeometry(coords, SVG.importLineString);\n  },\n  MultiPolygon: function(coords) {\n    return SVG.importMultiGeometry(coords, SVG.importPolygon);\n  }\n};\n\n\n\n\n//\n//\nMapShaper.exportSVG = function(dataset, opts) {\n  var template = '<?xml version=\"1.0\"?>\\n<svg xmlns=\"http://www.w3.org/2000/svg\" ' +\n    'version=\"1.2\" baseProfile=\"tiny\" width=\"%d\" height=\"%d\" viewBox=\"%s %s %s %s\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\\n%s\\n</svg>';\n  var b, svg;\n  if (!opts.cloned) {\n    dataset = MapShaper.copyDataset(dataset); // Modify a copy of the dataset\n  }\n  b = MapShaper.transformCoordsForSVG(dataset, opts);\n  svg = dataset.layers.map(function(lyr) {\n    return MapShaper.exportLayerAsSVG(lyr, dataset, opts);\n  }).join('\\n');\n  svg = utils.format(template, b.width(), b.height(), 0, 0, b.width(), b.height(), svg);\n  return [{\n    content: svg,\n    filename: opts.output_file || utils.getOutputFileBase(dataset) + '.svg'\n  }];\n};\n\nMapShaper.transformCoordsForSVG = function(dataset, opts) {\n  var width = opts.width > 0 ? opts.width : 800;\n  var margin = opts.margin >= 0 ? opts.margin : 1;\n  var bounds = MapShaper.getDatasetBounds(dataset);\n  var precision = opts.precision || 0.0001;\n  var height, bounds2, fwd;\n\n\n  if (opts.svg_scale > 0) {\n    // alternative to using a fixed width (e.g. when generating multiple files\n    // at a consistent geographic scale)\n    width = bounds.width() / opts.svg_scale;\n    margin = 0;\n  }\n  MapShaper.padViewportBoundsForSVG(bounds, width, margin);\n  height = Math.ceil(width * bounds.height() / bounds.width());\n  bounds2 = new Bounds(0, -height, width, 0);\n  fwd = bounds.getTransform(bounds2);\n  MapShaper.transformPoints(dataset, function(x, y) {\n    return fwd.transform(x, y);\n  });\n\n  MapShaper.setCoordinatePrecision(dataset, precision);\n  return bounds2;\n};\n\n// pad bounds to accomodate stroke width and circle radius\nMapShaper.padViewportBoundsForSVG = function(bounds, width, marginPx) {\n  var bw = bounds.width() || bounds.height() || 1; // handle 0 width bbox\n  var marg;\n  if (marginPx >= 0 === false) {\n    marginPx = 1;\n  }\n  marg = bw / (width - marginPx * 2) * marginPx;\n  bounds.padBounds(marg, marg, marg, marg);\n};\n\nMapShaper.exportLayerAsSVG = function(lyr, dataset, opts) {\n  // TODO: convert geojson features one at a time\n  var geojson = MapShaper.exportGeoJSONCollection(lyr, dataset, opts);\n  var features = geojson.features || geojson.geometries || (geojson.type ? [geojson] : []);\n  var symbols = SVG.importGeoJSONFeatures(features);\n  var layerObj = {\n    tag: 'g',\n    children: symbols,\n    properties: {id: lyr.name}\n  };\n\n  // add default display properties to line layers\n  // (these are overridden by feature-level styles set via -svg-style)\n  if (lyr.geometry_type == 'polyline') {\n    layerObj.properties.fill = 'none';\n    layerObj.properties.stroke = 'black';\n    layerObj.properties['stroke-width'] = 1;\n  }\n\n  return SVG.stringify(layerObj);\n};\n\n\n\n\nMapShaper.roundPoints = function(lyr, round) {\n  MapShaper.forEachPoint(lyr.shapes, function(p) {\n    p[0] = round(p[0]);\n    p[1] = round(p[1]);\n  });\n};\n\nMapShaper.setCoordinatePrecision = function(dataset, precision) {\n  var round = geom.getRoundingFunction(precision);\n  var dissolvePolygon, nodes;\n  MapShaper.transformPoints(dataset, function(x, y) {\n    return [round(x), round(y)];\n  });\n  if (dataset.arcs) {\n    nodes = MapShaper.divideArcs(dataset);\n    dissolvePolygon = MapShaper.getPolygonDissolver(nodes);\n  }\n  dataset.layers.forEach(function(lyr) {\n    if (lyr.geometry_type == 'polygon' && dissolvePolygon) {\n      // clean each polygon -- use dissolve function to remove spikes\n      // TODO: better handling of corrupted polygons\n      lyr.shapes = lyr.shapes.map(dissolvePolygon);\n    }\n  });\n  return dataset;\n};\n\n\n\n\n// Generate output content from a dataset object\nMapShaper.exportDelim = function(dataset, opts) {\n  var delim = MapShaper.getExportDelimiter(dataset.info, opts),\n      ext = MapShaper.getDelimFileExtension(delim, opts);\n  return dataset.layers.reduce(function(arr, lyr) {\n    if (lyr.data){\n      arr.push({\n        // TODO: consider supporting encoding= option\n        content: MapShaper.exportDelimTable(lyr, delim),\n        filename: (lyr.name || 'output') + '.' + ext\n      });\n    }\n    return arr;\n  }, []);\n};\n\nMapShaper.exportDelimTable = function(lyr, delim) {\n  var dsv = require(\"d3-dsv\").dsvFormat(delim);\n  return dsv.format(lyr.data.getRecords());\n};\n\nMapShaper.getExportDelimiter = function(info, opts) {\n  var delim = ','; // default\n  var outputExt = opts.output_file ? utils.getFileExtension(opts.output_file) : '';\n  if (opts.delimiter) {\n    delim = opts.delimiter;\n  } else if (outputExt == 'tsv') {\n    delim = '\\t';\n  } else if (outputExt == 'csv') {\n    delim = ',';\n  } else if (info.input_delimiter) {\n    delim = info.input_delimiter;\n  }\n  return delim;\n};\n\n// If output filename is not specified, use the delimiter char to pick\n// an extension.\nMapShaper.getDelimFileExtension = function(delim, opts) {\n  var ext = 'txt'; // default\n  if (opts.output_file) {\n    ext = utils.getFileExtension(opts.output_file);\n  } else if (delim == '\\t') {\n    ext = 'tsv';\n  } else if (delim == ',') {\n    ext = 'csv';\n  }\n  return ext;\n};\n\n\n\n\nMapShaper.importJSONTable = function(arr) {\n  return {\n    layers: [{\n      data: new DataTable(arr)\n    }],\n    info: {}\n  };\n};\n\nMapShaper.exportJSON = function(dataset, opts) {\n  return dataset.layers.reduce(function(arr, lyr) {\n    if (lyr.data){\n      arr.push({\n        content: MapShaper.exportJSONTable(lyr),\n        filename: (lyr.name || 'output') + '.json'\n      });\n    }\n    return arr;\n  }, []);\n};\n\nMapShaper.exportJSONTable = function(lyr) {\n  return JSON.stringify(lyr.data.getRecords());\n};\n\n\n\n\n// Return an array of objects with \"filename\" \"filebase\" \"extension\" and\n// \"content\" attributes.\n//\nMapShaper.exportFileContent = function(dataset, opts) {\n  var outFmt = opts.format = MapShaper.getOutputFormat(dataset, opts),\n      exporter = MapShaper.exporters[outFmt],\n      files = [];\n\n  if (!outFmt) {\n    error(\"[o] Missing output format\");\n  } else if (!exporter) {\n    error(\"[o] Unknown export format:\", outFmt);\n  }\n\n  // shallow-copy dataset and layers, so layers can be renamed for export\n  dataset = utils.defaults({\n    layers: dataset.layers.map(function(lyr) {return utils.extend({}, lyr);})\n  }, dataset);\n\n  if (opts.output_file && outFmt != 'topojson') {\n    dataset.layers.forEach(function(lyr) {\n      lyr.name = utils.getFileBase(opts.output_file);\n    });\n  }\n\n  if (opts.precision && outFmt != 'svg') {\n    dataset = MapShaper.copyDatasetForExport(dataset);\n    MapShaper.setCoordinatePrecision(dataset, opts.precision);\n  }\n\n  MapShaper.validateLayerData(dataset.layers);\n  MapShaper.assignUniqueLayerNames(dataset.layers);\n\n  if (opts.cut_table) {\n    files = MapShaper.exportDataTables(dataset.layers, opts).concat(files);\n  }\n\n  files = exporter(dataset, opts).concat(files);\n  // If rounding or quantization are applied during export, bounds may\n  // change somewhat... consider adding a bounds property to each layer during\n  // export when appropriate.\n  if (opts.bbox_index) {\n    files.push(MapShaper.createIndexFile(dataset));\n  }\n\n  MapShaper.validateFileNames(files);\n  return files;\n};\n\nMapShaper.exporters = {\n  geojson: MapShaper.exportGeoJSON,\n  topojson: MapShaper.exportTopoJSON,\n  shapefile: MapShaper.exportShapefile,\n  dsv: MapShaper.exportDelim,\n  dbf: MapShaper.exportDbf,\n  json: MapShaper.exportJSON,\n  svg: MapShaper.exportSVG\n};\n\nMapShaper.getOutputFormat = function(dataset, opts) {\n  var outFile = opts.output_file || null,\n      inFmt = dataset.info && dataset.info.input_format,\n      outFmt = null;\n\n  if (opts.format) {\n    outFmt = opts.format;\n  } else if (outFile) {\n    outFmt = MapShaper.inferOutputFormat(outFile, inFmt);\n  } else if (inFmt) {\n    outFmt = inFmt;\n  }\n  return outFmt;\n};\n\n// Generate json file with bounding boxes and names of each export layer\n// TODO: consider making this a command, or at least make format settable\n//\nMapShaper.createIndexFile = function(dataset) {\n  var index = dataset.layers.map(function(lyr) {\n    var bounds = MapShaper.getLayerBounds(lyr, dataset.arcs);\n    return {\n      bbox: bounds.toArray(),\n      name: lyr.name\n    };\n  });\n\n  return {\n    content: JSON.stringify(index),\n    filename: \"bbox-index.json\"\n  };\n};\n\nMapShaper.validateLayerData = function(layers) {\n  layers.forEach(function(lyr) {\n    if (!lyr.geometry_type) {\n      // allowing data-only layers\n      if (lyr.shapes && utils.some(lyr.shapes, function(o) {\n        return !!o;\n      })) {\n        error(\"[export] A layer contains shape records and a null geometry type\");\n      }\n    } else {\n      if (!utils.contains(['polygon', 'polyline', 'point'], lyr.geometry_type)) {\n        error (\"[export] A layer has an invalid geometry type:\", lyr.geometry_type);\n      }\n      if (!lyr.shapes) {\n        error (\"[export] A layer is missing shape data\");\n      }\n    }\n  });\n};\n\nMapShaper.validateFileNames = function(files) {\n  var index = {};\n  files.forEach(function(file, i) {\n    var filename = file.filename;\n    if (!filename) error(\"[o] Missing a filename for file\" + i);\n    if (filename in index) error(\"[o] Duplicate filename\", filename);\n    index[filename] = true;\n  });\n};\n\nMapShaper.assignUniqueLayerNames = function(layers) {\n  var names = layers.map(function(lyr) {\n    return lyr.name || \"layer\";\n  });\n  var uniqueNames = MapShaper.uniqifyNames(names);\n  layers.forEach(function(lyr, i) {\n    lyr.name = uniqueNames[i];\n  });\n};\n\n// Assign unique layer names across multiple datasets\nMapShaper.assignUniqueLayerNames2 = function(datasets) {\n  var layers = datasets.reduce(function(memo, dataset) {\n    return memo.concat(dataset.layers);\n  }, []);\n  MapShaper.assignUniqueLayerNames(layers);\n};\n\nMapShaper.assignUniqueFileNames = function(output) {\n  var names = output.map(function(o) {return o.filename;});\n  var uniqnames = MapShaper.uniqifyNames(names, MapShaper.formatVersionedFileName);\n  output.forEach(function(o, i) {o.filename = uniqnames[i];});\n};\n\n/*\nMapShaper.getDefaultFileExtension = function(fileType) {\n  var ext = \"\";\n  if (fileType == 'shapefile') {\n    ext = 'shp';\n  } else if (fileType == 'geojson' || fileType == 'topojson') {\n    ext = \"json\";\n  }\n  return ext;\n};\n*/\n\nMapShaper.exportDataTables = function(layers, opts) {\n  var tables = [];\n  layers.forEach(function(lyr) {\n    if (lyr.data) {\n      tables.push({\n        content: lyr.data.exportAsJSON(), // TODO: other formats\n        filename: (lyr.name ? lyr.name + '-' : '') + 'table.json'\n      });\n    }\n  });\n  return tables;\n};\n\nMapShaper.formatVersionedName = function(name, i) {\n  var suffix = String(i);\n  if (/[0-9]$/.test(name)) {\n    suffix = '-' + suffix;\n  }\n  return name + suffix;\n};\n\nMapShaper.formatVersionedFileName = function(filename, i) {\n  var parts = filename.split('.');\n  var ext, base;\n  if (parts.length < 2) {\n    return MapShaper.formatVersionedName(filename, i);\n  }\n  ext = parts.pop();\n  base = parts.join('.');\n  return MapShaper.formatVersionedName(base, i) + '.' + ext;\n};\n\nMapShaper.uniqifyNames = function(names, formatter) {\n  var counts = utils.countValues(names),\n      format = formatter || MapShaper.formatVersionedName,\n      blacklist = {};\n\n  Object.keys(counts).forEach(function(name) {\n    if (counts[name] > 1) blacklist[name] = true; // uniqify all instances of a name\n  });\n  return names.map(function(name) {\n    var i = 1, // first version id\n        candidate = name,\n        versionedName;\n    while (candidate in blacklist) {\n      versionedName = format(name, i);\n      if (!versionedName || versionedName == candidate) {\n        throw new Error(\"Naming error\"); // catch buggy versioning function\n      }\n      candidate = versionedName;\n      i++;\n    }\n    blacklist[candidate] = true;\n    return candidate;\n  });\n};\n\n\n\n\napi.evaluateEachFeature = function(lyr, arcs, exp, opts) {\n  var n = MapShaper.getFeatureCount(lyr),\n      compiled, filter;\n\n  // TODO: consider not creating a data table -- not needed if expression only references geometry\n  if (n > 0 && !lyr.data) {\n    lyr.data = new DataTable(n);\n  }\n  if (opts && opts.where) {\n    filter = MapShaper.compileValueExpression(opts.where, lyr, arcs);\n  }\n  compiled = MapShaper.compileFeatureExpression(exp, lyr, arcs);\n  // call compiled expression with id of each record\n  for (var i=0; i<n; i++) {\n    if (!filter || filter(i)) {\n      compiled(i);\n    }\n  }\n};\n\n\n\n\n// Calculate an expression across a group of features, print and return the result\n// Supported functions include sum(), average(), max(), min(), median(), count()\n// Functions receive a field name or a feature expression (like the -each command)\n// Examples: 'sum(\"$.area\")' 'min(income)'\n// opts.expression  Expression to evaluate\n// opts.where  Optional filter expression (like -filter command)\n//\napi.calc = function(lyr, arcs, opts) {\n  var msg = 'calc ' + opts.expression,\n      result;\n  if (opts.where) {\n    // TODO: implement no_replace option for filter() instead of this\n    lyr = {\n      shapes: lyr.shapes,\n      data: lyr.data\n    };\n    api.filterFeatures(lyr, arcs, {expression: opts.where});\n    msg += ' where ' + opts.where;\n  }\n  result = MapShaper.evalCalcExpression(lyr, arcs, opts.expression);\n  message(msg + \":  \" + result);\n  return result;\n};\n\nMapShaper.evalCalcExpression = function(lyr, arcs, exp) {\n  var calc = MapShaper.compileCalcExpression(exp);\n  return calc(lyr, arcs);\n};\n\n// Return a function to evaluate a calc expression\n// (also used by mapshaper-subdivide.js)\nMapShaper.compileCalcExpression = function(exp) {\n  return function(lyr, arcs) {\n    var env = MapShaper.getCalcExpressionContext(lyr, arcs),\n        calc, retn;\n    try {\n      calc = new Function(\"env\", \"with(env){return \" + exp + \";}\");\n      retn = calc.call(null, env);\n    } catch(e) {\n      message('Error ' + (calc ? 'compiling' : 'running') + ' expression: \"' + exp + '\"');\n      stop(e);\n    }\n    return retn;\n  };\n};\n\nMapShaper.getCalcExpressionContext = function(lyr, arcs) {\n  var env = MapShaper.getBaseContext();\n  if (lyr.data) {\n    lyr.data.getFields().forEach(function(f) {\n      env[f] = f;\n    });\n  }\n  MapShaper.initCalcFunctions(env, lyr, arcs);\n  return env;\n};\n\nMapShaper.initCalcFunctions = function(env, lyr, arcs) {\n  var functions = Object.keys(new FeatureCalculator().functions);\n  functions.forEach(function(fname) {\n    env[fname] = MapShaper.getCalcFunction(fname, lyr, arcs);\n  });\n};\n\nMapShaper.getCalcFunction = function(fname, lyr, arcs) {\n  return function(exp) {\n    var calculator = new FeatureCalculator();\n    var func = calculator.functions[fname];\n    var compiled = MapShaper.compileValueExpression(exp, lyr, arcs);\n    utils.repeat(MapShaper.getFeatureCount(lyr), function(i) {\n      func(compiled(i));\n    });\n    return calculator.done()[fname];\n  };\n};\n\nfunction FeatureCalculator() {\n  var api = {},\n      count = 0,\n      sum = 0,\n      sumFlag = false,\n      avgSum = 0,\n      avgCount = 0,\n      min = Infinity,\n      max = -Infinity,\n      medianArr = [];\n\n  api.sum = function(val) {\n    sum += val;\n    sumFlag = true;\n  };\n\n  api.count = function() {\n    count++;\n  };\n\n  api.average = function(val) {\n    avgCount++;\n    avgSum += val;\n  };\n\n  api.median = function(val) {\n    medianArr.push(val);\n  };\n\n  api.max = function(val) {\n    if (val > max) max = val;\n  };\n\n  api.min = function(val) {\n    if (val < min) min = val;\n  };\n\n  function done() {\n    var results = {};\n    if (sumFlag) results.sum = sum;\n    if (avgCount > 0) results.average = avgSum / avgCount;\n    if (medianArr.length > 0) results.median = utils.findMedian(medianArr);\n    if (min < Infinity) results.min = min;\n    if (max > -Infinity) results.max = max;\n    if (count > 0) results.count = count;\n    return results;\n  }\n\n  return {\n    done: done,\n    functions: api\n  };\n}\n\n\n\n\n// Parse content of one or more input files and return a dataset\n// @obj: file data, indexed by file type\n// File data objects have two properties:\n//    content: Buffer, ArrayBuffer, String or Object\n//    filename: String or null\n//\nMapShaper.importContent = function(obj, opts) {\n  var dataset, content, fileFmt, data;\n  opts = opts || {};\n  if (obj.json) {\n    data = obj.json;\n    content = data.content;\n    if (utils.isString(content)) {\n      try {\n        content = JSON.parse(content);\n      } catch(e) {\n        stop(\"Unable to parse JSON\");\n      }\n    }\n    if (content.type == 'Topology') {\n      fileFmt = 'topojson';\n      dataset = MapShaper.importTopoJSON(content, opts);\n    } else if (content.type) {\n      fileFmt = 'geojson';\n      dataset = MapShaper.importGeoJSON(content, opts);\n    } else if (utils.isArray(content)) {\n      fileFmt = 'json';\n      dataset = MapShaper.importJSONTable(content, opts);\n    }\n  } else if (obj.text) {\n    fileFmt = 'dsv';\n    data = obj.text;\n    dataset = MapShaper.importDelim(data.content, opts);\n  } else if (obj.shp) {\n    fileFmt = 'shapefile';\n    data = obj.shp;\n    dataset = MapShaper.importShapefile(obj, opts);\n  } else if (obj.dbf) {\n    fileFmt = 'dbf';\n    data = obj.dbf;\n    dataset = MapShaper.importDbf(obj, opts);\n  }\n\n  if (!dataset) {\n    stop(\"Missing an expected input type\");\n  }\n\n  // Convert to topological format, if needed\n  if (dataset.arcs && !opts.no_topology && fileFmt != 'topojson') {\n    T.start();\n    api.buildTopology(dataset);\n    T.stop(\"Process topology\");\n  }\n\n  // Use file basename for layer name, except TopoJSON, which uses object names\n  if (fileFmt != 'topojson') {\n    MapShaper.setLayerName(dataset.layers[0], MapShaper.filenameToLayerName(data.filename || ''));\n  }\n\n  // Add input filename and format to the dataset's 'info' object\n  // (this is useful when exporting if format or name has not been specified.)\n  if (data.filename) {\n    dataset.info.input_files = [data.filename];\n  }\n  dataset.info.input_format = fileFmt;\n\n  return dataset;\n};\n\n// Deprecated (included for compatibility with older tests)\nMapShaper.importFileContent = function(content, filename, opts) {\n  var type = MapShaper.guessInputType(filename, content),\n      input = {};\n  input[type] = {filename: filename, content: content};\n  return MapShaper.importContent(input, opts);\n};\n\nMapShaper.importShapefile = function(obj, opts) {\n  var shpSrc = obj.shp.content || obj.shp.filename, // content may be missing\n      dataset = MapShaper.importShp(shpSrc, opts),\n      lyr = dataset.layers[0],\n      dbf;\n  if (obj.dbf) {\n    dbf = MapShaper.importDbf(obj, opts);\n    utils.extend(dataset.info, dbf.info);\n    lyr.data = dbf.layers[0].data;\n    if (lyr.shapes && lyr.data.size() != lyr.shapes.length) {\n      message(\"[shp] Mismatched .dbf and .shp record count -- possible data loss.\");\n    }\n  }\n  if (obj.prj) {\n    dataset.info.input_prj = obj.prj.content;\n  }\n  return dataset;\n};\n\nMapShaper.importDbf = function(input, opts) {\n  var table;\n  opts = utils.extend({}, opts);\n  if (input.cpg && !opts.encoding) {\n    opts.encoding = input.cpg.content;\n  }\n  table = MapShaper.importDbfTable(input.dbf.content, opts);\n  return {\n    info: {},\n    layers: [{data: table}]\n  };\n};\n\nMapShaper.filenameToLayerName = function(path) {\n  var name = 'layer1';\n  var obj = utils.parseLocalPath(path);\n  if (obj.basename && obj.extension) { // exclude paths like '/dev/stdin'\n    name = obj.basename;\n  }\n  return name;\n};\n\n// initialize layer name using filename\nMapShaper.setLayerName = function(lyr, path) {\n  if (!lyr.name) {\n    lyr.name = utils.getFileBase(path);\n  }\n};\n\n\n\n\napi.importFiles = function(opts) {\n  var files = opts.files ? cli.validateInputFiles(opts.files) : [],\n      dataset;\n  if ((opts.merge_files || opts.combine_files) && files.length > 1) {\n    dataset = api.mergeFiles(files, opts);\n  } else if (files.length == 1) {\n    dataset = api.importFile(files[0], opts);\n  } else if (opts.stdin) {\n    dataset = api.importFile('/dev/stdin', opts);\n  } else {\n    stop('Missing input file(s)');\n  }\n  return dataset;\n};\n\napi.importFile = function(path, opts) {\n  cli.checkFileExists(path);\n  var isBinary = MapShaper.isBinaryFile(path),\n      isShp = MapShaper.guessInputFileType(path) == 'shp',\n      input = {},\n      type, content;\n\n  if (isShp) {\n    content = null; // let ShpReader read the file (supports larger files)\n  } else if (isBinary) {\n    content = cli.readFile(path);\n  } else {\n    content = cli.readFile(path, opts && opts.encoding || 'utf-8');\n  }\n  type = MapShaper.guessInputFileType(path) || MapShaper.guessInputContentType(content);\n  if (!type) {\n    error(\"Unkown file type:\", path);\n  } else if (type == 'json') {\n    // parsing JSON here so input file can be gc'd before JSON data is imported\n    // TODO: look into incrementally parsing JSON data\n    try {\n      content = JSON.parse(content);\n    } catch(e) {\n      stop(\"Unable to parse JSON\");\n    }\n  }\n  input[type] = {filename: path, content: content};\n  content = null; // for g.c.\n  if (type == 'shp' || type == 'dbf') {\n    MapShaper.readShapefileAuxFiles(path, input);\n  }\n  if (type == 'shp' && !input.dbf) {\n    message(utils.format(\"[%s] .dbf file is missing - shapes imported without attribute data.\", path));\n  }\n  return MapShaper.importContent(input, opts);\n};\n\napi.importDataTable = function(path, opts) {\n  // TODO: avoid the overhead of importing shape data, if present\n  var dataset = api.importFile(path, opts);\n  return dataset.layers[0].data;\n};\n\nMapShaper.readShapefileAuxFiles = function(path, obj) {\n  var dbfPath = utils.replaceFileExtension(path, 'dbf');\n  var cpgPath = utils.replaceFileExtension(path, 'cpg');\n  var prjPath = utils.replaceFileExtension(path, 'prj');\n  if (cli.isFile(prjPath)) {\n    obj.prj = {filename: prjPath, content: cli.readFile(prjPath, 'utf-8')};\n  }\n  if (!obj.dbf && cli.isFile(dbfPath)) {\n    obj.dbf = {filename: dbfPath, content: cli.readFile(dbfPath)};\n  }\n  if (obj.dbf && cli.isFile(cpgPath)) {\n    obj.cpg = {filename: cpgPath, content: cli.readFile(cpgPath, 'utf-8').trim()};\n  }\n};\n\n\n\n\n// TODO: remove?\napi.exportFiles = function(dataset, opts) {\n  MapShaper.writeFiles(MapShaper.exportFileContent(dataset, opts), opts);\n};\n\nMapShaper.writeFiles = function(exports, opts, cb) {\n  if (exports.length > 0 === false) {\n    message(\"No files to save\");\n  } else if (opts.dry_run) {\n    // no output\n  } else if (opts.stdout) {\n    cli.writeFile('/dev/stdout', exports[0].content);\n  } else {\n    var paths = MapShaper.getOutputPaths(utils.pluck(exports, 'filename'), opts);\n    exports.forEach(function(obj, i) {\n      var path = paths[i];\n      cli.writeFile(path, obj.content);\n      message(\"Wrote \" + path);\n    });\n  }\n  if (cb) cb(null);\n};\n\nMapShaper.getOutputPaths = function(files, opts) {\n  var odir = opts.output_dir;\n  if (odir) {\n    files = files.map(function(file) {\n      return require('path').join(odir, file);\n    });\n  }\n  if (!opts.force) {\n    files = resolveFileCollisions(files);\n  }\n  return files;\n};\n\n// Avoid naming conflicts with existing files\n// by adding file suffixes to output filenames: -ms, -ms2, -ms3 etc.\nfunction resolveFileCollisions(candidates) {\n  var i = 0,\n      suffix = \"\",\n      paths = candidates.concat();\n\n  while (testFileCollision(paths)) {\n    i++;\n    suffix = \"-ms\";\n    if (i > 1) suffix += String(i);\n    paths = addFileSuffix(candidates, suffix);\n  }\n  return paths;\n}\n\nfunction addFileSuffix(paths, suff) {\n  return paths.map(function(path) {\n     return utils.getPathBase(path) + suff + '.' + utils.getFileExtension(path);\n  });\n}\n\nfunction testFileCollision(paths) {\n  return utils.some(paths, function(path) {\n    return cli.isFile(path) || cli.isDirectory(path);\n  });\n}\n\n\n\n\napi.filterFields = function(lyr, names) {\n  var table = lyr.data;\n  MapShaper.requireDataFields(table, names, 'filter-fields');\n  utils.difference(table.getFields(), names).forEach(table.deleteField, table);\n};\n\napi.renameFields = function(lyr, names) {\n  var map = MapShaper.mapFieldNames(names);\n  MapShaper.requireDataFields(lyr.data, Object.keys(map), 'rename-fields');\n  utils.defaults(map, MapShaper.mapFieldNames(lyr.data.getFields()));\n  lyr.data.update(MapShaper.getRecordMapper(map));\n};\n\nMapShaper.mapFieldNames = function(names) {\n  return names.reduce(function(memo, str) {\n    var parts = str.split('=');\n    var dest = parts[0],\n        src = parts[1] || dest;\n    if (!src || !dest) stop(\"[rename-fields] Invalid field description:\", str);\n    memo[src] = dest;\n    return memo;\n  }, {});\n};\n\nMapShaper.getRecordMapper = function(map) {\n  var fields = Object.keys(map);\n  return function(src) {\n    var dest = {}, key;\n    for (var i=0, n=fields.length; i<n; i++) {\n      key = fields[i];\n      dest[map[key]] = src[key];\n    }\n    return dest;\n  };\n};\n\n\n\n\napi.printInfo = function(dataset, opts) {\n  // str += utils.format(\"Number of layers: %d\\n\", dataset.layers.length);\n  // if (dataset.arcs) str += utils.format(\"Topological arcs: %'d\\n\", dataset.arcs.size());\n  var str = dataset.layers.map(function(lyr, i) {\n    var infoStr = MapShaper.getLayerInfo(lyr, dataset.arcs);\n    if (dataset.layers.length > 1) {\n      infoStr = 'Layer ' + (i + 1) + '\\n' + infoStr;\n    }\n    return infoStr;\n  }).join('\\n\\n');\n  message(str);\n};\n\n// TODO: consider polygons with zero area or other invalid geometries\nMapShaper.countNullShapes = function(shapes) {\n  var count = 0;\n  for (var i=0; i<shapes.length; i++) {\n    if (!shapes[i] || shapes[i].length === 0) count++;\n  }\n  return count;\n};\n\nMapShaper.getGeometryInfo = function(lyr, id) {\n  var type = lyr.geometry_type || \"[none]\";\n  if (utils.isInteger(id) && lyr.shapes && !lyr.shapes[id]) {\n    type = '[null]';\n  }\n  return \"Geometry: \" + type + \"\\n\";\n};\n\nMapShaper.getLayerInfo = function(lyr, arcs) {\n  var shapeCount = lyr.shapes ? lyr.shapes.length : 0,\n      nullCount = shapeCount > 0 ? MapShaper.countNullShapes(lyr.shapes) : 0,\n      str;\n  str = \"Layer name: \" + (lyr.name || \"[unnamed]\") + \"\\n\";\n  str += utils.format(\"Records: %,d\\n\", MapShaper.getFeatureCount(lyr));\n  str += MapShaper.getGeometryInfo(lyr);\n  if (nullCount > 0) {\n    str += utils.format(\"Null shapes: %'d\\n\", nullCount);\n  }\n  if (shapeCount > nullCount) {\n    str += \"Bounds: \" + MapShaper.getLayerBounds(lyr, arcs).toArray().join(' ') + \"\\n\";\n  }\n  str += MapShaper.getTableInfo(lyr);\n  return str;\n};\n\nMapShaper.getTableInfo = function(lyr, i) {\n  if (!lyr.data || lyr.data.size() === 0) {\n    return \"Attribute data: [none]\";\n  }\n  return MapShaper.getAttributeInfo(lyr.data, i);\n};\n\nMapShaper.getAttributeInfo = function(data, i) {\n  var featureId = i || 0;\n  var featureLabel = i >= 0 ? 'Value' : 'First value';\n  var fields = data.getFields().sort();\n  var replacements = {\n    '\\n': '\\\\n',\n    '\\r': '\\\\r',\n    '\\t': '\\\\t'\n  };\n  var cleanChar = function(c) {\n    // convert newlines and carriage returns\n    // TODO: better handling of non-printing chars\n    return c in replacements ? replacements[c] : '';\n  };\n  var col1Chars = fields.reduce(function(memo, name) {\n    return Math.max(memo, name.length);\n  }, 5) + 2;\n  var vals = fields.map(function(fname) {\n    return data.getRecordAt(featureId)[fname];\n  });\n  var digits = vals.map(function(val, i) {\n    return utils.isNumber(vals[i]) ? (val + '.').indexOf('.') + 1 :  0;\n  });\n  var maxDigits = Math.max.apply(null, digits);\n  var table = vals.map(function(val, i) {\n    var str = '  ' + utils.rpad(fields[i], col1Chars, ' ');\n    if (utils.isNumber(val)) {\n      str += utils.lpad(\"\", maxDigits - digits[i], ' ') + val;\n    } else if (utils.isString(val)) {\n      val = val.replace(/[\\r\\t\\n]/g, cleanChar);\n      str += \"'\" + val + \"'\";\n    } else {\n      str += String(val);\n    }\n    return str;\n  }).join('\\n');\n  return \"Attribute data\\n  \" +\n      utils.rpad('Field', col1Chars, ' ') + featureLabel + \"\\n\" + table;\n};\n\nMapShaper.getSimplificationInfo = function(arcs) {\n  var nodeCount = new NodeCollection(arcs).size();\n  // get count of non-node vertices\n  var internalVertexCount = MapShaper.countInteriorVertices(arcs);\n};\n\nMapShaper.countInteriorVertices = function(arcs) {\n  var count = 0;\n  arcs.forEach2(function(i, n) {\n    if (n > 2) {\n      count += n - 2;\n    }\n  });\n  return count;\n};\n\n\n\n\napi.innerlines = function(lyr, arcs, opts) {\n  MapShaper.requirePolygonLayer(lyr, \"[innerlines] Command requires a polygon layer\");\n  var classifier = MapShaper.getArcClassifier(lyr.shapes, arcs);\n  var lines = MapShaper.extractInnerLines(lyr.shapes, classifier);\n  var outputLyr = MapShaper.createLineLayer(lines, null);\n\n  if (lines.length === 0) {\n    message(\"[innerlines] No shared boundaries were found\");\n  }\n  outputLyr.name = opts && opts.no_replace ? null : lyr.name;\n  return outputLyr;\n};\n\napi.lines = function(lyr, arcs, opts) {\n  opts = opts || {};\n  var classifier = MapShaper.getArcClassifier(lyr.shapes, arcs),\n      fields = utils.isArray(opts.fields) ? opts.fields : [],\n      typeId = 0,\n      shapes = [],\n      records = [],\n      outputLyr;\n\n  MapShaper.requirePolygonLayer(lyr, \"[lines] Command requires a polygon layer\");\n  if (fields.length > 0 && !lyr.data) {\n    stop(\"[lines] Missing a data table\");\n  }\n\n  addLines(MapShaper.extractOuterLines(lyr.shapes, classifier));\n\n  fields.forEach(function(field) {\n    var data = lyr.data.getRecords();\n    var key = function(a, b) {\n      var arec = data[a];\n      var brec = data[b];\n      var aval, bval;\n      if (!arec || !brec || arec[field] === brec[field]) {\n        return '';\n      }\n      return a + '-' + b;\n    };\n    if (!lyr.data.fieldExists(field)) {\n      stop(\"[lines] Unknown data field:\", field);\n    }\n    addLines(MapShaper.extractLines(lyr.shapes, classifier(key)));\n  });\n\n  addLines(MapShaper.extractInnerLines(lyr.shapes, classifier));\n  outputLyr = MapShaper.createLineLayer(shapes, records);\n  outputLyr.name = opts.no_replace ? null : lyr.name;\n  return outputLyr;\n\n  function addLines(lines) {\n    var attr = lines.map(function(shp, i) {\n      return {TYPE: typeId};\n    });\n    shapes = utils.merge(lines, shapes);\n    records = utils.merge(attr, records);\n    typeId++;\n  }\n};\n\nMapShaper.createLineLayer = function(lines, records) {\n  return {\n    geometry_type: 'polyline',\n    shapes: lines,\n    data: records ? new DataTable(records) : null\n  };\n};\n\nMapShaper.extractOuterLines = function(shapes, classifier) {\n  var key = function(a, b) {return b == -1 ? String(a) : '';};\n  return MapShaper.extractLines(shapes, classifier(key));\n};\n\nMapShaper.extractInnerLines = function(shapes, classifier) {\n  var key = function(a, b) {return b > -1 ? a + '-' + b : '';};\n  return MapShaper.extractLines(shapes, classifier(key));\n};\n\nMapShaper.extractLines = function(shapes, classify) {\n  var lines = [],\n      index = {},\n      prev = null,\n      prevKey = '',\n      part;\n\n  MapShaper.traversePaths(shapes, onArc, onPart);\n\n  function onArc(o) {\n    var arcId = o.arcId,\n        key = classify(absArcId(arcId)),\n        isContinuation, line;\n    if (!!key) {\n      line = key in index ? index[key] : null;\n      isContinuation = key == prevKey && o.shapeId == prev.shapeId && o.partId == prev.partId;\n      if (!line) {\n        line = [[arcId]]; // new shape\n        index[key] = line;\n        lines.push(line);\n      } else if (isContinuation) {\n        line[line.length-1].push(arcId); // extending prev part\n      } else {\n        line.push([arcId]); // new part\n      }\n\n      // if extracted line is split across endpoint of original polygon ring, then merge\n      if (o.i == part.arcs.length - 1 &&  // this is last arc in ring\n          line.length > 1 &&              // extracted line has more than one part\n          line[0][0] == part.arcs[0]) {   // first arc of first extracted part is first arc in ring\n        line[0] = line.pop().concat(line[0]);\n      }\n    }\n    prev = o;\n    prevKey = key;\n  }\n\n  function onPart(o) {\n    part = o;\n  }\n\n  return lines;\n};\n\n\nMapShaper.getArcClassifier = function(shapes, arcs) {\n  var n = arcs.size(),\n      a = new Int32Array(n),\n      b = new Int32Array(n);\n\n  utils.initializeArray(a, -1);\n  utils.initializeArray(b, -1);\n\n  MapShaper.traversePaths(shapes, function(o) {\n    var i = absArcId(o.arcId);\n    var shpId = o.shapeId;\n    var aval = a[i];\n    if (aval == -1) {\n      a[i] = shpId;\n    } else if (shpId < aval) {\n      b[i] = aval;\n      a[i] = shpId;\n    } else {\n      b[i] = shpId;\n    }\n  });\n\n  function classify(i, getKey) {\n    var key = '';\n    if (a[i] > -1) {\n      key = getKey(a[i], b[i]);\n      if (key) {\n        a[i] = -1;\n        b[i] = -1;\n      }\n    }\n    return key;\n  }\n\n  return function(getKey) {\n    return function(i) {\n      return classify(i, getKey);\n    };\n  };\n};\n\n\n\n\napi.inspect = function(lyr, arcs, opts) {\n  var ids = MapShaper.selectFeatures(lyr, arcs, opts);\n  var msg;\n  if (ids.length == 1) {\n    msg = MapShaper.getFeatureInfo(ids[0], lyr, arcs);\n  } else {\n    msg = utils.format(\"[inspect] Expression matched %d feature%s. Select one feature for details\", ids.length, utils.pluralSuffix(ids.length));\n  }\n  message(msg);\n};\n\nMapShaper.getFeatureInfo = function(id, lyr, arcs) {\n    var msg = \"Feature \" + id + '\\n';\n    msg += MapShaper.getGeometryInfo(lyr, id);\n    msg += MapShaper.getShapeInfo(id, lyr, arcs);\n    msg += MapShaper.getTableInfo(lyr, id);\n    return msg;\n};\n\nMapShaper.getShapeInfo = function(id, lyr, arcs) {\n  var shp = lyr.shapes ? lyr.shapes[id] : null;\n  var type = lyr.geometry_type;\n  var msg = '';\n  var info;\n  if (!shp || !type) {\n    //\n  } else if (type == 'point') {\n    msg += '  Points: ' + shp.length + '\\n';\n  } else if (type == 'polyline') {\n    msg += '  Parts: ' + shp.length + '\\n';\n  } else if (type == 'polygon') {\n    info = MapShaper.getPolygonInfo(shp, arcs);\n    msg += utils.format('  Rings: %d cw, %d ccw\\n', info.cw, info.ccw);\n    msg += '  Planar area: ' + info.area + '\\n';\n    if (info.sph_area) {\n      msg += '  Spherical area: ' + info.sph_area + ' sq. meters\\n';\n    }\n  }\n  return msg;\n};\n\nMapShaper.getPolygonInfo = function(shp, arcs) {\n  var o = {rings: shp.length, cw: 0, ccw: 0, area: 0};\n  var area;\n  for (var i=0; i<shp.length; i++) {\n    area = geom.getPlanarPathArea(shp[i], arcs);\n    if (area > 0) {\n      o.cw++;\n    } else if (area < 0) {\n      o.ccw++;\n    }\n    o.area += area;\n  }\n  if (!arcs.isPlanar()) {\n    o.sph_area = geom.getSphericalShapeArea(shp, arcs);\n  }\n  return o;\n};\n\nMapShaper.selectFeatures = function(lyr, arcs, opts) {\n  var n = MapShaper.getFeatureCount(lyr),\n      ids = [],\n      filter;\n  if (!opts.expression) {\n    stop(\"[inspect] Missing a JS expression for selecting a feature\");\n  }\n  filter = MapShaper.compileValueExpression(opts.expression, lyr, arcs);\n  utils.repeat(n, function(id) {\n    var result = filter(id);\n    if (result === true) {\n      ids.push(id);\n    } else if (result !== false) {\n      stop(\"[inspect] Expression must return true or false\");\n    }\n  });\n  return ids;\n};\n\n\n\n\n// Convert a string containing delimited text data into a dataset object\nMapShaper.importDelim = function(str, opts) {\n  var delim = MapShaper.guessDelimiter(str);\n  return {\n    layers: [{\n      data: MapShaper.importDelimTable(str, delim, opts)\n    }],\n    info: {\n      input_delimiter: delim\n    }\n  };\n};\n\nMapShaper.importDelimTable = function(str, delim, opts) {\n  var records = require(\"d3-dsv\").dsvFormat(delim).parse(str);\n  var table;\n  if (records.length === 0) {\n    stop(\"[dsv] Unable to read any records\");\n  }\n  delete records.columns; // added by d3-dsv\n  MapShaper.adjustRecordTypes(records, opts && opts.field_types);\n  table = new DataTable(records);\n  MapShaper.deleteFields(table, MapShaper.isInvalidFieldName);\n return table;\n};\n\nMapShaper.supportedDelimiters = ['|', '\\t', ',', ';'];\n\nMapShaper.isSupportedDelimiter = function(d) {\n  return utils.contains(MapShaper.supportedDelimiters, d);\n};\n\nMapShaper.guessDelimiter = function(content) {\n  return utils.find(MapShaper.supportedDelimiters, function(delim) {\n    var rxp = MapShaper.getDelimiterRxp(delim);\n    return rxp.test(content);\n  }) || ',';\n};\n\n// Get RegExp to test for a delimiter before first line break of a string\n// Assumes that the first line does not contain alternate delim chars (this will\n// be true if the first line has field headers composed of word characters).\nMapShaper.getDelimiterRxp = function(delim) {\n  var rxp = \"^[^\\\\n\\\\r]+\" + utils.regexEscape(delim);\n  return new RegExp(rxp);\n};\n\n// Detect and convert data types of data from csv files.\n// TODO: decide how to handle records with inconstent properties. Mapshaper\n//    currently assumes tabular data\n// @fieldList (optional) array of field names with type hints; may contain\n//    duplicate names with inconsistent type hints.\nMapShaper.adjustRecordTypes = function(records, fieldList) {\n  var hintIndex = {},\n      fields = Object.keys(records[0] || []),\n      type;\n  if (fieldList) {\n    // parse optional type hints\n    MapShaper.parseFieldHeaders(fieldList, hintIndex);\n  }\n  fields.forEach(function(key) {\n    type = hintIndex[key] || MapShaper.detectConversionType(key, records);\n    if (type == 'number') {\n      MapShaper.convertDataField(records, key, utils.parseNumber);\n    } else if (type == 'string') {\n      MapShaper.convertDataField(records, key, utils.parseString);\n    }\n  });\n};\n\nMapShaper.convertDataField = function(records, name, f) {\n  for (var i=0, n=records.length; i<n; i++) {\n    records[i][name] = f(records[i][name]);\n  }\n};\n\n// Returns 'string', 'number' or null\n// Detection is based on value of first non-empty record\nMapShaper.detectConversionType = function(name, records) {\n  var type = null, val;\n  for (var i=0, n=records.length; i<n; i++) {\n    val = records[i][name];\n    if (!!val && utils.isString(val)) {\n      type = utils.stringIsNumeric(val) ? 'number' : 'string';\n      break;\n    }\n  }\n  return type;\n};\n\n// Accept a type hint from a header like \"FIPS:str\"\n// Return standard type name (number|string) or null if hint is not recognized\nMapShaper.validateFieldType = function(hint) {\n  var str = hint.toLowerCase(),\n      type = null;\n  if (str[0] == 'n') {\n    type = 'number';\n  } else if (str[0] == 's') {\n    type = 'string';\n  }\n  return type;\n};\n\nMapShaper.removeTypeHints = function(arr) {\n  return MapShaper.parseFieldHeaders(arr, {});\n};\n\n// Look for type hints in array of field headers\n// return index of field types\n// modify @fields to remove type hints\n//\nMapShaper.parseFieldHeaders = function(fields, index) {\n  var parsed = fields.map(function(raw) {\n    var parts, name, type;\n    if (raw.indexOf(':') != -1) {\n      parts = raw.split(':');\n      name = parts[0];\n      type = MapShaper.validateFieldType(parts[1]);\n      if (!type) {\n        message(\"Invalid type hint (expected :str or :num) [\" + raw + \"]\");\n      }\n    } else if (raw[0] === '+') { // d3-style type hint: unary plus\n      name = raw.substr(1);\n      type = 'number';\n    } else {\n      name = raw;\n    }\n    if (type) {\n      index[name] = type;\n    }\n    return name;\n  });\n  return parsed;\n};\n\nutils.stringIsNumeric = function(str) {\n  var parsed = utils.parseNumber(str);\n  // exclude values like '300 E'\n  return !isNaN(parsed) && parsed == Number(utils.cleanNumericString(str));\n};\n\n// Remove comma separators from strings\n// TODO: accept European-style numbers?\nutils.cleanNumericString = function(raw) {\n  return String(raw).replace(/,/g, '');\n};\n\n// Assume: @raw is string, undefined or null\nutils.parseString = function(raw) {\n  return raw ? raw : \"\";\n};\n\n// Assume: @raw is string, undefined or null\n// Use null instead of NaN for unparsable values\n// (in part because if NaN is used, empty strings get converted to \"NaN\"\n// when re-exported).\nutils.parseNumber = function(raw) {\n  var parsed = raw ? parseFloat(utils.cleanNumericString(raw)) : NaN;\n  return isNaN(parsed) ? null : parsed;\n};\n\n\n\n\n\napi.joinPointsToPolygons = function(targetLyr, arcs, pointLyr, opts) {\n  // TODO: copy points that can't be joined to a new layer\n  var joinFunction = MapShaper.getPolygonToPointsFunction(targetLyr, arcs, pointLyr, opts);\n  MapShaper.prepJoinLayers(targetLyr, pointLyr);\n  return MapShaper.joinTables(targetLyr.data, pointLyr.data, joinFunction, opts);\n};\n\napi.joinPolygonsToPoints = function(targetLyr, polygonLyr, arcs, opts) {\n  var joinFunction = MapShaper.getPointToPolygonFunction(targetLyr, polygonLyr, arcs, opts);\n  MapShaper.prepJoinLayers(targetLyr, polygonLyr);\n  return MapShaper.joinTables(targetLyr.data, polygonLyr.data, joinFunction, opts);\n};\n\nMapShaper.prepJoinLayers = function(targetLyr, srcLyr) {\n  if (!targetLyr.data) {\n    // create an empty data table if target layer is missing attributes\n    targetLyr.data = new DataTable(targetLyr.shapes.length);\n  }\n  if (!srcLyr.data) {\n    stop(\"[join] Can't join a layer that is missing attribute data\");\n  }\n};\n\nMapShaper.getPolygonToPointsFunction = function(polygonLyr, arcs, pointLyr, opts) {\n  var joinFunction = MapShaper.getPointToPolygonFunction(pointLyr, polygonLyr, arcs, opts);\n  var index = [];\n  var hit, polygonId;\n  for (var i=0, n=pointLyr.shapes.length; i<n; i++) {\n    hit = joinFunction(i);\n    if (hit) {\n      polygonId = hit[0]; // TODO: handle multiple hits\n      if (polygonId in index) {\n        index[polygonId].push(i);\n      } else {\n        index[polygonId] = [i];\n      }\n    }\n  }\n  // @i id of a polygon feature\n  return function(i) {\n    return index[i] || null;\n  };\n};\n\nMapShaper.getPointToPolygonFunction = function(pointLyr, polygonLyr, arcs, opts) {\n  var index = new PathIndex(polygonLyr.shapes, arcs),\n      points = pointLyr.shapes;\n\n  // @i id of a point feature\n  return function(i) {\n    var shp = points[i],\n        shpId = -1;\n    if (shp) {\n      // TODO: handle multiple hits\n      shpId = index.findEnclosingShape(shp[0]);\n    }\n    return shpId == -1 ? null : [shpId];\n  };\n};\n\n\n\n\napi.join = function(targetLyr, dataset, opts) {\n  var src, srcLyr, srcType, targetType, retn;\n  if (opts.keys) {\n    // join using data in attribute fields\n    if (opts.keys.length != 2) {\n      stop(\"[join] Expected two key fields: a target field and a source field\");\n    }\n    src = MapShaper.getJoinTable(dataset, opts);\n    retn = api.joinAttributesToFeatures(targetLyr, src, opts);\n  } else {\n    // spatial join\n    src = MapShaper.getJoinDataset(dataset, opts);\n    if (!src) {\n      stop(\"[join] Missing a joinable data source\");\n    }\n    srcLyr = src.layers[0];\n    srcType = srcLyr.geometry_type;\n    targetType = targetLyr.geometry_type;\n    if (srcType == 'point' && targetType == 'polygon') {\n      retn = api.joinPointsToPolygons(targetLyr, dataset.arcs, srcLyr, opts);\n    } else if (srcType == 'polygon' && targetType == 'point') {\n      retn = api.joinPolygonsToPoints(targetLyr, srcLyr, src.arcs, opts);\n    } else {\n      stop(utils.format(\"[join] Unable to join %s geometry to %s geometry\",\n          srcType || 'null', targetType || 'null'));\n    }\n  }\n\n  if (retn.unmatched) {\n    dataset.layers.push(retn.unmatched);\n  }\n  if (retn.unjoined) {\n    dataset.layers.push(retn.unjoined);\n  }\n};\n\n// Get a DataTable to join, either from a current layer or from a file.\nMapShaper.getJoinTable = function(dataset, opts) {\n  var layers = MapShaper.findMatchingLayers(dataset.layers, opts.source),\n      table;\n  if (layers.length > 0) {\n    table = layers[0].data;\n  } else {\n    table = api.importJoinTable(opts.source, opts);\n  }\n  return table;\n};\n\n// Get a dataset containing a source layer to join\n// TODO: remove duplication with getJoinTable()\nMapShaper.getJoinDataset = function(dataset, opts) {\n  var layers = MapShaper.findMatchingLayers(dataset.layers, opts.source);\n  if (!layers.length) {\n    dataset = api.importFile(opts.source, opts);\n    layers = dataset.layers;\n  }\n  return layers.length ? {arcs: dataset.arcs, layers: [layers[0]]} : null;\n};\n\napi.importJoinTable = function(file, opts) {\n  var fieldsWithTypeHints = [];\n  if (opts.keys) {\n    fieldsWithTypeHints.push(opts.keys[1]);\n  }\n  if (opts.fields) {\n    fieldsWithTypeHints = fieldsWithTypeHints.concat(opts.fields);\n  }\n  if (opts.field_types) {\n    fieldsWithTypeHints = fieldsWithTypeHints.concat(opts.field_types);\n  }\n  var importOpts = utils.defaults({field_types: fieldsWithTypeHints}, opts);\n  return api.importDataTable(file, importOpts);\n};\n\napi.joinAttributesToFeatures = function(lyr, srcTable, opts) {\n  var keys = MapShaper.removeTypeHints(opts.keys),\n      destKey = keys[0],\n      srcKey = keys[1],\n      destTable = lyr.data,\n      // exclude source key field from join unless explicitly listed\n      joinFields = opts.fields || utils.difference(srcTable.getFields(), [srcKey]),\n      joinFunction = MapShaper.getJoinByKey(destTable, destKey, srcTable, srcKey);\n\n  opts = utils.defaults({fields: joinFields}, opts);\n  return MapShaper.joinTables(destTable, srcTable, joinFunction, opts);\n};\n\nMapShaper.joinTables = function(dest, src, join, opts) {\n  var srcRecords = src.getRecords(),\n      destRecords = dest.getRecords(),\n      unmatchedRecords = [],\n      joinFields = MapShaper.getFieldsToJoin(dest, src, opts),\n      sumFields = opts.sum_fields || [],\n      copyFields = utils.difference(joinFields, sumFields),\n      countField = MapShaper.getCountFieldName(dest.getFields()),\n      addCountField = sumFields.length > 0, // add a count field if we're aggregating records\n      joinCounts = new Uint32Array(srcRecords.length),\n      matchCount = 0,\n      collisionCount = 0,\n      retn = {},\n      srcRec, srcId, destRec, joinIds, joins, count, filter;\n\n  if (opts.where) {\n    filter = MapShaper.getJoinFilter(src, opts.where);\n  }\n\n  // join source records to target records\n  for (var i=0, n=destRecords.length; i<n; i++) {\n    destRec = destRecords[i];\n    joins = join(i);\n    count = 0;\n    for (var j=0, m=joins ? joins.length : 0; j<m; j++) {\n      srcId = joins[j];\n      if (filter && !filter(srcId)) {\n        continue;\n      }\n      srcRec = srcRecords[srcId];\n      if (copyFields.length > 0) {\n        if (count === 0) {\n          // only copying the first match\n          MapShaper.joinByCopy(destRec, srcRec, copyFields);\n        } else {\n          collisionCount++;\n        }\n      }\n      if (sumFields.length > 0) {\n        MapShaper.joinBySum(destRec, srcRec, sumFields);\n      }\n      joinCounts[srcId]++;\n      count++;\n    }\n    if (count > 0) {\n      matchCount++;\n    } else if (destRec) {\n      if (opts.unmatched) {\n        // Save a copy of unmatched record, before null values from join fields\n        // are added.\n        unmatchedRecords.push(utils.extend({}, destRec));\n      }\n      MapShaper.updateUnmatchedRecord(destRec, copyFields, sumFields);\n    }\n    if (addCountField) {\n      destRec[countField] = count;\n    }\n  }\n  if (matchCount === 0) {\n    stop(\"[join] No records could be joined\");\n  }\n\n  MapShaper.printJoinMessage(matchCount, destRecords.length,\n      MapShaper.countJoins(joinCounts), srcRecords.length, collisionCount);\n\n  if (opts.unjoined) {\n    retn.unjoined = {\n      name: 'unjoined',\n      data: new DataTable(srcRecords.filter(function(o, i) {\n        return joinCounts[i] === 0;\n      }))\n    };\n  }\n  if (opts.unmatched) {\n    retn.unmatched = {\n      name: 'unmatched',\n      data: new DataTable(unmatchedRecords)\n    };\n  }\n  return retn;\n};\n\nMapShaper.countJoins = function(counts) {\n  var joinCount = 0;\n  for (var i=0, n=counts.length; i<n; i++) {\n    if (counts[i] > 0) {\n      joinCount++;\n    }\n  }\n  return joinCount;\n};\n\n// Unset fields of unmatched records get null/empty values\nMapShaper.updateUnmatchedRecord = function(rec, copyFields, sumFields) {\n  MapShaper.joinByCopy(rec, {}, copyFields);\n  MapShaper.joinBySum(rec, {}, sumFields);\n};\n\nMapShaper.getCountFieldName = function(fields) {\n  var uniq = MapShaper.getUniqFieldNames(fields.concat(\"joins\"));\n  return uniq.pop();\n};\n\nMapShaper.joinByCopy = function(dest, src, fields) {\n  var f;\n  for (var i=0, n=fields.length; i<n; i++) {\n    // dest[fields[i]] = src[fields[i]];\n    // Use null when the source record is missing an expected value\n    // TODO: think some more about whether this is desirable\n    f = fields[i];\n    if (Object.prototype.hasOwnProperty.call(src, f)) {\n      dest[f] = src[f];\n    } else if (!Object.prototype.hasOwnProperty.call(dest, f)) {\n      dest[f] = null;\n    }\n  }\n};\n\nMapShaper.joinBySum = function(dest, src, fields) {\n  var f;\n  for (var j=0; j<fields.length; j++) {\n    f = fields[j];\n    dest[f] = (dest[f] || 0) + (src[f] || 0);\n  }\n};\n\nMapShaper.printJoinMessage = function(matches, n, joins, m, collisions) {\n  // TODO: add tip for generating layer containing unmatched records, when\n  // this option is implemented.\n  message(utils.format(\"[join] Joined %'d data record%s\", joins, utils.pluralSuffix(joins)));\n  if (matches < n) {\n    message(utils.format('[join] %d/%d target records received no data', n-matches, n));\n  }\n  if (joins < m) {\n    message(utils.format(\"[join] %d/%d source records could not be joined\", m-joins, m));\n  }\n  if (collisions > 0) {\n    message(utils.format(\"[join] %'d collision%s occured; data was copied from the first matching source record\",\n      collisions, utils.pluralSuffix(collisions)));\n  }\n};\n\nMapShaper.getFieldsToJoin = function(destTable, srcTable, opts) {\n  var joinFields;\n  if (opts.fields) {\n    joinFields = MapShaper.removeTypeHints(opts.fields);\n  } else {\n    // If a list of fields to join is not given, try to join all the\n    // source fields except the key field.\n    joinFields = srcTable.getFields();\n  }\n  if (!opts.force) {\n    // only overwrite existing fields if the \"force\" option is set.\n    joinFields = utils.difference(joinFields, destTable.getFields());\n  }\n  return joinFields;\n};\n\n// Return a function for translating a target id to an array of source ids based on values\n// of two key fields.\nMapShaper.getJoinByKey = function(dest, destKey, src, srcKey) {\n  var destRecords = dest.getRecords();\n  var index = MapShaper.createTableIndex(src.getRecords(), srcKey);\n  if (src.fieldExists(srcKey) === false) {\n    stop(\"[join] External table is missing a field named:\", srcKey);\n  }\n  if (!dest || !dest.fieldExists(destKey)) {\n    stop(\"[join] Target layer is missing key field:\", destKey);\n  }\n  return function(i) {\n    var destRec = destRecords[i],\n        val = destRec && destRec[destKey],\n        retn = null;\n    if (destRec && val in index) {\n      retn = index[val];\n    }\n    return retn;\n  };\n};\n\nMapShaper.getJoinFilter = function(data, exp) {\n  var test =  MapShaper.compileValueExpression(exp, {data: data}, null);\n  return function(i) {\n    var retn = test(i);\n    if (retn !== true && retn !== false) {\n      stop('[join] \"where\" expression must return true or false');\n    }\n    return retn;\n  };\n};\n\nMapShaper.createTableIndex = function(records, f) {\n  var index = {}, rec, key;\n  for (var i=0, n=records.length; i<n; i++) {\n    rec = records[i];\n    key = rec[f];\n    if (key in index) {\n      index[key].push(i);\n    } else {\n      index[key] = [i];\n    }\n  }\n  return index;\n};\n\n\n\n\napi.keepEveryPolygon =\nMapShaper.keepEveryPolygon = function(arcData, layers) {\n  T.start();\n  layers.forEach(function(lyr) {\n    if (lyr.geometry_type == 'polygon') {\n      MapShaper.protectLayerShapes(arcData, lyr.shapes);\n    }\n  });\n  T.stop(\"Protect shapes\");\n};\n\nMapShaper.protectLayerShapes = function(arcData, shapes) {\n  shapes.forEach(function(shape) {\n    MapShaper.protectShape(arcData, shape);\n  });\n};\n\n// Protect a single shape from complete removal by simplification\n// @arcData an ArcCollection\n// @shape an array containing one or more arrays of arc ids, or null if null shape\n//\nMapShaper.protectShape = function(arcData, shape) {\n  var maxArea = 0,\n      arcCount = shape ? shape.length : 0,\n      maxRing, area;\n  // Find ring with largest bounding box\n  for (var i=0; i<arcCount; i++) {\n    area = arcData.getSimpleShapeBounds(shape[i]).area();\n    if (area > maxArea) {\n      maxRing = shape[i];\n      maxArea = area;\n    }\n  }\n\n  if (!maxRing || maxRing.length === 0) {\n    // invald shape\n    verbose(\"[protectShape()] Invalid shape:\", shape);\n  } else if (maxRing.length == 1) {\n    MapShaper.protectIslandRing(arcData, maxRing);\n  } else {\n    MapShaper.protectMultiRing(arcData, maxRing);\n  }\n};\n\n// Add two vertices to the ring to form a triangle.\n// Assuming that this will inflate the ring.\n// Consider using the function for multi-arc rings, which\n//   calculates ring area...\nMapShaper.protectIslandRing = function(arcData, ring) {\n  var added = MapShaper.lockMaxThreshold(arcData, ring);\n  if (added == 1) {\n    added += MapShaper.lockMaxThreshold(arcData, ring);\n  }\n  if (added < 2) verbose(\"[protectIslandRing()] Failed on ring:\", ring);\n};\n\nMapShaper.protectMultiRing = function(arcData, ring) {\n  var zlim = arcData.getRetainedInterval(),\n      minArea = 0, // 0.00000001, // Need to handle rounding error?\n      area, added;\n  arcData.setRetainedInterval(Infinity);\n  area = geom.getPlanarPathArea(ring, arcData);\n  while (area <= minArea) {\n    added = MapShaper.lockMaxThreshold(arcData, ring);\n    if (added === 0) {\n      verbose(\"[protectMultiRing()] Failed on ring:\", ring);\n      break;\n    }\n    area = geom.getPlanarPathArea(ring, arcData);\n  }\n  arcData.setRetainedInterval(zlim);\n};\n\n// Protect the vertex or vertices with the largest non-infinite\n// removal threshold in a ring.\n//\nMapShaper.lockMaxThreshold = function(arcData, ring) {\n  var targZ = 0,\n      targArcId,\n      raw = arcData.getVertexData(),\n      arcId, id, z,\n      start, end;\n\n  for (var i=0; i<ring.length; i++) {\n    arcId = ring[i];\n    if (arcId < 0) arcId = ~arcId;\n    start = raw.ii[arcId];\n    end = start + raw.nn[arcId] - 1;\n    id = MapShaper.findNextRemovableVertex(raw.zz, Infinity, start, end);\n    if (id == -1) continue;\n    z = raw.zz[id];\n    if (z > targZ) {\n      targZ = z;\n      targArcId = arcId;\n    }\n  }\n  if (targZ > 0) {\n    // There may be more than one vertex with the target Z value; lock them all.\n    start = raw.ii[targArcId];\n    end = start + raw.nn[targArcId] - 1;\n    return MapShaper.replaceInArray(raw.zz, targZ, Infinity, start, end);\n  }\n  return 0;\n};\n\nMapShaper.replaceInArray = function(zz, value, replacement, start, end) {\n  var count = 0;\n  for (var i=start; i<=end; i++) {\n    if (zz[i] === value) {\n      zz[i] = replacement;\n      count++;\n    }\n  }\n  return count;\n};\n\n\n\n\n// WORK IN PROGRESS\n// Remove 'cuts' in an unprojected dataset at the antemeridian and poles.\n// This will be useful when generating rotated projections.\n//\napi.stitch = function(dataset) {\n  var arcs = dataset.arcs,\n      edgeArcs, dissolver, nodes;\n  if (!arcs || arcs.isPlanar()) {\n    error(\"[stitch] Requires lat-lng dataset\");\n  }\n  if (!MapShaper.snapEdgeArcs(arcs)) {\n    return;\n  }\n  nodes = MapShaper.divideArcs(dataset);\n  // console.log(arcs.toArray())\n\n  dissolver = MapShaper.getPolygonDissolver(nodes, !!'spherical');\n  dataset.layers.forEach(function(lyr) {\n    if (lyr.geometry_type != 'polygon') return;\n    var shapes = lyr.shapes,\n        edgeShapeIds = MapShaper.findEdgeShapes(shapes, arcs);\n    edgeShapeIds.forEach(function(i) {\n      shapes[i] = dissolver(shapes[i]);\n    });\n  });\n};\n\n// TODO: test with 'wrapped' datasets\nMapShaper.findEdgeArcs = function(arcs) {\n  var bbox = MapShaper.getWorldBounds(),\n      ids = [];\n  for (var i=0, n=arcs.size(); i<n; i++) {\n    if (!arcs.arcIsContained(i, bbox)) {\n      ids.push(i);\n    }\n  }\n  return ids;\n};\n\nMapShaper.findEdgeShapes = function(shapes, arcs) {\n  var arcIds = MapShaper.findEdgeArcs(arcs);\n  return MapShaper.findShapesByArcId(shapes, arcIds, arcs.size());\n};\n\n// Snap arcs that either touch poles or prime meridian to 0 degrees longitude\n// Return array of affected arc ids\nMapShaper.snapEdgeArcs = function(arcs) {\n  var data = arcs.getVertexData(),\n      xx = data.xx,\n      yy = data.yy,\n      onEdge = false,\n      e = 1e-10, // TODO: justify this...\n      xmin = -180,\n      xmax = 180,\n      ymin = -90,\n      ymax = 90,\n      lat, lng;\n  for (var i=0, n=xx.length; i<n; i++) {\n    lat = yy[i];\n    lng = xx[i];\n    if (lng <= xmin + e || lng >= xmax - e) {\n      onEdge = true;\n      xx[i] = xmin;\n      // console.log(\">>> snapped lat:\", lat, \"lng:\", lng, \"to lng:\", xmin);\n    }\n    if (lat <= ymin + e) {\n      onEdge = true;\n      yy[i] = ymin;\n      xx[i] = xmin;\n    } else if (lat >= ymax - e) {\n      onEdge = true;\n      yy[i] = ymax;\n      xx[i] = xmin;\n    }\n  }\n  return onEdge;\n};\n\n\n\n\n// Merge similar layers in a dataset, in-place\napi.mergeLayers = function(layers) {\n  var index = {},\n      merged = [];\n\n  // layers with same key can be merged\n  function layerKey(lyr) {\n    var key = lyr.geometry_type || '';\n    if (lyr.data) {\n      key += '~' + lyr.data.getFields().sort().join(',');\n    }\n    return key;\n  }\n\n  layers.forEach(function(lyr) {\n    var key = layerKey(lyr),\n        indexedLyr,\n        records;\n    if (key in index === false) {\n      index[key] = lyr;\n      merged.push(lyr);\n    } else {\n      indexedLyr = index[key];\n      indexedLyr.name = utils.mergeNames(indexedLyr.name, lyr.name);\n      indexedLyr.shapes = indexedLyr.shapes.concat(lyr.shapes);\n      if (indexedLyr.data) {\n        records = indexedLyr.data.getRecords().concat(lyr.data.getRecords());\n        indexedLyr.data = new DataTable(records);\n      }\n    }\n  });\n\n  if (merged.length >= 2) {\n    stop(\"[merge-layers] Unable to merge \" + (merged.length < layers.length ? \"some \" : \"\") + \"layers. Geometry and data fields must be compatible.\");\n  }\n\n  return merged;\n};\n\n\n\n\n// Don't modify input layers (mergeDatasets() updates arc ids in-place)\nMapShaper.mergeDatasetsForExport = function(arr) {\n  // copy layers but not arcs, which get copied in mergeDatasets()\n  var copy = arr.map(function(dataset) {\n    return utils.defaults({\n      layers: dataset.layers.map(MapShaper.copyLayerShapes)\n    }, dataset);\n  });\n  return MapShaper.mergeDatasets(copy);\n};\n\nMapShaper.mergeDatasets = function(arr) {\n  var arcSources = [],\n      arcCount = 0,\n      mergedLayers = [],\n      mergedArcs;\n\n  arr.forEach(function(data) {\n    var n = data.arcs ? data.arcs.size() : 0;\n    if (n > 0) {\n      arcSources.push(data.arcs);\n    }\n    data.layers.forEach(function(lyr) {\n      if (lyr.geometry_type == 'polygon' || lyr.geometry_type == 'polyline') {\n        // reindex arc ids\n        MapShaper.forEachArcId(lyr.shapes, function(id) {\n          return id < 0 ? id - arcCount : id + arcCount;\n        });\n      }\n      mergedLayers.push(lyr);\n    });\n    arcCount += n;\n  });\n\n  mergedArcs = MapShaper.mergeArcs(arcSources);\n  if (mergedArcs.size() != arcCount) {\n    error(\"[mergeDatasets()] Arc indexing error\");\n  }\n\n  return {\n    arcs: mergedArcs,\n    layers: mergedLayers\n  };\n};\n\nMapShaper.mergeArcs = function(arr) {\n  var dataArr = arr.map(function(arcs) {\n    if (arcs.getRetainedInterval() > 0) {\n      verbose(\"Baking-in simplification setting.\");\n      arcs.flatten();\n    }\n    return arcs.getVertexData();\n  });\n  var xx = utils.mergeArrays(utils.pluck(dataArr, 'xx'), Float64Array),\n      yy = utils.mergeArrays(utils.pluck(dataArr, 'yy'), Float64Array),\n      nn = utils.mergeArrays(utils.pluck(dataArr, 'nn'), Int32Array);\n\n  return new ArcCollection(nn, xx, yy);\n};\n\nutils.countElements = function(arrays) {\n  return arrays.reduce(function(memo, arr) {\n    return memo + (arr.length || 0);\n  }, 0);\n};\n\nutils.mergeArrays = function(arrays, TypedArr) {\n  var size = utils.countElements(arrays),\n      Arr = TypedArr || Array,\n      merged = new Arr(size),\n      offs = 0;\n  arrays.forEach(function(src) {\n    var n = src.length;\n    for (var i = 0; i<n; i++) {\n      merged[i + offs] = src[i];\n    }\n    offs += n;\n  });\n  return merged;\n};\n\n\n\n\napi.mergeFiles = function(files, opts) {\n  var datasets = files.map(function(fname) {\n    // import without topology or snapping\n    var importOpts = utils.defaults({no_topology: true, auto_snap: false, snap_interval: null, files: [fname]}, opts);\n    return api.importFile(fname, importOpts);\n  });\n\n  // Don't allow multiple input formats\n  var formats = datasets.map(function(d) {\n    return d.info.input_format;\n  });\n  if (utils.uniq(formats).length != 1) {\n    stop(\"Importing files with different formats is not supported\");\n  }\n\n  var merged = MapShaper.mergeDatasets(datasets);\n  // kludge -- using info property of first dataset\n  merged.info = datasets[0].info;\n  merged.info.input_files = files;\n\n  // Don't try to re-build topology of TopoJSON files\n  // TODO: consider updating topology of TopoJSON files instead of concatenating arcs\n  // (but problem of mismatched coordinates due to quantization in input files.)\n  if (!opts.no_topology && merged.info.input_format != 'topojson') {\n    // TODO: remove duplication with mapshaper-path-import.js; consider applying\n    //   snapping option inside buildTopology()\n    if (opts.auto_snap || opts.snap_interval) {\n      T.start();\n      MapShaper.snapCoords(merged.arcs, opts.snap_interval);\n      T.stop(\"Snapping points\");\n    }\n\n    api.buildTopology(merged);\n  }\n\n  if (opts.merge_files) {\n    merged.layers = api.mergeLayers(merged.layers);\n  }\n  return merged;\n};\n\n\n\n\napi.createPointLayer = function(srcLyr, arcs, opts) {\n  var destLyr = MapShaper.getOutputLayer(srcLyr, opts);\n  destLyr.shapes = opts.x || opts.y ?\n      MapShaper.pointsFromDataTable(srcLyr.data, opts) :\n      MapShaper.pointsFromPolygons(srcLyr, arcs, opts);\n  destLyr.geometry_type = 'point';\n\n  var nulls = destLyr.shapes.reduce(function(sum, shp) {\n    if (!shp) sum++;\n    return sum;\n  }, 0);\n\n  if (nulls > 0) {\n    message(utils.format('[points] %,d of %,d points are null', nulls, destLyr.shapes.length));\n  }\n  if (srcLyr.data) {\n    destLyr.data = opts.no_replace ? srcLyr.data.clone() : srcLyr.data;\n  }\n  return destLyr;\n};\n\nMapShaper.pointsFromPolygons = function(lyr, arcs, opts) {\n  if (lyr.geometry_type != \"polygon\") {\n    stop(\"[points] Expected a polygon layer\");\n  }\n  var func = opts.inner ? geom.findInteriorPoint : geom.getShapeCentroid;\n  return lyr.shapes.map(function(shp) {\n    var p = func(shp, arcs);\n    return p ? [[p.x, p.y]] : null;\n  });\n};\n\nMapShaper.pointsFromDataTable = function(data, opts) {\n  if (!data) stop(\"[points] Layer is missing a data table\");\n  if (!opts.x || !opts.y || !data.fieldExists(opts.x) || !data.fieldExists(opts.y)) {\n    stop(\"[points] Missing x,y data fields\");\n  }\n\n  return data.getRecords().map(function(rec) {\n    var x = rec[opts.x],\n        y = rec[opts.y];\n    if (!utils.isFiniteNumber(x) || !utils.isFiniteNumber(y)) {\n      return null;\n    }\n    return [[x, y]];\n  });\n\n};\n\n\n\n\nMapShaper.projectionIndex = {\n  webmercator: WebMercator,\n  mercator: Mercator,\n  albers: AlbersEqualAreaConic,\n  albersusa: AlbersNYT,\n  albersnyt: AlbersNYT,\n  lambertcc: LambertConformalConic,\n  transversemercator: TransverseMercator,\n  utm: UTM,\n  winkeltripel: WinkelTripel,\n  robinson: Robinson\n};\n\nvar DEG2RAD = Math.PI / 180.0;\n\n// @params (optional) array of decimal-degree params that should be present in opts\nfunction initProj(proj, name, opts, params) {\n  var base = {\n    spherical: false, // Toggle for spherical / ellipsoidal formulas\n    x0: 0,   // false easting (used by UTM and some other projections)\n    y0: 0,   // false northing\n    k0: 1,   // scale factor\n    to_meter: 1,\n    R: 6378137, // Earth radius / semi-major axis (spherical / ellipsoidal formulas)\n    // E: flattening parameter for GRS80 ellipsoid (others not supported)\n    E: 0.0818191908426214943348,\n\n    projectLatLng: function(lat, lng, xy) {\n      xy = xy || {};\n      this.forward(lng * DEG2RAD, lat * DEG2RAD, xy);\n      xy.x = (this.R * xy.x + this.x0) / this.to_meter;\n      xy.y = (this.R * xy.y + this.y0) / this.to_meter;\n      return xy;\n    },\n    unprojectXY: function(x, y, ll) {\n      x = (x * this.to_meter - this.x0) / this.R;\n      y = (y * this.to_meter - this.y0) / this.R;\n      ll = ll || {};\n      this.inverse(x , y, ll);\n      ll.lat /= DEG2RAD;\n      ll.lng /= DEG2RAD;\n      return ll;\n    },\n    // Approximate the inverse ellipsoidal projection function when\n    // the forward ellipsoidal formula and both spheroidal formulas are known.\n    // (Many ellipsoidal inverse projections lack closed formulas and/or are a hassle to implement).\n    // Accuracy depends on # of iterations, projection, etc.\n    // n of 4 gives ~1e-10 degree accuracy with Lambert CC.\n    inverseEllApprox: function(x, y, ll) {\n      var xy = {};\n      var dx = 0, dy = 0;\n      var n = 4;\n      while (true) {\n        this.spherical = true;\n        this.inverse(x + dx, y + dy, ll);\n        this.spherical = false;\n        if (!--n) break;\n        this.forward(ll.lng, ll.lat, xy);\n        dx += x - xy.x;\n        dy += y - xy.y;\n      }\n    }\n  };\n  opts = utils.extend({}, opts); // make a copy, don't modify original param\n  if (params) {\n    // check for required decimal degree parameters and convert to radians\n    params.forEach(function(param) {\n      if (param in opts === false) {\n        throw new Error('[' + name + '] Missing required parameter:', param);\n      }\n      opts[param] = opts[param] * DEG2RAD;\n    });\n  }\n  utils.extend(proj, base, opts);\n  proj.name = name;\n  if (opts.units) {\n    proj.to_meter = initProjUnits(opts.units);\n  }\n}\n\n// Return multiplier for converting to meters\nfunction initProjUnits(units) {\n  units = units.toLowerCase().replace(/-_/g, '');\n  var k = {\n      meters: 1,\n      feet: 0.3048,\n      usfeet: 0.304800609601219 }[units];\n  if (!k) {\n    throw new Error(\"[proj] Unsupported units, use to_meter param:\", units);\n  }\n  return 1 / k;\n}\n\nfunction WebMercator() {\n  return new Mercator({spherical: true});\n}\n\n// Optional param: lng0 (in decimal degrees)\nfunction Mercator(opts) {\n  opts = utils.extend({lng0: 0}, opts);\n  initProj(this, 'mercator', opts, ['lng0']);\n  this.forward = function(lng, lat, xy) {\n    xy.x = lng - this.lng0;\n    if (!this.spherical) {\n      xy.y = Math.log(Math.tan(Math.PI * 0.25 + lat * 0.5) *\n        Math.pow((1 - this.E * Math.sin(lat)) / (1 + this.E * Math.sin(lat)), this.E * 0.5));\n    } else {\n      xy.y = Math.log(Math.tan(Math.PI * 0.25 + lat * 0.5));\n    }\n  };\n  this.inverse = function(x, y, ll) {\n    if (!this.spherical) {\n      this.inverseEllApprox(x, y, ll);\n    } else {\n      ll.lng = x + this.lng0;\n      ll.lat = Math.PI * 0.5 - 2 * Math.atan(Math.exp(-y));\n    }\n  };\n}\n\nfunction UTM(opts) {\n  var m = /^([\\d]+)([NS])$/.exec(opts.zone || \"\");\n  if (!m) {\n    throw new Error(\"[UTM] Expected a UTM zone parameter of the form: 17N\");\n  }\n  var z = parseFloat(m[1]);\n  var proj = new TransverseMercator({\n    k0: 0.9996,\n    lng0: z * 6 - 183,\n    lat0: 0,\n    x0: 500000,\n    y0: m[2] == 'S' ? 1e7 : 0\n  });\n  return proj;\n}\n\nfunction TransverseMercator(opts) {\n  initProj(this, 'transverse_mercator', opts, ['lat0', 'lng0']);\n  var _m0 = calcTransMercM(this.lat0, this.E);\n  this.forward = function(lng, lat, xy) {\n    if (this.spherical) {\n      var B = Math.cos(lat) * Math.sin(lng - this.lng0);\n      xy.x = 0.5 * this.k0 * Math.log((1 + B) / (1 - B));\n      xy.y = this.k0 * (Math.atan(Math.tan(lat) / Math.cos(lng - this.lng0)) - this.lat0);\n    } else {\n      var e2 = this.E * this.E,\n          ep2 = e2 / (1 - e2),\n          sinLat = Math.sin(lat),\n          cosLat = Math.cos(lat),\n          tanLat = Math.tan(lat),\n          n = 1 / Math.sqrt(1 - e2 * sinLat * sinLat),\n          t = tanLat * tanLat,\n          c = ep2 * cosLat * cosLat,\n          a = cosLat * (lng - this.lng0),\n          a2 = a * a,\n          m = calcTransMercM(lat, this.E);\n      xy.x = this.k0 * n * (a + a * a2 / 6 * (1 - t + c) +\n        a2 * a2 * a / 120 * (5 - 18 * t + t * t + 72 * c - 58 * ep2));\n      xy.y = this.k0 * (m - _m0 + n * tanLat *\n        (a2 / 2 + a2 * a2 / 24 * (5 - t + 9 * c + 4 * c * c)));\n    }\n  };\n  this.inverse = function(x, y, ll) {\n    if (this.spherical) {\n      var D = y / this.k0 + this.lat0;\n      ll.lat = Math.asin(Math.sin(D) / cosh(x / this.k0));\n      ll.lng = this.lng0 + Math.atan(sinh(x / this.k0) / Math.cos(D));\n    } else {\n      this.inverseEllApprox(x, y, ll);\n    }\n  };\n}\n\n// Authalic sin\nfunction sinh(x) {\n  return (Math.exp(x) - Math.exp(-x)) * 0.5;\n}\n\n// Authalic cosine\nfunction cosh(x) {\n  return (Math.exp(x) + Math.exp(-x)) * 0.5;\n}\n\nfunction calcTransMercM(lat, e) {\n  var e2 = e * e,\n      e4 = e2 * e2,\n      e6 = e4 * e2;\n  return (lat * (1 - e2 / 4.0 - 3 * e4 / 64 - 5 * e6 / 256) -\n    Math.sin(2 * lat) * (3 * e2 / 8 + 3 * e4 / 32 + 45 * e6 / 1024) +\n    Math.sin(4 * lat) * (15 * e4 / 256 + 45 * e6 / 1024) -\n    Math.sin(6 * lat) * (35 * e6 / 3072));\n}\n\nfunction AlbersNYT(opts) {\n  var lambert = new LambertConformalConic({lng0:-96, lat1:33, lat2:45, lat0:39, spherical: true});\n  return new MixedProjection(new AlbersUSA(opts))\n    .addFrame(lambert, {lat:63, lng:-152}, {lat:27, lng:-115}, 6e6, 3e6, 0.31, 29.2)  // AK\n    .addFrame(lambert, {lat:20.9, lng:-157}, {lat:28.2, lng:-106.6}, 3e6, 5e6, 0.9, 40); // HI\n}\n\nfunction AlbersUSA(opts) {\n  return new AlbersEqualAreaConic(utils.extend({lng0:-96, lat1:29.5, lat2:45.5, lat0:37.5}, opts));\n}\n\n/*\nfunction LambertUSA() {\n  return new LambertConformalConic({lng0:-96, lat1:33, lat2:45, lat0:39});\n}\n*/\n\n// Parameters (in decimal degrees):\n//   lng0  Reference longitude\n//   lat0  Reference latitude\n//   lat1  First standard parallel\n//   lat2  Second standard parallel\nfunction AlbersEqualAreaConic(opts) {\n  initProj(this, 'albers', opts, ['lat0', 'lat1', 'lat2', 'lng0']);\n  var E = this.E;\n  var cosLat1 = Math.cos(this.lat1),\n      sinLat1 = Math.sin(this.lat1),\n      _sphN = 0.5 * (sinLat1 + Math.sin(this.lat2)),\n      _sphC = cosLat1 * cosLat1 + 2.0 * _sphN * sinLat1,\n      _sphRho0 = Math.sqrt(_sphC - 2.0 * _sphN * Math.sin(this.lat0)) / _sphN;\n\n  var m1 = calcAlbersMell(E, this.lat1),\n      m2 = calcAlbersMell(E, this.lat2),\n      q0 = calcAlbersQell(E, this.lat0),\n      q1 = calcAlbersQell(E, this.lat1),\n      q2 = calcAlbersQell(E, this.lat2),\n      _ellN = (m1 * m1 - m2 * m2) / (q2 - q1),\n      _ellC = m1 * m1 + _ellN * q1,\n      _ellRho0 = Math.sqrt(_ellC - _ellN * q0) / _ellN,\n      _ellAuthConst = 1 - (1 - E * E) / (2 * E) * Math.log((1 - E) / (1 + E));\n\n  this.forward = function(lng, lat, xy) {\n    var rho, theta, q;\n    if (!this.spherical) {\n      q = calcAlbersQell(E, lat);\n      rho = Math.sqrt(_ellC - _ellN * q) / _ellN;\n      theta = _ellN * (lng - this.lng0);\n      xy.x = rho * Math.sin(theta);\n      xy.y = _ellRho0 - rho * Math.cos(theta);\n    } else {\n      rho = Math.sqrt(_sphC - 2 * _sphN * Math.sin(lat)) / _sphN;\n      theta = _sphN * (lng - this.lng0);\n      xy.x = rho * Math.sin(theta);\n      xy.y = _sphRho0 - rho * Math.cos(theta);\n    }\n  };\n\n  this.inverse = function(x, y, ll) {\n    var rho, theta, e2, e4, q, beta;\n    if (!this.spherical) {\n      theta = Math.atan(x / (_ellRho0 - y));\n      ll.lng = this.lng0 + theta / _ellN;\n      e2 = E * E;\n      e4 = e2 * e2;\n      rho = Math.sqrt(x * x + (_ellRho0 - y) * (_ellRho0 - y));\n      q = (_ellC - rho * rho * _ellN * _ellN) / _ellN;\n      beta = Math.asin(q / _ellAuthConst);\n      ll.lat = beta + Math.sin(2 * beta) *\n        (e2 / 3 + 31 * e4 / 180 + 517 * e4 * e2 / 5040) +\n        Math.sin(4 * beta) * (23 * e4 / 360 + 251 * e4 * e2 / 3780) +\n        Math.sin(6 * beta) * 761 * e4 * e2 / 45360;\n    } else {\n      rho = Math.sqrt(x * x + (_sphRho0 - y) * (_sphRho0 - y));\n      theta = Math.atan(x / (_sphRho0 - y));\n      ll.lat = Math.asin((_sphC - rho * rho * _sphN * _sphN) * 0.5 / _sphN);\n      ll.lng = theta / _sphN + this.lng0;\n    }\n  };\n}\n\nfunction calcAlbersQell(e, lat) {\n  var sinLat = Math.sin(lat);\n  return (1 - e * e) * (sinLat / (1 - e * e * sinLat * sinLat) -\n    0.5 / e * Math.log((1 - e * sinLat) / (1 + e * sinLat)));\n}\n\nfunction calcAlbersMell(e, lat) {\n  var sinLat = Math.sin(lat);\n  return Math.cos(lat) / Math.sqrt(1 - e * e * sinLat * sinLat);\n}\n\n// Parameters (in decimal degrees):\n//   lng0  Reference longitude\n//   lat0  Reference latitude\n//   lat1  First standard parallel\n//   lat2  Second standard parallel\nfunction LambertConformalConic(opts) {\n  initProj(this, 'lambertcc', opts, ['lat0', 'lat1', 'lat2', 'lng0']);\n  var E = this.E;\n  var _sphN = Math.log(Math.cos(this.lat1) / Math.cos(this.lat2)) /\n    Math.log(Math.tan(Math.PI / 4.0 + this.lat2 / 2.0) /\n    Math.tan(Math.PI / 4.0 + this.lat1 / 2.0));\n  var _sphF = Math.cos(this.lat1) *\n    Math.pow(Math.tan(Math.PI / 4.0 + this.lat1 / 2.0), _sphN) / _sphN;\n  var _sphRho0 = _sphF /\n    Math.pow(Math.tan(Math.PI / 4.0 + this.lat0 / 2.0), _sphN);\n  var _ellN = (Math.log(calcLambertM(this.lat1, E)) -\n    Math.log(calcLambertM(this.lat2, E))) /\n    (Math.log(calcLambertT(this.lat1, E)) -\n    Math.log(calcLambertT(this.lat2, E)));\n  var _ellF = calcLambertM(this.lat1, E) / (_ellN *\n    Math.pow(calcLambertT(this.lat1, E), _ellN));\n  var _ellRho0 = _ellF *\n    Math.pow(calcLambertT(this.lat0, E), _ellN);\n\n  this.forward = function(lng, lat, xy) {\n    var rho, theta;\n    if (!this.spherical) {\n      var t = calcLambertT(lat, E);\n      rho = _ellF * Math.pow(t, _ellN);\n      theta = _ellN * (lng - this.lng0);\n      xy.x = rho * Math.sin(theta);\n      xy.y = _ellRho0 - rho * Math.cos(theta);\n    } else {\n      rho = _sphF /\n        Math.pow(Math.tan(Math.PI / 4 + lat / 2.0), _sphN);\n      theta = _sphN * (lng - this.lng0);\n      xy.x = rho * Math.sin(theta);\n      xy.y = _sphRho0 - rho * Math.cos(theta);\n    }\n  };\n\n  this.inverse = function(x, y, ll) {\n    if (!this.spherical) {\n      this.inverseEllApprox(x, y, ll);\n    } else {\n      var rho0 = _sphRho0;\n      var rho = Math.sqrt(x * x + (rho0 - y) * (rho0 - y));\n      if (_sphN < 0) {\n        rho = -rho;\n      }\n      var theta = Math.atan(x / (rho0 - y));\n      ll.lat = 2 * Math.atan(Math.pow(_sphF /\n        rho, 1 / _sphN)) - 0.5 * Math.PI;\n      ll.lng = theta / _sphN + this.lng0;\n    }\n  };\n}\n\nfunction calcLambertT(lat, e) {\n  var sinLat = Math.sin(lat);\n  return Math.tan(Math.PI / 4 - lat / 2) /\n    Math.pow((1 - e * sinLat) / (1 + e * sinLat), e / 2);\n}\n\nfunction calcLambertM(lat, e) {\n  var sinLat = Math.sin(lat);\n  return Math.cos(lat) / Math.sqrt(1 - e * e * sinLat * sinLat);\n}\n\nfunction WinkelTripel() {\n  initProj(this, 'winkel_tripel');\n  this.forward = function(lng, lat, xy) {\n    var lat0 = 50.4670 * DEG2RAD;\n    var a = Math.acos( Math.cos(lat) * Math.cos(lng * 0.5));\n    var sincAlpha = a === 0 ? 1 : Math.sin( a ) / a;\n    xy.x = 0.5 * (lng * Math.cos(lat0) + 2 * Math.cos(lat) * Math.sin(0.5 * lng) / sincAlpha);\n    xy.y = 0.5 * (lat + Math.sin(lat) / sincAlpha);\n  };\n}\n\nfunction Robinson() {\n  initProj(this, 'robinson');\n  var FXC = 0.8487;\n  var FYC = 1.3523;\n  var xx = [\n    1, -5.67239e-12, -7.15511e-05, 3.11028e-06,\n    0.9986, -0.000482241, -2.4897e-05, -1.33094e-06,\n    0.9954, -0.000831031, -4.4861e-05, -9.86588e-07,\n    0.99, -0.00135363, -5.96598e-05, 3.67749e-06,\n    0.9822, -0.00167442, -4.4975e-06, -5.72394e-06,\n    0.973, -0.00214869, -9.03565e-05, 1.88767e-08,\n    0.96, -0.00305084, -9.00732e-05, 1.64869e-06,\n    0.9427, -0.00382792, -6.53428e-05, -2.61493e-06,\n    0.9216, -0.00467747, -0.000104566, 4.8122e-06,\n    0.8962, -0.00536222, -3.23834e-05, -5.43445e-06,\n    0.8679, -0.00609364, -0.0001139, 3.32521e-06,\n    0.835, -0.00698325, -6.40219e-05, 9.34582e-07,\n    0.7986, -0.00755337, -5.00038e-05, 9.35532e-07,\n    0.7597, -0.00798325, -3.59716e-05, -2.27604e-06,\n    0.7186, -0.00851366, -7.0112e-05, -8.63072e-06,\n    0.6732, -0.00986209, -0.000199572, 1.91978e-05,\n    0.6213, -0.010418, 8.83948e-05, 6.24031e-06,\n    0.5722, -0.00906601, 0.000181999, 6.24033e-06,\n    0.5322, 0,0,0\n  ];\n  var yy = [\n    0, 0.0124, 3.72529e-10, 1.15484e-09,\n    0.062, 0.0124001, 1.76951e-08, -5.92321e-09,\n    0.124, 0.0123998, -7.09668e-08, 2.25753e-08,\n    0.186, 0.0124008, 2.66917e-07, -8.44523e-08,\n    0.248, 0.0123971, -9.99682e-07, 3.15569e-07,\n    0.31, 0.0124108, 3.73349e-06, -1.1779e-06,\n    0.372, 0.0123598, -1.3935e-05, 4.39588e-06,\n    0.434, 0.0125501, 5.20034e-05, -1.00051e-05,\n    0.4968, 0.0123198, -9.80735e-05, 9.22397e-06,\n    0.5571, 0.0120308, 4.02857e-05, -5.2901e-06,\n    0.6176, 0.0120369, -3.90662e-05, 7.36117e-07,\n    0.6769, 0.0117015, -2.80246e-05, -8.54283e-07,\n    0.7346, 0.0113572, -4.08389e-05, -5.18524e-07,\n    0.7903, 0.0109099, -4.86169e-05, -1.0718e-06,\n    0.8435, 0.0103433, -6.46934e-05, 5.36384e-09,\n    0.8936, 0.00969679, -6.46129e-05, -8.54894e-06,\n    0.9394, 0.00840949, -0.000192847, -4.21023e-06,\n    0.9761, 0.00616525, -0.000256001, -4.21021e-06,\n    1,0,0,0\n  ];\n  this.forward = function(lng, lat, xy) {\n    var absLat = Math.abs(lat),\n        j = Math.min(Math.floor(absLat * 11.45915590261646417544), 17),\n        dphi = (absLat - 0.08726646259971647884 * j) / DEG2RAD,\n        sign = lat < 0 ? -1 : 1,\n        i = j * 4;\n    xy.x = (((dphi * xx[i+3] + xx[i+2]) * dphi + xx[i+1]) * dphi + xx[i]) * lng * FXC;\n    xy.y = (((dphi * yy[i+3] + yy[i+2]) * dphi + yy[i+1]) * dphi + yy[i]) * FYC * sign;\n  };\n}\n\n// A compound projection, consisting of a default projection and one or more rectangular frames\n// that are reprojected and/or affine transformed.\n// @proj Default projection.\nfunction MixedProjection(proj) {\n  var frames = [];\n  // @proj2 projection to use.\n  // @ctr1 {lat, lng} center of the frame contents.\n  // @ctr2 {lat, lng} geo location to move the frame center\n  // @frameWidth Width of the frame in base projection units\n  // @frameHeight Height of the frame in base projection units\n  // @scale Scale factor; 1 = no scaling.\n  // @rotation Rotation in degrees; 0 = no rotation.\n  this.addFrame = function(proj2, ctr1, ctr2, frameWidth, frameHeight, scale, rotation) {\n    var xy1 = proj.projectLatLng(ctr1.lat, ctr1.lng);\n    var xy2 = proj.projectLatLng(ctr2.lat, ctr2.lng);\n    var bbox = [xy1.x - frameWidth * 0.5, xy1.y - frameHeight * 0.5, xy1.x + frameWidth * 0.5, xy1.y + frameHeight * 0.5];\n    var m = new Matrix2D();\n    m.rotate(rotation * DEG2RAD, xy1.x, xy1.y );\n    m.scale(scale, scale);\n    m.transformXY(xy1.x, xy1.y, xy1);\n    m.translate(xy2.x - xy1.x, xy2.y - xy1.y);\n    frames.push({\n      bbox: bbox,\n      matrix: m,\n      projection: proj2\n    });\n    return this;\n  };\n\n  this.projectLatLng = function(lat, lng, xy) {\n    var frame, bbox;\n    xy = proj.projectLatLng(lat, lng, xy);\n    for (var i=0, n=frames.length; i<n; i++) {\n      frame = frames[i];\n      bbox = frame.bbox;\n      if (xy.x >= bbox[0] && xy.x <= bbox[2] && xy.y >= bbox[1] && xy.y <= bbox[3]) {\n        frame.projection.projectLatLng(lat, lng, xy);\n        frame.matrix.transformXY(xy.x, xy.y, xy);\n        break;\n      }\n    }\n    return xy;\n  };\n\n  // TODO: implement inverse projection for frames\n  this.unprojectXY = function(x, y, ll) {\n    return proj.unprojectXY.call(proj, x, y, ll);\n  };\n}\n\n// A matrix class that supports affine transformations (scaling, translation, rotation).\n// Elements:\n//   a  c  tx\n//   b  d  ty\n//   0  0  1  (u v w are not used)\n//\nfunction Matrix2D() {\n  this.a = 1;\n  this.c = 0;\n  this.tx = 0;\n  this.b = 0;\n  this.d = 1;\n  this.ty = 0;\n}\n\nMatrix2D.prototype.transformXY = function(x, y, p) {\n  p = p || {};\n  p.x = x * this.a + y * this.c + this.tx;\n  p.y = x * this.b + y * this.d + this.ty;\n  return p;\n};\n\nMatrix2D.prototype.translate = function(dx, dy) {\n  this.tx += dx;\n  this.ty += dy;\n};\n\nMatrix2D.prototype.rotate = function(q, x, y) {\n  var cos = Math.cos(q);\n  var sin = Math.sin(q);\n  x = x || 0;\n  y = y || 0;\n  this.a = cos;\n  this.c = -sin;\n  this.b = sin;\n  this.d = cos;\n  this.tx += x - x * cos + y * sin;\n  this.ty += y - x * sin - y * cos;\n};\n\nMatrix2D.prototype.scale = function(sx, sy) {\n  this.a *= sx;\n  this.c *= sx;\n  this.b *= sy;\n  this.d *= sy;\n};\n\n\n\n\nMapShaper.editArcs = function(arcs, onPoint) {\n  var nn2 = [],\n      xx2 = [],\n      yy2 = [],\n      n;\n\n  arcs.forEach(function(arc, i) {\n    editArc(arc, onPoint);\n  });\n  arcs.updateVertexData(nn2, xx2, yy2);\n\n  function append(p) {\n    xx2.push(p.x);\n    yy2.push(p.y);\n    n++;\n  }\n\n  function editArc(arc, cb) {\n    var x, y, xp, yp;\n    var i = 0;\n    n = 0;\n    while (arc.hasNext()) {\n      x = arc.x;\n      y = arc.y;\n      cb(append, x, y, xp, yp, i++);\n      xp = x;\n      yp = y;\n    }\n    if (n == 1) { // invalid arc len\n      error(\"An invalid arc was created\");\n    }\n    nn2.push(n);\n  }\n};\n\n\n\n\napi.proj = function(dataset, opts) {\n  var proj = MapShaper.getProjection(opts.projection, opts);\n  if (!proj) {\n    stop(\"[proj] Unknown projection:\", opts.projection);\n  }\n  MapShaper.projectDataset(dataset, proj, opts);\n};\n\nMapShaper.getProjection = function(name, opts) {\n  var f = MapShaper.projectionIndex[name.toLowerCase().replace(/-_ /g, '')];\n  return f ? new f(opts) : null;\n};\n\nMapShaper.printProjections = function() {\n  var names = Object.keys(MapShaper.projectionIndex);\n  names.sort();\n  names.forEach(function(n) {\n    message(n);\n  });\n};\n\nMapShaper.projectDataset = function(dataset, proj, opts) {\n  dataset.layers.forEach(function(lyr) {\n    if (MapShaper.layerHasPoints(lyr)) {\n      MapShaper.projectPointLayer(lyr, proj);\n    }\n  });\n  if (dataset.arcs) {\n    if (opts.densify) {\n      MapShaper.projectAndDensifyArcs(dataset.arcs, proj);\n    } else {\n      MapShaper.projectArcs(dataset.arcs, proj);\n    }\n  }\n  if (dataset.info) {\n    // Setting output crs to null: \"If the value of CRS is null, no CRS can be assumed\"\n    // (by default, GeoJSON assumes WGS84)\n    // source: http://geojson.org/geojson-spec.html#coordinate-reference-system-objects\n    // TODO: create a valid GeoJSON crs object after projecting\n    dataset.info.output_crs = null;\n    dataset.info.output_prj = null;\n  }\n};\n\nMapShaper.projectPointLayer = function(lyr, proj) {\n  var xy = {x: 0, y: 0};\n  MapShaper.forEachPoint(lyr.shapes, function(p) {\n    proj.projectLatLng(p[1], p[0], xy);\n    p[0] = xy.x;\n    p[1] = xy.y;\n  });\n};\n\nMapShaper.projectArcs = function(arcs, proj) {\n  var data = arcs.getVertexData(),\n      xx = data.xx,\n      yy = data.yy,\n      // old zz will not be optimal after reprojection; re-using it for now\n      // to avoid error in web ui\n      zz = data.zz,\n      p = {x: 0, y: 0};\n  if (arcs.isPlanar()) {\n    stop(\"[proj] Only projection from lat-lng coordinates is supported\");\n  }\n  for (var i=0, n=xx.length; i<n; i++) {\n    proj.projectLatLng(yy[i], xx[i], p);\n    xx[i] = p.x;\n    yy[i] = p.y;\n  }\n  arcs.updateVertexData(data.nn, xx, yy, zz);\n};\n\nMapShaper.getDefaultDensifyInterval = function(arcs, proj) {\n  var xy = MapShaper.getAvgSegment2(arcs),\n      bb = arcs.getBounds(),\n      a = proj.projectLatLng(bb.centerY(), bb.centerX()),\n      b = proj.projectLatLng(bb.centerY() + xy[1], bb.centerX());\n  return distance2D(a.x, a.y, b.x, b.y);\n};\n\n// Interpolate points into a projected line segment if needed to prevent large\n//   deviations from path of original unprojected segment.\n// @points (optional) array of accumulated points\nMapShaper.densifySegment = function(lng0, lat0, x0, y0, lng2, lat2, x2, y2, proj, interval, points) {\n  // Find midpoint between two endpoints and project it (assumes longitude does\n  // not wrap). TODO Consider bisecting along great circle path -- although this\n  // would not be good for boundaries that follow line of constant latitude.\n  var lng1 = (lng0 + lng2) / 2,\n      lat1 = (lat0 + lat2) / 2,\n      p = proj.projectLatLng(lat1, lng1),\n      distSq = geom.pointSegDistSq(p.x, p.y, x0, y0, x2, y2); // sq displacement\n  points = points || [];\n  // Bisect current segment if the projected midpoint deviates from original\n  //   segment by more than the @interval parameter.\n  //   ... but don't bisect very small segments to prevent infinite recursion\n  //   (e.g. if projection function is discontinuous)\n  if (distSq > interval * interval && distance2D(lng0, lat0, lng2, lat2) > 0.01) {\n    MapShaper.densifySegment(lng0, lat0, x0, y0, lng1, lat1, p.x, p.y, proj, interval, points);\n    points.push(p);\n    MapShaper.densifySegment(lng1, lat1, p.x, p.y, lng2, lat2, x2, y2, proj, interval, points);\n  }\n  return points;\n};\n\nMapShaper.projectAndDensifyArcs = function(arcs, proj) {\n  var interval = MapShaper.getDefaultDensifyInterval(arcs, proj);\n  var tmp = {x: 0, y: 0};\n  MapShaper.editArcs(arcs, onPoint);\n\n  function onPoint(append, lng, lat, prevLng, prevLat, i) {\n    var p = tmp,\n        prevX = p.x,\n        prevY = p.y;\n    proj.projectLatLng(lat, lng, p);\n    // Try to densify longer segments (optimization)\n    if (i > 0 && distanceSq(p.x, p.y, prevX, prevY) > interval * interval * 25) {\n      MapShaper.densifySegment(prevLng, prevLat, prevX, prevY, lng, lat, p.x, p.y, proj, interval)\n        .forEach(append);\n    }\n    append(p);\n  }\n};\n\n\n\n\napi.renameLayers = function(layers, names) {\n  var nameCount = names && names.length || 0;\n  layers.forEach(function(lyr, i) {\n    var name;\n    if (nameCount === 0) {\n      name = \"layer\" + (i + 1);\n    } else {\n      name = i < nameCount - 1 ? names[i] : names[nameCount - 1];\n      if (nameCount < layers.length && i >= nameCount - 2) {\n        name += i - nameCount + 2;\n      }\n    }\n    lyr.name = name;\n  });\n};\n\n\n\n\n// A minheap data structure used for computing Visvalingam simplification data.\n//\nfunction Heap() {\n  var heapBuf = utils.expandoBuffer(Int32Array),\n      indexBuf = utils.expandoBuffer(Int32Array),\n      itemsInHeap = 0,\n      dataArr,\n      heapArr,\n      indexArr;\n\n  this.init = function(values) {\n    var i;\n    dataArr = values;\n    itemsInHeap = values.length;\n    heapArr = heapBuf(itemsInHeap);\n    indexArr = indexBuf(itemsInHeap);\n    for (i=0; i<itemsInHeap; i++) {\n      insertValue(i, i);\n    }\n    // place non-leaf items\n    for (i=(itemsInHeap-2) >> 1; i >= 0; i--) {\n      downHeap(i);\n    }\n  };\n\n  this.size = function() {\n    return itemsInHeap;\n  };\n\n  // Update a single value and re-heap\n  this.updateValue = function(valIdx, val) {\n    var heapIdx = indexArr[valIdx];\n    dataArr[valIdx] = val;\n    if (!(heapIdx >= 0 && heapIdx < itemsInHeap)) {\n      error(\"Out-of-range heap index.\");\n    }\n    downHeap(upHeap(heapIdx));\n  };\n\n  this.popValue = function() {\n    return dataArr[this.pop()];\n  };\n\n  // Return the idx of the lowest-value item in the heap\n  this.pop = function() {\n    var popIdx;\n    if (itemsInHeap <= 0) {\n      error(\"Tried to pop from an empty heap.\");\n    }\n    popIdx = heapArr[0];\n    insertValue(0, heapArr[--itemsInHeap]); // move last item in heap into root position\n    downHeap(0);\n    return popIdx;\n  };\n\n  function upHeap(idx) {\n    var parentIdx;\n    // Move item up in the heap until it's at the top or is not lighter than its parent\n    while (idx > 0) {\n      parentIdx = (idx - 1) >> 1;\n      if (greaterThan(idx, parentIdx)) {\n        break;\n      }\n      swapItems(idx, parentIdx);\n      idx = parentIdx;\n    }\n    return idx;\n  }\n\n  // Swap item at @idx with any lighter children\n  function downHeap(idx) {\n    var minIdx = compareDown(idx);\n\n    while (minIdx > idx) {\n      swapItems(idx, minIdx);\n      idx = minIdx; // descend in the heap\n      minIdx = compareDown(idx);\n    }\n  }\n\n  function swapItems(a, b) {\n    var i = heapArr[a];\n    insertValue(a, heapArr[b]);\n    insertValue(b, i);\n  }\n\n  // Associate a heap idx with the index of a value in data arr\n  function insertValue(heapIdx, valId) {\n    indexArr[valId] = heapIdx;\n    heapArr[heapIdx] = valId;\n  }\n\n  // @a, @b: Indexes in @heapArr\n  function greaterThan(a, b) {\n    var idx1 = heapArr[a],\n        idx2 = heapArr[b],\n        val1 = dataArr[idx1],\n        val2 = dataArr[idx2];\n    // If values are equal, compare array indexes.\n    // This is not a requirement of the Visvalingam algorithm,\n    // but it generates output that matches Mahes Visvalingam's\n    // reference implementation.\n    // See https://hydra.hull.ac.uk/assets/hull:10874/content\n    return (val1 > val2 || val1 === val2 && idx1 > idx2);\n  }\n\n  function compareDown(idx) {\n    var a = 2 * idx + 1,\n        b = a + 1,\n        n = itemsInHeap;\n    if (a < n && greaterThan(idx, a)) {\n      idx = a;\n    }\n    if (b < n && greaterThan(idx, b)) {\n      idx = b;\n    }\n    return idx;\n  }\n}\n\n\n\n\nvar Visvalingam = {};\n\nVisvalingam.getArcCalculator = function(metric, is3D) {\n  var heap = new Heap(),\n      prevBuf = utils.expandoBuffer(Int32Array),\n      nextBuf = utils.expandoBuffer(Int32Array),\n      calc = is3D ?\n        function(b, c, d, xx, yy, zz) {\n          return metric(xx[b], yy[b], zz[b], xx[c], yy[c], zz[c], xx[d], yy[d], zz[d]);\n        } :\n        function(b, c, d, xx, yy) {\n          return metric(xx[b], yy[b], xx[c], yy[c], xx[d], yy[d]);\n        };\n\n  // Calculate Visvalingam simplification data for an arc\n  // @kk (Float64Array|Array) Receives calculated simplification thresholds\n  // @xx, @yy, (@zz) Buffers containing vertex coordinates\n  return function calcVisvalingam(kk, xx, yy, zz) {\n    var arcLen = kk.length,\n        prevArr = prevBuf(arcLen),\n        nextArr = nextBuf(arcLen),\n        val, maxVal = -Infinity,\n        b, c, d; // indexes of points along arc\n\n    if (zz && !is3D) {\n      error(\"[visvalingam] Received z-axis data for 2D simplification\");\n    } else if (!zz && is3D) {\n      error(\"[visvalingam] Missing z-axis data for 3D simplification\");\n    } else if (kk.length > xx.length) {\n      error(\"[visvalingam] Incompatible data arrays:\", kk.length, xx.length);\n    }\n\n    // Initialize Visvalingam \"effective area\" values and references to\n    //   prev/next points for each point in arc.\n    for (c=0; c<arcLen; c++) {\n      b = c-1;\n      d = c+1;\n      if (b < 0 || d >= arcLen) {\n        val = Infinity; // endpoint maxVals\n      } else {\n        val = calc(b, c, d, xx, yy, zz);\n      }\n      kk[c] = val;\n      nextArr[c] = d;\n      prevArr[c] = b;\n    }\n    heap.init(kk);\n\n    // Calculate removal thresholds for each internal point in the arc\n    //\n    while (heap.size() > 0) {\n      c = heap.pop(); // Remove the point with the least effective area.\n      val = kk[c];\n      if (val === Infinity) {\n        break;\n      }\n      if (val < maxVal) {\n        // don't assign current point a lesser value than the last removed vertex\n        kk[c] = maxVal;\n      } else {\n        maxVal = val;\n      }\n\n      // Recompute effective area of neighbors of the removed point.\n      b = prevArr[c];\n      d = nextArr[c];\n      if (b > 0) {\n        val = calc(prevArr[b], b, d, xx, yy, zz);\n        heap.updateValue(b, val);\n      }\n      if (d < arcLen-1) {\n        val = calc(b, d, nextArr[d], xx, yy, zz);\n        heap.updateValue(d, val);\n      }\n      nextArr[b] = d;\n      prevArr[d] = b;\n    }\n  };\n};\n\nVisvalingam.standardMetric = triangleArea;\nVisvalingam.standardMetric3D = triangleArea3D;\n\nVisvalingam.getWeightedMetric = function(opts) {\n  var weight = Visvalingam.getWeightFunction(opts);\n  return function(ax, ay, bx, by, cx, cy) {\n    var area = triangleArea(ax, ay, bx, by, cx, cy),\n        cos = cosine(ax, ay, bx, by, cx, cy);\n    return weight(cos) * area;\n  };\n};\n\nVisvalingam.getWeightedMetric3D = function(opts) {\n  var weight = Visvalingam.getWeightFunction(opts);\n  return function(ax, ay, az, bx, by, bz, cx, cy, cz) {\n    var area = triangleArea3D(ax, ay, az, bx, by, bz, cx, cy, cz),\n        cos = cosine3D(ax, ay, az, bx, by, bz, cx, cy, cz);\n    return weight(cos) * area;\n  };\n};\n\nVisvalingam.getWeightCoefficient = function(opts) {\n  return opts && utils.isNumber(opts && opts.weighting) ? opts.weighting : 0.7;\n};\n\n// Get a parameterized version of Visvalingam.weight()\nVisvalingam.getWeightFunction = function(opts) {\n  var k = Visvalingam.getWeightCoefficient(opts);\n  return function(cos) {\n    return -cos * k + 1;\n  };\n};\n\n// Weight triangle area by inverse cosine\n// Standard weighting favors 90-deg angles; this curve peaks at 120 deg.\nVisvalingam.weight = function(cos) {\n  var k = 0.7;\n  return -cos * k + 1;\n};\n\nVisvalingam.getEffectiveAreaSimplifier = function(use3D) {\n  var metric = use3D ? Visvalingam.standardMetric3D : Visvalingam.standardMetric;\n  return Visvalingam.getPathSimplifier(metric, use3D);\n};\n\nVisvalingam.getWeightedSimplifier = function(opts, use3D) {\n  var metric = use3D ? Visvalingam.getWeightedMetric3D(opts) : Visvalingam.getWeightedMetric(opts);\n  return Visvalingam.getPathSimplifier(metric, use3D);\n};\n\nVisvalingam.getPathSimplifier = function(metric, use3D) {\n  return Visvalingam.scaledSimplify(Visvalingam.getArcCalculator(metric, use3D));\n};\n\n\nVisvalingam.scaledSimplify = function(f) {\n  return function(kk, xx, yy, zz) {\n    f(kk, xx, yy, zz);\n    for (var i=1, n=kk.length - 1; i<n; i++) {\n      // convert area metric to a linear equivalent\n      kk[i] = Math.sqrt(kk[i]) * 0.65;\n    }\n  };\n};\n\n\n\n\nvar DouglasPeucker = {};\n\nDouglasPeucker.metricSq3D = geom.pointSegDistSq3D;\nDouglasPeucker.metricSq = geom.pointSegDistSq;\n\n// @dest array to contain point removal thresholds\n// @xx, @yy arrays of x, y coords of a path\n// @zz (optional) array of z coords for spherical simplification\n//\nDouglasPeucker.calcArcData = function(dest, xx, yy, zz) {\n  var len = dest.length,\n      useZ = !!zz;\n\n  dest[0] = dest[len-1] = Infinity;\n  if (len > 2) {\n    procSegment(0, len-1, 1, Number.MAX_VALUE);\n  }\n\n  function procSegment(startIdx, endIdx, depth, distSqPrev) {\n    // get endpoint coords\n    var ax = xx[startIdx],\n        ay = yy[startIdx],\n        cx = xx[endIdx],\n        cy = yy[endIdx],\n        az, cz;\n    if (useZ) {\n      az = zz[startIdx];\n      cz = zz[endIdx];\n    }\n\n    var maxDistSq = 0,\n        maxIdx = 0,\n        distSqLeft = 0,\n        distSqRight = 0,\n        distSq;\n\n    for (var i=startIdx+1; i<endIdx; i++) {\n      if (useZ) {\n        distSq = DouglasPeucker.metricSq3D(xx[i], yy[i], zz[i], ax, ay, az, cx, cy, cz);\n      } else {\n        distSq = DouglasPeucker.metricSq(xx[i], yy[i], ax, ay, cx, cy);\n      }\n\n      if (distSq >= maxDistSq) {\n        maxDistSq = distSq;\n        maxIdx = i;\n      }\n    }\n\n    // Case -- threshold of parent segment is less than threshold of curr segment\n    // Curr max point is assigned parent's threshold, so parent is not removed\n    // before child as simplification is increased.\n    //\n    if (distSqPrev < maxDistSq) {\n      maxDistSq = distSqPrev;\n    }\n\n    if (maxIdx - startIdx > 1) {\n      distSqLeft = procSegment(startIdx, maxIdx, depth+1, maxDistSq);\n    }\n    if (endIdx - maxIdx > 1) {\n      distSqRight = procSegment(maxIdx, endIdx, depth+1, maxDistSq);\n    }\n\n    // Case -- max point of curr segment is highest-threshold point of an island polygon\n    // Give point the same threshold as the next-highest point, to prevent\n    // a 3-vertex degenerate ring.\n    if (depth == 1 && ax == cx && ay == cy) {\n      maxDistSq = Math.max(distSqLeft, distSqRight);\n    }\n\n    dest[maxIdx] =  Math.sqrt(maxDistSq);\n    return maxDistSq;\n  }\n};\n\n\n\n\n// Combine detection and repair for cli\n//\napi.findAndRepairIntersections = function(arcs) {\n  T.start();\n  var intersections = MapShaper.findSegmentIntersections(arcs),\n      unfixable = MapShaper.repairIntersections(arcs, intersections),\n      countPre = intersections.length,\n      countPost = unfixable.length,\n      countFixed = countPre > countPost ? countPre - countPost : 0,\n      msg;\n  T.stop('Find and repair intersections');\n  if (countPre > 0) {\n    msg = utils.format(\"[simplify] Repaired %'i intersection%s\", countFixed,\n        utils.pluralSuffix(countFixed));\n    if (countPost > 0) {\n      msg += utils.format(\"; %'i intersection%s could not be repaired\", countPost,\n          utils.pluralSuffix(countPost));\n    }\n    message(msg);\n  }\n};\n\n// Try to resolve a collection of line-segment intersections by rolling\n// back simplification along intersecting segments.\n//\n// Limitation of this method: it can't remove intersections that are present\n// in the original dataset.\n//\n// @arcs ArcCollection object\n// @intersections (Array) Output from MapShaper.findSegmentIntersections()\n// Returns array of unresolved intersections, or empty array if none.\n//\nMapShaper.repairIntersections = function(arcs, intersections) {\n  while (MapShaper.unwindIntersections(arcs, intersections) > 0) {\n    intersections = MapShaper.findSegmentIntersections(arcs);\n  }\n  return intersections;\n};\n\nMapShaper.unwindIntersections = function(arcs, intersections) {\n  var data = arcs.getVertexData(),\n      zlim = arcs.getRetainedInterval(),\n      changes = 0,\n      loops = 0,\n      replacements, queue, target, i;\n\n  // create a queue of unwind targets\n  queue = MapShaper.getUnwindTargets(intersections, zlim, data.zz);\n  utils.sortOn(queue, 'z', !!\"ascending\");\n\n  while (queue.length > 0) {\n    target = queue.pop();\n    // redetect unwind target, in case a previous unwind operation has changed things\n    // TODO: don't redetect if target couldn't have been affected\n    replacements = MapShaper.redetectIntersectionTarget(target, zlim, data.xx, data.yy, data.zz);\n    if (replacements.length == 1) {\n      replacements = MapShaper.unwindIntersection(replacements[0], zlim, data.zz);\n      changes++;\n    } else  {\n      // either 0 or multiple intersections detected\n    }\n\n    for (i=0; i<replacements.length; i++) {\n      MapShaper.insertUnwindTarget(queue, replacements[i]);\n    }\n  }\n  if (++loops > 500000) {\n    verbose(\"Caught an infinite loop at intersection:\", target);\n    return 0;\n  }\n  return changes;\n};\n\nMapShaper.getUnwindTargets = function(intersections, zlim, zz) {\n  return intersections.reduce(function(memo, o) {\n    var target = MapShaper.getUnwindTarget(o, zlim, zz);\n    if (target !== null) {\n      memo.push(target);\n    }\n    return memo;\n  }, []);\n};\n\n// @o an intersection object\n// returns null if no vertices can be added along both segments\n// else returns an object with properties:\n//   a: intersecting segment to be partitioned\n//   b: intersecting segment to be retained\n//   z: threshold value of one or more points along [a] to be re-added\nMapShaper.getUnwindTarget = function(o, zlim, zz) {\n  var ai = MapShaper.findNextRemovableVertex(zz, zlim, o.a[0], o.a[1]),\n      bi = MapShaper.findNextRemovableVertex(zz, zlim, o.b[0], o.b[1]),\n      targ;\n  if (ai == -1 && bi == -1) {\n    targ = null;\n  } else if (bi == -1 || ai != -1 && zz[ai] > zz[bi]) {\n    targ = {\n      a: o.a,\n      b: o.b,\n      z: zz[ai]\n    };\n  } else {\n    targ = {\n      a: o.b,\n      b: o.a,\n      z: zz[bi]\n    };\n  }\n  return targ;\n};\n\n// Insert an intersection into sorted position\nMapShaper.insertUnwindTarget = function(arr, obj) {\n  var ins = arr.length;\n  while (ins > 0) {\n    if (arr[ins-1].z <= obj.z) {\n      break;\n    }\n    arr[ins] = arr[ins-1];\n    ins--;\n  }\n  arr[ins] = obj;\n};\n\n// Partition one of two intersecting segments by setting the removal threshold\n// of vertices indicated by @target equal to @zlim (the current simplification\n// level of the ArcCollection)\nMapShaper.unwindIntersection = function(target, zlim, zz) {\n  var replacements = [];\n  var start = target.a[0],\n      end = target.a[1],\n      z = target.z;\n  for (var i = start + 1; i <= end; i++) {\n    if (zz[i] == z || i == end) {\n      replacements.push({\n        a: [start, i],\n        b: target.b,\n        z: z\n      });\n      if (i != end) zz[i] = zlim;\n      start = i;\n    }\n  }\n  if (replacements.length < 2) error(\"Error in unwindIntersection()\");\n  return replacements;\n};\n\nMapShaper.redetectIntersectionTarget = function(targ, zlim, xx, yy, zz) {\n  var segIds = MapShaper.getIntersectionCandidates(targ, zlim, xx, yy, zz);\n  var intersections = MapShaper.intersectSegments(segIds, xx, yy);\n  return MapShaper.getUnwindTargets(intersections, zlim, zz);\n};\n\nMapShaper.getIntersectionCandidates = function(o, zlim, xx, yy, zz) {\n  var segIds = MapShaper.getSegmentVertices(o.a, zlim, xx, yy, zz);\n  segIds = segIds.concat(MapShaper.getSegmentVertices(o.b, zlim, xx, yy, zz));\n  return segIds;\n};\n\n// Get all segments defined by two endpoints and the vertices between\n// them that are at or above the current simplification threshold.\n// TODO: test intersections with identical start + end ids\nMapShaper.getSegmentVertices = function(seg, zlim, xx, yy, zz) {\n  var start, end, prev, ids = [];\n  if (seg[0] <= seg[1]) {\n    start = seg[0];\n    end = seg[1];\n  } else {\n    start = seg[1];\n    end = seg[0];\n  }\n  prev = start;\n  for (var i=start+1; i<=end; i++) {\n    if (zz[i] >= zlim) {\n      if (xx[prev] < xx[i]) {\n        ids.push(prev, i);\n      } else {\n        ids.push(i, prev);\n      }\n      prev = i;\n    }\n  }\n  return ids;\n};\n\n\n\n\nMapShaper.calcSimplifyStats = function(arcs, use3D) {\n  var distSq = use3D ? pointSegGeoDistSq : geom.pointSegDistSq,\n      calcAngle = use3D ? geom.signedAngleSph : geom.signedAngle,\n      removed = 0,\n      retained = 0,\n      collapsedRings = 0,\n      max = 0,\n      sum = 0,\n      sumSq = 0,\n      iprev = -1,\n      jprev = -1,\n      measures = [],\n      angles = [],\n      zz = arcs.getVertexData().zz,\n      count, stats;\n\n  arcs.forEachSegment(function(i, j, xx, yy) {\n    var ax, ay, bx, by, d2, d, skipped, angle, tmp;\n    ax = xx[i];\n    ay = yy[i];\n    bx = xx[j];\n    by = yy[j];\n\n    if (i == jprev) {\n      angle = calcAngle(xx[iprev], yy[iprev], ax, ay, bx, by);\n      if (angle > Math.PI) angle = 2 * Math.PI - angle;\n      if (!isNaN(angle)) {\n        angles.push(angle * 180 / Math.PI);\n      }\n    }\n    iprev = i;\n    jprev = j;\n\n    if (zz[i] < Infinity) {\n      retained++;\n    }\n    skipped = j - i - 1;\n    if (skipped < 1) return;\n    removed += skipped;\n\n    if (ax == bx && ay == by) {\n      collapsedRings++;\n    } else {\n      d2 = 0;\n      while (++i < j) {\n        tmp = distSq(xx[i], yy[i], ax, ay, bx, by);\n        d2 = Math.max(d2, tmp);\n      }\n      sumSq += d2;\n      d = Math.sqrt(d2);\n      sum += d;\n      measures.push(d);\n      max = Math.max(max, d);\n    }\n  });\n\n  function pointSegGeoDistSq(alng, alat, blng, blat, clng, clat) {\n    var xx = [], yy = [], zz = [];\n    geom.convLngLatToSph([alng, blng, clng], [alat, blat, clat], xx, yy, zz);\n    return geom.pointSegDistSq3D(xx[0], yy[0], zz[0], xx[1], yy[1], zz[1],\n          xx[2], yy[2], zz[2]);\n  }\n\n  stats = {\n    angleMean: 0,\n    displacementMean: 0,\n    displacementMax: max,\n    collapsedRings: collapsedRings,\n    removed: removed,\n    retained: retained,\n    uniqueCount: MapShaper.countUniqueVertices(arcs),\n    removableCount: removed + retained\n  };\n\n  if (angles.length > 0) {\n    // stats.medianAngle = utils.findMedian(angles);\n    stats.angleMean = utils.sum(angles) / angles.length;\n    // stats.lt30 = utils.findRankByValue(angles, 30) / angles.length * 100;\n    // stats.lt45 = utils.findRankByValue(angles, 45) / angles.length * 100;\n    // stats.lt60 = utils.findRankByValue(angles, 60) / angles.length * 100;\n    // stats.lt90 = utils.findRankByValue(angles, 90) / angles.length * 100;\n    // stats.lt120 = utils.findRankByValue(angles, 120) / angles.length * 100;\n    // stats.lt135 = utils.findRankByValue(angles, 135) / angles.length * 100;\n    stats.angleQuartiles = [\n      utils.findValueByPct(angles, 0.75),\n      utils.findValueByPct(angles, 0.5),\n      utils.findValueByPct(angles, 0.25)\n    ];\n  }\n\n  if (measures.length > 0) {\n    stats.displacementMean = sum / measures.length;\n    // stats.median = utils.findMedian(measures);\n    // stats.stdDev = Math.sqrt(sumSq / measures.length);\n    stats.displacementQuartiles = [\n      utils.findValueByPct(measures, 0.75),\n      utils.findValueByPct(measures, 0.5),\n      utils.findValueByPct(measures, 0.25)\n    ];\n  }\n  return stats;\n};\n\nMapShaper.countUniqueVertices = function(arcs) {\n  // TODO: exclude any zero-length arcs\n  var endpoints = arcs.size() * 2;\n  var nodes = new NodeCollection(arcs).size();\n  return arcs.getPointCount() - endpoints + nodes;\n};\n\n\n\n\n\nMapShaper.getSimplifyMethodLabel = function(slug) {\n  return {\n    dp: \"Ramer-Douglas-Peucker\",\n    visvalingam: \"Visvalingam\",\n    weighted_visvalingam: \"Weighted Visvalingam\"\n  }[slug] || \"Unknown\";\n};\n\nMapShaper.printSimplifyInfo = function(arcs, opts) {\n  var method = MapShaper.getSimplifyMethod(opts);\n  var name = MapShaper.getSimplifyMethodLabel(method);\n  var spherical = MapShaper.useSphericalSimplify(arcs, opts);\n  var stats = MapShaper.calcSimplifyStats(arcs, spherical);\n  var pct1 = (stats.removed + stats.collapsedRings) / stats.uniqueCount || 0;\n  var pct2 = stats.removed / stats.removableCount || 0;\n  var aq = stats.angleQuartiles;\n  var dq = stats.displacementQuartiles;\n  var lines = [\"Simplification statistics\"];\n  lines.push(utils.format(\"Method: %s (%s) %s\", name, spherical ? 'spherical' : 'planar',\n      method == 'weighted_visvalingam' ? '(weighting=' + Visvalingam.getWeightCoefficient(opts) + ')' : ''));\n  lines.push(utils.format(\"Removed vertices: %,d\", stats.removed + stats.collapsedRings));\n  lines.push(utils.format(\"   %.1f% of %,d unique coordinate locations\", pct1 * 100, stats.uniqueCount));\n  lines.push(utils.format(\"   %.1f% of %,d filterable coordinate locations\", pct2 * 100, stats.removableCount));\n  lines.push(utils.format(\"Simplification threshold: %.4f %s\", arcs.getRetainedInterval(),\n      spherical ? 'meters' : ''));\n  lines.push(utils.format(\"Collapsed rings: %,d\", stats.collapsedRings));\n  lines.push(\"Displacement statistics\");\n  lines.push(utils.format(\"   Mean displacement: %.4f\", stats.displacementMean));\n  lines.push(utils.format(\"   Max displacement: %.4f\", stats.displacementMax));\n  lines.push(utils.format(\"   Quartiles: %.2f, %.2f, %.2f\", dq[0], dq[1], dq[2]));\n  lines.push(\"Vertex angle statistics\");\n  lines.push(utils.format(\"   Mean angle: %.2f degrees\", stats.angleMean));\n  // lines.push(utils.format(\"   Angles < 45: %.2f%\", stats.lt45));\n  lines.push(utils.format(\"   Quartiles: %.2f, %.2f, %.2f\", aq[0], aq[1], aq[2]));\n\n  message(lines.join('\\n   '));\n};\n\n\n\n\napi.simplify = function(dataset, opts) {\n  var arcs = dataset.arcs;\n  if (!arcs) stop(\"[simplify] Missing path data\");\n  // standardize options\n  opts = MapShaper.getStandardSimplifyOpts(dataset, opts);\n  // stash simplifcation options (used by gui settings dialog)\n  dataset.info = utils.defaults({simplify: opts}, dataset.info);\n\n  T.start();\n  MapShaper.simplifyPaths(arcs, opts);\n\n  if (utils.isNumber(opts.pct)) {\n    arcs.setRetainedPct(opts.pct);\n  } else if (utils.isNumber(opts.interval)) {\n    arcs.setRetainedInterval(opts.interval);\n  } else if (opts.resolution) {\n    arcs.setRetainedInterval(MapShaper.calcSimplifyInterval(arcs, opts));\n  }\n  T.stop(\"Calculate simplification\");\n\n  if (opts.keep_shapes) {\n    api.keepEveryPolygon(arcs, dataset.layers);\n  }\n\n  if (!opts.no_repair && arcs.getRetainedInterval() > 0) {\n    api.findAndRepairIntersections(arcs);\n  }\n\n  if (opts.stats) {\n    MapShaper.printSimplifyInfo(arcs, opts);\n  }\n};\n\nMapShaper.getStandardSimplifyOpts = function(dataset, opts) {\n  opts = opts || {};\n  return utils.defaults({\n    method: MapShaper.getSimplifyMethod(opts),\n    spherical: MapShaper.useSphericalSimplify(dataset.arcs, opts)\n  }, opts);\n};\n\nMapShaper.useSphericalSimplify = function(arcs, opts) {\n  return !opts.planar && !arcs.isPlanar();\n};\n\n// Calculate simplification thresholds for each vertex of an arc collection\n// (modifies @arcs ArcCollection in-place)\nMapShaper.simplifyPaths = function(arcs, opts) {\n  var simplifyPath = MapShaper.getSimplifyFunction(opts);\n  arcs.setThresholds(new Float64Array(arcs.getPointCount())); // Create array to hold simplification data\n  if (opts.spherical) {\n    MapShaper.simplifyPaths3D(arcs, simplifyPath);\n    MapShaper.protectWorldEdges(arcs);\n  } else {\n    MapShaper.simplifyPaths2D(arcs, simplifyPath);\n  }\n};\n\nMapShaper.simplifyPaths2D = function(arcs, simplify) {\n  arcs.forEach3(function(xx, yy, kk, i) {\n    simplify(kk, xx, yy);\n  });\n};\n\nMapShaper.simplifyPaths3D = function(arcs, simplify) {\n  var xbuf = utils.expandoBuffer(Float64Array),\n      ybuf = utils.expandoBuffer(Float64Array),\n      zbuf = utils.expandoBuffer(Float64Array);\n  arcs.forEach3(function(xx, yy, kk, i) {\n    var n = xx.length,\n        xx2 = xbuf(n),\n        yy2 = ybuf(n),\n        zz2 = zbuf(n);\n    geom.convLngLatToSph(xx, yy, xx2, yy2, zz2);\n    simplify(kk, xx2, yy2, zz2);\n  });\n};\n\nMapShaper.getSimplifyMethod = function(opts) {\n  var m = opts.method;\n  if (!m || m == 'weighted' || m == 'visvalingam' && opts.weighting) {\n    m =  'weighted_visvalingam';\n  }\n  return m;\n};\n\n\nMapShaper.getSimplifyFunction = function(opts) {\n  var f;\n  if (opts.method == 'dp') {\n    f = DouglasPeucker.calcArcData;\n  } else if (opts.method == 'visvalingam') {\n    f = Visvalingam.getEffectiveAreaSimplifier(opts.spherical);\n  } else if (opts.method == 'weighted_visvalingam') {\n    f = Visvalingam.getWeightedSimplifier(opts, opts.spherical);\n  } else {\n    stop('[simplify] Unsupported simplify method:', method);\n  }\n  return f;\n};\n\n// Protect polar coordinates and coordinates at the prime meridian from\n// being removed before other points in a path.\n// Assume: coordinates are in decimal degrees\n//\nMapShaper.protectWorldEdges = function(arcs) {\n  // Need to handle coords with rounding errors:\n  // -179.99999999999994 in test/test_data/ne/ne_110m_admin_0_scale_rank.shp\n  // 180.00000000000003 in ne/ne_50m_admin_0_countries.shp\n  var bb1 = MapShaper.getWorldBounds(1e-12),\n      bb2 = arcs.getBounds().toArray();\n  if (containsBounds(bb1, bb2) === true) return; // return if content doesn't reach edges\n  arcs.forEach3(function(xx, yy, zz) {\n    var maxZ = 0,\n    x, y;\n    for (var i=0, n=zz.length; i<n; i++) {\n      x = xx[i];\n      y = yy[i];\n      if (x > bb1[2] || x < bb1[0] || y < bb1[1] || y > bb1[3]) {\n        if (maxZ === 0) {\n          maxZ = MapShaper.findMaxThreshold(zz);\n        }\n        if (zz[i] !== Infinity) { // don't override lock value\n          zz[i] = maxZ;\n        }\n      }\n    }\n  });\n};\n\n// Return largest value in an array, ignoring Infinity (lock value)\n//\nMapShaper.findMaxThreshold = function(zz) {\n  var z, maxZ = 0;\n  for (var i=0, n=zz.length; i<n; i++) {\n    z = zz[i];\n    if (z > maxZ && z < Infinity) {\n      maxZ = z;\n    }\n  }\n  return maxZ;\n};\n\nMapShaper.parseSimplifyResolution = function(raw) {\n  var parts, w, h;\n  if (utils.isNumber(raw)) {\n    w = raw;\n    h = raw;\n  }\n  else if (utils.isString(raw)) {\n    parts = raw.split('x');\n    w = Number(parts[0]) || 0;\n    h = parts.length == 2 ? Number(parts[1]) || 0 : w;\n  }\n  if (!(w >= 0 && h >= 0 && w + h > 0)) {\n    stop(\"Invalid simplify resolution:\", raw);\n  }\n  return [w, h]; // TODO: validate;\n};\n\nMapShaper.calcPlanarInterval = function(xres, yres, width, height) {\n  var fitWidth = xres !== 0 && width / height > xres / yres || yres === 0;\n  return fitWidth ? width / xres : height / yres;\n};\n\n// Calculate a simplification interval for unprojected data, given an output resolution\n// (This is approximate, since we don't know how the data will be projected for display)\nMapShaper.calcSphericalInterval = function(xres, yres, bounds) {\n  // Using length of arc along parallel through center of bbox as content width\n  // TODO: consider using great circle instead of parallel arc to calculate width\n  //    (doesn't work if width of bbox is greater than 180deg)\n  var width = geom.degreesToMeters(bounds.width()) * Math.cos(bounds.centerY() * geom.D2R);\n  var height = geom.degreesToMeters(bounds.height());\n  return MapShaper.calcPlanarInterval(xres, yres, width, height);\n};\n\nMapShaper.calcSimplifyInterval = function(arcs, opts) {\n  var res, interval, bounds;\n  if (opts.interval) {\n    interval = opts.interval;\n  } else if (opts.resolution) {\n    res = MapShaper.parseSimplifyResolution(opts.resolution);\n    bounds = arcs.getBounds();\n    if (MapShaper.useSphericalSimplify(arcs, opts)) {\n      interval = MapShaper.calcSphericalInterval(res[0], res[1], bounds);\n    } else {\n      interval = MapShaper.calcPlanarInterval(res[0], res[1], bounds.width(), bounds.height());\n    }\n    // scale interval to double the resolution (single-pixel resolution creates\n    //  visible artefacts)\n    interval *= 0.5;\n  }\n  return interval;\n};\n\n\n\n\napi.splitLayer = function(src, splitField, opts) {\n  var lyr0 = opts && opts.no_replace ? MapShaper.copyLayer(src) : src,\n      properties = lyr0.data ? lyr0.data.getRecords() : null,\n      shapes = lyr0.shapes,\n      index = {},\n      splitLayers = [],\n      prefix;\n\n  if (splitField && (!properties || !lyr0.data.fieldExists(splitField))) {\n    stop(\"[split] Missing attribute field:\", splitField);\n  }\n\n  // if not splitting on a field and layer is unnamed, name split-apart layers\n  // like: split-0, split-1, ...\n  prefix = lyr0.name || (splitField ? '' : 'split');\n\n  utils.repeat(MapShaper.getFeatureCount(lyr0), function(i) {\n    var key = String(splitField ? properties[i][splitField] : i + 1),\n        lyr;\n\n    if (key in index === false) {\n      index[key] = splitLayers.length;\n      lyr = utils.defaults({\n        name: MapShaper.getSplitLayerName(prefix, key),\n        data: properties ? new DataTable() : null,\n        shapes: shapes ? [] : null\n      }, lyr0);\n      splitLayers.push(lyr);\n    } else {\n      lyr = splitLayers[index[key]];\n    }\n    if (shapes) {\n      lyr.shapes.push(shapes[i]);\n    }\n    if (properties) {\n      lyr.data.getRecords().push(properties[i]);\n    }\n  });\n  return splitLayers;\n};\n\nMapShaper.getSplitLayerName = function(base, key) {\n  return (base ? base + '-' : '') + key;\n};\n\n\n\n\n// Split the shapes in a layer according to a grid\n// Return array of layers and an index with the bounding box of each cell\n//\napi.splitLayerOnGrid = function(lyr, arcs, rows, cols) {\n  var shapes = lyr.shapes,\n      bounds = arcs.getBounds(),\n      xmin = bounds.xmin,\n      ymin = bounds.ymin,\n      w = bounds.width(),\n      h = bounds.height(),\n      properties = lyr.data ? lyr.data.getRecords() : null,\n      groups = [];\n\n  function groupId(shpBounds) {\n    var c = Math.floor((shpBounds.centerX() - xmin) / w * cols),\n        r = Math.floor((shpBounds.centerY() - ymin) / h * rows);\n    c = utils.clamp(c, 0, cols-1);\n    r = utils.clamp(r, 0, rows-1);\n    return r * cols + c;\n  }\n\n  function groupName(i) {\n    var c = i % cols + 1,\n        r = Math.floor(i / cols) + 1;\n    return \"r\" + r + \"c\" + c;\n  }\n\n  shapes.forEach(function(shp, i) {\n    var bounds = arcs.getMultiShapeBounds(shp),\n        idx = groupId(bounds),\n        group = groups[idx];\n    if (!group) {\n      group = groups[idx] = {\n        shapes: [],\n        properties: properties ? [] : null,\n        bounds: new Bounds(),\n        name: MapShaper.getSplitLayerName(lyr.name, groupName(idx))\n      };\n    }\n    group.shapes.push(shp);\n    group.bounds.mergeBounds(bounds);\n    if (group.properties) {\n      group.properties.push(properties[i]);\n    }\n  });\n\n  var layers = [];\n  groups.forEach(function(group, i) {\n    if (!group) return; // empty cell\n    var groupLyr = {\n      shapes: group.shapes,\n      name: group.name\n    };\n    utils.defaults(groupLyr, lyr);\n    if (group.properties) {\n      groupLyr.data = new DataTable(group.properties);\n    }\n    layers.push(groupLyr);\n  });\n\n  return layers;\n};\n\n\n\n\n// Recursively divide a layer into two layers until a (compiled) expression\n// no longer returns true. The original layer is split along the long side of\n// its bounding box, so that each split-off layer contains half of the original\n// shapes (+/- 1).\n//\napi.subdivideLayer = function(lyr, arcs, exp) {\n  return MapShaper.subdivide(lyr, arcs, MapShaper.compileCalcExpression(exp));\n};\n\nMapShaper.subdivide = function(lyr, arcs, compiled) {\n  var divide = compiled(lyr, arcs),\n      subdividedLayers = [],\n      tmp, bounds, lyr1, lyr2;\n\n  if (!utils.isBoolean(divide)) {\n    stop(\"[subdivide] Expression must evaluate to true or false\");\n  }\n  if (divide) {\n    bounds = MapShaper.getLayerBounds(lyr, arcs);\n    tmp = MapShaper.divideLayer(lyr, arcs, bounds);\n    lyr1 = tmp[0];\n    if (lyr1.shapes.length > 1 && lyr1.shapes.length < lyr.shapes.length) {\n      utils.merge(subdividedLayers, MapShaper.subdivide(lyr1, arcs, compiled));\n    } else {\n      subdividedLayers.push(lyr1);\n    }\n\n    lyr2 = tmp[1];\n    if (lyr2.shapes.length > 1 && lyr2.shapes.length < lyr.shapes.length) {\n      utils.merge(subdividedLayers, MapShaper.subdivide(lyr2, arcs, compiled));\n    } else {\n      subdividedLayers.push(lyr2);\n    }\n  } else {\n    subdividedLayers.push(lyr);\n  }\n\n  subdividedLayers.forEach(function(lyr2, i) {\n    lyr2.name = MapShaper.getSplitLayerName(lyr.name || 'split', i + 1);\n    utils.defaults(lyr2, lyr);\n  });\n  return subdividedLayers;\n};\n\n// split one layer into two layers containing the same number of shapes (+-1),\n// either horizontally or vertically\n//\nMapShaper.divideLayer = function(lyr, arcs, bounds) {\n  var properties = lyr.data ? lyr.data.getRecords() : null,\n      shapes = lyr.shapes,\n      lyr1, lyr2;\n  lyr1 = {\n    geometry_type: lyr.geometry_type,\n    shapes: [],\n    data: properties ? [] : null\n  };\n  lyr2 = {\n    geometry_type: lyr.geometry_type,\n    shapes: [],\n    data: properties ? [] : null\n  };\n\n  var useX = bounds && bounds.width() > bounds.height();\n  // TODO: think about case where there are null shapes with NaN centers\n  var centers = shapes.map(function(shp) {\n    var bounds = arcs.getMultiShapeBounds(shp);\n    return useX ? bounds.centerX() : bounds.centerY();\n  });\n  var ids = utils.range(centers.length);\n  ids.sort(function(a, b) {\n    return centers[a] - centers[b];\n  });\n  ids.forEach(function(shapeId, i) {\n    var dest = i < shapes.length / 2 ? lyr1 : lyr2;\n    dest.shapes.push(shapes[shapeId]);\n    if (properties) {\n      dest.data.push(properties[shapeId]);\n    }\n  });\n\n  if (properties) {\n    lyr1.data = new DataTable(lyr1.data);\n    lyr2.data = new DataTable(lyr2.data);\n  }\n  return [lyr1, lyr2];\n};\n\n\n\n\napi.sortFeatures = function(lyr, arcs, opts) {\n  var n = MapShaper.getFeatureCount(lyr),\n      ascending = !opts.descending,\n      compiled = MapShaper.compileValueExpression(opts.expression, lyr, arcs),\n      values = [];\n\n  utils.repeat(n, function(i) {\n    values.push(compiled(i));\n  });\n\n  var ids = utils.getSortedIds(values, ascending);\n  if (lyr.shapes) {\n    utils.reorderArray(lyr.shapes, ids);\n  }\n  if (lyr.data) {\n    utils.reorderArray(lyr.data.getRecords(), ids);\n  }\n};\n\n\n\n\n// TODO: consider refactoring to allow modules\n// @cmd  example: {name: \"dissolve\", options:{field: \"STATE\"}}\n// @dataset  format: {arcs: <ArcCollection>, layers:[]}\n// @done callback: function(err, dataset)\n//\napi.runCommand = function(cmd, dataset, cb) {\n  var name = cmd.name,\n      opts = cmd.options,\n      targetLayers,\n      outputLayers,\n      outputFiles,\n      arcs;\n\n  try { // catch errors from synchronous functions\n\n    T.start();\n    if (dataset) {\n      arcs = dataset.arcs;\n      if (dataset.layers.length > 0 === false) {\n        error(\"Dataset contains 0 layers\");\n      }\n\n      if (opts.target) {\n        targetLayers = MapShaper.findMatchingLayers(dataset.layers, opts.target);\n        if (!targetLayers.length) {\n          stop(utils.format('[%s] Missing target layer: %s\\nAvailable layers: %s',\n            name, opts.target, MapShaper.getFormattedLayerList(dataset.layers)));\n        }\n      } else {\n        targetLayers = dataset.layers; // default: all layers\n      }\n    }\n\n    if (name == 'calc') {\n      MapShaper.applyCommand(api.calc, targetLayers, arcs, opts);\n\n    } else if (name == 'clip') {\n      api.clipLayers(targetLayers, opts.source, dataset, opts);\n\n    } else if (name == 'dissolve') {\n      outputLayers = MapShaper.applyCommand(api.dissolve, targetLayers, arcs, opts);\n\n    } else if (name == 'dissolve2') {\n      outputLayers = MapShaper.applyCommand(api.dissolve2, targetLayers, dataset, opts);\n\n    } else if (name == 'each') {\n      MapShaper.applyCommand(api.evaluateEachFeature, targetLayers, arcs, opts.expression, opts);\n\n    } else if (name == 'erase') {\n      api.eraseLayers(targetLayers, opts.source, dataset, opts);\n\n    } else if (name == 'explode') {\n      outputLayers = MapShaper.applyCommand(api.explodeFeatures, targetLayers, arcs, opts);\n\n    } else if (name == 'filter') {\n      outputLayers = MapShaper.applyCommand(api.filterFeatures, targetLayers, arcs, opts);\n\n    } else if (name == 'filter-fields') {\n      MapShaper.applyCommand(api.filterFields, targetLayers, opts.fields);\n\n    } else if (name == 'filter-islands') {\n      MapShaper.applyCommand(api.filterIslands, targetLayers, arcs, opts);\n\n    } else if (name == 'filter-slivers') {\n      MapShaper.applyCommand(api.filterSlivers, targetLayers, arcs, opts);\n\n    } else if (name == 'flatten') {\n      outputLayers = MapShaper.applyCommand(api.flattenLayer, targetLayers, dataset, opts);\n\n    } else if (name == 'i') {\n      dataset = api.importFiles(cmd.options);\n\n    } else if (name == 'info') {\n      api.printInfo(dataset);\n\n    } else if (name == 'inspect') {\n      MapShaper.applyCommand(api.inspect, targetLayers, arcs, opts);\n\n    } else if (name == 'innerlines') {\n      outputLayers = MapShaper.applyCommand(api.innerlines, targetLayers, arcs, opts);\n\n    } else if (name == 'join') {\n      MapShaper.applyCommand(api.join, targetLayers, dataset, opts);\n\n    } else if (name == 'layers') {\n      outputLayers = MapShaper.applyCommand(api.filterLayers, dataset.layers, opts.layers);\n\n    } else if (name == 'lines') {\n      outputLayers = MapShaper.applyCommand(api.lines, targetLayers, arcs, opts);\n\n    } else if (name == 'stitch') {\n      api.stitch(dataset);\n\n    } else if (name == 'merge-layers') {\n      // careful, returned layers are modified input layers\n      outputLayers = api.mergeLayers(targetLayers);\n\n    } else if (name == 'o') {\n      outputFiles = MapShaper.exportFileContent(utils.defaults({layers: targetLayers}, dataset), opts);\n      if (opts.__nowrite) {\n        done(null, outputFiles);\n      } else {\n        MapShaper.writeFiles(outputFiles, opts, done);\n      }\n      return;\n\n    } else if (name == 'points') {\n      outputLayers = MapShaper.applyCommand(api.createPointLayer, targetLayers, arcs, opts);\n\n    } else if (name == 'proj') {\n      api.proj(dataset, opts);\n\n    } else if (name == 'rename-fields') {\n      MapShaper.applyCommand(api.renameFields, targetLayers, opts.fields);\n\n    } else if (name == 'rename-layers') {\n      api.renameLayers(targetLayers, opts.names);\n\n    } else if (name == 'repair') {\n      outputLayers = MapShaper.repairPolygonGeometry(targetLayers, dataset, opts);\n\n    } else if (name == 'simplify') {\n      api.simplify(dataset, opts);\n\n    } else if (name == 'sort') {\n      MapShaper.applyCommand(api.sortFeatures, targetLayers, arcs, opts);\n\n    } else if (name == 'split') {\n      outputLayers = MapShaper.applyCommand(api.splitLayer, targetLayers, opts.field, opts);\n\n    } else if (name == 'split-on-grid') {\n      outputLayers = MapShaper.applyCommand(api.splitLayerOnGrid, targetLayers, arcs, opts.rows, opts.cols);\n\n    } else if (name == 'subdivide') {\n      outputLayers = MapShaper.applyCommand(api.subdivideLayer, targetLayers, arcs, opts.expression);\n\n    } else if (name == 'svg-style') {\n      MapShaper.applyCommand(api.svgStyle, targetLayers, dataset, opts);\n\n    } else {\n\n      error(\"Unhandled command: [\" + name + \"]\");\n    }\n\n    // apply name parameter\n    if ('name' in opts) {\n      // TODO: consider uniqifying multiple layers here\n      (outputLayers || targetLayers || dataset.layers).forEach(function(lyr) {\n        lyr.name = opts.name;\n      });\n    }\n\n    // integrate output layers into the dataset\n    if (outputLayers) {\n      if (opts.no_replace) {\n        dataset.layers = dataset.layers.concat(outputLayers);\n      } else {\n        // TODO: consider replacing old layers as they are generated, for gc\n        MapShaper.replaceLayers(dataset, targetLayers, outputLayers);\n      }\n    }\n  } catch(e) {\n    done(e);\n    return;\n  }\n\n  done(null);\n\n  function done(err, output) {\n    T.stop('-' + name);\n    cb(err, err ? null : output || dataset);\n  }\n};\n\n// Apply a command to an array of target layers\nMapShaper.applyCommand = function(func, targetLayers) {\n  var args = utils.toArray(arguments).slice(2);\n  return targetLayers.reduce(function(memo, lyr) {\n    var result = func.apply(null, [lyr].concat(args));\n    if (utils.isArray(result)) { // some commands return an array of layers\n      memo = memo.concat(result);\n    } else if (result) { // assuming result is a layer\n      memo.push(result);\n    }\n    return memo;\n  }, []);\n};\n\nMapShaper.getFormattedLayerList = function(layers) {\n  return layers.reduce(function(memo, lyr, i) {\n    return memo + '\\n  [' + i + ']  ' + (lyr.name || '[unnamed]');\n  }, '') || '[none]';\n};\n\n\n\n\n\n\nfunction CommandParser() {\n  var commandRxp = /^--?([a-z][\\w-]*)$/i,\n      assignmentRxp = /^([a-z0-9_+-]+)=(?!\\=)(.*)$/i, // exclude ==\n      _usage = \"\",\n      _examples = [],\n      _commands = [],\n      _default = null,\n      _note;\n\n  if (this instanceof CommandParser === false) return new CommandParser();\n\n  this.usage = function(str) {\n    _usage = str;\n    return this;\n  };\n\n  this.note = function(str) {\n    _note = str;\n    return this;\n  };\n\n  // set a default command; applies to command line args preceding the first\n  // explicit command\n  this.default = function(str) {\n    _default = str;\n  };\n\n  this.example = function(str) {\n    _examples.push(str);\n  };\n\n  this.command = function(name) {\n    var opts = new CommandOptions(name);\n    _commands.push(opts);\n    return opts;\n  };\n\n  this.parseArgv = function(raw) {\n    var commandDefs = getCommands(),\n        commands = [], cmd,\n        argv = raw.map(utils.trimQuotes), // remove one level of single or dbl quotes\n        cmdName, cmdDef, opt;\n\n    if (argv.length == 1 && tokenIsCommandName(argv[0])) {\n      // show help if only a command name is given\n      argv.unshift('-help'); // kludge (assumes -help <command> syntax)\n    } else if (argv.length > 0 && !tokenLooksLikeCommand(argv[0]) && _default) {\n      // if there are arguments before the first explicit command, use the default command\n      argv.unshift('-' + _default);\n    }\n\n    while (argv.length > 0) {\n      cmdName = readCommandName(argv);\n      if (!cmdName) {\n        stop(\"Invalid command:\", argv[0]);\n      }\n      cmdDef = findCommandDefn(cmdName, commandDefs);\n      if (!cmdDef) {\n        stop(\"Unknown command:\", cmdName);\n      }\n      cmd = {\n        name: cmdDef.name,\n        options: {},\n        _: []\n      };\n\n      while (argv.length > 0 && !tokenLooksLikeCommand(argv[0])) {\n        readOption(cmd, argv, cmdDef);\n      }\n\n      if (cmdDef.validate) {\n        try {\n          cmdDef.validate(cmd);\n        } catch(e) {\n          stop(\"[\" + cmdName + \"] \" + e.message);\n        }\n      }\n      commands.push(cmd);\n    }\n    return commands;\n\n    function tokenIsCommandName(s) {\n      return !!utils.find(getCommands(), function(cmd) {\n        return s === cmd.name || s === cmd.alias;\n      });\n    }\n\n    function tokenLooksLikeCommand(s) {\n      return commandRxp.test(s);\n    }\n\n    // Try to parse an assignment @token for command @cmdDef\n    function parseAssignment(cmd, token, cmdDef) {\n      var match = assignmentRxp.exec(token),\n          name = match[1],\n          val = utils.trimQuotes(match[2]),\n          optDef = findOptionDefn(name, cmdDef);\n\n      if (!optDef) {\n        // Assignment to an unrecognized identifier could be an expression\n        // (e.g. -each 'id=$.id') -- save for later parsing\n        cmd._.push(token);\n      } else if (optDef.type == 'flag' || optDef.assign_to) {\n        stop(\"-\" + cmdDef.name + \" \" + name + \" option doesn't take a value\");\n      } else {\n        readOption(cmd, [name, val], cmdDef);\n      }\n    }\n\n    // Try to read an option for command @cmdDef from @argv\n    function readOption(cmd, argv, cmdDef) {\n      var token = argv.shift(),\n          optDef = findOptionDefn(token, cmdDef),\n          optName;\n\n      if (assignmentRxp.test(token)) {\n        parseAssignment(cmd, token, cmdDef);\n        return;\n      }\n\n      if (!optDef) {\n        // not a defined option; add it to _ array for later processing\n        cmd._.push(token);\n        return;\n      }\n\n      optName = optDef.alias_to || optDef.name;\n      optName = optName.replace(/-/g, '_');\n\n      if (optDef.assign_to) {\n        cmd.options[optDef.assign_to] = optDef.name;\n      } else if (optDef.type == 'flag') {\n        cmd.options[optName] = true;\n      } else {\n        cmd.options[optName] = readOptionValue(argv, optDef);\n      }\n    }\n\n    // Read an option value for @optDef from @argv\n    function readOptionValue(argv, optDef) {\n      var type = optDef.type,\n          val, err, token;\n      if (argv.length === 0 || tokenLooksLikeCommand(argv[0])) {\n        err = 'Missing value';\n      } else {\n        token = argv.shift(); // remove token from argv\n        if (type == 'number') {\n          val = Number(token);\n        } else if (type == 'integer') {\n          val = Math.round(Number(token));\n        } else if (type == 'comma-sep') {\n          val = token.split(',');\n        } else {\n          val = token; // assumes string\n        }\n\n        if (val !== val) {\n          err = \"Invalid numeric value\";\n        }\n      }\n\n      if (err) {\n        stop(err + \" for option \" + optDef.name + \"=<value>\");\n      }\n      return val;\n    }\n\n    // Check first element of an array of tokens; remove and return if it looks\n    // like a command name, else return null;\n    function readCommandName(args) {\n      var match = commandRxp.exec(args[0]);\n      if (match) {\n        args.shift();\n        return match[1];\n      }\n      return null;\n    }\n\n    function findCommandDefn(name, arr) {\n      return utils.find(arr, function(cmd) {\n        return cmd.name === name || cmd.alias === name;\n      });\n    }\n\n    function findOptionDefn(name, cmd) {\n      return utils.find(cmd.options, function(o) {\n        return o.name === name || o.alias === name;\n      });\n    }\n  };\n\n  this.getHelpMessage = function(commandNames) {\n    var helpStr = '',\n        cmdPre = '  ',\n        optPre = '  ',\n        exPre = '  ',\n        gutter = '  ',\n        colWidth = 0,\n        detailView = false,\n        helpCommands, allCommands;\n\n    allCommands = getCommands().filter(function(cmd) {\n      // hide commands without a description\n      return !!cmd.describe;\n    });\n\n    if (commandNames) {\n      detailView = true;\n      helpCommands = commandNames.reduce(function(memo, name) {\n        var cmd = utils.find(allCommands, function(cmd) {return cmd.name == name;});\n        if (cmd) memo.push(cmd);\n        return memo;\n      }, []);\n\n      allCommands.filter(function(cmd) {\n        return utils.contains(commandNames, cmd.name);\n      });\n      if (helpCommands.length === 0) {\n        detailView = false;\n      }\n    }\n\n    if (!detailView) {\n      if (_usage) {\n        helpStr +=  \"\\n\" + _usage + \"\\n\\n\";\n      }\n      helpCommands = allCommands;\n    }\n\n    // Format help strings, calc width of left column.\n    colWidth = helpCommands.reduce(function(w, obj) {\n      var help = cmdPre + (obj.name ? \"-\" + obj.name : \"\");\n      if (obj.alias) help += \", -\" + obj.alias;\n      obj.help = help;\n      if (detailView) {\n        w = obj.options.reduce(function(w, opt) {\n          if (opt.describe) {\n            w = Math.max(formatOption(opt), w);\n          }\n          return w;\n        }, w);\n      }\n      return Math.max(w, help.length);\n    }, 0);\n\n    // Layout help display\n    helpCommands.forEach(function(cmd) {\n      if (!detailView && cmd.title) {\n        helpStr += cmd.title + \"\\n\";\n      }\n      if (detailView) {\n        helpStr += '\\nCommand\\n';\n      }\n      helpStr += formatHelpLine(cmd.help, cmd.describe);\n      if (detailView && cmd.options.length > 0) {\n        helpStr += '\\nOptions\\n';\n        cmd.options.forEach(function(opt) {\n          if (opt.help && opt.describe) {\n            helpStr += formatHelpLine(opt.help, opt.describe);\n          }\n        });\n      }\n      if (detailView && cmd.examples) {\n        helpStr += '\\nExample' + (cmd.examples.length > 1 ? 's' : ''); //  + '\\n';\n        cmd.examples.forEach(function(ex) {\n          ex.split('\\n').forEach(function(line) {\n            helpStr += '\\n' + exPre + line;\n          });\n          helpStr += '\\n';\n        });\n      }\n    });\n\n    // additional notes for non-detail view\n    if (!detailView) {\n      if (_examples.length > 0) {\n        helpStr += \"\\nExamples\\n\";\n        _examples.forEach(function(str) {\n          helpStr += \"\\n\" + str + \"\\n\";\n        });\n      }\n      if (_note) {\n        helpStr += '\\n' + _note;\n      }\n    }\n\n    return helpStr;\n\n    function formatHelpLine(help, desc) {\n      return utils.rpad(help, colWidth, ' ') + gutter + (desc || '') + '\\n';\n    }\n\n    function formatOption(o) {\n      o.help = optPre;\n      if (o.label) {\n        o.help += o.label;\n      } else {\n        o.help += o.name;\n        if (o.alias) o.help += \", \" + o.alias;\n        if (o.type != 'flag' && !o.assign_to) o.help += \"=\";\n      }\n      return o.help.length;\n    }\n\n  };\n\n  this.printHelp = function(commands) {\n    message(this.getHelpMessage(commands));\n  };\n\n  function getCommands() {\n    return _commands.map(function(cmd) {\n      return cmd.done();\n    });\n  }\n}\n\nfunction CommandOptions(name) {\n  var _command = {\n    name: name,\n    options: []\n  };\n\n  this.validate = function(f) {\n    _command.validate = f;\n    return this;\n  };\n\n  this.describe = function(str) {\n    _command.describe = str;\n    return this;\n  };\n\n  this.example = function(str) {\n    if (!_command.examples) {\n      _command.examples = [];\n    }\n    _command.examples.push(str);\n    return this;\n  };\n\n  this.alias = function(name) {\n    _command.alias = name;\n    return this;\n  };\n\n  this.title = function(str) {\n    _command.title = str;\n    return this;\n  };\n\n  this.option = function(name, opts) {\n    opts = opts || {}; // accept just a name -- some options don't need properties\n    if (!utils.isString(name) || !name) error(\"Missing option name\");\n    if (!utils.isObject(opts)) error(\"Invalid option definition:\", opts);\n    opts.name = name;\n    _command.options.push(opts);\n    return this;\n  };\n\n  this.done = function() {\n    return _command;\n  };\n}\n\n\n\n\n\nfunction validateHelpOpts(cmd) {\n  var commands = validateCommaSepNames(cmd._[0]);\n  if (commands) {\n    cmd.options.commands = commands;\n  }\n}\n\nfunction validateInputOpts(cmd) {\n  var o = cmd.options,\n      _ = cmd._;\n\n  if (_[0] == '-' || _[0] == '/dev/stdin') {\n    o.stdin = true;\n  } else if (_.length > 0) {\n    o.files = _;\n  }\n\n  if (\"precision\" in o && o.precision > 0 === false) {\n    error(\"precision= option should be a positive number\");\n  }\n\n  if (o.encoding) {\n    o.encoding = MapShaper.validateEncoding(o.encoding);\n  }\n}\n\nfunction validateSimplifyOpts(cmd) {\n  var o = cmd.options,\n      _ = cmd._;\n\n  var pctStr = o.pct || \"\";\n  if (_.length > 0) {\n    if (/^[0-9.]+%?$/.test(_[0])) {\n      pctStr = _.shift();\n    }\n    if (_.length > 0) {\n      error(\"Unparsable option:\", _.join(' '));\n    }\n  }\n\n  if (pctStr) {\n    var isPct = pctStr.indexOf('%') > 0;\n    if (isPct) {\n      o.pct = Number(pctStr.replace('%', '')) / 100;\n    } else {\n      o.pct = Number(pctStr);\n    }\n    if (!(o.pct >= 0 && o.pct <= 1)) {\n      error(utils.format(\"Out-of-range pct value: %s\", pctStr));\n    }\n  }\n\n  var intervalStr = o.interval;\n  if (intervalStr) {\n    o.interval = Number(intervalStr);\n    if (o.interval >= 0 === false) {\n      error(utils.format(\"Out-of-range interval value: %s\", intervalStr));\n    }\n  }\n\n  if (isNaN(o.interval) && isNaN(o.pct) && !o.resolution) {\n    error(\"Command requires an interval, pct or resolution parameter\");\n  }\n}\n\nfunction validateJoinOpts(cmd) {\n  var o = cmd.options;\n  o.source = o.source || cmd._[0];\n  if (!o.source) {\n    error(\"Command requires the name of a layer or file to join\");\n  }\n}\n\nfunction validateSplitOpts(cmd) {\n  if (cmd._.length == 1) {\n    cmd.options.field = cmd._[0];\n  } else if (cmd._.length > 1) {\n    error(\"Command takes a single field name\");\n  }\n}\n\nfunction validateClipOpts(cmd) {\n  var opts = cmd.options;\n  if (cmd._[0]) {\n    opts.source = cmd._[0];\n  }\n  // rename old option\n  if (opts.cleanup) {\n    delete opts.cleanup;\n    opts.remove_slivers = true;\n  }\n  if (opts.bbox) {\n    // assume comma-sep bbox has been parsed into array of strings\n    opts.bbox = opts.bbox.map(parseFloat);\n  }\n  if (!opts.source && !opts.bbox) {\n    error(\"Command requires a source file, layer id or bbox\");\n  }\n}\n\nfunction validateDissolveOpts(cmd) {\n  var _= cmd._,\n      o = cmd.options;\n  if (_.length == 1) {\n    o.field = _[0];\n  } else if (_.length > 1) {\n    error(\"Command takes a single field name\");\n  }\n}\n\nfunction validateMergeLayersOpts(cmd) {\n  if (cmd._.length > 0) error(\"Unexpected option:\", cmd._);\n}\n\nfunction validateRenameLayersOpts(cmd) {\n  cmd.options.names = validateCommaSepNames(cmd._[0]) || null;\n}\n\nfunction validateSplitOnGridOpts(cmd) {\n  var o = cmd.options;\n  if (cmd._.length == 1) {\n    var tmp = cmd._[0].split(',');\n    o.cols = parseInt(tmp[0], 10);\n    o.rows = parseInt(tmp[1], 10) || o.cols;\n  }\n\n  if (o.rows > 0 === false || o.cols > 0 === false) {\n    error(\"Command expects cols,rows\");\n  }\n}\n\nfunction validateLinesOpts(cmd) {\n  try {\n    var fields = validateCommaSepNames(cmd.options.fields || cmd._[0]);\n    if (fields) cmd.options.fields = fields;\n  } catch (e) {\n    error(\"Command takes a comma-separated list of fields\");\n  }\n}\n\n\nfunction validateInnerLinesOpts(cmd) {\n  if (cmd._.length > 0) {\n    error(\"Command takes no arguments\");\n  }\n}\n\nfunction validateSubdivideOpts(cmd) {\n  if (cmd._.length !== 1) {\n    error(\"Command requires a JavaScript expression\");\n  }\n  cmd.options.expression = cmd._[0];\n}\n\nfunction validateFilterFieldsOpts(cmd) {\n  try {\n    var fields = validateCommaSepNames(cmd._[0]);\n    cmd.options.fields = fields || [];\n  } catch(e) {\n    error(\"Command requires a comma-sep. list of fields\");\n  }\n}\n\nfunction validateExpressionOpts(cmd) {\n  if (cmd._.length == 1) {\n    cmd.options.expression = cmd._[0];\n  } else if (cmd._.length > 1) {\n    error(\"Unparsable arguments:\", cmd._);\n  }\n}\n\nfunction validateOutputOpts(cmd) {\n  var _ = cmd._,\n      o = cmd.options,\n      arg = _[0] || \"\",\n      pathInfo = utils.parseLocalPath(arg);\n\n  if (_.length > 1) {\n    error(\"Command takes one file or directory argument\");\n  }\n\n  if (arg == '-' || arg == '/dev/stdout') {\n    o.stdout = true;\n  } else if (arg && !pathInfo.extension) {\n    if (!cli.isDirectory(arg)) {\n      error(\"Unknown output option:\", arg);\n    }\n    o.output_dir = arg;\n  } else if (arg) {\n    if (pathInfo.directory) {\n      o.output_dir = pathInfo.directory;\n      cli.validateOutputDir(o.output_dir);\n    }\n    o.output_file = pathInfo.filename;\n    if (MapShaper.filenameIsUnsupportedOutputType(o.output_file)) {\n      error(\"Output file looks like an unsupported file type:\", o.output_file);\n    }\n  }\n\n  if (o.format) {\n    o.format = o.format.toLowerCase();\n    if (o.format == 'csv') {\n      o.format = 'dsv';\n      o.delimiter = o.delimiter || ',';\n    } else if (o.format == 'tsv') {\n      o.format = 'dsv';\n      o.delimiter = o.delimiter || '\\t';\n    }\n    if (!MapShaper.isSupportedOutputFormat(o.format)) {\n      error(\"Unsupported output format:\", o.format);\n    }\n  }\n\n  if (o.delimiter) {\n    // convert \"\\t\" '\\t' \\t to tab\n    o.delimiter = o.delimiter.replace(/^[\"']?\\\\t[\"']?$/, '\\t');\n    if (!MapShaper.isSupportedDelimiter(o.delimiter)) {\n      error(\"Unsupported delimiter:\", o.delimiter);\n    }\n  }\n\n  if (o.encoding) {\n    o.encoding = MapShaper.validateEncoding(o.encoding);\n  }\n\n  // topojson-specific\n  if (\"quantization\" in o && o.quantization > 0 === false) {\n    error(\"quantization= option should be a nonnegative integer\");\n  }\n\n  if (\"topojson_precision\" in o && o.topojson_precision > 0 === false) {\n    error(\"topojson-precision= option should be a positive number\");\n  }\n\n}\n\n// Convert a comma-separated string into an array of trimmed strings\n// Return null if list is empty\nfunction validateCommaSepNames(str, min) {\n  if (!min && !str) return null; // treat\n  if (!utils.isString(str)) {\n    error (\"Expected a comma-separated list; found:\", str);\n  }\n  var parts = str.split(',').map(utils.trim).filter(function(s) {return !!s;});\n  if (min && min > parts.length < min) {\n    error(utils.format(\"Expected a list of at least %d member%s; found: %s\", min, utils.pluralSuffix(min), str));\n  }\n  return parts.length > 0 ? parts : null;\n}\n\n\n\n\nMapShaper.splitShellTokens = function(str) {\n  var BAREWORD = '([^\\\\s\\'\"])+';\n  var SINGLE_QUOTE = '\"((\\\\\\\\\"|[^\"])*?)\"';\n  var DOUBLE_QUOTE = '\\'((\\\\\\\\\\'|[^\\'])*?)\\'';\n  var rxp = new RegExp('(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')*', 'g');\n  var matches = str.match(rxp) || [];\n  var chunks = matches.filter(function(chunk) {\n    // single backslashes may be present in multiline commands pasted from a makefile, e.g.\n    return !!chunk && chunk != '\\\\';\n  }).map(utils.trimQuotes);\n  return chunks;\n};\n\nutils.trimQuotes = function(raw) {\n  var len = raw.length, first, last;\n  if (len >= 2) {\n    first = raw.charAt(0);\n    last = raw.charAt(len-1);\n    if (first == '\"' && last == '\"' || first == \"'\" && last == \"'\") {\n      return raw.substr(1, len-2);\n    }\n  }\n  return raw;\n};\n\n\n\n\nMapShaper.getOptionParser = function() {\n  // definitions of options shared by more than one command\n  var targetOpt = {\n        describe: \"layer(s) to target (comma-sep. list); default is all layers\"\n      },\n      nameOpt = {\n        describe: \"rename the edited layer(s)\"\n      },\n      noReplaceOpt = {\n        alias: \"+\",\n        type: 'flag',\n        describe: \"retain the original layer(s) instead of replacing\"\n      },\n      encodingOpt = {\n        describe: \"text encoding (applies to .dbf and delimited text files)\"\n      },\n      autoSnapOpt = {\n        alias: \"snap\",\n        describe: \"snap nearly identical points to fix minor topology errors\",\n        type: \"flag\"\n      },\n      snapIntervalOpt = {\n        describe: \"specify snapping distance in source units\",\n        type: \"number\"\n      },\n      sumFieldsOpt = {\n        describe: \"fields to sum when dissolving  (comma-sep. list)\",\n        type: \"comma-sep\"\n      },\n      copyFieldsOpt = {\n        describe: \"fields to copy when dissolving (comma-sep. list)\",\n        type: \"comma-sep\"\n      },\n      dissolveFieldOpt = {\n        label: \"<field>\",\n        describe: \"(optional) name of a data field to dissolve on\"\n      },\n      bboxOpt = {\n        type: \"comma-sep\",\n        describe: \"comma-sep. bounding box: xmin,ymin,xmax,ymax\"\n      };\n\n  var parser = new CommandParser(),\n      usage = \"Usage:  mapshaper -<command> [options] ...\";\n\n  parser.usage(usage);\n\n  /*\n  parser.example(\"Fix minor topology errors, simplify to 10%, convert to GeoJSON\\n\" +\n      \"$ mapshaper states.shp auto-snap -simplify 10% -o format=geojson\");\n\n  parser.example(\"Aggregate census tracts to counties\\n\" +\n      \"$ mapshaper tracts.shp -each \\\"CTY_FIPS=FIPS.substr(0, 5)\\\" -dissolve CTY_FIPS\");\n  */\n\n  parser.note(\"Enter mapshaper -help <command> to view options for a single command\");\n\n  parser.default('i');\n\n  parser.command('i')\n    .title(\"Editing commands\")\n    .describe(\"input one or more files\")\n    .validate(validateInputOpts)\n    .option(\"files\", {\n      label: \"<file(s)>\",\n      describe: \"files to import (separated by spaces), or - to use stdin\"\n    })\n    .option(\"merge-files\", {\n      describe: \"merge features from compatible files into the same layer\",\n      type: \"flag\"\n    })\n    .option(\"combine-files\", {\n      describe: \"import files to separate layers with shared topology\",\n      type: \"flag\"\n    })\n    .option(\"no-topology\", {\n      describe: \"treat each shape as topologically independent\",\n      type: \"flag\"\n    })\n    .option(\"precision\", {\n      describe: \"coordinate precision in source units, e.g. 0.001\",\n      type: \"number\"\n    })\n    .option(\"auto-snap\", autoSnapOpt)\n    .option(\"snap-interval\", snapIntervalOpt)\n    .option(\"encoding\", encodingOpt)\n    /*\n    .option(\"fields\", {\n      describe: \"attribute fields to import (comma-sep.) (default is all fields)\",\n      type: \"comma-sep\"\n    }) */\n    .option(\"id-field\", {\n      describe: \"import Topo/GeoJSON id property to this field\"\n    })\n    .option(\"field-types\", {\n      describe: \"type hints for csv files, e.g. FIPS:str,STATE_FIPS:str\",\n      type: \"comma-sep\"\n    })\n    .option(\"name\", {\n      describe: \"Rename the imported layer(s)\"\n    });\n\n  parser.command('o')\n    .describe(\"output edited content\")\n    .validate(validateOutputOpts)\n    .option('_', {\n      label: \"<file|dir|->\",\n      describe: \"(optional) name of output file or directory, or - for stdout\"\n    })\n    .option(\"format\", {\n      describe: \"options: shapefile,geojson,topojson,json,dbf,csv,tsv,svg\"\n    })\n    .option(\"target\", targetOpt)\n    .option(\"force\", {\n      type: \"flag\",\n      describe: \"let output files overwrite existing files\"\n    })\n    .option(\"dry-run\", {\n      // describe: \"do not output any files\"\n      type: \"flag\"\n    })\n    .option(\"encoding\", {\n      describe: \"text encoding of output dbf file\"\n    })\n    .option(\"ldid\", {\n      // describe: \"language driver id of dbf file\",\n      type: \"number\"\n    })\n    .option(\"bbox-index\", {\n      describe: \"export a .json file with bbox of each layer\",\n      type: 'flag'\n    })\n    .option(\"cut-table\", {\n      describe: \"detach data attributes from shapes and save as a JSON file\",\n      type: \"flag\"\n    })\n    .option(\"drop-table\", {\n      describe: \"remove data attributes from output\",\n      type: \"flag\"\n    })\n    .option(\"precision\", {\n      describe: \"coordinate precision in source units, e.g. 0.001\",\n      type: \"number\"\n    })\n    .option(\"bbox\", {\n      type: \"flag\",\n      describe: \"(Topo/GeoJSON) add bbox property\"\n    })\n    .option(\"prettify\", {\n      type: \"flag\",\n      describe: \"(Topo/GeoJSON) format output for readability\"\n    })\n    .option(\"id-field\", {\n      describe: \"(Topo/GeoJSON) field to use for id property\",\n      type: \"comma-sep\"\n    })\n    .option(\"quantization\", {\n      describe: \"(TopoJSON) specify quantization (auto-set by default)\",\n      type: \"integer\"\n    })\n    .option(\"no-quantization\", {\n      describe: \"(TopoJSON) export arc coordinates without quantization\",\n      type: \"flag\"\n    })\n    .option('presimplify', {\n      describe: \"(TopoJSON) add per-vertex data for dynamic simplification\",\n      type: \"flag\"\n    })\n    .option(\"topojson-precision\", {\n      // describe: \"pct of avg segment length for rounding (0.02 is default)\",\n      type: \"number\"\n    })\n    .option(\"width\", {\n      describe: \"(SVG) width of the SVG viewport (default is 800)\",\n      type: \"number\"\n    })\n    .option(\"margin\", {\n      describe: \"(SVG) margin between data and viewport bounds (default is 1)\",\n      type: \"number\"\n    })\n    .option(\"svg-scale\", {\n      // describe: \"(SVG) data units (e.g. meters) per pixel\"\n      type: \"number\"\n    })\n    .option(\"delimiter\", {\n      describe: \"(CSV) field delimiter\"\n    });\n\n  parser.command('simplify')\n    .validate(validateSimplifyOpts)\n    .example(\"Retain 10% of removable vertices\\n$ mapshaper input.shp -simplify 10%\")\n    .describe(\"simplify the geometry of polygon and polyline features\")\n    .option('pct', {\n      alias: 'p',\n      label: \"<x%>\",\n      describe: \"percentage of removable points to retain, e.g. 10%\"\n    })\n    .option(\"dp\", {\n      alias: \"rdp\",\n      describe: \"use Ramer-Douglas-Peucker simplification\",\n      assign_to: \"method\"\n    })\n    .option(\"visvalingam\", {\n      describe: \"use Visvalingam simplification with \\\"effective area\\\" metric\",\n      assign_to: \"method\"\n    })\n    .option(\"weighted\", {\n      describe: \"use weighted Visvalingam simplification (default)\",\n      assign_to: \"method\"\n    })\n    .option(\"method\", {\n      // hidden option\n    })\n    .option(\"weighting\", {\n      type: \"number\",\n      describe: \"weighted Visvalingam coefficient (default is 0.7)\"\n    })\n    .option(\"resolution\", {\n      describe: \"output resolution as a grid (e.g. 1000x500)\"\n    })\n    .option(\"interval\", {\n      // alias: \"i\",\n      describe: \"output resolution as a distance (e.g. 100)\",\n      type: \"number\"\n    })\n    /*\n    .option(\"value\", {\n      // for testing\n      // describe: \"raw value of simplification threshold\",\n      type: \"number\"\n    })\n    */\n    .option(\"planar\", {\n      describe: \"simplify decimal degree coords in 2D space (default is 3D)\",\n      type: \"flag\"\n    })\n    .option(\"cartesian\", {\n      describe: \"(deprecated) alias for planar\",\n      type: \"flag\",\n      alias_to: \"planar\"\n    })\n    .option(\"keep-shapes\", {\n      describe: \"prevent small polygon features from disappearing\",\n      type: \"flag\"\n    })\n    .option(\"no-repair\", {\n      describe: \"don't remove intersections introduced by simplification\",\n      type: \"flag\"\n    })\n    .option(\"stats\", {\n      describe: \"display simplification statistics\",\n      type: \"flag\"\n    });\n\n  parser.command(\"join\")\n    .describe(\"join data records from a file or layer to a layer\")\n    .example(\"Join a csv table to a Shapefile\\n\" +\n      \"(The :str suffix prevents FIPS field from being converted from strings to numbers)\\n\" +\n      \"$ mapshaper states.shp -join data.csv keys=STATE_FIPS,FIPS -field-types=FIPS:str -o joined.shp\")\n    .validate(validateJoinOpts)\n    .option(\"source\", {\n      label: \"<file>\",\n      describe: \"file containing data records\"\n    })\n    .option(\"keys\", {\n      describe: \"join by matching target,source key fields; e.g. keys=FIPS,GEOID\",\n      type: \"comma-sep\"\n    })\n    .option(\"fields\", {\n      describe: \"fields to join, e.g. fields=FIPS,POP (default is all fields)\",\n      type: \"comma-sep\"\n    })\n    .option(\"field-types\", {\n      describe: \"type hints for importing csv files, e.g. FIPS:str,STATE_FIPS:str\",\n      type: \"comma-sep\"\n    })\n    .option(\"sum-fields\", {\n      describe: \"fields to sum when multiple source records match the same target\",\n      type: \"comma-sep\"\n    })\n    .option(\"where\", {\n      describe: \"use a JS expression to filter source records\"\n    })\n    .option(\"force\", {\n      describe: \"replace values from same-named fields\",\n      type: \"flag\"\n    })\n    .option(\"unjoined\", {\n      describe: \"copy unjoined records from source table to \\\"unjoined\\\" layer\",\n      type: \"flag\"\n    })\n    .option(\"unmatched\", {\n      describe: \"copy unmatched records in target table to \\\"unmatched\\\" layer\",\n      type: \"flag\"\n    })\n    .option(\"encoding\", encodingOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"each\")\n    .describe(\"create/update/delete data fields using a JS expression\")\n    .example(\"Add two calculated data fields to a layer of U.S. counties\\n\" +\n        \"$ mapshaper counties.shp -each 'STATE_FIPS=CNTY_FIPS.substr(0, 2), AREA=$.area'\")\n    .validate(validateExpressionOpts)\n    .option(\"expression\", {\n      label: \"<expression>\",\n      describe: \"JS expression to apply to each target feature\"\n    })\n    .option(\"where\", {\n      describe: \"use a JS expression to select a subset of features\"\n    })\n    .option(\"target\", targetOpt);\n\n   parser.command(\"sort\")\n    .describe(\"sort features using a JS expression\")\n    .validate(validateExpressionOpts)\n    .option(\"expression\", {\n      label: \"<expression>\",\n      describe: \"JS expression to generate a sort key for each feature\"\n    })\n    .option(\"ascending\", {\n      describe: \"Sort in ascending order (default)\",\n      type: \"flag\"\n    })\n    .option(\"descending\", {\n      describe: \"Sort in descending order\",\n      type: \"flag\"\n    })\n    .option(\"target\", targetOpt);\n\n  parser.command(\"filter\")\n    .describe(\"delete features using a JS expression\")\n    .validate(validateExpressionOpts)\n    .option(\"expression\", {\n      label: \"<expression>\",\n      describe: \"delete features that evaluate to false\"\n    })\n    .option(\"remove-empty\", {\n      type: \"flag\",\n      describe: \"delete features with null geometry\"\n    })\n    .option(\"keep-shapes\", {\n      type: \"flag\"\n    })\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"filter-islands\")\n    .describe(\"remove small detached polygon rings (islands)\")\n    .validate(validateExpressionOpts)\n\n    .option(\"min-area\", {\n      type: \"number\",\n      describe: \"remove small-area islands (sq meters or projected units)\"\n    })\n    .option(\"min-vertices\", {\n      type: \"integer\",\n      describe: \"remove low-vertex-count islands\"\n    })\n    .option(\"remove-empty\", {\n      type: \"flag\",\n      describe: \"delete features with null geometry\"\n    })\n    .option(\"target\", targetOpt);\n\n  parser.command(\"filter-slivers\")\n    .describe(\"remove small polygon rings\")\n    .validate(validateExpressionOpts)\n\n    .option(\"min-area\", {\n      type: \"number\",\n      describe: \"remove small-area rings (sq meters or projected units)\"\n    })\n    /*\n    .option(\"remove-empty\", {\n      type: \"flag\",\n      describe: \"delete features with null geometry\"\n    })\n    */\n    .option(\"target\", targetOpt);\n\n  parser.command(\"filter-fields\")\n    .describe('retain a subset of data fields')\n    .validate(validateFilterFieldsOpts)\n    .option(\"fields\", {\n      label: \"<field(s)>\",\n      describe: \"fields to retain (comma-sep.), e.g. 'fips,name'\"\n    })\n    .option(\"target\", targetOpt);\n\n  parser.command(\"rename-fields\")\n    .describe('rename data fields')\n    .validate(validateFilterFieldsOpts)\n    .option(\"fields\", {\n      label: \"<field(s)>\",\n      describe: \"fields to rename (comma-sep.), e.g. 'fips=STATE_FIPS,st=state'\"\n    })\n    .option(\"target\", targetOpt);\n\n  parser.command(\"clip\")\n    .describe(\"use a polygon layer to clip another layer\")\n    .example(\"$ mapshaper states.shp -clip land_area.shp -o clipped.shp\")\n    .validate(validateClipOpts)\n    .option(\"source\", {\n      label: \"<file|layer>\",\n      describe: \"file or layer containing clip polygons\"\n    })\n    .option('remove-slivers', {\n      describe: \"remove sliver polygons created by clipping\",\n      type: 'flag'\n    })\n    .option(\"cleanup\", {type: 'flag'}) // obsolete; renamed in validation func.\n    .option(\"bbox\", bboxOpt)\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"erase\")\n    .describe(\"use a polygon layer to erase another layer\")\n    .example(\"$ mapshaper land_areas.shp -erase water_bodies.shp -o erased.shp\")\n    .validate(validateClipOpts)\n    .option(\"source\", {\n      label: \"<file|layer>\",\n      describe: \"file or layer containing erase polygons\"\n    })\n    .option('remove-slivers', {\n      describe: \"remove sliver polygons created by erasing\",\n      type: 'flag'\n    })\n    .option(\"cleanup\", {type: 'flag'})\n    .option(\"bbox\", bboxOpt)\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"stitch\");\n\n  parser.command(\"dissolve\")\n    .validate(validateDissolveOpts)\n    .describe(\"merge polygon or point features\")\n    .example(\"Dissolve all polygons in a feature layer into a single polygon\\n\" +\n      \"$ mapshaper states.shp -dissolve -o country.shp\")\n    .example(\"Generate state-level polygons by dissolving a layer of counties\\n\" +\n      \"(STATE_FIPS, POPULATION and STATE_NAME are attribute field names)\\n\" +\n      \"$ mapshaper counties.shp -dissolve STATE_FIPS copy-fields=STATE_NAME sum-fields=POPULATION -o states.shp\")\n    .option(\"field\", dissolveFieldOpt)\n    .option(\"sum-fields\", sumFieldsOpt)\n    .option(\"copy-fields\", copyFieldsOpt)\n    .option(\"weight\", {\n      describe: \"[points] field or expression to use for weighting centroid\"\n    })\n    .option(\"planar\", {\n      type: 'flag',\n      describe: \"[points] use 2D math to find centroids of latlong points\"\n    })\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"dissolve2\")\n    .validate(validateDissolveOpts)\n    .describe(\"merge adjacent and overlapping polygons\")\n    .option(\"field\", dissolveFieldOpt)\n    .option(\"sum-fields\", sumFieldsOpt)\n    .option(\"copy-fields\", copyFieldsOpt)\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"explode\")\n    .describe(\"divide multi-part features into single-part features\")\n    .option(\"convert-holes\", {type: \"flag\"}) // testing\n    .option(\"target\", targetOpt);\n\n  parser.command(\"innerlines\")\n    .describe(\"convert polygons to polylines along shared edges\")\n    .validate(validateInnerLinesOpts)\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"lines\")\n    .describe(\"convert polygons to polylines, classified by edge type\")\n    .validate(validateLinesOpts)\n    .option(\"fields\", {\n      label: \"<field(s)>\",\n      describe: \"optional comma-sep. list of fields to create a hierarchy\",\n      type: \"comma-sep\"\n    })\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"points\")\n    .describe(\"create a point layer from polygons or attribute data\")\n    .validate(function (cmd) {\n      if (cmd._.length > 0) {\n        error(\"Unknown argument:\", cmd._[0]);\n      }\n    })\n    .option(\"x\", {\n      describe: \"field containing x coordinate\"\n    })\n    .option(\"y\", {\n      describe: \"field containing y coordinate\"\n    })\n    .option(\"inner\", {\n      describe: \"create an interior point for each polygon's largest ring\",\n      type: \"flag\"\n    })\n    .option(\"centroid\", {\n      describe: \"create a centroid point for each polygon's largest ring\",\n      type: \"flag\"\n    })\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"split\")\n    .describe(\"split features into separate layers using a data field\")\n    .validate(validateSplitOpts)\n    .option(\"field\", {\n      label: '<field>',\n      describe: \"name of an attribute field (omit to split all features)\"\n    })\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"merge-layers\")\n    .describe(\"merge multiple layers into as few layers as possible\")\n    .validate(validateMergeLayersOpts)\n    .option(\"name\", nameOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"rename-layers\")\n    .describe(\"assign new names to layers\")\n    .validate(validateRenameLayersOpts)\n    .option(\"names\", {\n      label: \"<name(s)>\",\n      type: \"comma-sep\",\n      describe: \"new layer name(s) (comma-sep. list)\"\n    })\n    .option(\"target\", targetOpt);\n\n  parser.command(\"subdivide\")\n    .describe(\"recursively split a layer using a JS expression\")\n    .validate(validateSubdivideOpts)\n    .option(\"expression\", {\n      label: \"<expression>\",\n      describe: \"boolean JS expression\"\n    })\n    // .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"split-on-grid\")\n    .describe(\"split features into separate layers using a grid\")\n    .validate(validateSplitOnGridOpts)\n    .option(\"-\", {\n      label: \"<cols,rows>\",\n      describe: \"size of the grid, e.g. -split-on-grid 12,10\"\n    })\n    .option(\"cols\", {\n      type: \"integer\"\n    })\n    .option(\"rows\", {\n      type: \"integer\"\n    })\n    // .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"svg-style\")\n    .describe(\"set SVG style using JS expressions or literal values\")\n    .option(\"class\", {\n      describe: 'name of CSS class or classes (space sep.)'\n    })\n    .option(\"fill\", {\n      describe: 'fill color, examples: #eee pink rgba(0, 0, 0, 0.2)'\n    })\n    .option(\"stroke\", {\n      describe: 'stroke color'\n    })\n    .option(\"stroke-width\", {\n      describe: 'stroke width'\n    })\n    .option(\"opacity\", {\n      describe: 'opacity, example: 0.5'\n    })\n    .option(\"r\", {\n      describe: 'radius of circle symbols',\n    })\n    .option(\"target\", targetOpt);\n\n  parser.command(\"proj\")\n    // .describe(\"project the coordinates in a dataset\")\n    .option(\"densify\", {\n      type: \"flag\",\n      describe: \"interpolate points to approximate curves\"\n    })\n    .option(\"spherical\", {type: \"flag\"})\n    .option(\"lng0\", {type: \"number\"})\n    .option(\"lat0\", {type: \"number\"})\n    .option(\"lat1\", {type: \"number\"})\n    .option(\"lat2\", {type: \"number\"})\n    .option(\"zone\") // for UTM\n    //.option(\"k0\", {type: \"number\"})\n    //.option(\"x0\", {type: \"number\"})\n    //.option(\"y0\", {type: \"number\"})\n    .validate(function(cmd) {\n      var name = cmd._[0];\n      if (!name) {\n        error(\"Missing a projection name\");\n      }\n      if (cmd._.length > 1) {\n        error(\"Received one or more unknown projection parameters\");\n      }\n      cmd.options.projection = name;\n    });\n\n\n  parser.command(\"calc\")\n    .title(\"\\nInformational commands\")\n    .describe(\"calculate statistics about the features in a layer\")\n    .example(\"Calculate the total area of a polygon layer\\n\" +\n      \"$ mapshaper polygons.shp -calc 'sum($.area)'\")\n    .example(\"Count census blocks in NY with zero population\\n\" +\n      \"$ mapshaper ny-census-blocks.shp -calc 'count()' where='POPULATION == 0'\")\n    .validate(function(cmd) {\n      if (cmd._.length === 0) {\n        error(\"Missing a JS expression\");\n      }\n      validateExpressionOpts(cmd);\n    })\n    .option(\"expression\", {\n      label: \"<expression>\",\n      describe: \"functions: sum() average() median() max() min() count()\"\n    })\n    .option(\"where\", {\n      describe: \"use a JS expression to select a subset of features\"\n    })\n    .option(\"target\", targetOpt);\n\n\n  parser.command('encodings')\n    .describe(\"print list of supported text encodings (for .dbf import)\");\n\n  parser.command('projections');\n    // .describe(\"print names of supported projections\");\n\n  parser.command('version')\n    .alias('v')\n    .describe(\"print mapshaper version\");\n\n  parser.command('info')\n    .describe(\"print information about data layers\");\n\n  parser.command('inspect')\n    .describe(\"print information about a feature\")\n    .option(\"expression\", {\n      label: \"<expression>\",\n      describe: \"boolean JS expression for selecting a feature\"\n    })\n    .option(\"target\", targetOpt)\n    .validate(function(cmd) {\n      if (cmd._.length > 0) {\n        cmd.options.expression = cmd._[0];\n      }\n    });\n\n  parser.command('verbose')\n    .describe(\"print verbose processing messages\");\n\n  parser.command('help')\n    .alias('h')\n    .validate(validateHelpOpts)\n    .describe(\"print help; takes optional command name\")\n    .option(\"commands\", {\n      label: \"<command>\",\n      type: \"comma-sep\",\n      describe: \"view detailed information about a command\"\n    });\n\n  // Work-in-progress (no .describe(), so hidden from -h)\n  parser.command('tracing');\n  parser.command(\"flatten\")\n    .option(\"target\", targetOpt);\n  /*\n  parser.command(\"divide\")\n    .option(\"name\", nameOpt)\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"fill-holes\")\n    .option(\"no-replace\", noReplaceOpt)\n    .option(\"target\", targetOpt);\n\n  parser.command(\"repair\")\n    .option(\"target\", targetOpt);\n  */\n\n  return parser;\n};\n\n\n\n\n// Parse an array or a string of command line tokens into an array of\n// command objects.\nMapShaper.parseCommands = function(tokens) {\n  if (utils.isString(tokens)) {\n    tokens = MapShaper.splitShellTokens(tokens);\n  }\n  return MapShaper.getOptionParser().parseArgv(tokens);\n};\n\n// Parse a command line string for the browser console\nMapShaper.parseConsoleCommands = function(raw) {\n  var str = raw.replace(/^mapshaper\\b/, '').trim();\n  var parsed;\n  if (/^[a-z]/.test(str)) {\n    // add hyphen prefix to bare command\n    str = '-' + str;\n  }\n  if (utils.contains(MapShaper.splitShellTokens(str), '-i')) {\n    stop(\"The input command cannot be run in the browser\");\n  }\n  parsed = MapShaper.parseCommands(str);\n  // block implicit initial -i command\n  if (parsed.length > 0 && parsed[0].name == 'i') {\n    stop(utils.format(\"Unable to run [%s]\", raw));\n  }\n  return parsed;\n};\n\n\n\n\n// Parse command line args into commands and run them\n// @argv Array of command line tokens or single string of commands\napi.runCommands = function(argv, done) {\n  var commands;\n  try {\n    commands = MapShaper.parseCommands(argv);\n  } catch(e) {\n    return done(e);\n  }\n\n  if (commands.length === 0) {\n    return done(new APIError(\"No commands to run\"));\n  }\n\n  T.start(\"Start timing\");\n  MapShaper.runParsedCommands(commands, function(err, output) {\n    T.stop(\"Total time\");\n    done(err, output);\n  });\n};\n\n// Apply a set of processing commands to the contents of an input file\n// @argv Command line arguments, as string or array\n// @done Callback: function(<error>, <output>)\napi.applyCommands = function(argv, content, done) {\n  MapShaper.processFileContent(argv, content, function(err, exports) {\n    var output = null;\n    if (!err) {\n      output = exports.map(function(obj) {\n        return obj.content;\n      });\n      if (output.length == 1) {\n        output = output[0];\n      }\n    }\n    done(err, output);\n  });\n};\n\n// Capture output data instead of writing files (useful for testing)\n// @tokens Command line arguments, as string or array\n// @content (may be null) Contents of input data file\n// @done: Callback function(<error>, <output>); <output> is an array of objects\n//        with properties \"content\" and \"filename\"\nMapShaper.processFileContent = function(tokens, content, done) {\n  var dataset, commands, lastCmd, inOpts;\n  try {\n    commands = MapShaper.parseCommands(tokens);\n    commands = MapShaper.runAndRemoveInfoCommands(commands);\n\n    // if we're processing raw content, import it to a dataset object\n    if (content) {\n      // if first command is -i, use -i options for importing\n      if (commands[0] && commands[0].name == 'i') {\n        inOpts = commands.shift().options;\n      } else {\n        inOpts = {};\n      }\n      dataset = MapShaper.importFileContent(content, null, inOpts);\n    }\n\n    // if last command is -o, use -o options for exporting\n    lastCmd = commands[commands.length-1];\n    if (!lastCmd || lastCmd.name != 'o') {\n      lastCmd = {name: 'o', options: {}};\n      commands.push(lastCmd);\n    }\n    // export to callback, not file\n    lastCmd.options.__nowrite = true;\n  } catch(e) {\n    return done(e);\n  }\n\n  MapShaper.runParsedCommands(commands, dataset, done);\n};\n\n// Execute a sequence of commands\n// Signature: function(commands, [dataset,] done)\n// @commands Array of parsed commands\n// @done: function(<error>, <dataset>)\n//\nMapShaper.runParsedCommands = function(commands) {\n  var dataset = null,\n      done;\n\n  if (arguments.length == 2) {\n    done = arguments[1];\n  } else if (arguments.length == 3) {\n    dataset = arguments[1];\n    done = arguments[2];\n  }\n\n  if (!utils.isFunction(done)) {\n    error(\"[runParsedCommands()] Missing a callback function\");\n  }\n\n  if (!utils.isArray(commands)) {\n    error(\"[runParsedCommands()] Expected an array of parsed commands\");\n  }\n\n  commands = MapShaper.runAndRemoveInfoCommands(commands);\n  if (commands.length === 0) {\n    return done(null, dataset);\n  }\n  commands = MapShaper.divideImportCommand(commands);\n  if (commands[0].name != 'i' && !dataset) {\n    return done(new APIError(\"Missing a -i command\"));\n  }\n\n  utils.reduceAsync(commands, dataset, function(dataset, cmd, nextCmd) {\n    api.runCommand(cmd, dataset, nextCmd);\n  }, done);\n};\n\n// If an initial import command indicates that several input files should be\n//   processed separately, then duplicate the sequence of commands to run\n//   once for each input file\n// @commands Array of parsed commands\n// Returns: either original command array or array of duplicated commands.\n//\nMapShaper.divideImportCommand = function(commands) {\n  var firstCmd = commands[0],\n      firstOpts = firstCmd.options,\n      files = firstOpts.files || [];\n\n  if (firstCmd.name != 'i' || files.length <= 1 || firstOpts.stdin ||\n      firstOpts.merge_files || firstOpts.combine_files) {\n    return commands;\n  }\n  return files.reduce(function(memo, file) {\n    var importCmd = {\n      name: 'i',\n      options: utils.defaults({files:[file]}, firstOpts)\n    };\n    memo.push(importCmd);\n    memo.push.apply(memo, commands.slice(1));\n    return memo;\n  }, []);\n};\n\n// Call @iter on each member of an array (similar to Array#reduce(iter))\n//    iter: function(memo, item, callback)\n// Call @done when all members have been processed or if an error occurs\n//    done: function(err, memo)\n// @memo: Initial value\n//\nutils.reduceAsync = function(arr, memo, iter, done) {\n  var call = typeof setImmediate == 'undefined' ? setTimeout : setImmediate;\n  var i=0;\n  next(null, memo);\n\n  function next(err, memo) {\n    // Detach next operation from call stack to prevent overflow\n    // Don't use setTimeout(, 0) if setImmediate is available\n    // (setTimeout() can introduce a long delay if previous operation was slow,\n    //    as of Node 0.10.32 -- a bug?)\n    if (err) {\n      return done(err, null);\n    }\n    call(function() {\n      if (i < arr.length === false) {\n        done(null, memo);\n      } else {\n        iter(memo, arr[i++], next);\n      }\n    }, 0);\n  }\n};\n\n// Handle information commands and remove them from the list\nMapShaper.runAndRemoveInfoCommands = function(commands) {\n  return commands.filter(function(cmd) {\n    if (cmd.name == 'version') {\n      message(MapShaper.VERSION);\n    } else if (cmd.name == 'encodings') {\n      MapShaper.printEncodings();\n    } else if (cmd.name == 'projections') {\n      MapShaper.printProjections();\n    } else if (cmd.name == 'help') {\n      MapShaper.getOptionParser().printHelp(cmd.options.commands);\n    } else if (cmd.name == 'verbose') {\n      MapShaper.VERBOSE = true;\n    } else if (cmd.name == 'tracing') {\n      MapShaper.TRACING = true;\n    } else {\n      return true;\n    }\n    return false;\n  });\n};\n\n\n\n\napi.cli = cli;\napi.internal = MapShaper;\napi.utils = utils;\napi.geom = geom;\nthis.mapshaper = api;\n\n// Expose internal objects for testing\nutils.extend(api.internal, {\n  DataTable: DataTable,\n  BinArray: BinArray,\n  DouglasPeucker: DouglasPeucker,\n  Visvalingam: Visvalingam,\n  Heap: Heap,\n  ShpReader: ShpReader,\n  ShpType: ShpType,\n  Dbf: Dbf,\n  DbfReader: DbfReader,\n  ShapefileTable: ShapefileTable,\n  ArcCollection: ArcCollection,\n  ArcIter: ArcIter,\n  ShapeIter: ShapeIter,\n  Bounds: Bounds,\n  Transform: Transform,\n  NodeCollection: NodeCollection,\n  PolygonIndex: PolygonIndex,\n  PathIndex: PathIndex,\n  topojson: TopoJSON,\n  geojson: GeoJSON,\n  svg: SVG,\n  APIError: APIError\n});\n\nif (typeof define === \"function\" && define.amd) {\n  define(\"mapshaper\", api);\n} else if (typeof module === \"object\" && module.exports) {\n  module.exports = api;\n}\n\n}());\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5,\"d3-dsv\":8,\"fs\":4,\"iconv-lite\":29,\"path\":34,\"rbush\":37,\"rw\":49}],2:[function(require,module,exports){\n'use strict'\n\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nfunction init () {\n  var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n  for (var i = 0, len = code.length; i < len; ++i) {\n    lookup[i] = code[i]\n    revLookup[code.charCodeAt(i)] = i\n  }\n\n  revLookup['-'.charCodeAt(0)] = 62\n  revLookup['_'.charCodeAt(0)] = 63\n}\n\ninit()\n\nfunction toByteArray (b64) {\n  var i, j, l, tmp, placeHolders, arr\n  var len = b64.length\n\n  if (len % 4 > 0) {\n    throw new Error('Invalid string. Length must be a multiple of 4')\n  }\n\n  // the number of equal signs (place holders)\n  // if there are two placeholders, than the two characters before it\n  // represent one byte\n  // if there is only one, then the three characters before it represent 2 bytes\n  // this is just a cheap hack to not do indexOf twice\n  placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0\n\n  // base64 is 4/3 + up to two characters of the original data\n  arr = new Arr(len * 3 / 4 - placeHolders)\n\n  // if there are placeholders, only get up to the last complete 4 chars\n  l = placeHolders > 0 ? len - 4 : len\n\n  var L = 0\n\n  for (i = 0, j = 0; i < l; i += 4, j += 3) {\n    tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]\n    arr[L++] = (tmp >> 16) & 0xFF\n    arr[L++] = (tmp >> 8) & 0xFF\n    arr[L++] = tmp & 0xFF\n  }\n\n  if (placeHolders === 2) {\n    tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)\n    arr[L++] = tmp & 0xFF\n  } else if (placeHolders === 1) {\n    tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)\n    arr[L++] = (tmp >> 8) & 0xFF\n    arr[L++] = tmp & 0xFF\n  }\n\n  return arr\n}\n\nfunction tripletToBase64 (num) {\n  return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n  var tmp\n  var output = []\n  for (var i = start; i < end; i += 3) {\n    tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])\n    output.push(tripletToBase64(tmp))\n  }\n  return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n  var tmp\n  var len = uint8.length\n  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n  var output = ''\n  var parts = []\n  var maxChunkLength = 16383 // must be multiple of 3\n\n  // go through the array every three bytes, we'll deal with trailing stuff later\n  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n    parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n  }\n\n  // pad the end with zeros, but make sure to not forget the extra bytes\n  if (extraBytes === 1) {\n    tmp = uint8[len - 1]\n    output += lookup[tmp >> 2]\n    output += lookup[(tmp << 4) & 0x3F]\n    output += '=='\n  } else if (extraBytes === 2) {\n    tmp = (uint8[len - 2] << 8) + (uint8[len - 1])\n    output += lookup[tmp >> 10]\n    output += lookup[(tmp >> 4) & 0x3F]\n    output += lookup[(tmp << 2) & 0x3F]\n    output += '='\n  }\n\n  parts.push(output)\n\n  return parts.join('')\n}\n\n},{}],3:[function(require,module,exports){\n\n},{}],4:[function(require,module,exports){\narguments[4][3][0].apply(exports,arguments)\n},{\"dup\":3}],5:[function(require,module,exports){\n(function (global){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license  MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n *   === true    Use Uint8Array implementation (fastest)\n *   === false   Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n *     incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n  ? global.TYPED_ARRAY_SUPPORT\n  : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n  try {\n    var arr = new Uint8Array(1)\n    arr.foo = function () { return 42 }\n    return arr.foo() === 42 && // typed array instances can be augmented\n        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n  } catch (e) {\n    return false\n  }\n}\n\nfunction kMaxLength () {\n  return Buffer.TYPED_ARRAY_SUPPORT\n    ? 0x7fffffff\n    : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n  if (kMaxLength() < length) {\n    throw new RangeError('Invalid typed array length')\n  }\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    that = new Uint8Array(length)\n    that.__proto__ = Buffer.prototype\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    if (that === null) {\n      that = new Buffer(length)\n    }\n    that.length = length\n  }\n\n  return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n  if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n    return new Buffer(arg, encodingOrOffset, length)\n  }\n\n  // Common case.\n  if (typeof arg === 'number') {\n    if (typeof encodingOrOffset === 'string') {\n      throw new Error(\n        'If encoding is specified then the first argument must be a string'\n      )\n    }\n    return allocUnsafe(this, arg)\n  }\n  return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n  arr.__proto__ = Buffer.prototype\n  return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n  if (typeof value === 'number') {\n    throw new TypeError('\"value\" argument must not be a number')\n  }\n\n  if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n    return fromArrayBuffer(that, value, encodingOrOffset, length)\n  }\n\n  if (typeof value === 'string') {\n    return fromString(that, value, encodingOrOffset)\n  }\n\n  return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n  return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n  Buffer.prototype.__proto__ = Uint8Array.prototype\n  Buffer.__proto__ = Uint8Array\n  if (typeof Symbol !== 'undefined' && Symbol.species &&\n      Buffer[Symbol.species] === Buffer) {\n    // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n    Object.defineProperty(Buffer, Symbol.species, {\n      value: null,\n      configurable: true\n    })\n  }\n}\n\nfunction assertSize (size) {\n  if (typeof size !== 'number') {\n    throw new TypeError('\"size\" argument must be a number')\n  }\n}\n\nfunction alloc (that, size, fill, encoding) {\n  assertSize(size)\n  if (size <= 0) {\n    return createBuffer(that, size)\n  }\n  if (fill !== undefined) {\n    // Only pay attention to encoding if it's a string. This\n    // prevents accidentally sending in a number that would\n    // be interpretted as a start offset.\n    return typeof encoding === 'string'\n      ? createBuffer(that, size).fill(fill, encoding)\n      : createBuffer(that, size).fill(fill)\n  }\n  return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n  return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n  assertSize(size)\n  that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) {\n    for (var i = 0; i < size; i++) {\n      that[i] = 0\n    }\n  }\n  return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n  return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n  return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n  if (typeof encoding !== 'string' || encoding === '') {\n    encoding = 'utf8'\n  }\n\n  if (!Buffer.isEncoding(encoding)) {\n    throw new TypeError('\"encoding\" must be a valid string encoding')\n  }\n\n  var length = byteLength(string, encoding) | 0\n  that = createBuffer(that, length)\n\n  that.write(string, encoding)\n  return that\n}\n\nfunction fromArrayLike (that, array) {\n  var length = checked(array.length) | 0\n  that = createBuffer(that, length)\n  for (var i = 0; i < length; i += 1) {\n    that[i] = array[i] & 255\n  }\n  return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n  array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n  if (byteOffset < 0 || array.byteLength < byteOffset) {\n    throw new RangeError('\\'offset\\' is out of bounds')\n  }\n\n  if (array.byteLength < byteOffset + (length || 0)) {\n    throw new RangeError('\\'length\\' is out of bounds')\n  }\n\n  if (length === undefined) {\n    array = new Uint8Array(array, byteOffset)\n  } else {\n    array = new Uint8Array(array, byteOffset, length)\n  }\n\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    // Return an augmented `Uint8Array` instance, for best performance\n    that = array\n    that.__proto__ = Buffer.prototype\n  } else {\n    // Fallback: Return an object instance of the Buffer class\n    that = fromArrayLike(that, array)\n  }\n  return that\n}\n\nfunction fromObject (that, obj) {\n  if (Buffer.isBuffer(obj)) {\n    var len = checked(obj.length) | 0\n    that = createBuffer(that, len)\n\n    if (that.length === 0) {\n      return that\n    }\n\n    obj.copy(that, 0, 0, len)\n    return that\n  }\n\n  if (obj) {\n    if ((typeof ArrayBuffer !== 'undefined' &&\n        obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n      if (typeof obj.length !== 'number' || isnan(obj.length)) {\n        return createBuffer(that, 0)\n      }\n      return fromArrayLike(that, obj)\n    }\n\n    if (obj.type === 'Buffer' && isArray(obj.data)) {\n      return fromArrayLike(that, obj.data)\n    }\n  }\n\n  throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n  // Note: cannot use `length < kMaxLength` here because that fails when\n  // length is NaN (which is otherwise coerced to zero.)\n  if (length >= kMaxLength()) {\n    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n                         'size: 0x' + kMaxLength().toString(16) + ' bytes')\n  }\n  return length | 0\n}\n\nfunction SlowBuffer (length) {\n  if (+length != length) { // eslint-disable-line eqeqeq\n    length = 0\n  }\n  return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n  return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n    throw new TypeError('Arguments must be Buffers')\n  }\n\n  if (a === b) return 0\n\n  var x = a.length\n  var y = b.length\n\n  for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n    if (a[i] !== b[i]) {\n      x = a[i]\n      y = b[i]\n      break\n    }\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n  switch (String(encoding).toLowerCase()) {\n    case 'hex':\n    case 'utf8':\n    case 'utf-8':\n    case 'ascii':\n    case 'binary':\n    case 'base64':\n    case 'raw':\n    case 'ucs2':\n    case 'ucs-2':\n    case 'utf16le':\n    case 'utf-16le':\n      return true\n    default:\n      return false\n  }\n}\n\nBuffer.concat = function concat (list, length) {\n  if (!isArray(list)) {\n    throw new TypeError('\"list\" argument must be an Array of Buffers')\n  }\n\n  if (list.length === 0) {\n    return Buffer.alloc(0)\n  }\n\n  var i\n  if (length === undefined) {\n    length = 0\n    for (i = 0; i < list.length; i++) {\n      length += list[i].length\n    }\n  }\n\n  var buffer = Buffer.allocUnsafe(length)\n  var pos = 0\n  for (i = 0; i < list.length; i++) {\n    var buf = list[i]\n    if (!Buffer.isBuffer(buf)) {\n      throw new TypeError('\"list\" argument must be an Array of Buffers')\n    }\n    buf.copy(buffer, pos)\n    pos += buf.length\n  }\n  return buffer\n}\n\nfunction byteLength (string, encoding) {\n  if (Buffer.isBuffer(string)) {\n    return string.length\n  }\n  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n      (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n    return string.byteLength\n  }\n  if (typeof string !== 'string') {\n    string = '' + string\n  }\n\n  var len = string.length\n  if (len === 0) return 0\n\n  // Use a for loop to avoid recursion\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'ascii':\n      case 'binary':\n      // Deprecated\n      case 'raw':\n      case 'raws':\n        return len\n      case 'utf8':\n      case 'utf-8':\n      case undefined:\n        return utf8ToBytes(string).length\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return len * 2\n      case 'hex':\n        return len >>> 1\n      case 'base64':\n        return base64ToBytes(string).length\n      default:\n        if (loweredCase) return utf8ToBytes(string).length // assume utf8\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n  var loweredCase = false\n\n  // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n  // property of a typed array.\n\n  // This behaves neither like String nor Uint8Array in that we set start/end\n  // to their upper/lower bounds if the value passed is out of range.\n  // undefined is handled specially as per ECMA-262 6th Edition,\n  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n  if (start === undefined || start < 0) {\n    start = 0\n  }\n  // Return early if start > this.length. Done here to prevent potential uint32\n  // coercion fail below.\n  if (start > this.length) {\n    return ''\n  }\n\n  if (end === undefined || end > this.length) {\n    end = this.length\n  }\n\n  if (end <= 0) {\n    return ''\n  }\n\n  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n  end >>>= 0\n  start >>>= 0\n\n  if (end <= start) {\n    return ''\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  while (true) {\n    switch (encoding) {\n      case 'hex':\n        return hexSlice(this, start, end)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Slice(this, start, end)\n\n      case 'ascii':\n        return asciiSlice(this, start, end)\n\n      case 'binary':\n        return binarySlice(this, start, end)\n\n      case 'base64':\n        return base64Slice(this, start, end)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return utf16leSlice(this, start, end)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = (encoding + '').toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n  var i = b[n]\n  b[n] = b[m]\n  b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n  var len = this.length\n  if (len % 2 !== 0) {\n    throw new RangeError('Buffer size must be a multiple of 16-bits')\n  }\n  for (var i = 0; i < len; i += 2) {\n    swap(this, i, i + 1)\n  }\n  return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n  var len = this.length\n  if (len % 4 !== 0) {\n    throw new RangeError('Buffer size must be a multiple of 32-bits')\n  }\n  for (var i = 0; i < len; i += 4) {\n    swap(this, i, i + 3)\n    swap(this, i + 1, i + 2)\n  }\n  return this\n}\n\nBuffer.prototype.toString = function toString () {\n  var length = this.length | 0\n  if (length === 0) return ''\n  if (arguments.length === 0) return utf8Slice(this, 0, length)\n  return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n  if (this === b) return true\n  return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n  var str = ''\n  var max = exports.INSPECT_MAX_BYTES\n  if (this.length > 0) {\n    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n    if (this.length > max) str += ' ... '\n  }\n  return '<Buffer ' + str + '>'\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n  if (!Buffer.isBuffer(target)) {\n    throw new TypeError('Argument must be a Buffer')\n  }\n\n  if (start === undefined) {\n    start = 0\n  }\n  if (end === undefined) {\n    end = target ? target.length : 0\n  }\n  if (thisStart === undefined) {\n    thisStart = 0\n  }\n  if (thisEnd === undefined) {\n    thisEnd = this.length\n  }\n\n  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n    throw new RangeError('out of range index')\n  }\n\n  if (thisStart >= thisEnd && start >= end) {\n    return 0\n  }\n  if (thisStart >= thisEnd) {\n    return -1\n  }\n  if (start >= end) {\n    return 1\n  }\n\n  start >>>= 0\n  end >>>= 0\n  thisStart >>>= 0\n  thisEnd >>>= 0\n\n  if (this === target) return 0\n\n  var x = thisEnd - thisStart\n  var y = end - start\n  var len = Math.min(x, y)\n\n  var thisCopy = this.slice(thisStart, thisEnd)\n  var targetCopy = target.slice(start, end)\n\n  for (var i = 0; i < len; ++i) {\n    if (thisCopy[i] !== targetCopy[i]) {\n      x = thisCopy[i]\n      y = targetCopy[i]\n      break\n    }\n  }\n\n  if (x < y) return -1\n  if (y < x) return 1\n  return 0\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding) {\n  var indexSize = 1\n  var arrLength = arr.length\n  var valLength = val.length\n\n  if (encoding !== undefined) {\n    encoding = String(encoding).toLowerCase()\n    if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n        encoding === 'utf16le' || encoding === 'utf-16le') {\n      if (arr.length < 2 || val.length < 2) {\n        return -1\n      }\n      indexSize = 2\n      arrLength /= 2\n      valLength /= 2\n      byteOffset /= 2\n    }\n  }\n\n  function read (buf, i) {\n    if (indexSize === 1) {\n      return buf[i]\n    } else {\n      return buf.readUInt16BE(i * indexSize)\n    }\n  }\n\n  var foundIndex = -1\n  for (var i = 0; byteOffset + i < arrLength; i++) {\n    if (read(arr, byteOffset + i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n      if (foundIndex === -1) foundIndex = i\n      if (i - foundIndex + 1 === valLength) return (byteOffset + foundIndex) * indexSize\n    } else {\n      if (foundIndex !== -1) i -= i - foundIndex\n      foundIndex = -1\n    }\n  }\n  return -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n  if (typeof byteOffset === 'string') {\n    encoding = byteOffset\n    byteOffset = 0\n  } else if (byteOffset > 0x7fffffff) {\n    byteOffset = 0x7fffffff\n  } else if (byteOffset < -0x80000000) {\n    byteOffset = -0x80000000\n  }\n  byteOffset >>= 0\n\n  if (this.length === 0) return -1\n  if (byteOffset >= this.length) return -1\n\n  // Negative offsets start from the end of the buffer\n  if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n  if (typeof val === 'string') {\n    val = Buffer.from(val, encoding)\n  }\n\n  if (Buffer.isBuffer(val)) {\n    // special case: looking for empty string/buffer always fails\n    if (val.length === 0) {\n      return -1\n    }\n    return arrayIndexOf(this, val, byteOffset, encoding)\n  }\n  if (typeof val === 'number') {\n    if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {\n      return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n    }\n    return arrayIndexOf(this, [ val ], byteOffset, encoding)\n  }\n\n  throw new TypeError('val must be string, number or Buffer')\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n  return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nfunction hexWrite (buf, string, offset, length) {\n  offset = Number(offset) || 0\n  var remaining = buf.length - offset\n  if (!length) {\n    length = remaining\n  } else {\n    length = Number(length)\n    if (length > remaining) {\n      length = remaining\n    }\n  }\n\n  // must be an even number of digits\n  var strLen = string.length\n  if (strLen % 2 !== 0) throw new Error('Invalid hex string')\n\n  if (length > strLen / 2) {\n    length = strLen / 2\n  }\n  for (var i = 0; i < length; i++) {\n    var parsed = parseInt(string.substr(i * 2, 2), 16)\n    if (isNaN(parsed)) return i\n    buf[offset + i] = parsed\n  }\n  return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n  return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction binaryWrite (buf, string, offset, length) {\n  return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n  return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n  // Buffer#write(string)\n  if (offset === undefined) {\n    encoding = 'utf8'\n    length = this.length\n    offset = 0\n  // Buffer#write(string, encoding)\n  } else if (length === undefined && typeof offset === 'string') {\n    encoding = offset\n    length = this.length\n    offset = 0\n  // Buffer#write(string, offset[, length][, encoding])\n  } else if (isFinite(offset)) {\n    offset = offset | 0\n    if (isFinite(length)) {\n      length = length | 0\n      if (encoding === undefined) encoding = 'utf8'\n    } else {\n      encoding = length\n      length = undefined\n    }\n  // legacy write(string, encoding, offset, length) - remove in v0.13\n  } else {\n    throw new Error(\n      'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n    )\n  }\n\n  var remaining = this.length - offset\n  if (length === undefined || length > remaining) length = remaining\n\n  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n    throw new RangeError('Attempt to write outside buffer bounds')\n  }\n\n  if (!encoding) encoding = 'utf8'\n\n  var loweredCase = false\n  for (;;) {\n    switch (encoding) {\n      case 'hex':\n        return hexWrite(this, string, offset, length)\n\n      case 'utf8':\n      case 'utf-8':\n        return utf8Write(this, string, offset, length)\n\n      case 'ascii':\n        return asciiWrite(this, string, offset, length)\n\n      case 'binary':\n        return binaryWrite(this, string, offset, length)\n\n      case 'base64':\n        // Warning: maxLength not taken into account in base64Write\n        return base64Write(this, string, offset, length)\n\n      case 'ucs2':\n      case 'ucs-2':\n      case 'utf16le':\n      case 'utf-16le':\n        return ucs2Write(this, string, offset, length)\n\n      default:\n        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n        encoding = ('' + encoding).toLowerCase()\n        loweredCase = true\n    }\n  }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n  return {\n    type: 'Buffer',\n    data: Array.prototype.slice.call(this._arr || this, 0)\n  }\n}\n\nfunction base64Slice (buf, start, end) {\n  if (start === 0 && end === buf.length) {\n    return base64.fromByteArray(buf)\n  } else {\n    return base64.fromByteArray(buf.slice(start, end))\n  }\n}\n\nfunction utf8Slice (buf, start, end) {\n  end = Math.min(buf.length, end)\n  var res = []\n\n  var i = start\n  while (i < end) {\n    var firstByte = buf[i]\n    var codePoint = null\n    var bytesPerSequence = (firstByte > 0xEF) ? 4\n      : (firstByte > 0xDF) ? 3\n      : (firstByte > 0xBF) ? 2\n      : 1\n\n    if (i + bytesPerSequence <= end) {\n      var secondByte, thirdByte, fourthByte, tempCodePoint\n\n      switch (bytesPerSequence) {\n        case 1:\n          if (firstByte < 0x80) {\n            codePoint = firstByte\n          }\n          break\n        case 2:\n          secondByte = buf[i + 1]\n          if ((secondByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n            if (tempCodePoint > 0x7F) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 3:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n              codePoint = tempCodePoint\n            }\n          }\n          break\n        case 4:\n          secondByte = buf[i + 1]\n          thirdByte = buf[i + 2]\n          fourthByte = buf[i + 3]\n          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n              codePoint = tempCodePoint\n            }\n          }\n      }\n    }\n\n    if (codePoint === null) {\n      // we did not generate a valid codePoint so insert a\n      // replacement char (U+FFFD) and advance only 1 byte\n      codePoint = 0xFFFD\n      bytesPerSequence = 1\n    } else if (codePoint > 0xFFFF) {\n      // encode to utf16 (surrogate pair dance)\n      codePoint -= 0x10000\n      res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n      codePoint = 0xDC00 | codePoint & 0x3FF\n    }\n\n    res.push(codePoint)\n    i += bytesPerSequence\n  }\n\n  return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n  var len = codePoints.length\n  if (len <= MAX_ARGUMENTS_LENGTH) {\n    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n  }\n\n  // Decode in chunks to avoid \"call stack size exceeded\".\n  var res = ''\n  var i = 0\n  while (i < len) {\n    res += String.fromCharCode.apply(\n      String,\n      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n    )\n  }\n  return res\n}\n\nfunction asciiSlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i] & 0x7F)\n  }\n  return ret\n}\n\nfunction binarySlice (buf, start, end) {\n  var ret = ''\n  end = Math.min(buf.length, end)\n\n  for (var i = start; i < end; i++) {\n    ret += String.fromCharCode(buf[i])\n  }\n  return ret\n}\n\nfunction hexSlice (buf, start, end) {\n  var len = buf.length\n\n  if (!start || start < 0) start = 0\n  if (!end || end < 0 || end > len) end = len\n\n  var out = ''\n  for (var i = start; i < end; i++) {\n    out += toHex(buf[i])\n  }\n  return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n  var bytes = buf.slice(start, end)\n  var res = ''\n  for (var i = 0; i < bytes.length; i += 2) {\n    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n  }\n  return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n  var len = this.length\n  start = ~~start\n  end = end === undefined ? len : ~~end\n\n  if (start < 0) {\n    start += len\n    if (start < 0) start = 0\n  } else if (start > len) {\n    start = len\n  }\n\n  if (end < 0) {\n    end += len\n    if (end < 0) end = 0\n  } else if (end > len) {\n    end = len\n  }\n\n  if (end < start) end = start\n\n  var newBuf\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    newBuf = this.subarray(start, end)\n    newBuf.__proto__ = Buffer.prototype\n  } else {\n    var sliceLen = end - start\n    newBuf = new Buffer(sliceLen, undefined)\n    for (var i = 0; i < sliceLen; i++) {\n      newBuf[i] = this[i + start]\n    }\n  }\n\n  return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    checkOffset(offset, byteLength, this.length)\n  }\n\n  var val = this[offset + --byteLength]\n  var mul = 1\n  while (byteLength > 0 && (mul *= 0x100)) {\n    val += this[offset + --byteLength] * mul\n  }\n\n  return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return ((this[offset]) |\n      (this[offset + 1] << 8) |\n      (this[offset + 2] << 16)) +\n      (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] * 0x1000000) +\n    ((this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var val = this[offset]\n  var mul = 1\n  var i = 0\n  while (++i < byteLength && (mul *= 0x100)) {\n    val += this[offset + i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n  var i = byteLength\n  var mul = 1\n  var val = this[offset + --i]\n  while (i > 0 && (mul *= 0x100)) {\n    val += this[offset + --i] * mul\n  }\n  mul *= 0x80\n\n  if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n  return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 1, this.length)\n  if (!(this[offset] & 0x80)) return (this[offset])\n  return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset] | (this[offset + 1] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 2, this.length)\n  var val = this[offset + 1] | (this[offset] << 8)\n  return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset]) |\n    (this[offset + 1] << 8) |\n    (this[offset + 2] << 16) |\n    (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n\n  return (this[offset] << 24) |\n    (this[offset + 1] << 16) |\n    (this[offset + 2] << 8) |\n    (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 4, this.length)\n  return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n  if (!noAssert) checkOffset(offset, 8, this.length)\n  return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n  if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n  if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n  if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    var maxBytes = Math.pow(2, 8 * byteLength) - 1\n    checkInt(this, value, offset, byteLength, maxBytes, 0)\n  }\n\n  var mul = 1\n  var i = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  byteLength = byteLength | 0\n  if (!noAssert) {\n    var maxBytes = Math.pow(2, 8 * byteLength) - 1\n    checkInt(this, value, offset, byteLength, maxBytes, 0)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    this[offset + i] = (value / mul) & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n      (littleEndian ? i : 1 - i) * 8\n  }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n  if (value < 0) value = 0xffffffff + value + 1\n  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n  }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset + 3] = (value >>> 24)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 1] = (value >>> 8)\n    this[offset] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = 0\n  var mul = 1\n  var sub = 0\n  this[offset] = value & 0xFF\n  while (++i < byteLength && (mul *= 0x100)) {\n    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n      sub = 1\n    }\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) {\n    var limit = Math.pow(2, 8 * byteLength - 1)\n\n    checkInt(this, value, offset, byteLength, limit - 1, -limit)\n  }\n\n  var i = byteLength - 1\n  var mul = 1\n  var sub = 0\n  this[offset + i] = value & 0xFF\n  while (--i >= 0 && (mul *= 0x100)) {\n    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n      sub = 1\n    }\n    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n  }\n\n  return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n  if (value < 0) value = 0xff + value + 1\n  this[offset] = (value & 0xff)\n  return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n  } else {\n    objectWriteUInt16(this, value, offset, true)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 8)\n    this[offset + 1] = (value & 0xff)\n  } else {\n    objectWriteUInt16(this, value, offset, false)\n  }\n  return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value & 0xff)\n    this[offset + 1] = (value >>> 8)\n    this[offset + 2] = (value >>> 16)\n    this[offset + 3] = (value >>> 24)\n  } else {\n    objectWriteUInt32(this, value, offset, true)\n  }\n  return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n  value = +value\n  offset = offset | 0\n  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n  if (value < 0) value = 0xffffffff + value + 1\n  if (Buffer.TYPED_ARRAY_SUPPORT) {\n    this[offset] = (value >>> 24)\n    this[offset + 1] = (value >>> 16)\n    this[offset + 2] = (value >>> 8)\n    this[offset + 3] = (value & 0xff)\n  } else {\n    objectWriteUInt32(this, value, offset, false)\n  }\n  return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n  if (offset + ext > buf.length) throw new RangeError('Index out of range')\n  if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 23, 4)\n  return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n  return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n  if (!noAssert) {\n    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n  }\n  ieee754.write(buf, value, offset, littleEndian, 52, 8)\n  return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n  return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n  if (!start) start = 0\n  if (!end && end !== 0) end = this.length\n  if (targetStart >= target.length) targetStart = target.length\n  if (!targetStart) targetStart = 0\n  if (end > 0 && end < start) end = start\n\n  // Copy 0 bytes; we're done\n  if (end === start) return 0\n  if (target.length === 0 || this.length === 0) return 0\n\n  // Fatal error conditions\n  if (targetStart < 0) {\n    throw new RangeError('targetStart out of bounds')\n  }\n  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n  if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n  // Are we oob?\n  if (end > this.length) end = this.length\n  if (target.length - targetStart < end - start) {\n    end = target.length - targetStart + start\n  }\n\n  var len = end - start\n  var i\n\n  if (this === target && start < targetStart && targetStart < end) {\n    // descending copy from end\n    for (i = len - 1; i >= 0; i--) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n    // ascending copy from start\n    for (i = 0; i < len; i++) {\n      target[i + targetStart] = this[i + start]\n    }\n  } else {\n    Uint8Array.prototype.set.call(\n      target,\n      this.subarray(start, start + len),\n      targetStart\n    )\n  }\n\n  return len\n}\n\n// Usage:\n//    buffer.fill(number[, offset[, end]])\n//    buffer.fill(buffer[, offset[, end]])\n//    buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n  // Handle string cases:\n  if (typeof val === 'string') {\n    if (typeof start === 'string') {\n      encoding = start\n      start = 0\n      end = this.length\n    } else if (typeof end === 'string') {\n      encoding = end\n      end = this.length\n    }\n    if (val.length === 1) {\n      var code = val.charCodeAt(0)\n      if (code < 256) {\n        val = code\n      }\n    }\n    if (encoding !== undefined && typeof encoding !== 'string') {\n      throw new TypeError('encoding must be a string')\n    }\n    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n      throw new TypeError('Unknown encoding: ' + encoding)\n    }\n  } else if (typeof val === 'number') {\n    val = val & 255\n  }\n\n  // Invalid ranges are not set to a default, so can range check early.\n  if (start < 0 || this.length < start || this.length < end) {\n    throw new RangeError('Out of range index')\n  }\n\n  if (end <= start) {\n    return this\n  }\n\n  start = start >>> 0\n  end = end === undefined ? this.length : end >>> 0\n\n  if (!val) val = 0\n\n  var i\n  if (typeof val === 'number') {\n    for (i = start; i < end; i++) {\n      this[i] = val\n    }\n  } else {\n    var bytes = Buffer.isBuffer(val)\n      ? val\n      : utf8ToBytes(new Buffer(val, encoding).toString())\n    var len = bytes.length\n    for (i = 0; i < end - start; i++) {\n      this[i + start] = bytes[i % len]\n    }\n  }\n\n  return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n  // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n  str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n  // Node converts strings with length < 2 to ''\n  if (str.length < 2) return ''\n  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n  while (str.length % 4 !== 0) {\n    str = str + '='\n  }\n  return str\n}\n\nfunction stringtrim (str) {\n  if (str.trim) return str.trim()\n  return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n  if (n < 16) return '0' + n.toString(16)\n  return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n  units = units || Infinity\n  var codePoint\n  var length = string.length\n  var leadSurrogate = null\n  var bytes = []\n\n  for (var i = 0; i < length; i++) {\n    codePoint = string.charCodeAt(i)\n\n    // is surrogate component\n    if (codePoint > 0xD7FF && codePoint < 0xE000) {\n      // last char was a lead\n      if (!leadSurrogate) {\n        // no lead yet\n        if (codePoint > 0xDBFF) {\n          // unexpected trail\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        } else if (i + 1 === length) {\n          // unpaired lead\n          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n          continue\n        }\n\n        // valid lead\n        leadSurrogate = codePoint\n\n        continue\n      }\n\n      // 2 leads in a row\n      if (codePoint < 0xDC00) {\n        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n        leadSurrogate = codePoint\n        continue\n      }\n\n      // valid surrogate pair\n      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n    } else if (leadSurrogate) {\n      // valid bmp char, but last char was a lead\n      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n    }\n\n    leadSurrogate = null\n\n    // encode utf8\n    if (codePoint < 0x80) {\n      if ((units -= 1) < 0) break\n      bytes.push(codePoint)\n    } else if (codePoint < 0x800) {\n      if ((units -= 2) < 0) break\n      bytes.push(\n        codePoint >> 0x6 | 0xC0,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x10000) {\n      if ((units -= 3) < 0) break\n      bytes.push(\n        codePoint >> 0xC | 0xE0,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else if (codePoint < 0x110000) {\n      if ((units -= 4) < 0) break\n      bytes.push(\n        codePoint >> 0x12 | 0xF0,\n        codePoint >> 0xC & 0x3F | 0x80,\n        codePoint >> 0x6 & 0x3F | 0x80,\n        codePoint & 0x3F | 0x80\n      )\n    } else {\n      throw new Error('Invalid code point')\n    }\n  }\n\n  return bytes\n}\n\nfunction asciiToBytes (str) {\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    // Node's code seems to be doing this and not & 0x7F..\n    byteArray.push(str.charCodeAt(i) & 0xFF)\n  }\n  return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n  var c, hi, lo\n  var byteArray = []\n  for (var i = 0; i < str.length; i++) {\n    if ((units -= 2) < 0) break\n\n    c = str.charCodeAt(i)\n    hi = c >> 8\n    lo = c % 256\n    byteArray.push(lo)\n    byteArray.push(hi)\n  }\n\n  return byteArray\n}\n\nfunction base64ToBytes (str) {\n  return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n  for (var i = 0; i < length; i++) {\n    if ((i + offset >= dst.length) || (i >= src.length)) break\n    dst[i + offset] = src[i]\n  }\n  return i\n}\n\nfunction isnan (val) {\n  return val !== val // eslint-disable-line no-self-compare\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"base64-js\":2,\"ieee754\":31,\"isarray\":6}],6:[function(require,module,exports){\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n  return toString.call(arr) == '[object Array]';\n};\n\n},{}],7:[function(require,module,exports){\n(function (Buffer){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n  if (Array.isArray) {\n    return Array.isArray(arg);\n  }\n  return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n  return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n  return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n  return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n  return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n  return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n  return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n  return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n  return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n  return arg === null ||\n         typeof arg === 'boolean' ||\n         typeof arg === 'number' ||\n         typeof arg === 'string' ||\n         typeof arg === 'symbol' ||  // ES6 symbol\n         typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n  return Object.prototype.toString.call(o);\n}\n\n}).call(this,{\"isBuffer\":require(\"../../is-buffer/index.js\")})\n},{\"../../is-buffer/index.js\":33}],8:[function(require,module,exports){\n(function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n  typeof define === 'function' && define.amd ? define(['exports'], factory) :\n  (factory((global.d3_dsv = global.d3_dsv || {})));\n}(this, function (exports) { 'use strict';\n\n  var version = \"0.3.2\";\n\n  function objectConverter(columns) {\n    return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n      return JSON.stringify(name) + \": d[\" + i + \"]\";\n    }).join(\",\") + \"}\");\n  }\n\n  function customConverter(columns, f) {\n    var object = objectConverter(columns);\n    return function(row, i) {\n      return f(object(row), i, columns);\n    };\n  }\n\n  // Compute unique columns in order of discovery.\n  function inferColumns(rows) {\n    var columnSet = Object.create(null),\n        columns = [];\n\n    rows.forEach(function(row) {\n      for (var column in row) {\n        if (!(column in columnSet)) {\n          columns.push(columnSet[column] = column);\n        }\n      }\n    });\n\n    return columns;\n  }\n\n  function dsv(delimiter) {\n    var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n]\"),\n        delimiterCode = delimiter.charCodeAt(0);\n\n    function parse(text, f) {\n      var convert, columns, rows = parseRows(text, function(row, i) {\n        if (convert) return convert(row, i - 1);\n        columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n      });\n      rows.columns = columns;\n      return rows;\n    }\n\n    function parseRows(text, f) {\n      var EOL = {}, // sentinel value for end-of-line\n          EOF = {}, // sentinel value for end-of-file\n          rows = [], // output rows\n          N = text.length,\n          I = 0, // current character index\n          n = 0, // the current line number\n          t, // the current token\n          eol; // is the current token followed by EOL?\n\n      function token() {\n        if (I >= N) return EOF; // special case: end of file\n        if (eol) return eol = false, EOL; // special case: end of line\n\n        // special case: quotes\n        var j = I, c;\n        if (text.charCodeAt(j) === 34) {\n          var i = j;\n          while (i++ < N) {\n            if (text.charCodeAt(i) === 34) {\n              if (text.charCodeAt(i + 1) !== 34) break;\n              ++i;\n            }\n          }\n          I = i + 2;\n          c = text.charCodeAt(i + 1);\n          if (c === 13) {\n            eol = true;\n            if (text.charCodeAt(i + 2) === 10) ++I;\n          } else if (c === 10) {\n            eol = true;\n          }\n          return text.slice(j + 1, i).replace(/\"\"/g, \"\\\"\");\n        }\n\n        // common case: find next delimiter or newline\n        while (I < N) {\n          var k = 1;\n          c = text.charCodeAt(I++);\n          if (c === 10) eol = true; // \\n\n          else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \\r|\\r\\n\n          else if (c !== delimiterCode) continue;\n          return text.slice(j, I - k);\n        }\n\n        // special case: last token before EOF\n        return text.slice(j);\n      }\n\n      while ((t = token()) !== EOF) {\n        var a = [];\n        while (t !== EOL && t !== EOF) {\n          a.push(t);\n          t = token();\n        }\n        if (f && (a = f(a, n++)) == null) continue;\n        rows.push(a);\n      }\n\n      return rows;\n    }\n\n    function format(rows, columns) {\n      if (columns == null) columns = inferColumns(rows);\n      return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n        return columns.map(function(column) {\n          return formatValue(row[column]);\n        }).join(delimiter);\n      })).join(\"\\n\");\n    }\n\n    function formatRows(rows) {\n      return rows.map(formatRow).join(\"\\n\");\n    }\n\n    function formatRow(row) {\n      return row.map(formatValue).join(delimiter);\n    }\n\n    function formatValue(text) {\n      return text == null ? \"\"\n          : reFormat.test(text += \"\") ? \"\\\"\" + text.replace(/\\\"/g, \"\\\"\\\"\") + \"\\\"\"\n          : text;\n    }\n\n    return {\n      parse: parse,\n      parseRows: parseRows,\n      format: format,\n      formatRows: formatRows\n    };\n  }\n\n  var csv = dsv(\",\");\n\n  var csvParse = csv.parse;\n  var csvParseRows = csv.parseRows;\n  var csvFormat = csv.format;\n  var csvFormatRows = csv.formatRows;\n\n  var tsv = dsv(\"\\t\");\n\n  var tsvParse = tsv.parse;\n  var tsvParseRows = tsv.parseRows;\n  var tsvFormat = tsv.format;\n  var tsvFormatRows = tsv.formatRows;\n\n  exports.version = version;\n  exports.dsvFormat = dsv;\n  exports.csvParse = csvParse;\n  exports.csvParseRows = csvParseRows;\n  exports.csvFormat = csvFormat;\n  exports.csvFormatRows = csvFormatRows;\n  exports.tsvParse = tsvParse;\n  exports.tsvParseRows = tsvParseRows;\n  exports.tsvFormat = tsvFormat;\n  exports.tsvFormatRows = tsvFormatRows;\n\n}));\n},{}],9:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n  this._events = this._events || {};\n  this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n  if (!isNumber(n) || n < 0 || isNaN(n))\n    throw TypeError('n must be a positive number');\n  this._maxListeners = n;\n  return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n  var er, handler, len, args, i, listeners;\n\n  if (!this._events)\n    this._events = {};\n\n  // If there is no 'error' event listener then throw.\n  if (type === 'error') {\n    if (!this._events.error ||\n        (isObject(this._events.error) && !this._events.error.length)) {\n      er = arguments[1];\n      if (er instanceof Error) {\n        throw er; // Unhandled 'error' event\n      }\n      throw TypeError('Uncaught, unspecified \"error\" event.');\n    }\n  }\n\n  handler = this._events[type];\n\n  if (isUndefined(handler))\n    return false;\n\n  if (isFunction(handler)) {\n    switch (arguments.length) {\n      // fast cases\n      case 1:\n        handler.call(this);\n        break;\n      case 2:\n        handler.call(this, arguments[1]);\n        break;\n      case 3:\n        handler.call(this, arguments[1], arguments[2]);\n        break;\n      // slower\n      default:\n        args = Array.prototype.slice.call(arguments, 1);\n        handler.apply(this, args);\n    }\n  } else if (isObject(handler)) {\n    args = Array.prototype.slice.call(arguments, 1);\n    listeners = handler.slice();\n    len = listeners.length;\n    for (i = 0; i < len; i++)\n      listeners[i].apply(this, args);\n  }\n\n  return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n  var m;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events)\n    this._events = {};\n\n  // To avoid recursion in the case that type === \"newListener\"! Before\n  // adding it to the listeners, first emit \"newListener\".\n  if (this._events.newListener)\n    this.emit('newListener', type,\n              isFunction(listener.listener) ?\n              listener.listener : listener);\n\n  if (!this._events[type])\n    // Optimize the case of one listener. Don't need the extra array object.\n    this._events[type] = listener;\n  else if (isObject(this._events[type]))\n    // If we've already got an array, just append.\n    this._events[type].push(listener);\n  else\n    // Adding the second element, need to change to array.\n    this._events[type] = [this._events[type], listener];\n\n  // Check for listener leak\n  if (isObject(this._events[type]) && !this._events[type].warned) {\n    if (!isUndefined(this._maxListeners)) {\n      m = this._maxListeners;\n    } else {\n      m = EventEmitter.defaultMaxListeners;\n    }\n\n    if (m && m > 0 && this._events[type].length > m) {\n      this._events[type].warned = true;\n      console.error('(node) warning: possible EventEmitter memory ' +\n                    'leak detected. %d listeners added. ' +\n                    'Use emitter.setMaxListeners() to increase limit.',\n                    this._events[type].length);\n      if (typeof console.trace === 'function') {\n        // not supported in IE 10\n        console.trace();\n      }\n    }\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  var fired = false;\n\n  function g() {\n    this.removeListener(type, g);\n\n    if (!fired) {\n      fired = true;\n      listener.apply(this, arguments);\n    }\n  }\n\n  g.listener = listener;\n  this.on(type, g);\n\n  return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n  var list, position, length, i;\n\n  if (!isFunction(listener))\n    throw TypeError('listener must be a function');\n\n  if (!this._events || !this._events[type])\n    return this;\n\n  list = this._events[type];\n  length = list.length;\n  position = -1;\n\n  if (list === listener ||\n      (isFunction(list.listener) && list.listener === listener)) {\n    delete this._events[type];\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n\n  } else if (isObject(list)) {\n    for (i = length; i-- > 0;) {\n      if (list[i] === listener ||\n          (list[i].listener && list[i].listener === listener)) {\n        position = i;\n        break;\n      }\n    }\n\n    if (position < 0)\n      return this;\n\n    if (list.length === 1) {\n      list.length = 0;\n      delete this._events[type];\n    } else {\n      list.splice(position, 1);\n    }\n\n    if (this._events.removeListener)\n      this.emit('removeListener', type, listener);\n  }\n\n  return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n  var key, listeners;\n\n  if (!this._events)\n    return this;\n\n  // not listening for removeListener, no need to emit\n  if (!this._events.removeListener) {\n    if (arguments.length === 0)\n      this._events = {};\n    else if (this._events[type])\n      delete this._events[type];\n    return this;\n  }\n\n  // emit removeListener for all listeners on all events\n  if (arguments.length === 0) {\n    for (key in this._events) {\n      if (key === 'removeListener') continue;\n      this.removeAllListeners(key);\n    }\n    this.removeAllListeners('removeListener');\n    this._events = {};\n    return this;\n  }\n\n  listeners = this._events[type];\n\n  if (isFunction(listeners)) {\n    this.removeListener(type, listeners);\n  } else if (listeners) {\n    // LIFO order\n    while (listeners.length)\n      this.removeListener(type, listeners[listeners.length - 1]);\n  }\n  delete this._events[type];\n\n  return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n  var ret;\n  if (!this._events || !this._events[type])\n    ret = [];\n  else if (isFunction(this._events[type]))\n    ret = [this._events[type]];\n  else\n    ret = this._events[type].slice();\n  return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n  if (this._events) {\n    var evlistener = this._events[type];\n\n    if (isFunction(evlistener))\n      return 1;\n    else if (evlistener)\n      return evlistener.length;\n  }\n  return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n  return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n  return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n  return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n  return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n  return arg === void 0;\n}\n\n},{}],10:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\n// Multibyte codec. In this scheme, a character is represented by 1 or more bytes.\n// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences.\n// To save memory and loading time, we read table files only when requested.\n\nexports._dbcs = DBCSCodec;\n\nvar UNASSIGNED = -1,\n    GB18030_CODE = -2,\n    SEQ_START  = -10,\n    NODE_START = -1000,\n    UNASSIGNED_NODE = new Array(0x100),\n    DEF_CHAR = -1;\n\nfor (var i = 0; i < 0x100; i++)\n    UNASSIGNED_NODE[i] = UNASSIGNED;\n\n\n// Class DBCSCodec reads and initializes mapping tables.\nfunction DBCSCodec(codecOptions, iconv) {\n    this.encodingName = codecOptions.encodingName;\n    if (!codecOptions)\n        throw new Error(\"DBCS codec is called without the data.\")\n    if (!codecOptions.table)\n        throw new Error(\"Encoding '\" + this.encodingName + \"' has no data.\");\n\n    // Load tables.\n    var mappingTable = codecOptions.table();\n\n\n    // Decode tables: MBCS -> Unicode.\n\n    // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256.\n    // Trie root is decodeTables[0].\n    // Values: >=  0 -> unicode character code. can be > 0xFFFF\n    //         == UNASSIGNED -> unknown/unassigned sequence.\n    //         == GB18030_CODE -> this is the end of a GB18030 4-byte sequence.\n    //         <= NODE_START -> index of the next node in our trie to process next byte.\n    //         <= SEQ_START  -> index of the start of a character code sequence, in decodeTableSeq.\n    this.decodeTables = [];\n    this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.\n\n    // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. \n    this.decodeTableSeq = [];\n\n    // Actual mapping tables consist of chunks. Use them to fill up decode tables.\n    for (var i = 0; i < mappingTable.length; i++)\n        this._addDecodeChunk(mappingTable[i]);\n\n    this.defaultCharUnicode = iconv.defaultCharUnicode;\n\n    \n    // Encode tables: Unicode -> DBCS.\n\n    // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance.\n    // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null.\n    // Values: >=  0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.).\n    //         == UNASSIGNED -> no conversion found. Output a default char.\n    //         <= SEQ_START  -> it's an index in encodeTableSeq, see below. The character starts a sequence.\n    this.encodeTable = [];\n    \n    // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of\n    // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key\n    // means end of sequence (needed when one sequence is a strict subsequence of another).\n    // Objects are kept separately from encodeTable to increase performance.\n    this.encodeTableSeq = [];\n\n    // Some chars can be decoded, but need not be encoded.\n    var skipEncodeChars = {};\n    if (codecOptions.encodeSkipVals)\n        for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {\n            var val = codecOptions.encodeSkipVals[i];\n            if (typeof val === 'number')\n                skipEncodeChars[val] = true;\n            else\n                for (var j = val.from; j <= val.to; j++)\n                    skipEncodeChars[j] = true;\n        }\n        \n    // Use decode trie to recursively fill out encode tables.\n    this._fillEncodeTable(0, 0, skipEncodeChars);\n\n    // Add more encoding pairs when needed.\n    if (codecOptions.encodeAdd) {\n        for (var uChar in codecOptions.encodeAdd)\n            if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))\n                this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);\n    }\n\n    this.defCharSB  = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];\n    if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?'];\n    if (this.defCharSB === UNASSIGNED) this.defCharSB = \"?\".charCodeAt(0);\n\n\n    // Load & create GB18030 tables when needed.\n    if (typeof codecOptions.gb18030 === 'function') {\n        this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges.\n\n        // Add GB18030 decode tables.\n        var thirdByteNodeIdx = this.decodeTables.length;\n        var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0);\n\n        var fourthByteNodeIdx = this.decodeTables.length;\n        var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0);\n\n        for (var i = 0x81; i <= 0xFE; i++) {\n            var secondByteNodeIdx = NODE_START - this.decodeTables[0][i];\n            var secondByteNode = this.decodeTables[secondByteNodeIdx];\n            for (var j = 0x30; j <= 0x39; j++)\n                secondByteNode[j] = NODE_START - thirdByteNodeIdx;\n        }\n        for (var i = 0x81; i <= 0xFE; i++)\n            thirdByteNode[i] = NODE_START - fourthByteNodeIdx;\n        for (var i = 0x30; i <= 0x39; i++)\n            fourthByteNode[i] = GB18030_CODE\n    }        \n}\n\nDBCSCodec.prototype.encoder = DBCSEncoder;\nDBCSCodec.prototype.decoder = DBCSDecoder;\n\n// Decoder helpers\nDBCSCodec.prototype._getDecodeTrieNode = function(addr) {\n    var bytes = [];\n    for (; addr > 0; addr >>= 8)\n        bytes.push(addr & 0xFF);\n    if (bytes.length == 0)\n        bytes.push(0);\n\n    var node = this.decodeTables[0];\n    for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie.\n        var val = node[bytes[i]];\n\n        if (val == UNASSIGNED) { // Create new node.\n            node[bytes[i]] = NODE_START - this.decodeTables.length;\n            this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));\n        }\n        else if (val <= NODE_START) { // Existing node.\n            node = this.decodeTables[NODE_START - val];\n        }\n        else\n            throw new Error(\"Overwrite byte in \" + this.encodingName + \", addr: \" + addr.toString(16));\n    }\n    return node;\n}\n\n\nDBCSCodec.prototype._addDecodeChunk = function(chunk) {\n    // First element of chunk is the hex mbcs code where we start.\n    var curAddr = parseInt(chunk[0], 16);\n\n    // Choose the decoding node where we'll write our chars.\n    var writeTable = this._getDecodeTrieNode(curAddr);\n    curAddr = curAddr & 0xFF;\n\n    // Write all other elements of the chunk to the table.\n    for (var k = 1; k < chunk.length; k++) {\n        var part = chunk[k];\n        if (typeof part === \"string\") { // String, write as-is.\n            for (var l = 0; l < part.length;) {\n                var code = part.charCodeAt(l++);\n                if (0xD800 <= code && code < 0xDC00) { // Decode surrogate\n                    var codeTrail = part.charCodeAt(l++);\n                    if (0xDC00 <= codeTrail && codeTrail < 0xE000)\n                        writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00);\n                    else\n                        throw new Error(\"Incorrect surrogate pair in \"  + this.encodingName + \" at chunk \" + chunk[0]);\n                }\n                else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used)\n                    var len = 0xFFF - code + 2;\n                    var seq = [];\n                    for (var m = 0; m < len; m++)\n                        seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq.\n\n                    writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;\n                    this.decodeTableSeq.push(seq);\n                }\n                else\n                    writeTable[curAddr++] = code; // Basic char\n            }\n        } \n        else if (typeof part === \"number\") { // Integer, meaning increasing sequence starting with prev character.\n            var charCode = writeTable[curAddr - 1] + 1;\n            for (var l = 0; l < part; l++)\n                writeTable[curAddr++] = charCode++;\n        }\n        else\n            throw new Error(\"Incorrect type '\" + typeof part + \"' given in \"  + this.encodingName + \" at chunk \" + chunk[0]);\n    }\n    if (curAddr > 0xFF)\n        throw new Error(\"Incorrect chunk in \"  + this.encodingName + \" at addr \" + chunk[0] + \": too long\" + curAddr);\n}\n\n// Encoder helpers\nDBCSCodec.prototype._getEncodeBucket = function(uCode) {\n    var high = uCode >> 8; // This could be > 0xFF because of astral characters.\n    if (this.encodeTable[high] === undefined)\n        this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand.\n    return this.encodeTable[high];\n}\n\nDBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {\n    var bucket = this._getEncodeBucket(uCode);\n    var low = uCode & 0xFF;\n    if (bucket[low] <= SEQ_START)\n        this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it.\n    else if (bucket[low] == UNASSIGNED)\n        bucket[low] = dbcsCode;\n}\n\nDBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {\n    \n    // Get the root of character tree according to first character of the sequence.\n    var uCode = seq[0];\n    var bucket = this._getEncodeBucket(uCode);\n    var low = uCode & 0xFF;\n\n    var node;\n    if (bucket[low] <= SEQ_START) {\n        // There's already a sequence with  - use it.\n        node = this.encodeTableSeq[SEQ_START-bucket[low]];\n    }\n    else {\n        // There was no sequence object - allocate a new one.\n        node = {};\n        if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence.\n        bucket[low] = SEQ_START - this.encodeTableSeq.length;\n        this.encodeTableSeq.push(node);\n    }\n\n    // Traverse the character tree, allocating new nodes as needed.\n    for (var j = 1; j < seq.length-1; j++) {\n        var oldVal = node[uCode];\n        if (typeof oldVal === 'object')\n            node = oldVal;\n        else {\n            node = node[uCode] = {}\n            if (oldVal !== undefined)\n                node[DEF_CHAR] = oldVal\n        }\n    }\n\n    // Set the leaf to given dbcsCode.\n    uCode = seq[seq.length-1];\n    node[uCode] = dbcsCode;\n}\n\nDBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {\n    var node = this.decodeTables[nodeIdx];\n    for (var i = 0; i < 0x100; i++) {\n        var uCode = node[i];\n        var mbCode = prefix + i;\n        if (skipEncodeChars[mbCode])\n            continue;\n\n        if (uCode >= 0)\n            this._setEncodeChar(uCode, mbCode);\n        else if (uCode <= NODE_START)\n            this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars);\n        else if (uCode <= SEQ_START)\n            this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);\n    }\n}\n\n\n\n// == Encoder ==================================================================\n\nfunction DBCSEncoder(options, codec) {\n    // Encoder state\n    this.leadSurrogate = -1;\n    this.seqObj = undefined;\n    \n    // Static data\n    this.encodeTable = codec.encodeTable;\n    this.encodeTableSeq = codec.encodeTableSeq;\n    this.defaultCharSingleByte = codec.defCharSB;\n    this.gb18030 = codec.gb18030;\n}\n\nDBCSEncoder.prototype.write = function(str) {\n    var newBuf = new Buffer(str.length * (this.gb18030 ? 4 : 3)), \n        leadSurrogate = this.leadSurrogate,\n        seqObj = this.seqObj, nextChar = -1,\n        i = 0, j = 0;\n\n    while (true) {\n        // 0. Get next character.\n        if (nextChar === -1) {\n            if (i == str.length) break;\n            var uCode = str.charCodeAt(i++);\n        }\n        else {\n            var uCode = nextChar;\n            nextChar = -1;    \n        }\n\n        // 1. Handle surrogates.\n        if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates.\n            if (uCode < 0xDC00) { // We've got lead surrogate.\n                if (leadSurrogate === -1) {\n                    leadSurrogate = uCode;\n                    continue;\n                } else {\n                    leadSurrogate = uCode;\n                    // Double lead surrogate found.\n                    uCode = UNASSIGNED;\n                }\n            } else { // We've got trail surrogate.\n                if (leadSurrogate !== -1) {\n                    uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00);\n                    leadSurrogate = -1;\n                } else {\n                    // Incomplete surrogate pair - only trail surrogate found.\n                    uCode = UNASSIGNED;\n                }\n                \n            }\n        }\n        else if (leadSurrogate !== -1) {\n            // Incomplete surrogate pair - only lead surrogate found.\n            nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char.\n            leadSurrogate = -1;\n        }\n\n        // 2. Convert uCode character.\n        var dbcsCode = UNASSIGNED;\n        if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence\n            var resCode = seqObj[uCode];\n            if (typeof resCode === 'object') { // Sequence continues.\n                seqObj = resCode;\n                continue;\n\n            } else if (typeof resCode == 'number') { // Sequence finished. Write it.\n                dbcsCode = resCode;\n\n            } else if (resCode == undefined) { // Current character is not part of the sequence.\n\n                // Try default character for this sequence\n                resCode = seqObj[DEF_CHAR];\n                if (resCode !== undefined) {\n                    dbcsCode = resCode; // Found. Write it.\n                    nextChar = uCode; // Current character will be written too in the next iteration.\n\n                } else {\n                    // TODO: What if we have no default? (resCode == undefined)\n                    // Then, we should write first char of the sequence as-is and try the rest recursively.\n                    // Didn't do it for now because no encoding has this situation yet.\n                    // Currently, just skip the sequence and write current char.\n                }\n            }\n            seqObj = undefined;\n        }\n        else if (uCode >= 0) {  // Regular character\n            var subtable = this.encodeTable[uCode >> 8];\n            if (subtable !== undefined)\n                dbcsCode = subtable[uCode & 0xFF];\n            \n            if (dbcsCode <= SEQ_START) { // Sequence start\n                seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];\n                continue;\n            }\n\n            if (dbcsCode == UNASSIGNED && this.gb18030) {\n                // Use GB18030 algorithm to find character(s) to write.\n                var idx = findIdx(this.gb18030.uChars, uCode);\n                if (idx != -1) {\n                    var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);\n                    newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600;\n                    newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260;\n                    newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10;\n                    newBuf[j++] = 0x30 + dbcsCode;\n                    continue;\n                }\n            }\n        }\n\n        // 3. Write dbcsCode character.\n        if (dbcsCode === UNASSIGNED)\n            dbcsCode = this.defaultCharSingleByte;\n        \n        if (dbcsCode < 0x100) {\n            newBuf[j++] = dbcsCode;\n        }\n        else if (dbcsCode < 0x10000) {\n            newBuf[j++] = dbcsCode >> 8;   // high byte\n            newBuf[j++] = dbcsCode & 0xFF; // low byte\n        }\n        else {\n            newBuf[j++] = dbcsCode >> 16;\n            newBuf[j++] = (dbcsCode >> 8) & 0xFF;\n            newBuf[j++] = dbcsCode & 0xFF;\n        }\n    }\n\n    this.seqObj = seqObj;\n    this.leadSurrogate = leadSurrogate;\n    return newBuf.slice(0, j);\n}\n\nDBCSEncoder.prototype.end = function() {\n    if (this.leadSurrogate === -1 && this.seqObj === undefined)\n        return; // All clean. Most often case.\n\n    var newBuf = new Buffer(10), j = 0;\n\n    if (this.seqObj) { // We're in the sequence.\n        var dbcsCode = this.seqObj[DEF_CHAR];\n        if (dbcsCode !== undefined) { // Write beginning of the sequence.\n            if (dbcsCode < 0x100) {\n                newBuf[j++] = dbcsCode;\n            }\n            else {\n                newBuf[j++] = dbcsCode >> 8;   // high byte\n                newBuf[j++] = dbcsCode & 0xFF; // low byte\n            }\n        } else {\n            // See todo above.\n        }\n        this.seqObj = undefined;\n    }\n\n    if (this.leadSurrogate !== -1) {\n        // Incomplete surrogate pair - only lead surrogate found.\n        newBuf[j++] = this.defaultCharSingleByte;\n        this.leadSurrogate = -1;\n    }\n    \n    return newBuf.slice(0, j);\n}\n\n// Export for testing\nDBCSEncoder.prototype.findIdx = findIdx;\n\n\n// == Decoder ==================================================================\n\nfunction DBCSDecoder(options, codec) {\n    // Decoder state\n    this.nodeIdx = 0;\n    this.prevBuf = new Buffer(0);\n\n    // Static data\n    this.decodeTables = codec.decodeTables;\n    this.decodeTableSeq = codec.decodeTableSeq;\n    this.defaultCharUnicode = codec.defaultCharUnicode;\n    this.gb18030 = codec.gb18030;\n}\n\nDBCSDecoder.prototype.write = function(buf) {\n    var newBuf = new Buffer(buf.length*2),\n        nodeIdx = this.nodeIdx, \n        prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length,\n        seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence.\n        uCode;\n\n    if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later.\n        prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);\n    \n    for (var i = 0, j = 0; i < buf.length; i++) {\n        var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset];\n\n        // Lookup in current trie node.\n        var uCode = this.decodeTables[nodeIdx][curByte];\n\n        if (uCode >= 0) { \n            // Normal character, just use it.\n        }\n        else if (uCode === UNASSIGNED) { // Unknown char.\n            // TODO: Callback with seq.\n            //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);\n            i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle).\n            uCode = this.defaultCharUnicode.charCodeAt(0);\n        }\n        else if (uCode === GB18030_CODE) {\n            var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset);\n            var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30);\n            var idx = findIdx(this.gb18030.gbChars, ptr);\n            uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];\n        }\n        else if (uCode <= NODE_START) { // Go to next trie node.\n            nodeIdx = NODE_START - uCode;\n            continue;\n        }\n        else if (uCode <= SEQ_START) { // Output a sequence of chars.\n            var seq = this.decodeTableSeq[SEQ_START - uCode];\n            for (var k = 0; k < seq.length - 1; k++) {\n                uCode = seq[k];\n                newBuf[j++] = uCode & 0xFF;\n                newBuf[j++] = uCode >> 8;\n            }\n            uCode = seq[seq.length-1];\n        }\n        else\n            throw new Error(\"iconv-lite internal error: invalid decoding table value \" + uCode + \" at \" + nodeIdx + \"/\" + curByte);\n\n        // Write the character to buffer, handling higher planes using surrogate pair.\n        if (uCode > 0xFFFF) { \n            uCode -= 0x10000;\n            var uCodeLead = 0xD800 + Math.floor(uCode / 0x400);\n            newBuf[j++] = uCodeLead & 0xFF;\n            newBuf[j++] = uCodeLead >> 8;\n\n            uCode = 0xDC00 + uCode % 0x400;\n        }\n        newBuf[j++] = uCode & 0xFF;\n        newBuf[j++] = uCode >> 8;\n\n        // Reset trie node.\n        nodeIdx = 0; seqStart = i+1;\n    }\n\n    this.nodeIdx = nodeIdx;\n    this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset);\n    return newBuf.slice(0, j).toString('ucs2');\n}\n\nDBCSDecoder.prototype.end = function() {\n    var ret = '';\n\n    // Try to parse all remaining chars.\n    while (this.prevBuf.length > 0) {\n        // Skip 1 character in the buffer.\n        ret += this.defaultCharUnicode;\n        var buf = this.prevBuf.slice(1);\n\n        // Parse remaining as usual.\n        this.prevBuf = new Buffer(0);\n        this.nodeIdx = 0;\n        if (buf.length > 0)\n            ret += this.write(buf);\n    }\n\n    this.nodeIdx = 0;\n    return ret;\n}\n\n// Binary search for GB18030. Returns largest i such that table[i] <= val.\nfunction findIdx(table, val) {\n    if (table[0] > val)\n        return -1;\n\n    var l = 0, r = table.length;\n    while (l < r-1) { // always table[l] <= val < table[r]\n        var mid = l + Math.floor((r-l+1)/2);\n        if (table[mid] <= val)\n            l = mid;\n        else\n            r = mid;\n    }\n    return l;\n}\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5}],11:[function(require,module,exports){\n\"use strict\"\n\n// Description of supported double byte encodings and aliases.\n// Tables are not require()-d until they are needed to speed up library load.\n// require()-s are direct to support Browserify.\n\nmodule.exports = {\n    \n    // == Japanese/ShiftJIS ====================================================\n    // All japanese encodings are based on JIS X set of standards:\n    // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.\n    // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. \n    //              Has several variations in 1978, 1983, 1990 and 1997.\n    // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.\n    // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.\n    //              2 planes, first is superset of 0208, second - revised 0212.\n    //              Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx)\n\n    // Byte encodings are:\n    //  * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte\n    //               encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC.\n    //               Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI.\n    //  * EUC-JP:    Up to 3 bytes per character. Used mostly on *nixes.\n    //               0x00-0x7F       - lower part of 0201\n    //               0x8E, 0xA1-0xDF - upper part of 0201\n    //               (0xA1-0xFE)x2   - 0208 plane (94x94).\n    //               0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).\n    //  * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.\n    //               Used as-is in ISO2022 family.\n    //  * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, \n    //                0201-1976 Roman, 0208-1978, 0208-1983.\n    //  * ISO2022-JP-1: Adds esc seq for 0212-1990.\n    //  * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.\n    //  * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2.\n    //  * ISO2022-JP-2004: Adds 0213-2004 Plane 1.\n    //\n    // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.\n    //\n    // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html\n\n\n    'shiftjis': {\n        type: '_dbcs',\n        table: function() { return require('./tables/shiftjis.json') },\n        encodeAdd: {'\\u00a5': 0x5C, '\\u203E': 0x7E},\n        encodeSkipVals: [{from: 0xED40, to: 0xF940}],\n    },\n    'csshiftjis': 'shiftjis',\n    'mskanji': 'shiftjis',\n    'sjis': 'shiftjis',\n    'windows31j': 'shiftjis',\n    'xsjis': 'shiftjis',\n    'windows932': 'shiftjis',\n    '932': 'shiftjis',\n    'cp932': 'shiftjis',\n\n    'eucjp': {\n        type: '_dbcs',\n        table: function() { return require('./tables/eucjp.json') },\n        encodeAdd: {'\\u00a5': 0x5C, '\\u203E': 0x7E},\n    },\n\n    // TODO: KDDI extension to Shift_JIS\n    // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes.\n    // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars.\n\n    // == Chinese/GBK ==========================================================\n    // http://en.wikipedia.org/wiki/GBK\n\n    // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936\n    'gb2312': 'cp936',\n    'gb231280': 'cp936',\n    'gb23121980': 'cp936',\n    'csgb2312': 'cp936',\n    'csiso58gb231280': 'cp936',\n    'euccn': 'cp936',\n    'isoir58': 'gbk',\n\n    // Microsoft's CP936 is a subset and approximation of GBK.\n    // TODO: Euro = 0x80 in cp936, but not in GBK (where it's valid but undefined)\n    'windows936': 'cp936',\n    '936': 'cp936',\n    'cp936': {\n        type: '_dbcs',\n        table: function() { return require('./tables/cp936.json') },\n    },\n\n    // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.\n    'gbk': {\n        type: '_dbcs',\n        table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) },\n    },\n    'xgbk': 'gbk',\n\n    // GB18030 is an algorithmic extension of GBK.\n    'gb18030': {\n        type: '_dbcs',\n        table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) },\n        gb18030: function() { return require('./tables/gb18030-ranges.json') },\n    },\n\n    'chinese': 'gb18030',\n\n    // TODO: Support GB18030 (~27000 chars + whole unicode mapping, cp54936)\n    // http://icu-project.org/docs/papers/gb18030.html\n    // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml\n    // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0\n\n    // == Korean ===============================================================\n    // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.\n    'windows949': 'cp949',\n    '949': 'cp949',\n    'cp949': {\n        type: '_dbcs',\n        table: function() { return require('./tables/cp949.json') },\n    },\n\n    'cseuckr': 'cp949',\n    'csksc56011987': 'cp949',\n    'euckr': 'cp949',\n    'isoir149': 'cp949',\n    'korean': 'cp949',\n    'ksc56011987': 'cp949',\n    'ksc56011989': 'cp949',\n    'ksc5601': 'cp949',\n\n\n    // == Big5/Taiwan/Hong Kong ================================================\n    // There are lots of tables for Big5 and cp950. Please see the following links for history:\n    // http://moztw.org/docs/big5/  http://www.haible.de/bruno/charsets/conversion-tables/Big5.html\n    // Variations, in roughly number of defined chars:\n    //  * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT\n    //  * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/\n    //  * Big5-2003 (Taiwan standard) almost superset of cp950.\n    //  * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.\n    //  * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. \n    //    many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.\n    //    Plus, it has 4 combining sequences.\n    //    Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299\n    //    because big5-hkscs is the only encoding to include astral characters in non-algorithmic way.\n    //    Implementations are not consistent within browsers; sometimes labeled as just big5.\n    //    MS Internet Explorer switches from big5 to big5-hkscs when a patch applied.\n    //    Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31\n    //    In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.\n    //    Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt\n    //                   http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt\n    // \n    // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder\n    // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.\n\n    'windows950': 'cp950',\n    '950': 'cp950',\n    'cp950': {\n        type: '_dbcs',\n        table: function() { return require('./tables/cp950.json') },\n    },\n\n    // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.\n    'big5': 'big5hkscs',\n    'big5hkscs': {\n        type: '_dbcs',\n        table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) },\n        encodeSkipVals: [0xa2cc],\n    },\n\n    'cnbig5': 'big5hkscs',\n    'csbig5': 'big5hkscs',\n    'xxbig5': 'big5hkscs',\n\n};\n\n},{\"./tables/big5-added.json\":17,\"./tables/cp936.json\":18,\"./tables/cp949.json\":19,\"./tables/cp950.json\":20,\"./tables/eucjp.json\":21,\"./tables/gb18030-ranges.json\":22,\"./tables/gbk-added.json\":23,\"./tables/shiftjis.json\":24}],12:[function(require,module,exports){\n\"use strict\"\n\n// Update this array if you add/rename/remove files in this directory.\n// We support Browserify by skipping automatic module discovery and requiring modules directly.\nvar modules = [\n    require(\"./internal\"),\n    require(\"./utf16\"),\n    require(\"./utf7\"),\n    require(\"./sbcs-codec\"),\n    require(\"./sbcs-data\"),\n    require(\"./sbcs-data-generated\"),\n    require(\"./dbcs-codec\"),\n    require(\"./dbcs-data\"),\n];\n\n// Put all encoding/alias/codec definitions to single object and export it. \nfor (var i = 0; i < modules.length; i++) {\n    var module = modules[i];\n    for (var enc in module)\n        if (Object.prototype.hasOwnProperty.call(module, enc))\n            exports[enc] = module[enc];\n}\n\n},{\"./dbcs-codec\":10,\"./dbcs-data\":11,\"./internal\":13,\"./sbcs-codec\":14,\"./sbcs-data\":16,\"./sbcs-data-generated\":15,\"./utf16\":25,\"./utf7\":26}],13:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\n// Export Node.js internal encodings.\n\nmodule.exports = {\n    // Encodings\n    utf8:   { type: \"_internal\", bomAware: true},\n    cesu8:  { type: \"_internal\", bomAware: true},\n    unicode11utf8: \"utf8\",\n\n    ucs2:   { type: \"_internal\", bomAware: true},\n    utf16le: \"ucs2\",\n\n    binary: { type: \"_internal\" },\n    base64: { type: \"_internal\" },\n    hex:    { type: \"_internal\" },\n\n    // Codec.\n    _internal: InternalCodec,\n};\n\n//------------------------------------------------------------------------------\n\nfunction InternalCodec(codecOptions, iconv) {\n    this.enc = codecOptions.encodingName;\n    this.bomAware = codecOptions.bomAware;\n\n    if (this.enc === \"base64\")\n        this.encoder = InternalEncoderBase64;\n    else if (this.enc === \"cesu8\") {\n        this.enc = \"utf8\"; // Use utf8 for decoding.\n        this.encoder = InternalEncoderCesu8;\n\n        // Add decoder for versions of Node not supporting CESU-8\n        if (new Buffer(\"eda080\", 'hex').toString().length == 3) {\n            this.decoder = InternalDecoderCesu8;\n            this.defaultCharUnicode = iconv.defaultCharUnicode;\n        }\n    }\n}\n\nInternalCodec.prototype.encoder = InternalEncoder;\nInternalCodec.prototype.decoder = InternalDecoder;\n\n//------------------------------------------------------------------------------\n\n// We use node.js internal decoder. Its signature is the same as ours.\nvar StringDecoder = require('string_decoder').StringDecoder;\n\nif (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.\n    StringDecoder.prototype.end = function() {};\n\n\nfunction InternalDecoder(options, codec) {\n    StringDecoder.call(this, codec.enc);\n}\n\nInternalDecoder.prototype = StringDecoder.prototype;\n\n\n//------------------------------------------------------------------------------\n// Encoder is mostly trivial\n\nfunction InternalEncoder(options, codec) {\n    this.enc = codec.enc;\n}\n\nInternalEncoder.prototype.write = function(str) {\n    return new Buffer(str, this.enc);\n}\n\nInternalEncoder.prototype.end = function() {\n}\n\n\n//------------------------------------------------------------------------------\n// Except base64 encoder, which must keep its state.\n\nfunction InternalEncoderBase64(options, codec) {\n    this.prevStr = '';\n}\n\nInternalEncoderBase64.prototype.write = function(str) {\n    str = this.prevStr + str;\n    var completeQuads = str.length - (str.length % 4);\n    this.prevStr = str.slice(completeQuads);\n    str = str.slice(0, completeQuads);\n\n    return new Buffer(str, \"base64\");\n}\n\nInternalEncoderBase64.prototype.end = function() {\n    return new Buffer(this.prevStr, \"base64\");\n}\n\n\n//------------------------------------------------------------------------------\n// CESU-8 encoder is also special.\n\nfunction InternalEncoderCesu8(options, codec) {\n}\n\nInternalEncoderCesu8.prototype.write = function(str) {\n    var buf = new Buffer(str.length * 3), bufIdx = 0;\n    for (var i = 0; i < str.length; i++) {\n        var charCode = str.charCodeAt(i);\n        // Naive implementation, but it works because CESU-8 is especially easy\n        // to convert from UTF-16 (which all JS strings are encoded in).\n        if (charCode < 0x80)\n            buf[bufIdx++] = charCode;\n        else if (charCode < 0x800) {\n            buf[bufIdx++] = 0xC0 + (charCode >>> 6);\n            buf[bufIdx++] = 0x80 + (charCode & 0x3f);\n        }\n        else { // charCode will always be < 0x10000 in javascript.\n            buf[bufIdx++] = 0xE0 + (charCode >>> 12);\n            buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f);\n            buf[bufIdx++] = 0x80 + (charCode & 0x3f);\n        }\n    }\n    return buf.slice(0, bufIdx);\n}\n\nInternalEncoderCesu8.prototype.end = function() {\n}\n\n//------------------------------------------------------------------------------\n// CESU-8 decoder is not implemented in Node v4.0+\n\nfunction InternalDecoderCesu8(options, codec) {\n    this.acc = 0;\n    this.contBytes = 0;\n    this.accBytes = 0;\n    this.defaultCharUnicode = codec.defaultCharUnicode;\n}\n\nInternalDecoderCesu8.prototype.write = function(buf) {\n    var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, \n        res = '';\n    for (var i = 0; i < buf.length; i++) {\n        var curByte = buf[i];\n        if ((curByte & 0xC0) !== 0x80) { // Leading byte\n            if (contBytes > 0) { // Previous code is invalid\n                res += this.defaultCharUnicode;\n                contBytes = 0;\n            }\n\n            if (curByte < 0x80) { // Single-byte code\n                res += String.fromCharCode(curByte);\n            } else if (curByte < 0xE0) { // Two-byte code\n                acc = curByte & 0x1F;\n                contBytes = 1; accBytes = 1;\n            } else if (curByte < 0xF0) { // Three-byte code\n                acc = curByte & 0x0F;\n                contBytes = 2; accBytes = 1;\n            } else { // Four or more are not supported for CESU-8.\n                res += this.defaultCharUnicode;\n            }\n        } else { // Continuation byte\n            if (contBytes > 0) { // We're waiting for it.\n                acc = (acc << 6) | (curByte & 0x3f);\n                contBytes--; accBytes++;\n                if (contBytes === 0) {\n                    // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80)\n                    if (accBytes === 2 && acc < 0x80 && acc > 0)\n                        res += this.defaultCharUnicode;\n                    else if (accBytes === 3 && acc < 0x800)\n                        res += this.defaultCharUnicode;\n                    else\n                        // Actually add character.\n                        res += String.fromCharCode(acc);\n                }\n            } else { // Unexpected continuation byte\n                res += this.defaultCharUnicode;\n            }\n        }\n    }\n    this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes;\n    return res;\n}\n\nInternalDecoderCesu8.prototype.end = function() {\n    var res = 0;\n    if (this.contBytes > 0)\n        res += this.defaultCharUnicode;\n    return res;\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5,\"string_decoder\":58}],14:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\n// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that\n// correspond to encoded bytes (if 128 - then lower half is ASCII). \n\nexports._sbcs = SBCSCodec;\nfunction SBCSCodec(codecOptions, iconv) {\n    if (!codecOptions)\n        throw new Error(\"SBCS codec is called without the data.\")\n    \n    // Prepare char buffer for decoding.\n    if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256))\n        throw new Error(\"Encoding '\"+codecOptions.type+\"' has incorrect 'chars' (must be of len 128 or 256)\");\n    \n    if (codecOptions.chars.length === 128) {\n        var asciiString = \"\";\n        for (var i = 0; i < 128; i++)\n            asciiString += String.fromCharCode(i);\n        codecOptions.chars = asciiString + codecOptions.chars;\n    }\n\n    this.decodeBuf = new Buffer(codecOptions.chars, 'ucs2');\n    \n    // Encoding buffer.\n    var encodeBuf = new Buffer(65536);\n    encodeBuf.fill(iconv.defaultCharSingleByte.charCodeAt(0));\n\n    for (var i = 0; i < codecOptions.chars.length; i++)\n        encodeBuf[codecOptions.chars.charCodeAt(i)] = i;\n\n    this.encodeBuf = encodeBuf;\n}\n\nSBCSCodec.prototype.encoder = SBCSEncoder;\nSBCSCodec.prototype.decoder = SBCSDecoder;\n\n\nfunction SBCSEncoder(options, codec) {\n    this.encodeBuf = codec.encodeBuf;\n}\n\nSBCSEncoder.prototype.write = function(str) {\n    var buf = new Buffer(str.length);\n    for (var i = 0; i < str.length; i++)\n        buf[i] = this.encodeBuf[str.charCodeAt(i)];\n    \n    return buf;\n}\n\nSBCSEncoder.prototype.end = function() {\n}\n\n\nfunction SBCSDecoder(options, codec) {\n    this.decodeBuf = codec.decodeBuf;\n}\n\nSBCSDecoder.prototype.write = function(buf) {\n    // Strings are immutable in JS -> we use ucs2 buffer to speed up computations.\n    var decodeBuf = this.decodeBuf;\n    var newBuf = new Buffer(buf.length*2);\n    var idx1 = 0, idx2 = 0;\n    for (var i = 0; i < buf.length; i++) {\n        idx1 = buf[i]*2; idx2 = i*2;\n        newBuf[idx2] = decodeBuf[idx1];\n        newBuf[idx2+1] = decodeBuf[idx1+1];\n    }\n    return newBuf.toString('ucs2');\n}\n\nSBCSDecoder.prototype.end = function() {\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5}],15:[function(require,module,exports){\n\"use strict\"\n\n// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script.\nmodule.exports = {\n  \"437\": \"cp437\",\n  \"737\": \"cp737\",\n  \"775\": \"cp775\",\n  \"850\": \"cp850\",\n  \"852\": \"cp852\",\n  \"855\": \"cp855\",\n  \"856\": \"cp856\",\n  \"857\": \"cp857\",\n  \"858\": \"cp858\",\n  \"860\": \"cp860\",\n  \"861\": \"cp861\",\n  \"862\": \"cp862\",\n  \"863\": \"cp863\",\n  \"864\": \"cp864\",\n  \"865\": \"cp865\",\n  \"866\": \"cp866\",\n  \"869\": \"cp869\",\n  \"874\": \"windows874\",\n  \"922\": \"cp922\",\n  \"1046\": \"cp1046\",\n  \"1124\": \"cp1124\",\n  \"1125\": \"cp1125\",\n  \"1129\": \"cp1129\",\n  \"1133\": \"cp1133\",\n  \"1161\": \"cp1161\",\n  \"1162\": \"cp1162\",\n  \"1163\": \"cp1163\",\n  \"1250\": \"windows1250\",\n  \"1251\": \"windows1251\",\n  \"1252\": \"windows1252\",\n  \"1253\": \"windows1253\",\n  \"1254\": \"windows1254\",\n  \"1255\": \"windows1255\",\n  \"1256\": \"windows1256\",\n  \"1257\": \"windows1257\",\n  \"1258\": \"windows1258\",\n  \"28591\": \"iso88591\",\n  \"28592\": \"iso88592\",\n  \"28593\": \"iso88593\",\n  \"28594\": \"iso88594\",\n  \"28595\": \"iso88595\",\n  \"28596\": \"iso88596\",\n  \"28597\": \"iso88597\",\n  \"28598\": \"iso88598\",\n  \"28599\": \"iso88599\",\n  \"28600\": \"iso885910\",\n  \"28601\": \"iso885911\",\n  \"28603\": \"iso885913\",\n  \"28604\": \"iso885914\",\n  \"28605\": \"iso885915\",\n  \"28606\": \"iso885916\",\n  \"windows874\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����\"\n  },\n  \"win874\": \"windows874\",\n  \"cp874\": \"windows874\",\n  \"windows1250\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙\"\n  },\n  \"win1250\": \"windows1250\",\n  \"cp1250\": \"windows1250\",\n  \"windows1251\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя\"\n  },\n  \"win1251\": \"windows1251\",\n  \"cp1251\": \"windows1251\",\n  \"windows1252\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"\n  },\n  \"win1252\": \"windows1252\",\n  \"cp1252\": \"windows1252\",\n  \"windows1253\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�\"\n  },\n  \"win1253\": \"windows1253\",\n  \"cp1253\": \"windows1253\",\n  \"windows1254\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ\"\n  },\n  \"win1254\": \"windows1254\",\n  \"cp1254\": \"windows1254\",\n  \"windows1255\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹ�ֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�\"\n  },\n  \"win1255\": \"windows1255\",\n  \"cp1255\": \"windows1255\",\n  \"windows1256\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے\"\n  },\n  \"win1256\": \"windows1256\",\n  \"cp1256\": \"windows1256\",\n  \"windows1257\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙\"\n  },\n  \"win1257\": \"windows1257\",\n  \"cp1257\": \"windows1257\",\n  \"windows1258\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ\"\n  },\n  \"win1258\": \"windows1258\",\n  \"cp1258\": \"windows1258\",\n  \"iso88591\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"\n  },\n  \"cp28591\": \"iso88591\",\n  \"iso88592\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙\"\n  },\n  \"cp28592\": \"iso88592\",\n  \"iso88593\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" Ħ˘£¤�Ĥ§¨İŞĞĴ­�Ż°ħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙\"\n  },\n  \"cp28593\": \"iso88593\",\n  \"iso88594\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ĄĸŖ¤ĨĻ§¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖ×ØŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙\"\n  },\n  \"cp28594\": \"iso88594\",\n  \"iso88595\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ\"\n  },\n  \"cp28595\": \"iso88595\",\n  \"iso88596\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������\"\n  },\n  \"cp28596\": \"iso88596\",\n  \"iso88597\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�\"\n  },\n  \"cp28597\": \"iso88597\",\n  \"iso88598\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�\"\n  },\n  \"cp28598\": \"iso88598\",\n  \"iso88599\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ\"\n  },\n  \"cp28599\": \"iso88599\",\n  \"iso885910\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ĄĒĢĪĨĶ§ĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ\"\n  },\n  \"cp28600\": \"iso885910\",\n  \"iso885911\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����\"\n  },\n  \"cp28601\": \"iso885911\",\n  \"iso885913\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’\"\n  },\n  \"cp28603\": \"iso885913\",\n  \"iso885914\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ\"\n  },\n  \"cp28604\": \"iso885914\",\n  \"iso885915\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"\n  },\n  \"cp28605\": \"iso885915\",\n  \"iso885916\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ĄąŁ€„Š§š©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ\"\n  },\n  \"cp28606\": \"iso885916\",\n  \"cp437\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñÑªº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm437\": \"cp437\",\n  \"csibm437\": \"cp437\",\n  \"cp737\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm737\": \"cp737\",\n  \"csibm737\": \"cp737\",\n  \"cp775\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£Ø×¤ĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ \"\n  },\n  \"ibm775\": \"cp775\",\n  \"csibm775\": \"cp775\",\n  \"cp850\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñÑªº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýÝ¯´­±‗¾¶§÷¸°¨·¹³²■ \"\n  },\n  \"ibm850\": \"cp850\",\n  \"csibm850\": \"cp850\",\n  \"cp852\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘę¬źČş«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ \"\n  },\n  \"ibm852\": \"cp852\",\n  \"csibm852\": \"cp852\",\n  \"cp855\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ \"\n  },\n  \"ibm855\": \"cp855\",\n  \"csibm855\": \"cp855\",\n  \"cp856\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ \"\n  },\n  \"ibm856\": \"cp856\",\n  \"csibm856\": \"cp856\",\n  \"cp857\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞğ¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ \"\n  },\n  \"ibm857\": \"cp857\",\n  \"csibm857\": \"cp857\",\n  \"cp858\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñÑªº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýÝ¯´­±‗¾¶§÷¸°¨·¹³²■ \"\n  },\n  \"ibm858\": \"cp858\",\n  \"csibm858\": \"cp858\",\n  \"cp860\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñÑªº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm860\": \"cp860\",\n  \"csibm860\": \"cp860\",\n  \"cp861\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm861\": \"cp861\",\n  \"csibm861\": \"cp861\",\n  \"cp862\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñÑªº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm862\": \"cp862\",\n  \"csibm862\": \"cp862\",\n  \"cp863\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm863\": \"cp863\",\n  \"csibm863\": \"cp863\",\n  \"cp864\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f !\\\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�\"\n  },\n  \"ibm864\": \"cp864\",\n  \"csibm864\": \"cp864\",\n  \"cp865\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñÑªº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ \"\n  },\n  \"ibm865\": \"cp865\",\n  \"csibm865\": \"cp865\",\n  \"cp866\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ \"\n  },\n  \"ibm866\": \"cp866\",\n  \"csibm866\": \"cp866\",\n  \"cp869\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ \"\n  },\n  \"ibm869\": \"cp869\",\n  \"csibm869\": \"cp869\",\n  \"cp922\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖ×ØÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ\"\n  },\n  \"ibm922\": \"cp922\",\n  \"csibm922\": \"cp922\",\n  \"cp1046\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ﺈ×÷ﹱ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�\"\n  },\n  \"ibm1046\": \"cp1046\",\n  \"csibm1046\": \"cp1046\",\n  \"cp1124\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ\"\n  },\n  \"ibm1124\": \"cp1124\",\n  \"csibm1124\": \"cp1124\",\n  \"cp1125\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ \"\n  },\n  \"ibm1125\": \"cp1125\",\n  \"csibm1125\": \"cp1125\",\n  \"cp1129\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ\"\n  },\n  \"ibm1129\": \"cp1129\",\n  \"csibm1129\": \"cp1129\",\n  \"cp1133\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�\"\n  },\n  \"ibm1133\": \"cp1133\",\n  \"csibm1133\": \"cp1133\",\n  \"cp1161\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ \"\n  },\n  \"ibm1161\": \"cp1161\",\n  \"csibm1161\": \"cp1161\",\n  \"cp1162\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"€…‘’“”•–— กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����\"\n  },\n  \"ibm1162\": \"cp1162\",\n  \"csibm1162\": \"cp1162\",\n  \"cp1163\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖ×ØÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ\"\n  },\n  \"ibm1163\": \"cp1163\",\n  \"csibm1163\": \"cp1163\",\n  \"maccroatian\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ\"\n  },\n  \"maccyrillic\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤\"\n  },\n  \"macgreek\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"Ä¹²É³ÖÜ΅àâä΄¨çéèêë£™îï•½‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�\"\n  },\n  \"maciceland\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ\"\n  },\n  \"macroman\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›ﬁﬂ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ\"\n  },\n  \"macromania\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ\"\n  },\n  \"macthai\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู﻿​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����\"\n  },\n  \"macturkish\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ\"\n  },\n  \"macukraine\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤\"\n  },\n  \"koi8r\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ\"\n  },\n  \"koi8u\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ\"\n  },\n  \"koi8ru\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ\"\n  },\n  \"koi8t\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ\"\n  },\n  \"armscii8\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�\"\n  },\n  \"rk1048\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя\"\n  },\n  \"tcvn\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"\\u0000ÚỤ\\u0003ỪỬỮ\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010ỨỰỲỶỸÝỴ\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ\"\n  },\n  \"georgianacademy\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"\n  },\n  \"georgianps\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"\n  },\n  \"pt154\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя\"\n  },\n  \"viscii\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"\\u0000\\u0001Ẳ\\u0003\\u0004ẴẪ\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013Ỷ\\u0015\\u0016\\u0017\\u0018Ỹ\\u001a\\u001b\\u001c\\u001dỴ\\u001f !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ\"\n  },\n  \"iso646cn\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f !\\\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������\"\n  },\n  \"iso646jp\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������\"\n  },\n  \"hproman8\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \" ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�\"\n  },\n  \"macintosh\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›ﬁﬂ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ\"\n  },\n  \"ascii\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"��������������������������������������������������������������������������������������������������������������������������������\"\n  },\n  \"tis620\": {\n    \"type\": \"_sbcs\",\n    \"chars\": \"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����\"\n  }\n}\n},{}],16:[function(require,module,exports){\n\"use strict\"\n\n// Manually added data to be used by sbcs codec in addition to generated one.\n\nmodule.exports = {\n    // Not supported by iconv, not sure why.\n    \"10029\": \"maccenteuro\",\n    \"maccenteuro\": {\n        \"type\": \"_sbcs\",\n        \"chars\": \"ÄĀāÉĄÖÜáąČäčĆćéŹźĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņŃ¬√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ\"\n    },\n\n    \"808\": \"cp808\",\n    \"ibm808\": \"cp808\",\n    \"cp808\": {\n        \"type\": \"_sbcs\",\n        \"chars\": \"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ \"\n    },\n\n    // Aliases of generated encodings.\n    \"ascii8bit\": \"ascii\",\n    \"usascii\": \"ascii\",\n    \"ansix34\": \"ascii\",\n    \"ansix341968\": \"ascii\",\n    \"ansix341986\": \"ascii\",\n    \"csascii\": \"ascii\",\n    \"cp367\": \"ascii\",\n    \"ibm367\": \"ascii\",\n    \"isoir6\": \"ascii\",\n    \"iso646us\": \"ascii\",\n    \"iso646irv\": \"ascii\",\n    \"us\": \"ascii\",\n\n    \"latin1\": \"iso88591\",\n    \"latin2\": \"iso88592\",\n    \"latin3\": \"iso88593\",\n    \"latin4\": \"iso88594\",\n    \"latin5\": \"iso88599\",\n    \"latin6\": \"iso885910\",\n    \"latin7\": \"iso885913\",\n    \"latin8\": \"iso885914\",\n    \"latin9\": \"iso885915\",\n    \"latin10\": \"iso885916\",\n\n    \"csisolatin1\": \"iso88591\",\n    \"csisolatin2\": \"iso88592\",\n    \"csisolatin3\": \"iso88593\",\n    \"csisolatin4\": \"iso88594\",\n    \"csisolatincyrillic\": \"iso88595\",\n    \"csisolatinarabic\": \"iso88596\",\n    \"csisolatingreek\" : \"iso88597\",\n    \"csisolatinhebrew\": \"iso88598\",\n    \"csisolatin5\": \"iso88599\",\n    \"csisolatin6\": \"iso885910\",\n\n    \"l1\": \"iso88591\",\n    \"l2\": \"iso88592\",\n    \"l3\": \"iso88593\",\n    \"l4\": \"iso88594\",\n    \"l5\": \"iso88599\",\n    \"l6\": \"iso885910\",\n    \"l7\": \"iso885913\",\n    \"l8\": \"iso885914\",\n    \"l9\": \"iso885915\",\n    \"l10\": \"iso885916\",\n\n    \"isoir14\": \"iso646jp\",\n    \"isoir57\": \"iso646cn\",\n    \"isoir100\": \"iso88591\",\n    \"isoir101\": \"iso88592\",\n    \"isoir109\": \"iso88593\",\n    \"isoir110\": \"iso88594\",\n    \"isoir144\": \"iso88595\",\n    \"isoir127\": \"iso88596\",\n    \"isoir126\": \"iso88597\",\n    \"isoir138\": \"iso88598\",\n    \"isoir148\": \"iso88599\",\n    \"isoir157\": \"iso885910\",\n    \"isoir166\": \"tis620\",\n    \"isoir179\": \"iso885913\",\n    \"isoir199\": \"iso885914\",\n    \"isoir203\": \"iso885915\",\n    \"isoir226\": \"iso885916\",\n\n    \"cp819\": \"iso88591\",\n    \"ibm819\": \"iso88591\",\n\n    \"cyrillic\": \"iso88595\",\n\n    \"arabic\": \"iso88596\",\n    \"arabic8\": \"iso88596\",\n    \"ecma114\": \"iso88596\",\n    \"asmo708\": \"iso88596\",\n\n    \"greek\" : \"iso88597\",\n    \"greek8\" : \"iso88597\",\n    \"ecma118\" : \"iso88597\",\n    \"elot928\" : \"iso88597\",\n\n    \"hebrew\": \"iso88598\",\n    \"hebrew8\": \"iso88598\",\n\n    \"turkish\": \"iso88599\",\n    \"turkish8\": \"iso88599\",\n\n    \"thai\": \"iso885911\",\n    \"thai8\": \"iso885911\",\n\n    \"celtic\": \"iso885914\",\n    \"celtic8\": \"iso885914\",\n    \"isoceltic\": \"iso885914\",\n\n    \"tis6200\": \"tis620\",\n    \"tis62025291\": \"tis620\",\n    \"tis62025330\": \"tis620\",\n\n    \"10000\": \"macroman\",\n    \"10006\": \"macgreek\",\n    \"10007\": \"maccyrillic\",\n    \"10079\": \"maciceland\",\n    \"10081\": \"macturkish\",\n\n    \"cspc8codepage437\": \"cp437\",\n    \"cspc775baltic\": \"cp775\",\n    \"cspc850multilingual\": \"cp850\",\n    \"cspcp852\": \"cp852\",\n    \"cspc862latinhebrew\": \"cp862\",\n    \"cpgr\": \"cp869\",\n\n    \"msee\": \"cp1250\",\n    \"mscyrl\": \"cp1251\",\n    \"msansi\": \"cp1252\",\n    \"msgreek\": \"cp1253\",\n    \"msturk\": \"cp1254\",\n    \"mshebr\": \"cp1255\",\n    \"msarab\": \"cp1256\",\n    \"winbaltrim\": \"cp1257\",\n\n    \"cp20866\": \"koi8r\",\n    \"20866\": \"koi8r\",\n    \"ibm878\": \"koi8r\",\n    \"cskoi8r\": \"koi8r\",\n\n    \"cp21866\": \"koi8u\",\n    \"21866\": \"koi8u\",\n    \"ibm1168\": \"koi8u\",\n\n    \"strk10482002\": \"rk1048\",\n\n    \"tcvn5712\": \"tcvn\",\n    \"tcvn57121\": \"tcvn\",\n\n    \"gb198880\": \"iso646cn\",\n    \"cn\": \"iso646cn\",\n\n    \"csiso14jisc6220ro\": \"iso646jp\",\n    \"jisc62201969ro\": \"iso646jp\",\n    \"jp\": \"iso646jp\",\n\n    \"cshproman8\": \"hproman8\",\n    \"r8\": \"hproman8\",\n    \"roman8\": \"hproman8\",\n    \"xroman8\": \"hproman8\",\n    \"ibm1051\": \"hproman8\",\n\n    \"mac\": \"macintosh\",\n    \"csmacintosh\": \"macintosh\",\n};\n\n\n},{}],17:[function(require,module,exports){\nmodule.exports=[\n[\"8740\",\"䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻\"],\n[\"8767\",\"綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬\"],\n[\"87a1\",\"𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋\"],\n[\"8840\",\"㇀\",4,\"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒ࿿Ê̄Ế࿿Ê̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ\"],\n[\"88a1\",\"ǜü࿿ê̄ế࿿ê̌ềêɡ⏚⏛\"],\n[\"8940\",\"𪎩𡅅\"],\n[\"8943\",\"攊\"],\n[\"8946\",\"丽滝鵎釟\"],\n[\"894c\",\"𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮\"],\n[\"89a1\",\"琑糼緍楆竉刧\"],\n[\"89ab\",\"醌碸酞肼\"],\n[\"89b0\",\"贋胶𠧧\"],\n[\"89b5\",\"肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁\"],\n[\"89c1\",\"溚舾甙\"],\n[\"89c5\",\"䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅\"],\n[\"8a40\",\"𧶄唥\"],\n[\"8a43\",\"𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓\"],\n[\"8a64\",\"𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕\"],\n[\"8a76\",\"䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯\"],\n[\"8aa1\",\"𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱\"],\n[\"8aac\",\"䠋𠆩㿺塳𢶍\"],\n[\"8ab2\",\"𤗈𠓼𦂗𠽌𠶖啹䂻䎺\"],\n[\"8abb\",\"䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃\"],\n[\"8ac9\",\"𪘁𠸉𢫏𢳉\"],\n[\"8ace\",\"𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻\"],\n[\"8adf\",\"𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌\"],\n[\"8af6\",\"𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭\"],\n[\"8b40\",\"𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹\"],\n[\"8b55\",\"𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑\"],\n[\"8ba1\",\"𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁\"],\n[\"8bde\",\"𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢\"],\n[\"8c40\",\"倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋\"],\n[\"8ca1\",\"𣏹椙橃𣱣泿\"],\n[\"8ca7\",\"爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚\"],\n[\"8cc9\",\"顨杫䉶圽\"],\n[\"8cce\",\"藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶\"],\n[\"8ce6\",\"峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻\"],\n[\"8d40\",\"𠮟\"],\n[\"8d42\",\"𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱\"],\n[\"8da1\",\"㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘\"],\n[\"8e40\",\"𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎\"],\n[\"8ea1\",\"繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛\"],\n[\"8f40\",\"蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖\"],\n[\"8fa1\",\"𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起\"],\n[\"9040\",\"趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛\"],\n[\"90a1\",\"𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜\"],\n[\"9140\",\"𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈\"],\n[\"91a1\",\"鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨\"],\n[\"9240\",\"𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘\"],\n[\"92a1\",\"働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃\"],\n[\"9340\",\"媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍\"],\n[\"93a1\",\"摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋\"],\n[\"9440\",\"銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻\"],\n[\"94a1\",\"㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡\"],\n[\"9540\",\"𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂\"],\n[\"95a1\",\"衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰\"],\n[\"9640\",\"桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸\"],\n[\"96a1\",\"𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉\"],\n[\"9740\",\"愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫\"],\n[\"97a1\",\"𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎\"],\n[\"9840\",\"𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦\"],\n[\"98a1\",\"咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃\"],\n[\"9940\",\"䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚\"],\n[\"99a1\",\"䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿\"],\n[\"9a40\",\"鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺\"],\n[\"9aa1\",\"黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪\"],\n[\"9b40\",\"𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌\"],\n[\"9b62\",\"𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎\"],\n[\"9ba1\",\"椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊\"],\n[\"9c40\",\"嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶\"],\n[\"9ca1\",\"㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏\"],\n[\"9d40\",\"𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁\"],\n[\"9da1\",\"辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢\"],\n[\"9e40\",\"𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺\"],\n[\"9ea1\",\"鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭\"],\n[\"9ead\",\"𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹\"],\n[\"9ec5\",\"㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲\"],\n[\"9ef5\",\"噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼\"],\n[\"9f40\",\"籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱\"],\n[\"9f4f\",\"凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰\"],\n[\"9fa1\",\"椬叚鰊鴂䰻陁榀傦畆𡝭駚剳\"],\n[\"9fae\",\"酙隁酜\"],\n[\"9fb2\",\"酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽\"],\n[\"9fc1\",\"𤤙盖鮝个𠳔莾衂\"],\n[\"9fc9\",\"届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳\"],\n[\"9fdb\",\"歒酼龥鮗頮颴骺麨麄煺笔\"],\n[\"9fe7\",\"毺蠘罸\"],\n[\"9feb\",\"嘠𪙊蹷齓\"],\n[\"9ff0\",\"跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇\"],\n[\"a040\",\"𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷\"],\n[\"a055\",\"𡠻𦸅\"],\n[\"a058\",\"詾𢔛\"],\n[\"a05b\",\"惽癧髗鵄鍮鮏蟵\"],\n[\"a063\",\"蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽\"],\n[\"a073\",\"坟慯抦戹拎㩜懢厪𣏵捤栂㗒\"],\n[\"a0a1\",\"嵗𨯂迚𨸹\"],\n[\"a0a6\",\"僙𡵆礆匲阸𠼻䁥\"],\n[\"a0ae\",\"矾\"],\n[\"a0b0\",\"糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦\"],\n[\"a0d4\",\"覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷\"],\n[\"a0e2\",\"罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫\"],\n[\"a3c0\",\"␀\",31,\"␡\"],\n[\"c6a1\",\"①\",9,\"⑴\",9,\"ⅰ\",9,\"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー［］✽ぁ\",23],\n[\"c740\",\"す\",58,\"ァアィイ\"],\n[\"c7a1\",\"ゥ\",81,\"А\",5,\"ЁЖ\",4],\n[\"c840\",\"Л\",26,\"ёж\",25,\"⇧↸↹㇏𠃌乚𠂊刂䒑\"],\n[\"c8a1\",\"龰冈龱𧘇\"],\n[\"c8cd\",\"￢￤＇＂㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣\"],\n[\"c8f5\",\"ʃɐɛɔɵœøŋʊɪ\"],\n[\"f9fe\",\"￭\"],\n[\"fa40\",\"𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸\"],\n[\"faa1\",\"鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍\"],\n[\"fb40\",\"𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙\"],\n[\"fba1\",\"𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂\"],\n[\"fc40\",\"廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷\"],\n[\"fca1\",\"𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝\"],\n[\"fd40\",\"𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀\"],\n[\"fda1\",\"𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎\"],\n[\"fe40\",\"鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌\"],\n[\"fea1\",\"𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔\"]\n]\n\n},{}],18:[function(require,module,exports){\nmodule.exports=[\n[\"0\",\"\\u0000\",127,\"€\"],\n[\"8140\",\"丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪\",5,\"乲乴\",9,\"乿\",6,\"亇亊\"],\n[\"8180\",\"亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂\",6,\"伋伌伒\",4,\"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾\",4,\"佄佅佇\",5,\"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢\"],\n[\"8240\",\"侤侫侭侰\",4,\"侶\",8,\"俀俁係俆俇俈俉俋俌俍俒\",4,\"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿\",11],\n[\"8280\",\"個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯\",10,\"倻倽倿偀偁偂偄偅偆偉偊偋偍偐\",4,\"偖偗偘偙偛偝\",7,\"偦\",5,\"偭\",8,\"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎\",20,\"傤傦傪傫傭\",4,\"傳\",6,\"傼\"],\n[\"8340\",\"傽\",17,\"僐\",5,\"僗僘僙僛\",10,\"僨僩僪僫僯僰僱僲僴僶\",4,\"僼\",9,\"儈\"],\n[\"8380\",\"儉儊儌\",5,\"儓\",13,\"儢\",28,\"兂兇兊兌兎兏児兒兓兗兘兙兛兝\",4,\"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦\",4,\"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒\",5],\n[\"8440\",\"凘凙凚凜凞凟凢凣凥\",5,\"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄\",5,\"剋剎剏剒剓剕剗剘\"],\n[\"8480\",\"剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳\",9,\"剾劀劃\",4,\"劉\",6,\"劑劒劔\",6,\"劜劤劥劦劧劮劯劰労\",9,\"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務\",5,\"勠勡勢勣勥\",10,\"勱\",7,\"勻勼勽匁匂匃匄匇匉匊匋匌匎\"],\n[\"8540\",\"匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯\",9,\"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏\"],\n[\"8580\",\"厐\",4,\"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯\",6,\"厷厸厹厺厼厽厾叀參\",4,\"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝\",4,\"呣呥呧呩\",7,\"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡\"],\n[\"8640\",\"咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠\",4,\"哫哬哯哰哱哴\",5,\"哻哾唀唂唃唄唅唈唊\",4,\"唒唓唕\",5,\"唜唝唞唟唡唥唦\"],\n[\"8680\",\"唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋\",4,\"啑啒啓啔啗\",4,\"啝啞啟啠啢啣啨啩啫啯\",5,\"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠\",6,\"喨\",8,\"喲喴営喸喺喼喿\",4,\"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗\",4,\"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸\",4,\"嗿嘂嘃嘄嘅\"],\n[\"8740\",\"嘆嘇嘊嘋嘍嘐\",7,\"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀\",11,\"噏\",4,\"噕噖噚噛噝\",4],\n[\"8780\",\"噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽\",7,\"嚇\",6,\"嚐嚑嚒嚔\",14,\"嚤\",10,\"嚰\",6,\"嚸嚹嚺嚻嚽\",12,\"囋\",8,\"囕囖囘囙囜団囥\",5,\"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國\",6],\n[\"8840\",\"園\",9,\"圝圞圠圡圢圤圥圦圧圫圱圲圴\",4,\"圼圽圿坁坃坄坅坆坈坉坋坒\",4,\"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀\"],\n[\"8880\",\"垁垇垈垉垊垍\",4,\"垔\",6,\"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹\",8,\"埄\",6,\"埌埍埐埑埓埖埗埛埜埞埡埢埣埥\",7,\"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥\",4,\"堫\",4,\"報堲堳場堶\",7],\n[\"8940\",\"堾\",5,\"塅\",6,\"塎塏塐塒塓塕塖塗塙\",4,\"塟\",5,\"塦\",4,\"塭\",16,\"塿墂墄墆墇墈墊墋墌\"],\n[\"8980\",\"墍\",4,\"墔\",4,\"墛墜墝墠\",7,\"墪\",17,\"墽墾墿壀壂壃壄壆\",10,\"壒壓壔壖\",13,\"壥\",5,\"壭壯壱売壴壵壷壸壺\",7,\"夃夅夆夈\",4,\"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻\"],\n[\"8a40\",\"夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛\",4,\"奡奣奤奦\",12,\"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦\"],\n[\"8a80\",\"妧妬妭妰妱妳\",5,\"妺妼妽妿\",6,\"姇姈姉姌姍姎姏姕姖姙姛姞\",4,\"姤姦姧姩姪姫姭\",11,\"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪\",6,\"娳娵娷\",4,\"娽娾娿婁\",4,\"婇婈婋\",9,\"婖婗婘婙婛\",5],\n[\"8b40\",\"婡婣婤婥婦婨婩婫\",8,\"婸婹婻婼婽婾媀\",17,\"媓\",6,\"媜\",13,\"媫媬\"],\n[\"8b80\",\"媭\",4,\"媴媶媷媹\",4,\"媿嫀嫃\",5,\"嫊嫋嫍\",4,\"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬\",4,\"嫲\",22,\"嬊\",11,\"嬘\",25,\"嬳嬵嬶嬸\",7,\"孁\",6],\n[\"8c40\",\"孈\",7,\"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏\"],\n[\"8c80\",\"寑寔\",8,\"寠寢寣實寧審\",4,\"寯寱\",6,\"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧\",6,\"屰屲\",6,\"屻屼屽屾岀岃\",4,\"岉岊岋岎岏岒岓岕岝\",4,\"岤\",4],\n[\"8d40\",\"岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅\",5,\"峌\",5,\"峓\",5,\"峚\",6,\"峢峣峧峩峫峬峮峯峱\",9,\"峼\",4],\n[\"8d80\",\"崁崄崅崈\",5,\"崏\",4,\"崕崗崘崙崚崜崝崟\",4,\"崥崨崪崫崬崯\",4,\"崵\",7,\"崿\",7,\"嵈嵉嵍\",10,\"嵙嵚嵜嵞\",10,\"嵪嵭嵮嵰嵱嵲嵳嵵\",12,\"嶃\",21,\"嶚嶛嶜嶞嶟嶠\"],\n[\"8e40\",\"嶡\",21,\"嶸\",12,\"巆\",6,\"巎\",12,\"巜巟巠巣巤巪巬巭\"],\n[\"8e80\",\"巰巵巶巸\",4,\"巿帀帄帇帉帊帋帍帎帒帓帗帞\",7,\"帨\",4,\"帯帰帲\",4,\"帹帺帾帿幀幁幃幆\",5,\"幍\",6,\"幖\",4,\"幜幝幟幠幣\",14,\"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨\",4,\"庮\",4,\"庴庺庻庼庽庿\",6],\n[\"8f40\",\"廆廇廈廋\",5,\"廔廕廗廘廙廚廜\",11,\"廩廫\",8,\"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤\"],\n[\"8f80\",\"弨弫弬弮弰弲\",6,\"弻弽弾弿彁\",14,\"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢\",5,\"復徫徬徯\",5,\"徶徸徹徺徻徾\",4,\"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇\"],\n[\"9040\",\"怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰\",4,\"怶\",4,\"怽怾恀恄\",6,\"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀\"],\n[\"9080\",\"悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽\",7,\"惇惈惉惌\",4,\"惒惓惔惖惗惙惛惞惡\",4,\"惪惱惲惵惷惸惻\",4,\"愂愃愄愅愇愊愋愌愐\",4,\"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬\",18,\"慀\",6],\n[\"9140\",\"慇慉態慍慏慐慒慓慔慖\",6,\"慞慟慠慡慣慤慥慦慩\",6,\"慱慲慳慴慶慸\",18,\"憌憍憏\",4,\"憕\"],\n[\"9180\",\"憖\",6,\"憞\",8,\"憪憫憭\",9,\"憸\",5,\"憿懀懁懃\",4,\"應懌\",4,\"懓懕\",16,\"懧\",13,\"懶\",8,\"戀\",5,\"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸\",4,\"扂扄扅扆扊\"],\n[\"9240\",\"扏扐払扖扗扙扚扜\",6,\"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋\",5,\"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁\"],\n[\"9280\",\"拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳\",5,\"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖\",7,\"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙\",6,\"採掤掦掫掯掱掲掵掶掹掻掽掿揀\"],\n[\"9340\",\"揁揂揃揅揇揈揊揋揌揑揓揔揕揗\",6,\"揟揢揤\",4,\"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆\",4,\"損搎搑搒搕\",5,\"搝搟搢搣搤\"],\n[\"9380\",\"搥搧搨搩搫搮\",5,\"搵\",4,\"搻搼搾摀摂摃摉摋\",6,\"摓摕摖摗摙\",4,\"摟\",7,\"摨摪摫摬摮\",9,\"摻\",6,\"撃撆撈\",8,\"撓撔撗撘撚撛撜撝撟\",4,\"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆\",6,\"擏擑擓擔擕擖擙據\"],\n[\"9440\",\"擛擜擝擟擠擡擣擥擧\",24,\"攁\",7,\"攊\",7,\"攓\",4,\"攙\",8],\n[\"9480\",\"攢攣攤攦\",4,\"攬攭攰攱攲攳攷攺攼攽敀\",4,\"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數\",14,\"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱\",7,\"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘\",7,\"旡旣旤旪旫\"],\n[\"9540\",\"旲旳旴旵旸旹旻\",4,\"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷\",4,\"昽昿晀時晄\",6,\"晍晎晐晑晘\"],\n[\"9580\",\"晙晛晜晝晞晠晢晣晥晧晩\",4,\"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘\",4,\"暞\",8,\"暩\",4,\"暯\",4,\"暵暶暷暸暺暻暼暽暿\",25,\"曚曞\",7,\"曧曨曪\",5,\"曱曵曶書曺曻曽朁朂會\"],\n[\"9640\",\"朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠\",5,\"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗\",4,\"杝杢杣杤杦杧杫杬杮東杴杶\"],\n[\"9680\",\"杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹\",7,\"柂柅\",9,\"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵\",7,\"柾栁栂栃栄栆栍栐栒栔栕栘\",4,\"栞栟栠栢\",6,\"栫\",6,\"栴栵栶栺栻栿桇桋桍桏桒桖\",5],\n[\"9740\",\"桜桝桞桟桪桬\",7,\"桵桸\",8,\"梂梄梇\",7,\"梐梑梒梔梕梖梘\",9,\"梣梤梥梩梪梫梬梮梱梲梴梶梷梸\"],\n[\"9780\",\"梹\",6,\"棁棃\",5,\"棊棌棎棏棐棑棓棔棖棗棙棛\",4,\"棡棢棤\",9,\"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆\",4,\"椌椏椑椓\",11,\"椡椢椣椥\",7,\"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃\",16,\"楕楖楘楙楛楜楟\"],\n[\"9840\",\"楡楢楤楥楧楨楩楪楬業楯楰楲\",4,\"楺楻楽楾楿榁榃榅榊榋榌榎\",5,\"榖榗榙榚榝\",9,\"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽\"],\n[\"9880\",\"榾榿槀槂\",7,\"構槍槏槑槒槓槕\",5,\"槜槝槞槡\",11,\"槮槯槰槱槳\",9,\"槾樀\",9,\"樋\",11,\"標\",5,\"樠樢\",5,\"権樫樬樭樮樰樲樳樴樶\",6,\"樿\",4,\"橅橆橈\",7,\"橑\",6,\"橚\"],\n[\"9940\",\"橜\",4,\"橢橣橤橦\",10,\"橲\",6,\"橺橻橽橾橿檁檂檃檅\",8,\"檏檒\",4,\"檘\",7,\"檡\",5],\n[\"9980\",\"檧檨檪檭\",114,\"欥欦欨\",6],\n[\"9a40\",\"欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍\",11,\"歚\",7,\"歨歩歫\",13,\"歺歽歾歿殀殅殈\"],\n[\"9a80\",\"殌殎殏殐殑殔殕殗殘殙殜\",4,\"殢\",7,\"殫\",7,\"殶殸\",6,\"毀毃毄毆\",4,\"毌毎毐毑毘毚毜\",4,\"毢\",7,\"毬毭毮毰毱毲毴毶毷毸毺毻毼毾\",6,\"氈\",4,\"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋\",4,\"汑汒汓汖汘\"],\n[\"9b40\",\"汙汚汢汣汥汦汧汫\",4,\"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘\"],\n[\"9b80\",\"泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟\",5,\"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽\",4,\"涃涄涆涇涊涋涍涏涐涒涖\",4,\"涜涢涥涬涭涰涱涳涴涶涷涹\",5,\"淁淂淃淈淉淊\"],\n[\"9c40\",\"淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽\",7,\"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵\"],\n[\"9c80\",\"渶渷渹渻\",7,\"湅\",7,\"湏湐湑湒湕湗湙湚湜湝湞湠\",10,\"湬湭湯\",14,\"満溁溂溄溇溈溊\",4,\"溑\",6,\"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪\",5],\n[\"9d40\",\"滰滱滲滳滵滶滷滸滺\",7,\"漃漄漅漇漈漊\",4,\"漐漑漒漖\",9,\"漡漢漣漥漦漧漨漬漮漰漲漴漵漷\",6,\"漿潀潁潂\"],\n[\"9d80\",\"潃潄潅潈潉潊潌潎\",9,\"潙潚潛潝潟潠潡潣潤潥潧\",5,\"潯潰潱潳潵潶潷潹潻潽\",6,\"澅澆澇澊澋澏\",12,\"澝澞澟澠澢\",4,\"澨\",10,\"澴澵澷澸澺\",5,\"濁濃\",5,\"濊\",6,\"濓\",10,\"濟濢濣濤濥\"],\n[\"9e40\",\"濦\",7,\"濰\",32,\"瀒\",7,\"瀜\",6,\"瀤\",6],\n[\"9e80\",\"瀫\",9,\"瀶瀷瀸瀺\",17,\"灍灎灐\",13,\"灟\",11,\"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞\",12,\"炰炲炴炵炶為炾炿烄烅烆烇烉烋\",12,\"烚\"],\n[\"9f40\",\"烜烝烞烠烡烢烣烥烪烮烰\",6,\"烸烺烻烼烾\",10,\"焋\",4,\"焑焒焔焗焛\",10,\"焧\",7,\"焲焳焴\"],\n[\"9f80\",\"焵焷\",13,\"煆煇煈煉煋煍煏\",12,\"煝煟\",4,\"煥煩\",4,\"煯煰煱煴煵煶煷煹煻煼煾\",5,\"熅\",4,\"熋熌熍熎熐熑熒熓熕熖熗熚\",4,\"熡\",6,\"熩熪熫熭\",5,\"熴熶熷熸熺\",8,\"燄\",9,\"燏\",4],\n[\"a040\",\"燖\",9,\"燡燢燣燤燦燨\",5,\"燯\",9,\"燺\",11,\"爇\",19],\n[\"a080\",\"爛爜爞\",9,\"爩爫爭爮爯爲爳爴爺爼爾牀\",6,\"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅\",4,\"犌犎犐犑犓\",11,\"犠\",11,\"犮犱犲犳犵犺\",6,\"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛\"],\n[\"a1a1\",\"　、。·ˉˇ¨〃々—～‖…‘’“”〔〕〈\",7,\"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃＄¤￠￡‰§№☆★○●◎◇◆□■△▲※→←↑↓〓\"],\n[\"a2a1\",\"ⅰ\",9],\n[\"a2b1\",\"⒈\",19,\"⑴\",19,\"①\",9],\n[\"a2e5\",\"㈠\",9],\n[\"a2f1\",\"Ⅰ\",11],\n[\"a3a1\",\"！＂＃￥％\",88,\"￣\"],\n[\"a4a1\",\"ぁ\",82],\n[\"a5a1\",\"ァ\",85],\n[\"a6a1\",\"Α\",16,\"Σ\",6],\n[\"a6c1\",\"α\",16,\"σ\",6],\n[\"a6e0\",\"︵︶︹︺︿﹀︽︾﹁﹂﹃﹄\"],\n[\"a6ee\",\"︻︼︷︸︱\"],\n[\"a6f4\",\"︳︴\"],\n[\"a7a1\",\"А\",5,\"ЁЖ\",25],\n[\"a7d1\",\"а\",5,\"ёж\",25],\n[\"a840\",\"ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═\",35,\"▁\",6],\n[\"a880\",\"█\",7,\"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞\"],\n[\"a8a1\",\"āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ\"],\n[\"a8bd\",\"ńň\"],\n[\"a8c0\",\"ɡ\"],\n[\"a8c5\",\"ㄅ\",36],\n[\"a940\",\"〡\",8,\"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰￢￤\"],\n[\"a959\",\"℡㈱\"],\n[\"a95c\",\"‐\"],\n[\"a960\",\"ー゛゜ヽヾ〆ゝゞ﹉\",9,\"﹔﹕﹖﹗﹙\",8],\n[\"a980\",\"﹢\",4,\"﹨﹩﹪﹫\"],\n[\"a996\",\"〇\"],\n[\"a9a4\",\"─\",75],\n[\"aa40\",\"狜狝狟狢\",5,\"狪狫狵狶狹狽狾狿猀猂猄\",5,\"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀\",8],\n[\"aa80\",\"獉獊獋獌獎獏獑獓獔獕獖獘\",7,\"獡\",10,\"獮獰獱\"],\n[\"ab40\",\"獲\",11,\"獿\",4,\"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣\",5,\"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃\",4],\n[\"ab80\",\"珋珌珎珒\",6,\"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳\",4],\n[\"ac40\",\"珸\",10,\"琄琇琈琋琌琍琎琑\",8,\"琜\",5,\"琣琤琧琩琫琭琯琱琲琷\",4,\"琽琾琿瑀瑂\",11],\n[\"ac80\",\"瑎\",6,\"瑖瑘瑝瑠\",12,\"瑮瑯瑱\",4,\"瑸瑹瑺\"],\n[\"ad40\",\"瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑\",10,\"璝璟\",7,\"璪\",15,\"璻\",12],\n[\"ad80\",\"瓈\",9,\"瓓\",8,\"瓝瓟瓡瓥瓧\",6,\"瓰瓱瓲\"],\n[\"ae40\",\"瓳瓵瓸\",6,\"甀甁甂甃甅\",7,\"甎甐甒甔甕甖甗甛甝甞甠\",4,\"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘\"],\n[\"ae80\",\"畝\",7,\"畧畨畩畫\",6,\"畳畵當畷畺\",4,\"疀疁疂疄疅疇\"],\n[\"af40\",\"疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦\",4,\"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇\"],\n[\"af80\",\"瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄\"],\n[\"b040\",\"癅\",6,\"癎\",5,\"癕癗\",4,\"癝癟癠癡癢癤\",6,\"癬癭癮癰\",7,\"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛\"],\n[\"b080\",\"皜\",7,\"皥\",8,\"皯皰皳皵\",9,\"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥\"],\n[\"b140\",\"盄盇盉盋盌盓盕盙盚盜盝盞盠\",4,\"盦\",7,\"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎\",10,\"眛眜眝眞眡眣眤眥眧眪眫\"],\n[\"b180\",\"眬眮眰\",4,\"眹眻眽眾眿睂睄睅睆睈\",7,\"睒\",7,\"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳\"],\n[\"b240\",\"睝睞睟睠睤睧睩睪睭\",11,\"睺睻睼瞁瞂瞃瞆\",5,\"瞏瞐瞓\",11,\"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶\",4],\n[\"b280\",\"瞼瞾矀\",12,\"矎\",8,\"矘矙矚矝\",4,\"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖\"],\n[\"b340\",\"矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃\",5,\"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚\"],\n[\"b380\",\"硛硜硞\",11,\"硯\",7,\"硸硹硺硻硽\",6,\"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚\"],\n[\"b440\",\"碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨\",7,\"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚\",9],\n[\"b480\",\"磤磥磦磧磩磪磫磭\",4,\"磳磵磶磸磹磻\",5,\"礂礃礄礆\",6,\"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮\"],\n[\"b540\",\"礍\",5,\"礔\",9,\"礟\",4,\"礥\",14,\"礵\",4,\"礽礿祂祃祄祅祇祊\",8,\"祔祕祘祙祡祣\"],\n[\"b580\",\"祤祦祩祪祫祬祮祰\",6,\"祹祻\",4,\"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠\"],\n[\"b640\",\"禓\",6,\"禛\",11,\"禨\",10,\"禴\",4,\"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙\",5,\"秠秡秢秥秨秪\"],\n[\"b680\",\"秬秮秱\",6,\"秹秺秼秾秿稁稄稅稇稈稉稊稌稏\",4,\"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二\"],\n[\"b740\",\"稝稟稡稢稤\",14,\"稴稵稶稸稺稾穀\",5,\"穇\",9,\"穒\",4,\"穘\",16],\n[\"b780\",\"穩\",6,\"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服\"],\n[\"b840\",\"窣窤窧窩窪窫窮\",4,\"窴\",10,\"竀\",10,\"竌\",9,\"竗竘竚竛竜竝竡竢竤竧\",5,\"竮竰竱竲竳\"],\n[\"b880\",\"竴\",4,\"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹\"],\n[\"b940\",\"笯笰笲笴笵笶笷笹笻笽笿\",5,\"筆筈筊筍筎筓筕筗筙筜筞筟筡筣\",10,\"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆\",6,\"箎箏\"],\n[\"b980\",\"箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹\",7,\"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈\"],\n[\"ba40\",\"篅篈築篊篋篍篎篏篐篒篔\",4,\"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲\",4,\"篸篹篺篻篽篿\",7,\"簈簉簊簍簎簐\",5,\"簗簘簙\"],\n[\"ba80\",\"簚\",4,\"簠\",5,\"簨簩簫\",12,\"簹\",5,\"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖\"],\n[\"bb40\",\"籃\",9,\"籎\",36,\"籵\",5,\"籾\",9],\n[\"bb80\",\"粈粊\",6,\"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴\",4,\"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕\"],\n[\"bc40\",\"粿糀糂糃糄糆糉糋糎\",6,\"糘糚糛糝糞糡\",6,\"糩\",5,\"糰\",7,\"糹糺糼\",13,\"紋\",5],\n[\"bc80\",\"紑\",14,\"紡紣紤紥紦紨紩紪紬紭紮細\",6,\"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件\"],\n[\"bd40\",\"紷\",54,\"絯\",7],\n[\"bd80\",\"絸\",32,\"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸\"],\n[\"be40\",\"継\",12,\"綧\",6,\"綯\",42],\n[\"be80\",\"線\",32,\"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻\"],\n[\"bf40\",\"緻\",62],\n[\"bf80\",\"縺縼\",4,\"繂\",4,\"繈\",21,\"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀\"],\n[\"c040\",\"繞\",35,\"纃\",23,\"纜纝纞\"],\n[\"c080\",\"纮纴纻纼绖绤绬绹缊缐缞缷缹缻\",6,\"罃罆\",9,\"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐\"],\n[\"c140\",\"罖罙罛罜罝罞罠罣\",4,\"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂\",7,\"羋羍羏\",4,\"羕\",4,\"羛羜羠羢羣羥羦羨\",6,\"羱\"],\n[\"c180\",\"羳\",4,\"羺羻羾翀翂翃翄翆翇翈翉翋翍翏\",4,\"翖翗翙\",5,\"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿\"],\n[\"c240\",\"翤翧翨翪翫翬翭翯翲翴\",6,\"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫\",5,\"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗\"],\n[\"c280\",\"聙聛\",13,\"聫\",5,\"聲\",11,\"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫\"],\n[\"c340\",\"聾肁肂肅肈肊肍\",5,\"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇\",4,\"胏\",6,\"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋\"],\n[\"c380\",\"脌脕脗脙脛脜脝脟\",12,\"脭脮脰脳脴脵脷脹\",4,\"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸\"],\n[\"c440\",\"腀\",5,\"腇腉腍腎腏腒腖腗腘腛\",4,\"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃\",4,\"膉膋膌膍膎膐膒\",5,\"膙膚膞\",4,\"膤膥\"],\n[\"c480\",\"膧膩膫\",7,\"膴\",5,\"膼膽膾膿臄臅臇臈臉臋臍\",6,\"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁\"],\n[\"c540\",\"臔\",14,\"臤臥臦臨臩臫臮\",4,\"臵\",5,\"臽臿舃與\",4,\"舎舏舑舓舕\",5,\"舝舠舤舥舦舧舩舮舲舺舼舽舿\"],\n[\"c580\",\"艀艁艂艃艅艆艈艊艌艍艎艐\",7,\"艙艛艜艝艞艠\",7,\"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗\"],\n[\"c640\",\"艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸\"],\n[\"c680\",\"苺苼\",4,\"茊茋茍茐茒茓茖茘茙茝\",9,\"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐\"],\n[\"c740\",\"茾茿荁荂荄荅荈荊\",4,\"荓荕\",4,\"荝荢荰\",6,\"荹荺荾\",6,\"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡\",6,\"莬莭莮\"],\n[\"c780\",\"莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠\"],\n[\"c840\",\"菮華菳\",4,\"菺菻菼菾菿萀萂萅萇萈萉萊萐萒\",5,\"萙萚萛萞\",5,\"萩\",7,\"萲\",5,\"萹萺萻萾\",7,\"葇葈葉\"],\n[\"c880\",\"葊\",6,\"葒\",4,\"葘葝葞葟葠葢葤\",4,\"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁\"],\n[\"c940\",\"葽\",4,\"蒃蒄蒅蒆蒊蒍蒏\",7,\"蒘蒚蒛蒝蒞蒟蒠蒢\",12,\"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗\"],\n[\"c980\",\"蓘\",4,\"蓞蓡蓢蓤蓧\",4,\"蓭蓮蓯蓱\",10,\"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳\"],\n[\"ca40\",\"蔃\",8,\"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢\",8,\"蔭\",9,\"蔾\",4,\"蕄蕅蕆蕇蕋\",10],\n[\"ca80\",\"蕗蕘蕚蕛蕜蕝蕟\",4,\"蕥蕦蕧蕩\",8,\"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱\"],\n[\"cb40\",\"薂薃薆薈\",6,\"薐\",10,\"薝\",6,\"薥薦薧薩薫薬薭薱\",5,\"薸薺\",6,\"藂\",6,\"藊\",4,\"藑藒\"],\n[\"cb80\",\"藔藖\",5,\"藝\",6,\"藥藦藧藨藪\",14,\"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔\"],\n[\"cc40\",\"藹藺藼藽藾蘀\",4,\"蘆\",10,\"蘒蘓蘔蘕蘗\",15,\"蘨蘪\",13,\"蘹蘺蘻蘽蘾蘿虀\"],\n[\"cc80\",\"虁\",11,\"虒虓處\",4,\"虛虜虝號虠虡虣\",7,\"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃\"],\n[\"cd40\",\"虭虯虰虲\",6,\"蚃\",6,\"蚎\",4,\"蚔蚖\",5,\"蚞\",4,\"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻\",4,\"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜\"],\n[\"cd80\",\"蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威\"],\n[\"ce40\",\"蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀\",6,\"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚\",5,\"蝡蝢蝦\",7,\"蝯蝱蝲蝳蝵\"],\n[\"ce80\",\"蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎\",4,\"螔螕螖螘\",6,\"螠\",4,\"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺\"],\n[\"cf40\",\"螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁\",4,\"蟇蟈蟉蟌\",4,\"蟔\",6,\"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯\",9],\n[\"cf80\",\"蟺蟻蟼蟽蟿蠀蠁蠂蠄\",5,\"蠋\",7,\"蠔蠗蠘蠙蠚蠜\",4,\"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓\"],\n[\"d040\",\"蠤\",13,\"蠳\",5,\"蠺蠻蠽蠾蠿衁衂衃衆\",5,\"衎\",5,\"衕衖衘衚\",6,\"衦衧衪衭衯衱衳衴衵衶衸衹衺\"],\n[\"d080\",\"衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗\",4,\"袝\",4,\"袣袥\",5,\"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄\"],\n[\"d140\",\"袬袮袯袰袲\",4,\"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚\",4,\"裠裡裦裧裩\",6,\"裲裵裶裷裺裻製裿褀褁褃\",5],\n[\"d180\",\"褉褋\",4,\"褑褔\",4,\"褜\",4,\"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶\"],\n[\"d240\",\"褸\",8,\"襂襃襅\",24,\"襠\",5,\"襧\",19,\"襼\"],\n[\"d280\",\"襽襾覀覂覄覅覇\",26,\"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐\"],\n[\"d340\",\"覢\",30,\"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴\",6],\n[\"d380\",\"觻\",4,\"訁\",5,\"計\",21,\"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉\"],\n[\"d440\",\"訞\",31,\"訿\",8,\"詉\",21],\n[\"d480\",\"詟\",25,\"詺\",6,\"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧\"],\n[\"d540\",\"誁\",7,\"誋\",7,\"誔\",46],\n[\"d580\",\"諃\",32,\"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政\"],\n[\"d640\",\"諤\",34,\"謈\",27],\n[\"d680\",\"謤謥謧\",30,\"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑\"],\n[\"d740\",\"譆\",31,\"譧\",4,\"譭\",25],\n[\"d780\",\"讇\",24,\"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座\"],\n[\"d840\",\"谸\",8,\"豂豃豄豅豈豊豋豍\",7,\"豖豗豘豙豛\",5,\"豣\",6,\"豬\",6,\"豴豵豶豷豻\",6,\"貃貄貆貇\"],\n[\"d880\",\"貈貋貍\",6,\"貕貖貗貙\",20,\"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝\"],\n[\"d940\",\"貮\",62],\n[\"d980\",\"賭\",32,\"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼\"],\n[\"da40\",\"贎\",14,\"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸\",8,\"趂趃趆趇趈趉趌\",4,\"趒趓趕\",9,\"趠趡\"],\n[\"da80\",\"趢趤\",12,\"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺\"],\n[\"db40\",\"跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾\",6,\"踆踇踈踋踍踎踐踑踒踓踕\",7,\"踠踡踤\",4,\"踫踭踰踲踳踴踶踷踸踻踼踾\"],\n[\"db80\",\"踿蹃蹅蹆蹌\",4,\"蹓\",5,\"蹚\",11,\"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝\"],\n[\"dc40\",\"蹳蹵蹷\",4,\"蹽蹾躀躂躃躄躆躈\",6,\"躑躒躓躕\",6,\"躝躟\",11,\"躭躮躰躱躳\",6,\"躻\",7],\n[\"dc80\",\"軃\",10,\"軏\",21,\"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥\"],\n[\"dd40\",\"軥\",62],\n[\"dd80\",\"輤\",32,\"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺\"],\n[\"de40\",\"轅\",32,\"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆\"],\n[\"de80\",\"迉\",4,\"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖\"],\n[\"df40\",\"這逜連逤逥逧\",5,\"逰\",4,\"逷逹逺逽逿遀遃遅遆遈\",4,\"過達違遖遙遚遜\",5,\"遤遦遧適遪遫遬遯\",4,\"遶\",6,\"遾邁\"],\n[\"df80\",\"還邅邆邇邉邊邌\",4,\"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼\"],\n[\"e040\",\"郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅\",19,\"鄚鄛鄜\"],\n[\"e080\",\"鄝鄟鄠鄡鄤\",10,\"鄰鄲\",6,\"鄺\",8,\"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼\"],\n[\"e140\",\"酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀\",4,\"醆醈醊醎醏醓\",6,\"醜\",5,\"醤\",5,\"醫醬醰醱醲醳醶醷醸醹醻\"],\n[\"e180\",\"醼\",10,\"釈釋釐釒\",9,\"針\",8,\"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺\"],\n[\"e240\",\"釦\",62],\n[\"e280\",\"鈥\",32,\"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧\",5,\"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂\"],\n[\"e340\",\"鉆\",45,\"鉵\",16],\n[\"e380\",\"銆\",7,\"銏\",24,\"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾\"],\n[\"e440\",\"銨\",5,\"銯\",24,\"鋉\",31],\n[\"e480\",\"鋩\",32,\"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑\"],\n[\"e540\",\"錊\",51,\"錿\",10],\n[\"e580\",\"鍊\",31,\"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣\"],\n[\"e640\",\"鍬\",34,\"鎐\",27],\n[\"e680\",\"鎬\",29,\"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩\"],\n[\"e740\",\"鏎\",7,\"鏗\",54],\n[\"e780\",\"鐎\",32,\"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡\",6,\"缪缫缬缭缯\",4,\"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬\"],\n[\"e840\",\"鐯\",14,\"鐿\",43,\"鑬鑭鑮鑯\"],\n[\"e880\",\"鑰\",20,\"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹\"],\n[\"e940\",\"锧锳锽镃镈镋镕镚镠镮镴镵長\",7,\"門\",42],\n[\"e980\",\"閫\",32,\"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋\"],\n[\"ea40\",\"闌\",27,\"闬闿阇阓阘阛阞阠阣\",6,\"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗\"],\n[\"ea80\",\"陘陙陚陜陝陞陠陣陥陦陫陭\",4,\"陳陸\",12,\"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰\"],\n[\"eb40\",\"隌階隑隒隓隕隖隚際隝\",9,\"隨\",7,\"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖\",9,\"雡\",6,\"雫\"],\n[\"eb80\",\"雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗\",4,\"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻\"],\n[\"ec40\",\"霡\",8,\"霫霬霮霯霱霳\",4,\"霺霻霼霽霿\",18,\"靔靕靗靘靚靜靝靟靣靤靦靧靨靪\",7],\n[\"ec80\",\"靲靵靷\",4,\"靽\",7,\"鞆\",4,\"鞌鞎鞏鞐鞓鞕鞖鞗鞙\",4,\"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐\"],\n[\"ed40\",\"鞞鞟鞡鞢鞤\",6,\"鞬鞮鞰鞱鞳鞵\",46],\n[\"ed80\",\"韤韥韨韮\",4,\"韴韷\",23,\"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨\"],\n[\"ee40\",\"頏\",62],\n[\"ee80\",\"顎\",32,\"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶\",4,\"钼钽钿铄铈\",6,\"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪\"],\n[\"ef40\",\"顯\",5,\"颋颎颒颕颙颣風\",37,\"飏飐飔飖飗飛飜飝飠\",4],\n[\"ef80\",\"飥飦飩\",30,\"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒\",4,\"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤\",8,\"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔\"],\n[\"f040\",\"餈\",4,\"餎餏餑\",28,\"餯\",26],\n[\"f080\",\"饊\",9,\"饖\",12,\"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨\",4,\"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦\",6,\"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙\"],\n[\"f140\",\"馌馎馚\",10,\"馦馧馩\",47],\n[\"f180\",\"駙\",32,\"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃\"],\n[\"f240\",\"駺\",62],\n[\"f280\",\"騹\",32,\"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒\"],\n[\"f340\",\"驚\",17,\"驲骃骉骍骎骔骕骙骦骩\",6,\"骲骳骴骵骹骻骽骾骿髃髄髆\",4,\"髍髎髏髐髒體髕髖髗髙髚髛髜\"],\n[\"f380\",\"髝髞髠髢髣髤髥髧髨髩髪髬髮髰\",8,\"髺髼\",6,\"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋\"],\n[\"f440\",\"鬇鬉\",5,\"鬐鬑鬒鬔\",10,\"鬠鬡鬢鬤\",10,\"鬰鬱鬳\",7,\"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕\",5],\n[\"f480\",\"魛\",32,\"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤\"],\n[\"f540\",\"魼\",62],\n[\"f580\",\"鮻\",32,\"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜\"],\n[\"f640\",\"鯜\",62],\n[\"f680\",\"鰛\",32,\"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅\",5,\"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞\",5,\"鲥\",4,\"鲫鲭鲮鲰\",7,\"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋\"],\n[\"f740\",\"鰼\",62],\n[\"f780\",\"鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾\",4,\"鳈鳉鳑鳒鳚鳛鳠鳡鳌\",4,\"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄\"],\n[\"f840\",\"鳣\",62],\n[\"f880\",\"鴢\",32],\n[\"f940\",\"鵃\",62],\n[\"f980\",\"鶂\",32],\n[\"fa40\",\"鶣\",62],\n[\"fa80\",\"鷢\",32],\n[\"fb40\",\"鸃\",27,\"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴\",9,\"麀\"],\n[\"fb80\",\"麁麃麄麅麆麉麊麌\",5,\"麔\",8,\"麞麠\",5,\"麧麨麩麪\"],\n[\"fc40\",\"麫\",8,\"麵麶麷麹麺麼麿\",4,\"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰\",8,\"黺黽黿\",6],\n[\"fc80\",\"鼆\",4,\"鼌鼏鼑鼒鼔鼕鼖鼘鼚\",5,\"鼡鼣\",8,\"鼭鼮鼰鼱\"],\n[\"fd40\",\"鼲\",4,\"鼸鼺鼼鼿\",4,\"齅\",10,\"齒\",38],\n[\"fd80\",\"齹\",5,\"龁龂龍\",11,\"龜龝龞龡\",4,\"郎凉秊裏隣\"],\n[\"fe40\",\"兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩\"]\n]\n\n},{}],19:[function(require,module,exports){\nmodule.exports=[\n[\"0\",\"\\u0000\",127],\n[\"8141\",\"갂갃갅갆갋\",4,\"갘갞갟갡갢갣갥\",6,\"갮갲갳갴\"],\n[\"8161\",\"갵갶갷갺갻갽갾갿걁\",9,\"걌걎\",5,\"걕\"],\n[\"8181\",\"걖걗걙걚걛걝\",18,\"걲걳걵걶걹걻\",4,\"겂겇겈겍겎겏겑겒겓겕\",6,\"겞겢\",5,\"겫겭겮겱\",6,\"겺겾겿곀곂곃곅곆곇곉곊곋곍\",7,\"곖곘\",7,\"곢곣곥곦곩곫곭곮곲곴곷\",4,\"곾곿괁괂괃괅괇\",4,\"괎괐괒괓\"],\n[\"8241\",\"괔괕괖괗괙괚괛괝괞괟괡\",7,\"괪괫괮\",5],\n[\"8261\",\"괶괷괹괺괻괽\",6,\"굆굈굊\",5,\"굑굒굓굕굖굗\"],\n[\"8281\",\"굙\",7,\"굢굤\",7,\"굮굯굱굲굷굸굹굺굾궀궃\",4,\"궊궋궍궎궏궑\",10,\"궞\",5,\"궥\",17,\"궸\",7,\"귂귃귅귆귇귉\",6,\"귒귔\",7,\"귝귞귟귡귢귣귥\",18],\n[\"8341\",\"귺귻귽귾긂\",5,\"긊긌긎\",5,\"긕\",7],\n[\"8361\",\"긝\",18,\"긲긳긵긶긹긻긼\"],\n[\"8381\",\"긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗\",4,\"깞깢깣깤깦깧깪깫깭깮깯깱\",6,\"깺깾\",5,\"꺆\",5,\"꺍\",46,\"꺿껁껂껃껅\",6,\"껎껒\",5,\"껚껛껝\",8],\n[\"8441\",\"껦껧껩껪껬껮\",5,\"껵껶껷껹껺껻껽\",8],\n[\"8461\",\"꼆꼉꼊꼋꼌꼎꼏꼑\",18],\n[\"8481\",\"꼤\",7,\"꼮꼯꼱꼳꼵\",6,\"꼾꽀꽄꽅꽆꽇꽊\",5,\"꽑\",10,\"꽞\",5,\"꽦\",18,\"꽺\",5,\"꾁꾂꾃꾅꾆꾇꾉\",6,\"꾒꾓꾔꾖\",5,\"꾝\",26,\"꾺꾻꾽꾾\"],\n[\"8541\",\"꾿꿁\",5,\"꿊꿌꿏\",4,\"꿕\",6,\"꿝\",4],\n[\"8561\",\"꿢\",5,\"꿪\",5,\"꿲꿳꿵꿶꿷꿹\",6,\"뀂뀃\"],\n[\"8581\",\"뀅\",6,\"뀍뀎뀏뀑뀒뀓뀕\",6,\"뀞\",9,\"뀩\",26,\"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞\",29,\"끾끿낁낂낃낅\",6,\"낎낐낒\",5,\"낛낝낞낣낤\"],\n[\"8641\",\"낥낦낧낪낰낲낶낷낹낺낻낽\",6,\"냆냊\",5,\"냒\"],\n[\"8661\",\"냓냕냖냗냙\",6,\"냡냢냣냤냦\",10],\n[\"8681\",\"냱\",22,\"넊넍넎넏넑넔넕넖넗넚넞\",4,\"넦넧넩넪넫넭\",6,\"넶넺\",5,\"녂녃녅녆녇녉\",6,\"녒녓녖녗녙녚녛녝녞녟녡\",22,\"녺녻녽녾녿놁놃\",4,\"놊놌놎놏놐놑놕놖놗놙놚놛놝\"],\n[\"8741\",\"놞\",9,\"놩\",15],\n[\"8761\",\"놹\",18,\"뇍뇎뇏뇑뇒뇓뇕\"],\n[\"8781\",\"뇖\",5,\"뇞뇠\",7,\"뇪뇫뇭뇮뇯뇱\",7,\"뇺뇼뇾\",5,\"눆눇눉눊눍\",6,\"눖눘눚\",5,\"눡\",18,\"눵\",6,\"눽\",26,\"뉙뉚뉛뉝뉞뉟뉡\",6,\"뉪\",4],\n[\"8841\",\"뉯\",4,\"뉶\",5,\"뉽\",6,\"늆늇늈늊\",4],\n[\"8861\",\"늏늒늓늕늖늗늛\",4,\"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷\"],\n[\"8881\",\"늸\",15,\"닊닋닍닎닏닑닓\",4,\"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉\",6,\"댒댖\",5,\"댝\",54,\"덗덙덚덝덠덡덢덣\"],\n[\"8941\",\"덦덨덪덬덭덯덲덳덵덶덷덹\",6,\"뎂뎆\",5,\"뎍\"],\n[\"8961\",\"뎎뎏뎑뎒뎓뎕\",10,\"뎢\",5,\"뎩뎪뎫뎭\"],\n[\"8981\",\"뎮\",21,\"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩\",18,\"돽\",18,\"됑\",6,\"됙됚됛됝됞됟됡\",6,\"됪됬\",7,\"됵\",15],\n[\"8a41\",\"둅\",10,\"둒둓둕둖둗둙\",6,\"둢둤둦\"],\n[\"8a61\",\"둧\",4,\"둭\",18,\"뒁뒂\"],\n[\"8a81\",\"뒃\",4,\"뒉\",19,\"뒞\",5,\"뒥뒦뒧뒩뒪뒫뒭\",7,\"뒶뒸뒺\",5,\"듁듂듃듅듆듇듉\",6,\"듑듒듓듔듖\",5,\"듞듟듡듢듥듧\",4,\"듮듰듲\",5,\"듹\",26,\"딖딗딙딚딝\"],\n[\"8b41\",\"딞\",5,\"딦딫\",4,\"딲딳딵딶딷딹\",6,\"땂땆\"],\n[\"8b61\",\"땇땈땉땊땎땏땑땒땓땕\",6,\"땞땢\",8],\n[\"8b81\",\"땫\",52,\"떢떣떥떦떧떩떬떭떮떯떲떶\",4,\"떾떿뗁뗂뗃뗅\",6,\"뗎뗒\",5,\"뗙\",18,\"뗭\",18],\n[\"8c41\",\"똀\",15,\"똒똓똕똖똗똙\",4],\n[\"8c61\",\"똞\",6,\"똦\",5,\"똭\",6,\"똵\",5],\n[\"8c81\",\"똻\",12,\"뙉\",26,\"뙥뙦뙧뙩\",50,\"뚞뚟뚡뚢뚣뚥\",5,\"뚭뚮뚯뚰뚲\",16],\n[\"8d41\",\"뛃\",16,\"뛕\",8],\n[\"8d61\",\"뛞\",17,\"뛱뛲뛳뛵뛶뛷뛹뛺\"],\n[\"8d81\",\"뛻\",4,\"뜂뜃뜄뜆\",33,\"뜪뜫뜭뜮뜱\",6,\"뜺뜼\",7,\"띅띆띇띉띊띋띍\",6,\"띖\",9,\"띡띢띣띥띦띧띩\",6,\"띲띴띶\",5,\"띾띿랁랂랃랅\",6,\"랎랓랔랕랚랛랝랞\"],\n[\"8e41\",\"랟랡\",6,\"랪랮\",5,\"랶랷랹\",8],\n[\"8e61\",\"럂\",4,\"럈럊\",19],\n[\"8e81\",\"럞\",13,\"럮럯럱럲럳럵\",6,\"럾렂\",4,\"렊렋렍렎렏렑\",6,\"렚렜렞\",5,\"렦렧렩렪렫렭\",6,\"렶렺\",5,\"롁롂롃롅\",11,\"롒롔\",7,\"롞롟롡롢롣롥\",6,\"롮롰롲\",5,\"롹롺롻롽\",7],\n[\"8f41\",\"뢅\",7,\"뢎\",17],\n[\"8f61\",\"뢠\",7,\"뢩\",6,\"뢱뢲뢳뢵뢶뢷뢹\",4],\n[\"8f81\",\"뢾뢿룂룄룆\",5,\"룍룎룏룑룒룓룕\",7,\"룞룠룢\",5,\"룪룫룭룮룯룱\",6,\"룺룼룾\",5,\"뤅\",18,\"뤙\",6,\"뤡\",26,\"뤾뤿륁륂륃륅\",6,\"륍륎륐륒\",5],\n[\"9041\",\"륚륛륝륞륟륡\",6,\"륪륬륮\",5,\"륶륷륹륺륻륽\"],\n[\"9061\",\"륾\",5,\"릆릈릋릌릏\",15],\n[\"9081\",\"릟\",12,\"릮릯릱릲릳릵\",6,\"릾맀맂\",5,\"맊맋맍맓\",4,\"맚맜맟맠맢맦맧맩맪맫맭\",6,\"맶맻\",4,\"먂\",5,\"먉\",11,\"먖\",33,\"먺먻먽먾먿멁멃멄멅멆\"],\n[\"9141\",\"멇멊멌멏멐멑멒멖멗멙멚멛멝\",6,\"멦멪\",5],\n[\"9161\",\"멲멳멵멶멷멹\",9,\"몆몈몉몊몋몍\",5],\n[\"9181\",\"몓\",20,\"몪몭몮몯몱몳\",4,\"몺몼몾\",5,\"뫅뫆뫇뫉\",14,\"뫚\",33,\"뫽뫾뫿묁묂묃묅\",7,\"묎묐묒\",5,\"묙묚묛묝묞묟묡\",6],\n[\"9241\",\"묨묪묬\",7,\"묷묹묺묿\",4,\"뭆뭈뭊뭋뭌뭎뭑뭒\"],\n[\"9261\",\"뭓뭕뭖뭗뭙\",7,\"뭢뭤\",7,\"뭭\",4],\n[\"9281\",\"뭲\",21,\"뮉뮊뮋뮍뮎뮏뮑\",18,\"뮥뮦뮧뮩뮪뮫뮭\",6,\"뮵뮶뮸\",7,\"믁믂믃믅믆믇믉\",6,\"믑믒믔\",35,\"믺믻믽믾밁\"],\n[\"9341\",\"밃\",4,\"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵\"],\n[\"9361\",\"밶밷밹\",6,\"뱂뱆뱇뱈뱊뱋뱎뱏뱑\",8],\n[\"9381\",\"뱚뱛뱜뱞\",37,\"벆벇벉벊벍벏\",4,\"벖벘벛\",4,\"벢벣벥벦벩\",6,\"벲벶\",5,\"벾벿볁볂볃볅\",7,\"볎볒볓볔볖볗볙볚볛볝\",22,\"볷볹볺볻볽\"],\n[\"9441\",\"볾\",5,\"봆봈봊\",5,\"봑봒봓봕\",8],\n[\"9461\",\"봞\",5,\"봥\",6,\"봭\",12],\n[\"9481\",\"봺\",5,\"뵁\",6,\"뵊뵋뵍뵎뵏뵑\",6,\"뵚\",9,\"뵥뵦뵧뵩\",22,\"붂붃붅붆붋\",4,\"붒붔붖붗붘붛붝\",6,\"붥\",10,\"붱\",6,\"붹\",24],\n[\"9541\",\"뷒뷓뷖뷗뷙뷚뷛뷝\",11,\"뷪\",5,\"뷱\"],\n[\"9561\",\"뷲뷳뷵뷶뷷뷹\",6,\"븁븂븄븆\",5,\"븎븏븑븒븓\"],\n[\"9581\",\"븕\",6,\"븞븠\",35,\"빆빇빉빊빋빍빏\",4,\"빖빘빜빝빞빟빢빣빥빦빧빩빫\",4,\"빲빶\",4,\"빾빿뺁뺂뺃뺅\",6,\"뺎뺒\",5,\"뺚\",13,\"뺩\",14],\n[\"9641\",\"뺸\",23,\"뻒뻓\"],\n[\"9661\",\"뻕뻖뻙\",6,\"뻡뻢뻦\",5,\"뻭\",8],\n[\"9681\",\"뻶\",10,\"뼂\",5,\"뼊\",13,\"뼚뼞\",33,\"뽂뽃뽅뽆뽇뽉\",6,\"뽒뽓뽔뽖\",44],\n[\"9741\",\"뾃\",16,\"뾕\",8],\n[\"9761\",\"뾞\",17,\"뾱\",7],\n[\"9781\",\"뾹\",11,\"뿆\",5,\"뿎뿏뿑뿒뿓뿕\",6,\"뿝뿞뿠뿢\",89,\"쀽쀾쀿\"],\n[\"9841\",\"쁀\",16,\"쁒\",5,\"쁙쁚쁛\"],\n[\"9861\",\"쁝쁞쁟쁡\",6,\"쁪\",15],\n[\"9881\",\"쁺\",21,\"삒삓삕삖삗삙\",6,\"삢삤삦\",5,\"삮삱삲삷\",4,\"삾샂샃샄샆샇샊샋샍샎샏샑\",6,\"샚샞\",5,\"샦샧샩샪샫샭\",6,\"샶샸샺\",5,\"섁섂섃섅섆섇섉\",6,\"섑섒섓섔섖\",5,\"섡섢섥섨섩섪섫섮\"],\n[\"9941\",\"섲섳섴섵섷섺섻섽섾섿셁\",6,\"셊셎\",5,\"셖셗\"],\n[\"9961\",\"셙셚셛셝\",6,\"셦셪\",5,\"셱셲셳셵셶셷셹셺셻\"],\n[\"9981\",\"셼\",8,\"솆\",5,\"솏솑솒솓솕솗\",4,\"솞솠솢솣솤솦솧솪솫솭솮솯솱\",11,\"솾\",5,\"쇅쇆쇇쇉쇊쇋쇍\",6,\"쇕쇖쇙\",6,\"쇡쇢쇣쇥쇦쇧쇩\",6,\"쇲쇴\",7,\"쇾쇿숁숂숃숅\",6,\"숎숐숒\",5,\"숚숛숝숞숡숢숣\"],\n[\"9a41\",\"숤숥숦숧숪숬숮숰숳숵\",16],\n[\"9a61\",\"쉆쉇쉉\",6,\"쉒쉓쉕쉖쉗쉙\",6,\"쉡쉢쉣쉤쉦\"],\n[\"9a81\",\"쉧\",4,\"쉮쉯쉱쉲쉳쉵\",6,\"쉾슀슂\",5,\"슊\",5,\"슑\",6,\"슙슚슜슞\",5,\"슦슧슩슪슫슮\",5,\"슶슸슺\",33,\"싞싟싡싢싥\",5,\"싮싰싲싳싴싵싷싺싽싾싿쌁\",6,\"쌊쌋쌎쌏\"],\n[\"9b41\",\"쌐쌑쌒쌖쌗쌙쌚쌛쌝\",6,\"쌦쌧쌪\",8],\n[\"9b61\",\"쌳\",17,\"썆\",7],\n[\"9b81\",\"썎\",25,\"썪썫썭썮썯썱썳\",4,\"썺썻썾\",5,\"쎅쎆쎇쎉쎊쎋쎍\",50,\"쏁\",22,\"쏚\"],\n[\"9c41\",\"쏛쏝쏞쏡쏣\",4,\"쏪쏫쏬쏮\",5,\"쏶쏷쏹\",5],\n[\"9c61\",\"쏿\",8,\"쐉\",6,\"쐑\",9],\n[\"9c81\",\"쐛\",8,\"쐥\",6,\"쐭쐮쐯쐱쐲쐳쐵\",6,\"쐾\",9,\"쑉\",26,\"쑦쑧쑩쑪쑫쑭\",6,\"쑶쑷쑸쑺\",5,\"쒁\",18,\"쒕\",6,\"쒝\",12],\n[\"9d41\",\"쒪\",13,\"쒹쒺쒻쒽\",8],\n[\"9d61\",\"쓆\",25],\n[\"9d81\",\"쓠\",8,\"쓪\",5,\"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂\",9,\"씍씎씏씑씒씓씕\",6,\"씝\",10,\"씪씫씭씮씯씱\",6,\"씺씼씾\",5,\"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩\",6,\"앲앶\",5,\"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔\"],\n[\"9e41\",\"얖얙얚얛얝얞얟얡\",7,\"얪\",9,\"얶\"],\n[\"9e61\",\"얷얺얿\",4,\"엋엍엏엒엓엕엖엗엙\",6,\"엢엤엦엧\"],\n[\"9e81\",\"엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑\",6,\"옚옝\",6,\"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉\",6,\"왒왖\",5,\"왞왟왡\",10,\"왭왮왰왲\",5,\"왺왻왽왾왿욁\",6,\"욊욌욎\",5,\"욖욗욙욚욛욝\",6,\"욦\"],\n[\"9f41\",\"욨욪\",5,\"욲욳욵욶욷욻\",4,\"웂웄웆\",5,\"웎\"],\n[\"9f61\",\"웏웑웒웓웕\",6,\"웞웟웢\",5,\"웪웫웭웮웯웱웲\"],\n[\"9f81\",\"웳\",4,\"웺웻웼웾\",5,\"윆윇윉윊윋윍\",6,\"윖윘윚\",5,\"윢윣윥윦윧윩\",6,\"윲윴윶윸윹윺윻윾윿읁읂읃읅\",4,\"읋읎읐읙읚읛읝읞읟읡\",6,\"읩읪읬\",7,\"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛\",4,\"잢잧\",4,\"잮잯잱잲잳잵잶잷\"],\n[\"a041\",\"잸잹잺잻잾쟂\",5,\"쟊쟋쟍쟏쟑\",6,\"쟙쟚쟛쟜\"],\n[\"a061\",\"쟞\",5,\"쟥쟦쟧쟩쟪쟫쟭\",13],\n[\"a081\",\"쟻\",4,\"젂젃젅젆젇젉젋\",4,\"젒젔젗\",4,\"젞젟젡젢젣젥\",6,\"젮젰젲\",5,\"젹젺젻젽젾젿졁\",6,\"졊졋졎\",5,\"졕\",26,\"졲졳졵졶졷졹졻\",4,\"좂좄좈좉좊좎\",5,\"좕\",7,\"좞좠좢좣좤\"],\n[\"a141\",\"좥좦좧좩\",18,\"좾좿죀죁\"],\n[\"a161\",\"죂죃죅죆죇죉죊죋죍\",6,\"죖죘죚\",5,\"죢죣죥\"],\n[\"a181\",\"죦\",14,\"죶\",5,\"죾죿줁줂줃줇\",4,\"줎　、。·‥…¨〃­―∥＼∼‘’“”〔〕〈\",9,\"±×÷≠≤≥∞∴°′″℃Å￠￡￥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨￢\"],\n[\"a241\",\"줐줒\",5,\"줙\",18],\n[\"a261\",\"줭\",6,\"줵\",18],\n[\"a281\",\"쥈\",7,\"쥒쥓쥕쥖쥗쥙\",6,\"쥢쥤\",7,\"쥭쥮쥯⇒⇔∀∃´～ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®\"],\n[\"a341\",\"쥱쥲쥳쥵\",6,\"쥽\",10,\"즊즋즍즎즏\"],\n[\"a361\",\"즑\",6,\"즚즜즞\",16],\n[\"a381\",\"즯\",16,\"짂짃짅짆짉짋\",4,\"짒짔짗짘짛！\",58,\"￦］\",32,\"￣\"],\n[\"a441\",\"짞짟짡짣짥짦짨짩짪짫짮짲\",5,\"짺짻짽짾짿쨁쨂쨃쨄\"],\n[\"a461\",\"쨅쨆쨇쨊쨎\",5,\"쨕쨖쨗쨙\",12],\n[\"a481\",\"쨦쨧쨨쨪\",28,\"ㄱ\",93],\n[\"a541\",\"쩇\",4,\"쩎쩏쩑쩒쩓쩕\",6,\"쩞쩢\",5,\"쩩쩪\"],\n[\"a561\",\"쩫\",17,\"쩾\",5,\"쪅쪆\"],\n[\"a581\",\"쪇\",16,\"쪙\",14,\"ⅰ\",9],\n[\"a5b0\",\"Ⅰ\",9],\n[\"a5c1\",\"Α\",16,\"Σ\",6],\n[\"a5e1\",\"α\",16,\"σ\",6],\n[\"a641\",\"쪨\",19,\"쪾쪿쫁쫂쫃쫅\"],\n[\"a661\",\"쫆\",5,\"쫎쫐쫒쫔쫕쫖쫗쫚\",5,\"쫡\",6],\n[\"a681\",\"쫨쫩쫪쫫쫭\",6,\"쫵\",18,\"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃\",7],\n[\"a741\",\"쬋\",4,\"쬑쬒쬓쬕쬖쬗쬙\",6,\"쬢\",7],\n[\"a761\",\"쬪\",22,\"쭂쭃쭄\"],\n[\"a781\",\"쭅쭆쭇쭊쭋쭍쭎쭏쭑\",6,\"쭚쭛쭜쭞\",5,\"쭥\",7,\"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙\",9,\"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰\",9,\"㎀\",4,\"㎺\",5,\"㎐\",4,\"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆\"],\n[\"a841\",\"쭭\",10,\"쭺\",14],\n[\"a861\",\"쮉\",18,\"쮝\",6],\n[\"a881\",\"쮤\",19,\"쮹\",11,\"ÆÐªĦ\"],\n[\"a8a6\",\"Ĳ\"],\n[\"a8a8\",\"ĿŁØŒºÞŦŊ\"],\n[\"a8b1\",\"㉠\",27,\"ⓐ\",25,\"①\",14,\"½⅓⅔¼¾⅛⅜⅝⅞\"],\n[\"a941\",\"쯅\",14,\"쯕\",10],\n[\"a961\",\"쯠쯡쯢쯣쯥쯦쯨쯪\",18],\n[\"a981\",\"쯽\",14,\"찎찏찑찒찓찕\",6,\"찞찟찠찣찤æđðħıĳĸŀłøœßþŧŋŉ㈀\",27,\"⒜\",25,\"⑴\",14,\"¹²³⁴ⁿ₁₂₃₄\"],\n[\"aa41\",\"찥찦찪찫찭찯찱\",6,\"찺찿\",4,\"챆챇챉챊챋챍챎\"],\n[\"aa61\",\"챏\",4,\"챖챚\",5,\"챡챢챣챥챧챩\",6,\"챱챲\"],\n[\"aa81\",\"챳챴챶\",29,\"ぁ\",82],\n[\"ab41\",\"첔첕첖첗첚첛첝첞첟첡\",6,\"첪첮\",5,\"첶첷첹\"],\n[\"ab61\",\"첺첻첽\",6,\"쳆쳈쳊\",5,\"쳑쳒쳓쳕\",5],\n[\"ab81\",\"쳛\",8,\"쳥\",6,\"쳭쳮쳯쳱\",12,\"ァ\",85],\n[\"ac41\",\"쳾쳿촀촂\",5,\"촊촋촍촎촏촑\",6,\"촚촜촞촟촠\"],\n[\"ac61\",\"촡촢촣촥촦촧촩촪촫촭\",11,\"촺\",4],\n[\"ac81\",\"촿\",28,\"쵝쵞쵟А\",5,\"ЁЖ\",25],\n[\"acd1\",\"а\",5,\"ёж\",25],\n[\"ad41\",\"쵡쵢쵣쵥\",6,\"쵮쵰쵲\",5,\"쵹\",7],\n[\"ad61\",\"춁\",6,\"춉\",10,\"춖춗춙춚춛춝춞춟\"],\n[\"ad81\",\"춠춡춢춣춦춨춪\",5,\"춱\",18,\"췅\"],\n[\"ae41\",\"췆\",5,\"췍췎췏췑\",16],\n[\"ae61\",\"췢\",5,\"췩췪췫췭췮췯췱\",6,\"췺췼췾\",4],\n[\"ae81\",\"츃츅츆츇츉츊츋츍\",6,\"츕츖츗츘츚\",5,\"츢츣츥츦츧츩츪츫\"],\n[\"af41\",\"츬츭츮츯츲츴츶\",19],\n[\"af61\",\"칊\",13,\"칚칛칝칞칢\",5,\"칪칬\"],\n[\"af81\",\"칮\",5,\"칶칷칹칺칻칽\",6,\"캆캈캊\",5,\"캒캓캕캖캗캙\"],\n[\"b041\",\"캚\",5,\"캢캦\",5,\"캮\",12],\n[\"b061\",\"캻\",5,\"컂\",19],\n[\"b081\",\"컖\",13,\"컦컧컩컪컭\",6,\"컶컺\",5,\"가각간갇갈갉갊감\",7,\"같\",4,\"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆\"],\n[\"b141\",\"켂켃켅켆켇켉\",6,\"켒켔켖\",5,\"켝켞켟켡켢켣\"],\n[\"b161\",\"켥\",6,\"켮켲\",5,\"켹\",11],\n[\"b181\",\"콅\",14,\"콖콗콙콚콛콝\",6,\"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸\"],\n[\"b241\",\"콭콮콯콲콳콵콶콷콹\",6,\"쾁쾂쾃쾄쾆\",5,\"쾍\"],\n[\"b261\",\"쾎\",18,\"쾢\",5,\"쾩\"],\n[\"b281\",\"쾪\",5,\"쾱\",18,\"쿅\",6,\"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙\"],\n[\"b341\",\"쿌\",19,\"쿢쿣쿥쿦쿧쿩\"],\n[\"b361\",\"쿪\",5,\"쿲쿴쿶\",5,\"쿽쿾쿿퀁퀂퀃퀅\",5],\n[\"b381\",\"퀋\",5,\"퀒\",5,\"퀙\",19,\"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫\",4,\"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝\"],\n[\"b441\",\"퀮\",5,\"퀶퀷퀹퀺퀻퀽\",6,\"큆큈큊\",5],\n[\"b461\",\"큑큒큓큕큖큗큙\",6,\"큡\",10,\"큮큯\"],\n[\"b481\",\"큱큲큳큵\",6,\"큾큿킀킂\",18,\"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫\",4,\"닳담답닷\",4,\"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥\"],\n[\"b541\",\"킕\",14,\"킦킧킩킪킫킭\",5],\n[\"b561\",\"킳킶킸킺\",5,\"탂탃탅탆탇탊\",5,\"탒탖\",4],\n[\"b581\",\"탛탞탟탡탢탣탥\",6,\"탮탲\",5,\"탹\",11,\"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸\"],\n[\"b641\",\"턅\",7,\"턎\",17],\n[\"b661\",\"턠\",15,\"턲턳턵턶턷턹턻턼턽턾\"],\n[\"b681\",\"턿텂텆\",5,\"텎텏텑텒텓텕\",6,\"텞텠텢\",5,\"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗\"],\n[\"b741\",\"텮\",13,\"텽\",6,\"톅톆톇톉톊\"],\n[\"b761\",\"톋\",20,\"톢톣톥톦톧\"],\n[\"b781\",\"톩\",6,\"톲톴톶톷톸톹톻톽톾톿퇁\",14,\"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩\"],\n[\"b841\",\"퇐\",7,\"퇙\",17],\n[\"b861\",\"퇫\",8,\"퇵퇶퇷퇹\",13],\n[\"b881\",\"툈툊\",5,\"툑\",24,\"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많\",4,\"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼\"],\n[\"b941\",\"툪툫툮툯툱툲툳툵\",6,\"툾퉀퉂\",5,\"퉉퉊퉋퉌\"],\n[\"b961\",\"퉍\",14,\"퉝\",6,\"퉥퉦퉧퉨\"],\n[\"b981\",\"퉩\",22,\"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바\",4,\"받\",4,\"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗\"],\n[\"ba41\",\"튍튎튏튒튓튔튖\",5,\"튝튞튟튡튢튣튥\",6,\"튭\"],\n[\"ba61\",\"튮튯튰튲\",5,\"튺튻튽튾틁틃\",4,\"틊틌\",5],\n[\"ba81\",\"틒틓틕틖틗틙틚틛틝\",6,\"틦\",9,\"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤\"],\n[\"bb41\",\"틻\",4,\"팂팄팆\",5,\"팏팑팒팓팕팗\",4,\"팞팢팣\"],\n[\"bb61\",\"팤팦팧팪팫팭팮팯팱\",6,\"팺팾\",5,\"퍆퍇퍈퍉\"],\n[\"bb81\",\"퍊\",31,\"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤\"],\n[\"bc41\",\"퍪\",17,\"퍾퍿펁펂펃펅펆펇\"],\n[\"bc61\",\"펈펉펊펋펎펒\",5,\"펚펛펝펞펟펡\",6,\"펪펬펮\"],\n[\"bc81\",\"펯\",4,\"펵펶펷펹펺펻펽\",6,\"폆폇폊\",5,\"폑\",5,\"샥샨샬샴샵샷샹섀섄섈섐섕서\",4,\"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭\"],\n[\"bd41\",\"폗폙\",7,\"폢폤\",7,\"폮폯폱폲폳폵폶폷\"],\n[\"bd61\",\"폸폹폺폻폾퐀퐂\",5,\"퐉\",13],\n[\"bd81\",\"퐗\",5,\"퐞\",25,\"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰\"],\n[\"be41\",\"퐸\",7,\"푁푂푃푅\",14],\n[\"be61\",\"푔\",7,\"푝푞푟푡푢푣푥\",7,\"푮푰푱푲\"],\n[\"be81\",\"푳\",4,\"푺푻푽푾풁풃\",4,\"풊풌풎\",5,\"풕\",8,\"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄\",6,\"엌엎\"],\n[\"bf41\",\"풞\",10,\"풪\",14],\n[\"bf61\",\"풹\",18,\"퓍퓎퓏퓑퓒퓓퓕\"],\n[\"bf81\",\"퓖\",5,\"퓝퓞퓠\",7,\"퓩퓪퓫퓭퓮퓯퓱\",6,\"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염\",5,\"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨\"],\n[\"c041\",\"퓾\",5,\"픅픆픇픉픊픋픍\",6,\"픖픘\",5],\n[\"c061\",\"픞\",25],\n[\"c081\",\"픸픹픺픻픾픿핁핂핃핅\",6,\"핎핐핒\",5,\"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응\",7,\"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊\"],\n[\"c141\",\"핤핦핧핪핬핮\",5,\"핶핷핹핺핻핽\",6,\"햆햊햋\"],\n[\"c161\",\"햌햍햎햏햑\",19,\"햦햧\"],\n[\"c181\",\"햨\",31,\"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓\"],\n[\"c241\",\"헊헋헍헎헏헑헓\",4,\"헚헜헞\",5,\"헦헧헩헪헫헭헮\"],\n[\"c261\",\"헯\",4,\"헶헸헺\",5,\"혂혃혅혆혇혉\",6,\"혒\"],\n[\"c281\",\"혖\",5,\"혝혞혟혡혢혣혥\",7,\"혮\",9,\"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻\"],\n[\"c341\",\"혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝\",4],\n[\"c361\",\"홢\",4,\"홨홪\",5,\"홲홳홵\",11],\n[\"c381\",\"횁횂횄횆\",5,\"횎횏횑횒횓횕\",7,\"횞횠횢\",5,\"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층\"],\n[\"c441\",\"횫횭횮횯횱\",7,\"횺횼\",7,\"훆훇훉훊훋\"],\n[\"c461\",\"훍훎훏훐훒훓훕훖훘훚\",5,\"훡훢훣훥훦훧훩\",4],\n[\"c481\",\"훮훯훱훲훳훴훶\",5,\"훾훿휁휂휃휅\",11,\"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼\"],\n[\"c541\",\"휕휖휗휚휛휝휞휟휡\",6,\"휪휬휮\",5,\"휶휷휹\"],\n[\"c561\",\"휺휻휽\",6,\"흅흆흈흊\",5,\"흒흓흕흚\",4],\n[\"c581\",\"흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵\",6,\"흾흿힀힂\",5,\"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜\"],\n[\"c641\",\"힍힎힏힑\",6,\"힚힜힞\",5],\n[\"c6a1\",\"퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁\"],\n[\"c7a1\",\"퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠\"],\n[\"c8a1\",\"혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝\"],\n[\"caa1\",\"伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕\"],\n[\"cba1\",\"匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢\"],\n[\"cca1\",\"瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械\"],\n[\"cda1\",\"棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜\"],\n[\"cea1\",\"科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾\"],\n[\"cfa1\",\"區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴\"],\n[\"d0a1\",\"鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣\"],\n[\"d1a1\",\"朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩\",5,\"那樂\",4,\"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉\"],\n[\"d2a1\",\"納臘蠟衲囊娘廊\",4,\"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧\",5,\"駑魯\",10,\"濃籠聾膿農惱牢磊腦賂雷尿壘\",7,\"嫩訥杻紐勒\",5,\"能菱陵尼泥匿溺多茶\"],\n[\"d3a1\",\"丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃\"],\n[\"d4a1\",\"棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅\"],\n[\"d5a1\",\"蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣\"],\n[\"d6a1\",\"煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼\"],\n[\"d7a1\",\"遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬\"],\n[\"d8a1\",\"立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅\"],\n[\"d9a1\",\"蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文\"],\n[\"daa1\",\"汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑\"],\n[\"dba1\",\"發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖\"],\n[\"dca1\",\"碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦\"],\n[\"dda1\",\"孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥\"],\n[\"dea1\",\"脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索\"],\n[\"dfa1\",\"傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署\"],\n[\"e0a1\",\"胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬\"],\n[\"e1a1\",\"聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁\"],\n[\"e2a1\",\"戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧\"],\n[\"e3a1\",\"嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁\"],\n[\"e4a1\",\"沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額\"],\n[\"e5a1\",\"櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬\"],\n[\"e6a1\",\"旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒\"],\n[\"e7a1\",\"簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳\"],\n[\"e8a1\",\"烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療\"],\n[\"e9a1\",\"窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓\"],\n[\"eaa1\",\"運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜\"],\n[\"eba1\",\"濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼\"],\n[\"eca1\",\"議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄\"],\n[\"eda1\",\"立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長\"],\n[\"eea1\",\"障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱\"],\n[\"efa1\",\"煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖\"],\n[\"f0a1\",\"靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫\"],\n[\"f1a1\",\"踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只\"],\n[\"f2a1\",\"咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯\"],\n[\"f3a1\",\"鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策\"],\n[\"f4a1\",\"責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢\"],\n[\"f5a1\",\"椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃\"],\n[\"f6a1\",\"贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託\"],\n[\"f7a1\",\"鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑\"],\n[\"f8a1\",\"阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃\"],\n[\"f9a1\",\"品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航\"],\n[\"faa1\",\"行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型\"],\n[\"fba1\",\"形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵\"],\n[\"fca1\",\"禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆\"],\n[\"fda1\",\"爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰\"]\n]\n\n},{}],20:[function(require,module,exports){\nmodule.exports=[\n[\"0\",\"\\u0000\",127],\n[\"a140\",\"　，、。．‧；：？！︰…‥﹐﹑﹒·﹔﹕﹖﹗｜–︱—︳╴︴﹏（）︵︶｛｝︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚\"],\n[\"a1a1\",\"﹛﹜﹝﹞‘’“”〝〞‵′＃＆＊※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯￣＿ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡＋－×÷±√＜＞＝≦≧≠∞≒≡﹢\",4,\"～∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣／\"],\n[\"a240\",\"＼∕﹨＄￥〒￠￡％＠℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁\",7,\"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭\"],\n[\"a2a1\",\"╮╰╯═╞╪╡◢◣◥◤╱╲╳０\",9,\"Ⅰ\",9,\"〡\",8,\"十卄卅Ａ\",25,\"ａ\",21],\n[\"a340\",\"ｗｘｙｚΑ\",16,\"Σ\",6,\"α\",16,\"σ\",6,\"ㄅ\",10],\n[\"a3a1\",\"ㄐ\",25,\"˙ˉˊˇˋ\"],\n[\"a3e1\",\"€\"],\n[\"a440\",\"一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才\"],\n[\"a4a1\",\"丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙\"],\n[\"a540\",\"世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外\"],\n[\"a5a1\",\"央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全\"],\n[\"a640\",\"共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年\"],\n[\"a6a1\",\"式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣\"],\n[\"a740\",\"作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍\"],\n[\"a7a1\",\"均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠\"],\n[\"a840\",\"杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒\"],\n[\"a8a1\",\"芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵\"],\n[\"a940\",\"咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居\"],\n[\"a9a1\",\"屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊\"],\n[\"aa40\",\"昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠\"],\n[\"aaa1\",\"炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附\"],\n[\"ab40\",\"陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品\"],\n[\"aba1\",\"哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷\"],\n[\"ac40\",\"拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗\"],\n[\"aca1\",\"活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄\"],\n[\"ad40\",\"耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥\"],\n[\"ada1\",\"迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪\"],\n[\"ae40\",\"哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙\"],\n[\"aea1\",\"恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓\"],\n[\"af40\",\"浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷\"],\n[\"afa1\",\"砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃\"],\n[\"b040\",\"虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡\"],\n[\"b0a1\",\"陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀\"],\n[\"b140\",\"娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽\"],\n[\"b1a1\",\"情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺\"],\n[\"b240\",\"毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶\"],\n[\"b2a1\",\"瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼\"],\n[\"b340\",\"莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途\"],\n[\"b3a1\",\"部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠\"],\n[\"b440\",\"婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍\"],\n[\"b4a1\",\"插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋\"],\n[\"b540\",\"溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘\"],\n[\"b5a1\",\"窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁\"],\n[\"b640\",\"詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑\"],\n[\"b6a1\",\"間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼\"],\n[\"b740\",\"媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業\"],\n[\"b7a1\",\"楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督\"],\n[\"b840\",\"睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫\"],\n[\"b8a1\",\"腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊\"],\n[\"b940\",\"辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴\"],\n[\"b9a1\",\"飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇\"],\n[\"ba40\",\"愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢\"],\n[\"baa1\",\"滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬\"],\n[\"bb40\",\"罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤\"],\n[\"bba1\",\"說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜\"],\n[\"bc40\",\"劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂\"],\n[\"bca1\",\"慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃\"],\n[\"bd40\",\"瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯\"],\n[\"bda1\",\"翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞\"],\n[\"be40\",\"輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉\"],\n[\"bea1\",\"鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡\"],\n[\"bf40\",\"濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊\"],\n[\"bfa1\",\"縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚\"],\n[\"c040\",\"錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇\"],\n[\"c0a1\",\"嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬\"],\n[\"c140\",\"瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪\"],\n[\"c1a1\",\"薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁\"],\n[\"c240\",\"駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘\"],\n[\"c2a1\",\"癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦\"],\n[\"c340\",\"鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸\"],\n[\"c3a1\",\"獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類\"],\n[\"c440\",\"願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼\"],\n[\"c4a1\",\"纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴\"],\n[\"c540\",\"護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬\"],\n[\"c5a1\",\"禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒\"],\n[\"c640\",\"讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲\"],\n[\"c940\",\"乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕\"],\n[\"c9a1\",\"氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋\"],\n[\"ca40\",\"汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘\"],\n[\"caa1\",\"吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇\"],\n[\"cb40\",\"杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓\"],\n[\"cba1\",\"芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢\"],\n[\"cc40\",\"坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋\"],\n[\"cca1\",\"怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲\"],\n[\"cd40\",\"泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺\"],\n[\"cda1\",\"矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏\"],\n[\"ce40\",\"哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛\"],\n[\"cea1\",\"峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺\"],\n[\"cf40\",\"柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂\"],\n[\"cfa1\",\"洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀\"],\n[\"d040\",\"穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪\"],\n[\"d0a1\",\"苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱\"],\n[\"d140\",\"唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧\"],\n[\"d1a1\",\"恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤\"],\n[\"d240\",\"毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸\"],\n[\"d2a1\",\"牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐\"],\n[\"d340\",\"笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢\"],\n[\"d3a1\",\"荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐\"],\n[\"d440\",\"酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅\"],\n[\"d4a1\",\"唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏\"],\n[\"d540\",\"崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟\"],\n[\"d5a1\",\"捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉\"],\n[\"d640\",\"淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏\"],\n[\"d6a1\",\"痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟\"],\n[\"d740\",\"耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷\"],\n[\"d7a1\",\"蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪\"],\n[\"d840\",\"釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷\"],\n[\"d8a1\",\"堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔\"],\n[\"d940\",\"惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒\"],\n[\"d9a1\",\"晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞\"],\n[\"da40\",\"湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖\"],\n[\"daa1\",\"琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥\"],\n[\"db40\",\"罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳\"],\n[\"dba1\",\"菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺\"],\n[\"dc40\",\"軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈\"],\n[\"dca1\",\"隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆\"],\n[\"dd40\",\"媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤\"],\n[\"dda1\",\"搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼\"],\n[\"de40\",\"毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓\"],\n[\"dea1\",\"煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓\"],\n[\"df40\",\"稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯\"],\n[\"dfa1\",\"腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤\"],\n[\"e040\",\"觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿\"],\n[\"e0a1\",\"遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠\"],\n[\"e140\",\"凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠\"],\n[\"e1a1\",\"寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉\"],\n[\"e240\",\"榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊\"],\n[\"e2a1\",\"漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓\"],\n[\"e340\",\"禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞\"],\n[\"e3a1\",\"耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻\"],\n[\"e440\",\"裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍\"],\n[\"e4a1\",\"銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘\"],\n[\"e540\",\"噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉\"],\n[\"e5a1\",\"憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒\"],\n[\"e640\",\"澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙\"],\n[\"e6a1\",\"獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟\"],\n[\"e740\",\"膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢\"],\n[\"e7a1\",\"蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧\"],\n[\"e840\",\"踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓\"],\n[\"e8a1\",\"銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮\"],\n[\"e940\",\"噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺\"],\n[\"e9a1\",\"憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸\"],\n[\"ea40\",\"澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙\"],\n[\"eaa1\",\"瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘\"],\n[\"eb40\",\"蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠\"],\n[\"eba1\",\"諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌\"],\n[\"ec40\",\"錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕\"],\n[\"eca1\",\"魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎\"],\n[\"ed40\",\"檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶\"],\n[\"eda1\",\"瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞\"],\n[\"ee40\",\"蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞\"],\n[\"eea1\",\"謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜\"],\n[\"ef40\",\"鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰\"],\n[\"efa1\",\"鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶\"],\n[\"f040\",\"璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒\"],\n[\"f0a1\",\"臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧\"],\n[\"f140\",\"蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪\"],\n[\"f1a1\",\"鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰\"],\n[\"f240\",\"徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛\"],\n[\"f2a1\",\"礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕\"],\n[\"f340\",\"譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦\"],\n[\"f3a1\",\"鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲\"],\n[\"f440\",\"嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩\"],\n[\"f4a1\",\"禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿\"],\n[\"f540\",\"鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛\"],\n[\"f5a1\",\"鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥\"],\n[\"f640\",\"蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺\"],\n[\"f6a1\",\"騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚\"],\n[\"f740\",\"糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊\"],\n[\"f7a1\",\"驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾\"],\n[\"f840\",\"讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏\"],\n[\"f8a1\",\"齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚\"],\n[\"f940\",\"纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊\"],\n[\"f9a1\",\"龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓\"]\n]\n\n},{}],21:[function(require,module,exports){\nmodule.exports=[\n[\"0\",\"\\u0000\",127],\n[\"8ea1\",\"｡\",62],\n[\"a1a1\",\"　、。，．・：；？！゛゜´｀¨＾￣＿ヽヾゝゞ〃仝々〆〇ー―‐／＼～∥｜…‥‘’“”（）〔〕［］｛｝〈\",9,\"＋－±×÷＝≠＜＞≦≧∞∴♂♀°′″℃￥＄￠￡％＃＆＊＠§☆★○●◎◇\"],\n[\"a2a1\",\"◆□■△▲▽▼※〒→←↑↓〓\"],\n[\"a2ba\",\"∈∋⊆⊇⊂⊃∪∩\"],\n[\"a2ca\",\"∧∨￢⇒⇔∀∃\"],\n[\"a2dc\",\"∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬\"],\n[\"a2f2\",\"Å‰♯♭♪†‡¶\"],\n[\"a2fe\",\"◯\"],\n[\"a3b0\",\"０\",9],\n[\"a3c1\",\"Ａ\",25],\n[\"a3e1\",\"ａ\",25],\n[\"a4a1\",\"ぁ\",82],\n[\"a5a1\",\"ァ\",85],\n[\"a6a1\",\"Α\",16,\"Σ\",6],\n[\"a6c1\",\"α\",16,\"σ\",6],\n[\"a7a1\",\"А\",5,\"ЁЖ\",25],\n[\"a7d1\",\"а\",5,\"ёж\",25],\n[\"a8a1\",\"─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂\"],\n[\"ada1\",\"①\",19,\"Ⅰ\",9],\n[\"adc0\",\"㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡\"],\n[\"addf\",\"㍻〝〟№㏍℡㊤\",4,\"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪\"],\n[\"b0a1\",\"亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭\"],\n[\"b1a1\",\"院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応\"],\n[\"b2a1\",\"押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改\"],\n[\"b3a1\",\"魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱\"],\n[\"b4a1\",\"粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄\"],\n[\"b5a1\",\"機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京\"],\n[\"b6a1\",\"供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈\"],\n[\"b7a1\",\"掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲\"],\n[\"b8a1\",\"検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向\"],\n[\"b9a1\",\"后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込\"],\n[\"baa1\",\"此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷\"],\n[\"bba1\",\"察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時\"],\n[\"bca1\",\"次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周\"],\n[\"bda1\",\"宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償\"],\n[\"bea1\",\"勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾\"],\n[\"bfa1\",\"拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾\"],\n[\"c0a1\",\"澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線\"],\n[\"c1a1\",\"繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎\"],\n[\"c2a1\",\"臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只\"],\n[\"c3a1\",\"叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵\"],\n[\"c4a1\",\"帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓\"],\n[\"c5a1\",\"邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到\"],\n[\"c6a1\",\"董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入\"],\n[\"c7a1\",\"如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦\"],\n[\"c8a1\",\"函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美\"],\n[\"c9a1\",\"鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服\"],\n[\"caa1\",\"福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋\"],\n[\"cba1\",\"法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満\"],\n[\"cca1\",\"漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒\"],\n[\"cda1\",\"諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃\"],\n[\"cea1\",\"痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯\"],\n[\"cfa1\",\"蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕\"],\n[\"d0a1\",\"弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲\"],\n[\"d1a1\",\"僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨\"],\n[\"d2a1\",\"辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨\"],\n[\"d3a1\",\"咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉\"],\n[\"d4a1\",\"圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩\"],\n[\"d5a1\",\"奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓\"],\n[\"d6a1\",\"屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏\"],\n[\"d7a1\",\"廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚\"],\n[\"d8a1\",\"悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛\"],\n[\"d9a1\",\"戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼\"],\n[\"daa1\",\"據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼\"],\n[\"dba1\",\"曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍\"],\n[\"dca1\",\"棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣\"],\n[\"dda1\",\"檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾\"],\n[\"dea1\",\"沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌\"],\n[\"dfa1\",\"漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼\"],\n[\"e0a1\",\"燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱\"],\n[\"e1a1\",\"瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰\"],\n[\"e2a1\",\"癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬\"],\n[\"e3a1\",\"磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐\"],\n[\"e4a1\",\"筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆\"],\n[\"e5a1\",\"紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺\"],\n[\"e6a1\",\"罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋\"],\n[\"e7a1\",\"隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙\"],\n[\"e8a1\",\"茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈\"],\n[\"e9a1\",\"蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙\"],\n[\"eaa1\",\"蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞\"],\n[\"eba1\",\"襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫\"],\n[\"eca1\",\"譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊\"],\n[\"eda1\",\"蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸\"],\n[\"eea1\",\"遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮\"],\n[\"efa1\",\"錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞\"],\n[\"f0a1\",\"陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰\"],\n[\"f1a1\",\"顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷\"],\n[\"f2a1\",\"髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈\"],\n[\"f3a1\",\"鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠\"],\n[\"f4a1\",\"堯槇遙瑤凜熙\"],\n[\"f9a1\",\"纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德\"],\n[\"faa1\",\"忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱\"],\n[\"fba1\",\"犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚\"],\n[\"fca1\",\"釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑\"],\n[\"fcf1\",\"ⅰ\",9,\"￢￤＇＂\"],\n[\"8fa2af\",\"˘ˇ¸˙˝¯˛˚～΄΅\"],\n[\"8fa2c2\",\"¡¦¿\"],\n[\"8fa2eb\",\"ºª©®™¤№\"],\n[\"8fa6e1\",\"ΆΈΉΊΪ\"],\n[\"8fa6e7\",\"Ό\"],\n[\"8fa6e9\",\"ΎΫ\"],\n[\"8fa6ec\",\"Ώ\"],\n[\"8fa6f1\",\"άέήίϊΐόςύϋΰώ\"],\n[\"8fa7c2\",\"Ђ\",10,\"ЎЏ\"],\n[\"8fa7f2\",\"ђ\",10,\"ўџ\"],\n[\"8fa9a1\",\"ÆĐ\"],\n[\"8fa9a4\",\"Ħ\"],\n[\"8fa9a6\",\"Ĳ\"],\n[\"8fa9a8\",\"ŁĿ\"],\n[\"8fa9ab\",\"ŊØŒ\"],\n[\"8fa9af\",\"ŦÞ\"],\n[\"8fa9c1\",\"æđðħıĳĸłŀŉŋøœßŧþ\"],\n[\"8faaa1\",\"ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ\"],\n[\"8faaba\",\"ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ\"],\n[\"8faba1\",\"áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ\"],\n[\"8fabbd\",\"ġĥíìïîǐ\"],\n[\"8fabc5\",\"īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż\"],\n[\"8fb0a1\",\"丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄\"],\n[\"8fb1a1\",\"侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐\"],\n[\"8fb2a1\",\"傒傓傔傖傛傜傞\",4,\"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂\"],\n[\"8fb3a1\",\"凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋\"],\n[\"8fb4a1\",\"匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿\"],\n[\"8fb5a1\",\"咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒\"],\n[\"8fb6a1\",\"嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍\",5,\"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤\",4,\"囱囫园\"],\n[\"8fb7a1\",\"囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭\",4,\"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡\"],\n[\"8fb8a1\",\"堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭\"],\n[\"8fb9a1\",\"奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿\"],\n[\"8fbaa1\",\"嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖\",4,\"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩\"],\n[\"8fbba1\",\"屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤\"],\n[\"8fbca1\",\"巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪\",4,\"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧\"],\n[\"8fbda1\",\"彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐\",4,\"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷\"],\n[\"8fbea1\",\"悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐\",4,\"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥\"],\n[\"8fbfa1\",\"懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵\"],\n[\"8fc0a1\",\"捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿\"],\n[\"8fc1a1\",\"擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝\"],\n[\"8fc2a1\",\"昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝\"],\n[\"8fc3a1\",\"杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮\",4,\"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏\"],\n[\"8fc4a1\",\"棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲\"],\n[\"8fc5a1\",\"樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽\"],\n[\"8fc6a1\",\"歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖\"],\n[\"8fc7a1\",\"泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞\"],\n[\"8fc8a1\",\"湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊\"],\n[\"8fc9a1\",\"濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔\",4,\"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃\",4,\"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠\"],\n[\"8fcaa1\",\"煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻\"],\n[\"8fcba1\",\"狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽\"],\n[\"8fcca1\",\"珿琀琁琄琇琊琑琚琛琤琦琨\",9,\"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆\"],\n[\"8fcda1\",\"甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹\",5,\"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹\"],\n[\"8fcea1\",\"瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢\",6,\"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢\"],\n[\"8fcfa1\",\"睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳\"],\n[\"8fd0a1\",\"碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞\"],\n[\"8fd1a1\",\"秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰\"],\n[\"8fd2a1\",\"笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙\",5],\n[\"8fd3a1\",\"籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝\"],\n[\"8fd4a1\",\"綞綦綧綪綳綶綷綹緂\",4,\"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭\"],\n[\"8fd5a1\",\"罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮\"],\n[\"8fd6a1\",\"胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆\"],\n[\"8fd7a1\",\"艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸\"],\n[\"8fd8a1\",\"荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓\"],\n[\"8fd9a1\",\"蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏\",4,\"蕖蕙蕜\",6,\"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼\"],\n[\"8fdaa1\",\"藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠\",4,\"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣\"],\n[\"8fdba1\",\"蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃\",6,\"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵\"],\n[\"8fdca1\",\"蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊\",4,\"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺\"],\n[\"8fdda1\",\"襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔\",4,\"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳\"],\n[\"8fdea1\",\"誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂\",4,\"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆\"],\n[\"8fdfa1\",\"貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢\"],\n[\"8fe0a1\",\"踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁\"],\n[\"8fe1a1\",\"轃轇轏轑\",4,\"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃\"],\n[\"8fe2a1\",\"郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿\"],\n[\"8fe3a1\",\"釂釃釅釓釔釗釙釚釞釤釥釩釪釬\",5,\"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵\",4,\"鉻鉼鉽鉿銈銉銊銍銎銒銗\"],\n[\"8fe4a1\",\"銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿\",4,\"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶\"],\n[\"8fe5a1\",\"鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉\",4,\"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹\"],\n[\"8fe6a1\",\"镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂\"],\n[\"8fe7a1\",\"霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦\"],\n[\"8fe8a1\",\"頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱\",4,\"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵\"],\n[\"8fe9a1\",\"馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿\",4],\n[\"8feaa1\",\"鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪\",4,\"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸\"],\n[\"8feba1\",\"鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦\",4,\"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻\"],\n[\"8feca1\",\"鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵\"],\n[\"8feda1\",\"黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃\",4,\"齓齕齖齗齘齚齝齞齨齩齭\",4,\"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥\"]\n]\n\n},{}],22:[function(require,module,exports){\nmodule.exports={\"uChars\":[128,165,169,178,184,216,226,235,238,244,248,251,253,258,276,284,300,325,329,334,364,463,465,467,469,471,473,475,477,506,594,610,712,716,730,930,938,962,970,1026,1104,1106,8209,8215,8218,8222,8231,8241,8244,8246,8252,8365,8452,8454,8458,8471,8482,8556,8570,8596,8602,8713,8720,8722,8726,8731,8737,8740,8742,8748,8751,8760,8766,8777,8781,8787,8802,8808,8816,8854,8858,8870,8896,8979,9322,9372,9548,9588,9616,9622,9634,9652,9662,9672,9676,9680,9702,9735,9738,9793,9795,11906,11909,11913,11917,11928,11944,11947,11951,11956,11960,11964,11979,12284,12292,12312,12319,12330,12351,12436,12447,12535,12543,12586,12842,12850,12964,13200,13215,13218,13253,13263,13267,13270,13384,13428,13727,13839,13851,14617,14703,14801,14816,14964,15183,15471,15585,16471,16736,17208,17325,17330,17374,17623,17997,18018,18212,18218,18301,18318,18760,18811,18814,18820,18823,18844,18848,18872,19576,19620,19738,19887,40870,59244,59336,59367,59413,59417,59423,59431,59437,59443,59452,59460,59478,59493,63789,63866,63894,63976,63986,64016,64018,64021,64025,64034,64037,64042,65074,65093,65107,65112,65127,65132,65375,65510,65536],\"gbChars\":[0,36,38,45,50,81,89,95,96,100,103,104,105,109,126,133,148,172,175,179,208,306,307,308,309,310,311,312,313,341,428,443,544,545,558,741,742,749,750,805,819,820,7922,7924,7925,7927,7934,7943,7944,7945,7950,8062,8148,8149,8152,8164,8174,8236,8240,8262,8264,8374,8380,8381,8384,8388,8390,8392,8393,8394,8396,8401,8406,8416,8419,8424,8437,8439,8445,8482,8485,8496,8521,8603,8936,8946,9046,9050,9063,9066,9076,9092,9100,9108,9111,9113,9131,9162,9164,9218,9219,11329,11331,11334,11336,11346,11361,11363,11366,11370,11372,11375,11389,11682,11686,11687,11692,11694,11714,11716,11723,11725,11730,11736,11982,11989,12102,12336,12348,12350,12384,12393,12395,12397,12510,12553,12851,12962,12973,13738,13823,13919,13933,14080,14298,14585,14698,15583,15847,16318,16434,16438,16481,16729,17102,17122,17315,17320,17402,17418,17859,17909,17911,17915,17916,17936,17939,17961,18664,18703,18814,18962,19043,33469,33470,33471,33484,33485,33490,33497,33501,33505,33513,33520,33536,33550,37845,37921,37948,38029,38038,38064,38065,38066,38069,38075,38076,38078,39108,39109,39113,39114,39115,39116,39265,39394,189000]}\n},{}],23:[function(require,module,exports){\nmodule.exports=[\n[\"a140\",\"\",62],\n[\"a180\",\"\",32],\n[\"a240\",\"\",62],\n[\"a280\",\"\",32],\n[\"a2ab\",\"\",5],\n[\"a2e3\",\"€\"],\n[\"a2ef\",\"\"],\n[\"a2fd\",\"\"],\n[\"a340\",\"\",62],\n[\"a380\",\"\",31,\"　\"],\n[\"a440\",\"\",62],\n[\"a480\",\"\",32],\n[\"a4f4\",\"\",10],\n[\"a540\",\"\",62],\n[\"a580\",\"\",32],\n[\"a5f7\",\"\",7],\n[\"a640\",\"\",62],\n[\"a680\",\"\",32],\n[\"a6b9\",\"\",7],\n[\"a6d9\",\"\",6],\n[\"a6ec\",\"\"],\n[\"a6f3\",\"\"],\n[\"a6f6\",\"\",8],\n[\"a740\",\"\",62],\n[\"a780\",\"\",32],\n[\"a7c2\",\"\",14],\n[\"a7f2\",\"\",12],\n[\"a896\",\"\",10],\n[\"a8bc\",\"\"],\n[\"a8bf\",\"ǹ\"],\n[\"a8c1\",\"\"],\n[\"a8ea\",\"\",20],\n[\"a958\",\"\"],\n[\"a95b\",\"\"],\n[\"a95d\",\"\"],\n[\"a989\",\"〾⿰\",11],\n[\"a997\",\"\",12],\n[\"a9f0\",\"\",14],\n[\"aaa1\",\"\",93],\n[\"aba1\",\"\",93],\n[\"aca1\",\"\",93],\n[\"ada1\",\"\",93],\n[\"aea1\",\"\",93],\n[\"afa1\",\"\",93],\n[\"d7fa\",\"\",4],\n[\"f8a1\",\"\",93],\n[\"f9a1\",\"\",93],\n[\"faa1\",\"\",93],\n[\"fba1\",\"\",93],\n[\"fca1\",\"\",93],\n[\"fda1\",\"\",93],\n[\"fe50\",\"⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌\"],\n[\"fe80\",\"䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓\",6,\"䶮\",93]\n]\n\n},{}],24:[function(require,module,exports){\nmodule.exports=[\n[\"0\",\"\\u0000\",128],\n[\"a1\",\"｡\",62],\n[\"8140\",\"　、。，．・：；？！゛゜´｀¨＾￣＿ヽヾゝゞ〃仝々〆〇ー―‐／＼～∥｜…‥‘’“”（）〔〕［］｛｝〈\",9,\"＋－±×\"],\n[\"8180\",\"÷＝≠＜＞≦≧∞∴♂♀°′″℃￥＄￠￡％＃＆＊＠§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓\"],\n[\"81b8\",\"∈∋⊆⊇⊂⊃∪∩\"],\n[\"81c8\",\"∧∨￢⇒⇔∀∃\"],\n[\"81da\",\"∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬\"],\n[\"81f0\",\"Å‰♯♭♪†‡¶\"],\n[\"81fc\",\"◯\"],\n[\"824f\",\"０\",9],\n[\"8260\",\"Ａ\",25],\n[\"8281\",\"ａ\",25],\n[\"829f\",\"ぁ\",82],\n[\"8340\",\"ァ\",62],\n[\"8380\",\"ム\",22],\n[\"839f\",\"Α\",16,\"Σ\",6],\n[\"83bf\",\"α\",16,\"σ\",6],\n[\"8440\",\"А\",5,\"ЁЖ\",25],\n[\"8470\",\"а\",5,\"ёж\",7],\n[\"8480\",\"о\",17],\n[\"849f\",\"─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂\"],\n[\"8740\",\"①\",19,\"Ⅰ\",9],\n[\"875f\",\"㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡\"],\n[\"877e\",\"㍻\"],\n[\"8780\",\"〝〟№㏍℡㊤\",4,\"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪\"],\n[\"889f\",\"亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭\"],\n[\"8940\",\"院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円\"],\n[\"8980\",\"園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改\"],\n[\"8a40\",\"魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫\"],\n[\"8a80\",\"橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄\"],\n[\"8b40\",\"機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救\"],\n[\"8b80\",\"朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈\"],\n[\"8c40\",\"掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨\"],\n[\"8c80\",\"劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向\"],\n[\"8d40\",\"后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降\"],\n[\"8d80\",\"項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷\"],\n[\"8e40\",\"察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止\"],\n[\"8e80\",\"死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周\"],\n[\"8f40\",\"宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳\"],\n[\"8f80\",\"準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾\"],\n[\"9040\",\"拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨\"],\n[\"9080\",\"逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線\"],\n[\"9140\",\"繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻\"],\n[\"9180\",\"操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只\"],\n[\"9240\",\"叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄\"],\n[\"9280\",\"逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓\"],\n[\"9340\",\"邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬\"],\n[\"9380\",\"凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入\"],\n[\"9440\",\"如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅\"],\n[\"9480\",\"楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美\"],\n[\"9540\",\"鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷\"],\n[\"9580\",\"斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋\"],\n[\"9640\",\"法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆\"],\n[\"9680\",\"摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒\"],\n[\"9740\",\"諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲\"],\n[\"9780\",\"沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯\"],\n[\"9840\",\"蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕\"],\n[\"989f\",\"弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲\"],\n[\"9940\",\"僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭\"],\n[\"9980\",\"凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨\"],\n[\"9a40\",\"咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸\"],\n[\"9a80\",\"噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩\"],\n[\"9b40\",\"奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀\"],\n[\"9b80\",\"它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏\"],\n[\"9c40\",\"廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠\"],\n[\"9c80\",\"怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛\"],\n[\"9d40\",\"戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫\"],\n[\"9d80\",\"捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼\"],\n[\"9e40\",\"曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎\"],\n[\"9e80\",\"梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣\"],\n[\"9f40\",\"檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯\"],\n[\"9f80\",\"麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌\"],\n[\"e040\",\"漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝\"],\n[\"e080\",\"烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱\"],\n[\"e140\",\"瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿\"],\n[\"e180\",\"痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬\"],\n[\"e240\",\"磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰\"],\n[\"e280\",\"窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆\"],\n[\"e340\",\"紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷\"],\n[\"e380\",\"縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋\"],\n[\"e440\",\"隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤\"],\n[\"e480\",\"艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈\"],\n[\"e540\",\"蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬\"],\n[\"e580\",\"蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞\"],\n[\"e640\",\"襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧\"],\n[\"e680\",\"諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊\"],\n[\"e740\",\"蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜\"],\n[\"e780\",\"轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮\"],\n[\"e840\",\"錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙\"],\n[\"e880\",\"閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰\"],\n[\"e940\",\"顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃\"],\n[\"e980\",\"騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈\"],\n[\"ea40\",\"鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯\"],\n[\"ea80\",\"黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙\"],\n[\"ed40\",\"纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏\"],\n[\"ed80\",\"塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱\"],\n[\"ee40\",\"犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙\"],\n[\"ee80\",\"蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑\"],\n[\"eeef\",\"ⅰ\",9,\"￢￤＇＂\"],\n[\"f040\",\"\",62],\n[\"f080\",\"\",124],\n[\"f140\",\"\",62],\n[\"f180\",\"\",124],\n[\"f240\",\"\",62],\n[\"f280\",\"\",124],\n[\"f340\",\"\",62],\n[\"f380\",\"\",124],\n[\"f440\",\"\",62],\n[\"f480\",\"\",124],\n[\"f540\",\"\",62],\n[\"f580\",\"\",124],\n[\"f640\",\"\",62],\n[\"f680\",\"\",124],\n[\"f740\",\"\",62],\n[\"f780\",\"\",124],\n[\"f840\",\"\",62],\n[\"f880\",\"\",124],\n[\"f940\",\"\"],\n[\"fa40\",\"ⅰ\",9,\"Ⅰ\",9,\"￢￤＇＂㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊\"],\n[\"fa80\",\"兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯\"],\n[\"fb40\",\"涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神\"],\n[\"fb80\",\"祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙\"],\n[\"fc40\",\"髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑\"]\n]\n\n},{}],25:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\n// == UTF16-BE codec. ==========================================================\n\nexports.utf16be = Utf16BECodec;\nfunction Utf16BECodec() {\n}\n\nUtf16BECodec.prototype.encoder = Utf16BEEncoder;\nUtf16BECodec.prototype.decoder = Utf16BEDecoder;\nUtf16BECodec.prototype.bomAware = true;\n\n\n// -- Encoding\n\nfunction Utf16BEEncoder() {\n}\n\nUtf16BEEncoder.prototype.write = function(str) {\n    var buf = new Buffer(str, 'ucs2');\n    for (var i = 0; i < buf.length; i += 2) {\n        var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp;\n    }\n    return buf;\n}\n\nUtf16BEEncoder.prototype.end = function() {\n}\n\n\n// -- Decoding\n\nfunction Utf16BEDecoder() {\n    this.overflowByte = -1;\n}\n\nUtf16BEDecoder.prototype.write = function(buf) {\n    if (buf.length == 0)\n        return '';\n\n    var buf2 = new Buffer(buf.length + 1),\n        i = 0, j = 0;\n\n    if (this.overflowByte !== -1) {\n        buf2[0] = buf[0];\n        buf2[1] = this.overflowByte;\n        i = 1; j = 2;\n    }\n\n    for (; i < buf.length-1; i += 2, j+= 2) {\n        buf2[j] = buf[i+1];\n        buf2[j+1] = buf[i];\n    }\n\n    this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1;\n\n    return buf2.slice(0, j).toString('ucs2');\n}\n\nUtf16BEDecoder.prototype.end = function() {\n}\n\n\n// == UTF-16 codec =============================================================\n// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic.\n// Defaults to UTF-16LE, as it's prevalent and default in Node.\n// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le\n// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'});\n\n// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false).\n\nexports.utf16 = Utf16Codec;\nfunction Utf16Codec(codecOptions, iconv) {\n    this.iconv = iconv;\n}\n\nUtf16Codec.prototype.encoder = Utf16Encoder;\nUtf16Codec.prototype.decoder = Utf16Decoder;\n\n\n// -- Encoding (pass-through)\n\nfunction Utf16Encoder(options, codec) {\n    options = options || {};\n    if (options.addBOM === undefined)\n        options.addBOM = true;\n    this.encoder = codec.iconv.getEncoder('utf-16le', options);\n}\n\nUtf16Encoder.prototype.write = function(str) {\n    return this.encoder.write(str);\n}\n\nUtf16Encoder.prototype.end = function() {\n    return this.encoder.end();\n}\n\n\n// -- Decoding\n\nfunction Utf16Decoder(options, codec) {\n    this.decoder = null;\n    this.initialBytes = [];\n    this.initialBytesLen = 0;\n\n    this.options = options || {};\n    this.iconv = codec.iconv;\n}\n\nUtf16Decoder.prototype.write = function(buf) {\n    if (!this.decoder) {\n        // Codec is not chosen yet. Accumulate initial bytes.\n        this.initialBytes.push(buf);\n        this.initialBytesLen += buf.length;\n        \n        if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below)\n            return '';\n\n        // We have enough bytes -> detect endianness.\n        var buf = Buffer.concat(this.initialBytes),\n            encoding = detectEncoding(buf, this.options.defaultEncoding);\n        this.decoder = this.iconv.getDecoder(encoding, this.options);\n        this.initialBytes.length = this.initialBytesLen = 0;\n    }\n\n    return this.decoder.write(buf);\n}\n\nUtf16Decoder.prototype.end = function() {\n    if (!this.decoder) {\n        var buf = Buffer.concat(this.initialBytes),\n            encoding = detectEncoding(buf, this.options.defaultEncoding);\n        this.decoder = this.iconv.getDecoder(encoding, this.options);\n\n        var res = this.decoder.write(buf),\n            trail = this.decoder.end();\n\n        return trail ? (res + trail) : res;\n    }\n    return this.decoder.end();\n}\n\nfunction detectEncoding(buf, defaultEncoding) {\n    var enc = defaultEncoding || 'utf-16le';\n\n    if (buf.length >= 2) {\n        // Check BOM.\n        if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM\n            enc = 'utf-16be';\n        else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM\n            enc = 'utf-16le';\n        else {\n            // No BOM found. Try to deduce encoding from initial content.\n            // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.\n            // So, we count ASCII as if it was LE or BE, and decide from that.\n            var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions\n                _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even.\n\n            for (var i = 0; i < _len; i += 2) {\n                if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++;\n                if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++;\n            }\n\n            if (asciiCharsBE > asciiCharsLE)\n                enc = 'utf-16be';\n            else if (asciiCharsBE < asciiCharsLE)\n                enc = 'utf-16le';\n        }\n    }\n\n    return enc;\n}\n\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5}],26:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\n// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152\n// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3\n\nexports.utf7 = Utf7Codec;\nexports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7\nfunction Utf7Codec(codecOptions, iconv) {\n    this.iconv = iconv;\n};\n\nUtf7Codec.prototype.encoder = Utf7Encoder;\nUtf7Codec.prototype.decoder = Utf7Decoder;\nUtf7Codec.prototype.bomAware = true;\n\n\n// -- Encoding\n\nvar nonDirectChars = /[^A-Za-z0-9'\\(\\),-\\.\\/:\\? \\n\\r\\t]+/g;\n\nfunction Utf7Encoder(options, codec) {\n    this.iconv = codec.iconv;\n}\n\nUtf7Encoder.prototype.write = function(str) {\n    // Naive implementation.\n    // Non-direct chars are encoded as \"+<base64>-\"; single \"+\" char is encoded as \"+-\".\n    return new Buffer(str.replace(nonDirectChars, function(chunk) {\n        return \"+\" + (chunk === '+' ? '' : \n            this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) \n            + \"-\";\n    }.bind(this)));\n}\n\nUtf7Encoder.prototype.end = function() {\n}\n\n\n// -- Decoding\n\nfunction Utf7Decoder(options, codec) {\n    this.iconv = codec.iconv;\n    this.inBase64 = false;\n    this.base64Accum = '';\n}\n\nvar base64Regex = /[A-Za-z0-9\\/+]/;\nvar base64Chars = [];\nfor (var i = 0; i < 256; i++)\n    base64Chars[i] = base64Regex.test(String.fromCharCode(i));\n\nvar plusChar = '+'.charCodeAt(0), \n    minusChar = '-'.charCodeAt(0),\n    andChar = '&'.charCodeAt(0);\n\nUtf7Decoder.prototype.write = function(buf) {\n    var res = \"\", lastI = 0,\n        inBase64 = this.inBase64,\n        base64Accum = this.base64Accum;\n\n    // The decoder is more involved as we must handle chunks in stream.\n\n    for (var i = 0; i < buf.length; i++) {\n        if (!inBase64) { // We're in direct mode.\n            // Write direct chars until '+'\n            if (buf[i] == plusChar) {\n                res += this.iconv.decode(buf.slice(lastI, i), \"ascii\"); // Write direct chars.\n                lastI = i+1;\n                inBase64 = true;\n            }\n        } else { // We decode base64.\n            if (!base64Chars[buf[i]]) { // Base64 ended.\n                if (i == lastI && buf[i] == minusChar) {// \"+-\" -> \"+\"\n                    res += \"+\";\n                } else {\n                    var b64str = base64Accum + buf.slice(lastI, i).toString();\n                    res += this.iconv.decode(new Buffer(b64str, 'base64'), \"utf16-be\");\n                }\n\n                if (buf[i] != minusChar) // Minus is absorbed after base64.\n                    i--;\n\n                lastI = i+1;\n                inBase64 = false;\n                base64Accum = '';\n            }\n        }\n    }\n\n    if (!inBase64) {\n        res += this.iconv.decode(buf.slice(lastI), \"ascii\"); // Write direct chars.\n    } else {\n        var b64str = base64Accum + buf.slice(lastI).toString();\n\n        var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.\n        base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.\n        b64str = b64str.slice(0, canBeDecoded);\n\n        res += this.iconv.decode(new Buffer(b64str, 'base64'), \"utf16-be\");\n    }\n\n    this.inBase64 = inBase64;\n    this.base64Accum = base64Accum;\n\n    return res;\n}\n\nUtf7Decoder.prototype.end = function() {\n    var res = \"\";\n    if (this.inBase64 && this.base64Accum.length > 0)\n        res = this.iconv.decode(new Buffer(this.base64Accum, 'base64'), \"utf16-be\");\n\n    this.inBase64 = false;\n    this.base64Accum = '';\n    return res;\n}\n\n\n// UTF-7-IMAP codec.\n// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3)\n// Differences:\n//  * Base64 part is started by \"&\" instead of \"+\"\n//  * Direct characters are 0x20-0x7E, except \"&\" (0x26)\n//  * In Base64, \",\" is used instead of \"/\"\n//  * Base64 must not be used to represent direct characters.\n//  * No implicit shift back from Base64 (should always end with '-')\n//  * String must end in non-shifted position.\n//  * \"-&\" while in base64 is not allowed.\n\n\nexports.utf7imap = Utf7IMAPCodec;\nfunction Utf7IMAPCodec(codecOptions, iconv) {\n    this.iconv = iconv;\n};\n\nUtf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;\nUtf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;\nUtf7IMAPCodec.prototype.bomAware = true;\n\n\n// -- Encoding\n\nfunction Utf7IMAPEncoder(options, codec) {\n    this.iconv = codec.iconv;\n    this.inBase64 = false;\n    this.base64Accum = new Buffer(6);\n    this.base64AccumIdx = 0;\n}\n\nUtf7IMAPEncoder.prototype.write = function(str) {\n    var inBase64 = this.inBase64,\n        base64Accum = this.base64Accum,\n        base64AccumIdx = this.base64AccumIdx,\n        buf = new Buffer(str.length*5 + 10), bufIdx = 0;\n\n    for (var i = 0; i < str.length; i++) {\n        var uChar = str.charCodeAt(i);\n        if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'.\n            if (inBase64) {\n                if (base64AccumIdx > 0) {\n                    bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\\//g, ',').replace(/=+$/, ''), bufIdx);\n                    base64AccumIdx = 0;\n                }\n\n                buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.\n                inBase64 = false;\n            }\n\n            if (!inBase64) {\n                buf[bufIdx++] = uChar; // Write direct character\n\n                if (uChar === andChar)  // Ampersand -> '&-'\n                    buf[bufIdx++] = minusChar;\n            }\n\n        } else { // Non-direct character\n            if (!inBase64) {\n                buf[bufIdx++] = andChar; // Write '&', then go to base64 mode.\n                inBase64 = true;\n            }\n            if (inBase64) {\n                base64Accum[base64AccumIdx++] = uChar >> 8;\n                base64Accum[base64AccumIdx++] = uChar & 0xFF;\n\n                if (base64AccumIdx == base64Accum.length) {\n                    bufIdx += buf.write(base64Accum.toString('base64').replace(/\\//g, ','), bufIdx);\n                    base64AccumIdx = 0;\n                }\n            }\n        }\n    }\n\n    this.inBase64 = inBase64;\n    this.base64AccumIdx = base64AccumIdx;\n\n    return buf.slice(0, bufIdx);\n}\n\nUtf7IMAPEncoder.prototype.end = function() {\n    var buf = new Buffer(10), bufIdx = 0;\n    if (this.inBase64) {\n        if (this.base64AccumIdx > 0) {\n            bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\\//g, ',').replace(/=+$/, ''), bufIdx);\n            this.base64AccumIdx = 0;\n        }\n\n        buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.\n        this.inBase64 = false;\n    }\n\n    return buf.slice(0, bufIdx);\n}\n\n\n// -- Decoding\n\nfunction Utf7IMAPDecoder(options, codec) {\n    this.iconv = codec.iconv;\n    this.inBase64 = false;\n    this.base64Accum = '';\n}\n\nvar base64IMAPChars = base64Chars.slice();\nbase64IMAPChars[','.charCodeAt(0)] = true;\n\nUtf7IMAPDecoder.prototype.write = function(buf) {\n    var res = \"\", lastI = 0,\n        inBase64 = this.inBase64,\n        base64Accum = this.base64Accum;\n\n    // The decoder is more involved as we must handle chunks in stream.\n    // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end).\n\n    for (var i = 0; i < buf.length; i++) {\n        if (!inBase64) { // We're in direct mode.\n            // Write direct chars until '&'\n            if (buf[i] == andChar) {\n                res += this.iconv.decode(buf.slice(lastI, i), \"ascii\"); // Write direct chars.\n                lastI = i+1;\n                inBase64 = true;\n            }\n        } else { // We decode base64.\n            if (!base64IMAPChars[buf[i]]) { // Base64 ended.\n                if (i == lastI && buf[i] == minusChar) { // \"&-\" -> \"&\"\n                    res += \"&\";\n                } else {\n                    var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/');\n                    res += this.iconv.decode(new Buffer(b64str, 'base64'), \"utf16-be\");\n                }\n\n                if (buf[i] != minusChar) // Minus may be absorbed after base64.\n                    i--;\n\n                lastI = i+1;\n                inBase64 = false;\n                base64Accum = '';\n            }\n        }\n    }\n\n    if (!inBase64) {\n        res += this.iconv.decode(buf.slice(lastI), \"ascii\"); // Write direct chars.\n    } else {\n        var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/');\n\n        var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.\n        base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.\n        b64str = b64str.slice(0, canBeDecoded);\n\n        res += this.iconv.decode(new Buffer(b64str, 'base64'), \"utf16-be\");\n    }\n\n    this.inBase64 = inBase64;\n    this.base64Accum = base64Accum;\n\n    return res;\n}\n\nUtf7IMAPDecoder.prototype.end = function() {\n    var res = \"\";\n    if (this.inBase64 && this.base64Accum.length > 0)\n        res = this.iconv.decode(new Buffer(this.base64Accum, 'base64'), \"utf16-be\");\n\n    this.inBase64 = false;\n    this.base64Accum = '';\n    return res;\n}\n\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5}],27:[function(require,module,exports){\n\"use strict\"\n\nvar BOMChar = '\\uFEFF';\n\nexports.PrependBOM = PrependBOMWrapper\nfunction PrependBOMWrapper(encoder, options) {\n    this.encoder = encoder;\n    this.addBOM = true;\n}\n\nPrependBOMWrapper.prototype.write = function(str) {\n    if (this.addBOM) {\n        str = BOMChar + str;\n        this.addBOM = false;\n    }\n\n    return this.encoder.write(str);\n}\n\nPrependBOMWrapper.prototype.end = function() {\n    return this.encoder.end();\n}\n\n\n//------------------------------------------------------------------------------\n\nexports.StripBOM = StripBOMWrapper;\nfunction StripBOMWrapper(decoder, options) {\n    this.decoder = decoder;\n    this.pass = false;\n    this.options = options || {};\n}\n\nStripBOMWrapper.prototype.write = function(buf) {\n    var res = this.decoder.write(buf);\n    if (this.pass || !res)\n        return res;\n\n    if (res[0] === BOMChar) {\n        res = res.slice(1);\n        if (typeof this.options.stripBOM === 'function')\n            this.options.stripBOM();\n    }\n\n    this.pass = true;\n    return res;\n}\n\nStripBOMWrapper.prototype.end = function() {\n    return this.decoder.end();\n}\n\n\n},{}],28:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\n// == Extend Node primitives to use iconv-lite =================================\n\nmodule.exports = function (iconv) {\n    var original = undefined; // Place to keep original methods.\n\n    // Node authors rewrote Buffer internals to make it compatible with\n    // Uint8Array and we cannot patch key functions since then.\n    iconv.supportsNodeEncodingsExtension = !(new Buffer(0) instanceof Uint8Array);\n\n    iconv.extendNodeEncodings = function extendNodeEncodings() {\n        if (original) return;\n        original = {};\n\n        if (!iconv.supportsNodeEncodingsExtension) {\n            console.error(\"ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node\");\n            console.error(\"See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility\");\n            return;\n        }\n\n        var nodeNativeEncodings = {\n            'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, \n            'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true,\n        };\n\n        Buffer.isNativeEncoding = function(enc) {\n            return enc && nodeNativeEncodings[enc.toLowerCase()];\n        }\n\n        // -- SlowBuffer -----------------------------------------------------------\n        var SlowBuffer = require('buffer').SlowBuffer;\n\n        original.SlowBufferToString = SlowBuffer.prototype.toString;\n        SlowBuffer.prototype.toString = function(encoding, start, end) {\n            encoding = String(encoding || 'utf8').toLowerCase();\n\n            // Use native conversion when possible\n            if (Buffer.isNativeEncoding(encoding))\n                return original.SlowBufferToString.call(this, encoding, start, end);\n\n            // Otherwise, use our decoding method.\n            if (typeof start == 'undefined') start = 0;\n            if (typeof end == 'undefined') end = this.length;\n            return iconv.decode(this.slice(start, end), encoding);\n        }\n\n        original.SlowBufferWrite = SlowBuffer.prototype.write;\n        SlowBuffer.prototype.write = function(string, offset, length, encoding) {\n            // Support both (string, offset, length, encoding)\n            // and the legacy (string, encoding, offset, length)\n            if (isFinite(offset)) {\n                if (!isFinite(length)) {\n                    encoding = length;\n                    length = undefined;\n                }\n            } else {  // legacy\n                var swap = encoding;\n                encoding = offset;\n                offset = length;\n                length = swap;\n            }\n\n            offset = +offset || 0;\n            var remaining = this.length - offset;\n            if (!length) {\n                length = remaining;\n            } else {\n                length = +length;\n                if (length > remaining) {\n                    length = remaining;\n                }\n            }\n            encoding = String(encoding || 'utf8').toLowerCase();\n\n            // Use native conversion when possible\n            if (Buffer.isNativeEncoding(encoding))\n                return original.SlowBufferWrite.call(this, string, offset, length, encoding);\n\n            if (string.length > 0 && (length < 0 || offset < 0))\n                throw new RangeError('attempt to write beyond buffer bounds');\n\n            // Otherwise, use our encoding method.\n            var buf = iconv.encode(string, encoding);\n            if (buf.length < length) length = buf.length;\n            buf.copy(this, offset, 0, length);\n            return length;\n        }\n\n        // -- Buffer ---------------------------------------------------------------\n\n        original.BufferIsEncoding = Buffer.isEncoding;\n        Buffer.isEncoding = function(encoding) {\n            return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding);\n        }\n\n        original.BufferByteLength = Buffer.byteLength;\n        Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) {\n            encoding = String(encoding || 'utf8').toLowerCase();\n\n            // Use native conversion when possible\n            if (Buffer.isNativeEncoding(encoding))\n                return original.BufferByteLength.call(this, str, encoding);\n\n            // Slow, I know, but we don't have a better way yet.\n            return iconv.encode(str, encoding).length;\n        }\n\n        original.BufferToString = Buffer.prototype.toString;\n        Buffer.prototype.toString = function(encoding, start, end) {\n            encoding = String(encoding || 'utf8').toLowerCase();\n\n            // Use native conversion when possible\n            if (Buffer.isNativeEncoding(encoding))\n                return original.BufferToString.call(this, encoding, start, end);\n\n            // Otherwise, use our decoding method.\n            if (typeof start == 'undefined') start = 0;\n            if (typeof end == 'undefined') end = this.length;\n            return iconv.decode(this.slice(start, end), encoding);\n        }\n\n        original.BufferWrite = Buffer.prototype.write;\n        Buffer.prototype.write = function(string, offset, length, encoding) {\n            var _offset = offset, _length = length, _encoding = encoding;\n            // Support both (string, offset, length, encoding)\n            // and the legacy (string, encoding, offset, length)\n            if (isFinite(offset)) {\n                if (!isFinite(length)) {\n                    encoding = length;\n                    length = undefined;\n                }\n            } else {  // legacy\n                var swap = encoding;\n                encoding = offset;\n                offset = length;\n                length = swap;\n            }\n\n            encoding = String(encoding || 'utf8').toLowerCase();\n\n            // Use native conversion when possible\n            if (Buffer.isNativeEncoding(encoding))\n                return original.BufferWrite.call(this, string, _offset, _length, _encoding);\n\n            offset = +offset || 0;\n            var remaining = this.length - offset;\n            if (!length) {\n                length = remaining;\n            } else {\n                length = +length;\n                if (length > remaining) {\n                    length = remaining;\n                }\n            }\n\n            if (string.length > 0 && (length < 0 || offset < 0))\n                throw new RangeError('attempt to write beyond buffer bounds');\n\n            // Otherwise, use our encoding method.\n            var buf = iconv.encode(string, encoding);\n            if (buf.length < length) length = buf.length;\n            buf.copy(this, offset, 0, length);\n            return length;\n\n            // TODO: Set _charsWritten.\n        }\n\n\n        // -- Readable -------------------------------------------------------------\n        if (iconv.supportsStreams) {\n            var Readable = require('stream').Readable;\n\n            original.ReadableSetEncoding = Readable.prototype.setEncoding;\n            Readable.prototype.setEncoding = function setEncoding(enc, options) {\n                // Use our own decoder, it has the same interface.\n                // We cannot use original function as it doesn't handle BOM-s.\n                this._readableState.decoder = iconv.getDecoder(enc, options);\n                this._readableState.encoding = enc;\n            }\n\n            Readable.prototype.collect = iconv._collect;\n        }\n    }\n\n    // Remove iconv-lite Node primitive extensions.\n    iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() {\n        if (!iconv.supportsNodeEncodingsExtension)\n            return;\n        if (!original)\n            throw new Error(\"require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.\")\n\n        delete Buffer.isNativeEncoding;\n\n        var SlowBuffer = require('buffer').SlowBuffer;\n\n        SlowBuffer.prototype.toString = original.SlowBufferToString;\n        SlowBuffer.prototype.write = original.SlowBufferWrite;\n\n        Buffer.isEncoding = original.BufferIsEncoding;\n        Buffer.byteLength = original.BufferByteLength;\n        Buffer.prototype.toString = original.BufferToString;\n        Buffer.prototype.write = original.BufferWrite;\n\n        if (iconv.supportsStreams) {\n            var Readable = require('stream').Readable;\n\n            Readable.prototype.setEncoding = original.ReadableSetEncoding;\n            delete Readable.prototype.collect;\n        }\n\n        original = undefined;\n    }\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5,\"stream\":57}],29:[function(require,module,exports){\n(function (process,Buffer){\n\"use strict\"\n\nvar bomHandling = require('./bom-handling'),\n    iconv = module.exports;\n\n// All codecs and aliases are kept here, keyed by encoding name/alias.\n// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`.\niconv.encodings = null;\n\n// Characters emitted in case of error.\niconv.defaultCharUnicode = '�';\niconv.defaultCharSingleByte = '?';\n\n// Public API.\niconv.encode = function encode(str, encoding, options) {\n    str = \"\" + (str || \"\"); // Ensure string.\n\n    var encoder = iconv.getEncoder(encoding, options);\n\n    var res = encoder.write(str);\n    var trail = encoder.end();\n    \n    return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res;\n}\n\niconv.decode = function decode(buf, encoding, options) {\n    if (typeof buf === 'string') {\n        if (!iconv.skipDecodeWarning) {\n            console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding');\n            iconv.skipDecodeWarning = true;\n        }\n\n        buf = new Buffer(\"\" + (buf || \"\"), \"binary\"); // Ensure buffer.\n    }\n\n    var decoder = iconv.getDecoder(encoding, options);\n\n    var res = decoder.write(buf);\n    var trail = decoder.end();\n\n    return trail ? (res + trail) : res;\n}\n\niconv.encodingExists = function encodingExists(enc) {\n    try {\n        iconv.getCodec(enc);\n        return true;\n    } catch (e) {\n        return false;\n    }\n}\n\n// Legacy aliases to convert functions\niconv.toEncoding = iconv.encode;\niconv.fromEncoding = iconv.decode;\n\n// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache.\niconv._codecDataCache = {};\niconv.getCodec = function getCodec(encoding) {\n    if (!iconv.encodings)\n        iconv.encodings = require(\"../encodings\"); // Lazy load all encoding definitions.\n    \n    // Canonicalize encoding name: strip all non-alphanumeric chars and appended year.\n    var enc = (''+encoding).toLowerCase().replace(/[^0-9a-z]|:\\d{4}$/g, \"\");\n\n    // Traverse iconv.encodings to find actual codec.\n    var codecOptions = {};\n    while (true) {\n        var codec = iconv._codecDataCache[enc];\n        if (codec)\n            return codec;\n\n        var codecDef = iconv.encodings[enc];\n\n        switch (typeof codecDef) {\n            case \"string\": // Direct alias to other encoding.\n                enc = codecDef;\n                break;\n\n            case \"object\": // Alias with options. Can be layered.\n                for (var key in codecDef)\n                    codecOptions[key] = codecDef[key];\n\n                if (!codecOptions.encodingName)\n                    codecOptions.encodingName = enc;\n                \n                enc = codecDef.type;\n                break;\n\n            case \"function\": // Codec itself.\n                if (!codecOptions.encodingName)\n                    codecOptions.encodingName = enc;\n\n                // The codec function must load all tables and return object with .encoder and .decoder methods.\n                // It'll be called only once (for each different options object).\n                codec = new codecDef(codecOptions, iconv);\n\n                iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later.\n                return codec;\n\n            default:\n                throw new Error(\"Encoding not recognized: '\" + encoding + \"' (searched as: '\"+enc+\"')\");\n        }\n    }\n}\n\niconv.getEncoder = function getEncoder(encoding, options) {\n    var codec = iconv.getCodec(encoding),\n        encoder = new codec.encoder(options, codec);\n\n    if (codec.bomAware && options && options.addBOM)\n        encoder = new bomHandling.PrependBOM(encoder, options);\n\n    return encoder;\n}\n\niconv.getDecoder = function getDecoder(encoding, options) {\n    var codec = iconv.getCodec(encoding),\n        decoder = new codec.decoder(options, codec);\n\n    if (codec.bomAware && !(options && options.stripBOM === false))\n        decoder = new bomHandling.StripBOM(decoder, options);\n\n    return decoder;\n}\n\n\n// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json.\nvar nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node;\nif (nodeVer) {\n\n    // Load streaming support in Node v0.10+\n    var nodeVerArr = nodeVer.split(\".\").map(Number);\n    if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {\n        require(\"./streams\")(iconv);\n    }\n\n    // Load Node primitive extensions.\n    require(\"./extend-node\")(iconv);\n}\n\n\n}).call(this,require('_process'),require(\"buffer\").Buffer)\n},{\"../encodings\":12,\"./bom-handling\":27,\"./extend-node\":28,\"./streams\":30,\"_process\":36,\"buffer\":5}],30:[function(require,module,exports){\n(function (Buffer){\n\"use strict\"\n\nvar Transform = require(\"stream\").Transform;\n\n\n// == Exports ==================================================================\nmodule.exports = function(iconv) {\n    \n    // Additional Public API.\n    iconv.encodeStream = function encodeStream(encoding, options) {\n        return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);\n    }\n\n    iconv.decodeStream = function decodeStream(encoding, options) {\n        return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);\n    }\n\n    iconv.supportsStreams = true;\n\n\n    // Not published yet.\n    iconv.IconvLiteEncoderStream = IconvLiteEncoderStream;\n    iconv.IconvLiteDecoderStream = IconvLiteDecoderStream;\n    iconv._collect = IconvLiteDecoderStream.prototype.collect;\n};\n\n\n// == Encoder stream =======================================================\nfunction IconvLiteEncoderStream(conv, options) {\n    this.conv = conv;\n    options = options || {};\n    options.decodeStrings = false; // We accept only strings, so we don't need to decode them.\n    Transform.call(this, options);\n}\n\nIconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {\n    constructor: { value: IconvLiteEncoderStream }\n});\n\nIconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {\n    if (typeof chunk != 'string')\n        return done(new Error(\"Iconv encoding stream needs strings as its input.\"));\n    try {\n        var res = this.conv.write(chunk);\n        if (res && res.length) this.push(res);\n        done();\n    }\n    catch (e) {\n        done(e);\n    }\n}\n\nIconvLiteEncoderStream.prototype._flush = function(done) {\n    try {\n        var res = this.conv.end();\n        if (res && res.length) this.push(res);\n        done();\n    }\n    catch (e) {\n        done(e);\n    }\n}\n\nIconvLiteEncoderStream.prototype.collect = function(cb) {\n    var chunks = [];\n    this.on('error', cb);\n    this.on('data', function(chunk) { chunks.push(chunk); });\n    this.on('end', function() {\n        cb(null, Buffer.concat(chunks));\n    });\n    return this;\n}\n\n\n// == Decoder stream =======================================================\nfunction IconvLiteDecoderStream(conv, options) {\n    this.conv = conv;\n    options = options || {};\n    options.encoding = this.encoding = 'utf8'; // We output strings.\n    Transform.call(this, options);\n}\n\nIconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {\n    constructor: { value: IconvLiteDecoderStream }\n});\n\nIconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {\n    if (!Buffer.isBuffer(chunk))\n        return done(new Error(\"Iconv decoding stream needs buffers as its input.\"));\n    try {\n        var res = this.conv.write(chunk);\n        if (res && res.length) this.push(res, this.encoding);\n        done();\n    }\n    catch (e) {\n        done(e);\n    }\n}\n\nIconvLiteDecoderStream.prototype._flush = function(done) {\n    try {\n        var res = this.conv.end();\n        if (res && res.length) this.push(res, this.encoding);                \n        done();\n    }\n    catch (e) {\n        done(e);\n    }\n}\n\nIconvLiteDecoderStream.prototype.collect = function(cb) {\n    var res = '';\n    this.on('error', cb);\n    this.on('data', function(chunk) { res += chunk; });\n    this.on('end', function() {\n        cb(null, res);\n    });\n    return this;\n}\n\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5,\"stream\":57}],31:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n  var e, m\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var nBits = -7\n  var i = isLE ? (nBytes - 1) : 0\n  var d = isLE ? -1 : 1\n  var s = buffer[offset + i]\n\n  i += d\n\n  e = s & ((1 << (-nBits)) - 1)\n  s >>= (-nBits)\n  nBits += eLen\n  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  m = e & ((1 << (-nBits)) - 1)\n  e >>= (-nBits)\n  nBits += mLen\n  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}\n\n  if (e === 0) {\n    e = 1 - eBias\n  } else if (e === eMax) {\n    return m ? NaN : ((s ? -1 : 1) * Infinity)\n  } else {\n    m = m + Math.pow(2, mLen)\n    e = e - eBias\n  }\n  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n  var e, m, c\n  var eLen = nBytes * 8 - mLen - 1\n  var eMax = (1 << eLen) - 1\n  var eBias = eMax >> 1\n  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n  var i = isLE ? 0 : (nBytes - 1)\n  var d = isLE ? 1 : -1\n  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n  value = Math.abs(value)\n\n  if (isNaN(value) || value === Infinity) {\n    m = isNaN(value) ? 1 : 0\n    e = eMax\n  } else {\n    e = Math.floor(Math.log(value) / Math.LN2)\n    if (value * (c = Math.pow(2, -e)) < 1) {\n      e--\n      c *= 2\n    }\n    if (e + eBias >= 1) {\n      value += rt / c\n    } else {\n      value += rt * Math.pow(2, 1 - eBias)\n    }\n    if (value * c >= 2) {\n      e++\n      c /= 2\n    }\n\n    if (e + eBias >= eMax) {\n      m = 0\n      e = eMax\n    } else if (e + eBias >= 1) {\n      m = (value * c - 1) * Math.pow(2, mLen)\n      e = e + eBias\n    } else {\n      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n      e = 0\n    }\n  }\n\n  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n  e = (e << mLen) | m\n  eLen += mLen\n  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n  buffer[offset + i - d] |= s * 128\n}\n\n},{}],32:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n  // implementation from standard node.js 'util' module\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    ctor.prototype = Object.create(superCtor.prototype, {\n      constructor: {\n        value: ctor,\n        enumerable: false,\n        writable: true,\n        configurable: true\n      }\n    });\n  };\n} else {\n  // old school shim for old browsers\n  module.exports = function inherits(ctor, superCtor) {\n    ctor.super_ = superCtor\n    var TempCtor = function () {}\n    TempCtor.prototype = superCtor.prototype\n    ctor.prototype = new TempCtor()\n    ctor.prototype.constructor = ctor\n  }\n}\n\n},{}],33:[function(require,module,exports){\n/**\n * Determine if an object is Buffer\n *\n * Author:   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * License:  MIT\n *\n * `npm install is-buffer`\n */\n\nmodule.exports = function (obj) {\n  return !!(obj != null &&\n    (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)\n      (obj.constructor &&\n      typeof obj.constructor.isBuffer === 'function' &&\n      obj.constructor.isBuffer(obj))\n    ))\n}\n\n},{}],34:[function(require,module,exports){\n(function (process){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n  // if the path tries to go above the root, `up` ends up > 0\n  var up = 0;\n  for (var i = parts.length - 1; i >= 0; i--) {\n    var last = parts[i];\n    if (last === '.') {\n      parts.splice(i, 1);\n    } else if (last === '..') {\n      parts.splice(i, 1);\n      up++;\n    } else if (up) {\n      parts.splice(i, 1);\n      up--;\n    }\n  }\n\n  // if the path is allowed to go above the root, restore leading ..s\n  if (allowAboveRoot) {\n    for (; up--; up) {\n      parts.unshift('..');\n    }\n  }\n\n  return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n    /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n  return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n  var resolvedPath = '',\n      resolvedAbsolute = false;\n\n  for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n    var path = (i >= 0) ? arguments[i] : process.cwd();\n\n    // Skip empty and invalid entries\n    if (typeof path !== 'string') {\n      throw new TypeError('Arguments to path.resolve must be strings');\n    } else if (!path) {\n      continue;\n    }\n\n    resolvedPath = path + '/' + resolvedPath;\n    resolvedAbsolute = path.charAt(0) === '/';\n  }\n\n  // At this point the path should be resolved to a full absolute path, but\n  // handle relative paths to be safe (might happen when process.cwd() fails)\n\n  // Normalize the path\n  resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n    return !!p;\n  }), !resolvedAbsolute).join('/');\n\n  return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n  var isAbsolute = exports.isAbsolute(path),\n      trailingSlash = substr(path, -1) === '/';\n\n  // Normalize the path\n  path = normalizeArray(filter(path.split('/'), function(p) {\n    return !!p;\n  }), !isAbsolute).join('/');\n\n  if (!path && !isAbsolute) {\n    path = '.';\n  }\n  if (path && trailingSlash) {\n    path += '/';\n  }\n\n  return (isAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n  return path.charAt(0) === '/';\n};\n\n// posix version\nexports.join = function() {\n  var paths = Array.prototype.slice.call(arguments, 0);\n  return exports.normalize(filter(paths, function(p, index) {\n    if (typeof p !== 'string') {\n      throw new TypeError('Arguments to path.join must be strings');\n    }\n    return p;\n  }).join('/'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n  from = exports.resolve(from).substr(1);\n  to = exports.resolve(to).substr(1);\n\n  function trim(arr) {\n    var start = 0;\n    for (; start < arr.length; start++) {\n      if (arr[start] !== '') break;\n    }\n\n    var end = arr.length - 1;\n    for (; end >= 0; end--) {\n      if (arr[end] !== '') break;\n    }\n\n    if (start > end) return [];\n    return arr.slice(start, end - start + 1);\n  }\n\n  var fromParts = trim(from.split('/'));\n  var toParts = trim(to.split('/'));\n\n  var length = Math.min(fromParts.length, toParts.length);\n  var samePartsLength = length;\n  for (var i = 0; i < length; i++) {\n    if (fromParts[i] !== toParts[i]) {\n      samePartsLength = i;\n      break;\n    }\n  }\n\n  var outputParts = [];\n  for (var i = samePartsLength; i < fromParts.length; i++) {\n    outputParts.push('..');\n  }\n\n  outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n  return outputParts.join('/');\n};\n\nexports.sep = '/';\nexports.delimiter = ':';\n\nexports.dirname = function(path) {\n  var result = splitPath(path),\n      root = result[0],\n      dir = result[1];\n\n  if (!root && !dir) {\n    // No dirname whatsoever\n    return '.';\n  }\n\n  if (dir) {\n    // It has a dirname, strip trailing slash\n    dir = dir.substr(0, dir.length - 1);\n  }\n\n  return root + dir;\n};\n\n\nexports.basename = function(path, ext) {\n  var f = splitPath(path)[2];\n  // TODO: make this comparison case-insensitive on windows?\n  if (ext && f.substr(-1 * ext.length) === ext) {\n    f = f.substr(0, f.length - ext.length);\n  }\n  return f;\n};\n\n\nexports.extname = function(path) {\n  return splitPath(path)[3];\n};\n\nfunction filter (xs, f) {\n    if (xs.filter) return xs.filter(f);\n    var res = [];\n    for (var i = 0; i < xs.length; i++) {\n        if (f(xs[i], i, xs)) res.push(xs[i]);\n    }\n    return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b'\n    ? function (str, start, len) { return str.substr(start, len) }\n    : function (str, start, len) {\n        if (start < 0) start = str.length + start;\n        return str.substr(start, len);\n    }\n;\n\n}).call(this,require('_process'))\n},{\"_process\":36}],35:[function(require,module,exports){\n(function (process){\n'use strict';\n\nif (!process.version ||\n    process.version.indexOf('v0.') === 0 ||\n    process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n  module.exports = nextTick;\n} else {\n  module.exports = process.nextTick;\n}\n\nfunction nextTick(fn) {\n  var args = new Array(arguments.length - 1);\n  var i = 0;\n  while (i < args.length) {\n    args[i++] = arguments[i];\n  }\n  process.nextTick(function afterTick() {\n    fn.apply(null, args);\n  });\n}\n\n}).call(this,require('_process'))\n},{\"_process\":36}],36:[function(require,module,exports){\n// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n    draining = false;\n    if (currentQueue.length) {\n        queue = currentQueue.concat(queue);\n    } else {\n        queueIndex = -1;\n    }\n    if (queue.length) {\n        drainQueue();\n    }\n}\n\nfunction drainQueue() {\n    if (draining) {\n        return;\n    }\n    var timeout = setTimeout(cleanUpNextTick);\n    draining = true;\n\n    var len = queue.length;\n    while(len) {\n        currentQueue = queue;\n        queue = [];\n        while (++queueIndex < len) {\n            if (currentQueue) {\n                currentQueue[queueIndex].run();\n            }\n        }\n        queueIndex = -1;\n        len = queue.length;\n    }\n    currentQueue = null;\n    draining = false;\n    clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n    var args = new Array(arguments.length - 1);\n    if (arguments.length > 1) {\n        for (var i = 1; i < arguments.length; i++) {\n            args[i - 1] = arguments[i];\n        }\n    }\n    queue.push(new Item(fun, args));\n    if (queue.length === 1 && !draining) {\n        setTimeout(drainQueue, 0);\n    }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n    this.fun = fun;\n    this.array = array;\n}\nItem.prototype.run = function () {\n    this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n    throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n    throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],37:[function(require,module,exports){\n/*\n (c) 2015, Vladimir Agafonkin\n RBush, a JavaScript library for high-performance 2D spatial indexing of points and rectangles.\n https://github.com/mourner/rbush\n*/\n\n(function () {\n'use strict';\n\nfunction rbush(maxEntries, format) {\n\n    // jshint newcap: false, validthis: true\n    if (!(this instanceof rbush)) return new rbush(maxEntries, format);\n\n    // max entries in a node is 9 by default; min node fill is 40% for best performance\n    this._maxEntries = Math.max(4, maxEntries || 9);\n    this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));\n\n    if (format) {\n        this._initFormat(format);\n    }\n\n    this.clear();\n}\n\nrbush.prototype = {\n\n    all: function () {\n        return this._all(this.data, []);\n    },\n\n    search: function (bbox) {\n\n        var node = this.data,\n            result = [],\n            toBBox = this.toBBox;\n\n        if (!intersects(bbox, node.bbox)) return result;\n\n        var nodesToSearch = [],\n            i, len, child, childBBox;\n\n        while (node) {\n            for (i = 0, len = node.children.length; i < len; i++) {\n\n                child = node.children[i];\n                childBBox = node.leaf ? toBBox(child) : child.bbox;\n\n                if (intersects(bbox, childBBox)) {\n                    if (node.leaf) result.push(child);\n                    else if (contains(bbox, childBBox)) this._all(child, result);\n                    else nodesToSearch.push(child);\n                }\n            }\n            node = nodesToSearch.pop();\n        }\n\n        return result;\n    },\n\n    collides: function (bbox) {\n\n        var node = this.data,\n            toBBox = this.toBBox;\n\n        if (!intersects(bbox, node.bbox)) return false;\n\n        var nodesToSearch = [],\n            i, len, child, childBBox;\n\n        while (node) {\n            for (i = 0, len = node.children.length; i < len; i++) {\n\n                child = node.children[i];\n                childBBox = node.leaf ? toBBox(child) : child.bbox;\n\n                if (intersects(bbox, childBBox)) {\n                    if (node.leaf || contains(bbox, childBBox)) return true;\n                    nodesToSearch.push(child);\n                }\n            }\n            node = nodesToSearch.pop();\n        }\n\n        return false;\n    },\n\n    load: function (data) {\n        if (!(data && data.length)) return this;\n\n        if (data.length < this._minEntries) {\n            for (var i = 0, len = data.length; i < len; i++) {\n                this.insert(data[i]);\n            }\n            return this;\n        }\n\n        // recursively build the tree with the given data from stratch using OMT algorithm\n        var node = this._build(data.slice(), 0, data.length - 1, 0);\n\n        if (!this.data.children.length) {\n            // save as is if tree is empty\n            this.data = node;\n\n        } else if (this.data.height === node.height) {\n            // split root if trees have the same height\n            this._splitRoot(this.data, node);\n\n        } else {\n            if (this.data.height < node.height) {\n                // swap trees if inserted one is bigger\n                var tmpNode = this.data;\n                this.data = node;\n                node = tmpNode;\n            }\n\n            // insert the small tree into the large tree at appropriate level\n            this._insert(node, this.data.height - node.height - 1, true);\n        }\n\n        return this;\n    },\n\n    insert: function (item) {\n        if (item) this._insert(item, this.data.height - 1);\n        return this;\n    },\n\n    clear: function () {\n        this.data = {\n            children: [],\n            height: 1,\n            bbox: empty(),\n            leaf: true\n        };\n        return this;\n    },\n\n    remove: function (item) {\n        if (!item) return this;\n\n        var node = this.data,\n            bbox = this.toBBox(item),\n            path = [],\n            indexes = [],\n            i, parent, index, goingUp;\n\n        // depth-first iterative tree traversal\n        while (node || path.length) {\n\n            if (!node) { // go up\n                node = path.pop();\n                parent = path[path.length - 1];\n                i = indexes.pop();\n                goingUp = true;\n            }\n\n            if (node.leaf) { // check current node\n                index = node.children.indexOf(item);\n\n                if (index !== -1) {\n                    // item found, remove the item and condense tree upwards\n                    node.children.splice(index, 1);\n                    path.push(node);\n                    this._condense(path);\n                    return this;\n                }\n            }\n\n            if (!goingUp && !node.leaf && contains(node.bbox, bbox)) { // go down\n                path.push(node);\n                indexes.push(i);\n                i = 0;\n                parent = node;\n                node = node.children[0];\n\n            } else if (parent) { // go right\n                i++;\n                node = parent.children[i];\n                goingUp = false;\n\n            } else node = null; // nothing found\n        }\n\n        return this;\n    },\n\n    toBBox: function (item) { return item; },\n\n    compareMinX: function (a, b) { return a[0] - b[0]; },\n    compareMinY: function (a, b) { return a[1] - b[1]; },\n\n    toJSON: function () { return this.data; },\n\n    fromJSON: function (data) {\n        this.data = data;\n        return this;\n    },\n\n    _all: function (node, result) {\n        var nodesToSearch = [];\n        while (node) {\n            if (node.leaf) result.push.apply(result, node.children);\n            else nodesToSearch.push.apply(nodesToSearch, node.children);\n\n            node = nodesToSearch.pop();\n        }\n        return result;\n    },\n\n    _build: function (items, left, right, height) {\n\n        var N = right - left + 1,\n            M = this._maxEntries,\n            node;\n\n        if (N <= M) {\n            // reached leaf level; return leaf\n            node = {\n                children: items.slice(left, right + 1),\n                height: 1,\n                bbox: null,\n                leaf: true\n            };\n            calcBBox(node, this.toBBox);\n            return node;\n        }\n\n        if (!height) {\n            // target height of the bulk-loaded tree\n            height = Math.ceil(Math.log(N) / Math.log(M));\n\n            // target number of root entries to maximize storage utilization\n            M = Math.ceil(N / Math.pow(M, height - 1));\n        }\n\n        node = {\n            children: [],\n            height: height,\n            bbox: null,\n            leaf: false\n        };\n\n        // split the items into M mostly square tiles\n\n        var N2 = Math.ceil(N / M),\n            N1 = N2 * Math.ceil(Math.sqrt(M)),\n            i, j, right2, right3;\n\n        multiSelect(items, left, right, N1, this.compareMinX);\n\n        for (i = left; i <= right; i += N1) {\n\n            right2 = Math.min(i + N1 - 1, right);\n\n            multiSelect(items, i, right2, N2, this.compareMinY);\n\n            for (j = i; j <= right2; j += N2) {\n\n                right3 = Math.min(j + N2 - 1, right2);\n\n                // pack each entry recursively\n                node.children.push(this._build(items, j, right3, height - 1));\n            }\n        }\n\n        calcBBox(node, this.toBBox);\n\n        return node;\n    },\n\n    _chooseSubtree: function (bbox, node, level, path) {\n\n        var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;\n\n        while (true) {\n            path.push(node);\n\n            if (node.leaf || path.length - 1 === level) break;\n\n            minArea = minEnlargement = Infinity;\n\n            for (i = 0, len = node.children.length; i < len; i++) {\n                child = node.children[i];\n                area = bboxArea(child.bbox);\n                enlargement = enlargedArea(bbox, child.bbox) - area;\n\n                // choose entry with the least area enlargement\n                if (enlargement < minEnlargement) {\n                    minEnlargement = enlargement;\n                    minArea = area < minArea ? area : minArea;\n                    targetNode = child;\n\n                } else if (enlargement === minEnlargement) {\n                    // otherwise choose one with the smallest area\n                    if (area < minArea) {\n                        minArea = area;\n                        targetNode = child;\n                    }\n                }\n            }\n\n            node = targetNode;\n        }\n\n        return node;\n    },\n\n    _insert: function (item, level, isNode) {\n\n        var toBBox = this.toBBox,\n            bbox = isNode ? item.bbox : toBBox(item),\n            insertPath = [];\n\n        // find the best node for accommodating the item, saving all nodes along the path too\n        var node = this._chooseSubtree(bbox, this.data, level, insertPath);\n\n        // put the item into the node\n        node.children.push(item);\n        extend(node.bbox, bbox);\n\n        // split on node overflow; propagate upwards if necessary\n        while (level >= 0) {\n            if (insertPath[level].children.length > this._maxEntries) {\n                this._split(insertPath, level);\n                level--;\n            } else break;\n        }\n\n        // adjust bboxes along the insertion path\n        this._adjustParentBBoxes(bbox, insertPath, level);\n    },\n\n    // split overflowed node into two\n    _split: function (insertPath, level) {\n\n        var node = insertPath[level],\n            M = node.children.length,\n            m = this._minEntries;\n\n        this._chooseSplitAxis(node, m, M);\n\n        var splitIndex = this._chooseSplitIndex(node, m, M);\n\n        var newNode = {\n            children: node.children.splice(splitIndex, node.children.length - splitIndex),\n            height: node.height,\n            bbox: null,\n            leaf: false\n        };\n\n        if (node.leaf) newNode.leaf = true;\n\n        calcBBox(node, this.toBBox);\n        calcBBox(newNode, this.toBBox);\n\n        if (level) insertPath[level - 1].children.push(newNode);\n        else this._splitRoot(node, newNode);\n    },\n\n    _splitRoot: function (node, newNode) {\n        // split root node\n        this.data = {\n            children: [node, newNode],\n            height: node.height + 1,\n            bbox: null,\n            leaf: false\n        };\n        calcBBox(this.data, this.toBBox);\n    },\n\n    _chooseSplitIndex: function (node, m, M) {\n\n        var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;\n\n        minOverlap = minArea = Infinity;\n\n        for (i = m; i <= M - m; i++) {\n            bbox1 = distBBox(node, 0, i, this.toBBox);\n            bbox2 = distBBox(node, i, M, this.toBBox);\n\n            overlap = intersectionArea(bbox1, bbox2);\n            area = bboxArea(bbox1) + bboxArea(bbox2);\n\n            // choose distribution with minimum overlap\n            if (overlap < minOverlap) {\n                minOverlap = overlap;\n                index = i;\n\n                minArea = area < minArea ? area : minArea;\n\n            } else if (overlap === minOverlap) {\n                // otherwise choose distribution with minimum area\n                if (area < minArea) {\n                    minArea = area;\n                    index = i;\n                }\n            }\n        }\n\n        return index;\n    },\n\n    // sorts node children by the best axis for split\n    _chooseSplitAxis: function (node, m, M) {\n\n        var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX,\n            compareMinY = node.leaf ? this.compareMinY : compareNodeMinY,\n            xMargin = this._allDistMargin(node, m, M, compareMinX),\n            yMargin = this._allDistMargin(node, m, M, compareMinY);\n\n        // if total distributions margin value is minimal for x, sort by minX,\n        // otherwise it's already sorted by minY\n        if (xMargin < yMargin) node.children.sort(compareMinX);\n    },\n\n    // total margin of all possible split distributions where each node is at least m full\n    _allDistMargin: function (node, m, M, compare) {\n\n        node.children.sort(compare);\n\n        var toBBox = this.toBBox,\n            leftBBox = distBBox(node, 0, m, toBBox),\n            rightBBox = distBBox(node, M - m, M, toBBox),\n            margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),\n            i, child;\n\n        for (i = m; i < M - m; i++) {\n            child = node.children[i];\n            extend(leftBBox, node.leaf ? toBBox(child) : child.bbox);\n            margin += bboxMargin(leftBBox);\n        }\n\n        for (i = M - m - 1; i >= m; i--) {\n            child = node.children[i];\n            extend(rightBBox, node.leaf ? toBBox(child) : child.bbox);\n            margin += bboxMargin(rightBBox);\n        }\n\n        return margin;\n    },\n\n    _adjustParentBBoxes: function (bbox, path, level) {\n        // adjust bboxes along the given tree path\n        for (var i = level; i >= 0; i--) {\n            extend(path[i].bbox, bbox);\n        }\n    },\n\n    _condense: function (path) {\n        // go through the path, removing empty nodes and updating bboxes\n        for (var i = path.length - 1, siblings; i >= 0; i--) {\n            if (path[i].children.length === 0) {\n                if (i > 0) {\n                    siblings = path[i - 1].children;\n                    siblings.splice(siblings.indexOf(path[i]), 1);\n\n                } else this.clear();\n\n            } else calcBBox(path[i], this.toBBox);\n        }\n    },\n\n    _initFormat: function (format) {\n        // data format (minX, minY, maxX, maxY accessors)\n\n        // uses eval-type function compilation instead of just accepting a toBBox function\n        // because the algorithms are very sensitive to sorting functions performance,\n        // so they should be dead simple and without inner calls\n\n        // jshint evil: true\n\n        var compareArr = ['return a', ' - b', ';'];\n\n        this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));\n        this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));\n\n        this.toBBox = new Function('a', 'return [a' + format.join(', a') + '];');\n    }\n};\n\n\n// calculate node's bbox from bboxes of its children\nfunction calcBBox(node, toBBox) {\n    node.bbox = distBBox(node, 0, node.children.length, toBBox);\n}\n\n// min bounding rectangle of node children from k to p-1\nfunction distBBox(node, k, p, toBBox) {\n    var bbox = empty();\n\n    for (var i = k, child; i < p; i++) {\n        child = node.children[i];\n        extend(bbox, node.leaf ? toBBox(child) : child.bbox);\n    }\n\n    return bbox;\n}\n\nfunction empty() { return [Infinity, Infinity, -Infinity, -Infinity]; }\n\nfunction extend(a, b) {\n    a[0] = Math.min(a[0], b[0]);\n    a[1] = Math.min(a[1], b[1]);\n    a[2] = Math.max(a[2], b[2]);\n    a[3] = Math.max(a[3], b[3]);\n    return a;\n}\n\nfunction compareNodeMinX(a, b) { return a.bbox[0] - b.bbox[0]; }\nfunction compareNodeMinY(a, b) { return a.bbox[1] - b.bbox[1]; }\n\nfunction bboxArea(a)   { return (a[2] - a[0]) * (a[3] - a[1]); }\nfunction bboxMargin(a) { return (a[2] - a[0]) + (a[3] - a[1]); }\n\nfunction enlargedArea(a, b) {\n    return (Math.max(b[2], a[2]) - Math.min(b[0], a[0])) *\n           (Math.max(b[3], a[3]) - Math.min(b[1], a[1]));\n}\n\nfunction intersectionArea(a, b) {\n    var minX = Math.max(a[0], b[0]),\n        minY = Math.max(a[1], b[1]),\n        maxX = Math.min(a[2], b[2]),\n        maxY = Math.min(a[3], b[3]);\n\n    return Math.max(0, maxX - minX) *\n           Math.max(0, maxY - minY);\n}\n\nfunction contains(a, b) {\n    return a[0] <= b[0] &&\n           a[1] <= b[1] &&\n           b[2] <= a[2] &&\n           b[3] <= a[3];\n}\n\nfunction intersects(a, b) {\n    return b[0] <= a[2] &&\n           b[1] <= a[3] &&\n           b[2] >= a[0] &&\n           b[3] >= a[1];\n}\n\n// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;\n// combines selection algorithm with binary divide & conquer approach\n\nfunction multiSelect(arr, left, right, n, compare) {\n    var stack = [left, right],\n        mid;\n\n    while (stack.length) {\n        right = stack.pop();\n        left = stack.pop();\n\n        if (right - left <= n) continue;\n\n        mid = left + Math.ceil((right - left) / n / 2) * n;\n        select(arr, left, right, mid, compare);\n\n        stack.push(left, mid, mid, right);\n    }\n}\n\n// Floyd-Rivest selection algorithm:\n// sort an array between left and right (inclusive) so that the smallest k elements come first (unordered)\nfunction select(arr, left, right, k, compare) {\n    var n, i, z, s, sd, newLeft, newRight, t, j;\n\n    while (right > left) {\n        if (right - left > 600) {\n            n = right - left + 1;\n            i = k - left + 1;\n            z = Math.log(n);\n            s = 0.5 * Math.exp(2 * z / 3);\n            sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (i - n / 2 < 0 ? -1 : 1);\n            newLeft = Math.max(left, Math.floor(k - i * s / n + sd));\n            newRight = Math.min(right, Math.floor(k + (n - i) * s / n + sd));\n            select(arr, newLeft, newRight, k, compare);\n        }\n\n        t = arr[k];\n        i = left;\n        j = right;\n\n        swap(arr, left, k);\n        if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n        while (i < j) {\n            swap(arr, i, j);\n            i++;\n            j--;\n            while (compare(arr[i], t) < 0) i++;\n            while (compare(arr[j], t) > 0) j--;\n        }\n\n        if (compare(arr[left], t) === 0) swap(arr, left, j);\n        else {\n            j++;\n            swap(arr, j, right);\n        }\n\n        if (j <= k) left = j + 1;\n        if (k <= j) right = j - 1;\n    }\n}\n\nfunction swap(arr, i, j) {\n    var tmp = arr[i];\n    arr[i] = arr[j];\n    arr[j] = tmp;\n}\n\n\n// export as AMD/CommonJS module or global variable\nif (typeof define === 'function' && define.amd) define('rbush', function () { return rbush; });\nelse if (typeof module !== 'undefined') module.exports = rbush;\nelse if (typeof self !== 'undefined') self.rbush = rbush;\nelse window.rbush = rbush;\n\n})();\n\n},{}],38:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_duplex.js\")\n\n},{\"./lib/_stream_duplex.js\":39}],39:[function(require,module,exports){\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/*<replacement>*/\n\nvar objectKeys = Object.keys || function (obj) {\n  var keys = [];\n  for (var key in obj) {\n    keys.push(key);\n  }return keys;\n};\n/*</replacement>*/\n\nmodule.exports = Duplex;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n  var method = keys[v];\n  if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n  if (!(this instanceof Duplex)) return new Duplex(options);\n\n  Readable.call(this, options);\n  Writable.call(this, options);\n\n  if (options && options.readable === false) this.readable = false;\n\n  if (options && options.writable === false) this.writable = false;\n\n  this.allowHalfOpen = true;\n  if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n  this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n  // if we allow half-open state, or if the writable side ended,\n  // then we're ok.\n  if (this.allowHalfOpen || this._writableState.ended) return;\n\n  // no more data can be written.\n  // But allow more writes to happen in this tick.\n  processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n  self.end();\n}\n\nfunction forEach(xs, f) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    f(xs[i], i);\n  }\n}\n},{\"./_stream_readable\":41,\"./_stream_writable\":43,\"core-util-is\":7,\"inherits\":32,\"process-nextick-args\":35}],40:[function(require,module,exports){\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n  if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n  Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n  cb(null, chunk);\n};\n},{\"./_stream_transform\":42,\"core-util-is\":7,\"inherits\":32}],41:[function(require,module,exports){\n(function (process){\n'use strict';\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n/*<replacement>*/\nvar isArray = require('isarray');\n/*</replacement>*/\n\n/*<replacement>*/\nvar Buffer = require('buffer').Buffer;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\nvar EE = require('events');\n\n/*<replacement>*/\nvar EElistenerCount = function (emitter, type) {\n  return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream;\n(function () {\n  try {\n    Stream = require('st' + 'ream');\n  } catch (_) {} finally {\n    if (!Stream) Stream = require('events').EventEmitter;\n  }\n})();\n/*</replacement>*/\n\nvar Buffer = require('buffer').Buffer;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n/*<replacement>*/\nvar debugUtil = require('util');\nvar debug = undefined;\nif (debugUtil && debugUtil.debuglog) {\n  debug = debugUtil.debuglog('stream');\n} else {\n  debug = function () {};\n}\n/*</replacement>*/\n\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar Duplex;\nfunction ReadableState(options, stream) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  options = options || {};\n\n  // object stream flag. Used to make read(n) ignore n and to\n  // make all the buffer merging and length checks go away\n  this.objectMode = !!options.objectMode;\n\n  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n  // the point at which it stops calling _read() to fill the buffer\n  // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n  var hwm = options.highWaterMark;\n  var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;\n\n  // cast to ints.\n  this.highWaterMark = ~ ~this.highWaterMark;\n\n  this.buffer = [];\n  this.length = 0;\n  this.pipes = null;\n  this.pipesCount = 0;\n  this.flowing = null;\n  this.ended = false;\n  this.endEmitted = false;\n  this.reading = false;\n\n  // a flag to be able to tell if the onwrite cb is called immediately,\n  // or on a later tick.  We set this to true at first, because any\n  // actions that shouldn't happen until \"later\" should generally also\n  // not happen before the first write call.\n  this.sync = true;\n\n  // whenever we return null, then we set a flag to say\n  // that we're awaiting a 'readable' event emission.\n  this.needReadable = false;\n  this.emittedReadable = false;\n  this.readableListening = false;\n  this.resumeScheduled = false;\n\n  // Crypto is kind of old and crusty.  Historically, its default string\n  // encoding is 'binary' so we have to make this configurable.\n  // Everything else in the universe uses 'utf8', though.\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n  // when piping, we only care about 'readable' events that happen\n  // after read()ing all the bytes and not getting any pushback.\n  this.ranOut = false;\n\n  // the number of writers that are awaiting a drain event in .pipe()s\n  this.awaitDrain = 0;\n\n  // if true, a maybeReadMore has been scheduled\n  this.readingMore = false;\n\n  this.decoder = null;\n  this.encoding = null;\n  if (options.encoding) {\n    if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n    this.decoder = new StringDecoder(options.encoding);\n    this.encoding = options.encoding;\n  }\n}\n\nvar Duplex;\nfunction Readable(options) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  if (!(this instanceof Readable)) return new Readable(options);\n\n  this._readableState = new ReadableState(options, this);\n\n  // legacy\n  this.readable = true;\n\n  if (options && typeof options.read === 'function') this._read = options.read;\n\n  Stream.call(this);\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n  var state = this._readableState;\n\n  if (!state.objectMode && typeof chunk === 'string') {\n    encoding = encoding || state.defaultEncoding;\n    if (encoding !== state.encoding) {\n      chunk = new Buffer(chunk, encoding);\n      encoding = '';\n    }\n  }\n\n  return readableAddChunk(this, state, chunk, encoding, false);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n  var state = this._readableState;\n  return readableAddChunk(this, state, chunk, '', true);\n};\n\nReadable.prototype.isPaused = function () {\n  return this._readableState.flowing === false;\n};\n\nfunction readableAddChunk(stream, state, chunk, encoding, addToFront) {\n  var er = chunkInvalid(state, chunk);\n  if (er) {\n    stream.emit('error', er);\n  } else if (chunk === null) {\n    state.reading = false;\n    onEofChunk(stream, state);\n  } else if (state.objectMode || chunk && chunk.length > 0) {\n    if (state.ended && !addToFront) {\n      var e = new Error('stream.push() after EOF');\n      stream.emit('error', e);\n    } else if (state.endEmitted && addToFront) {\n      var e = new Error('stream.unshift() after end event');\n      stream.emit('error', e);\n    } else {\n      var skipAdd;\n      if (state.decoder && !addToFront && !encoding) {\n        chunk = state.decoder.write(chunk);\n        skipAdd = !state.objectMode && chunk.length === 0;\n      }\n\n      if (!addToFront) state.reading = false;\n\n      // Don't add to the buffer if we've decoded to an empty string chunk and\n      // we're not in object mode\n      if (!skipAdd) {\n        // if we want the data now, just emit it.\n        if (state.flowing && state.length === 0 && !state.sync) {\n          stream.emit('data', chunk);\n          stream.read(0);\n        } else {\n          // update the buffer info.\n          state.length += state.objectMode ? 1 : chunk.length;\n          if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n          if (state.needReadable) emitReadable(stream);\n        }\n      }\n\n      maybeReadMore(stream, state);\n    }\n  } else if (!addToFront) {\n    state.reading = false;\n  }\n\n  return needMoreData(state);\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes.  This is to work around cases where hwm=0,\n// such as the repl.  Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n  return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n  if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n  this._readableState.decoder = new StringDecoder(enc);\n  this._readableState.encoding = enc;\n  return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n  if (n >= MAX_HWM) {\n    n = MAX_HWM;\n  } else {\n    // Get the next highest power of 2\n    n--;\n    n |= n >>> 1;\n    n |= n >>> 2;\n    n |= n >>> 4;\n    n |= n >>> 8;\n    n |= n >>> 16;\n    n++;\n  }\n  return n;\n}\n\nfunction howMuchToRead(n, state) {\n  if (state.length === 0 && state.ended) return 0;\n\n  if (state.objectMode) return n === 0 ? 0 : 1;\n\n  if (n === null || isNaN(n)) {\n    // only flow one buffer at a time\n    if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;\n  }\n\n  if (n <= 0) return 0;\n\n  // If we're asking for more than the target buffer level,\n  // then raise the water mark.  Bump up to the next highest\n  // power of 2, to prevent increasing it excessively in tiny\n  // amounts.\n  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n\n  // don't have that much.  return null, unless we've ended.\n  if (n > state.length) {\n    if (!state.ended) {\n      state.needReadable = true;\n      return 0;\n    } else {\n      return state.length;\n    }\n  }\n\n  return n;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n  debug('read', n);\n  var state = this._readableState;\n  var nOrig = n;\n\n  if (typeof n !== 'number' || n > 0) state.emittedReadable = false;\n\n  // if we're doing read(0) to trigger a readable event, but we\n  // already have a bunch of data in the buffer, then just trigger\n  // the 'readable' event and move on.\n  if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n    debug('read: emitReadable', state.length, state.ended);\n    if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n    return null;\n  }\n\n  n = howMuchToRead(n, state);\n\n  // if we've ended, and we're now clear, then finish it up.\n  if (n === 0 && state.ended) {\n    if (state.length === 0) endReadable(this);\n    return null;\n  }\n\n  // All the actual chunk generation logic needs to be\n  // *below* the call to _read.  The reason is that in certain\n  // synthetic stream cases, such as passthrough streams, _read\n  // may be a completely synchronous operation which may change\n  // the state of the read buffer, providing enough data when\n  // before there was *not* enough.\n  //\n  // So, the steps are:\n  // 1. Figure out what the state of things will be after we do\n  // a read from the buffer.\n  //\n  // 2. If that resulting state will trigger a _read, then call _read.\n  // Note that this may be asynchronous, or synchronous.  Yes, it is\n  // deeply ugly to write APIs this way, but that still doesn't mean\n  // that the Readable class should behave improperly, as streams are\n  // designed to be sync/async agnostic.\n  // Take note if the _read call is sync or async (ie, if the read call\n  // has returned yet), so that we know whether or not it's safe to emit\n  // 'readable' etc.\n  //\n  // 3. Actually pull the requested chunks out of the buffer and return.\n\n  // if we need a readable event, then we need to do some reading.\n  var doRead = state.needReadable;\n  debug('need readable', doRead);\n\n  // if we currently have less than the highWaterMark, then also read some\n  if (state.length === 0 || state.length - n < state.highWaterMark) {\n    doRead = true;\n    debug('length less than watermark', doRead);\n  }\n\n  // however, if we've ended, then there's no point, and if we're already\n  // reading, then it's unnecessary.\n  if (state.ended || state.reading) {\n    doRead = false;\n    debug('reading or ended', doRead);\n  }\n\n  if (doRead) {\n    debug('do read');\n    state.reading = true;\n    state.sync = true;\n    // if the length is currently zero, then we *need* a readable event.\n    if (state.length === 0) state.needReadable = true;\n    // call internal read method\n    this._read(state.highWaterMark);\n    state.sync = false;\n  }\n\n  // If _read pushed data synchronously, then `reading` will be false,\n  // and we need to re-evaluate how much data we can return to the user.\n  if (doRead && !state.reading) n = howMuchToRead(nOrig, state);\n\n  var ret;\n  if (n > 0) ret = fromList(n, state);else ret = null;\n\n  if (ret === null) {\n    state.needReadable = true;\n    n = 0;\n  }\n\n  state.length -= n;\n\n  // If we have nothing in the buffer, then we want to know\n  // as soon as we *do* get something into the buffer.\n  if (state.length === 0 && !state.ended) state.needReadable = true;\n\n  // If we tried to read() past the EOF, then emit end on the next tick.\n  if (nOrig !== n && state.ended && state.length === 0) endReadable(this);\n\n  if (ret !== null) this.emit('data', ret);\n\n  return ret;\n};\n\nfunction chunkInvalid(state, chunk) {\n  var er = null;\n  if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n    er = new TypeError('Invalid non-string/buffer chunk');\n  }\n  return er;\n}\n\nfunction onEofChunk(stream, state) {\n  if (state.ended) return;\n  if (state.decoder) {\n    var chunk = state.decoder.end();\n    if (chunk && chunk.length) {\n      state.buffer.push(chunk);\n      state.length += state.objectMode ? 1 : chunk.length;\n    }\n  }\n  state.ended = true;\n\n  // emit 'readable' now to make sure it gets picked up.\n  emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow.  This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n  var state = stream._readableState;\n  state.needReadable = false;\n  if (!state.emittedReadable) {\n    debug('emitReadable', state.flowing);\n    state.emittedReadable = true;\n    if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n  }\n}\n\nfunction emitReadable_(stream) {\n  debug('emit readable');\n  stream.emit('readable');\n  flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data.  that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n  if (!state.readingMore) {\n    state.readingMore = true;\n    processNextTick(maybeReadMore_, stream, state);\n  }\n}\n\nfunction maybeReadMore_(stream, state) {\n  var len = state.length;\n  while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n    debug('maybeReadMore read 0');\n    stream.read(0);\n    if (len === state.length)\n      // didn't get any data, stop spinning.\n      break;else len = state.length;\n  }\n  state.readingMore = false;\n}\n\n// abstract method.  to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n  this.emit('error', new Error('not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n  var src = this;\n  var state = this._readableState;\n\n  switch (state.pipesCount) {\n    case 0:\n      state.pipes = dest;\n      break;\n    case 1:\n      state.pipes = [state.pipes, dest];\n      break;\n    default:\n      state.pipes.push(dest);\n      break;\n  }\n  state.pipesCount += 1;\n  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n  var endFn = doEnd ? onend : cleanup;\n  if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);\n\n  dest.on('unpipe', onunpipe);\n  function onunpipe(readable) {\n    debug('onunpipe');\n    if (readable === src) {\n      cleanup();\n    }\n  }\n\n  function onend() {\n    debug('onend');\n    dest.end();\n  }\n\n  // when the dest drains, it reduces the awaitDrain counter\n  // on the source.  This would be more elegant with a .once()\n  // handler in flow(), but adding and removing repeatedly is\n  // too slow.\n  var ondrain = pipeOnDrain(src);\n  dest.on('drain', ondrain);\n\n  var cleanedUp = false;\n  function cleanup() {\n    debug('cleanup');\n    // cleanup event handlers once the pipe is broken\n    dest.removeListener('close', onclose);\n    dest.removeListener('finish', onfinish);\n    dest.removeListener('drain', ondrain);\n    dest.removeListener('error', onerror);\n    dest.removeListener('unpipe', onunpipe);\n    src.removeListener('end', onend);\n    src.removeListener('end', cleanup);\n    src.removeListener('data', ondata);\n\n    cleanedUp = true;\n\n    // if the reader is waiting for a drain event from this\n    // specific writer, then it would cause it to never start\n    // flowing again.\n    // So, if this is awaiting a drain, then we just call it now.\n    // If we don't know, then assume that we are waiting for one.\n    if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n  }\n\n  src.on('data', ondata);\n  function ondata(chunk) {\n    debug('ondata');\n    var ret = dest.write(chunk);\n    if (false === ret) {\n      // If the user unpiped during `dest.write()`, it is possible\n      // to get stuck in a permanently paused state if that write\n      // also returned false.\n      if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) {\n        debug('false write response, pause', src._readableState.awaitDrain);\n        src._readableState.awaitDrain++;\n      }\n      src.pause();\n    }\n  }\n\n  // if the dest has an error, then stop piping into it.\n  // however, don't suppress the throwing behavior for this.\n  function onerror(er) {\n    debug('onerror', er);\n    unpipe();\n    dest.removeListener('error', onerror);\n    if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n  }\n  // This is a brutally ugly hack to make sure that our error handler\n  // is attached before any userland ones.  NEVER DO THIS.\n  if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error];\n\n  // Both close and finish should trigger unpipe, but only once.\n  function onclose() {\n    dest.removeListener('finish', onfinish);\n    unpipe();\n  }\n  dest.once('close', onclose);\n  function onfinish() {\n    debug('onfinish');\n    dest.removeListener('close', onclose);\n    unpipe();\n  }\n  dest.once('finish', onfinish);\n\n  function unpipe() {\n    debug('unpipe');\n    src.unpipe(dest);\n  }\n\n  // tell the dest that it's being piped to\n  dest.emit('pipe', src);\n\n  // start the flow if it hasn't been started already.\n  if (!state.flowing) {\n    debug('pipe resume');\n    src.resume();\n  }\n\n  return dest;\n};\n\nfunction pipeOnDrain(src) {\n  return function () {\n    var state = src._readableState;\n    debug('pipeOnDrain', state.awaitDrain);\n    if (state.awaitDrain) state.awaitDrain--;\n    if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n      state.flowing = true;\n      flow(src);\n    }\n  };\n}\n\nReadable.prototype.unpipe = function (dest) {\n  var state = this._readableState;\n\n  // if we're not piping anywhere, then do nothing.\n  if (state.pipesCount === 0) return this;\n\n  // just one destination.  most common case.\n  if (state.pipesCount === 1) {\n    // passed in one, but it's not the right one.\n    if (dest && dest !== state.pipes) return this;\n\n    if (!dest) dest = state.pipes;\n\n    // got a match.\n    state.pipes = null;\n    state.pipesCount = 0;\n    state.flowing = false;\n    if (dest) dest.emit('unpipe', this);\n    return this;\n  }\n\n  // slow case. multiple pipe destinations.\n\n  if (!dest) {\n    // remove all.\n    var dests = state.pipes;\n    var len = state.pipesCount;\n    state.pipes = null;\n    state.pipesCount = 0;\n    state.flowing = false;\n\n    for (var _i = 0; _i < len; _i++) {\n      dests[_i].emit('unpipe', this);\n    }return this;\n  }\n\n  // try to find the right one.\n  var i = indexOf(state.pipes, dest);\n  if (i === -1) return this;\n\n  state.pipes.splice(i, 1);\n  state.pipesCount -= 1;\n  if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n  dest.emit('unpipe', this);\n\n  return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n  var res = Stream.prototype.on.call(this, ev, fn);\n\n  // If listening to data, and it has not explicitly been paused,\n  // then call resume to start the flow of data on the next tick.\n  if (ev === 'data' && false !== this._readableState.flowing) {\n    this.resume();\n  }\n\n  if (ev === 'readable' && !this._readableState.endEmitted) {\n    var state = this._readableState;\n    if (!state.readableListening) {\n      state.readableListening = true;\n      state.emittedReadable = false;\n      state.needReadable = true;\n      if (!state.reading) {\n        processNextTick(nReadingNextTick, this);\n      } else if (state.length) {\n        emitReadable(this, state);\n      }\n    }\n  }\n\n  return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n  debug('readable nexttick read 0');\n  self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n  var state = this._readableState;\n  if (!state.flowing) {\n    debug('resume');\n    state.flowing = true;\n    resume(this, state);\n  }\n  return this;\n};\n\nfunction resume(stream, state) {\n  if (!state.resumeScheduled) {\n    state.resumeScheduled = true;\n    processNextTick(resume_, stream, state);\n  }\n}\n\nfunction resume_(stream, state) {\n  if (!state.reading) {\n    debug('resume read 0');\n    stream.read(0);\n  }\n\n  state.resumeScheduled = false;\n  stream.emit('resume');\n  flow(stream);\n  if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n  debug('call pause flowing=%j', this._readableState.flowing);\n  if (false !== this._readableState.flowing) {\n    debug('pause');\n    this._readableState.flowing = false;\n    this.emit('pause');\n  }\n  return this;\n};\n\nfunction flow(stream) {\n  var state = stream._readableState;\n  debug('flow', state.flowing);\n  if (state.flowing) {\n    do {\n      var chunk = stream.read();\n    } while (null !== chunk && state.flowing);\n  }\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n  var state = this._readableState;\n  var paused = false;\n\n  var self = this;\n  stream.on('end', function () {\n    debug('wrapped end');\n    if (state.decoder && !state.ended) {\n      var chunk = state.decoder.end();\n      if (chunk && chunk.length) self.push(chunk);\n    }\n\n    self.push(null);\n  });\n\n  stream.on('data', function (chunk) {\n    debug('wrapped data');\n    if (state.decoder) chunk = state.decoder.write(chunk);\n\n    // don't skip over falsy values in objectMode\n    if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n    var ret = self.push(chunk);\n    if (!ret) {\n      paused = true;\n      stream.pause();\n    }\n  });\n\n  // proxy all the other methods.\n  // important when wrapping filters and duplexes.\n  for (var i in stream) {\n    if (this[i] === undefined && typeof stream[i] === 'function') {\n      this[i] = function (method) {\n        return function () {\n          return stream[method].apply(stream, arguments);\n        };\n      }(i);\n    }\n  }\n\n  // proxy certain important events.\n  var events = ['error', 'close', 'destroy', 'pause', 'resume'];\n  forEach(events, function (ev) {\n    stream.on(ev, self.emit.bind(self, ev));\n  });\n\n  // when we try to consume some more bytes, simply unpause the\n  // underlying stream.\n  self._read = function (n) {\n    debug('wrapped _read', n);\n    if (paused) {\n      paused = false;\n      stream.resume();\n    }\n  };\n\n  return self;\n};\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\nfunction fromList(n, state) {\n  var list = state.buffer;\n  var length = state.length;\n  var stringMode = !!state.decoder;\n  var objectMode = !!state.objectMode;\n  var ret;\n\n  // nothing in the list, definitely empty.\n  if (list.length === 0) return null;\n\n  if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) {\n    // read it all, truncate the array.\n    if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);\n    list.length = 0;\n  } else {\n    // read just some of it.\n    if (n < list[0].length) {\n      // just take a part of the first list item.\n      // slice is the same for buffers and strings.\n      var buf = list[0];\n      ret = buf.slice(0, n);\n      list[0] = buf.slice(n);\n    } else if (n === list[0].length) {\n      // first list is a perfect match\n      ret = list.shift();\n    } else {\n      // complex case.\n      // we have enough to cover it, but it spans past the first buffer.\n      if (stringMode) ret = '';else ret = new Buffer(n);\n\n      var c = 0;\n      for (var i = 0, l = list.length; i < l && c < n; i++) {\n        var buf = list[0];\n        var cpy = Math.min(n - c, buf.length);\n\n        if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy);\n\n        if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift();\n\n        c += cpy;\n      }\n    }\n  }\n\n  return ret;\n}\n\nfunction endReadable(stream) {\n  var state = stream._readableState;\n\n  // If we get here before consuming all the bytes, then that is a\n  // bug in node.  Should never happen.\n  if (state.length > 0) throw new Error('endReadable called on non-empty stream');\n\n  if (!state.endEmitted) {\n    state.ended = true;\n    processNextTick(endReadableNT, state, stream);\n  }\n}\n\nfunction endReadableNT(state, stream) {\n  // Check that we didn't get one last unshift.\n  if (!state.endEmitted && state.length === 0) {\n    state.endEmitted = true;\n    stream.readable = false;\n    stream.emit('end');\n  }\n}\n\nfunction forEach(xs, f) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    f(xs[i], i);\n  }\n}\n\nfunction indexOf(xs, x) {\n  for (var i = 0, l = xs.length; i < l; i++) {\n    if (xs[i] === x) return i;\n  }\n  return -1;\n}\n}).call(this,require('_process'))\n},{\"./_stream_duplex\":39,\"_process\":36,\"buffer\":5,\"core-util-is\":7,\"events\":9,\"inherits\":32,\"isarray\":44,\"process-nextick-args\":35,\"string_decoder/\":58,\"util\":3}],42:[function(require,module,exports){\n// a transform stream is a readable/writable stream where you do\n// something with the data.  Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored.  (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation.  For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes.  When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up.  When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer.  When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks.  If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk.  However,\n// a pathological inflate type of transform can cause excessive buffering\n// here.  For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output.  In this case, you could write a very small\n// amount of input, and end up with a very large amount of output.  In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform.  A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\nutil.inherits(Transform, Duplex);\n\nfunction TransformState(stream) {\n  this.afterTransform = function (er, data) {\n    return afterTransform(stream, er, data);\n  };\n\n  this.needTransform = false;\n  this.transforming = false;\n  this.writecb = null;\n  this.writechunk = null;\n  this.writeencoding = null;\n}\n\nfunction afterTransform(stream, er, data) {\n  var ts = stream._transformState;\n  ts.transforming = false;\n\n  var cb = ts.writecb;\n\n  if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));\n\n  ts.writechunk = null;\n  ts.writecb = null;\n\n  if (data !== null && data !== undefined) stream.push(data);\n\n  cb(er);\n\n  var rs = stream._readableState;\n  rs.reading = false;\n  if (rs.needReadable || rs.length < rs.highWaterMark) {\n    stream._read(rs.highWaterMark);\n  }\n}\n\nfunction Transform(options) {\n  if (!(this instanceof Transform)) return new Transform(options);\n\n  Duplex.call(this, options);\n\n  this._transformState = new TransformState(this);\n\n  // when the writable side finishes, then flush out anything remaining.\n  var stream = this;\n\n  // start out asking for a readable event once data is transformed.\n  this._readableState.needReadable = true;\n\n  // we have implemented the _read method, and done the other things\n  // that Readable wants before the first _read call, so unset the\n  // sync guard flag.\n  this._readableState.sync = false;\n\n  if (options) {\n    if (typeof options.transform === 'function') this._transform = options.transform;\n\n    if (typeof options.flush === 'function') this._flush = options.flush;\n  }\n\n  this.once('prefinish', function () {\n    if (typeof this._flush === 'function') this._flush(function (er) {\n      done(stream, er);\n    });else done(stream);\n  });\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n  this._transformState.needTransform = false;\n  return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side.  You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk.  If you pass\n// an error, then that'll put the hurt on the whole operation.  If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n  throw new Error('not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n  var ts = this._transformState;\n  ts.writecb = cb;\n  ts.writechunk = chunk;\n  ts.writeencoding = encoding;\n  if (!ts.transforming) {\n    var rs = this._readableState;\n    if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n  }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n  var ts = this._transformState;\n\n  if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n    ts.transforming = true;\n    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n  } else {\n    // mark that we need a transform, so that any data that comes in\n    // will get processed, now that we've asked for it.\n    ts.needTransform = true;\n  }\n};\n\nfunction done(stream, er) {\n  if (er) return stream.emit('error', er);\n\n  // if there's nothing in the write buffer, then that means\n  // that nothing more will ever be provided\n  var ws = stream._writableState;\n  var ts = stream._transformState;\n\n  if (ws.length) throw new Error('calling transform done when ws.length != 0');\n\n  if (ts.transforming) throw new Error('calling transform done when still transforming');\n\n  return stream.push(null);\n}\n},{\"./_stream_duplex\":39,\"core-util-is\":7,\"inherits\":32}],43:[function(require,module,exports){\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/*<replacement>*/\nvar processNextTick = require('process-nextick-args');\n/*</replacement>*/\n\n/*<replacement>*/\nvar asyncWrite = !true ? setImmediate : processNextTick;\n/*</replacement>*/\n\n/*<replacement>*/\nvar Buffer = require('buffer').Buffer;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n/*<replacement>*/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/*</replacement>*/\n\n/*<replacement>*/\nvar internalUtil = {\n  deprecate: require('util-deprecate')\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream;\n(function () {\n  try {\n    Stream = require('st' + 'ream');\n  } catch (_) {} finally {\n    if (!Stream) Stream = require('events').EventEmitter;\n  }\n})();\n/*</replacement>*/\n\nvar Buffer = require('buffer').Buffer;\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WriteReq(chunk, encoding, cb) {\n  this.chunk = chunk;\n  this.encoding = encoding;\n  this.callback = cb;\n  this.next = null;\n}\n\nvar Duplex;\nfunction WritableState(options, stream) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  options = options || {};\n\n  // object stream flag to indicate whether or not this stream\n  // contains buffers or objects.\n  this.objectMode = !!options.objectMode;\n\n  if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n  // the point at which write() starts returning false\n  // Note: 0 is a valid value, means that we always return false if\n  // the entire buffer is not flushed immediately on write()\n  var hwm = options.highWaterMark;\n  var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n  this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;\n\n  // cast to ints.\n  this.highWaterMark = ~ ~this.highWaterMark;\n\n  this.needDrain = false;\n  // at the start of calling end()\n  this.ending = false;\n  // when end() has been called, and returned\n  this.ended = false;\n  // when 'finish' is emitted\n  this.finished = false;\n\n  // should we decode strings into buffers before passing to _write?\n  // this is here so that some node-core streams can optimize string\n  // handling at a lower level.\n  var noDecode = options.decodeStrings === false;\n  this.decodeStrings = !noDecode;\n\n  // Crypto is kind of old and crusty.  Historically, its default string\n  // encoding is 'binary' so we have to make this configurable.\n  // Everything else in the universe uses 'utf8', though.\n  this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n  // not an actual buffer we keep track of, but a measurement\n  // of how much we're waiting to get pushed to some underlying\n  // socket or file.\n  this.length = 0;\n\n  // a flag to see when we're in the middle of a write.\n  this.writing = false;\n\n  // when true all writes will be buffered until .uncork() call\n  this.corked = 0;\n\n  // a flag to be able to tell if the onwrite cb is called immediately,\n  // or on a later tick.  We set this to true at first, because any\n  // actions that shouldn't happen until \"later\" should generally also\n  // not happen before the first write call.\n  this.sync = true;\n\n  // a flag to know if we're processing previously buffered items, which\n  // may call the _write() callback in the same tick, so that we don't\n  // end up in an overlapped onwrite situation.\n  this.bufferProcessing = false;\n\n  // the callback that's passed to _write(chunk,cb)\n  this.onwrite = function (er) {\n    onwrite(stream, er);\n  };\n\n  // the callback that the user supplies to write(chunk,encoding,cb)\n  this.writecb = null;\n\n  // the amount that is being written when _write is called.\n  this.writelen = 0;\n\n  this.bufferedRequest = null;\n  this.lastBufferedRequest = null;\n\n  // number of pending user-supplied write callbacks\n  // this must be 0 before 'finish' can be emitted\n  this.pendingcb = 0;\n\n  // emit prefinish if the only thing we're waiting for is _write cbs\n  // This is relevant for synchronous Transform streams\n  this.prefinished = false;\n\n  // True if the error was already emitted and should not be thrown again\n  this.errorEmitted = false;\n\n  // count buffered requests\n  this.bufferedRequestCount = 0;\n\n  // create the two objects needed to store the corked requests\n  // they are not a linked list, as no new elements are inserted in there\n  this.corkedRequestsFree = new CorkedRequest(this);\n  this.corkedRequestsFree.next = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function writableStateGetBuffer() {\n  var current = this.bufferedRequest;\n  var out = [];\n  while (current) {\n    out.push(current);\n    current = current.next;\n  }\n  return out;\n};\n\n(function () {\n  try {\n    Object.defineProperty(WritableState.prototype, 'buffer', {\n      get: internalUtil.deprecate(function () {\n        return this.getBuffer();\n      }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')\n    });\n  } catch (_) {}\n})();\n\nvar Duplex;\nfunction Writable(options) {\n  Duplex = Duplex || require('./_stream_duplex');\n\n  // Writable ctor is applied to Duplexes, though they're not\n  // instanceof Writable, they're instanceof Readable.\n  if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);\n\n  this._writableState = new WritableState(options, this);\n\n  // legacy.\n  this.writable = true;\n\n  if (options) {\n    if (typeof options.write === 'function') this._write = options.write;\n\n    if (typeof options.writev === 'function') this._writev = options.writev;\n  }\n\n  Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n  this.emit('error', new Error('Cannot pipe. Not readable.'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n  var er = new Error('write after end');\n  // TODO: defer error events consistently everywhere, not just the cb\n  stream.emit('error', er);\n  processNextTick(cb, er);\n}\n\n// If we get something that is not a buffer, string, null, or undefined,\n// and we're not in objectMode, then that's an error.\n// Otherwise stream chunks are all considered to be of length=1, and the\n// watermarks determine how many objects to keep in the buffer, rather than\n// how many bytes or characters.\nfunction validChunk(stream, state, chunk, cb) {\n  var valid = true;\n\n  if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n    var er = new TypeError('Invalid non-string/buffer chunk');\n    stream.emit('error', er);\n    processNextTick(cb, er);\n    valid = false;\n  }\n  return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n  var state = this._writableState;\n  var ret = false;\n\n  if (typeof encoding === 'function') {\n    cb = encoding;\n    encoding = null;\n  }\n\n  if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n  if (typeof cb !== 'function') cb = nop;\n\n  if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {\n    state.pendingcb++;\n    ret = writeOrBuffer(this, state, chunk, encoding, cb);\n  }\n\n  return ret;\n};\n\nWritable.prototype.cork = function () {\n  var state = this._writableState;\n\n  state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n  var state = this._writableState;\n\n  if (state.corked) {\n    state.corked--;\n\n    if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n  }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n  // node::ParseEncoding() requires lower case.\n  if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n  if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n  this._writableState.defaultEncoding = encoding;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n    chunk = new Buffer(chunk, encoding);\n  }\n  return chunk;\n}\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn.  Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, cb) {\n  chunk = decodeChunk(state, chunk, encoding);\n\n  if (Buffer.isBuffer(chunk)) encoding = 'buffer';\n  var len = state.objectMode ? 1 : chunk.length;\n\n  state.length += len;\n\n  var ret = state.length < state.highWaterMark;\n  // we must ensure that previous needDrain will not be reset to false.\n  if (!ret) state.needDrain = true;\n\n  if (state.writing || state.corked) {\n    var last = state.lastBufferedRequest;\n    state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);\n    if (last) {\n      last.next = state.lastBufferedRequest;\n    } else {\n      state.bufferedRequest = state.lastBufferedRequest;\n    }\n    state.bufferedRequestCount += 1;\n  } else {\n    doWrite(stream, state, false, len, chunk, encoding, cb);\n  }\n\n  return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n  state.writelen = len;\n  state.writecb = cb;\n  state.writing = true;\n  state.sync = true;\n  if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n  state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n  --state.pendingcb;\n  if (sync) processNextTick(cb, er);else cb(er);\n\n  stream._writableState.errorEmitted = true;\n  stream.emit('error', er);\n}\n\nfunction onwriteStateUpdate(state) {\n  state.writing = false;\n  state.writecb = null;\n  state.length -= state.writelen;\n  state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n  var state = stream._writableState;\n  var sync = state.sync;\n  var cb = state.writecb;\n\n  onwriteStateUpdate(state);\n\n  if (er) onwriteError(stream, state, sync, er, cb);else {\n    // Check if we're actually ready to finish, but don't emit yet\n    var finished = needFinish(state);\n\n    if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n      clearBuffer(stream, state);\n    }\n\n    if (sync) {\n      /*<replacement>*/\n      asyncWrite(afterWrite, stream, state, finished, cb);\n      /*</replacement>*/\n    } else {\n        afterWrite(stream, state, finished, cb);\n      }\n  }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n  if (!finished) onwriteDrain(stream, state);\n  state.pendingcb--;\n  cb();\n  finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n  if (state.length === 0 && state.needDrain) {\n    state.needDrain = false;\n    stream.emit('drain');\n  }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n  state.bufferProcessing = true;\n  var entry = state.bufferedRequest;\n\n  if (stream._writev && entry && entry.next) {\n    // Fast case, write everything using _writev()\n    var l = state.bufferedRequestCount;\n    var buffer = new Array(l);\n    var holder = state.corkedRequestsFree;\n    holder.entry = entry;\n\n    var count = 0;\n    while (entry) {\n      buffer[count] = entry;\n      entry = entry.next;\n      count += 1;\n    }\n\n    doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n    // doWrite is always async, defer these to save a bit of time\n    // as the hot path ends with doWrite\n    state.pendingcb++;\n    state.lastBufferedRequest = null;\n    state.corkedRequestsFree = holder.next;\n    holder.next = null;\n  } else {\n    // Slow case, write chunks one-by-one\n    while (entry) {\n      var chunk = entry.chunk;\n      var encoding = entry.encoding;\n      var cb = entry.callback;\n      var len = state.objectMode ? 1 : chunk.length;\n\n      doWrite(stream, state, false, len, chunk, encoding, cb);\n      entry = entry.next;\n      // if we didn't call the onwrite immediately, then\n      // it means that we need to wait until it does.\n      // also, that means that the chunk and cb are currently\n      // being processed, so move the buffer counter past them.\n      if (state.writing) {\n        break;\n      }\n    }\n\n    if (entry === null) state.lastBufferedRequest = null;\n  }\n\n  state.bufferedRequestCount = 0;\n  state.bufferedRequest = entry;\n  state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n  cb(new Error('not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n  var state = this._writableState;\n\n  if (typeof chunk === 'function') {\n    cb = chunk;\n    chunk = null;\n    encoding = null;\n  } else if (typeof encoding === 'function') {\n    cb = encoding;\n    encoding = null;\n  }\n\n  if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n  // .end() fully uncorks\n  if (state.corked) {\n    state.corked = 1;\n    this.uncork();\n  }\n\n  // ignore unnecessary end() calls.\n  if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction prefinish(stream, state) {\n  if (!state.prefinished) {\n    state.prefinished = true;\n    stream.emit('prefinish');\n  }\n}\n\nfunction finishMaybe(stream, state) {\n  var need = needFinish(state);\n  if (need) {\n    if (state.pendingcb === 0) {\n      prefinish(stream, state);\n      state.finished = true;\n      stream.emit('finish');\n    } else {\n      prefinish(stream, state);\n    }\n  }\n  return need;\n}\n\nfunction endWritable(stream, state, cb) {\n  state.ending = true;\n  finishMaybe(stream, state);\n  if (cb) {\n    if (state.finished) processNextTick(cb);else stream.once('finish', cb);\n  }\n  state.ended = true;\n  stream.writable = false;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n  var _this = this;\n\n  this.next = null;\n  this.entry = null;\n\n  this.finish = function (err) {\n    var entry = _this.entry;\n    _this.entry = null;\n    while (entry) {\n      var cb = entry.callback;\n      state.pendingcb--;\n      cb(err);\n      entry = entry.next;\n    }\n    if (state.corkedRequestsFree) {\n      state.corkedRequestsFree.next = _this;\n    } else {\n      state.corkedRequestsFree = _this;\n    }\n  };\n}\n},{\"./_stream_duplex\":39,\"buffer\":5,\"core-util-is\":7,\"events\":9,\"inherits\":32,\"process-nextick-args\":35,\"util-deprecate\":59}],44:[function(require,module,exports){\narguments[4][6][0].apply(exports,arguments)\n},{\"dup\":6}],45:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_passthrough.js\")\n\n},{\"./lib/_stream_passthrough.js\":40}],46:[function(require,module,exports){\nvar Stream = (function (){\n  try {\n    return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify\n  } catch(_){}\n}());\nexports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = Stream || exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n\n// inline-process-browser and unreachable-branch-transform make sure this is\n// removed in browserify builds\nif (!true) {\n  module.exports = require('stream');\n}\n\n},{\"./lib/_stream_duplex.js\":39,\"./lib/_stream_passthrough.js\":40,\"./lib/_stream_readable.js\":41,\"./lib/_stream_transform.js\":42,\"./lib/_stream_writable.js\":43,\"stream\":57}],47:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_transform.js\")\n\n},{\"./lib/_stream_transform.js\":42}],48:[function(require,module,exports){\nmodule.exports = require(\"./lib/_stream_writable.js\")\n\n},{\"./lib/_stream_writable.js\":43}],49:[function(require,module,exports){\nexports.dash = require(\"./lib/rw/dash\");\nexports.readFile = require(\"./lib/rw/read-file\");\nexports.readFileSync = require(\"./lib/rw/read-file-sync\");\nexports.writeFile = require(\"./lib/rw/write-file\");\nexports.writeFileSync = require(\"./lib/rw/write-file-sync\");\n\n},{\"./lib/rw/dash\":50,\"./lib/rw/read-file\":54,\"./lib/rw/read-file-sync\":53,\"./lib/rw/write-file\":56,\"./lib/rw/write-file-sync\":55}],50:[function(require,module,exports){\nvar slice = Array.prototype.slice;\n\nfunction dashify(method, file) {\n  return function(path) {\n    var argv = arguments;\n    if (path == \"-\") (argv = slice.call(argv)).splice(0, 1, file);\n    return method.apply(null, argv);\n  };\n}\n\nexports.readFile = dashify(require(\"./read-file\"), \"/dev/stdin\");\nexports.readFileSync = dashify(require(\"./read-file-sync\"), \"/dev/stdin\");\nexports.writeFile = dashify(require(\"./write-file\"), \"/dev/stdout\");\nexports.writeFileSync = dashify(require(\"./write-file-sync\"), \"/dev/stdout\");\n\n},{\"./read-file\":54,\"./read-file-sync\":53,\"./write-file\":56,\"./write-file-sync\":55}],51:[function(require,module,exports){\n(function (Buffer){\nmodule.exports = function(options) {\n  if (options) {\n    if (typeof options === \"string\") return encoding(options);\n    if (options.encoding !== null) return encoding(options.encoding);\n  }\n  return identity();\n};\n\nfunction identity() {\n  var chunks = [];\n  return {\n    push: function(chunk) { chunks.push(chunk); },\n    value: function() { return Buffer.concat(chunks); }\n  };\n}\n\nfunction encoding(encoding) {\n  var chunks = [];\n  return {\n    push: function(chunk) { chunks.push(chunk); },\n    value: function() { return Buffer.concat(chunks).toString(encoding); }\n  };\n}\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5}],52:[function(require,module,exports){\n(function (Buffer){\nmodule.exports = function(data, options) {\n  return typeof data === \"string\"\n      ? new Buffer(data, typeof options === \"string\" ? options\n          : options && options.encoding !== null ? options.encoding\n          : \"utf8\")\n      : data;\n};\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":5}],53:[function(require,module,exports){\n(function (Buffer){\nvar fs = require(\"fs\"),\n    decode = require(\"./decode\");\n\nmodule.exports = function(filename, options) {\n  if (fs.statSync(filename).isFile()) {\n    return fs.readFileSync(filename, options);\n  } else {\n    var fd = fs.openSync(filename, options && options.flag || \"r\"),\n        decoder = decode(options);\n\n    while (true) {\n      try {\n        var buffer = new Buffer(bufferSize),\n            bytesRead = fs.readSync(fd, buffer, 0, bufferSize);\n      } catch (e) {\n        if (e.code === \"EOF\") break;\n        fs.closeSync(fd);\n        throw e;\n      }\n      if (bytesRead === 0) break;\n      decoder.push(buffer.slice(0, bytesRead));\n    }\n\n    fs.closeSync(fd);\n    return decoder.value();\n  }\n};\n\nvar bufferSize = 1 << 16;\n\n}).call(this,require(\"buffer\").Buffer)\n},{\"./decode\":51,\"buffer\":5,\"fs\":4}],54:[function(require,module,exports){\n(function (process){\nvar fs = require(\"fs\"),\n    decode = require(\"./decode\");\n\nmodule.exports = function(filename, options, callback) {\n  if (arguments.length < 3) callback = options, options = null;\n  fs.stat(filename, function(error, stat) {\n    if (error) return callback(error);\n    if (stat.isFile()) {\n      fs.readFile(filename, options, callback);\n    } else {\n      var decoder = decode(options), stream;\n\n      switch (filename) {\n        case \"/dev/stdin\": stream = process.stdin; break;\n        default: stream = fs.createReadStream(filename, options ? {flags: options.flag || \"r\"} : {}); break; // N.B. flag / flags\n      }\n\n      stream\n          .on(\"error\", callback)\n          .on(\"data\", function(d) { decoder.push(d); })\n          .on(\"end\", function() { callback(null, decoder.value()); });\n    }\n  });\n};\n\n}).call(this,require('_process'))\n},{\"./decode\":51,\"_process\":36,\"fs\":4}],55:[function(require,module,exports){\nvar fs = require(\"fs\"),\n    encode = require(\"./encode\");\n\nmodule.exports = function(filename, data, options) {\n  var stat;\n\n  try {\n    stat = fs.statSync(filename);\n  } catch (error) {\n    if (error.code !== \"ENOENT\") throw error;\n  }\n\n  if (!stat || stat.isFile()) {\n    fs.writeFileSync(filename, data, options);\n  } else {\n    var fd = fs.openSync(filename, options && options.flag || \"w\"),\n        bytesWritten = 0,\n        bytesTotal = (data = encode(data, options)).length;\n\n    while (bytesWritten < bytesTotal) {\n      try {\n        bytesWritten += fs.writeSync(fd, data, bytesWritten, bytesTotal - bytesWritten, null);\n      } catch (error) {\n        if (error.code === \"EPIPE\") break; // ignore broken pipe, e.g., | head\n        fs.closeSync(fd);\n        throw error;\n      }\n    }\n\n    fs.closeSync(fd);\n  }\n};\n\n},{\"./encode\":52,\"fs\":4}],56:[function(require,module,exports){\n(function (process){\nvar fs = require(\"fs\"),\n    encode = require(\"./encode\");\n\nmodule.exports = function(filename, data, options, callback) {\n  if (arguments.length < 4) callback = options, options = null;\n  fs.stat(filename, function(error, stat) {\n    if (error && error.code !== \"ENOENT\") return callback(error);\n    if (stat && stat.isFile()) {\n      fs.writeFile(filename, data, options, callback);\n    } else {\n      var stream, send = \"end\";\n\n      switch (filename) {\n        case \"/dev/stdout\": stream = process.stdout, send = \"write\"; break;\n        case \"/dev/stderr\": stream = process.stderr, send = \"write\"; break;\n        default: stream = fs.createWriteStream(filename, options ? {flags: options.flag || \"w\"} : {}); break; // N.B. flag / flags\n      }\n\n      stream\n          .on(\"error\", function(error) { callback(error.code === \"EPIPE\" ? null : error); }) // ignore broken pipe, e.g., | head\n          [send](encode(data, options), function(error) { callback(error && error.code === \"EPIPE\" ? null : error); });\n    }\n  });\n};\n\n}).call(this,require('_process'))\n},{\"./encode\":52,\"_process\":36,\"fs\":4}],57:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/readable.js');\nStream.Writable = require('readable-stream/writable.js');\nStream.Duplex = require('readable-stream/duplex.js');\nStream.Transform = require('readable-stream/transform.js');\nStream.PassThrough = require('readable-stream/passthrough.js');\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams.  Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n  EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n  var source = this;\n\n  function ondata(chunk) {\n    if (dest.writable) {\n      if (false === dest.write(chunk) && source.pause) {\n        source.pause();\n      }\n    }\n  }\n\n  source.on('data', ondata);\n\n  function ondrain() {\n    if (source.readable && source.resume) {\n      source.resume();\n    }\n  }\n\n  dest.on('drain', ondrain);\n\n  // If the 'end' option is not supplied, dest.end() will be called when\n  // source gets the 'end' or 'close' events.  Only dest.end() once.\n  if (!dest._isStdio && (!options || options.end !== false)) {\n    source.on('end', onend);\n    source.on('close', onclose);\n  }\n\n  var didOnEnd = false;\n  function onend() {\n    if (didOnEnd) return;\n    didOnEnd = true;\n\n    dest.end();\n  }\n\n\n  function onclose() {\n    if (didOnEnd) return;\n    didOnEnd = true;\n\n    if (typeof dest.destroy === 'function') dest.destroy();\n  }\n\n  // don't leave dangling pipes when there are errors.\n  function onerror(er) {\n    cleanup();\n    if (EE.listenerCount(this, 'error') === 0) {\n      throw er; // Unhandled stream error in pipe.\n    }\n  }\n\n  source.on('error', onerror);\n  dest.on('error', onerror);\n\n  // remove all the event listeners that were added.\n  function cleanup() {\n    source.removeListener('data', ondata);\n    dest.removeListener('drain', ondrain);\n\n    source.removeListener('end', onend);\n    source.removeListener('close', onclose);\n\n    source.removeListener('error', onerror);\n    dest.removeListener('error', onerror);\n\n    source.removeListener('end', cleanup);\n    source.removeListener('close', cleanup);\n\n    dest.removeListener('close', cleanup);\n  }\n\n  source.on('end', cleanup);\n  source.on('close', cleanup);\n\n  dest.on('close', cleanup);\n\n  dest.emit('pipe', source);\n\n  // Allow for unix-like usage: A.pipe(B).pipe(C)\n  return dest;\n};\n\n},{\"events\":9,\"inherits\":32,\"readable-stream/duplex.js\":38,\"readable-stream/passthrough.js\":45,\"readable-stream/readable.js\":46,\"readable-stream/transform.js\":47,\"readable-stream/writable.js\":48}],58:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar Buffer = require('buffer').Buffer;\n\nvar isBufferEncoding = Buffer.isEncoding\n  || function(encoding) {\n       switch (encoding && encoding.toLowerCase()) {\n         case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;\n         default: return false;\n       }\n     }\n\n\nfunction assertEncoding(encoding) {\n  if (encoding && !isBufferEncoding(encoding)) {\n    throw new Error('Unknown encoding: ' + encoding);\n  }\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters. CESU-8 is handled as part of the UTF-8 encoding.\n//\n// @TODO Handling all encodings inside a single object makes it very difficult\n// to reason about this code, so it should be split up in the future.\n// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code\n// points as used by CESU-8.\nvar StringDecoder = exports.StringDecoder = function(encoding) {\n  this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');\n  assertEncoding(encoding);\n  switch (this.encoding) {\n    case 'utf8':\n      // CESU-8 represents each of Surrogate Pair by 3-bytes\n      this.surrogateSize = 3;\n      break;\n    case 'ucs2':\n    case 'utf16le':\n      // UTF-16 represents each of Surrogate Pair by 2-bytes\n      this.surrogateSize = 2;\n      this.detectIncompleteChar = utf16DetectIncompleteChar;\n      break;\n    case 'base64':\n      // Base-64 stores 3 bytes in 4 chars, and pads the remainder.\n      this.surrogateSize = 3;\n      this.detectIncompleteChar = base64DetectIncompleteChar;\n      break;\n    default:\n      this.write = passThroughWrite;\n      return;\n  }\n\n  // Enough space to store all bytes of a single character. UTF-8 needs 4\n  // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).\n  this.charBuffer = new Buffer(6);\n  // Number of bytes received for the current incomplete multi-byte character.\n  this.charReceived = 0;\n  // Number of bytes expected for the current incomplete multi-byte character.\n  this.charLength = 0;\n};\n\n\n// write decodes the given buffer and returns it as JS string that is\n// guaranteed to not contain any partial multi-byte characters. Any partial\n// character found at the end of the buffer is buffered up, and will be\n// returned when calling write again with the remaining bytes.\n//\n// Note: Converting a Buffer containing an orphan surrogate to a String\n// currently works, but converting a String to a Buffer (via `new Buffer`, or\n// Buffer#write) will replace incomplete surrogates with the unicode\n// replacement character. See https://codereview.chromium.org/121173009/ .\nStringDecoder.prototype.write = function(buffer) {\n  var charStr = '';\n  // if our last write ended with an incomplete multibyte character\n  while (this.charLength) {\n    // determine how many remaining bytes this buffer has to offer for this char\n    var available = (buffer.length >= this.charLength - this.charReceived) ?\n        this.charLength - this.charReceived :\n        buffer.length;\n\n    // add the new bytes to the char buffer\n    buffer.copy(this.charBuffer, this.charReceived, 0, available);\n    this.charReceived += available;\n\n    if (this.charReceived < this.charLength) {\n      // still not enough chars in this buffer? wait for more ...\n      return '';\n    }\n\n    // remove bytes belonging to the current character from the buffer\n    buffer = buffer.slice(available, buffer.length);\n\n    // get the character that was split\n    charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);\n\n    // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n    var charCode = charStr.charCodeAt(charStr.length - 1);\n    if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n      this.charLength += this.surrogateSize;\n      charStr = '';\n      continue;\n    }\n    this.charReceived = this.charLength = 0;\n\n    // if there are no more bytes in this buffer, just emit our char\n    if (buffer.length === 0) {\n      return charStr;\n    }\n    break;\n  }\n\n  // determine and set charLength / charReceived\n  this.detectIncompleteChar(buffer);\n\n  var end = buffer.length;\n  if (this.charLength) {\n    // buffer the incomplete character bytes we got\n    buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);\n    end -= this.charReceived;\n  }\n\n  charStr += buffer.toString(this.encoding, 0, end);\n\n  var end = charStr.length - 1;\n  var charCode = charStr.charCodeAt(end);\n  // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character\n  if (charCode >= 0xD800 && charCode <= 0xDBFF) {\n    var size = this.surrogateSize;\n    this.charLength += size;\n    this.charReceived += size;\n    this.charBuffer.copy(this.charBuffer, size, 0, size);\n    buffer.copy(this.charBuffer, 0, 0, size);\n    return charStr.substring(0, end);\n  }\n\n  // or just emit the charStr\n  return charStr;\n};\n\n// detectIncompleteChar determines if there is an incomplete UTF-8 character at\n// the end of the given buffer. If so, it sets this.charLength to the byte\n// length that character, and sets this.charReceived to the number of bytes\n// that are available for this character.\nStringDecoder.prototype.detectIncompleteChar = function(buffer) {\n  // determine how many bytes we have to check at the end of this buffer\n  var i = (buffer.length >= 3) ? 3 : buffer.length;\n\n  // Figure out if one of the last i bytes of our buffer announces an\n  // incomplete char.\n  for (; i > 0; i--) {\n    var c = buffer[buffer.length - i];\n\n    // See http://en.wikipedia.org/wiki/UTF-8#Description\n\n    // 110XXXXX\n    if (i == 1 && c >> 5 == 0x06) {\n      this.charLength = 2;\n      break;\n    }\n\n    // 1110XXXX\n    if (i <= 2 && c >> 4 == 0x0E) {\n      this.charLength = 3;\n      break;\n    }\n\n    // 11110XXX\n    if (i <= 3 && c >> 3 == 0x1E) {\n      this.charLength = 4;\n      break;\n    }\n  }\n  this.charReceived = i;\n};\n\nStringDecoder.prototype.end = function(buffer) {\n  var res = '';\n  if (buffer && buffer.length)\n    res = this.write(buffer);\n\n  if (this.charReceived) {\n    var cr = this.charReceived;\n    var buf = this.charBuffer;\n    var enc = this.encoding;\n    res += buf.slice(0, cr).toString(enc);\n  }\n\n  return res;\n};\n\nfunction passThroughWrite(buffer) {\n  return buffer.toString(this.encoding);\n}\n\nfunction utf16DetectIncompleteChar(buffer) {\n  this.charReceived = buffer.length % 2;\n  this.charLength = this.charReceived ? 2 : 0;\n}\n\nfunction base64DetectIncompleteChar(buffer) {\n  this.charReceived = buffer.length % 3;\n  this.charLength = this.charReceived ? 3 : 0;\n}\n\n},{\"buffer\":5}],59:[function(require,module,exports){\n(function (global){\n\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n  if (config('noDeprecation')) {\n    return fn;\n  }\n\n  var warned = false;\n  function deprecated() {\n    if (!warned) {\n      if (config('throwDeprecation')) {\n        throw new Error(msg);\n      } else if (config('traceDeprecation')) {\n        console.trace(msg);\n      } else {\n        console.warn(msg);\n      }\n      warned = true;\n    }\n    return fn.apply(this, arguments);\n  }\n\n  return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n  // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n  try {\n    if (!global.localStorage) return false;\n  } catch (_) {\n    return false;\n  }\n  var val = global.localStorage[name];\n  if (null == val) return false;\n  return String(val).toLowerCase() === 'true';\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}]},{},[1]);\n"
  },
  {
    "path": "page.css",
    "content": "/*\n@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600);\n*/\n\n@font-face {\n  font-family: 'Source Sans Pro';\n  font-style: normal;\n  font-weight: 400;\n  src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(SourceSansPro-Regular.woff) format('woff');\n}\n\n@font-face {\n  font-family: 'Source Sans Pro';\n  font-style: normal;\n  font-weight: 600;\n  src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(SourceSansPro-Semibold.woff) format('woff');\n}\n\nhtml, body {\n\theight: 100%;\n\twidth: 100%;\n\tmargin: 0;\n\tpadding: 0;\n}\n\nbody {\n\toverflow: hidden;\n\tbackground-color: #fff;\n\tfont: 14px/1.4 'Source Sans Pro', Helvetica, sans-serif;\n\tcolor: #444;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\t-moz-user-select: none;\n\tcursor: default;\n}\n\n.selectable,.selectable * {\n\tuser-select: default;\n\t-webkit-user-select: text;\n\t-moz-user-select: text;\n\tcursor: text;\n}\n\n\n/* --- Themed elements -------------- */\n\n.page-header,\n.dialog-btn {\n\tbackground-color: #1385b7;\n}\n\n.colored-text {\n\tcolor: #0774a5;\n}\n\n\n.dot-underline {\n\tborder-bottom: 1px dotted #0774a5;\n}\n\n.nav-btn * {\n\tfill: #1385b7;\n}\n\n.dialog-btn:hover,\n.header-btn:hover {\n\tbackground-color: #0F5A84;\n}\n\n.colored-text::selection {\n\tbackground-color: #e6f7ff;\n}\n\n.colored-text::-moz-selection {\n\tbackground-color: #e6f7ff;\n}\n\n.layer-item.active {\n\tbackground-color: #e6f7ff;\n}\n\n/* THEME 2  */\n\n.theme2 .page-header,\n.theme2 .dialog-btn {\n\tbackground-color: #678691;\n}\n\n.theme2 .colored-text {\n\tcolor: #678691;\n}\n\n.theme2 .dot-underline {\n\tborder-bottom: 1px dotted #678691;\n}\n\n.theme2 .nav-btn * {\n\tfill: #678691;\n}\n\n.theme2 .dialog-btn:hover,\n.theme2 .header-btn:hover {\n\tbackground-color: #365A68;\n}\n\n.theme2 .colored-text::selection {\n\tbackground-color: #DEF1F9;\n}\n\n.theme2 .colored-text::-moz-selection {\n\tbackground-color: #DEF1F9;\n}\n\n.theme2 .layer-item.active {\n\tbackground-color: #DEF1F9;\n}\n\n/* THEME 3 -- GREY */\n\n.theme3 .page-header,\n.theme3 .dialog-btn {\n\tbackground-color: #8c8c8c;\n}\n\n.theme3 .nav-btn * {\n\tfill: #8c8c8c;\n}\n\n.theme3 .nav-btn.selected {\n\tbackground-color: black;\n}\n\n.theme3 .dialog-btn:hover,\n.theme3 .header-btn:hover {\n\tbackground-color: #555;\n}\n\n/* --- Page header --------------- */\n\n.page-header {\n\tposition: absolute;\n\tcolor: white;\n\ttop: 0;\n\tleft: 0;\n\tz-index: 40;\n\twidth: 100%;\n\theight: 32px;\n}\n\n#coordinate-info {\n\tz-index: 1;\n\tposition: absolute;\n\tbottom: 6px;\n\tleft: 6px;\n\tpadding: 2px 5px 2px 5px;\n\tfont-size: 11px;\n}\n\n\n\n.mapshaper-logo {\n\tfont-weight: bold;\n\tfont-size: 18px;\n\tmargin: 2px 0 0 12px;\n}\n\n.mapshaper-logo .logo-highlight {\n\tcolor: #ffa;\n}\n\n.page-header a {\n\ttext-decoration: none;\n}\n\n#mode-buttons {\n\tz-index: 20;\n\tposition: absolute;\n\ttop: 0px;\n\tright: 0px;\n\tdisplay: none;\n\tmargin: 0 8px 3px 0;\n}\n\n.separator {\n\tborder-left: 1px solid white;\n\theight: 10px;\n\tmargin: 0 2px 0 2px;\n}\n\n/* --- Export dialog --------- */\n\n#export-options .dialog-btn {\n\tmin-width: 20px;\n\tpadding: 4px 6px 5px 6px;\n}\n\n#export-layer-list {\n\tmax-height: 160px;\n\toverflow: hidden;\n\toverflow-y: auto;\n\tmargin-right: -13px;\n}\n\n#export-layer-list > div {\n\twhite-space: nowrap;\n}\n\n#export-options .option-menu .advanced-options {\n\twidth: 190px;\n}\n\n/* --- Main area ------------- */\n\n.main-area {\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\tmargin: 32px 0 0 0;\t\n}\n\n\n/* --- Error message ---------- */\n\n.error-wrapper {\n\tz-index: 120;\n\ttext-align: center;\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n}\n\ndiv.error-box {\n\tmargin-top: 55px;\n\t/* padding: 8px 12px 10px 12px; */\n\tmax-width: 400px;\n\tfont-size: 16px;\n}\n\ndiv.error-box > div {\n\n}\n\n\n/* --- Import screen -------------- */\n\n#fork-me {\n\tbackground-image: url(\"images/fork-me-right-graphite@2x.png\");\n    background-size: 149px 149px;\n\tposition: absolute;\n\tz-index: 110;\n\ttop: 0;\n\tright: 0;\n\tborder: 0;\n\twidth: 149px;\n\theight: 149px;\n}\n\n.option-menu .advanced-options {\n\twidth: 210px;\n\tbackground: rgba(255, 255, 255, 0.4);\n\tborder: 1px solid #999;\n\tpadding: 0 3px;\n\theight: 17px;\n\tfont-size: 12px;\n}\n\n#mshp-not-supported {\n\tdisplay: none;\n\tz-index: 100;\n\ttext-align: center;\n}\n\n#dropped-file-list {\n\tdisplay: none;\n\tpadding-bottom: 3px;\n}\n\n#dropped-file-list p {\n\tline-height: 1;\n\tmargin-bottom: 5px;\n}\n\n.popup-dialog {\n\tdisplay: none;\n\tz-index: 80;\t\n\ttext-align: center;\n}\n\n.info-box {\n\ttext-align: left;\n\tmargin-top: 12px;\n\tbackground-color: #fff;\n\tpadding: 10px 14px 8px 14px;\n\tvertical-align: top;\n\tdisplay: inline-block;\n\tborder: 1px solid #999;\n\tborder-radius: 9px;\n}\n\n.info-box h3 {\n\tfont-size: 1.2em;\n\tpadding: 0;\n\tmargin: 0 0 2px 0;\n}\n\n.info-box h4 {\n\tfont-size: 1em;\n\tmargin: 0 0 1px 0;\n}\n\n.info-box p {\n\twhite-space: pre-line;\n\tmargin: 0 0 0.5em 0;\n}\n\n.option-menu {\n\tpadding: 0 0 7px 0;\n}\n\n.option-menu input {\n\twidth: 12px;\n\theight: 12px;\n}\n\n.option-menu .tip-button {\n\tmargin-left: 12px;\n\tmargin-top: 3px;\n}\n\n.option-menu input.checkbox {\n\tmargin: 3px 5px 0 0;\n}\n\n.option-menu input.radio {\n\tmargin: 0 5px 0 0;\n}\n\n/* --- Progress bar --------------- */\n\n#progress-message {\n\tposition: absolute;\n\twidth: 100%;\n\tz-index: 90;\n\ttext-align: center;\n\ttop: 52px;\n}\n\n#progress-message > div {\n\tdisplay: inline-block;\n\ttext-transform: uppercase;\n\tpadding: 3px 6px;\n\tfont-size: 15px;\n\tcolor: black;\n\tbackground-color: rgba(255, 255, 222, 0.85);\n\tborder: 1px solid #333;\n}\n\n/* === Editing interface ========== */\n\n#mshp-main-page {\n\tposition: relative;\n\theight: 100%;\n\twidth: 100%;\n}\n\n\n/* --- Console control ------------ */\n\n#console {\n\tz-index: 30;\n\tpointer-events: none;\n\tdisplay: none;\n}\n\n#console-window {\n\tpointer-events: auto;\n\tbackground-color: rgba(0,0,0,1);\n\tposition: absolute;\n\twidth: 100%;\n\ttext-align: center;\n\toverflow: auto;\n\tmax-height: 80%;\n}\n\n#console-buffer {\n\tcursor: text;\n\twidth: 100%;\n\tposition: relative;\n\tcolor: white;\n\tfont: 13px/1.35 monospace;\n\tmargin: 8px 0 10px 0;\n\tword-break: break-all;\n\tword-wrap: break-word;\n\twhite-space: pre; /* Chrome breaks right at line end */\n}\n\n@-moz-document url-prefix() {\n\t#console-buffer {\n\t\twhite-space: pre-wrap; /* Firefox breaks right at line end */\n\t}\n}\n\n#console-buffer > div {\n\ttext-align: left;\n\tmax-width: 640px;\n\tmargin: 0 auto;\n\tpadding-left: 13%;\n\tpadding-right: 2%;\n}\n\n.console-error {\n\tcolor: #f93b00;\n}\n\n.console-message {\n\tcolor: #eddd98;\n}\n\n.console-example {\n\tcolor: #b9dffc;\n}\n\n.input-field {\n\toutline: none;\n\tmin-width: 100px;\n}\n\n/* --- Layer menu ----------- */\n\n#layer-control-btn {\n\ttop: 0;\n\tposition: absolute;\n\ttext-align: center;\n\tz-index: 10;\n\twidth: 100%;\n}\n\nbody.simplify #layer-control-btn {\n\tdisplay: none;\n}\n\n#layer-menu .info-box {\n\tmax-height: 90%;\n\toverflow: hidden;\n\toverflow-y: auto;\n\n}\n\n\n#layer-menu .layer-list {\n\tmargin: 6px 0 6px 0;\n}\n\n#layer-menu .layer-item {\n\tposition: relative;\n\tmargin-left: -14px;\n\tmargin-right: 9px;\n\tpadding: 8px 14px;\n\tcursor: pointer;\n\twidth: 100%;\n}\n\n.layer-item img {\n\tposition: absolute;\n\ttop: 8px;\n\topacity: 0.35;\n\tright: 8px;\n\twidth: 16px;\n\theight: 16px;\n\tpadding: 2px;\n}\n\n.layer-item img:hover {\n\topacity: 1;\n}\n\n.layer-item .row {\n\tline-height: 18px;\n\tmargin-bottom: 1px;\n\twhite-space: nowrap;\n}\n\n.layer-item .layer-name {\n\tdisplay: inline-block;\n\tmin-height: 14px; /* For FF when content is empty */\n\tmin-width: 2px;\n\toutline: none;\n}\n\n.layer-item .layer-name.editing {\n\tborder-bottom: 1px solid transparent;\n}\n\n.layer-item .layer-name::selection {\n\tbackground: black;\n\tcolor: white;\n\ttext-decoration: none;\n}\n\n.layer-item .layer-name::-moz-selection {\n\tbackground: black;\n\tcolor: white;\n\ttext-decoration: none;\n}\n\n.layer-item:hover:not(.active) {\n\tbackground-color: #f7f7f7;\n}\n\n.layer-item .row > div {\n\tdisplay: inline-block;\n}\n\n.layer-item .col1 {\n\twidth: 84px;\n}\n\n.layer-item .col2 {\n\t/*position: relative;\n\tleft: 12px;\n\t*/\n}\n\n/* --- Intersection control ----------*/\n\n#intersection-display {\n\tcursor: default;\n\tvisibility: visible;\n\tdisplay: none;\n\tposition: absolute;\n\tz-index: 20;\n\ttop: 9px;\n\tleft: 12px;\n}\n\n#intersection-display .text-btn.disabled {\n\tvisibility: hidden;\n}\n\n/* --- Popup -------------------- */\n\n.popup {\n\tbox-sizing: border-box;\n\tposition: absolute;\n\tz-index: 40;\n\ttop: 12px;\n\tleft: 12px;\n\tbackground-color: white;\n\tborder: 1px solid #999;\n\tborder-radius: 9px;\n\tpadding: 5px 0;\n}\n\n.popup > div {\n\tbox-sizing: border-box;\n\toverflow: hidden;\n\toverflow-y: auto;\n\tpadding: 4px 12px;\n\tline-height: 1.2;\n\tfont-size: 13px;\n}\n\n.popup table {\n\tborder-spacing: 0px;\n}\n\n.popup td {\n\tvertical-align: top;\n\tpadding: 2px 0;\n\t/*font-weight: bold;*/\n\tmin-width: 80px;\n\tmax-width: 180px;\n\tcolor: black;\n}\n\n.popup td.field-name {\n\tcolor: #aaa;\n\tpadding-right: 7px;\n\tfont-weight: normal;\n\tmin-width: 60px;\n}\n\n.popup .num-field {\n\tfont-style: italic;\n}\n\n.popup .empty {\n\tmin-width: 4px;\n\tmin-height: 10px;\n\tdisplay: inline-block;\n}\n\n.popup .null-value {\n\tcolor: #aaa;\n}\n\n.popup .note {\n\tfont-style: italic;\n\ttext-align: right;\n}\n\n.popup .value {\n\toutline: none;\n\tword-wrap: break-word;\n}\n\n.popup .editable-cell .value.editing {\n\tcolor: black;\n\tborder-bottom: none;\n}\n\n.popup .editable-cell .value::selection {\n\tcolor: white;\n\tbackground: black;\n}\n\n.popup .editable-cell .value::-moz-selection {\n\tcolor: white;\n\tbackground: black;\n}\n\n\n/* --- Map ---------------------- */\n\n#map-layers {\n\theight: 100%;\n}\n\n#mshp-main-map {\n\tbackground-color: #fff;\n}\n\n#map-layers.hover {\n\tcursor: pointer;\n}\n\n#map-layers canvas {\n\tpointer-events: none;\n\tposition: absolute;\n}\n\n#map-layers canvas.retina {\n\ttransform-origin: top left;\n\t-webkit-transform-origin: top left;\n\ttransform: scale3D(0.5, 0.5, 1);\n\t-webkit-transform: scale3D(0.5, 0.5, 1);\n}\n\n#nav-buttons {\n\tdisplay: none;\n\tz-index: 20;\n\tposition: absolute;\n\ttop: 6px;\n\tright: 9px;\n\tpadding: 2px;\n\tbackground-color: rgba(255, 255, 255, 0.85);\n}\n\n.nav-btn {\n\tcursor:pointer;\n\tpadding: 3px;\n\tline-height: 1;\n}\n\n\n.nav-btn:hover * {\n\tfill: black;\n}\n\n.nav-btn.selected * {\n\tfill: white;\n}\n\n.nav-btn.selected {\n\tbackground-color: black;\n\tborder-radius: 4px;\n}\n\n.zoom-box {\n\tposition: absolute;\n\tborder: 1px solid #f74b80;\n\tz-index: 15;\n}\n\n\n/* Simplification control ------------ */\n\n@media (max-width: 765px) {\n\tbody.simplify  #simplify-control-wrapper {\n\t\ttop: 22px;\n\t}\n\n\tbody.simplify .page-header {\n\t\theight: 52px;\n\t}\n\n\tbody.simplify .main-area {\n\t\tmargin-top: 52px;\n\t}\n}\n\n#simplify-control-wrapper {\n\tdisplay: none;\n\tposition: absolute;\n\twidth: 100%;\n\toverflow: hidden;\n\tmargin: 0 auto 0 auto;\n\ttop: 0px;\n}\n\n#simplify-control {\n\ttext-align: center;\n\twhite-space: nowrap;\n\tpadding: 0 90px 0 12px;\n}\n\n#simplify-control .slider {\n\tmargin: 15px 5px 0 3px;\n\tposition: relative;\n\tvertical-align: top;\n\tdisplay: inline-block;\n}\n\n#simplify-control .track {   \t\n  \tborder-radius: 2px;\n\twidth: 340px;\n\tbackground-color: #fff;\n\theight: 2px;\n}\n\n#simplify-control .handle {\n\tposition: absolute;\n\ttop: -3px;\n}\n\n#simplify-control .handle img {\n\twidth: 20px;\n\theight: 20px;\n\tmargin-left: -10px;\n\tmargin-top: -10px;\n}\n\n#simplify-control .clicktext {\n\twidth: 56px;\n\tbackground: rgba(255, 255, 255, 0.5);\n\ttext-align: center;\n\tborder: 1px solid rgba(0,0,0,0);\n\tfont-size: 13px;\n}\n\n#simplify-control .clicktext:focus {\n\tbackground: #fff;\n}\n"
  },
  {
    "path": "pako.deflate.js",
    "content": "/* pako 0.2.7 nodeca/pako */\n!function(t){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=t();else if(\"function\"==typeof define&&define.amd)define([],t);else{var e;e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this,e.pako=t()}}(function(){return function t(e,a,n){function r(s,h){if(!a[s]){if(!e[s]){var l=\"function\"==typeof require&&require;if(!h&&l)return l(s,!0);if(i)return i(s,!0);var o=new Error(\"Cannot find module '\"+s+\"'\");throw o.code=\"MODULE_NOT_FOUND\",o}var _=a[s]={exports:{}};e[s][0].call(_.exports,function(t){var a=e[s][1][t];return r(a?a:t)},_,_.exports,t,e,a,n)}return a[s].exports}for(var i=\"function\"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(t,e,a){\"use strict\";var n=\"undefined\"!=typeof Uint8Array&&\"undefined\"!=typeof Uint16Array&&\"undefined\"!=typeof Int32Array;a.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var a=e.shift();if(a){if(\"object\"!=typeof a)throw new TypeError(a+\"must be non-object\");for(var n in a)a.hasOwnProperty(n)&&(t[n]=a[n])}}return t},a.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,a,n,r){if(e.subarray&&t.subarray)return void t.set(e.subarray(a,a+n),r);for(var i=0;n>i;i++)t[r+i]=e[a+i]},flattenChunks:function(t){var e,a,n,r,i,s;for(n=0,e=0,a=t.length;a>e;e++)n+=t[e].length;for(s=new Uint8Array(n),r=0,e=0,a=t.length;a>e;e++)i=t[e],s.set(i,r),r+=i.length;return s}},i={arraySet:function(t,e,a,n,r){for(var i=0;n>i;i++)t[r+i]=e[a+i]},flattenChunks:function(t){return[].concat.apply([],t)}};a.setTyped=function(t){t?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,r)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,i))},a.setTyped(n)},{}],2:[function(t,e,a){\"use strict\";function n(t,e){if(65537>e&&(t.subarray&&s||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var a=\"\",n=0;e>n;n++)a+=String.fromCharCode(t[n]);return a}var r=t(\"./common\"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(h){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){s=!1}for(var l=new r.Buf8(256),o=0;256>o;o++)l[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;l[254]=l[254]=1,a.string2buf=function(t){var e,a,n,i,s,h=t.length,l=0;for(i=0;h>i;i++)a=t.charCodeAt(i),55296===(64512&a)&&h>i+1&&(n=t.charCodeAt(i+1),56320===(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),l+=128>a?1:2048>a?2:65536>a?3:4;for(e=new r.Buf8(l),s=0,i=0;l>s;i++)a=t.charCodeAt(i),55296===(64512&a)&&h>i+1&&(n=t.charCodeAt(i+1),56320===(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),128>a?e[s++]=a:2048>a?(e[s++]=192|a>>>6,e[s++]=128|63&a):65536>a?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e},a.buf2binstring=function(t){return n(t,t.length)},a.binstring2buf=function(t){for(var e=new r.Buf8(t.length),a=0,n=e.length;n>a;a++)e[a]=t.charCodeAt(a);return e},a.buf2string=function(t,e){var a,r,i,s,h=e||t.length,o=new Array(2*h);for(r=0,a=0;h>a;)if(i=t[a++],128>i)o[r++]=i;else if(s=l[i],s>4)o[r++]=65533,a+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&h>a;)i=i<<6|63&t[a++],s--;s>1?o[r++]=65533:65536>i?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|1023&i)}return n(o,r)},a.utf8border=function(t,e){var a;for(e=e||t.length,e>t.length&&(e=t.length),a=e-1;a>=0&&128===(192&t[a]);)a--;return 0>a?e:0===a?e:a+l[t[a]]>e?a:e}},{\"./common\":1}],3:[function(t,e,a){\"use strict\";function n(t,e,a,n){for(var r=65535&t|0,i=t>>>16&65535|0,s=0;0!==a;){s=a>2e3?2e3:a,a-=s;do r=r+e[n++]|0,i=i+r|0;while(--s);r%=65521,i%=65521}return r|i<<16|0}e.exports=n},{}],4:[function(t,e,a){\"use strict\";function n(){for(var t,e=[],a=0;256>a;a++){t=a;for(var n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}function r(t,e,a,n){var r=i,s=n+a;t=-1^t;for(var h=n;s>h;h++)t=t>>>8^r[255&(t^e[h])];return-1^t}var i=n();e.exports=r},{}],5:[function(t,e,a){\"use strict\";function n(t,e){return t.msg=I[e],e}function r(t){return(t<<1)-(t>4?9:0)}function i(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(S.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function h(t,e){j._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,s(t.strm)}function l(t,e){t.pending_buf[t.pending++]=e}function o(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function _(t,e,a,n){var r=t.avail_in;return r>n&&(r=n),0===r?0:(t.avail_in-=r,S.arraySet(e,t.input,t.next_in,r,a),1===t.state.wrap?t.adler=E(t.adler,e,r,a):2===t.state.wrap&&(t.adler=U(t.adler,e,r,a)),t.next_in+=r,t.total_in+=r,r)}function d(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-ot?t.strstart-(t.w_size-ot):0,o=t.window,_=t.w_mask,d=t.prev,u=t.strstart+lt,f=o[i+s-1],c=o[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do if(a=e,o[a+s]===c&&o[a+s-1]===f&&o[a]===o[i]&&o[++a]===o[i+1]){i+=2,a++;do;while(o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&o[++i]===o[++a]&&u>i);if(n=lt-(u-i),i=u-lt,n>s){if(t.match_start=e,s=n,n>=h)break;f=o[i+s-1],c=o[i+s]}}while((e=d[e&_])>l&&0!==--r);return s<=t.lookahead?s:t.lookahead}function u(t){var e,a,n,r,i,s=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-ot)){S.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,a=t.hash_size,e=a;do n=t.head[--e],t.head[e]=n>=s?n-s:0;while(--a);a=s,e=a;do n=t.prev[--e],t.prev[e]=n>=s?n-s:0;while(--a);r+=s}if(0===t.strm.avail_in)break;if(a=_(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=a,t.lookahead+t.insert>=ht)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=(t.ins_h<<t.hash_shift^t.window[i+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[i+ht-1])&t.hash_mask,t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<ht)););}while(t.lookahead<ot&&0!==t.strm.avail_in)}function f(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(u(t),0===t.lookahead&&e===D)return bt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,h(t,!1),0===t.strm.avail_out))return bt;if(t.strstart-t.block_start>=t.w_size-ot&&(h(t,!1),0===t.strm.avail_out))return bt}return t.insert=0,e===T?(h(t,!0),0===t.strm.avail_out?wt:yt):t.strstart>t.block_start&&(h(t,!1),0===t.strm.avail_out)?bt:bt}function c(t,e){for(var a,n;;){if(t.lookahead<ot){if(u(t),t.lookahead<ot&&e===D)return bt;if(0===t.lookahead)break}if(a=0,t.lookahead>=ht&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ht-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ot&&(t.match_length=d(t,a)),t.match_length>=ht)if(n=j._tr_tally(t,t.strstart-t.match_start,t.match_length-ht),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ht){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ht-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=j._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(h(t,!1),0===t.strm.avail_out))return bt}return t.insert=t.strstart<ht-1?t.strstart:ht-1,e===T?(h(t,!0),0===t.strm.avail_out?wt:yt):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?bt:vt}function g(t,e){for(var a,n,r;;){if(t.lookahead<ot){if(u(t),t.lookahead<ot&&e===D)return bt;if(0===t.lookahead)break}if(a=0,t.lookahead>=ht&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ht-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ht-1,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ot&&(t.match_length=d(t,a),t.match_length<=5&&(t.strategy===P||t.match_length===ht&&t.strstart-t.match_start>4096)&&(t.match_length=ht-1)),t.prev_length>=ht&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-ht,n=j._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ht),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=r&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+ht-1])&t.hash_mask,a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(0!==--t.prev_length);if(t.match_available=0,t.match_length=ht-1,t.strstart++,n&&(h(t,!1),0===t.strm.avail_out))return bt}else if(t.match_available){if(n=j._tr_tally(t,0,t.window[t.strstart-1]),n&&h(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return bt}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=j._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ht-1?t.strstart:ht-1,e===T?(h(t,!0),0===t.strm.avail_out?wt:yt):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?bt:vt}function p(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=lt){if(u(t),t.lookahead<=lt&&e===D)return bt;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=ht&&t.strstart>0&&(r=t.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){i=t.strstart+lt;do;while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&i>r);t.match_length=lt-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ht?(a=j._tr_tally(t,1,t.match_length-ht),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=j._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(h(t,!1),0===t.strm.avail_out))return bt}return t.insert=0,e===T?(h(t,!0),0===t.strm.avail_out?wt:yt):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?bt:vt}function m(t,e){for(var a;;){if(0===t.lookahead&&(u(t),0===t.lookahead)){if(e===D)return bt;break}if(t.match_length=0,a=j._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(h(t,!1),0===t.strm.avail_out))return bt}return t.insert=0,e===T?(h(t,!0),0===t.strm.avail_out?wt:yt):t.last_lit&&(h(t,!1),0===t.strm.avail_out)?bt:vt}function b(t){t.window_size=2*t.w_size,i(t.head),t.max_lazy_match=C[t.level].max_lazy,t.good_match=C[t.level].good_length,t.nice_match=C[t.level].nice_length,t.max_chain_length=C[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ht-1,t.match_available=0,t.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=X,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new S.Buf16(2*it),this.dyn_dtree=new S.Buf16(2*(2*nt+1)),this.bl_tree=new S.Buf16(2*(2*rt+1)),i(this.dyn_ltree),i(this.dyn_dtree),i(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new S.Buf16(st+1),this.heap=new S.Buf16(2*at+1),i(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new S.Buf16(2*at+1),i(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function w(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=W,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?dt:pt,t.adler=2===e.wrap?0:1,e.last_flush=D,j._tr_init(e),N):n(t,H)}function y(t){var e=w(t);return e===N&&b(t.state),e}function z(t,e){return t&&t.state?2!==t.state.wrap?H:(t.state.gzhead=e,N):H}function k(t,e,a,r,i,s){if(!t)return H;var h=1;if(e===M&&(e=6),0>r?(h=0,r=-r):r>15&&(h=2,r-=16),1>i||i>Y||a!==X||8>r||r>15||0>e||e>9||0>s||s>Q)return n(t,H);8===r&&(r=9);var l=new v;return t.state=l,l.strm=t,l.wrap=h,l.gzhead=null,l.w_bits=r,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=i+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+ht-1)/ht),l.window=new S.Buf8(2*l.w_size),l.head=new S.Buf16(l.hash_size),l.prev=new S.Buf16(l.w_size),l.lit_bufsize=1<<i+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new S.Buf8(l.pending_buf_size),l.d_buf=l.lit_bufsize>>1,l.l_buf=3*l.lit_bufsize,l.level=e,l.strategy=s,l.method=a,y(t)}function x(t,e){return k(t,e,X,Z,$,V)}function B(t,e){var a,h,_,d;if(!t||!t.state||e>L||0>e)return t?n(t,H):H;if(h=t.state,!t.output||!t.input&&0!==t.avail_in||h.status===mt&&e!==T)return n(t,0===t.avail_out?K:H);if(h.strm=t,a=h.last_flush,h.last_flush=e,h.status===dt)if(2===h.wrap)t.adler=0,l(h,31),l(h,139),l(h,8),h.gzhead?(l(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),l(h,255&h.gzhead.time),l(h,h.gzhead.time>>8&255),l(h,h.gzhead.time>>16&255),l(h,h.gzhead.time>>24&255),l(h,9===h.level?2:h.strategy>=G||h.level<2?4:0),l(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(l(h,255&h.gzhead.extra.length),l(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(t.adler=U(t.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=ut):(l(h,0),l(h,0),l(h,0),l(h,0),l(h,0),l(h,9===h.level?2:h.strategy>=G||h.level<2?4:0),l(h,zt),h.status=pt);else{var u=X+(h.w_bits-8<<4)<<8,f=-1;f=h.strategy>=G||h.level<2?0:h.level<6?1:6===h.level?2:3,u|=f<<6,0!==h.strstart&&(u|=_t),u+=31-u%31,h.status=pt,o(h,u),0!==h.strstart&&(o(h,t.adler>>>16),o(h,65535&t.adler)),t.adler=1}if(h.status===ut)if(h.gzhead.extra){for(_=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>_&&(t.adler=U(t.adler,h.pending_buf,h.pending-_,_)),s(t),_=h.pending,h.pending!==h.pending_buf_size));)l(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>_&&(t.adler=U(t.adler,h.pending_buf,h.pending-_,_)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=ft)}else h.status=ft;if(h.status===ft)if(h.gzhead.name){_=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>_&&(t.adler=U(t.adler,h.pending_buf,h.pending-_,_)),s(t),_=h.pending,h.pending===h.pending_buf_size)){d=1;break}d=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,l(h,d)}while(0!==d);h.gzhead.hcrc&&h.pending>_&&(t.adler=U(t.adler,h.pending_buf,h.pending-_,_)),0===d&&(h.gzindex=0,h.status=ct)}else h.status=ct;if(h.status===ct)if(h.gzhead.comment){_=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>_&&(t.adler=U(t.adler,h.pending_buf,h.pending-_,_)),s(t),_=h.pending,h.pending===h.pending_buf_size)){d=1;break}d=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,l(h,d)}while(0!==d);h.gzhead.hcrc&&h.pending>_&&(t.adler=U(t.adler,h.pending_buf,h.pending-_,_)),0===d&&(h.status=gt)}else h.status=gt;if(h.status===gt&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&s(t),h.pending+2<=h.pending_buf_size&&(l(h,255&t.adler),l(h,t.adler>>8&255),t.adler=0,h.status=pt)):h.status=pt),0!==h.pending){if(s(t),0===t.avail_out)return h.last_flush=-1,N}else if(0===t.avail_in&&r(e)<=r(a)&&e!==T)return n(t,K);if(h.status===mt&&0!==t.avail_in)return n(t,K);if(0!==t.avail_in||0!==h.lookahead||e!==D&&h.status!==mt){var c=h.strategy===G?m(h,e):h.strategy===J?p(h,e):C[h.level].func(h,e);if((c===wt||c===yt)&&(h.status=mt),c===bt||c===wt)return 0===t.avail_out&&(h.last_flush=-1),N;if(c===vt&&(e===O?j._tr_align(h):e!==L&&(j._tr_stored_block(h,0,0,!1),e===q&&(i(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),s(t),0===t.avail_out))return h.last_flush=-1,N}return e!==T?N:h.wrap<=0?R:(2===h.wrap?(l(h,255&t.adler),l(h,t.adler>>8&255),l(h,t.adler>>16&255),l(h,t.adler>>24&255),l(h,255&t.total_in),l(h,t.total_in>>8&255),l(h,t.total_in>>16&255),l(h,t.total_in>>24&255)):(o(h,t.adler>>>16),o(h,65535&t.adler)),s(t),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?N:R)}function A(t){var e;return t&&t.state?(e=t.state.status,e!==dt&&e!==ut&&e!==ft&&e!==ct&&e!==gt&&e!==pt&&e!==mt?n(t,H):(t.state=null,e===pt?n(t,F):N)):H}var C,S=t(\"../utils/common\"),j=t(\"./trees\"),E=t(\"./adler32\"),U=t(\"./crc32\"),I=t(\"./messages\"),D=0,O=1,q=3,T=4,L=5,N=0,R=1,H=-2,F=-3,K=-5,M=-1,P=1,G=2,J=3,Q=4,V=0,W=2,X=8,Y=9,Z=15,$=8,tt=29,et=256,at=et+1+tt,nt=30,rt=19,it=2*at+1,st=15,ht=3,lt=258,ot=lt+ht+1,_t=32,dt=42,ut=69,ft=73,ct=91,gt=103,pt=113,mt=666,bt=1,vt=2,wt=3,yt=4,zt=3,kt=function(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r};C=[new kt(0,0,0,0,f),new kt(4,4,8,4,c),new kt(4,5,16,8,c),new kt(4,6,32,32,c),new kt(4,4,16,16,g),new kt(8,16,32,32,g),new kt(8,16,128,128,g),new kt(8,32,128,256,g),new kt(32,128,258,1024,g),new kt(32,258,258,4096,g)],a.deflateInit=x,a.deflateInit2=k,a.deflateReset=y,a.deflateResetKeep=w,a.deflateSetHeader=z,a.deflate=B,a.deflateEnd=A,a.deflateInfo=\"pako deflate (from Nodeca project)\"},{\"../utils/common\":1,\"./adler32\":3,\"./crc32\":4,\"./messages\":6,\"./trees\":7}],6:[function(t,e,a){\"use strict\";e.exports={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"}},{}],7:[function(t,e,a){\"use strict\";function n(t){for(var e=t.length;--e>=0;)t[e]=0}function r(t){return 256>t?st[t]:st[256+(t>>>7)]}function i(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function s(t,e,a){t.bi_valid>Q-a?(t.bi_buf|=e<<t.bi_valid&65535,i(t,t.bi_buf),t.bi_buf=e>>Q-t.bi_valid,t.bi_valid+=a-Q):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)}function h(t,e,a){s(t,a[2*e],a[2*e+1])}function l(t,e){var a=0;do a|=1&t,t>>>=1,a<<=1;while(--e>0);return a>>>1}function o(t){16===t.bi_valid?(i(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function _(t,e){var a,n,r,i,s,h,l=e.dyn_tree,o=e.max_code,_=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,g=0;for(i=0;J>=i;i++)t.bl_count[i]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;G>a;a++)n=t.heap[a],i=l[2*l[2*n+1]+1]+1,i>c&&(i=c,g++),l[2*n+1]=i,n>o||(t.bl_count[i]++,s=0,n>=f&&(s=u[n-f]),h=l[2*n],t.opt_len+=h*(i+s),d&&(t.static_len+=h*(_[2*n+1]+s)));if(0!==g){do{for(i=c-1;0===t.bl_count[i];)i--;t.bl_count[i]--,t.bl_count[i+1]+=2,t.bl_count[c]--,g-=2}while(g>0);for(i=c;0!==i;i--)for(n=t.bl_count[i];0!==n;)r=t.heap[--a],r>o||(l[2*r+1]!==i&&(t.opt_len+=(i-l[2*r+1])*l[2*r],l[2*r+1]=i),n--)}}function d(t,e,a){var n,r,i=new Array(J+1),s=0;for(n=1;J>=n;n++)i[n]=s=s+a[n-1]<<1;for(r=0;e>=r;r++){var h=t[2*r+1];0!==h&&(t[2*r]=l(i[h]++,h))}}function u(){var t,e,a,n,r,i=new Array(J+1);for(a=0,n=0;H-1>n;n++)for(lt[n]=a,t=0;t<1<<$[n];t++)ht[a++]=n;for(ht[a-1]=n,r=0,n=0;16>n;n++)for(ot[n]=r,t=0;t<1<<tt[n];t++)st[r++]=n;for(r>>=7;M>n;n++)for(ot[n]=r<<7,t=0;t<1<<tt[n]-7;t++)st[256+r++]=n;for(e=0;J>=e;e++)i[e]=0;for(t=0;143>=t;)rt[2*t+1]=8,t++,i[8]++;for(;255>=t;)rt[2*t+1]=9,t++,i[9]++;for(;279>=t;)rt[2*t+1]=7,t++,i[7]++;for(;287>=t;)rt[2*t+1]=8,t++,i[8]++;for(d(rt,K+1,i),t=0;M>t;t++)it[2*t+1]=5,it[2*t]=l(t,5);_t=new ft(rt,$,F+1,K,J),dt=new ft(it,tt,0,M,J),ut=new ft(new Array(0),et,0,P,V)}function f(t){var e;for(e=0;K>e;e++)t.dyn_ltree[2*e]=0;for(e=0;M>e;e++)t.dyn_dtree[2*e]=0;for(e=0;P>e;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*W]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function c(t){t.bi_valid>8?i(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function g(t,e,a,n){c(t),n&&(i(t,a),i(t,~a)),E.arraySet(t.pending_buf,t.window,e,a,t.pending),t.pending+=a}function p(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]}function m(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&p(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!p(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n}function b(t,e,a){var n,i,l,o,_=0;if(0!==t.last_lit)do n=t.pending_buf[t.d_buf+2*_]<<8|t.pending_buf[t.d_buf+2*_+1],i=t.pending_buf[t.l_buf+_],_++,0===n?h(t,i,e):(l=ht[i],h(t,l+F+1,e),o=$[l],0!==o&&(i-=lt[l],s(t,i,o)),n--,l=r(n),h(t,l,a),o=tt[l],0!==o&&(n-=ot[l],s(t,n,o)));while(_<t.last_lit);h(t,W,e)}function v(t,e){var a,n,r,i=e.dyn_tree,s=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.elems,o=-1;for(t.heap_len=0,t.heap_max=G,a=0;l>a;a++)0!==i[2*a]?(t.heap[++t.heap_len]=o=a,t.depth[a]=0):i[2*a+1]=0;for(;t.heap_len<2;)r=t.heap[++t.heap_len]=2>o?++o:0,i[2*r]=1,t.depth[r]=0,t.opt_len--,h&&(t.static_len-=s[2*r+1]);for(e.max_code=o,a=t.heap_len>>1;a>=1;a--)m(t,i,a);r=l;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],m(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,i[2*r]=i[2*a]+i[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,i[2*a+1]=i[2*n+1]=r,t.heap[1]=r++,m(t,i,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],_(t,e),d(i,o,t.bl_count)}function w(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,o=4;for(0===s&&(l=138,o=3),e[2*(a+1)+1]=65535,n=0;a>=n;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(o>h?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[2*X]++):10>=h?t.bl_tree[2*Y]++:t.bl_tree[2*Z]++,h=0,i=r,0===s?(l=138,o=3):r===s?(l=6,o=3):(l=7,o=4))}function y(t,e,a){var n,r,i=-1,l=e[1],o=0,_=7,d=4;for(0===l&&(_=138,d=3),n=0;a>=n;n++)if(r=l,l=e[2*(n+1)+1],!(++o<_&&r===l)){if(d>o){do h(t,r,t.bl_tree);while(0!==--o)}else 0!==r?(r!==i&&(h(t,r,t.bl_tree),o--),h(t,X,t.bl_tree),s(t,o-3,2)):10>=o?(h(t,Y,t.bl_tree),s(t,o-3,3)):(h(t,Z,t.bl_tree),s(t,o-11,7));o=0,i=r,0===l?(_=138,d=3):r===l?(_=6,d=3):(_=7,d=4)}}function z(t){var e;for(w(t,t.dyn_ltree,t.l_desc.max_code),w(t,t.dyn_dtree,t.d_desc.max_code),v(t,t.bl_desc),e=P-1;e>=3&&0===t.bl_tree[2*at[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function k(t,e,a,n){var r;for(s(t,e-257,5),s(t,a-1,5),s(t,n-4,4),r=0;n>r;r++)s(t,t.bl_tree[2*at[r]+1],3);y(t,t.dyn_ltree,e-1),y(t,t.dyn_dtree,a-1)}function x(t){var e,a=4093624447;for(e=0;31>=e;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return I;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return D;for(e=32;F>e;e++)if(0!==t.dyn_ltree[2*e])return D;return I}function B(t){gt||(u(),gt=!0),t.l_desc=new ct(t.dyn_ltree,_t),t.d_desc=new ct(t.dyn_dtree,dt),t.bl_desc=new ct(t.bl_tree,ut),t.bi_buf=0,t.bi_valid=0,f(t)}function A(t,e,a,n){s(t,(q<<1)+(n?1:0),3),g(t,e,a,!0)}function C(t){s(t,T<<1,3),h(t,W,rt),o(t)}function S(t,e,a,n){var r,i,h=0;t.level>0?(t.strm.data_type===O&&(t.strm.data_type=x(t)),v(t,t.l_desc),v(t,t.d_desc),h=z(t),r=t.opt_len+3+7>>>3,i=t.static_len+3+7>>>3,r>=i&&(r=i)):r=i=a+5,r>=a+4&&-1!==e?A(t,e,a,n):t.strategy===U||i===r?(s(t,(T<<1)+(n?1:0),3),b(t,rt,it)):(s(t,(L<<1)+(n?1:0),3),k(t,t.l_desc.max_code+1,t.d_desc.max_code+1,h+1),b(t,t.dyn_ltree,t.dyn_dtree)),f(t),n&&c(t)}function j(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(ht[a]+F+1)]++,t.dyn_dtree[2*r(e)]++),t.last_lit===t.lit_bufsize-1}var E=t(\"../utils/common\"),U=4,I=0,D=1,O=2,q=0,T=1,L=2,N=3,R=258,H=29,F=256,K=F+1+H,M=30,P=19,G=2*K+1,J=15,Q=16,V=7,W=256,X=16,Y=17,Z=18,$=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],tt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],et=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],at=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],nt=512,rt=new Array(2*(K+2));n(rt);var it=new Array(2*M);n(it);var st=new Array(nt);n(st);var ht=new Array(R-N+1);n(ht);var lt=new Array(H);n(lt);var ot=new Array(M);n(ot);var _t,dt,ut,ft=function(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length},ct=function(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e},gt=!1;a._tr_init=B,a._tr_stored_block=A,a._tr_flush_block=S,a._tr_tally=j,a._tr_align=C},{\"../utils/common\":1}],8:[function(t,e,a){\"use strict\";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0}e.exports=n},{}],\"/lib/deflate.js\":[function(t,e,a){\"use strict\";function n(t,e){var a=new w(e);if(a.push(t,!0),a.err)throw a.msg;return a.result}function r(t,e){return e=e||{},e.raw=!0,n(t,e)}function i(t,e){return e=e||{},e.gzip=!0,n(t,e)}var s=t(\"./zlib/deflate.js\"),h=t(\"./utils/common\"),l=t(\"./utils/strings\"),o=t(\"./zlib/messages\"),_=t(\"./zlib/zstream\"),d=Object.prototype.toString,u=0,f=4,c=0,g=1,p=2,m=-1,b=0,v=8,w=function(t){this.options=h.assign({level:m,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:b,to:\"\"},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new _,this.strm.avail_out=0;var a=s.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==c)throw new Error(o[a]);e.header&&s.deflateSetHeader(this.strm,e.header)};w.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;n=e===~~e?e:e===!0?f:u,\"string\"==typeof t?r.input=l.string2buf(t):\"[object ArrayBuffer]\"===d.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(0===r.avail_out&&(r.output=new h.Buf8(i),r.next_out=0,r.avail_out=i),a=s.deflate(r,n),a!==g&&a!==c)return this.onEnd(a),this.ended=!0,!1;(0===r.avail_out||0===r.avail_in&&(n===f||n===p))&&this.onData(\"string\"===this.options.to?l.buf2binstring(h.shrinkBuf(r.output,r.next_out)):h.shrinkBuf(r.output,r.next_out))}while((r.avail_in>0||0===r.avail_out)&&a!==g);return n===f?(a=s.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===c):n===p?(this.onEnd(c),r.avail_out=0,!0):!0},w.prototype.onData=function(t){this.chunks.push(t)},w.prototype.onEnd=function(t){t===c&&(\"string\"===this.options.to?this.result=this.chunks.join(\"\"):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},a.Deflate=w,a.deflate=n,a.deflateRaw=r,a.gzip=i},{\"./utils/common\":1,\"./utils/strings\":2,\"./zlib/deflate.js\":5,\"./zlib/messages\":6,\"./zlib/zstream\":8}]},{},[])(\"/lib/deflate.js\")});\n"
  },
  {
    "path": "pako.inflate.js",
    "content": "/* pako 0.2.7 nodeca/pako */\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var t;t=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this,t.pako=e()}}(function(){return function e(t,i,n){function a(o,s){if(!i[o]){if(!t[o]){var f=\"function\"==typeof require&&require;if(!s&&f)return f(o,!0);if(r)return r(o,!0);var l=new Error(\"Cannot find module '\"+o+\"'\");throw l.code=\"MODULE_NOT_FOUND\",l}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){var i=t[o][1][e];return a(i?i:e)},d,d.exports,e,t,i,n)}return i[o].exports}for(var r=\"function\"==typeof require&&require,o=0;o<n.length;o++)a(n[o]);return a}({1:[function(e,t,i){\"use strict\";var n=\"undefined\"!=typeof Uint8Array&&\"undefined\"!=typeof Uint16Array&&\"undefined\"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if(\"object\"!=typeof i)throw new TypeError(i+\"must be non-object\");for(var n in i)i.hasOwnProperty(n)&&(e[n]=i[n])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var a={arraySet:function(e,t,i,n,a){if(t.subarray&&e.subarray)return void e.set(t.subarray(i,i+n),a);for(var r=0;n>r;r++)e[a+r]=t[i+r]},flattenChunks:function(e){var t,i,n,a,r,o;for(n=0,t=0,i=e.length;i>t;t++)n+=e[t].length;for(o=new Uint8Array(n),a=0,t=0,i=e.length;i>t;t++)r=e[t],o.set(r,a),a+=r.length;return o}},r={arraySet:function(e,t,i,n,a){for(var r=0;n>r;r++)e[a+r]=t[i+r]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,a)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,r))},i.setTyped(n)},{}],2:[function(e,t,i){\"use strict\";function n(e,t){if(65537>t&&(e.subarray&&o||!e.subarray&&r))return String.fromCharCode.apply(null,a.shrinkBuf(e,t));for(var i=\"\",n=0;t>n;n++)i+=String.fromCharCode(e[n]);return i}var a=e(\"./common\"),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(s){r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(s){o=!1}for(var f=new a.Buf8(256),l=0;256>l;l++)f[l]=l>=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;f[254]=f[254]=1,i.string2buf=function(e){var t,i,n,r,o,s=e.length,f=0;for(r=0;s>r;r++)i=e.charCodeAt(r),55296===(64512&i)&&s>r+1&&(n=e.charCodeAt(r+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),f+=128>i?1:2048>i?2:65536>i?3:4;for(t=new a.Buf8(f),o=0,r=0;f>o;r++)i=e.charCodeAt(r),55296===(64512&i)&&s>r+1&&(n=e.charCodeAt(r+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),r++)),128>i?t[o++]=i:2048>i?(t[o++]=192|i>>>6,t[o++]=128|63&i):65536>i?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},i.buf2binstring=function(e){return n(e,e.length)},i.binstring2buf=function(e){for(var t=new a.Buf8(e.length),i=0,n=t.length;n>i;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,a,r,o,s=t||e.length,l=new Array(2*s);for(a=0,i=0;s>i;)if(r=e[i++],128>r)l[a++]=r;else if(o=f[r],o>4)l[a++]=65533,i+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&s>i;)r=r<<6|63&e[i++],o--;o>1?l[a++]=65533:65536>r?l[a++]=r:(r-=65536,l[a++]=55296|r>>10&1023,l[a++]=56320|1023&r)}return n(l,a)},i.utf8border=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&128===(192&e[i]);)i--;return 0>i?t:0===i?t:i+f[e[i]]>t?i:t}},{\"./common\":1}],3:[function(e,t,i){\"use strict\";function n(e,t,i,n){for(var a=65535&e|0,r=e>>>16&65535|0,o=0;0!==i;){o=i>2e3?2e3:i,i-=o;do a=a+t[n++]|0,r=r+a|0;while(--o);a%=65521,r%=65521}return a|r<<16|0}t.exports=n},{}],4:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,i){\"use strict\";function n(){for(var e,t=[],i=0;256>i;i++){e=i;for(var n=0;8>n;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}function a(e,t,i,n){var a=r,o=n+i;e=-1^e;for(var s=n;o>s;s++)e=e>>>8^a[255&(e^t[s])];return-1^e}var r=n();t.exports=a},{}],6:[function(e,t,i){\"use strict\";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=\"\",this.comment=\"\",this.hcrc=0,this.done=!1}t.exports=n},{}],7:[function(e,t,i){\"use strict\";var n=30,a=12;t.exports=function(e,t){var i,r,o,s,f,l,d,u,h,c,b,w,m,k,_,g,v,p,x,y,S,E,B,Z,A;i=e.state,r=e.next_in,Z=e.input,o=r+(e.avail_in-5),s=e.next_out,A=e.output,f=s-(t-e.avail_out),l=s+(e.avail_out-257),d=i.dmax,u=i.wsize,h=i.whave,c=i.wnext,b=i.window,w=i.hold,m=i.bits,k=i.lencode,_=i.distcode,g=(1<<i.lenbits)-1,v=(1<<i.distbits)-1;e:do{15>m&&(w+=Z[r++]<<m,m+=8,w+=Z[r++]<<m,m+=8),p=k[w&g];t:for(;;){if(x=p>>>24,w>>>=x,m-=x,x=p>>>16&255,0===x)A[s++]=65535&p;else{if(!(16&x)){if(0===(64&x)){p=k[(65535&p)+(w&(1<<x)-1)];continue t}if(32&x){i.mode=a;break e}e.msg=\"invalid literal/length code\",i.mode=n;break e}y=65535&p,x&=15,x&&(x>m&&(w+=Z[r++]<<m,m+=8),y+=w&(1<<x)-1,w>>>=x,m-=x),15>m&&(w+=Z[r++]<<m,m+=8,w+=Z[r++]<<m,m+=8),p=_[w&v];i:for(;;){if(x=p>>>24,w>>>=x,m-=x,x=p>>>16&255,!(16&x)){if(0===(64&x)){p=_[(65535&p)+(w&(1<<x)-1)];continue i}e.msg=\"invalid distance code\",i.mode=n;break e}if(S=65535&p,x&=15,x>m&&(w+=Z[r++]<<m,m+=8,x>m&&(w+=Z[r++]<<m,m+=8)),S+=w&(1<<x)-1,S>d){e.msg=\"invalid distance too far back\",i.mode=n;break e}if(w>>>=x,m-=x,x=s-f,S>x){if(x=S-x,x>h&&i.sane){e.msg=\"invalid distance too far back\",i.mode=n;break e}if(E=0,B=b,0===c){if(E+=u-x,y>x){y-=x;do A[s++]=b[E++];while(--x);E=s-S,B=A}}else if(x>c){if(E+=u+c-x,x-=c,y>x){y-=x;do A[s++]=b[E++];while(--x);if(E=0,y>c){x=c,y-=x;do A[s++]=b[E++];while(--x);E=s-S,B=A}}}else if(E+=c-x,y>x){y-=x;do A[s++]=b[E++];while(--x);E=s-S,B=A}for(;y>2;)A[s++]=B[E++],A[s++]=B[E++],A[s++]=B[E++],y-=3;y&&(A[s++]=B[E++],y>1&&(A[s++]=B[E++]))}else{E=s-S;do A[s++]=A[E++],A[s++]=A[E++],A[s++]=A[E++],y-=3;while(y>2);y&&(A[s++]=A[E++],y>1&&(A[s++]=A[E++]))}break}}break}}while(o>r&&l>s);y=m>>3,r-=y,m-=y<<3,w&=(1<<m)-1,e.next_in=r,e.next_out=s,e.avail_in=o>r?5+(o-r):5-(r-o),e.avail_out=l>s?257+(l-s):257-(s-l),i.hold=w,i.bits=m}},{}],8:[function(e,t,i){\"use strict\";function n(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function a(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new k.Buf16(320),this.work=new k.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=\"\",t.wrap&&(e.adler=1&t.wrap),t.mode=F,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new k.Buf32(be),t.distcode=t.distdyn=new k.Buf32(we),t.sane=1,t.back=-1,A):R}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,r(e)):R}function s(e,t){var i,n;return e&&e.state?(n=e.state,0>t?(i=0,t=-t):(i=(t>>4)+1,48>t&&(t&=15)),t&&(8>t||t>15)?R:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,o(e))):R}function f(e,t){var i,n;return e?(n=new a,e.state=n,n.window=null,i=s(e,t),i!==A&&(e.state=null),i):R}function l(e){return f(e,ke)}function d(e){if(_e){var t;for(w=new k.Buf32(512),m=new k.Buf32(32),t=0;144>t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(p(y,e.lens,0,288,w,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;p(S,e.lens,0,32,m,0,e.work,{bits:5}),_e=!1}e.lencode=w,e.lenbits=9,e.distcode=m,e.distbits=5}function u(e,t,i,n){var a,r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new k.Buf8(r.wsize)),n>=r.wsize?(k.arraySet(r.window,t,i-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>n&&(a=n),k.arraySet(r.window,t,i-n,a,r.wnext),n-=a,n?(k.arraySet(r.window,t,i-n,n,0),r.wnext=n,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0}function h(e,t){var i,a,r,o,s,f,l,h,c,b,w,m,be,we,me,ke,_e,ge,ve,pe,xe,ye,Se,Ee,Be=0,Ze=new k.Buf8(4),Ae=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return R;i=e.state,i.mode===G&&(i.mode=X),s=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,a=e.input,f=e.avail_in,h=i.hold,c=i.bits,b=f,w=l,ye=A;e:for(;;)switch(i.mode){case F:if(0===i.wrap){i.mode=X;break}for(;16>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(2&i.wrap&&35615===h){i.check=0,Ze[0]=255&h,Ze[1]=h>>>8&255,i.check=g(i.check,Ze,2,0),h=0,c=0,i.mode=U;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg=\"incorrect header check\",i.mode=ue;break}if((15&h)!==T){e.msg=\"unknown compression method\",i.mode=ue;break}if(h>>>=4,c-=4,xe=(15&h)+8,0===i.wbits)i.wbits=xe;else if(xe>i.wbits){e.msg=\"invalid window size\",i.mode=ue;break}i.dmax=1<<xe,e.adler=i.check=1,i.mode=512&h?Y:G,h=0,c=0;break;case U:for(;16>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(i.flags=h,(255&i.flags)!==T){e.msg=\"unknown compression method\",i.mode=ue;break}if(57344&i.flags){e.msg=\"unknown header flags set\",i.mode=ue;break}i.head&&(i.head.text=h>>8&1),512&i.flags&&(Ze[0]=255&h,Ze[1]=h>>>8&255,i.check=g(i.check,Ze,2,0)),h=0,c=0,i.mode=D;case D:for(;32>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}i.head&&(i.head.time=h),512&i.flags&&(Ze[0]=255&h,Ze[1]=h>>>8&255,Ze[2]=h>>>16&255,Ze[3]=h>>>24&255,i.check=g(i.check,Ze,4,0)),h=0,c=0,i.mode=L;case L:for(;16>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}i.head&&(i.head.xflags=255&h,i.head.os=h>>8),512&i.flags&&(Ze[0]=255&h,Ze[1]=h>>>8&255,i.check=g(i.check,Ze,2,0)),h=0,c=0,i.mode=H;case H:if(1024&i.flags){for(;16>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}i.length=h,i.head&&(i.head.extra_len=h),512&i.flags&&(Ze[0]=255&h,Ze[1]=h>>>8&255,i.check=g(i.check,Ze,2,0)),h=0,c=0}else i.head&&(i.head.extra=null);i.mode=j;case j:if(1024&i.flags&&(m=i.length,m>f&&(m=f),m&&(i.head&&(xe=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),k.arraySet(i.head.extra,a,o,m,xe)),512&i.flags&&(i.check=g(i.check,a,m,o)),f-=m,o+=m,i.length-=m),i.length))break e;i.length=0,i.mode=M;case M:if(2048&i.flags){if(0===f)break e;m=0;do xe=a[o+m++],i.head&&xe&&i.length<65536&&(i.head.name+=String.fromCharCode(xe));while(xe&&f>m);if(512&i.flags&&(i.check=g(i.check,a,m,o)),f-=m,o+=m,xe)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=K;case K:if(4096&i.flags){if(0===f)break e;m=0;do xe=a[o+m++],i.head&&xe&&i.length<65536&&(i.head.comment+=String.fromCharCode(xe));while(xe&&f>m);if(512&i.flags&&(i.check=g(i.check,a,m,o)),f-=m,o+=m,xe)break e}else i.head&&(i.head.comment=null);i.mode=P;case P:if(512&i.flags){for(;16>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(h!==(65535&i.check)){e.msg=\"header crc mismatch\",i.mode=ue;break}h=0,c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=G;break;case Y:for(;32>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}e.adler=i.check=n(h),h=0,c=0,i.mode=q;case q:if(0===i.havedict)return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=f,i.hold=h,i.bits=c,N;e.adler=i.check=1,i.mode=G;case G:if(t===B||t===Z)break e;case X:if(i.last){h>>>=7&c,c-=7&c,i.mode=fe;break}for(;3>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}switch(i.last=1&h,h>>>=1,c-=1,3&h){case 0:i.mode=W;break;case 1:if(d(i),i.mode=te,t===Z){h>>>=2,c-=2;break e}break;case 2:i.mode=V;break;case 3:e.msg=\"invalid block type\",i.mode=ue}h>>>=2,c-=2;break;case W:for(h>>>=7&c,c-=7&c;32>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if((65535&h)!==(h>>>16^65535)){e.msg=\"invalid stored block lengths\",i.mode=ue;break}if(i.length=65535&h,h=0,c=0,i.mode=J,t===Z)break e;case J:i.mode=Q;case Q:if(m=i.length){if(m>f&&(m=f),m>l&&(m=l),0===m)break e;k.arraySet(r,a,o,m,s),f-=m,o+=m,l-=m,s+=m,i.length-=m;break}i.mode=G;break;case V:for(;14>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(i.nlen=(31&h)+257,h>>>=5,c-=5,i.ndist=(31&h)+1,h>>>=5,c-=5,i.ncode=(15&h)+4,h>>>=4,c-=4,i.nlen>286||i.ndist>30){e.msg=\"too many length or distance symbols\",i.mode=ue;break}i.have=0,i.mode=$;case $:for(;i.have<i.ncode;){for(;3>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}i.lens[Ae[i.have++]]=7&h,h>>>=3,c-=3}for(;i.have<19;)i.lens[Ae[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Se={bits:i.lenbits},ye=p(x,i.lens,0,19,i.lencode,0,i.work,Se),i.lenbits=Se.bits,ye){e.msg=\"invalid code lengths set\",i.mode=ue;break}i.have=0,i.mode=ee;case ee:for(;i.have<i.nlen+i.ndist;){for(;Be=i.lencode[h&(1<<i.lenbits)-1],me=Be>>>24,ke=Be>>>16&255,_e=65535&Be,!(c>=me);){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(16>_e)h>>>=me,c-=me,i.lens[i.have++]=_e;else{if(16===_e){for(Ee=me+2;Ee>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(h>>>=me,c-=me,0===i.have){e.msg=\"invalid bit length repeat\",i.mode=ue;break}xe=i.lens[i.have-1],m=3+(3&h),h>>>=2,c-=2}else if(17===_e){for(Ee=me+3;Ee>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}h>>>=me,c-=me,xe=0,m=3+(7&h),h>>>=3,c-=3}else{for(Ee=me+7;Ee>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}h>>>=me,c-=me,xe=0,m=11+(127&h),h>>>=7,c-=7}if(i.have+m>i.nlen+i.ndist){e.msg=\"invalid bit length repeat\",i.mode=ue;break}for(;m--;)i.lens[i.have++]=xe}}if(i.mode===ue)break;if(0===i.lens[256]){e.msg=\"invalid code -- missing end-of-block\",i.mode=ue;break}if(i.lenbits=9,Se={bits:i.lenbits},ye=p(y,i.lens,0,i.nlen,i.lencode,0,i.work,Se),i.lenbits=Se.bits,ye){e.msg=\"invalid literal/lengths set\",i.mode=ue;break}if(i.distbits=6,i.distcode=i.distdyn,Se={bits:i.distbits},ye=p(S,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Se),i.distbits=Se.bits,ye){e.msg=\"invalid distances set\",i.mode=ue;break}if(i.mode=te,t===Z)break e;case te:i.mode=ie;case ie:if(f>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=f,i.hold=h,i.bits=c,v(e,w),s=e.next_out,r=e.output,l=e.avail_out,o=e.next_in,a=e.input,f=e.avail_in,h=i.hold,c=i.bits,i.mode===G&&(i.back=-1);break}for(i.back=0;Be=i.lencode[h&(1<<i.lenbits)-1],me=Be>>>24,ke=Be>>>16&255,_e=65535&Be,!(c>=me);){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(ke&&0===(240&ke)){for(ge=me,ve=ke,pe=_e;Be=i.lencode[pe+((h&(1<<ge+ve)-1)>>ge)],me=Be>>>24,ke=Be>>>16&255,_e=65535&Be,!(c>=ge+me);){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}h>>>=ge,c-=ge,i.back+=ge}if(h>>>=me,c-=me,i.back+=me,i.length=_e,0===ke){i.mode=se;break}if(32&ke){i.back=-1,i.mode=G;break}if(64&ke){e.msg=\"invalid literal/length code\",i.mode=ue;break}i.extra=15&ke,i.mode=ne;case ne:if(i.extra){for(Ee=i.extra;Ee>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}i.length+=h&(1<<i.extra)-1,h>>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=ae;case ae:for(;Be=i.distcode[h&(1<<i.distbits)-1],me=Be>>>24,ke=Be>>>16&255,_e=65535&Be,!(c>=me);){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(0===(240&ke)){for(ge=me,ve=ke,pe=_e;Be=i.distcode[pe+((h&(1<<ge+ve)-1)>>ge)],me=Be>>>24,ke=Be>>>16&255,_e=65535&Be,!(c>=ge+me);){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}h>>>=ge,c-=ge,i.back+=ge}if(h>>>=me,c-=me,i.back+=me,64&ke){e.msg=\"invalid distance code\",i.mode=ue;break}i.offset=_e,i.extra=15&ke,i.mode=re;case re:if(i.extra){for(Ee=i.extra;Ee>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}i.offset+=h&(1<<i.extra)-1,h>>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg=\"invalid distance too far back\",i.mode=ue;break}i.mode=oe;case oe:if(0===l)break e;if(m=w-l,i.offset>m){if(m=i.offset-m,m>i.whave&&i.sane){e.msg=\"invalid distance too far back\",i.mode=ue;break}m>i.wnext?(m-=i.wnext,be=i.wsize-m):be=i.wnext-m,m>i.length&&(m=i.length),we=i.window}else we=r,be=s-i.offset,m=i.length;m>l&&(m=l),l-=m,i.length-=m;do r[s++]=we[be++];while(--m);0===i.length&&(i.mode=ie);break;case se:if(0===l)break e;r[s++]=i.length,l--,i.mode=ie;break;case fe:if(i.wrap){for(;32>c;){if(0===f)break e;f--,h|=a[o++]<<c,c+=8}if(w-=l,e.total_out+=w,i.total+=w,w&&(e.adler=i.check=i.flags?g(i.check,r,w,s-w):_(i.check,r,w,s-w)),w=l,(i.flags?h:n(h))!==i.check){e.msg=\"incorrect data check\",i.mode=ue;break}h=0,c=0}i.mode=le;case le:if(i.wrap&&i.flags){for(;32>c;){if(0===f)break e;f--,h+=a[o++]<<c,c+=8}if(h!==(4294967295&i.total)){e.msg=\"incorrect length check\",i.mode=ue;break}h=0,c=0}i.mode=de;case de:ye=z;break e;case ue:ye=C;break e;case he:return O;case ce:default:return R}return e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=f,i.hold=h,i.bits=c,(i.wsize||w!==e.avail_out&&i.mode<ue&&(i.mode<fe||t!==E))&&u(e,e.output,e.next_out,w-e.avail_out)?(i.mode=he,O):(b-=e.avail_in,w-=e.avail_out,e.total_in+=b,e.total_out+=w,i.total+=w,i.wrap&&w&&(e.adler=i.check=i.flags?g(i.check,r,w,e.next_out-w):_(i.check,r,w,e.next_out-w)),e.data_type=i.bits+(i.last?64:0)+(i.mode===G?128:0)+(i.mode===te||i.mode===J?256:0),(0===b&&0===w||t===E)&&ye===A&&(ye=I),ye)}function c(e){if(!e||!e.state)return R;var t=e.state;return t.window&&(t.window=null),e.state=null,A}function b(e,t){var i;return e&&e.state?(i=e.state,0===(2&i.wrap)?R:(i.head=t,t.done=!1,A)):R}var w,m,k=e(\"../utils/common\"),_=e(\"./adler32\"),g=e(\"./crc32\"),v=e(\"./inffast\"),p=e(\"./inftrees\"),x=0,y=1,S=2,E=4,B=5,Z=6,A=0,z=1,N=2,R=-2,C=-3,O=-4,I=-5,T=8,F=1,U=2,D=3,L=4,H=5,j=6,M=7,K=8,P=9,Y=10,q=11,G=12,X=13,W=14,J=15,Q=16,V=17,$=18,ee=19,te=20,ie=21,ne=22,ae=23,re=24,oe=25,se=26,fe=27,le=28,de=29,ue=30,he=31,ce=32,be=852,we=592,me=15,ke=me,_e=!0;i.inflateReset=o,i.inflateReset2=s,i.inflateResetKeep=r,i.inflateInit=l,i.inflateInit2=f,i.inflate=h,i.inflateEnd=c,i.inflateGetHeader=b,i.inflateInfo=\"pako inflate (from Nodeca project)\"},{\"../utils/common\":1,\"./adler32\":3,\"./crc32\":5,\"./inffast\":7,\"./inftrees\":9}],9:[function(e,t,i){\"use strict\";var n=e(\"../utils/common\"),a=15,r=852,o=592,s=0,f=1,l=2,d=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],u=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,i,b,w,m,k,_){var g,v,p,x,y,S,E,B,Z,A=_.bits,z=0,N=0,R=0,C=0,O=0,I=0,T=0,F=0,U=0,D=0,L=null,H=0,j=new n.Buf16(a+1),M=new n.Buf16(a+1),K=null,P=0;for(z=0;a>=z;z++)j[z]=0;for(N=0;b>N;N++)j[t[i+N]]++;for(O=A,C=a;C>=1&&0===j[C];C--);if(O>C&&(O=C),0===C)return w[m++]=20971520,w[m++]=20971520,_.bits=1,0;for(R=1;C>R&&0===j[R];R++);for(R>O&&(O=R),F=1,z=1;a>=z;z++)if(F<<=1,F-=j[z],0>F)return-1;if(F>0&&(e===s||1!==C))return-1;for(M[1]=0,z=1;a>z;z++)M[z+1]=M[z]+j[z];for(N=0;b>N;N++)0!==t[i+N]&&(k[M[t[i+N]]++]=N);if(e===s?(L=K=k,S=19):e===f?(L=d,H-=257,K=u,P-=257,S=256):(L=h,K=c,S=-1),D=0,N=0,z=R,y=m,I=O,T=0,p=-1,U=1<<O,x=U-1,e===f&&U>r||e===l&&U>o)return 1;for(var Y=0;;){Y++,E=z-T,k[N]<S?(B=0,Z=k[N]):k[N]>S?(B=K[P+k[N]],Z=L[H+k[N]]):(B=96,Z=0),g=1<<z-T,v=1<<I,R=v;do v-=g,w[y+(D>>T)+v]=E<<24|B<<16|Z|0;while(0!==v);for(g=1<<z-1;D&g;)g>>=1;if(0!==g?(D&=g-1,D+=g):D=0,N++,0===--j[z]){if(z===C)break;z=t[i+k[N]]}if(z>O&&(D&x)!==p){for(0===T&&(T=O),y+=R,I=z-T,F=1<<I;C>I+T&&(F-=j[I+T],!(0>=F));)I++,F<<=1;if(U+=1<<I,e===f&&U>r||e===l&&U>o)return 1;p=D&x,w[p]=O<<24|I<<16|y-m|0}}return 0!==D&&(w[y+D]=z-T<<24|64<<16|0),_.bits=O,0}},{\"../utils/common\":1}],10:[function(e,t,i){\"use strict\";t.exports={2:\"need dictionary\",1:\"stream end\",0:\"\",\"-1\":\"file error\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-4\":\"insufficient memory\",\"-5\":\"buffer error\",\"-6\":\"incompatible version\"}},{}],11:[function(e,t,i){\"use strict\";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0}t.exports=n},{}],\"/lib/inflate.js\":[function(e,t,i){\"use strict\";function n(e,t){var i=new c(t);if(i.push(e,!0),i.err)throw i.msg;return i.result}function a(e,t){return t=t||{},t.raw=!0,n(e,t)}var r=e(\"./zlib/inflate.js\"),o=e(\"./utils/common\"),s=e(\"./utils/strings\"),f=e(\"./zlib/constants\"),l=e(\"./zlib/messages\"),d=e(\"./zlib/zstream\"),u=e(\"./zlib/gzheader\"),h=Object.prototype.toString,c=function(e){this.options=o.assign({chunkSize:16384,windowBits:0,to:\"\"},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg=\"\",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var i=r.inflateInit2(this.strm,t.windowBits);if(i!==f.Z_OK)throw new Error(l[i]);this.header=new u,r.inflateGetHeader(this.strm,this.header)};c.prototype.push=function(e,t){var i,n,a,l,d,u=this.strm,c=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:t===!0?f.Z_FINISH:f.Z_NO_FLUSH,\"string\"==typeof e?u.input=s.binstring2buf(e):\"[object ArrayBuffer]\"===h.call(e)?u.input=new Uint8Array(e):u.input=e,u.next_in=0,u.avail_in=u.input.length;do{if(0===u.avail_out&&(u.output=new o.Buf8(c),u.next_out=0,u.avail_out=c),i=r.inflate(u,f.Z_NO_FLUSH),i!==f.Z_STREAM_END&&i!==f.Z_OK)return this.onEnd(i),this.ended=!0,!1;u.next_out&&(0===u.avail_out||i===f.Z_STREAM_END||0===u.avail_in&&(n===f.Z_FINISH||n===f.Z_SYNC_FLUSH))&&(\"string\"===this.options.to?(a=s.utf8border(u.output,u.next_out),l=u.next_out-a,d=s.buf2string(u.output,a),u.next_out=l,u.avail_out=c-l,l&&o.arraySet(u.output,u.output,a,l,0),this.onData(d)):this.onData(o.shrinkBuf(u.output,u.next_out)))}while(u.avail_in>0&&i!==f.Z_STREAM_END);return i===f.Z_STREAM_END&&(n=f.Z_FINISH),n===f.Z_FINISH?(i=r.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===f.Z_OK):n===f.Z_SYNC_FLUSH?(this.onEnd(f.Z_OK),u.avail_out=0,!0):!0},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===f.Z_OK&&(\"string\"===this.options.to?this.result=this.chunks.join(\"\"):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=c,i.inflate=n,i.inflateRaw=a,i.ungzip=n},{\"./utils/common\":1,\"./utils/strings\":2,\"./zlib/constants\":4,\"./zlib/gzheader\":6,\"./zlib/inflate.js\":8,\"./zlib/messages\":10,\"./zlib/zstream\":11}]},{},[])(\"/lib/inflate.js\")});\n"
  },
  {
    "path": "z-worker.js",
    "content": "/* jshint worker:true */\n(function main(global) {\n\t\"use strict\";\n\n\tif (global.zWorkerInitialized)\n\t\tthrow new Error('z-worker.js should be run only once');\n\tglobal.zWorkerInitialized = true;\n\n\taddEventListener(\"message\", function(event) {\n\t\tvar message = event.data, type = message.type, sn = message.sn;\n\t\tvar handler = handlers[type];\n\t\tif (handler) {\n\t\t\ttry {\n\t\t\t\thandler(message);\n\t\t\t} catch (e) {\n\t\t\t\tonError(type, sn, e);\n\t\t\t}\n\t\t}\n\t\t//for debug\n\t\t//postMessage({type: 'echo', originalType: type, sn: sn});\n\t});\n\n\tvar handlers = {\n\t\timportScripts: doImportScripts,\n\t\tnewTask: newTask,\n\t\tappend: processData,\n\t\tflush: processData,\n\t};\n\n\t// deflater/inflater tasks indexed by serial numbers\n\tvar tasks = {};\n\n\tfunction doImportScripts(msg) {\n\t\tif (msg.scripts && msg.scripts.length > 0)\n\t\t\timportScripts.apply(undefined, msg.scripts);\n\t\tpostMessage({type: 'importScripts'});\n\t}\n\n\tfunction newTask(msg) {\n\t\tvar CodecClass = global[msg.codecClass];\n\t\tvar sn = msg.sn;\n\t\tif (tasks[sn])\n\t\t\tthrow Error('duplicated sn');\n\t\ttasks[sn] =  {\n\t\t\tcodec: new CodecClass(msg.options),\n\t\t\tcrcInput: msg.crcType === 'input',\n\t\t\tcrcOutput: msg.crcType === 'output',\n\t\t\tcrc: new Crc32(),\n\t\t};\n\t\tpostMessage({type: 'newTask', sn: sn});\n\t}\n\n\t// performance may not be supported\n\tvar now = global.performance ? global.performance.now.bind(global.performance) : Date.now;\n\n\tfunction processData(msg) {\n\t\tvar sn = msg.sn, type = msg.type, input = msg.data;\n\t\tvar task = tasks[sn];\n\t\t// allow creating codec on first append\n\t\tif (!task && msg.codecClass) {\n\t\t\tnewTask(msg);\n\t\t\ttask = tasks[sn];\n\t\t}\n\t\tvar isAppend = type === 'append';\n\t\tvar start = now();\n\t\tvar output;\n\t\tif (isAppend) {\n\t\t\ttry {\n\t\t\t\toutput = task.codec.append(input, function onprogress(loaded) {\n\t\t\t\t\tpostMessage({type: 'progress', sn: sn, loaded: loaded});\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\tdelete tasks[sn];\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t} else {\n\t\t\tdelete tasks[sn];\n\t\t\toutput = task.codec.flush();\n\t\t}\n\t\tvar codecTime = now() - start;\n\n\t\tstart = now();\n\t\tif (input && task.crcInput)\n\t\t\ttask.crc.append(input);\n\t\tif (output && task.crcOutput)\n\t\t\ttask.crc.append(output);\n\t\tvar crcTime = now() - start;\n\n\t\tvar rmsg = {type: type, sn: sn, codecTime: codecTime, crcTime: crcTime};\n\t\tvar transferables = [];\n\t\tif (output) {\n\t\t\trmsg.data = output;\n\t\t\ttransferables.push(output.buffer);\n\t\t}\n\t\tif (!isAppend && (task.crcInput || task.crcOutput))\n\t\t\trmsg.crc = task.crc.get();\n\t\t\n\t\t// posting a message with transferables will fail on IE10\n\t\ttry {\n\t\t\tpostMessage(rmsg, transferables);\n\t\t} catch(ex) {\n\t\t\tpostMessage(rmsg); // retry without transferables\n\t\t}\n\t}\n\n\tfunction onError(type, sn, e) {\n\t\tvar msg = {\n\t\t\ttype: type,\n\t\t\tsn: sn,\n\t\t\terror: formatError(e)\n\t\t};\n\t\tpostMessage(msg);\n\t}\n\n\tfunction formatError(e) {\n\t\treturn { message: e.message, stack: e.stack };\n\t}\n\n\t// Crc32 code copied from file zip.js\n\tfunction Crc32() {\n\t\tthis.crc = -1;\n\t}\n\tCrc32.prototype.append = function append(data) {\n\t\tvar crc = this.crc | 0, table = this.table;\n\t\tfor (var offset = 0, len = data.length | 0; offset < len; offset++)\n\t\t\tcrc = (crc >>> 8) ^ table[(crc ^ data[offset]) & 0xFF];\n\t\tthis.crc = crc;\n\t};\n\tCrc32.prototype.get = function get() {\n\t\treturn ~this.crc;\n\t};\n\tCrc32.prototype.table = (function() {\n\t\tvar i, j, t, table = []; // Uint32Array is actually slower than []\n\t\tfor (i = 0; i < 256; i++) {\n\t\t\tt = i;\n\t\t\tfor (j = 0; j < 8; j++)\n\t\t\t\tif (t & 1)\n\t\t\t\t\tt = (t >>> 1) ^ 0xEDB88320;\n\t\t\t\telse\n\t\t\t\t\tt = t >>> 1;\n\t\t\ttable[i] = t;\n\t\t}\n\t\treturn table;\n\t})();\n\n\t// \"no-op\" codec\n\tfunction NOOP() {}\n\tglobal.NOOP = NOOP;\n\tNOOP.prototype.append = function append(bytes, onprogress) {\n\t\treturn bytes;\n\t};\n\tNOOP.prototype.flush = function flush() {};\n})(this);\n"
  },
  {
    "path": "zip.js",
    "content": "/*\n Copyright (c) 2013 Gildas Lormeau. All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the distribution.\n\n 3. The names of the authors may not be used to endorse or promote products\n derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,\n INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,\n INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,\n INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n(function(obj) {\n\t\"use strict\";\n\n\tvar ERR_BAD_FORMAT = \"File format is not recognized.\";\n\tvar ERR_CRC = \"CRC failed.\";\n\tvar ERR_ENCRYPTED = \"File contains encrypted entry.\";\n\tvar ERR_ZIP64 = \"File is using Zip64 (4gb+ file size).\";\n\tvar ERR_READ = \"Error while reading zip file.\";\n\tvar ERR_WRITE = \"Error while writing zip file.\";\n\tvar ERR_WRITE_DATA = \"Error while writing file data.\";\n\tvar ERR_READ_DATA = \"Error while reading file data.\";\n\tvar ERR_DUPLICATED_NAME = \"File already exists.\";\n\tvar CHUNK_SIZE = 512 * 1024;\n\t\n\tvar TEXT_PLAIN = \"text/plain\";\n\n\tvar appendABViewSupported;\n\ttry {\n\t\tappendABViewSupported = new Blob([ new DataView(new ArrayBuffer(0)) ]).size === 0;\n\t} catch (e) {\n\t}\n\n\tfunction Crc32() {\n\t\tthis.crc = -1;\n\t}\n\tCrc32.prototype.append = function append(data) {\n\t\tvar crc = this.crc | 0, table = this.table;\n\t\tfor (var offset = 0, len = data.length | 0; offset < len; offset++)\n\t\t\tcrc = (crc >>> 8) ^ table[(crc ^ data[offset]) & 0xFF];\n\t\tthis.crc = crc;\n\t};\n\tCrc32.prototype.get = function get() {\n\t\treturn ~this.crc;\n\t};\n\tCrc32.prototype.table = (function() {\n\t\tvar i, j, t, table = []; // Uint32Array is actually slower than []\n\t\tfor (i = 0; i < 256; i++) {\n\t\t\tt = i;\n\t\t\tfor (j = 0; j < 8; j++)\n\t\t\t\tif (t & 1)\n\t\t\t\t\tt = (t >>> 1) ^ 0xEDB88320;\n\t\t\t\telse\n\t\t\t\t\tt = t >>> 1;\n\t\t\ttable[i] = t;\n\t\t}\n\t\treturn table;\n\t})();\n\t\n\t// \"no-op\" codec\n\tfunction NOOP() {}\n\tNOOP.prototype.append = function append(bytes, onprogress) {\n\t\treturn bytes;\n\t};\n\tNOOP.prototype.flush = function flush() {};\n\n\tfunction blobSlice(blob, index, length) {\n\t\tif (index < 0 || length < 0 || index + length > blob.size)\n\t\t\tthrow new RangeError('offset:' + index + ', length:' + length + ', size:' + blob.size);\n\t\tif (blob.slice)\n\t\t\treturn blob.slice(index, index + length);\n\t\telse if (blob.webkitSlice)\n\t\t\treturn blob.webkitSlice(index, index + length);\n\t\telse if (blob.mozSlice)\n\t\t\treturn blob.mozSlice(index, index + length);\n\t\telse if (blob.msSlice)\n\t\t\treturn blob.msSlice(index, index + length);\n\t}\n\n\tfunction getDataHelper(byteLength, bytes) {\n\t\tvar dataBuffer, dataArray;\n\t\tdataBuffer = new ArrayBuffer(byteLength);\n\t\tdataArray = new Uint8Array(dataBuffer);\n\t\tif (bytes)\n\t\t\tdataArray.set(bytes, 0);\n\t\treturn {\n\t\t\tbuffer : dataBuffer,\n\t\t\tarray : dataArray,\n\t\t\tview : new DataView(dataBuffer)\n\t\t};\n\t}\n\n\t// Readers\n\tfunction Reader() {\n\t}\n\n\tfunction TextReader(text) {\n\t\tvar that = this, blobReader;\n\n\t\tfunction init(callback, onerror) {\n\t\t\tvar blob = new Blob([ text ], {\n\t\t\t\ttype : TEXT_PLAIN\n\t\t\t});\n\t\t\tblobReader = new BlobReader(blob);\n\t\t\tblobReader.init(function() {\n\t\t\t\tthat.size = blobReader.size;\n\t\t\t\tcallback();\n\t\t\t}, onerror);\n\t\t}\n\n\t\tfunction readUint8Array(index, length, callback, onerror) {\n\t\t\tblobReader.readUint8Array(index, length, callback, onerror);\n\t\t}\n\n\t\tthat.size = 0;\n\t\tthat.init = init;\n\t\tthat.readUint8Array = readUint8Array;\n\t}\n\tTextReader.prototype = new Reader();\n\tTextReader.prototype.constructor = TextReader;\n\n\tfunction Data64URIReader(dataURI) {\n\t\tvar that = this, dataStart;\n\n\t\tfunction init(callback) {\n\t\t\tvar dataEnd = dataURI.length;\n\t\t\twhile (dataURI.charAt(dataEnd - 1) == \"=\")\n\t\t\t\tdataEnd--;\n\t\t\tdataStart = dataURI.indexOf(\",\") + 1;\n\t\t\tthat.size = Math.floor((dataEnd - dataStart) * 0.75);\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction readUint8Array(index, length, callback) {\n\t\t\tvar i, data = getDataHelper(length);\n\t\t\tvar start = Math.floor(index / 3) * 4;\n\t\t\tvar end = Math.ceil((index + length) / 3) * 4;\n\t\t\tvar bytes = obj.atob(dataURI.substring(start + dataStart, end + dataStart));\n\t\t\tvar delta = index - Math.floor(start / 4) * 3;\n\t\t\tfor (i = delta; i < delta + length; i++)\n\t\t\t\tdata.array[i - delta] = bytes.charCodeAt(i);\n\t\t\tcallback(data.array);\n\t\t}\n\n\t\tthat.size = 0;\n\t\tthat.init = init;\n\t\tthat.readUint8Array = readUint8Array;\n\t}\n\tData64URIReader.prototype = new Reader();\n\tData64URIReader.prototype.constructor = Data64URIReader;\n\n\tfunction BlobReader(blob) {\n\t\tvar that = this;\n\n\t\tfunction init(callback) {\n\t\t\tthat.size = blob.size;\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction readUint8Array(index, length, callback, onerror) {\n\t\t\tvar reader = new FileReader();\n\t\t\treader.onload = function(e) {\n\t\t\t\tcallback(new Uint8Array(e.target.result));\n\t\t\t};\n\t\t\treader.onerror = onerror;\n\t\t\ttry {\n\t\t\t\treader.readAsArrayBuffer(blobSlice(blob, index, length));\n\t\t\t} catch (e) {\n\t\t\t\tonerror(e);\n\t\t\t}\n\t\t}\n\n\t\tthat.size = 0;\n\t\tthat.init = init;\n\t\tthat.readUint8Array = readUint8Array;\n\t}\n\tBlobReader.prototype = new Reader();\n\tBlobReader.prototype.constructor = BlobReader;\n\n\t// Writers\n\n\tfunction Writer() {\n\t}\n\tWriter.prototype.getData = function(callback) {\n\t\tcallback(this.data);\n\t};\n\n\tfunction TextWriter(encoding) {\n\t\tvar that = this, blob;\n\n\t\tfunction init(callback) {\n\t\t\tblob = new Blob([], {\n\t\t\t\ttype : TEXT_PLAIN\n\t\t\t});\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction writeUint8Array(array, callback) {\n\t\t\tblob = new Blob([ blob, appendABViewSupported ? array : array.buffer ], {\n\t\t\t\ttype : TEXT_PLAIN\n\t\t\t});\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction getData(callback, onerror) {\n\t\t\tvar reader = new FileReader();\n\t\t\treader.onload = function(e) {\n\t\t\t\tcallback(e.target.result);\n\t\t\t};\n\t\t\treader.onerror = onerror;\n\t\t\treader.readAsText(blob, encoding);\n\t\t}\n\n\t\tthat.init = init;\n\t\tthat.writeUint8Array = writeUint8Array;\n\t\tthat.getData = getData;\n\t}\n\tTextWriter.prototype = new Writer();\n\tTextWriter.prototype.constructor = TextWriter;\n\n\tfunction Data64URIWriter(contentType) {\n\t\tvar that = this, data = \"\", pending = \"\";\n\n\t\tfunction init(callback) {\n\t\t\tdata += \"data:\" + (contentType || \"\") + \";base64,\";\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction writeUint8Array(array, callback) {\n\t\t\tvar i, delta = pending.length, dataString = pending;\n\t\t\tpending = \"\";\n\t\t\tfor (i = 0; i < (Math.floor((delta + array.length) / 3) * 3) - delta; i++)\n\t\t\t\tdataString += String.fromCharCode(array[i]);\n\t\t\tfor (; i < array.length; i++)\n\t\t\t\tpending += String.fromCharCode(array[i]);\n\t\t\tif (dataString.length > 2)\n\t\t\t\tdata += obj.btoa(dataString);\n\t\t\telse\n\t\t\t\tpending = dataString;\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction getData(callback) {\n\t\t\tcallback(data + obj.btoa(pending));\n\t\t}\n\n\t\tthat.init = init;\n\t\tthat.writeUint8Array = writeUint8Array;\n\t\tthat.getData = getData;\n\t}\n\tData64URIWriter.prototype = new Writer();\n\tData64URIWriter.prototype.constructor = Data64URIWriter;\n\n\tfunction BlobWriter(contentType) {\n\t\tvar blob, that = this;\n\n\t\tfunction init(callback) {\n\t\t\tblob = new Blob([], {\n\t\t\t\ttype : contentType\n\t\t\t});\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction writeUint8Array(array, callback) {\n\t\t\tblob = new Blob([ blob, appendABViewSupported ? array : array.buffer ], {\n\t\t\t\ttype : contentType\n\t\t\t});\n\t\t\tcallback();\n\t\t}\n\n\t\tfunction getData(callback) {\n\t\t\tcallback(blob);\n\t\t}\n\n\t\tthat.init = init;\n\t\tthat.writeUint8Array = writeUint8Array;\n\t\tthat.getData = getData;\n\t}\n\tBlobWriter.prototype = new Writer();\n\tBlobWriter.prototype.constructor = BlobWriter;\n\n\t/** \n\t * inflate/deflate core functions\n\t * @param worker {Worker} web worker for the task.\n\t * @param initialMessage {Object} initial message to be sent to the worker. should contain\n\t *   sn(serial number for distinguishing multiple tasks sent to the worker), and codecClass.\n\t *   This function may add more properties before sending.\n\t */\n\tfunction launchWorkerProcess(worker, initialMessage, reader, writer, offset, size, onprogress, onend, onreaderror, onwriteerror) {\n\t\tvar chunkIndex = 0, index, outputSize, sn = initialMessage.sn, crc;\n\n\t\tfunction onflush() {\n\t\t\tworker.removeEventListener('message', onmessage, false);\n\t\t\tonend(outputSize, crc);\n\t\t}\n\n\t\tfunction onmessage(event) {\n\t\t\tvar message = event.data, data = message.data, err = message.error;\n\t\t\tif (err) {\n\t\t\t\terr.toString = function () { return 'Error: ' + this.message; };\n\t\t\t\tonreaderror(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (message.sn !== sn)\n\t\t\t\treturn;\n\t\t\tif (typeof message.codecTime === 'number')\n\t\t\t\tworker.codecTime += message.codecTime; // should be before onflush()\n\t\t\tif (typeof message.crcTime === 'number')\n\t\t\t\tworker.crcTime += message.crcTime;\n\n\t\t\tswitch (message.type) {\n\t\t\t\tcase 'append':\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\toutputSize += data.length;\n\t\t\t\t\t\twriter.writeUint8Array(data, function() {\n\t\t\t\t\t\t\tstep();\n\t\t\t\t\t\t}, onwriteerror);\n\t\t\t\t\t} else\n\t\t\t\t\t\tstep();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'flush':\n\t\t\t\t\tcrc = message.crc;\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\toutputSize += data.length;\n\t\t\t\t\t\twriter.writeUint8Array(data, function() {\n\t\t\t\t\t\t\tonflush();\n\t\t\t\t\t\t}, onwriteerror);\n\t\t\t\t\t} else\n\t\t\t\t\t\tonflush();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'progress':\n\t\t\t\t\tif (onprogress)\n\t\t\t\t\t\tonprogress(index + message.loaded, size);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'importScripts': //no need to handle here\n\t\t\t\tcase 'newTask':\n\t\t\t\tcase 'echo':\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.warn('zip.js:launchWorkerProcess: unknown message: ', message);\n\t\t\t}\n\t\t}\n\n\t\tfunction step() {\n\t\t\tindex = chunkIndex * CHUNK_SIZE;\n\t\t\tif (index < size) {\n\t\t\t\treader.readUint8Array(offset + index, Math.min(CHUNK_SIZE, size - index), function(array) {\n\t\t\t\t\tif (onprogress)\n\t\t\t\t\t\tonprogress(index, size);\n\t\t\t\t\tvar msg = index === 0 ? initialMessage : {sn : sn};\n\t\t\t\t\tmsg.type = 'append';\n\t\t\t\t\tmsg.data = array;\n\t\t\t\t\t\n\t\t\t\t\t// posting a message with transferables will fail on IE10\n\t\t\t\t\ttry {\n\t\t\t\t\t\tworker.postMessage(msg, [array.buffer]);\n\t\t\t\t\t} catch(ex) {\n\t\t\t\t\t\tworker.postMessage(msg); // retry without transferables\n\t\t\t\t\t}\n\t\t\t\t\tchunkIndex++;\n\t\t\t\t}, onreaderror);\n\t\t\t} else {\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tsn: sn,\n\t\t\t\t\ttype: 'flush'\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\toutputSize = 0;\n\t\tworker.addEventListener('message', onmessage, false);\n\t\tstep();\n\t}\n\n\tfunction launchProcess(process, reader, writer, offset, size, crcType, onprogress, onend, onreaderror, onwriteerror) {\n\t\tvar chunkIndex = 0, index, outputSize = 0,\n\t\t\tcrcInput = crcType === 'input',\n\t\t\tcrcOutput = crcType === 'output',\n\t\t\tcrc = new Crc32();\n\t\tfunction step() {\n\t\t\tvar outputData;\n\t\t\tindex = chunkIndex * CHUNK_SIZE;\n\t\t\tif (index < size)\n\t\t\t\treader.readUint8Array(offset + index, Math.min(CHUNK_SIZE, size - index), function(inputData) {\n\t\t\t\t\tvar outputData;\n\t\t\t\t\ttry {\n\t\t\t\t\t\toutputData = process.append(inputData, function(loaded) {\n\t\t\t\t\t\t\tif (onprogress)\n\t\t\t\t\t\t\t\tonprogress(index + loaded, size);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tonreaderror(e);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (outputData) {\n\t\t\t\t\t\toutputSize += outputData.length;\n\t\t\t\t\t\twriter.writeUint8Array(outputData, function() {\n\t\t\t\t\t\t\tchunkIndex++;\n\t\t\t\t\t\t\tsetTimeout(step, 1);\n\t\t\t\t\t\t}, onwriteerror);\n\t\t\t\t\t\tif (crcOutput)\n\t\t\t\t\t\t\tcrc.append(outputData);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchunkIndex++;\n\t\t\t\t\t\tsetTimeout(step, 1);\n\t\t\t\t\t}\n\t\t\t\t\tif (crcInput)\n\t\t\t\t\t\tcrc.append(inputData);\n\t\t\t\t\tif (onprogress)\n\t\t\t\t\t\tonprogress(index, size);\n\t\t\t\t}, onreaderror);\n\t\t\telse {\n\t\t\t\ttry {\n\t\t\t\t\toutputData = process.flush();\n\t\t\t\t} catch (e) {\n\t\t\t\t\tonreaderror(e);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (outputData) {\n\t\t\t\t\tif (crcOutput)\n\t\t\t\t\t\tcrc.append(outputData);\n\t\t\t\t\toutputSize += outputData.length;\n\t\t\t\t\twriter.writeUint8Array(outputData, function() {\n\t\t\t\t\t\tonend(outputSize, crc.get());\n\t\t\t\t\t}, onwriteerror);\n\t\t\t\t} else\n\t\t\t\t\tonend(outputSize, crc.get());\n\t\t\t}\n\t\t}\n\n\t\tstep();\n\t}\n\n\tfunction inflate(worker, sn, reader, writer, offset, size, computeCrc32, onend, onprogress, onreaderror, onwriteerror) {\n\t\tvar crcType = computeCrc32 ? 'output' : 'none';\n\t\tif (obj.zip.useWebWorkers) {\n\t\t\tvar initialMessage = {\n\t\t\t\tsn: sn,\n\t\t\t\tcodecClass: 'Inflater',\n\t\t\t\tcrcType: crcType,\n\t\t\t};\n\t\t\tlaunchWorkerProcess(worker, initialMessage, reader, writer, offset, size, onprogress, onend, onreaderror, onwriteerror);\n\t\t} else\n\t\t\tlaunchProcess(new obj.zip.Inflater(), reader, writer, offset, size, crcType, onprogress, onend, onreaderror, onwriteerror);\n\t}\n\n\tfunction deflate(worker, sn, reader, writer, level, onend, onprogress, onreaderror, onwriteerror) {\n\t\tvar crcType = 'input';\n\t\tif (obj.zip.useWebWorkers) {\n\t\t\tvar initialMessage = {\n\t\t\t\tsn: sn,\n\t\t\t\toptions: {level: level},\n\t\t\t\tcodecClass: 'Deflater',\n\t\t\t\tcrcType: crcType,\n\t\t\t};\n\t\t\tlaunchWorkerProcess(worker, initialMessage, reader, writer, 0, reader.size, onprogress, onend, onreaderror, onwriteerror);\n\t\t} else\n\t\t\tlaunchProcess(new obj.zip.Deflater(), reader, writer, 0, reader.size, crcType, onprogress, onend, onreaderror, onwriteerror);\n\t}\n\n\tfunction copy(worker, sn, reader, writer, offset, size, computeCrc32, onend, onprogress, onreaderror, onwriteerror) {\n\t\tvar crcType = 'input';\n\t\tif (obj.zip.useWebWorkers && computeCrc32) {\n\t\t\tvar initialMessage = {\n\t\t\t\tsn: sn,\n\t\t\t\tcodecClass: 'NOOP',\n\t\t\t\tcrcType: crcType,\n\t\t\t};\n\t\t\tlaunchWorkerProcess(worker, initialMessage, reader, writer, offset, size, onprogress, onend, onreaderror, onwriteerror);\n\t\t} else\n\t\t\tlaunchProcess(new NOOP(), reader, writer, offset, size, crcType, onprogress, onend, onreaderror, onwriteerror);\n\t}\n\n\t// ZipReader\n\n\tfunction decodeASCII(str) {\n\t\tvar i, out = \"\", charCode, extendedASCII = [ '\\u00C7', '\\u00FC', '\\u00E9', '\\u00E2', '\\u00E4', '\\u00E0', '\\u00E5', '\\u00E7', '\\u00EA', '\\u00EB',\n\t\t\t\t'\\u00E8', '\\u00EF', '\\u00EE', '\\u00EC', '\\u00C4', '\\u00C5', '\\u00C9', '\\u00E6', '\\u00C6', '\\u00F4', '\\u00F6', '\\u00F2', '\\u00FB', '\\u00F9',\n\t\t\t\t'\\u00FF', '\\u00D6', '\\u00DC', '\\u00F8', '\\u00A3', '\\u00D8', '\\u00D7', '\\u0192', '\\u00E1', '\\u00ED', '\\u00F3', '\\u00FA', '\\u00F1', '\\u00D1',\n\t\t\t\t'\\u00AA', '\\u00BA', '\\u00BF', '\\u00AE', '\\u00AC', '\\u00BD', '\\u00BC', '\\u00A1', '\\u00AB', '\\u00BB', '_', '_', '_', '\\u00A6', '\\u00A6',\n\t\t\t\t'\\u00C1', '\\u00C2', '\\u00C0', '\\u00A9', '\\u00A6', '\\u00A6', '+', '+', '\\u00A2', '\\u00A5', '+', '+', '-', '-', '+', '-', '+', '\\u00E3',\n\t\t\t\t'\\u00C3', '+', '+', '-', '-', '\\u00A6', '-', '+', '\\u00A4', '\\u00F0', '\\u00D0', '\\u00CA', '\\u00CB', '\\u00C8', 'i', '\\u00CD', '\\u00CE',\n\t\t\t\t'\\u00CF', '+', '+', '_', '_', '\\u00A6', '\\u00CC', '_', '\\u00D3', '\\u00DF', '\\u00D4', '\\u00D2', '\\u00F5', '\\u00D5', '\\u00B5', '\\u00FE',\n\t\t\t\t'\\u00DE', '\\u00DA', '\\u00DB', '\\u00D9', '\\u00FD', '\\u00DD', '\\u00AF', '\\u00B4', '\\u00AD', '\\u00B1', '_', '\\u00BE', '\\u00B6', '\\u00A7',\n\t\t\t\t'\\u00F7', '\\u00B8', '\\u00B0', '\\u00A8', '\\u00B7', '\\u00B9', '\\u00B3', '\\u00B2', '_', ' ' ];\n\t\tfor (i = 0; i < str.length; i++) {\n\t\t\tcharCode = str.charCodeAt(i) & 0xFF;\n\t\t\tif (charCode > 127)\n\t\t\t\tout += extendedASCII[charCode - 128];\n\t\t\telse\n\t\t\t\tout += String.fromCharCode(charCode);\n\t\t}\n\t\treturn out;\n\t}\n\n\tfunction decodeUTF8(string) {\n\t\treturn decodeURIComponent(escape(string));\n\t}\n\n\tfunction getString(bytes) {\n\t\tvar i, str = \"\";\n\t\tfor (i = 0; i < bytes.length; i++)\n\t\t\tstr += String.fromCharCode(bytes[i]);\n\t\treturn str;\n\t}\n\n\tfunction getDate(timeRaw) {\n\t\tvar date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff;\n\t\ttry {\n\t\t\treturn new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5,\n\t\t\t\t\t(time & 0x001F) * 2, 0);\n\t\t} catch (e) {\n\t\t}\n\t}\n\n\tfunction readCommonHeader(entry, data, index, centralDirectory, onerror) {\n\t\tentry.version = data.view.getUint16(index, true);\n\t\tentry.bitFlag = data.view.getUint16(index + 2, true);\n\t\tentry.compressionMethod = data.view.getUint16(index + 4, true);\n\t\tentry.lastModDateRaw = data.view.getUint32(index + 6, true);\n\t\tentry.lastModDate = getDate(entry.lastModDateRaw);\n\t\tif ((entry.bitFlag & 0x01) === 0x01) {\n\t\t\tonerror(ERR_ENCRYPTED);\n\t\t\treturn;\n\t\t}\n\t\tif (centralDirectory || (entry.bitFlag & 0x0008) != 0x0008) {\n\t\t\tentry.crc32 = data.view.getUint32(index + 10, true);\n\t\t\tentry.compressedSize = data.view.getUint32(index + 14, true);\n\t\t\tentry.uncompressedSize = data.view.getUint32(index + 18, true);\n\t\t}\n\t\tif (entry.compressedSize === 0xFFFFFFFF || entry.uncompressedSize === 0xFFFFFFFF) {\n\t\t\tonerror(ERR_ZIP64);\n\t\t\treturn;\n\t\t}\n\t\tentry.filenameLength = data.view.getUint16(index + 22, true);\n\t\tentry.extraFieldLength = data.view.getUint16(index + 24, true);\n\t}\n\n\tfunction createZipReader(reader, callback, onerror) {\n\t\tvar inflateSN = 0;\n\n\t\tfunction Entry() {\n\t\t}\n\n\t\tEntry.prototype.getData = function(writer, onend, onprogress, checkCrc32) {\n\t\t\tvar that = this;\n\n\t\t\tfunction testCrc32(crc32) {\n\t\t\t\tvar dataCrc32 = getDataHelper(4);\n\t\t\t\tdataCrc32.view.setUint32(0, crc32);\n\t\t\t\treturn that.crc32 == dataCrc32.view.getUint32(0);\n\t\t\t}\n\n\t\t\tfunction getWriterData(uncompressedSize, crc32) {\n\t\t\t\tif (checkCrc32 && !testCrc32(crc32))\n\t\t\t\t\tonerror(ERR_CRC);\n\t\t\t\telse\n\t\t\t\t\twriter.getData(function(data) {\n\t\t\t\t\t\tonend(data);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\tfunction onreaderror(err) {\n\t\t\t\tonerror(err || ERR_READ_DATA);\n\t\t\t}\n\n\t\t\tfunction onwriteerror(err) {\n\t\t\t\tonerror(err || ERR_WRITE_DATA);\n\t\t\t}\n\n\t\t\treader.readUint8Array(that.offset, 30, function(bytes) {\n\t\t\t\tvar data = getDataHelper(bytes.length, bytes), dataOffset;\n\t\t\t\tif (data.view.getUint32(0) != 0x504b0304) {\n\t\t\t\t\tonerror(ERR_BAD_FORMAT);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\treadCommonHeader(that, data, 4, false, onerror);\n\t\t\t\tdataOffset = that.offset + 30 + that.filenameLength + that.extraFieldLength;\n\t\t\t\twriter.init(function() {\n\t\t\t\t\tif (that.compressionMethod === 0)\n\t\t\t\t\t\tcopy(that._worker, inflateSN++, reader, writer, dataOffset, that.compressedSize, checkCrc32, getWriterData, onprogress, onreaderror, onwriteerror);\n\t\t\t\t\telse\n\t\t\t\t\t\tinflate(that._worker, inflateSN++, reader, writer, dataOffset, that.compressedSize, checkCrc32, getWriterData, onprogress, onreaderror, onwriteerror);\n\t\t\t\t}, onwriteerror);\n\t\t\t}, onreaderror);\n\t\t};\n\n\t\tfunction seekEOCDR(eocdrCallback) {\n\t\t\t// \"End of central directory record\" is the last part of a zip archive, and is at least 22 bytes long.\n\t\t\t// Zip file comment is the last part of EOCDR and has max length of 64KB,\n\t\t\t// so we only have to search the last 64K + 22 bytes of a archive for EOCDR signature (0x06054b50).\n\t\t\tvar EOCDR_MIN = 22;\n\t\t\tif (reader.size < EOCDR_MIN) {\n\t\t\t\tonerror(ERR_BAD_FORMAT);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar ZIP_COMMENT_MAX = 256 * 256, EOCDR_MAX = EOCDR_MIN + ZIP_COMMENT_MAX;\n\n\t\t\t// In most cases, the EOCDR is EOCDR_MIN bytes long\n\t\t\tdoSeek(EOCDR_MIN, function() {\n\t\t\t\t// If not found, try within EOCDR_MAX bytes\n\t\t\t\tdoSeek(Math.min(EOCDR_MAX, reader.size), function() {\n\t\t\t\t\tonerror(ERR_BAD_FORMAT);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// seek last length bytes of file for EOCDR\n\t\t\tfunction doSeek(length, eocdrNotFoundCallback) {\n\t\t\t\treader.readUint8Array(reader.size - length, length, function(bytes) {\n\t\t\t\t\tfor (var i = bytes.length - EOCDR_MIN; i >= 0; i--) {\n\t\t\t\t\t\tif (bytes[i] === 0x50 && bytes[i + 1] === 0x4b && bytes[i + 2] === 0x05 && bytes[i + 3] === 0x06) {\n\t\t\t\t\t\t\teocdrCallback(new DataView(bytes.buffer, i, EOCDR_MIN));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\teocdrNotFoundCallback();\n\t\t\t\t}, function() {\n\t\t\t\t\tonerror(ERR_READ);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tvar zipReader = {\n\t\t\tgetEntries : function(callback) {\n\t\t\t\tvar worker = this._worker;\n\t\t\t\t// look for End of central directory record\n\t\t\t\tseekEOCDR(function(dataView) {\n\t\t\t\t\tvar datalength, fileslength;\n\t\t\t\t\tdatalength = dataView.getUint32(16, true);\n\t\t\t\t\tfileslength = dataView.getUint16(8, true);\n\t\t\t\t\tif (datalength < 0 || datalength >= reader.size) {\n\t\t\t\t\t\tonerror(ERR_BAD_FORMAT);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\treader.readUint8Array(datalength, reader.size - datalength, function(bytes) {\n\t\t\t\t\t\tvar i, index = 0, entries = [], entry, filename, comment, data = getDataHelper(bytes.length, bytes);\n\t\t\t\t\t\tfor (i = 0; i < fileslength; i++) {\n\t\t\t\t\t\t\tentry = new Entry();\n\t\t\t\t\t\t\tentry._worker = worker;\n\t\t\t\t\t\t\tif (data.view.getUint32(index) != 0x504b0102) {\n\t\t\t\t\t\t\t\tonerror(ERR_BAD_FORMAT);\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treadCommonHeader(entry, data, index + 6, true, onerror);\n\t\t\t\t\t\t\tentry.commentLength = data.view.getUint16(index + 32, true);\n\t\t\t\t\t\t\tentry.directory = ((data.view.getUint8(index + 38) & 0x10) == 0x10);\n\t\t\t\t\t\t\tentry.offset = data.view.getUint32(index + 42, true);\n\t\t\t\t\t\t\tfilename = getString(data.array.subarray(index + 46, index + 46 + entry.filenameLength));\n\t\t\t\t\t\t\tentry.filename = ((entry.bitFlag & 0x0800) === 0x0800) ? decodeUTF8(filename) : decodeASCII(filename);\n\t\t\t\t\t\t\tif (!entry.directory && entry.filename.charAt(entry.filename.length - 1) == \"/\")\n\t\t\t\t\t\t\t\tentry.directory = true;\n\t\t\t\t\t\t\tcomment = getString(data.array.subarray(index + 46 + entry.filenameLength + entry.extraFieldLength, index + 46\n\t\t\t\t\t\t\t\t\t+ entry.filenameLength + entry.extraFieldLength + entry.commentLength));\n\t\t\t\t\t\t\tentry.comment = ((entry.bitFlag & 0x0800) === 0x0800) ? decodeUTF8(comment) : decodeASCII(comment);\n\t\t\t\t\t\t\tentries.push(entry);\n\t\t\t\t\t\t\tindex += 46 + entry.filenameLength + entry.extraFieldLength + entry.commentLength;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcallback(entries);\n\t\t\t\t\t}, function() {\n\t\t\t\t\t\tonerror(ERR_READ);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t\tclose : function(callback) {\n\t\t\t\tif (this._worker) {\n\t\t\t\t\tthis._worker.terminate();\n\t\t\t\t\tthis._worker = null;\n\t\t\t\t}\n\t\t\t\tif (callback)\n\t\t\t\t\tcallback();\n\t\t\t},\n\t\t\t_worker: null\n\t\t};\n\n\t\tif (!obj.zip.useWebWorkers)\n\t\t\tcallback(zipReader);\n\t\telse {\n\t\t\tcreateWorker('inflater',\n\t\t\t\tfunction(worker) {\n\t\t\t\t\tzipReader._worker = worker;\n\t\t\t\t\tcallback(zipReader);\n\t\t\t\t},\n\t\t\t\tfunction(err) {\n\t\t\t\t\tonerror(err);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\t// ZipWriter\n\n\tfunction encodeUTF8(string) {\n\t\treturn unescape(encodeURIComponent(string));\n\t}\n\n\tfunction getBytes(str) {\n\t\tvar i, array = [];\n\t\tfor (i = 0; i < str.length; i++)\n\t\t\tarray.push(str.charCodeAt(i));\n\t\treturn array;\n\t}\n\n\tfunction createZipWriter(writer, callback, onerror, dontDeflate) {\n\t\tvar files = {}, filenames = [], datalength = 0;\n\t\tvar deflateSN = 0;\n\n\t\tfunction onwriteerror(err) {\n\t\t\tonerror(err || ERR_WRITE);\n\t\t}\n\n\t\tfunction onreaderror(err) {\n\t\t\tonerror(err || ERR_READ_DATA);\n\t\t}\n\n\t\tvar zipWriter = {\n\t\t\tadd : function(name, reader, onend, onprogress, options) {\n\t\t\t\tvar header, filename, date;\n\t\t\t\tvar worker = this._worker;\n\n\t\t\t\tfunction writeHeader(callback) {\n\t\t\t\t\tvar data;\n\t\t\t\t\tdate = options.lastModDate || new Date();\n\t\t\t\t\theader = getDataHelper(26);\n\t\t\t\t\tfiles[name] = {\n\t\t\t\t\t\theaderArray : header.array,\n\t\t\t\t\t\tdirectory : options.directory,\n\t\t\t\t\t\tfilename : filename,\n\t\t\t\t\t\toffset : datalength,\n\t\t\t\t\t\tcomment : getBytes(encodeUTF8(options.comment || \"\"))\n\t\t\t\t\t};\n\t\t\t\t\theader.view.setUint32(0, 0x14000808);\n\t\t\t\t\tif (options.version)\n\t\t\t\t\t\theader.view.setUint8(0, options.version);\n\t\t\t\t\tif (!dontDeflate && options.level !== 0 && !options.directory)\n\t\t\t\t\t\theader.view.setUint16(4, 0x0800);\n\t\t\t\t\theader.view.setUint16(6, (((date.getHours() << 6) | date.getMinutes()) << 5) | date.getSeconds() / 2, true);\n\t\t\t\t\theader.view.setUint16(8, ((((date.getFullYear() - 1980) << 4) | (date.getMonth() + 1)) << 5) | date.getDate(), true);\n\t\t\t\t\theader.view.setUint16(22, filename.length, true);\n\t\t\t\t\tdata = getDataHelper(30 + filename.length);\n\t\t\t\t\tdata.view.setUint32(0, 0x504b0304);\n\t\t\t\t\tdata.array.set(header.array, 4);\n\t\t\t\t\tdata.array.set(filename, 30);\n\t\t\t\t\tdatalength += data.array.length;\n\t\t\t\t\twriter.writeUint8Array(data.array, callback, onwriteerror);\n\t\t\t\t}\n\n\t\t\t\tfunction writeFooter(compressedLength, crc32) {\n\t\t\t\t\tvar footer = getDataHelper(16);\n\t\t\t\t\tdatalength += compressedLength || 0;\n\t\t\t\t\tfooter.view.setUint32(0, 0x504b0708);\n\t\t\t\t\tif (typeof crc32 != \"undefined\") {\n\t\t\t\t\t\theader.view.setUint32(10, crc32, true);\n\t\t\t\t\t\tfooter.view.setUint32(4, crc32, true);\n\t\t\t\t\t}\n\t\t\t\t\tif (reader) {\n\t\t\t\t\t\tfooter.view.setUint32(8, compressedLength, true);\n\t\t\t\t\t\theader.view.setUint32(14, compressedLength, true);\n\t\t\t\t\t\tfooter.view.setUint32(12, reader.size, true);\n\t\t\t\t\t\theader.view.setUint32(18, reader.size, true);\n\t\t\t\t\t}\n\t\t\t\t\twriter.writeUint8Array(footer.array, function() {\n\t\t\t\t\t\tdatalength += 16;\n\t\t\t\t\t\tonend();\n\t\t\t\t\t}, onwriteerror);\n\t\t\t\t}\n\n\t\t\t\tfunction writeFile() {\n\t\t\t\t\toptions = options || {};\n\t\t\t\t\tname = name.trim();\n\t\t\t\t\tif (options.directory && name.charAt(name.length - 1) != \"/\")\n\t\t\t\t\t\tname += \"/\";\n\t\t\t\t\tif (files.hasOwnProperty(name)) {\n\t\t\t\t\t\tonerror(ERR_DUPLICATED_NAME);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tfilename = getBytes(encodeUTF8(name));\n\t\t\t\t\tfilenames.push(name);\n\t\t\t\t\twriteHeader(function() {\n\t\t\t\t\t\tif (reader)\n\t\t\t\t\t\t\tif (dontDeflate || options.level === 0)\n\t\t\t\t\t\t\t\tcopy(worker, deflateSN++, reader, writer, 0, reader.size, true, writeFooter, onprogress, onreaderror, onwriteerror);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tdeflate(worker, deflateSN++, reader, writer, options.level, writeFooter, onprogress, onreaderror, onwriteerror);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\twriteFooter();\n\t\t\t\t\t}, onwriteerror);\n\t\t\t\t}\n\n\t\t\t\tif (reader)\n\t\t\t\t\treader.init(writeFile, onreaderror);\n\t\t\t\telse\n\t\t\t\t\twriteFile();\n\t\t\t},\n\t\t\tclose : function(callback) {\n\t\t\t\tif (this._worker) {\n\t\t\t\t\tthis._worker.terminate();\n\t\t\t\t\tthis._worker = null;\n\t\t\t\t}\n\n\t\t\t\tvar data, length = 0, index = 0, indexFilename, file;\n\t\t\t\tfor (indexFilename = 0; indexFilename < filenames.length; indexFilename++) {\n\t\t\t\t\tfile = files[filenames[indexFilename]];\n\t\t\t\t\tlength += 46 + file.filename.length + file.comment.length;\n\t\t\t\t}\n\t\t\t\tdata = getDataHelper(length + 22);\n\t\t\t\tfor (indexFilename = 0; indexFilename < filenames.length; indexFilename++) {\n\t\t\t\t\tfile = files[filenames[indexFilename]];\n\t\t\t\t\tdata.view.setUint32(index, 0x504b0102);\n\t\t\t\t\tdata.view.setUint16(index + 4, 0x1400);\n\t\t\t\t\tdata.array.set(file.headerArray, index + 6);\n\t\t\t\t\tdata.view.setUint16(index + 32, file.comment.length, true);\n\t\t\t\t\tif (file.directory)\n\t\t\t\t\t\tdata.view.setUint8(index + 38, 0x10);\n\t\t\t\t\tdata.view.setUint32(index + 42, file.offset, true);\n\t\t\t\t\tdata.array.set(file.filename, index + 46);\n\t\t\t\t\tdata.array.set(file.comment, index + 46 + file.filename.length);\n\t\t\t\t\tindex += 46 + file.filename.length + file.comment.length;\n\t\t\t\t}\n\t\t\t\tdata.view.setUint32(index, 0x504b0506);\n\t\t\t\tdata.view.setUint16(index + 8, filenames.length, true);\n\t\t\t\tdata.view.setUint16(index + 10, filenames.length, true);\n\t\t\t\tdata.view.setUint32(index + 12, length, true);\n\t\t\t\tdata.view.setUint32(index + 16, datalength, true);\n\t\t\t\twriter.writeUint8Array(data.array, function() {\n\t\t\t\t\twriter.getData(callback);\n\t\t\t\t}, onwriteerror);\n\t\t\t},\n\t\t\t_worker: null\n\t\t};\n\n\t\tif (!obj.zip.useWebWorkers)\n\t\t\tcallback(zipWriter);\n\t\telse {\n\t\t\tcreateWorker('deflater',\n\t\t\t\tfunction(worker) {\n\t\t\t\t\tzipWriter._worker = worker;\n\t\t\t\t\tcallback(zipWriter);\n\t\t\t\t},\n\t\t\t\tfunction(err) {\n\t\t\t\t\tonerror(err);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction resolveURLs(urls) {\n\t\tvar a = document.createElement('a');\n\t\treturn urls.map(function(url) {\n\t\t\ta.href = url;\n\t\t\treturn a.href;\n\t\t});\n\t}\n\n\tvar DEFAULT_WORKER_SCRIPTS = {\n\t\tdeflater: ['z-worker.js', 'deflate.js'],\n\t\tinflater: ['z-worker.js', 'inflate.js']\n\t};\n\tfunction createWorker(type, callback, onerror) {\n\t\tif (obj.zip.workerScripts !== null && obj.zip.workerScriptsPath !== null) {\n\t\t\tonerror(new Error('Either zip.workerScripts or zip.workerScriptsPath may be set, not both.'));\n\t\t\treturn;\n\t\t}\n\t\tvar scripts;\n\t\tif (obj.zip.workerScripts) {\n\t\t\tscripts = obj.zip.workerScripts[type];\n\t\t\tif (!Array.isArray(scripts)) {\n\t\t\t\tonerror(new Error('zip.workerScripts.' + type + ' is not an array!'));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tscripts = resolveURLs(scripts);\n\t\t} else {\n\t\t\tscripts = DEFAULT_WORKER_SCRIPTS[type].slice(0);\n\t\t\tscripts[0] = (obj.zip.workerScriptsPath || '') + scripts[0];\n\t\t}\n\t\tvar worker = new Worker(scripts[0]);\n\t\t// record total consumed time by inflater/deflater/crc32 in this worker\n\t\tworker.codecTime = worker.crcTime = 0;\n\t\tworker.postMessage({ type: 'importScripts', scripts: scripts.slice(1) });\n\t\tworker.addEventListener('message', onmessage);\n\t\tfunction onmessage(ev) {\n\t\t\tvar msg = ev.data;\n\t\t\tif (msg.error) {\n\t\t\t\tworker.terminate(); // should before onerror(), because onerror() may throw.\n\t\t\t\tonerror(msg.error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (msg.type === 'importScripts') {\n\t\t\t\tworker.removeEventListener('message', onmessage);\n\t\t\t\tworker.removeEventListener('error', errorHandler);\n\t\t\t\tcallback(worker);\n\t\t\t}\n\t\t}\n\t\t// catch entry script loading error and other unhandled errors\n\t\tworker.addEventListener('error', errorHandler);\n\t\tfunction errorHandler(err) {\n\t\t\tworker.terminate();\n\t\t\tonerror(err);\n\t\t}\n\t}\n\n\tfunction onerror_default(error) {\n\t\tconsole.error(error);\n\t}\n\tobj.zip = {\n\t\tReader : Reader,\n\t\tWriter : Writer,\n\t\tBlobReader : BlobReader,\n\t\tData64URIReader : Data64URIReader,\n\t\tTextReader : TextReader,\n\t\tBlobWriter : BlobWriter,\n\t\tData64URIWriter : Data64URIWriter,\n\t\tTextWriter : TextWriter,\n\t\tcreateReader : function(reader, callback, onerror) {\n\t\t\tonerror = onerror || onerror_default;\n\n\t\t\treader.init(function() {\n\t\t\t\tcreateZipReader(reader, callback, onerror);\n\t\t\t}, onerror);\n\t\t},\n\t\tcreateWriter : function(writer, callback, onerror, dontDeflate) {\n\t\t\tonerror = onerror || onerror_default;\n\t\t\tdontDeflate = !!dontDeflate;\n\n\t\t\twriter.init(function() {\n\t\t\t\tcreateZipWriter(writer, callback, onerror, dontDeflate);\n\t\t\t}, onerror);\n\t\t},\n\t\tuseWebWorkers : true,\n\t\t/**\n\t\t * Directory containing the default worker scripts (z-worker.js, deflate.js, and inflate.js), relative to current base url.\n\t\t * E.g.: zip.workerScripts = './';\n\t\t */\n\t\tworkerScriptsPath : null,\n\t\t/**\n\t\t * Advanced option to control which scripts are loaded in the Web worker. If this option is specified, then workerScriptsPath must not be set.\n\t\t * workerScripts.deflater/workerScripts.inflater should be arrays of urls to scripts for deflater/inflater, respectively.\n\t\t * Scripts in the array are executed in order, and the first one should be z-worker.js, which is used to start the worker.\n\t\t * All urls are relative to current base url.\n\t\t * E.g.:\n\t\t * zip.workerScripts = {\n\t\t *   deflater: ['z-worker.js', 'deflate.js'],\n\t\t *   inflater: ['z-worker.js', 'inflate.js']\n\t\t * };\n\t\t */\n\t\tworkerScripts : null,\n\t};\n\n})(this);\n"
  }
]