kanabarum 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.d.ts +10 -0
- package/dist/index.browser.js +5888 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs +5 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -10
- package/dist/index.js.map +1 -1
- package/package.json +13 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/viterbi/ViterbiNode.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/viterbi/ViterbiLattice.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/util/SurrogateAwareString.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/viterbi/ViterbiBuilder.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/viterbi/ViterbiSearcher.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/util/IpadicFormatter.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/Tokenizer.js","../node_modules/.pnpm/zlibjs@0.3.1/node_modules/zlibjs/bin/gunzip.min.js","../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js","../node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js","../node_modules/.pnpm/doublearray@0.0.2/node_modules/doublearray/doublearray.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/util/ByteBuffer.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/TokenInfoDictionary.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/ConnectionCosts.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/CharacterClass.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/InvokeDefinitionMap.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/CharacterDefinition.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/UnknownDictionary.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/DynamicDictionaries.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/loader/DictionaryLoader.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/loader/BrowserDictionaryLoader.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/TokenizerBuilder.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/builder/ConnectionCostsBuilder.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/builder/CharacterDefinitionBuilder.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/dict/builder/DictionaryBuilder.js","../node_modules/.pnpm/kuromoji@0.1.2/node_modules/kuromoji/src/kuromoji.js","../src/normalizer.ts","../src/dictionary.ts","../src/particleRewriter.ts","../src/mora.ts","../src/coreConverter.ts","../src/kanaToHangul.ts","../src/tokenizer.browser.ts","../src/kanaBarum.browser.ts"],"names":["global","exports","args","index","Buffer","transform","iterator","callback","cb","filter","hasOwnProperty","memoized","kuromoji","toHiragana","outCpStart","isKatakanaChar","out","info"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AA+BA,aAAS,YAAY,WAAW,WAAW,WAAW,QAAQ,MAAM,SAAS,UAAU,cAAc;AACjG,WAAK,OAAO;AACZ,WAAK,OAAO;AACZ,WAAK,YAAY;AACjB,WAAK,SAAS;AACd,WAAK,UAAU;AACf,WAAK,WAAW;AAChB,WAAK,OAAO;AACZ,WAAK,eAAe;AACpB,UAAI,SAAS,OAAO;AAChB,aAAK,gBAAgB;AAAA,MACzB,OAAO;AACH,aAAK,gBAAgB,OAAO;AA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AAO,wBAAwB,WAAW;AAAA,IACxC,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ,CAAC;AACH;;;ACnCA,sBAAqB;AAIrB,eAAe,iBAAqC;AAClD,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,oBAAAL,QACG,QAAQ,EAAE,SAAS,oDAAoD,CAAC,EACxE,MAAM,CAAC,KAAK,OAAO;AAClB,UAAI,OAAO,CAAC;AAAI,eAAO,GAAG;AAAA;AACrB,gBAAQ,EAAE;AAAA,IACjB,CAAC;AAAA,EACL,CAAC;AACH;AAEA,IAAI,mBAA8C;AAElD,eAAsB,eAAmC;AACvD,MAAI,CAAC,kBAAkB;AACrB,uBAAmB,eAAe;AAAA,EACpC;AACA,SAAO;AACT;;;AClBO,IAAM,YAAN,MAAgB;AAAA,EAAhB;AACL,SAAQ,YAAiC;AAAA;AAAA,EAEzC,MAAM,OAAsB;AAC1B,UAAM,YAAY,MAAM,aAAa;AACrC,SAAK,YAAY,mBAAmB,SAAS;AAAA,EAC/C;AAAA,EAEA,aAAa,OAAuB;AAClC,QAAI,CAAC,KAAK,WAAW;AACnB,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AACA,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B;AACF;AAEA,IAAI,kBAAuC;AAC3C,IAAI,cAA4C;AAEhD,eAAe,mBAA0C;AACvD,MAAI;AAAiB,WAAO;AAC5B,MAAI;AAAa,WAAO;AAExB,iBAAe,YAAY;AACzB,UAAM,YAAY,MAAM,aAAa;AACrC,UAAM,YAAY,mBAAmB,SAAS;AAC9C,sBAAkB;AAClB,WAAO;AAAA,EACT,GAAG;AAEH,SAAO;AACT;AAEA,eAAsB,aAAa,OAAgC;AACjE,QAAM,YAAY,MAAM,iBAAiB;AACzC,SAAO,UAAU,KAAK;AACxB","sourcesContent":["/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * ViterbiNode is a node of ViterbiLattice\n * @param {number} node_name Word ID\n * @param {number} node_cost Word cost to generate\n * @param {number} start_pos Start position from 1\n * @param {number} length Word length\n * @param {string} type Node type (KNOWN, UNKNOWN, BOS, EOS, ...)\n * @param {number} left_id Left context ID\n * @param {number} right_id Right context ID\n * @param {string} surface_form Surface form of this word\n * @constructor\n */\nfunction ViterbiNode(node_name, node_cost, start_pos, length, type, left_id, right_id, surface_form) {\n this.name = node_name;\n this.cost = node_cost;\n this.start_pos = start_pos;\n this.length = length;\n this.left_id = left_id;\n this.right_id = right_id;\n this.prev = null;\n this.surface_form = surface_form;\n if (type === \"BOS\") {\n this.shortest_cost = 0;\n } else {\n this.shortest_cost = Number.MAX_VALUE;\n }\n this.type = type;\n}\n\nmodule.exports = ViterbiNode;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar ViterbiNode = require(\"./ViterbiNode\");\n\n/**\n * ViterbiLattice is a lattice in Viterbi algorithm\n * @constructor\n */\nfunction ViterbiLattice() {\n this.nodes_end_at = [];\n this.nodes_end_at[0] = [ new ViterbiNode(-1, 0, 0, 0, \"BOS\", 0, 0, \"\") ];\n this.eos_pos = 1;\n}\n\n/**\n * Append node to ViterbiLattice\n * @param {ViterbiNode} node\n */\nViterbiLattice.prototype.append = function (node) {\n var last_pos = node.start_pos + node.length - 1;\n if (this.eos_pos < last_pos) {\n this.eos_pos = last_pos;\n }\n\n var prev_nodes = this.nodes_end_at[last_pos];\n if (prev_nodes == null) {\n prev_nodes = [];\n }\n prev_nodes.push(node);\n\n this.nodes_end_at[last_pos] = prev_nodes;\n};\n\n/**\n * Set ends with EOS (End of Statement)\n */\nViterbiLattice.prototype.appendEos = function () {\n var last_index = this.nodes_end_at.length;\n this.eos_pos++;\n this.nodes_end_at[last_index] = [ new ViterbiNode(-1, 0, this.eos_pos, 0, \"EOS\", 0, 0, \"\") ];\n};\n\nmodule.exports = ViterbiLattice;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * String wrapper for UTF-16 surrogate pair (4 bytes)\n * @param {string} str String to wrap\n * @constructor\n */\nfunction SurrogateAwareString(str) {\n this.str = str;\n this.index_mapping = [];\n\n for (var pos = 0; pos < str.length; pos++) {\n var ch = str.charAt(pos);\n this.index_mapping.push(pos);\n if (SurrogateAwareString.isSurrogatePair(ch)) {\n pos++;\n }\n }\n // Surrogate aware length\n this.length = this.index_mapping.length;\n}\n\nSurrogateAwareString.prototype.slice = function (index) {\n if (this.index_mapping.length <= index) {\n return \"\";\n }\n var surrogate_aware_index = this.index_mapping[index];\n return this.str.slice(surrogate_aware_index);\n};\n\nSurrogateAwareString.prototype.charAt = function (index) {\n if (this.str.length <= index) {\n return \"\";\n }\n var surrogate_aware_start_index = this.index_mapping[index];\n var surrogate_aware_end_index = this.index_mapping[index + 1];\n\n if (surrogate_aware_end_index == null) {\n return this.str.slice(surrogate_aware_start_index);\n }\n return this.str.slice(surrogate_aware_start_index, surrogate_aware_end_index);\n};\n\nSurrogateAwareString.prototype.charCodeAt = function (index) {\n if (this.index_mapping.length <= index) {\n return NaN;\n }\n var surrogate_aware_index = this.index_mapping[index];\n var upper = this.str.charCodeAt(surrogate_aware_index);\n var lower;\n if (upper >= 0xD800 && upper <= 0xDBFF && surrogate_aware_index < this.str.length) {\n lower = this.str.charCodeAt(surrogate_aware_index + 1);\n if (lower >= 0xDC00 && lower <= 0xDFFF) {\n return (upper - 0xD800) * 0x400 + lower - 0xDC00 + 0x10000;\n }\n }\n return upper;\n};\n\nSurrogateAwareString.prototype.toString = function () {\n return this.str;\n};\n\nSurrogateAwareString.isSurrogatePair = function (ch) {\n var utf16_code = ch.charCodeAt(0);\n if (utf16_code >= 0xD800 && utf16_code <= 0xDBFF) {\n // surrogate pair\n return true;\n } else {\n return false;\n }\n};\n\nmodule.exports = SurrogateAwareString;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar ViterbiNode = require(\"./ViterbiNode\");\nvar ViterbiLattice = require(\"./ViterbiLattice\");\nvar SurrogateAwareString = require(\"../util/SurrogateAwareString\");\n\n/**\n * ViterbiBuilder builds word lattice (ViterbiLattice)\n * @param {DynamicDictionaries} dic dictionary\n * @constructor\n */\nfunction ViterbiBuilder(dic) {\n this.trie = dic.trie;\n this.token_info_dictionary = dic.token_info_dictionary;\n this.unknown_dictionary = dic.unknown_dictionary;\n}\n\n/**\n * Build word lattice\n * @param {string} sentence_str Input text\n * @returns {ViterbiLattice} Word lattice\n */\nViterbiBuilder.prototype.build = function (sentence_str) {\n var lattice = new ViterbiLattice();\n var sentence = new SurrogateAwareString(sentence_str);\n\n var key, trie_id, left_id, right_id, word_cost;\n for (var pos = 0; pos < sentence.length; pos++) {\n var tail = sentence.slice(pos);\n var vocabulary = this.trie.commonPrefixSearch(tail);\n for (var n = 0; n < vocabulary.length; n++) { // Words in dictionary do not have surrogate pair (only UCS2 set)\n trie_id = vocabulary[n].v;\n key = vocabulary[n].k;\n\n var token_info_ids = this.token_info_dictionary.target_map[trie_id];\n for (var i = 0; i < token_info_ids.length; i++) {\n var token_info_id = parseInt(token_info_ids[i]);\n\n left_id = this.token_info_dictionary.dictionary.getShort(token_info_id);\n right_id = this.token_info_dictionary.dictionary.getShort(token_info_id + 2);\n word_cost = this.token_info_dictionary.dictionary.getShort(token_info_id + 4);\n\n // node_name, cost, start_index, length, type, left_id, right_id, surface_form\n lattice.append(new ViterbiNode(token_info_id, word_cost, pos + 1, key.length, \"KNOWN\", left_id, right_id, key));\n }\n }\n\n // Unknown word processing\n var surrogate_aware_tail = new SurrogateAwareString(tail);\n var head_char = new SurrogateAwareString(surrogate_aware_tail.charAt(0));\n var head_char_class = this.unknown_dictionary.lookup(head_char.toString());\n if (vocabulary == null || vocabulary.length === 0 || head_char_class.is_always_invoke === 1) {\n // Process unknown word\n key = head_char;\n if (head_char_class.is_grouping === 1 && 1 < surrogate_aware_tail.length) {\n for (var k = 1; k < surrogate_aware_tail.length; k++) {\n var next_char = surrogate_aware_tail.charAt(k);\n var next_char_class = this.unknown_dictionary.lookup(next_char);\n if (head_char_class.class_name !== next_char_class.class_name) {\n break;\n }\n key += next_char;\n }\n }\n\n var unk_ids = this.unknown_dictionary.target_map[head_char_class.class_id];\n for (var j = 0; j < unk_ids.length; j++) {\n var unk_id = parseInt(unk_ids[j]);\n\n left_id = this.unknown_dictionary.dictionary.getShort(unk_id);\n right_id = this.unknown_dictionary.dictionary.getShort(unk_id + 2);\n word_cost = this.unknown_dictionary.dictionary.getShort(unk_id + 4);\n\n // node_name, cost, start_index, length, type, left_id, right_id, surface_form\n lattice.append(new ViterbiNode(unk_id, word_cost, pos + 1, key.length, \"UNKNOWN\", left_id, right_id, key.toString()));\n }\n }\n }\n lattice.appendEos();\n\n return lattice;\n};\n\nmodule.exports = ViterbiBuilder;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * ViterbiSearcher is for searching best Viterbi path\n * @param {ConnectionCosts} connection_costs Connection costs matrix\n * @constructor\n */\nfunction ViterbiSearcher(connection_costs) {\n this.connection_costs = connection_costs;\n}\n\n/**\n * Search best path by forward-backward algorithm\n * @param {ViterbiLattice} lattice Viterbi lattice to search\n * @returns {Array} Shortest path\n */\nViterbiSearcher.prototype.search = function (lattice) {\n lattice = this.forward(lattice);\n return this.backward(lattice);\n};\n\nViterbiSearcher.prototype.forward = function (lattice) {\n var i, j, k;\n for (i = 1; i <= lattice.eos_pos; i++) {\n var nodes = lattice.nodes_end_at[i];\n if (nodes == null) {\n continue;\n }\n for (j = 0; j < nodes.length; j++) {\n var node = nodes[j];\n var cost = Number.MAX_VALUE;\n var shortest_prev_node;\n\n var prev_nodes = lattice.nodes_end_at[node.start_pos - 1];\n if (prev_nodes == null) {\n // TODO process unknown words (repair word lattice)\n continue;\n }\n for (k = 0; k < prev_nodes.length; k++) {\n var prev_node = prev_nodes[k];\n\n var edge_cost;\n if (node.left_id == null || prev_node.right_id == null) {\n // TODO assert\n console.log(\"Left or right is null\");\n edge_cost = 0;\n } else {\n edge_cost = this.connection_costs.get(prev_node.right_id, node.left_id);\n }\n\n var _cost = prev_node.shortest_cost + edge_cost + node.cost;\n if (_cost < cost) {\n shortest_prev_node = prev_node;\n cost = _cost;\n }\n }\n\n node.prev = shortest_prev_node;\n node.shortest_cost = cost;\n }\n }\n return lattice;\n};\n\nViterbiSearcher.prototype.backward = function (lattice) {\n var shortest_path = [];\n var eos = lattice.nodes_end_at[lattice.nodes_end_at.length - 1][0];\n\n var node_back = eos.prev;\n if (node_back == null) {\n return [];\n }\n while (node_back.type !== \"BOS\") {\n shortest_path.push(node_back);\n if (node_back.prev == null) {\n // TODO Failed to back. Process unknown words?\n return [];\n }\n node_back = node_back.prev;\n }\n\n return shortest_path.reverse();\n};\n\nmodule.exports = ViterbiSearcher;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * Mappings between IPADIC dictionary features and tokenized results\n * @constructor\n */\nfunction IpadicFormatter() {\n}\n\nIpadicFormatter.prototype.formatEntry = function (word_id, position, type, features) {\n var token = {};\n token.word_id = word_id;\n token.word_type = type;\n token.word_position = position;\n\n token.surface_form = features[0];\n token.pos = features[1];\n token.pos_detail_1 = features[2];\n token.pos_detail_2 = features[3];\n token.pos_detail_3 = features[4];\n token.conjugated_type = features[5];\n token.conjugated_form = features[6];\n token.basic_form = features[7];\n token.reading = features[8];\n token.pronunciation = features[9];\n\n return token;\n};\n\nIpadicFormatter.prototype.formatUnknownEntry = function (word_id, position, type, features, surface_form) {\n var token = {};\n token.word_id = word_id;\n token.word_type = type;\n token.word_position = position;\n\n token.surface_form = surface_form;\n token.pos = features[1];\n token.pos_detail_1 = features[2];\n token.pos_detail_2 = features[3];\n token.pos_detail_3 = features[4];\n token.conjugated_type = features[5];\n token.conjugated_form = features[6];\n token.basic_form = features[7];\n // token.reading = features[8];\n // token.pronunciation = features[9];\n\n return token;\n};\n\nmodule.exports = IpadicFormatter;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar ViterbiBuilder = require(\"./viterbi/ViterbiBuilder\");\nvar ViterbiSearcher = require(\"./viterbi/ViterbiSearcher\");\nvar IpadicFormatter = require(\"./util/IpadicFormatter\");\n\nvar PUNCTUATION = /、|。/;\n\n/**\n * Tokenizer\n * @param {DynamicDictionaries} dic Dictionaries used by this tokenizer\n * @constructor\n */\nfunction Tokenizer(dic) {\n this.token_info_dictionary = dic.token_info_dictionary;\n this.unknown_dictionary = dic.unknown_dictionary;\n this.viterbi_builder = new ViterbiBuilder(dic);\n this.viterbi_searcher = new ViterbiSearcher(dic.connection_costs);\n this.formatter = new IpadicFormatter(); // TODO Other dictionaries\n}\n\n/**\n * Split into sentence by punctuation\n * @param {string} input Input text\n * @returns {Array.<string>} Sentences end with punctuation\n */\nTokenizer.splitByPunctuation = function (input) {\n var sentences = [];\n var tail = input;\n while (true) {\n if (tail === \"\") {\n break;\n }\n var index = tail.search(PUNCTUATION);\n if (index < 0) {\n sentences.push(tail);\n break;\n }\n sentences.push(tail.substring(0, index + 1));\n tail = tail.substring(index + 1);\n }\n return sentences;\n};\n\n/**\n * Tokenize text\n * @param {string} text Input text to analyze\n * @returns {Array} Tokens\n */\nTokenizer.prototype.tokenize = function (text) {\n var sentences = Tokenizer.splitByPunctuation(text);\n var tokens = [];\n for (var i = 0; i < sentences.length; i++) {\n var sentence = sentences[i];\n this.tokenizeForSentence(sentence, tokens);\n }\n return tokens;\n};\n\nTokenizer.prototype.tokenizeForSentence = function (sentence, tokens) {\n if (tokens == null) {\n tokens = [];\n }\n var lattice = this.getLattice(sentence);\n var best_path = this.viterbi_searcher.search(lattice);\n var last_pos = 0;\n if (tokens.length > 0) {\n last_pos = tokens[tokens.length - 1].word_position;\n }\n\n for (var j = 0; j < best_path.length; j++) {\n var node = best_path[j];\n\n var token, features, features_line;\n if (node.type === \"KNOWN\") {\n features_line = this.token_info_dictionary.getFeatures(node.name);\n if (features_line == null) {\n features = [];\n } else {\n features = features_line.split(\",\");\n }\n token = this.formatter.formatEntry(node.name, last_pos + node.start_pos, node.type, features);\n } else if (node.type === \"UNKNOWN\") {\n // Unknown word\n features_line = this.unknown_dictionary.getFeatures(node.name);\n if (features_line == null) {\n features = [];\n } else {\n features = features_line.split(\",\");\n }\n token = this.formatter.formatUnknownEntry(node.name, last_pos + node.start_pos, node.type, features, node.surface_form);\n } else {\n // TODO User dictionary\n token = this.formatter.formatEntry(node.name, last_pos + node.start_pos, node.type, []);\n }\n\n tokens.push(token);\n }\n\n return tokens;\n};\n\n/**\n * Build word lattice\n * @param {string} text Input text to analyze\n * @returns {ViterbiLattice} Word lattice\n */\nTokenizer.prototype.getLattice = function (text) {\n return this.viterbi_builder.build(text);\n};\n\nmodule.exports = Tokenizer;\n","/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function n(e){throw e;}var p=void 0,aa=this;function t(e,b){var d=e.split(\".\"),c=aa;!(d[0]in c)&&c.execScript&&c.execScript(\"var \"+d[0]);for(var a;d.length&&(a=d.shift());)!d.length&&b!==p?c[a]=b:c=c[a]?c[a]:c[a]={}};var x=\"undefined\"!==typeof Uint8Array&&\"undefined\"!==typeof Uint16Array&&\"undefined\"!==typeof Uint32Array&&\"undefined\"!==typeof DataView;new (x?Uint8Array:Array)(256);var y;for(y=0;256>y;++y)for(var A=y,ba=7,A=A>>>1;A;A>>>=1)--ba;function B(e,b,d){var c,a=\"number\"===typeof b?b:b=0,f=\"number\"===typeof d?d:e.length;c=-1;for(a=f&7;a--;++b)c=c>>>8^C[(c^e[b])&255];for(a=f>>3;a--;b+=8)c=c>>>8^C[(c^e[b])&255],c=c>>>8^C[(c^e[b+1])&255],c=c>>>8^C[(c^e[b+2])&255],c=c>>>8^C[(c^e[b+3])&255],c=c>>>8^C[(c^e[b+4])&255],c=c>>>8^C[(c^e[b+5])&255],c=c>>>8^C[(c^e[b+6])&255],c=c>>>8^C[(c^e[b+7])&255];return(c^4294967295)>>>0}\nvar D=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,\n2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,\n2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,\n2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,\n3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,\n936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],C=x?new Uint32Array(D):D;function E(){}E.prototype.getName=function(){return this.name};E.prototype.getData=function(){return this.data};E.prototype.G=function(){return this.H};function G(e){var b=e.length,d=0,c=Number.POSITIVE_INFINITY,a,f,k,l,m,r,q,g,h,v;for(g=0;g<b;++g)e[g]>d&&(d=e[g]),e[g]<c&&(c=e[g]);a=1<<d;f=new (x?Uint32Array:Array)(a);k=1;l=0;for(m=2;k<=d;){for(g=0;g<b;++g)if(e[g]===k){r=0;q=l;for(h=0;h<k;++h)r=r<<1|q&1,q>>=1;v=k<<16|g;for(h=r;h<a;h+=m)f[h]=v;++l}++k;l<<=1;m<<=1}return[f,d,c]};var J=[],K;for(K=0;288>K;K++)switch(!0){case 143>=K:J.push([K+48,8]);break;case 255>=K:J.push([K-144+400,9]);break;case 279>=K:J.push([K-256+0,7]);break;case 287>=K:J.push([K-280+192,8]);break;default:n(\"invalid literal: \"+K)}\nvar ca=function(){function e(a){switch(!0){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,\na-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:n(\"invalid length: \"+a)}}var b=[],d,c;for(d=3;258>=d;d++)c=e(d),b[d]=c[2]<<24|c[1]<<\n16|c[0];return b}();x&&new Uint32Array(ca);function L(e,b){this.i=[];this.j=32768;this.d=this.f=this.c=this.n=0;this.input=x?new Uint8Array(e):e;this.o=!1;this.k=M;this.w=!1;if(b||!(b={}))b.index&&(this.c=b.index),b.bufferSize&&(this.j=b.bufferSize),b.bufferType&&(this.k=b.bufferType),b.resize&&(this.w=b.resize);switch(this.k){case N:this.a=32768;this.b=new (x?Uint8Array:Array)(32768+this.j+258);break;case M:this.a=0;this.b=new (x?Uint8Array:Array)(this.j);this.e=this.D;this.q=this.A;this.l=this.C;break;default:n(Error(\"invalid inflate mode\"))}}\nvar N=0,M=1;\nL.prototype.g=function(){for(;!this.o;){var e=P(this,3);e&1&&(this.o=!0);e>>>=1;switch(e){case 0:var b=this.input,d=this.c,c=this.b,a=this.a,f=b.length,k=p,l=p,m=c.length,r=p;this.d=this.f=0;d+1>=f&&n(Error(\"invalid uncompressed block header: LEN\"));k=b[d++]|b[d++]<<8;d+1>=f&&n(Error(\"invalid uncompressed block header: NLEN\"));l=b[d++]|b[d++]<<8;k===~l&&n(Error(\"invalid uncompressed block header: length verify\"));d+k>b.length&&n(Error(\"input buffer is broken\"));switch(this.k){case N:for(;a+k>c.length;){r=\nm-a;k-=r;if(x)c.set(b.subarray(d,d+r),a),a+=r,d+=r;else for(;r--;)c[a++]=b[d++];this.a=a;c=this.e();a=this.a}break;case M:for(;a+k>c.length;)c=this.e({t:2});break;default:n(Error(\"invalid inflate mode\"))}if(x)c.set(b.subarray(d,d+k),a),a+=k,d+=k;else for(;k--;)c[a++]=b[d++];this.c=d;this.a=a;this.b=c;break;case 1:this.l(da,ea);break;case 2:for(var q=P(this,5)+257,g=P(this,5)+1,h=P(this,4)+4,v=new (x?Uint8Array:Array)(Q.length),s=p,F=p,H=p,w=p,z=p,O=p,I=p,u=p,Z=p,u=0;u<h;++u)v[Q[u]]=P(this,3);if(!x){u=\nh;for(h=v.length;u<h;++u)v[Q[u]]=0}s=G(v);w=new (x?Uint8Array:Array)(q+g);u=0;for(Z=q+g;u<Z;)switch(z=R(this,s),z){case 16:for(I=3+P(this,2);I--;)w[u++]=O;break;case 17:for(I=3+P(this,3);I--;)w[u++]=0;O=0;break;case 18:for(I=11+P(this,7);I--;)w[u++]=0;O=0;break;default:O=w[u++]=z}F=x?G(w.subarray(0,q)):G(w.slice(0,q));H=x?G(w.subarray(q)):G(w.slice(q));this.l(F,H);break;default:n(Error(\"unknown BTYPE: \"+e))}}return this.q()};\nvar S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Q=x?new Uint16Array(S):S,fa=[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,258,258],ga=x?new Uint16Array(fa):fa,ha=[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,0,0],T=x?new Uint8Array(ha):ha,ia=[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],ja=x?new Uint16Array(ia):ia,ka=[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,\n11,12,12,13,13],U=x?new Uint8Array(ka):ka,V=new (x?Uint8Array:Array)(288),W,la;W=0;for(la=V.length;W<la;++W)V[W]=143>=W?8:255>=W?9:279>=W?7:8;var da=G(V),X=new (x?Uint8Array:Array)(30),Y,ma;Y=0;for(ma=X.length;Y<ma;++Y)X[Y]=5;var ea=G(X);function P(e,b){for(var d=e.f,c=e.d,a=e.input,f=e.c,k=a.length,l;c<b;)f>=k&&n(Error(\"input buffer is broken\")),d|=a[f++]<<c,c+=8;l=d&(1<<b)-1;e.f=d>>>b;e.d=c-b;e.c=f;return l}\nfunction R(e,b){for(var d=e.f,c=e.d,a=e.input,f=e.c,k=a.length,l=b[0],m=b[1],r,q;c<m&&!(f>=k);)d|=a[f++]<<c,c+=8;r=l[d&(1<<m)-1];q=r>>>16;q>c&&n(Error(\"invalid code length: \"+q));e.f=d>>q;e.d=c-q;e.c=f;return r&65535}\nL.prototype.l=function(e,b){var d=this.b,c=this.a;this.r=e;for(var a=d.length-258,f,k,l,m;256!==(f=R(this,e));)if(256>f)c>=a&&(this.a=c,d=this.e(),c=this.a),d[c++]=f;else{k=f-257;m=ga[k];0<T[k]&&(m+=P(this,T[k]));f=R(this,b);l=ja[f];0<U[f]&&(l+=P(this,U[f]));c>=a&&(this.a=c,d=this.e(),c=this.a);for(;m--;)d[c]=d[c++-l]}for(;8<=this.d;)this.d-=8,this.c--;this.a=c};\nL.prototype.C=function(e,b){var d=this.b,c=this.a;this.r=e;for(var a=d.length,f,k,l,m;256!==(f=R(this,e));)if(256>f)c>=a&&(d=this.e(),a=d.length),d[c++]=f;else{k=f-257;m=ga[k];0<T[k]&&(m+=P(this,T[k]));f=R(this,b);l=ja[f];0<U[f]&&(l+=P(this,U[f]));c+m>a&&(d=this.e(),a=d.length);for(;m--;)d[c]=d[c++-l]}for(;8<=this.d;)this.d-=8,this.c--;this.a=c};\nL.prototype.e=function(){var e=new (x?Uint8Array:Array)(this.a-32768),b=this.a-32768,d,c,a=this.b;if(x)e.set(a.subarray(32768,e.length));else{d=0;for(c=e.length;d<c;++d)e[d]=a[d+32768]}this.i.push(e);this.n+=e.length;if(x)a.set(a.subarray(b,b+32768));else for(d=0;32768>d;++d)a[d]=a[b+d];this.a=32768;return a};\nL.prototype.D=function(e){var b,d=this.input.length/this.c+1|0,c,a,f,k=this.input,l=this.b;e&&(\"number\"===typeof e.t&&(d=e.t),\"number\"===typeof e.z&&(d+=e.z));2>d?(c=(k.length-this.c)/this.r[2],f=258*(c/2)|0,a=f<l.length?l.length+f:l.length<<1):a=l.length*d;x?(b=new Uint8Array(a),b.set(l)):b=l;return this.b=b};\nL.prototype.q=function(){var e=0,b=this.b,d=this.i,c,a=new (x?Uint8Array:Array)(this.n+(this.a-32768)),f,k,l,m;if(0===d.length)return x?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);f=0;for(k=d.length;f<k;++f){c=d[f];l=0;for(m=c.length;l<m;++l)a[e++]=c[l]}f=32768;for(k=this.a;f<k;++f)a[e++]=b[f];this.i=[];return this.buffer=a};\nL.prototype.A=function(){var e,b=this.a;x?this.w?(e=new Uint8Array(b),e.set(this.b.subarray(0,b))):e=this.b.subarray(0,b):(this.b.length>b&&(this.b.length=b),e=this.b);return this.buffer=e};function $(e){this.input=e;this.c=0;this.m=[];this.s=!1}$.prototype.F=function(){this.s||this.g();return this.m.slice()};\n$.prototype.g=function(){for(var e=this.input.length;this.c<e;){var b=new E,d=p,c=p,a=p,f=p,k=p,l=p,m=p,r=p,q=p,g=this.input,h=this.c;b.u=g[h++];b.v=g[h++];(31!==b.u||139!==b.v)&&n(Error(\"invalid file signature:\"+b.u+\",\"+b.v));b.p=g[h++];switch(b.p){case 8:break;default:n(Error(\"unknown compression method: \"+b.p))}b.h=g[h++];r=g[h++]|g[h++]<<8|g[h++]<<16|g[h++]<<24;b.H=new Date(1E3*r);b.N=g[h++];b.M=g[h++];0<(b.h&4)&&(b.I=g[h++]|g[h++]<<8,h+=b.I);if(0<(b.h&8)){m=[];for(l=0;0<(k=g[h++]);)m[l++]=String.fromCharCode(k);\nb.name=m.join(\"\")}if(0<(b.h&16)){m=[];for(l=0;0<(k=g[h++]);)m[l++]=String.fromCharCode(k);b.J=m.join(\"\")}0<(b.h&2)&&(b.B=B(g,0,h)&65535,b.B!==(g[h++]|g[h++]<<8)&&n(Error(\"invalid header crc16\")));d=g[g.length-4]|g[g.length-3]<<8|g[g.length-2]<<16|g[g.length-1]<<24;g.length-h-4-4<512*d&&(f=d);c=new L(g,{index:h,bufferSize:f});b.data=a=c.g();h=c.c;b.K=q=(g[h++]|g[h++]<<8|g[h++]<<16|g[h++]<<24)>>>0;B(a,p,p)!==q&&n(Error(\"invalid CRC-32 checksum: 0x\"+B(a,p,p).toString(16)+\" / 0x\"+q.toString(16)));b.L=\nd=(g[h++]|g[h++]<<8|g[h++]<<16|g[h++]<<24)>>>0;(a.length&4294967295)!==d&&n(Error(\"invalid input size: \"+(a.length&4294967295)+\" / \"+d));this.m.push(b);this.c=h}this.s=!0;var v=this.m,s,F,H=0,w=0,z;s=0;for(F=v.length;s<F;++s)w+=v[s].data.length;if(x){z=new Uint8Array(w);for(s=0;s<F;++s)z.set(v[s].data,H),H+=v[s].data.length}else{z=[];for(s=0;s<F;++s)z[s]=v[s].data;z=Array.prototype.concat.apply([],z)}return z};t(\"Zlib.Gunzip\",$);t(\"Zlib.Gunzip.prototype.decompress\",$.prototype.g);t(\"Zlib.Gunzip.prototype.getMembers\",$.prototype.F);t(\"Zlib.GunzipMember\",E);t(\"Zlib.GunzipMember.prototype.getName\",E.prototype.getName);t(\"Zlib.GunzipMember.prototype.getData\",E.prototype.getData);t(\"Zlib.GunzipMember.prototype.getMtime\",E.prototype.G);}).call(this);\n","// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\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'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\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 = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\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.async = global.async || {})));\n}(this, (function (exports) { 'use strict';\n\nfunction slice(arrayLike, start) {\n start = start|0;\n var newLen = Math.max(arrayLike.length - start, 0);\n var newArr = Array(newLen);\n for(var idx = 0; idx < newLen; idx++) {\n newArr[idx] = arrayLike[start + idx];\n }\n return newArr;\n}\n\n/**\n * Creates a continuation function with some arguments already applied.\n *\n * Useful as a shorthand when combined with other control flow functions. Any\n * arguments passed to the returned function are added to the arguments\n * originally passed to apply.\n *\n * @name apply\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {Function} fn - The function you want to eventually apply all\n * arguments to. Invokes with (arguments...).\n * @param {...*} arguments... - Any number of arguments to automatically apply\n * when the continuation is called.\n * @returns {Function} the partially-applied function\n * @example\n *\n * // using apply\n * async.parallel([\n * async.apply(fs.writeFile, 'testfile1', 'test1'),\n * async.apply(fs.writeFile, 'testfile2', 'test2')\n * ]);\n *\n *\n * // the same process without using apply\n * async.parallel([\n * function(callback) {\n * fs.writeFile('testfile1', 'test1', callback);\n * },\n * function(callback) {\n * fs.writeFile('testfile2', 'test2', callback);\n * }\n * ]);\n *\n * // It's possible to pass any number of additional arguments when calling the\n * // continuation:\n *\n * node> var fn = async.apply(sys.puts, 'one');\n * node> fn('two', 'three');\n * one\n * two\n * three\n */\nvar apply = function(fn/*, ...args*/) {\n var args = slice(arguments, 1);\n return function(/*callArgs*/) {\n var callArgs = slice(arguments);\n return fn.apply(null, args.concat(callArgs));\n };\n};\n\nvar initialParams = function (fn) {\n return function (/*...args, callback*/) {\n var args = slice(arguments);\n var callback = args.pop();\n fn.call(this, args, callback);\n };\n};\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nvar hasSetImmediate = typeof setImmediate === 'function' && setImmediate;\nvar hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';\n\nfunction fallback(fn) {\n setTimeout(fn, 0);\n}\n\nfunction wrap(defer) {\n return function (fn/*, ...args*/) {\n var args = slice(arguments, 1);\n defer(function () {\n fn.apply(null, args);\n });\n };\n}\n\nvar _defer;\n\nif (hasSetImmediate) {\n _defer = setImmediate;\n} else if (hasNextTick) {\n _defer = process.nextTick;\n} else {\n _defer = fallback;\n}\n\nvar setImmediate$1 = wrap(_defer);\n\n/**\n * Take a sync function and make it async, passing its return value to a\n * callback. This is useful for plugging sync functions into a waterfall,\n * series, or other async functions. Any arguments passed to the generated\n * function will be passed to the wrapped function (except for the final\n * callback argument). Errors thrown will be passed to the callback.\n *\n * If the function passed to `asyncify` returns a Promise, that promises's\n * resolved/rejected state will be used to call the callback, rather than simply\n * the synchronous return value.\n *\n * This also means you can asyncify ES2017 `async` functions.\n *\n * @name asyncify\n * @static\n * @memberOf module:Utils\n * @method\n * @alias wrapSync\n * @category Util\n * @param {Function} func - The synchronous function, or Promise-returning\n * function to convert to an {@link AsyncFunction}.\n * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be\n * invoked with `(args..., callback)`.\n * @example\n *\n * // passing a regular synchronous function\n * async.waterfall([\n * async.apply(fs.readFile, filename, \"utf8\"),\n * async.asyncify(JSON.parse),\n * function (data, next) {\n * // data is the result of parsing the text.\n * // If there was a parsing error, it would have been caught.\n * }\n * ], callback);\n *\n * // passing a function returning a promise\n * async.waterfall([\n * async.apply(fs.readFile, filename, \"utf8\"),\n * async.asyncify(function (contents) {\n * return db.model.create(contents);\n * }),\n * function (model, next) {\n * // `model` is the instantiated model object.\n * // If there was an error, this function would be skipped.\n * }\n * ], callback);\n *\n * // es2017 example, though `asyncify` is not needed if your JS environment\n * // supports async functions out of the box\n * var q = async.queue(async.asyncify(async function(file) {\n * var intermediateStep = await processFile(file);\n * return await somePromise(intermediateStep)\n * }));\n *\n * q.push(files);\n */\nfunction asyncify(func) {\n return initialParams(function (args, callback) {\n var result;\n try {\n result = func.apply(this, args);\n } catch (e) {\n return callback(e);\n }\n // if result is Promise object\n if (isObject(result) && typeof result.then === 'function') {\n result.then(function(value) {\n invokeCallback(callback, null, value);\n }, function(err) {\n invokeCallback(callback, err.message ? err : new Error(err));\n });\n } else {\n callback(null, result);\n }\n });\n}\n\nfunction invokeCallback(callback, error, value) {\n try {\n callback(error, value);\n } catch (e) {\n setImmediate$1(rethrow, e);\n }\n}\n\nfunction rethrow(error) {\n throw error;\n}\n\nvar supportsSymbol = typeof Symbol === 'function';\n\nfunction isAsync(fn) {\n return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction';\n}\n\nfunction wrapAsync(asyncFn) {\n return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn;\n}\n\nfunction applyEach$1(eachfn) {\n return function(fns/*, ...args*/) {\n var args = slice(arguments, 1);\n var go = initialParams(function(args, callback) {\n var that = this;\n return eachfn(fns, function (fn, cb) {\n wrapAsync(fn).apply(that, args.concat(cb));\n }, callback);\n });\n if (args.length) {\n return go.apply(this, args);\n }\n else {\n return go;\n }\n };\n}\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Built-in value references. */\nvar Symbol$1 = root.Symbol;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag$1),\n tag = value[symToStringTag$1];\n\n try {\n value[symToStringTag$1] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag$1] = tag;\n } else {\n delete value[symToStringTag$1];\n }\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar objectProto$1 = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString$1 = objectProto$1.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString$1.call(value);\n}\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]';\nvar undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]';\nvar funcTag = '[object Function]';\nvar genTag = '[object GeneratorFunction]';\nvar proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n// A temporary value used to identify if the loop should be broken.\n// See #1064, #1293\nvar breakLoop = {};\n\n/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nfunction once(fn) {\n return function () {\n if (fn === null) return;\n var callFn = fn;\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\nvar iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator;\n\nvar getIterator = function (coll) {\n return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol]();\n};\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/** Used for built-in method references. */\nvar objectProto$3 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$2 = objectProto$3.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto$3.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER$1 = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER$1 : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/** `Object#toString` result references. */\nvar argsTag$1 = '[object Arguments]';\nvar arrayTag = '[object Array]';\nvar boolTag = '[object Boolean]';\nvar dateTag = '[object Date]';\nvar errorTag = '[object Error]';\nvar funcTag$1 = '[object Function]';\nvar mapTag = '[object Map]';\nvar numberTag = '[object Number]';\nvar objectTag = '[object Object]';\nvar regexpTag = '[object RegExp]';\nvar setTag = '[object Set]';\nvar stringTag = '[object String]';\nvar weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]';\nvar dataViewTag = '[object DataView]';\nvar float32Tag = '[object Float32Array]';\nvar float64Tag = '[object Float64Array]';\nvar int8Tag = '[object Int8Array]';\nvar int16Tag = '[object Int16Array]';\nvar int32Tag = '[object Int32Array]';\nvar uint8Tag = '[object Uint8Array]';\nvar uint8ClampedTag = '[object Uint8ClampedArray]';\nvar uint16Tag = '[object Uint16Array]';\nvar uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag$1] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/** Detect free variable `exports`. */\nvar freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports$1 && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/** Used for built-in method references. */\nvar objectProto$2 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$1 = objectProto$2.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty$1.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar objectProto$5 = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;\n\n return value === proto;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\n/** Used for built-in method references. */\nvar objectProto$4 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$3 = objectProto$4.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty$3.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nfunction createArrayIterator(coll) {\n var i = -1;\n var len = coll.length;\n return function next() {\n return ++i < len ? {value: coll[i], key: i} : null;\n }\n}\n\nfunction createES2015Iterator(iterator) {\n var i = -1;\n return function next() {\n var item = iterator.next();\n if (item.done)\n return null;\n i++;\n return {value: item.value, key: i};\n }\n}\n\nfunction createObjectIterator(obj) {\n var okeys = keys(obj);\n var i = -1;\n var len = okeys.length;\n return function next() {\n var key = okeys[++i];\n if (key === '__proto__') {\n return next();\n }\n return i < len ? {value: obj[key], key: key} : null;\n };\n}\n\nfunction iterator(coll) {\n if (isArrayLike(coll)) {\n return createArrayIterator(coll);\n }\n\n var iterator = getIterator(coll);\n return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll);\n}\n\nfunction onlyOnce(fn) {\n return function() {\n if (fn === null) throw new Error(\"Callback was already called.\");\n var callFn = fn;\n fn = null;\n callFn.apply(this, arguments);\n };\n}\n\nfunction _eachOfLimit(limit) {\n return function (obj, iteratee, callback) {\n callback = once(callback || noop);\n if (limit <= 0 || !obj) {\n return callback(null);\n }\n var nextElem = iterator(obj);\n var done = false;\n var running = 0;\n var looping = false;\n\n function iterateeCallback(err, value) {\n running -= 1;\n if (err) {\n done = true;\n callback(err);\n }\n else if (value === breakLoop || (done && running <= 0)) {\n done = true;\n return callback(null);\n }\n else if (!looping) {\n replenish();\n }\n }\n\n function replenish () {\n looping = true;\n while (running < limit && !done) {\n var elem = nextElem();\n if (elem === null) {\n done = true;\n if (running <= 0) {\n callback(null);\n }\n return;\n }\n running += 1;\n iteratee(elem.value, elem.key, onlyOnce(iterateeCallback));\n }\n looping = false;\n }\n\n replenish();\n };\n}\n\n/**\n * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name eachOfLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.eachOf]{@link module:Collections.eachOf}\n * @alias forEachOfLimit\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async function to apply to each\n * item in `coll`. The `key` is the item's key, or index in the case of an\n * array.\n * Invoked with (item, key, callback).\n * @param {Function} [callback] - A callback which is called when all\n * `iteratee` functions have finished, or an error occurs. Invoked with (err).\n */\nfunction eachOfLimit(coll, limit, iteratee, callback) {\n _eachOfLimit(limit)(coll, wrapAsync(iteratee), callback);\n}\n\nfunction doLimit(fn, limit) {\n return function (iterable, iteratee, callback) {\n return fn(iterable, limit, iteratee, callback);\n };\n}\n\n// eachOf implementation optimized for array-likes\nfunction eachOfArrayLike(coll, iteratee, callback) {\n callback = once(callback || noop);\n var index = 0,\n completed = 0,\n length = coll.length;\n if (length === 0) {\n callback(null);\n }\n\n function iteratorCallback(err, value) {\n if (err) {\n callback(err);\n } else if ((++completed === length) || value === breakLoop) {\n callback(null);\n }\n }\n\n for (; index < length; index++) {\n iteratee(coll[index], index, onlyOnce(iteratorCallback));\n }\n}\n\n// a generic version of eachOf which can handle array, object, and iterator cases.\nvar eachOfGeneric = doLimit(eachOfLimit, Infinity);\n\n/**\n * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument\n * to the iteratee.\n *\n * @name eachOf\n * @static\n * @memberOf module:Collections\n * @method\n * @alias forEachOf\n * @category Collection\n * @see [async.each]{@link module:Collections.each}\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A function to apply to each\n * item in `coll`.\n * The `key` is the item's key, or index in the case of an array.\n * Invoked with (item, key, callback).\n * @param {Function} [callback] - A callback which is called when all\n * `iteratee` functions have finished, or an error occurs. Invoked with (err).\n * @example\n *\n * var obj = {dev: \"/dev.json\", test: \"/test.json\", prod: \"/prod.json\"};\n * var configs = {};\n *\n * async.forEachOf(obj, function (value, key, callback) {\n * fs.readFile(__dirname + value, \"utf8\", function (err, data) {\n * if (err) return callback(err);\n * try {\n * configs[key] = JSON.parse(data);\n * } catch (e) {\n * return callback(e);\n * }\n * callback();\n * });\n * }, function (err) {\n * if (err) console.error(err.message);\n * // configs is now a map of JSON data\n * doSomethingWith(configs);\n * });\n */\nvar eachOf = function(coll, iteratee, callback) {\n var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric;\n eachOfImplementation(coll, wrapAsync(iteratee), callback);\n};\n\nfunction doParallel(fn) {\n return function (obj, iteratee, callback) {\n return fn(eachOf, obj, wrapAsync(iteratee), callback);\n };\n}\n\nfunction _asyncMap(eachfn, arr, iteratee, callback) {\n callback = callback || noop;\n arr = arr || [];\n var results = [];\n var counter = 0;\n var _iteratee = wrapAsync(iteratee);\n\n eachfn(arr, function (value, _, callback) {\n var index = counter++;\n _iteratee(value, function (err, v) {\n results[index] = v;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n}\n\n/**\n * Produces a new collection of values by mapping each value in `coll` through\n * the `iteratee` function. The `iteratee` is called with an item from `coll`\n * and a callback for when it has finished processing. Each of these callback\n * takes 2 arguments: an `error`, and the transformed item from `coll`. If\n * `iteratee` passes an error to its callback, the main `callback` (for the\n * `map` function) is immediately called with the error.\n *\n * Note, that since this function applies the `iteratee` to each item in\n * parallel, there is no guarantee that the `iteratee` functions will complete\n * in order. However, the results array will be in the same order as the\n * original `coll`.\n *\n * If `map` is passed an Object, the results will be an Array. The results\n * will roughly be in the order of the original Objects' keys (but this can\n * vary across JavaScript engines).\n *\n * @name map\n * @static\n * @memberOf module:Collections\n * @method\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with the transformed item.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Results is an Array of the\n * transformed items from the `coll`. Invoked with (err, results).\n * @example\n *\n * async.map(['file1','file2','file3'], fs.stat, function(err, results) {\n * // results is now an array of stats for each file\n * });\n */\nvar map = doParallel(_asyncMap);\n\n/**\n * Applies the provided arguments to each function in the array, calling\n * `callback` after all functions have completed. If you only provide the first\n * argument, `fns`, then it will return a function which lets you pass in the\n * arguments as if it were a single function call. If more arguments are\n * provided, `callback` is required while `args` is still optional.\n *\n * @name applyEach\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s\n * to all call with the same arguments\n * @param {...*} [args] - any number of separate arguments to pass to the\n * function.\n * @param {Function} [callback] - the final argument should be the callback,\n * called when all functions have completed processing.\n * @returns {Function} - If only the first argument, `fns`, is provided, it will\n * return a function which lets you pass in the arguments as if it were a single\n * function call. The signature is `(..args, callback)`. If invoked with any\n * arguments, `callback` is required.\n * @example\n *\n * async.applyEach([enableSearch, updateSchema], 'bucket', callback);\n *\n * // partial application example:\n * async.each(\n * buckets,\n * async.applyEach([enableSearch, updateSchema]),\n * callback\n * );\n */\nvar applyEach = applyEach$1(map);\n\nfunction doParallelLimit(fn) {\n return function (obj, limit, iteratee, callback) {\n return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback);\n };\n}\n\n/**\n * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time.\n *\n * @name mapLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.map]{@link module:Collections.map}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with the transformed item.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Results is an array of the\n * transformed items from the `coll`. Invoked with (err, results).\n */\nvar mapLimit = doParallelLimit(_asyncMap);\n\n/**\n * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time.\n *\n * @name mapSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.map]{@link module:Collections.map}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with the transformed item.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Results is an array of the\n * transformed items from the `coll`. Invoked with (err, results).\n */\nvar mapSeries = doLimit(mapLimit, 1);\n\n/**\n * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.\n *\n * @name applyEachSeries\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.applyEach]{@link module:ControlFlow.applyEach}\n * @category Control Flow\n * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all\n * call with the same arguments\n * @param {...*} [args] - any number of separate arguments to pass to the\n * function.\n * @param {Function} [callback] - the final argument should be the callback,\n * called when all functions have completed processing.\n * @returns {Function} - If only the first argument is provided, it will return\n * a function which lets you pass in the arguments as if it were a single\n * function call.\n */\nvar applyEachSeries = applyEach$1(mapSeries);\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\n/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\n/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\n/**\n * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on\n * their requirements. Each function can optionally depend on other functions\n * being completed first, and each function is run as soon as its requirements\n * are satisfied.\n *\n * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence\n * will stop. Further tasks will not execute (so any other functions depending\n * on it will not run), and the main `callback` is immediately called with the\n * error.\n *\n * {@link AsyncFunction}s also receive an object containing the results of functions which\n * have completed so far as the first argument, if they have dependencies. If a\n * task function has no dependencies, it will only be passed a callback.\n *\n * @name auto\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Object} tasks - An object. Each of its properties is either a\n * function or an array of requirements, with the {@link AsyncFunction} itself the last item\n * in the array. The object's key of a property serves as the name of the task\n * defined by that property, i.e. can be used when specifying requirements for\n * other tasks. The function receives one or two arguments:\n * * a `results` object, containing the results of the previously executed\n * functions, only passed if the task has any dependencies,\n * * a `callback(err, result)` function, which must be called when finished,\n * passing an `error` (which can be `null`) and the result of the function's\n * execution.\n * @param {number} [concurrency=Infinity] - An optional `integer` for\n * determining the maximum number of tasks that can be run in parallel. By\n * default, as many as possible.\n * @param {Function} [callback] - An optional callback which is called when all\n * the tasks have been completed. It receives the `err` argument if any `tasks`\n * pass an error to their callback. Results are always returned; however, if an\n * error occurs, no further `tasks` will be performed, and the results object\n * will only contain partial results. Invoked with (err, results).\n * @returns undefined\n * @example\n *\n * async.auto({\n * // this function will just be passed a callback\n * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'),\n * showData: ['readData', function(results, cb) {\n * // results.readData is the file's contents\n * // ...\n * }]\n * }, callback);\n *\n * async.auto({\n * get_data: function(callback) {\n * console.log('in get_data');\n * // async code to get some data\n * callback(null, 'data', 'converted to array');\n * },\n * make_folder: function(callback) {\n * console.log('in make_folder');\n * // async code to create a directory to store a file in\n * // this is run at the same time as getting the data\n * callback(null, 'folder');\n * },\n * write_file: ['get_data', 'make_folder', function(results, callback) {\n * console.log('in write_file', JSON.stringify(results));\n * // once there is some data and the directory exists,\n * // write the data to a file in the directory\n * callback(null, 'filename');\n * }],\n * email_link: ['write_file', function(results, callback) {\n * console.log('in email_link', JSON.stringify(results));\n * // once the file is written let's email a link to it...\n * // results.write_file contains the filename returned by write_file.\n * callback(null, {'file':results.write_file, 'email':'user@example.com'});\n * }]\n * }, function(err, results) {\n * console.log('err = ', err);\n * console.log('results = ', results);\n * });\n */\nvar auto = function (tasks, concurrency, callback) {\n if (typeof concurrency === 'function') {\n // concurrency is optional, shift the args.\n callback = concurrency;\n concurrency = null;\n }\n callback = once(callback || noop);\n var keys$$1 = keys(tasks);\n var numTasks = keys$$1.length;\n if (!numTasks) {\n return callback(null);\n }\n if (!concurrency) {\n concurrency = numTasks;\n }\n\n var results = {};\n var runningTasks = 0;\n var hasError = false;\n\n var listeners = Object.create(null);\n\n var readyTasks = [];\n\n // for cycle detection:\n var readyToCheck = []; // tasks that have been identified as reachable\n // without the possibility of returning to an ancestor task\n var uncheckedDependencies = {};\n\n baseForOwn(tasks, function (task, key) {\n if (!isArray(task)) {\n // no dependencies\n enqueueTask(key, [task]);\n readyToCheck.push(key);\n return;\n }\n\n var dependencies = task.slice(0, task.length - 1);\n var remainingDependencies = dependencies.length;\n if (remainingDependencies === 0) {\n enqueueTask(key, task);\n readyToCheck.push(key);\n return;\n }\n uncheckedDependencies[key] = remainingDependencies;\n\n arrayEach(dependencies, function (dependencyName) {\n if (!tasks[dependencyName]) {\n throw new Error('async.auto task `' + key +\n '` has a non-existent dependency `' +\n dependencyName + '` in ' +\n dependencies.join(', '));\n }\n addListener(dependencyName, function () {\n remainingDependencies--;\n if (remainingDependencies === 0) {\n enqueueTask(key, task);\n }\n });\n });\n });\n\n checkForDeadlocks();\n processQueue();\n\n function enqueueTask(key, task) {\n readyTasks.push(function () {\n runTask(key, task);\n });\n }\n\n function processQueue() {\n if (readyTasks.length === 0 && runningTasks === 0) {\n return callback(null, results);\n }\n while(readyTasks.length && runningTasks < concurrency) {\n var run = readyTasks.shift();\n run();\n }\n\n }\n\n function addListener(taskName, fn) {\n var taskListeners = listeners[taskName];\n if (!taskListeners) {\n taskListeners = listeners[taskName] = [];\n }\n\n taskListeners.push(fn);\n }\n\n function taskComplete(taskName) {\n var taskListeners = listeners[taskName] || [];\n arrayEach(taskListeners, function (fn) {\n fn();\n });\n processQueue();\n }\n\n\n function runTask(key, task) {\n if (hasError) return;\n\n var taskCallback = onlyOnce(function(err, result) {\n runningTasks--;\n if (arguments.length > 2) {\n result = slice(arguments, 1);\n }\n if (err) {\n var safeResults = {};\n baseForOwn(results, function(val, rkey) {\n safeResults[rkey] = val;\n });\n safeResults[key] = result;\n hasError = true;\n listeners = Object.create(null);\n\n callback(err, safeResults);\n } else {\n results[key] = result;\n taskComplete(key);\n }\n });\n\n runningTasks++;\n var taskFn = wrapAsync(task[task.length - 1]);\n if (task.length > 1) {\n taskFn(results, taskCallback);\n } else {\n taskFn(taskCallback);\n }\n }\n\n function checkForDeadlocks() {\n // Kahn's algorithm\n // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm\n // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html\n var currentTask;\n var counter = 0;\n while (readyToCheck.length) {\n currentTask = readyToCheck.pop();\n counter++;\n arrayEach(getDependents(currentTask), function (dependent) {\n if (--uncheckedDependencies[dependent] === 0) {\n readyToCheck.push(dependent);\n }\n });\n }\n\n if (counter !== numTasks) {\n throw new Error(\n 'async.auto cannot execute tasks due to a recursive dependency'\n );\n }\n }\n\n function getDependents(taskName) {\n var result = [];\n baseForOwn(tasks, function (task, key) {\n if (isArray(task) && baseIndexOf(task, taskName, 0) >= 0) {\n result.push(key);\n }\n });\n return result;\n }\n};\n\n/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol$1 ? Symbol$1.prototype : undefined;\nvar symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\n/**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\nfunction castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n}\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the last unmatched string symbol.\n */\nfunction charsEndIndex(strSymbols, chrSymbols) {\n var index = strSymbols.length;\n\n while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n}\n\n/**\n * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the first unmatched string symbol.\n */\nfunction charsStartIndex(strSymbols, chrSymbols) {\n var index = -1,\n length = strSymbols.length;\n\n while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n}\n\n/**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction asciiToArray(string) {\n return string.split('');\n}\n\n/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff';\nvar rsComboMarksRange = '\\\\u0300-\\\\u036f';\nvar reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f';\nvar rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff';\nvar rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;\nvar rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\n/** Used to compose unicode character classes. */\nvar rsAstralRange$1 = '\\\\ud800-\\\\udfff';\nvar rsComboMarksRange$1 = '\\\\u0300-\\\\u036f';\nvar reComboHalfMarksRange$1 = '\\\\ufe20-\\\\ufe2f';\nvar rsComboSymbolsRange$1 = '\\\\u20d0-\\\\u20ff';\nvar rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;\nvar rsVarRange$1 = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange$1 + ']';\nvar rsCombo = '[' + rsComboRange$1 + ']';\nvar rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]';\nvar rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';\nvar rsNonAstral = '[^' + rsAstralRange$1 + ']';\nvar rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}';\nvar rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]';\nvar rsZWJ$1 = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?';\nvar rsOptVar = '[' + rsVarRange$1 + ']?';\nvar rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';\nvar rsSeq = rsOptVar + reOptMod + rsOptJoin;\nvar rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction unicodeToArray(string) {\n return string.match(reUnicode) || [];\n}\n\n/**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n}\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/**\n * Removes leading and trailing whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trim(' abc ');\n * // => 'abc'\n *\n * _.trim('-_-abc-_-', '_-');\n * // => 'abc'\n *\n * _.map([' foo ', ' bar '], _.trim);\n * // => ['foo', 'bar']\n */\nfunction trim(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined)) {\n return string.replace(reTrim, '');\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n chrSymbols = stringToArray(chars),\n start = charsStartIndex(strSymbols, chrSymbols),\n end = charsEndIndex(strSymbols, chrSymbols) + 1;\n\n return castSlice(strSymbols, start, end).join('');\n}\n\nvar FN_ARGS = /^(?:async\\s+)?(function)?\\s*[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /(=.+)?(\\s*)$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\n\nfunction parseParams(func) {\n func = func.toString().replace(STRIP_COMMENTS, '');\n func = func.match(FN_ARGS)[2].replace(' ', '');\n func = func ? func.split(FN_ARG_SPLIT) : [];\n func = func.map(function (arg){\n return trim(arg.replace(FN_ARG, ''));\n });\n return func;\n}\n\n/**\n * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent\n * tasks are specified as parameters to the function, after the usual callback\n * parameter, with the parameter names matching the names of the tasks it\n * depends on. This can provide even more readable task graphs which can be\n * easier to maintain.\n *\n * If a final callback is specified, the task results are similarly injected,\n * specified as named parameters after the initial error parameter.\n *\n * The autoInject function is purely syntactic sugar and its semantics are\n * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.\n *\n * @name autoInject\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.auto]{@link module:ControlFlow.auto}\n * @category Control Flow\n * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of\n * the form 'func([dependencies...], callback). The object's key of a property\n * serves as the name of the task defined by that property, i.e. can be used\n * when specifying requirements for other tasks.\n * * The `callback` parameter is a `callback(err, result)` which must be called\n * when finished, passing an `error` (which can be `null`) and the result of\n * the function's execution. The remaining parameters name other tasks on\n * which the task is dependent, and the results from those tasks are the\n * arguments of those parameters.\n * @param {Function} [callback] - An optional callback which is called when all\n * the tasks have been completed. It receives the `err` argument if any `tasks`\n * pass an error to their callback, and a `results` object with any completed\n * task results, similar to `auto`.\n * @example\n *\n * // The example from `auto` can be rewritten as follows:\n * async.autoInject({\n * get_data: function(callback) {\n * // async code to get some data\n * callback(null, 'data', 'converted to array');\n * },\n * make_folder: function(callback) {\n * // async code to create a directory to store a file in\n * // this is run at the same time as getting the data\n * callback(null, 'folder');\n * },\n * write_file: function(get_data, make_folder, callback) {\n * // once there is some data and the directory exists,\n * // write the data to a file in the directory\n * callback(null, 'filename');\n * },\n * email_link: function(write_file, callback) {\n * // once the file is written let's email a link to it...\n * // write_file contains the filename returned by write_file.\n * callback(null, {'file':write_file, 'email':'user@example.com'});\n * }\n * }, function(err, results) {\n * console.log('err = ', err);\n * console.log('email_link = ', results.email_link);\n * });\n *\n * // If you are using a JS minifier that mangles parameter names, `autoInject`\n * // will not work with plain functions, since the parameter names will be\n * // collapsed to a single letter identifier. To work around this, you can\n * // explicitly specify the names of the parameters your task function needs\n * // in an array, similar to Angular.js dependency injection.\n *\n * // This still has an advantage over plain `auto`, since the results a task\n * // depends on are still spread into arguments.\n * async.autoInject({\n * //...\n * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {\n * callback(null, 'filename');\n * }],\n * email_link: ['write_file', function(write_file, callback) {\n * callback(null, {'file':write_file, 'email':'user@example.com'});\n * }]\n * //...\n * }, function(err, results) {\n * console.log('err = ', err);\n * console.log('email_link = ', results.email_link);\n * });\n */\nfunction autoInject(tasks, callback) {\n var newTasks = {};\n\n baseForOwn(tasks, function (taskFn, key) {\n var params;\n var fnIsAsync = isAsync(taskFn);\n var hasNoDeps =\n (!fnIsAsync && taskFn.length === 1) ||\n (fnIsAsync && taskFn.length === 0);\n\n if (isArray(taskFn)) {\n params = taskFn.slice(0, -1);\n taskFn = taskFn[taskFn.length - 1];\n\n newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);\n } else if (hasNoDeps) {\n // no dependencies, use the function as-is\n newTasks[key] = taskFn;\n } else {\n params = parseParams(taskFn);\n if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {\n throw new Error(\"autoInject task functions require explicit parameters.\");\n }\n\n // remove callback param\n if (!fnIsAsync) params.pop();\n\n newTasks[key] = params.concat(newTask);\n }\n\n function newTask(results, taskCb) {\n var newArgs = arrayMap(params, function (name) {\n return results[name];\n });\n newArgs.push(taskCb);\n wrapAsync(taskFn).apply(null, newArgs);\n }\n });\n\n auto(newTasks, callback);\n}\n\n// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation\n// used for queues. This implementation assumes that the node provided by the user can be modified\n// to adjust the next and last properties. We implement only the minimal functionality\n// for queue support.\nfunction DLL() {\n this.head = this.tail = null;\n this.length = 0;\n}\n\nfunction setInitial(dll, node) {\n dll.length = 1;\n dll.head = dll.tail = node;\n}\n\nDLL.prototype.removeLink = function(node) {\n if (node.prev) node.prev.next = node.next;\n else this.head = node.next;\n if (node.next) node.next.prev = node.prev;\n else this.tail = node.prev;\n\n node.prev = node.next = null;\n this.length -= 1;\n return node;\n};\n\nDLL.prototype.empty = function () {\n while(this.head) this.shift();\n return this;\n};\n\nDLL.prototype.insertAfter = function(node, newNode) {\n newNode.prev = node;\n newNode.next = node.next;\n if (node.next) node.next.prev = newNode;\n else this.tail = newNode;\n node.next = newNode;\n this.length += 1;\n};\n\nDLL.prototype.insertBefore = function(node, newNode) {\n newNode.prev = node.prev;\n newNode.next = node;\n if (node.prev) node.prev.next = newNode;\n else this.head = newNode;\n node.prev = newNode;\n this.length += 1;\n};\n\nDLL.prototype.unshift = function(node) {\n if (this.head) this.insertBefore(this.head, node);\n else setInitial(this, node);\n};\n\nDLL.prototype.push = function(node) {\n if (this.tail) this.insertAfter(this.tail, node);\n else setInitial(this, node);\n};\n\nDLL.prototype.shift = function() {\n return this.head && this.removeLink(this.head);\n};\n\nDLL.prototype.pop = function() {\n return this.tail && this.removeLink(this.tail);\n};\n\nDLL.prototype.toArray = function () {\n var arr = Array(this.length);\n var curr = this.head;\n for(var idx = 0; idx < this.length; idx++) {\n arr[idx] = curr.data;\n curr = curr.next;\n }\n return arr;\n};\n\nDLL.prototype.remove = function (testFn) {\n var curr = this.head;\n while(!!curr) {\n var next = curr.next;\n if (testFn(curr)) {\n this.removeLink(curr);\n }\n curr = next;\n }\n return this;\n};\n\nfunction queue(worker, concurrency, payload) {\n if (concurrency == null) {\n concurrency = 1;\n }\n else if(concurrency === 0) {\n throw new Error('Concurrency must not be zero');\n }\n\n var _worker = wrapAsync(worker);\n var numRunning = 0;\n var workersList = [];\n\n var processingScheduled = false;\n function _insert(data, insertAtFront, callback) {\n if (callback != null && typeof callback !== 'function') {\n throw new Error('task callback must be a function');\n }\n q.started = true;\n if (!isArray(data)) {\n data = [data];\n }\n if (data.length === 0 && q.idle()) {\n // call drain immediately if there are no tasks\n return setImmediate$1(function() {\n q.drain();\n });\n }\n\n for (var i = 0, l = data.length; i < l; i++) {\n var item = {\n data: data[i],\n callback: callback || noop\n };\n\n if (insertAtFront) {\n q._tasks.unshift(item);\n } else {\n q._tasks.push(item);\n }\n }\n\n if (!processingScheduled) {\n processingScheduled = true;\n setImmediate$1(function() {\n processingScheduled = false;\n q.process();\n });\n }\n }\n\n function _next(tasks) {\n return function(err){\n numRunning -= 1;\n\n for (var i = 0, l = tasks.length; i < l; i++) {\n var task = tasks[i];\n\n var index = baseIndexOf(workersList, task, 0);\n if (index === 0) {\n workersList.shift();\n } else if (index > 0) {\n workersList.splice(index, 1);\n }\n\n task.callback.apply(task, arguments);\n\n if (err != null) {\n q.error(err, task.data);\n }\n }\n\n if (numRunning <= (q.concurrency - q.buffer) ) {\n q.unsaturated();\n }\n\n if (q.idle()) {\n q.drain();\n }\n q.process();\n };\n }\n\n var isProcessing = false;\n var q = {\n _tasks: new DLL(),\n concurrency: concurrency,\n payload: payload,\n saturated: noop,\n unsaturated:noop,\n buffer: concurrency / 4,\n empty: noop,\n drain: noop,\n error: noop,\n started: false,\n paused: false,\n push: function (data, callback) {\n _insert(data, false, callback);\n },\n kill: function () {\n q.drain = noop;\n q._tasks.empty();\n },\n unshift: function (data, callback) {\n _insert(data, true, callback);\n },\n remove: function (testFn) {\n q._tasks.remove(testFn);\n },\n process: function () {\n // Avoid trying to start too many processing operations. This can occur\n // when callbacks resolve synchronously (#1267).\n if (isProcessing) {\n return;\n }\n isProcessing = true;\n while(!q.paused && numRunning < q.concurrency && q._tasks.length){\n var tasks = [], data = [];\n var l = q._tasks.length;\n if (q.payload) l = Math.min(l, q.payload);\n for (var i = 0; i < l; i++) {\n var node = q._tasks.shift();\n tasks.push(node);\n workersList.push(node);\n data.push(node.data);\n }\n\n numRunning += 1;\n\n if (q._tasks.length === 0) {\n q.empty();\n }\n\n if (numRunning === q.concurrency) {\n q.saturated();\n }\n\n var cb = onlyOnce(_next(tasks));\n _worker(data, cb);\n }\n isProcessing = false;\n },\n length: function () {\n return q._tasks.length;\n },\n running: function () {\n return numRunning;\n },\n workersList: function () {\n return workersList;\n },\n idle: function() {\n return q._tasks.length + numRunning === 0;\n },\n pause: function () {\n q.paused = true;\n },\n resume: function () {\n if (q.paused === false) { return; }\n q.paused = false;\n setImmediate$1(q.process);\n }\n };\n return q;\n}\n\n/**\n * A cargo of tasks for the worker function to complete. Cargo inherits all of\n * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}.\n * @typedef {Object} CargoObject\n * @memberOf module:ControlFlow\n * @property {Function} length - A function returning the number of items\n * waiting to be processed. Invoke like `cargo.length()`.\n * @property {number} payload - An `integer` for determining how many tasks\n * should be process per round. This property can be changed after a `cargo` is\n * created to alter the payload on-the-fly.\n * @property {Function} push - Adds `task` to the `queue`. The callback is\n * called once the `worker` has finished processing the task. Instead of a\n * single task, an array of `tasks` can be submitted. The respective callback is\n * used for every task in the list. Invoke like `cargo.push(task, [callback])`.\n * @property {Function} saturated - A callback that is called when the\n * `queue.length()` hits the concurrency and further tasks will be queued.\n * @property {Function} empty - A callback that is called when the last item\n * from the `queue` is given to a `worker`.\n * @property {Function} drain - A callback that is called when the last item\n * from the `queue` has returned from the `worker`.\n * @property {Function} idle - a function returning false if there are items\n * waiting or being processed, or true if not. Invoke like `cargo.idle()`.\n * @property {Function} pause - a function that pauses the processing of tasks\n * until `resume()` is called. Invoke like `cargo.pause()`.\n * @property {Function} resume - a function that resumes the processing of\n * queued tasks when the queue is paused. Invoke like `cargo.resume()`.\n * @property {Function} kill - a function that removes the `drain` callback and\n * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`.\n */\n\n/**\n * Creates a `cargo` object with the specified payload. Tasks added to the\n * cargo will be processed altogether (up to the `payload` limit). If the\n * `worker` is in progress, the task is queued until it becomes available. Once\n * the `worker` has completed some tasks, each callback of those tasks is\n * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)\n * for how `cargo` and `queue` work.\n *\n * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers\n * at a time, cargo passes an array of tasks to a single worker, repeating\n * when the worker is finished.\n *\n * @name cargo\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.queue]{@link module:ControlFlow.queue}\n * @category Control Flow\n * @param {AsyncFunction} worker - An asynchronous function for processing an array\n * of queued tasks. Invoked with `(tasks, callback)`.\n * @param {number} [payload=Infinity] - An optional `integer` for determining\n * how many tasks should be processed per round; if omitted, the default is\n * unlimited.\n * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can\n * attached as certain properties to listen for specific events during the\n * lifecycle of the cargo and inner queue.\n * @example\n *\n * // create a cargo object with payload 2\n * var cargo = async.cargo(function(tasks, callback) {\n * for (var i=0; i<tasks.length; i++) {\n * console.log('hello ' + tasks[i].name);\n * }\n * callback();\n * }, 2);\n *\n * // add some items\n * cargo.push({name: 'foo'}, function(err) {\n * console.log('finished processing foo');\n * });\n * cargo.push({name: 'bar'}, function(err) {\n * console.log('finished processing bar');\n * });\n * cargo.push({name: 'baz'}, function(err) {\n * console.log('finished processing baz');\n * });\n */\nfunction cargo(worker, payload) {\n return queue(worker, 1, payload);\n}\n\n/**\n * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.\n *\n * @name eachOfSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.eachOf]{@link module:Collections.eachOf}\n * @alias forEachOfSeries\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * Invoked with (item, key, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Invoked with (err).\n */\nvar eachOfSeries = doLimit(eachOfLimit, 1);\n\n/**\n * Reduces `coll` into a single value using an async `iteratee` to return each\n * successive step. `memo` is the initial state of the reduction. This function\n * only operates in series.\n *\n * For performance reasons, it may make sense to split a call to this function\n * into a parallel map, and then use the normal `Array.prototype.reduce` on the\n * results. This function is for situations where each step in the reduction\n * needs to be async; if you can get the data before reducing it, then it's\n * probably a good idea to do so.\n *\n * @name reduce\n * @static\n * @memberOf module:Collections\n * @method\n * @alias inject\n * @alias foldl\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {*} memo - The initial state of the reduction.\n * @param {AsyncFunction} iteratee - A function applied to each item in the\n * array to produce the next step in the reduction.\n * The `iteratee` should complete with the next state of the reduction.\n * If the iteratee complete with an error, the reduction is stopped and the\n * main `callback` is immediately called with the error.\n * Invoked with (memo, item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Result is the reduced value. Invoked with\n * (err, result).\n * @example\n *\n * async.reduce([1,2,3], 0, function(memo, item, callback) {\n * // pointless async:\n * process.nextTick(function() {\n * callback(null, memo + item)\n * });\n * }, function(err, result) {\n * // result is now equal to the last value of memo, which is 6\n * });\n */\nfunction reduce(coll, memo, iteratee, callback) {\n callback = once(callback || noop);\n var _iteratee = wrapAsync(iteratee);\n eachOfSeries(coll, function(x, i, callback) {\n _iteratee(memo, x, function(err, v) {\n memo = v;\n callback(err);\n });\n }, function(err) {\n callback(err, memo);\n });\n}\n\n/**\n * Version of the compose function that is more natural to read. Each function\n * consumes the return value of the previous function. It is the equivalent of\n * [compose]{@link module:ControlFlow.compose} with the arguments reversed.\n *\n * Each function is executed with the `this` binding of the composed function.\n *\n * @name seq\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.compose]{@link module:ControlFlow.compose}\n * @category Control Flow\n * @param {...AsyncFunction} functions - the asynchronous functions to compose\n * @returns {Function} a function that composes the `functions` in order\n * @example\n *\n * // Requires lodash (or underscore), express3 and dresende's orm2.\n * // Part of an app, that fetches cats of the logged user.\n * // This example uses `seq` function to avoid overnesting and error\n * // handling clutter.\n * app.get('/cats', function(request, response) {\n * var User = request.models.User;\n * async.seq(\n * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))\n * function(user, fn) {\n * user.getCats(fn); // 'getCats' has signature (callback(err, data))\n * }\n * )(req.session.user_id, function (err, cats) {\n * if (err) {\n * console.error(err);\n * response.json({ status: 'error', message: err.message });\n * } else {\n * response.json({ status: 'ok', message: 'Cats found', data: cats });\n * }\n * });\n * });\n */\nfunction seq(/*...functions*/) {\n var _functions = arrayMap(arguments, wrapAsync);\n return function(/*...args*/) {\n var args = slice(arguments);\n var that = this;\n\n var cb = args[args.length - 1];\n if (typeof cb == 'function') {\n args.pop();\n } else {\n cb = noop;\n }\n\n reduce(_functions, args, function(newargs, fn, cb) {\n fn.apply(that, newargs.concat(function(err/*, ...nextargs*/) {\n var nextargs = slice(arguments, 1);\n cb(err, nextargs);\n }));\n },\n function(err, results) {\n cb.apply(that, [err].concat(results));\n });\n };\n}\n\n/**\n * Creates a function which is a composition of the passed asynchronous\n * functions. Each function consumes the return value of the function that\n * follows. Composing functions `f()`, `g()`, and `h()` would produce the result\n * of `f(g(h()))`, only this version uses callbacks to obtain the return values.\n *\n * Each function is executed with the `this` binding of the composed function.\n *\n * @name compose\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {...AsyncFunction} functions - the asynchronous functions to compose\n * @returns {Function} an asynchronous function that is the composed\n * asynchronous `functions`\n * @example\n *\n * function add1(n, callback) {\n * setTimeout(function () {\n * callback(null, n + 1);\n * }, 10);\n * }\n *\n * function mul3(n, callback) {\n * setTimeout(function () {\n * callback(null, n * 3);\n * }, 10);\n * }\n *\n * var add1mul3 = async.compose(mul3, add1);\n * add1mul3(4, function (err, result) {\n * // result now equals 15\n * });\n */\nvar compose = function(/*...args*/) {\n return seq.apply(null, slice(arguments).reverse());\n};\n\nvar _concat = Array.prototype.concat;\n\n/**\n * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.\n *\n * @name concatLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.concat]{@link module:Collections.concat}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,\n * which should use an array as its result. Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished, or an error occurs. Results is an array\n * containing the concatenated results of the `iteratee` function. Invoked with\n * (err, results).\n */\nvar concatLimit = function(coll, limit, iteratee, callback) {\n callback = callback || noop;\n var _iteratee = wrapAsync(iteratee);\n mapLimit(coll, limit, function(val, callback) {\n _iteratee(val, function(err /*, ...args*/) {\n if (err) return callback(err);\n return callback(null, slice(arguments, 1));\n });\n }, function(err, mapResults) {\n var result = [];\n for (var i = 0; i < mapResults.length; i++) {\n if (mapResults[i]) {\n result = _concat.apply(result, mapResults[i]);\n }\n }\n\n return callback(err, result);\n });\n};\n\n/**\n * Applies `iteratee` to each item in `coll`, concatenating the results. Returns\n * the concatenated list. The `iteratee`s are called in parallel, and the\n * results are concatenated as they return. There is no guarantee that the\n * results array will be returned in the original order of `coll` passed to the\n * `iteratee` function.\n *\n * @name concat\n * @static\n * @memberOf module:Collections\n * @method\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,\n * which should use an array as its result. Invoked with (item, callback).\n * @param {Function} [callback(err)] - A callback which is called after all the\n * `iteratee` functions have finished, or an error occurs. Results is an array\n * containing the concatenated results of the `iteratee` function. Invoked with\n * (err, results).\n * @example\n *\n * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) {\n * // files is now a list of filenames that exist in the 3 directories\n * });\n */\nvar concat = doLimit(concatLimit, Infinity);\n\n/**\n * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.\n *\n * @name concatSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.concat]{@link module:Collections.concat}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.\n * The iteratee should complete with an array an array of results.\n * Invoked with (item, callback).\n * @param {Function} [callback(err)] - A callback which is called after all the\n * `iteratee` functions have finished, or an error occurs. Results is an array\n * containing the concatenated results of the `iteratee` function. Invoked with\n * (err, results).\n */\nvar concatSeries = doLimit(concatLimit, 1);\n\n/**\n * Returns a function that when called, calls-back with the values provided.\n * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to\n * [`auto`]{@link module:ControlFlow.auto}.\n *\n * @name constant\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {...*} arguments... - Any number of arguments to automatically invoke\n * callback with.\n * @returns {AsyncFunction} Returns a function that when invoked, automatically\n * invokes the callback with the previous given arguments.\n * @example\n *\n * async.waterfall([\n * async.constant(42),\n * function (value, next) {\n * // value === 42\n * },\n * //...\n * ], callback);\n *\n * async.waterfall([\n * async.constant(filename, \"utf8\"),\n * fs.readFile,\n * function (fileData, next) {\n * //...\n * }\n * //...\n * ], callback);\n *\n * async.auto({\n * hostname: async.constant(\"https://server.net/\"),\n * port: findFreePort,\n * launchServer: [\"hostname\", \"port\", function (options, cb) {\n * startServer(options, cb);\n * }],\n * //...\n * }, callback);\n */\nvar constant = function(/*...values*/) {\n var values = slice(arguments);\n var args = [null].concat(values);\n return function (/*...ignoredArgs, callback*/) {\n var callback = arguments[arguments.length - 1];\n return callback.apply(this, args);\n };\n};\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nfunction _createTester(check, getResult) {\n return function(eachfn, arr, iteratee, cb) {\n cb = cb || noop;\n var testPassed = false;\n var testResult;\n eachfn(arr, function(value, _, callback) {\n iteratee(value, function(err, result) {\n if (err) {\n callback(err);\n } else if (check(result) && !testResult) {\n testPassed = true;\n testResult = getResult(true, value);\n callback(null, breakLoop);\n } else {\n callback();\n }\n });\n }, function(err) {\n if (err) {\n cb(err);\n } else {\n cb(null, testPassed ? testResult : getResult(false));\n }\n });\n };\n}\n\nfunction _findGetResult(v, x) {\n return x;\n}\n\n/**\n * Returns the first value in `coll` that passes an async truth test. The\n * `iteratee` is applied in parallel, meaning the first iteratee to return\n * `true` will fire the detect `callback` with that result. That means the\n * result might not be the first item in the original `coll` (in terms of order)\n * that passes the test.\n\n * If order within the original `coll` is important, then look at\n * [`detectSeries`]{@link module:Collections.detectSeries}.\n *\n * @name detect\n * @static\n * @memberOf module:Collections\n * @method\n * @alias find\n * @category Collections\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.\n * The iteratee must complete with a boolean value as its result.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called as soon as any\n * iteratee returns `true`, or after all the `iteratee` functions have finished.\n * Result will be the first item in the array that passes the truth test\n * (iteratee) or the value `undefined` if none passed. Invoked with\n * (err, result).\n * @example\n *\n * async.detect(['file1','file2','file3'], function(filePath, callback) {\n * fs.access(filePath, function(err) {\n * callback(null, !err)\n * });\n * }, function(err, result) {\n * // result now equals the first file in the list that exists\n * });\n */\nvar detect = doParallel(_createTester(identity, _findGetResult));\n\n/**\n * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name detectLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.detect]{@link module:Collections.detect}\n * @alias findLimit\n * @category Collections\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.\n * The iteratee must complete with a boolean value as its result.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called as soon as any\n * iteratee returns `true`, or after all the `iteratee` functions have finished.\n * Result will be the first item in the array that passes the truth test\n * (iteratee) or the value `undefined` if none passed. Invoked with\n * (err, result).\n */\nvar detectLimit = doParallelLimit(_createTester(identity, _findGetResult));\n\n/**\n * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.\n *\n * @name detectSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.detect]{@link module:Collections.detect}\n * @alias findSeries\n * @category Collections\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.\n * The iteratee must complete with a boolean value as its result.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called as soon as any\n * iteratee returns `true`, or after all the `iteratee` functions have finished.\n * Result will be the first item in the array that passes the truth test\n * (iteratee) or the value `undefined` if none passed. Invoked with\n * (err, result).\n */\nvar detectSeries = doLimit(detectLimit, 1);\n\nfunction consoleFunc(name) {\n return function (fn/*, ...args*/) {\n var args = slice(arguments, 1);\n args.push(function (err/*, ...args*/) {\n var args = slice(arguments, 1);\n if (typeof console === 'object') {\n if (err) {\n if (console.error) {\n console.error(err);\n }\n } else if (console[name]) {\n arrayEach(args, function (x) {\n console[name](x);\n });\n }\n }\n });\n wrapAsync(fn).apply(null, args);\n };\n}\n\n/**\n * Logs the result of an [`async` function]{@link AsyncFunction} to the\n * `console` using `console.dir` to display the properties of the resulting object.\n * Only works in Node.js or in browsers that support `console.dir` and\n * `console.error` (such as FF and Chrome).\n * If multiple arguments are returned from the async function,\n * `console.dir` is called on each argument in order.\n *\n * @name dir\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {AsyncFunction} function - The function you want to eventually apply\n * all arguments to.\n * @param {...*} arguments... - Any number of arguments to apply to the function.\n * @example\n *\n * // in a module\n * var hello = function(name, callback) {\n * setTimeout(function() {\n * callback(null, {hello: name});\n * }, 1000);\n * };\n *\n * // in the node repl\n * node> async.dir(hello, 'world');\n * {hello: 'world'}\n */\nvar dir = consoleFunc('dir');\n\n/**\n * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in\n * the order of operations, the arguments `test` and `fn` are switched.\n *\n * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function.\n * @name doDuring\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.during]{@link module:ControlFlow.during}\n * @category Control Flow\n * @param {AsyncFunction} fn - An async function which is called each time\n * `test` passes. Invoked with (callback).\n * @param {AsyncFunction} test - asynchronous truth test to perform before each\n * execution of `fn`. Invoked with (...args, callback), where `...args` are the\n * non-error args from the previous callback of `fn`.\n * @param {Function} [callback] - A callback which is called after the test\n * function has failed and repeated execution of `fn` has stopped. `callback`\n * will be passed an error if one occurred, otherwise `null`.\n */\nfunction doDuring(fn, test, callback) {\n callback = onlyOnce(callback || noop);\n var _fn = wrapAsync(fn);\n var _test = wrapAsync(test);\n\n function next(err/*, ...args*/) {\n if (err) return callback(err);\n var args = slice(arguments, 1);\n args.push(check);\n _test.apply(this, args);\n }\n\n function check(err, truth) {\n if (err) return callback(err);\n if (!truth) return callback(null);\n _fn(next);\n }\n\n check(null, true);\n\n}\n\n/**\n * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in\n * the order of operations, the arguments `test` and `iteratee` are switched.\n *\n * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.\n *\n * @name doWhilst\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.whilst]{@link module:ControlFlow.whilst}\n * @category Control Flow\n * @param {AsyncFunction} iteratee - A function which is called each time `test`\n * passes. Invoked with (callback).\n * @param {Function} test - synchronous truth test to perform after each\n * execution of `iteratee`. Invoked with any non-error callback results of\n * `iteratee`.\n * @param {Function} [callback] - A callback which is called after the test\n * function has failed and repeated execution of `iteratee` has stopped.\n * `callback` will be passed an error and any arguments passed to the final\n * `iteratee`'s callback. Invoked with (err, [results]);\n */\nfunction doWhilst(iteratee, test, callback) {\n callback = onlyOnce(callback || noop);\n var _iteratee = wrapAsync(iteratee);\n var next = function(err/*, ...args*/) {\n if (err) return callback(err);\n var args = slice(arguments, 1);\n if (test.apply(this, args)) return _iteratee(next);\n callback.apply(null, [null].concat(args));\n };\n _iteratee(next);\n}\n\n/**\n * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the\n * argument ordering differs from `until`.\n *\n * @name doUntil\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}\n * @category Control Flow\n * @param {AsyncFunction} iteratee - An async function which is called each time\n * `test` fails. Invoked with (callback).\n * @param {Function} test - synchronous truth test to perform after each\n * execution of `iteratee`. Invoked with any non-error callback results of\n * `iteratee`.\n * @param {Function} [callback] - A callback which is called after the test\n * function has passed and repeated execution of `iteratee` has stopped. `callback`\n * will be passed an error and any arguments passed to the final `iteratee`'s\n * callback. Invoked with (err, [results]);\n */\nfunction doUntil(iteratee, test, callback) {\n doWhilst(iteratee, function() {\n return !test.apply(this, arguments);\n }, callback);\n}\n\n/**\n * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that\n * is passed a callback in the form of `function (err, truth)`. If error is\n * passed to `test` or `fn`, the main callback is immediately called with the\n * value of the error.\n *\n * @name during\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.whilst]{@link module:ControlFlow.whilst}\n * @category Control Flow\n * @param {AsyncFunction} test - asynchronous truth test to perform before each\n * execution of `fn`. Invoked with (callback).\n * @param {AsyncFunction} fn - An async function which is called each time\n * `test` passes. Invoked with (callback).\n * @param {Function} [callback] - A callback which is called after the test\n * function has failed and repeated execution of `fn` has stopped. `callback`\n * will be passed an error, if one occurred, otherwise `null`.\n * @example\n *\n * var count = 0;\n *\n * async.during(\n * function (callback) {\n * return callback(null, count < 5);\n * },\n * function (callback) {\n * count++;\n * setTimeout(callback, 1000);\n * },\n * function (err) {\n * // 5 seconds have passed\n * }\n * );\n */\nfunction during(test, fn, callback) {\n callback = onlyOnce(callback || noop);\n var _fn = wrapAsync(fn);\n var _test = wrapAsync(test);\n\n function next(err) {\n if (err) return callback(err);\n _test(check);\n }\n\n function check(err, truth) {\n if (err) return callback(err);\n if (!truth) return callback(null);\n _fn(next);\n }\n\n _test(check);\n}\n\nfunction _withoutIndex(iteratee) {\n return function (value, index, callback) {\n return iteratee(value, callback);\n };\n}\n\n/**\n * Applies the function `iteratee` to each item in `coll`, in parallel.\n * The `iteratee` is called with an item from the list, and a callback for when\n * it has finished. If the `iteratee` passes an error to its `callback`, the\n * main `callback` (for the `each` function) is immediately called with the\n * error.\n *\n * Note, that since this function applies `iteratee` to each item in parallel,\n * there is no guarantee that the iteratee functions will complete in order.\n *\n * @name each\n * @static\n * @memberOf module:Collections\n * @method\n * @alias forEach\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to\n * each item in `coll`. Invoked with (item, callback).\n * The array index is not passed to the iteratee.\n * If you need the index, use `eachOf`.\n * @param {Function} [callback] - A callback which is called when all\n * `iteratee` functions have finished, or an error occurs. Invoked with (err).\n * @example\n *\n * // assuming openFiles is an array of file names and saveFile is a function\n * // to save the modified contents of that file:\n *\n * async.each(openFiles, saveFile, function(err){\n * // if any of the saves produced an error, err would equal that error\n * });\n *\n * // assuming openFiles is an array of file names\n * async.each(openFiles, function(file, callback) {\n *\n * // Perform operation on file here.\n * console.log('Processing file ' + file);\n *\n * if( file.length > 32 ) {\n * console.log('This file name is too long');\n * callback('File name too long');\n * } else {\n * // Do work to process file here\n * console.log('File processed');\n * callback();\n * }\n * }, function(err) {\n * // if any of the file processing produced an error, err would equal that error\n * if( err ) {\n * // One of the iterations produced an error.\n * // All processing will now stop.\n * console.log('A file failed to process');\n * } else {\n * console.log('All files have been processed successfully');\n * }\n * });\n */\nfunction eachLimit(coll, iteratee, callback) {\n eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback);\n}\n\n/**\n * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.\n *\n * @name eachLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.each]{@link module:Collections.each}\n * @alias forEachLimit\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The array index is not passed to the iteratee.\n * If you need the index, use `eachOfLimit`.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called when all\n * `iteratee` functions have finished, or an error occurs. Invoked with (err).\n */\nfunction eachLimit$1(coll, limit, iteratee, callback) {\n _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback);\n}\n\n/**\n * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.\n *\n * @name eachSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.each]{@link module:Collections.each}\n * @alias forEachSeries\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to each\n * item in `coll`.\n * The array index is not passed to the iteratee.\n * If you need the index, use `eachOfSeries`.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called when all\n * `iteratee` functions have finished, or an error occurs. Invoked with (err).\n */\nvar eachSeries = doLimit(eachLimit$1, 1);\n\n/**\n * Wrap an async function and ensure it calls its callback on a later tick of\n * the event loop. If the function already calls its callback on a next tick,\n * no extra deferral is added. This is useful for preventing stack overflows\n * (`RangeError: Maximum call stack size exceeded`) and generally keeping\n * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)\n * contained. ES2017 `async` functions are returned as-is -- they are immune\n * to Zalgo's corrupting influences, as they always resolve on a later tick.\n *\n * @name ensureAsync\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {AsyncFunction} fn - an async function, one that expects a node-style\n * callback as its last argument.\n * @returns {AsyncFunction} Returns a wrapped function with the exact same call\n * signature as the function passed in.\n * @example\n *\n * function sometimesAsync(arg, callback) {\n * if (cache[arg]) {\n * return callback(null, cache[arg]); // this would be synchronous!!\n * } else {\n * doSomeIO(arg, callback); // this IO would be asynchronous\n * }\n * }\n *\n * // this has a risk of stack overflows if many results are cached in a row\n * async.mapSeries(args, sometimesAsync, done);\n *\n * // this will defer sometimesAsync's callback if necessary,\n * // preventing stack overflows\n * async.mapSeries(args, async.ensureAsync(sometimesAsync), done);\n */\nfunction ensureAsync(fn) {\n if (isAsync(fn)) return fn;\n return initialParams(function (args, callback) {\n var sync = true;\n args.push(function () {\n var innerArgs = arguments;\n if (sync) {\n setImmediate$1(function () {\n callback.apply(null, innerArgs);\n });\n } else {\n callback.apply(null, innerArgs);\n }\n });\n fn.apply(this, args);\n sync = false;\n });\n}\n\nfunction notId(v) {\n return !v;\n}\n\n/**\n * Returns `true` if every element in `coll` satisfies an async test. If any\n * iteratee call returns `false`, the main `callback` is immediately called.\n *\n * @name every\n * @static\n * @memberOf module:Collections\n * @method\n * @alias all\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async truth test to apply to each item\n * in the collection in parallel.\n * The iteratee must complete with a boolean result value.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Result will be either `true` or `false`\n * depending on the values of the async tests. Invoked with (err, result).\n * @example\n *\n * async.every(['file1','file2','file3'], function(filePath, callback) {\n * fs.access(filePath, function(err) {\n * callback(null, !err)\n * });\n * }, function(err, result) {\n * // if result is true then every file exists\n * });\n */\nvar every = doParallel(_createTester(notId, notId));\n\n/**\n * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.\n *\n * @name everyLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.every]{@link module:Collections.every}\n * @alias allLimit\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async truth test to apply to each item\n * in the collection in parallel.\n * The iteratee must complete with a boolean result value.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Result will be either `true` or `false`\n * depending on the values of the async tests. Invoked with (err, result).\n */\nvar everyLimit = doParallelLimit(_createTester(notId, notId));\n\n/**\n * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.\n *\n * @name everySeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.every]{@link module:Collections.every}\n * @alias allSeries\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async truth test to apply to each item\n * in the collection in series.\n * The iteratee must complete with a boolean result value.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Result will be either `true` or `false`\n * depending on the values of the async tests. Invoked with (err, result).\n */\nvar everySeries = doLimit(everyLimit, 1);\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nfunction filterArray(eachfn, arr, iteratee, callback) {\n var truthValues = new Array(arr.length);\n eachfn(arr, function (x, index, callback) {\n iteratee(x, function (err, v) {\n truthValues[index] = !!v;\n callback(err);\n });\n }, function (err) {\n if (err) return callback(err);\n var results = [];\n for (var i = 0; i < arr.length; i++) {\n if (truthValues[i]) results.push(arr[i]);\n }\n callback(null, results);\n });\n}\n\nfunction filterGeneric(eachfn, coll, iteratee, callback) {\n var results = [];\n eachfn(coll, function (x, index, callback) {\n iteratee(x, function (err, v) {\n if (err) {\n callback(err);\n } else {\n if (v) {\n results.push({index: index, value: x});\n }\n callback();\n }\n });\n }, function (err) {\n if (err) {\n callback(err);\n } else {\n callback(null, arrayMap(results.sort(function (a, b) {\n return a.index - b.index;\n }), baseProperty('value')));\n }\n });\n}\n\nfunction _filter(eachfn, coll, iteratee, callback) {\n var filter = isArrayLike(coll) ? filterArray : filterGeneric;\n filter(eachfn, coll, wrapAsync(iteratee), callback || noop);\n}\n\n/**\n * Returns a new array of all the values in `coll` which pass an async truth\n * test. This operation is performed in parallel, but the results array will be\n * in the same order as the original.\n *\n * @name filter\n * @static\n * @memberOf module:Collections\n * @method\n * @alias select\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {Function} iteratee - A truth test to apply to each item in `coll`.\n * The `iteratee` is passed a `callback(err, truthValue)`, which must be called\n * with a boolean argument once it has completed. Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Invoked with (err, results).\n * @example\n *\n * async.filter(['file1','file2','file3'], function(filePath, callback) {\n * fs.access(filePath, function(err) {\n * callback(null, !err)\n * });\n * }, function(err, results) {\n * // results now equals an array of the existing files\n * });\n */\nvar filter = doParallel(_filter);\n\n/**\n * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name filterLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.filter]{@link module:Collections.filter}\n * @alias selectLimit\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {Function} iteratee - A truth test to apply to each item in `coll`.\n * The `iteratee` is passed a `callback(err, truthValue)`, which must be called\n * with a boolean argument once it has completed. Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Invoked with (err, results).\n */\nvar filterLimit = doParallelLimit(_filter);\n\n/**\n * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.\n *\n * @name filterSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.filter]{@link module:Collections.filter}\n * @alias selectSeries\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {Function} iteratee - A truth test to apply to each item in `coll`.\n * The `iteratee` is passed a `callback(err, truthValue)`, which must be called\n * with a boolean argument once it has completed. Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Invoked with (err, results)\n */\nvar filterSeries = doLimit(filterLimit, 1);\n\n/**\n * Calls the asynchronous function `fn` with a callback parameter that allows it\n * to call itself again, in series, indefinitely.\n\n * If an error is passed to the callback then `errback` is called with the\n * error, and execution stops, otherwise it will never be called.\n *\n * @name forever\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {AsyncFunction} fn - an async function to call repeatedly.\n * Invoked with (next).\n * @param {Function} [errback] - when `fn` passes an error to it's callback,\n * this function will be called, and execution stops. Invoked with (err).\n * @example\n *\n * async.forever(\n * function(next) {\n * // next is suitable for passing to things that need a callback(err [, whatever]);\n * // it will result in this function being called again.\n * },\n * function(err) {\n * // if next is called with a value in its first parameter, it will appear\n * // in here as 'err', and execution will stop.\n * }\n * );\n */\nfunction forever(fn, errback) {\n var done = onlyOnce(errback || noop);\n var task = wrapAsync(ensureAsync(fn));\n\n function next(err) {\n if (err) return done(err);\n task(next);\n }\n next();\n}\n\n/**\n * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time.\n *\n * @name groupByLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.groupBy]{@link module:Collections.groupBy}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with a `key` to group the value under.\n * Invoked with (value, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Result is an `Object` whoses\n * properties are arrays of values which returned the corresponding key.\n */\nvar groupByLimit = function(coll, limit, iteratee, callback) {\n callback = callback || noop;\n var _iteratee = wrapAsync(iteratee);\n mapLimit(coll, limit, function(val, callback) {\n _iteratee(val, function(err, key) {\n if (err) return callback(err);\n return callback(null, {key: key, val: val});\n });\n }, function(err, mapResults) {\n var result = {};\n // from MDN, handle object having an `hasOwnProperty` prop\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < mapResults.length; i++) {\n if (mapResults[i]) {\n var key = mapResults[i].key;\n var val = mapResults[i].val;\n\n if (hasOwnProperty.call(result, key)) {\n result[key].push(val);\n } else {\n result[key] = [val];\n }\n }\n }\n\n return callback(err, result);\n });\n};\n\n/**\n * Returns a new object, where each value corresponds to an array of items, from\n * `coll`, that returned the corresponding key. That is, the keys of the object\n * correspond to the values passed to the `iteratee` callback.\n *\n * Note: Since this function applies the `iteratee` to each item in parallel,\n * there is no guarantee that the `iteratee` functions will complete in order.\n * However, the values for each key in the `result` will be in the same order as\n * the original `coll`. For Objects, the values will roughly be in the order of\n * the original Objects' keys (but this can vary across JavaScript engines).\n *\n * @name groupBy\n * @static\n * @memberOf module:Collections\n * @method\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with a `key` to group the value under.\n * Invoked with (value, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Result is an `Object` whoses\n * properties are arrays of values which returned the corresponding key.\n * @example\n *\n * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) {\n * db.findById(userId, function(err, user) {\n * if (err) return callback(err);\n * return callback(null, user.age);\n * });\n * }, function(err, result) {\n * // result is object containing the userIds grouped by age\n * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']};\n * });\n */\nvar groupBy = doLimit(groupByLimit, Infinity);\n\n/**\n * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time.\n *\n * @name groupBySeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.groupBy]{@link module:Collections.groupBy}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with a `key` to group the value under.\n * Invoked with (value, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. Result is an `Object` whoses\n * properties are arrays of values which returned the corresponding key.\n */\nvar groupBySeries = doLimit(groupByLimit, 1);\n\n/**\n * Logs the result of an `async` function to the `console`. Only works in\n * Node.js or in browsers that support `console.log` and `console.error` (such\n * as FF and Chrome). If multiple arguments are returned from the async\n * function, `console.log` is called on each argument in order.\n *\n * @name log\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {AsyncFunction} function - The function you want to eventually apply\n * all arguments to.\n * @param {...*} arguments... - Any number of arguments to apply to the function.\n * @example\n *\n * // in a module\n * var hello = function(name, callback) {\n * setTimeout(function() {\n * callback(null, 'hello ' + name);\n * }, 1000);\n * };\n *\n * // in the node repl\n * node> async.log(hello, 'world');\n * 'hello world'\n */\nvar log = consoleFunc('log');\n\n/**\n * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name mapValuesLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.mapValues]{@link module:Collections.mapValues}\n * @category Collection\n * @param {Object} obj - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - A function to apply to each value and key\n * in `coll`.\n * The iteratee should complete with the transformed value as its result.\n * Invoked with (value, key, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. `result` is a new object consisting\n * of each key from `obj`, with each transformed value on the right-hand side.\n * Invoked with (err, result).\n */\nfunction mapValuesLimit(obj, limit, iteratee, callback) {\n callback = once(callback || noop);\n var newObj = {};\n var _iteratee = wrapAsync(iteratee);\n eachOfLimit(obj, limit, function(val, key, next) {\n _iteratee(val, key, function (err, result) {\n if (err) return next(err);\n newObj[key] = result;\n next();\n });\n }, function (err) {\n callback(err, newObj);\n });\n}\n\n/**\n * A relative of [`map`]{@link module:Collections.map}, designed for use with objects.\n *\n * Produces a new Object by mapping each value of `obj` through the `iteratee`\n * function. The `iteratee` is called each `value` and `key` from `obj` and a\n * callback for when it has finished processing. Each of these callbacks takes\n * two arguments: an `error`, and the transformed item from `obj`. If `iteratee`\n * passes an error to its callback, the main `callback` (for the `mapValues`\n * function) is immediately called with the error.\n *\n * Note, the order of the keys in the result is not guaranteed. The keys will\n * be roughly in the order they complete, (but this is very engine-specific)\n *\n * @name mapValues\n * @static\n * @memberOf module:Collections\n * @method\n * @category Collection\n * @param {Object} obj - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A function to apply to each value and key\n * in `coll`.\n * The iteratee should complete with the transformed value as its result.\n * Invoked with (value, key, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. `result` is a new object consisting\n * of each key from `obj`, with each transformed value on the right-hand side.\n * Invoked with (err, result).\n * @example\n *\n * async.mapValues({\n * f1: 'file1',\n * f2: 'file2',\n * f3: 'file3'\n * }, function (file, key, callback) {\n * fs.stat(file, callback);\n * }, function(err, result) {\n * // result is now a map of stats for each file, e.g.\n * // {\n * // f1: [stats for file1],\n * // f2: [stats for file2],\n * // f3: [stats for file3]\n * // }\n * });\n */\n\nvar mapValues = doLimit(mapValuesLimit, Infinity);\n\n/**\n * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.\n *\n * @name mapValuesSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.mapValues]{@link module:Collections.mapValues}\n * @category Collection\n * @param {Object} obj - A collection to iterate over.\n * @param {AsyncFunction} iteratee - A function to apply to each value and key\n * in `coll`.\n * The iteratee should complete with the transformed value as its result.\n * Invoked with (value, key, callback).\n * @param {Function} [callback] - A callback which is called when all `iteratee`\n * functions have finished, or an error occurs. `result` is a new object consisting\n * of each key from `obj`, with each transformed value on the right-hand side.\n * Invoked with (err, result).\n */\nvar mapValuesSeries = doLimit(mapValuesLimit, 1);\n\nfunction has(obj, key) {\n return key in obj;\n}\n\n/**\n * Caches the results of an async function. When creating a hash to store\n * function results against, the callback is omitted from the hash and an\n * optional hash function can be used.\n *\n * If no hash function is specified, the first argument is used as a hash key,\n * which may work reasonably if it is a string or a data type that converts to a\n * distinct string. Note that objects and arrays will not behave reasonably.\n * Neither will cases where the other arguments are significant. In such cases,\n * specify your own hash function.\n *\n * The cache of results is exposed as the `memo` property of the function\n * returned by `memoize`.\n *\n * @name memoize\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {AsyncFunction} fn - The async function to proxy and cache results from.\n * @param {Function} hasher - An optional function for generating a custom hash\n * for storing results. It has all the arguments applied to it apart from the\n * callback, and must be synchronous.\n * @returns {AsyncFunction} a memoized version of `fn`\n * @example\n *\n * var slow_fn = function(name, callback) {\n * // do something\n * callback(null, result);\n * };\n * var fn = async.memoize(slow_fn);\n *\n * // fn can now be used as if it were slow_fn\n * fn('some name', function() {\n * // callback\n * });\n */\nfunction memoize(fn, hasher) {\n var memo = Object.create(null);\n var queues = Object.create(null);\n hasher = hasher || identity;\n var _fn = wrapAsync(fn);\n var memoized = initialParams(function memoized(args, callback) {\n var key = hasher.apply(null, args);\n if (has(memo, key)) {\n setImmediate$1(function() {\n callback.apply(null, memo[key]);\n });\n } else if (has(queues, key)) {\n queues[key].push(callback);\n } else {\n queues[key] = [callback];\n _fn.apply(null, args.concat(function(/*args*/) {\n var args = slice(arguments);\n memo[key] = args;\n var q = queues[key];\n delete queues[key];\n for (var i = 0, l = q.length; i < l; i++) {\n q[i].apply(null, args);\n }\n }));\n }\n });\n memoized.memo = memo;\n memoized.unmemoized = fn;\n return memoized;\n}\n\n/**\n * Calls `callback` on a later loop around the event loop. In Node.js this just\n * calls `process.nextTick`. In the browser it will use `setImmediate` if\n * available, otherwise `setTimeout(callback, 0)`, which means other higher\n * priority events may precede the execution of `callback`.\n *\n * This is used internally for browser-compatibility purposes.\n *\n * @name nextTick\n * @static\n * @memberOf module:Utils\n * @method\n * @see [async.setImmediate]{@link module:Utils.setImmediate}\n * @category Util\n * @param {Function} callback - The function to call on a later loop around\n * the event loop. Invoked with (args...).\n * @param {...*} args... - any number of additional arguments to pass to the\n * callback on the next tick.\n * @example\n *\n * var call_order = [];\n * async.nextTick(function() {\n * call_order.push('two');\n * // call_order now equals ['one','two']\n * });\n * call_order.push('one');\n *\n * async.setImmediate(function (a, b, c) {\n * // a, b, and c equal 1, 2, and 3\n * }, 1, 2, 3);\n */\nvar _defer$1;\n\nif (hasNextTick) {\n _defer$1 = process.nextTick;\n} else if (hasSetImmediate) {\n _defer$1 = setImmediate;\n} else {\n _defer$1 = fallback;\n}\n\nvar nextTick = wrap(_defer$1);\n\nfunction _parallel(eachfn, tasks, callback) {\n callback = callback || noop;\n var results = isArrayLike(tasks) ? [] : {};\n\n eachfn(tasks, function (task, key, callback) {\n wrapAsync(task)(function (err, result) {\n if (arguments.length > 2) {\n result = slice(arguments, 1);\n }\n results[key] = result;\n callback(err);\n });\n }, function (err) {\n callback(err, results);\n });\n}\n\n/**\n * Run the `tasks` collection of functions in parallel, without waiting until\n * the previous function has completed. If any of the functions pass an error to\n * its callback, the main `callback` is immediately called with the value of the\n * error. Once the `tasks` have completed, the results are passed to the final\n * `callback` as an array.\n *\n * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about\n * parallel execution of code. If your tasks do not use any timers or perform\n * any I/O, they will actually be executed in series. Any synchronous setup\n * sections for each task will happen one after the other. JavaScript remains\n * single-threaded.\n *\n * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the\n * execution of other tasks when a task fails.\n *\n * It is also possible to use an object instead of an array. Each property will\n * be run as a function and the results will be passed to the final `callback`\n * as an object instead of an array. This can be a more readable way of handling\n * results from {@link async.parallel}.\n *\n * @name parallel\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array|Iterable|Object} tasks - A collection of\n * [async functions]{@link AsyncFunction} to run.\n * Each async function can complete with any number of optional `result` values.\n * @param {Function} [callback] - An optional callback to run once all the\n * functions have completed successfully. This function gets a results array\n * (or object) containing all the result arguments passed to the task callbacks.\n * Invoked with (err, results).\n *\n * @example\n * async.parallel([\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'one');\n * }, 200);\n * },\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'two');\n * }, 100);\n * }\n * ],\n * // optional callback\n * function(err, results) {\n * // the results array will equal ['one','two'] even though\n * // the second function had a shorter timeout.\n * });\n *\n * // an example using an object instead of an array\n * async.parallel({\n * one: function(callback) {\n * setTimeout(function() {\n * callback(null, 1);\n * }, 200);\n * },\n * two: function(callback) {\n * setTimeout(function() {\n * callback(null, 2);\n * }, 100);\n * }\n * }, function(err, results) {\n * // results is now equals to: {one: 1, two: 2}\n * });\n */\nfunction parallelLimit(tasks, callback) {\n _parallel(eachOf, tasks, callback);\n}\n\n/**\n * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name parallelLimit\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.parallel]{@link module:ControlFlow.parallel}\n * @category Control Flow\n * @param {Array|Iterable|Object} tasks - A collection of\n * [async functions]{@link AsyncFunction} to run.\n * Each async function can complete with any number of optional `result` values.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {Function} [callback] - An optional callback to run once all the\n * functions have completed successfully. This function gets a results array\n * (or object) containing all the result arguments passed to the task callbacks.\n * Invoked with (err, results).\n */\nfunction parallelLimit$1(tasks, limit, callback) {\n _parallel(_eachOfLimit(limit), tasks, callback);\n}\n\n/**\n * A queue of tasks for the worker function to complete.\n * @typedef {Object} QueueObject\n * @memberOf module:ControlFlow\n * @property {Function} length - a function returning the number of items\n * waiting to be processed. Invoke with `queue.length()`.\n * @property {boolean} started - a boolean indicating whether or not any\n * items have been pushed and processed by the queue.\n * @property {Function} running - a function returning the number of items\n * currently being processed. Invoke with `queue.running()`.\n * @property {Function} workersList - a function returning the array of items\n * currently being processed. Invoke with `queue.workersList()`.\n * @property {Function} idle - a function returning false if there are items\n * waiting or being processed, or true if not. Invoke with `queue.idle()`.\n * @property {number} concurrency - an integer for determining how many `worker`\n * functions should be run in parallel. This property can be changed after a\n * `queue` is created to alter the concurrency on-the-fly.\n * @property {Function} push - add a new task to the `queue`. Calls `callback`\n * once the `worker` has finished processing the task. Instead of a single task,\n * a `tasks` array can be submitted. The respective callback is used for every\n * task in the list. Invoke with `queue.push(task, [callback])`,\n * @property {Function} unshift - add a new task to the front of the `queue`.\n * Invoke with `queue.unshift(task, [callback])`.\n * @property {Function} remove - remove items from the queue that match a test\n * function. The test function will be passed an object with a `data` property,\n * and a `priority` property, if this is a\n * [priorityQueue]{@link module:ControlFlow.priorityQueue} object.\n * Invoked with `queue.remove(testFn)`, where `testFn` is of the form\n * `function ({data, priority}) {}` and returns a Boolean.\n * @property {Function} saturated - a callback that is called when the number of\n * running workers hits the `concurrency` limit, and further tasks will be\n * queued.\n * @property {Function} unsaturated - a callback that is called when the number\n * of running workers is less than the `concurrency` & `buffer` limits, and\n * further tasks will not be queued.\n * @property {number} buffer - A minimum threshold buffer in order to say that\n * the `queue` is `unsaturated`.\n * @property {Function} empty - a callback that is called when the last item\n * from the `queue` is given to a `worker`.\n * @property {Function} drain - a callback that is called when the last item\n * from the `queue` has returned from the `worker`.\n * @property {Function} error - a callback that is called when a task errors.\n * Has the signature `function(error, task)`.\n * @property {boolean} paused - a boolean for determining whether the queue is\n * in a paused state.\n * @property {Function} pause - a function that pauses the processing of tasks\n * until `resume()` is called. Invoke with `queue.pause()`.\n * @property {Function} resume - a function that resumes the processing of\n * queued tasks when the queue is paused. Invoke with `queue.resume()`.\n * @property {Function} kill - a function that removes the `drain` callback and\n * empties remaining tasks from the queue forcing it to go idle. No more tasks\n * should be pushed to the queue after calling this function. Invoke with `queue.kill()`.\n */\n\n/**\n * Creates a `queue` object with the specified `concurrency`. Tasks added to the\n * `queue` are processed in parallel (up to the `concurrency` limit). If all\n * `worker`s are in progress, the task is queued until one becomes available.\n * Once a `worker` completes a `task`, that `task`'s callback is called.\n *\n * @name queue\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {AsyncFunction} worker - An async function for processing a queued task.\n * If you want to handle errors from an individual task, pass a callback to\n * `q.push()`. Invoked with (task, callback).\n * @param {number} [concurrency=1] - An `integer` for determining how many\n * `worker` functions should be run in parallel. If omitted, the concurrency\n * defaults to `1`. If the concurrency is `0`, an error is thrown.\n * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can\n * attached as certain properties to listen for specific events during the\n * lifecycle of the queue.\n * @example\n *\n * // create a queue object with concurrency 2\n * var q = async.queue(function(task, callback) {\n * console.log('hello ' + task.name);\n * callback();\n * }, 2);\n *\n * // assign a callback\n * q.drain = function() {\n * console.log('all items have been processed');\n * };\n *\n * // add some items to the queue\n * q.push({name: 'foo'}, function(err) {\n * console.log('finished processing foo');\n * });\n * q.push({name: 'bar'}, function (err) {\n * console.log('finished processing bar');\n * });\n *\n * // add some items to the queue (batch-wise)\n * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) {\n * console.log('finished processing item');\n * });\n *\n * // add some items to the front of the queue\n * q.unshift({name: 'bar'}, function (err) {\n * console.log('finished processing bar');\n * });\n */\nvar queue$1 = function (worker, concurrency) {\n var _worker = wrapAsync(worker);\n return queue(function (items, cb) {\n _worker(items[0], cb);\n }, concurrency, 1);\n};\n\n/**\n * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and\n * completed in ascending priority order.\n *\n * @name priorityQueue\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.queue]{@link module:ControlFlow.queue}\n * @category Control Flow\n * @param {AsyncFunction} worker - An async function for processing a queued task.\n * If you want to handle errors from an individual task, pass a callback to\n * `q.push()`.\n * Invoked with (task, callback).\n * @param {number} concurrency - An `integer` for determining how many `worker`\n * functions should be run in parallel. If omitted, the concurrency defaults to\n * `1`. If the concurrency is `0`, an error is thrown.\n * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two\n * differences between `queue` and `priorityQueue` objects:\n * * `push(task, priority, [callback])` - `priority` should be a number. If an\n * array of `tasks` is given, all tasks will be assigned the same priority.\n * * The `unshift` method was removed.\n */\nvar priorityQueue = function(worker, concurrency) {\n // Start with a normal queue\n var q = queue$1(worker, concurrency);\n\n // Override push to accept second parameter representing priority\n q.push = function(data, priority, callback) {\n if (callback == null) callback = noop;\n if (typeof callback !== 'function') {\n throw new Error('task callback must be a function');\n }\n q.started = true;\n if (!isArray(data)) {\n data = [data];\n }\n if (data.length === 0) {\n // call drain immediately if there are no tasks\n return setImmediate$1(function() {\n q.drain();\n });\n }\n\n priority = priority || 0;\n var nextNode = q._tasks.head;\n while (nextNode && priority >= nextNode.priority) {\n nextNode = nextNode.next;\n }\n\n for (var i = 0, l = data.length; i < l; i++) {\n var item = {\n data: data[i],\n priority: priority,\n callback: callback\n };\n\n if (nextNode) {\n q._tasks.insertBefore(nextNode, item);\n } else {\n q._tasks.push(item);\n }\n }\n setImmediate$1(q.process);\n };\n\n // Remove unshift function\n delete q.unshift;\n\n return q;\n};\n\n/**\n * Runs the `tasks` array of functions in parallel, without waiting until the\n * previous function has completed. Once any of the `tasks` complete or pass an\n * error to its callback, the main `callback` is immediately called. It's\n * equivalent to `Promise.race()`.\n *\n * @name race\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}\n * to run. Each function can complete with an optional `result` value.\n * @param {Function} callback - A callback to run once any of the functions have\n * completed. This function gets an error or result from the first function that\n * completed. Invoked with (err, result).\n * @returns undefined\n * @example\n *\n * async.race([\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'one');\n * }, 200);\n * },\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'two');\n * }, 100);\n * }\n * ],\n * // main callback\n * function(err, result) {\n * // the result will be equal to 'two' as it finishes earlier\n * });\n */\nfunction race(tasks, callback) {\n callback = once(callback || noop);\n if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));\n if (!tasks.length) return callback();\n for (var i = 0, l = tasks.length; i < l; i++) {\n wrapAsync(tasks[i])(callback);\n }\n}\n\n/**\n * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.\n *\n * @name reduceRight\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.reduce]{@link module:Collections.reduce}\n * @alias foldr\n * @category Collection\n * @param {Array} array - A collection to iterate over.\n * @param {*} memo - The initial state of the reduction.\n * @param {AsyncFunction} iteratee - A function applied to each item in the\n * array to produce the next step in the reduction.\n * The `iteratee` should complete with the next state of the reduction.\n * If the iteratee complete with an error, the reduction is stopped and the\n * main `callback` is immediately called with the error.\n * Invoked with (memo, item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Result is the reduced value. Invoked with\n * (err, result).\n */\nfunction reduceRight (array, memo, iteratee, callback) {\n var reversed = slice(array).reverse();\n reduce(reversed, memo, iteratee, callback);\n}\n\n/**\n * Wraps the async function in another function that always completes with a\n * result object, even when it errors.\n *\n * The result object has either the property `error` or `value`.\n *\n * @name reflect\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {AsyncFunction} fn - The async function you want to wrap\n * @returns {Function} - A function that always passes null to it's callback as\n * the error. The second argument to the callback will be an `object` with\n * either an `error` or a `value` property.\n * @example\n *\n * async.parallel([\n * async.reflect(function(callback) {\n * // do some stuff ...\n * callback(null, 'one');\n * }),\n * async.reflect(function(callback) {\n * // do some more stuff but error ...\n * callback('bad stuff happened');\n * }),\n * async.reflect(function(callback) {\n * // do some more stuff ...\n * callback(null, 'two');\n * })\n * ],\n * // optional callback\n * function(err, results) {\n * // values\n * // results[0].value = 'one'\n * // results[1].error = 'bad stuff happened'\n * // results[2].value = 'two'\n * });\n */\nfunction reflect(fn) {\n var _fn = wrapAsync(fn);\n return initialParams(function reflectOn(args, reflectCallback) {\n args.push(function callback(error, cbArg) {\n if (error) {\n reflectCallback(null, { error: error });\n } else {\n var value;\n if (arguments.length <= 2) {\n value = cbArg;\n } else {\n value = slice(arguments, 1);\n }\n reflectCallback(null, { value: value });\n }\n });\n\n return _fn.apply(this, args);\n });\n}\n\n/**\n * A helper function that wraps an array or an object of functions with `reflect`.\n *\n * @name reflectAll\n * @static\n * @memberOf module:Utils\n * @method\n * @see [async.reflect]{@link module:Utils.reflect}\n * @category Util\n * @param {Array|Object|Iterable} tasks - The collection of\n * [async functions]{@link AsyncFunction} to wrap in `async.reflect`.\n * @returns {Array} Returns an array of async functions, each wrapped in\n * `async.reflect`\n * @example\n *\n * let tasks = [\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'one');\n * }, 200);\n * },\n * function(callback) {\n * // do some more stuff but error ...\n * callback(new Error('bad stuff happened'));\n * },\n * function(callback) {\n * setTimeout(function() {\n * callback(null, 'two');\n * }, 100);\n * }\n * ];\n *\n * async.parallel(async.reflectAll(tasks),\n * // optional callback\n * function(err, results) {\n * // values\n * // results[0].value = 'one'\n * // results[1].error = Error('bad stuff happened')\n * // results[2].value = 'two'\n * });\n *\n * // an example using an object instead of an array\n * let tasks = {\n * one: function(callback) {\n * setTimeout(function() {\n * callback(null, 'one');\n * }, 200);\n * },\n * two: function(callback) {\n * callback('two');\n * },\n * three: function(callback) {\n * setTimeout(function() {\n * callback(null, 'three');\n * }, 100);\n * }\n * };\n *\n * async.parallel(async.reflectAll(tasks),\n * // optional callback\n * function(err, results) {\n * // values\n * // results.one.value = 'one'\n * // results.two.error = 'two'\n * // results.three.value = 'three'\n * });\n */\nfunction reflectAll(tasks) {\n var results;\n if (isArray(tasks)) {\n results = arrayMap(tasks, reflect);\n } else {\n results = {};\n baseForOwn(tasks, function(task, key) {\n results[key] = reflect.call(this, task);\n });\n }\n return results;\n}\n\nfunction reject$1(eachfn, arr, iteratee, callback) {\n _filter(eachfn, arr, function(value, cb) {\n iteratee(value, function(err, v) {\n cb(err, !v);\n });\n }, callback);\n}\n\n/**\n * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test.\n *\n * @name reject\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.filter]{@link module:Collections.filter}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {Function} iteratee - An async truth test to apply to each item in\n * `coll`.\n * The should complete with a boolean value as its `result`.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Invoked with (err, results).\n * @example\n *\n * async.reject(['file1','file2','file3'], function(filePath, callback) {\n * fs.access(filePath, function(err) {\n * callback(null, !err)\n * });\n * }, function(err, results) {\n * // results now equals an array of missing files\n * createFiles(results);\n * });\n */\nvar reject = doParallel(reject$1);\n\n/**\n * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name rejectLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.reject]{@link module:Collections.reject}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {Function} iteratee - An async truth test to apply to each item in\n * `coll`.\n * The should complete with a boolean value as its `result`.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Invoked with (err, results).\n */\nvar rejectLimit = doParallelLimit(reject$1);\n\n/**\n * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time.\n *\n * @name rejectSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.reject]{@link module:Collections.reject}\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {Function} iteratee - An async truth test to apply to each item in\n * `coll`.\n * The should complete with a boolean value as its `result`.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Invoked with (err, results).\n */\nvar rejectSeries = doLimit(rejectLimit, 1);\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant$1(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * Attempts to get a successful response from `task` no more than `times` times\n * before returning an error. If the task is successful, the `callback` will be\n * passed the result of the successful task. If all attempts fail, the callback\n * will be passed the error and result (if any) of the final attempt.\n *\n * @name retry\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @see [async.retryable]{@link module:ControlFlow.retryable}\n * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an\n * object with `times` and `interval` or a number.\n * * `times` - The number of attempts to make before giving up. The default\n * is `5`.\n * * `interval` - The time to wait between retries, in milliseconds. The\n * default is `0`. The interval may also be specified as a function of the\n * retry count (see example).\n * * `errorFilter` - An optional synchronous function that is invoked on\n * erroneous result. If it returns `true` the retry attempts will continue;\n * if the function returns `false` the retry flow is aborted with the current\n * attempt's error and result being returned to the final callback.\n * Invoked with (err).\n * * If `opts` is a number, the number specifies the number of times to retry,\n * with the default interval of `0`.\n * @param {AsyncFunction} task - An async function to retry.\n * Invoked with (callback).\n * @param {Function} [callback] - An optional callback which is called when the\n * task has succeeded, or after the final failed attempt. It receives the `err`\n * and `result` arguments of the last attempt at completing the `task`. Invoked\n * with (err, results).\n *\n * @example\n *\n * // The `retry` function can be used as a stand-alone control flow by passing\n * // a callback, as shown below:\n *\n * // try calling apiMethod 3 times\n * async.retry(3, apiMethod, function(err, result) {\n * // do something with the result\n * });\n *\n * // try calling apiMethod 3 times, waiting 200 ms between each retry\n * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {\n * // do something with the result\n * });\n *\n * // try calling apiMethod 10 times with exponential backoff\n * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds)\n * async.retry({\n * times: 10,\n * interval: function(retryCount) {\n * return 50 * Math.pow(2, retryCount);\n * }\n * }, apiMethod, function(err, result) {\n * // do something with the result\n * });\n *\n * // try calling apiMethod the default 5 times no delay between each retry\n * async.retry(apiMethod, function(err, result) {\n * // do something with the result\n * });\n *\n * // try calling apiMethod only when error condition satisfies, all other\n * // errors will abort the retry control flow and return to final callback\n * async.retry({\n * errorFilter: function(err) {\n * return err.message === 'Temporary error'; // only retry on a specific error\n * }\n * }, apiMethod, function(err, result) {\n * // do something with the result\n * });\n *\n * // to retry individual methods that are not as reliable within other\n * // control flow functions, use the `retryable` wrapper:\n * async.auto({\n * users: api.getUsers.bind(api),\n * payments: async.retryable(3, api.getPayments.bind(api))\n * }, function(err, results) {\n * // do something with the results\n * });\n *\n */\nfunction retry(opts, task, callback) {\n var DEFAULT_TIMES = 5;\n var DEFAULT_INTERVAL = 0;\n\n var options = {\n times: DEFAULT_TIMES,\n intervalFunc: constant$1(DEFAULT_INTERVAL)\n };\n\n function parseTimes(acc, t) {\n if (typeof t === 'object') {\n acc.times = +t.times || DEFAULT_TIMES;\n\n acc.intervalFunc = typeof t.interval === 'function' ?\n t.interval :\n constant$1(+t.interval || DEFAULT_INTERVAL);\n\n acc.errorFilter = t.errorFilter;\n } else if (typeof t === 'number' || typeof t === 'string') {\n acc.times = +t || DEFAULT_TIMES;\n } else {\n throw new Error(\"Invalid arguments for async.retry\");\n }\n }\n\n if (arguments.length < 3 && typeof opts === 'function') {\n callback = task || noop;\n task = opts;\n } else {\n parseTimes(options, opts);\n callback = callback || noop;\n }\n\n if (typeof task !== 'function') {\n throw new Error(\"Invalid arguments for async.retry\");\n }\n\n var _task = wrapAsync(task);\n\n var attempt = 1;\n function retryAttempt() {\n _task(function(err) {\n if (err && attempt++ < options.times &&\n (typeof options.errorFilter != 'function' ||\n options.errorFilter(err))) {\n setTimeout(retryAttempt, options.intervalFunc(attempt));\n } else {\n callback.apply(null, arguments);\n }\n });\n }\n\n retryAttempt();\n}\n\n/**\n * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method\n * wraps a task and makes it retryable, rather than immediately calling it\n * with retries.\n *\n * @name retryable\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.retry]{@link module:ControlFlow.retry}\n * @category Control Flow\n * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional\n * options, exactly the same as from `retry`\n * @param {AsyncFunction} task - the asynchronous function to wrap.\n * This function will be passed any arguments passed to the returned wrapper.\n * Invoked with (...args, callback).\n * @returns {AsyncFunction} The wrapped function, which when invoked, will\n * retry on an error, based on the parameters specified in `opts`.\n * This function will accept the same parameters as `task`.\n * @example\n *\n * async.auto({\n * dep1: async.retryable(3, getFromFlakyService),\n * process: [\"dep1\", async.retryable(3, function (results, cb) {\n * maybeProcessData(results.dep1, cb);\n * })]\n * }, callback);\n */\nvar retryable = function (opts, task) {\n if (!task) {\n task = opts;\n opts = null;\n }\n var _task = wrapAsync(task);\n return initialParams(function (args, callback) {\n function taskFn(cb) {\n _task.apply(null, args.concat(cb));\n }\n\n if (opts) retry(opts, taskFn, callback);\n else retry(taskFn, callback);\n\n });\n};\n\n/**\n * Run the functions in the `tasks` collection in series, each one running once\n * the previous function has completed. If any functions in the series pass an\n * error to its callback, no more functions are run, and `callback` is\n * immediately called with the value of the error. Otherwise, `callback`\n * receives an array of results when `tasks` have completed.\n *\n * It is also possible to use an object instead of an array. Each property will\n * be run as a function, and the results will be passed to the final `callback`\n * as an object instead of an array. This can be a more readable way of handling\n * results from {@link async.series}.\n *\n * **Note** that while many implementations preserve the order of object\n * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)\n * explicitly states that\n *\n * > The mechanics and order of enumerating the properties is not specified.\n *\n * So if you rely on the order in which your series of functions are executed,\n * and want this to work on all platforms, consider using an array.\n *\n * @name series\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array|Iterable|Object} tasks - A collection containing\n * [async functions]{@link AsyncFunction} to run in series.\n * Each function can complete with any number of optional `result` values.\n * @param {Function} [callback] - An optional callback to run once all the\n * functions have completed. This function gets a results array (or object)\n * containing all the result arguments passed to the `task` callbacks. Invoked\n * with (err, result).\n * @example\n * async.series([\n * function(callback) {\n * // do some stuff ...\n * callback(null, 'one');\n * },\n * function(callback) {\n * // do some more stuff ...\n * callback(null, 'two');\n * }\n * ],\n * // optional callback\n * function(err, results) {\n * // results is now equal to ['one', 'two']\n * });\n *\n * async.series({\n * one: function(callback) {\n * setTimeout(function() {\n * callback(null, 1);\n * }, 200);\n * },\n * two: function(callback){\n * setTimeout(function() {\n * callback(null, 2);\n * }, 100);\n * }\n * }, function(err, results) {\n * // results is now equal to: {one: 1, two: 2}\n * });\n */\nfunction series(tasks, callback) {\n _parallel(eachOfSeries, tasks, callback);\n}\n\n/**\n * Returns `true` if at least one element in the `coll` satisfies an async test.\n * If any iteratee call returns `true`, the main `callback` is immediately\n * called.\n *\n * @name some\n * @static\n * @memberOf module:Collections\n * @method\n * @alias any\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async truth test to apply to each item\n * in the collections in parallel.\n * The iteratee should complete with a boolean `result` value.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called as soon as any\n * iteratee returns `true`, or after all the iteratee functions have finished.\n * Result will be either `true` or `false` depending on the values of the async\n * tests. Invoked with (err, result).\n * @example\n *\n * async.some(['file1','file2','file3'], function(filePath, callback) {\n * fs.access(filePath, function(err) {\n * callback(null, !err)\n * });\n * }, function(err, result) {\n * // if result is true then at least one of the files exists\n * });\n */\nvar some = doParallel(_createTester(Boolean, identity));\n\n/**\n * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.\n *\n * @name someLimit\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.some]{@link module:Collections.some}\n * @alias anyLimit\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - An async truth test to apply to each item\n * in the collections in parallel.\n * The iteratee should complete with a boolean `result` value.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called as soon as any\n * iteratee returns `true`, or after all the iteratee functions have finished.\n * Result will be either `true` or `false` depending on the values of the async\n * tests. Invoked with (err, result).\n */\nvar someLimit = doParallelLimit(_createTester(Boolean, identity));\n\n/**\n * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.\n *\n * @name someSeries\n * @static\n * @memberOf module:Collections\n * @method\n * @see [async.some]{@link module:Collections.some}\n * @alias anySeries\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async truth test to apply to each item\n * in the collections in series.\n * The iteratee should complete with a boolean `result` value.\n * Invoked with (item, callback).\n * @param {Function} [callback] - A callback which is called as soon as any\n * iteratee returns `true`, or after all the iteratee functions have finished.\n * Result will be either `true` or `false` depending on the values of the async\n * tests. Invoked with (err, result).\n */\nvar someSeries = doLimit(someLimit, 1);\n\n/**\n * Sorts a list by the results of running each `coll` value through an async\n * `iteratee`.\n *\n * @name sortBy\n * @static\n * @memberOf module:Collections\n * @method\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {AsyncFunction} iteratee - An async function to apply to each item in\n * `coll`.\n * The iteratee should complete with a value to use as the sort criteria as\n * its `result`.\n * Invoked with (item, callback).\n * @param {Function} callback - A callback which is called after all the\n * `iteratee` functions have finished, or an error occurs. Results is the items\n * from the original `coll` sorted by the values returned by the `iteratee`\n * calls. Invoked with (err, results).\n * @example\n *\n * async.sortBy(['file1','file2','file3'], function(file, callback) {\n * fs.stat(file, function(err, stats) {\n * callback(err, stats.mtime);\n * });\n * }, function(err, results) {\n * // results is now the original array of files sorted by\n * // modified date\n * });\n *\n * // By modifying the callback parameter the\n * // sorting order can be influenced:\n *\n * // ascending order\n * async.sortBy([1,9,3,5], function(x, callback) {\n * callback(null, x);\n * }, function(err,result) {\n * // result callback\n * });\n *\n * // descending order\n * async.sortBy([1,9,3,5], function(x, callback) {\n * callback(null, x*-1); //<- x*-1 instead of x, turns the order around\n * }, function(err,result) {\n * // result callback\n * });\n */\nfunction sortBy (coll, iteratee, callback) {\n var _iteratee = wrapAsync(iteratee);\n map(coll, function (x, callback) {\n _iteratee(x, function (err, criteria) {\n if (err) return callback(err);\n callback(null, {value: x, criteria: criteria});\n });\n }, function (err, results) {\n if (err) return callback(err);\n callback(null, arrayMap(results.sort(comparator), baseProperty('value')));\n });\n\n function comparator(left, right) {\n var a = left.criteria, b = right.criteria;\n return a < b ? -1 : a > b ? 1 : 0;\n }\n}\n\n/**\n * Sets a time limit on an asynchronous function. If the function does not call\n * its callback within the specified milliseconds, it will be called with a\n * timeout error. The code property for the error object will be `'ETIMEDOUT'`.\n *\n * @name timeout\n * @static\n * @memberOf module:Utils\n * @method\n * @category Util\n * @param {AsyncFunction} asyncFn - The async function to limit in time.\n * @param {number} milliseconds - The specified time limit.\n * @param {*} [info] - Any variable you want attached (`string`, `object`, etc)\n * to timeout Error for more information..\n * @returns {AsyncFunction} Returns a wrapped function that can be used with any\n * of the control flow functions.\n * Invoke this function with the same parameters as you would `asyncFunc`.\n * @example\n *\n * function myFunction(foo, callback) {\n * doAsyncTask(foo, function(err, data) {\n * // handle errors\n * if (err) return callback(err);\n *\n * // do some stuff ...\n *\n * // return processed data\n * return callback(null, data);\n * });\n * }\n *\n * var wrapped = async.timeout(myFunction, 1000);\n *\n * // call `wrapped` as you would `myFunction`\n * wrapped({ bar: 'bar' }, function(err, data) {\n * // if `myFunction` takes < 1000 ms to execute, `err`\n * // and `data` will have their expected values\n *\n * // else `err` will be an Error with the code 'ETIMEDOUT'\n * });\n */\nfunction timeout(asyncFn, milliseconds, info) {\n var fn = wrapAsync(asyncFn);\n\n return initialParams(function (args, callback) {\n var timedOut = false;\n var timer;\n\n function timeoutCallback() {\n var name = asyncFn.name || 'anonymous';\n var error = new Error('Callback function \"' + name + '\" timed out.');\n error.code = 'ETIMEDOUT';\n if (info) {\n error.info = info;\n }\n timedOut = true;\n callback(error);\n }\n\n args.push(function () {\n if (!timedOut) {\n callback.apply(null, arguments);\n clearTimeout(timer);\n }\n });\n\n // setup timer and call original function\n timer = setTimeout(timeoutCallback, milliseconds);\n fn.apply(null, args);\n });\n}\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil;\nvar nativeMax = Math.max;\n\n/**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\nfunction baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n}\n\n/**\n * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a\n * time.\n *\n * @name timesLimit\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.times]{@link module:ControlFlow.times}\n * @category Control Flow\n * @param {number} count - The number of times to run the function.\n * @param {number} limit - The maximum number of async operations at a time.\n * @param {AsyncFunction} iteratee - The async function to call `n` times.\n * Invoked with the iteration index and a callback: (n, next).\n * @param {Function} callback - see [async.map]{@link module:Collections.map}.\n */\nfunction timeLimit(count, limit, iteratee, callback) {\n var _iteratee = wrapAsync(iteratee);\n mapLimit(baseRange(0, count, 1), limit, _iteratee, callback);\n}\n\n/**\n * Calls the `iteratee` function `n` times, and accumulates results in the same\n * manner you would use with [map]{@link module:Collections.map}.\n *\n * @name times\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.map]{@link module:Collections.map}\n * @category Control Flow\n * @param {number} n - The number of times to run the function.\n * @param {AsyncFunction} iteratee - The async function to call `n` times.\n * Invoked with the iteration index and a callback: (n, next).\n * @param {Function} callback - see {@link module:Collections.map}.\n * @example\n *\n * // Pretend this is some complicated async factory\n * var createUser = function(id, callback) {\n * callback(null, {\n * id: 'user' + id\n * });\n * };\n *\n * // generate 5 users\n * async.times(5, function(n, next) {\n * createUser(n, function(err, user) {\n * next(err, user);\n * });\n * }, function(err, users) {\n * // we should now have 5 users\n * });\n */\nvar times = doLimit(timeLimit, Infinity);\n\n/**\n * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time.\n *\n * @name timesSeries\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.times]{@link module:ControlFlow.times}\n * @category Control Flow\n * @param {number} n - The number of times to run the function.\n * @param {AsyncFunction} iteratee - The async function to call `n` times.\n * Invoked with the iteration index and a callback: (n, next).\n * @param {Function} callback - see {@link module:Collections.map}.\n */\nvar timesSeries = doLimit(timeLimit, 1);\n\n/**\n * A relative of `reduce`. Takes an Object or Array, and iterates over each\n * element in series, each step potentially mutating an `accumulator` value.\n * The type of the accumulator defaults to the type of collection passed in.\n *\n * @name transform\n * @static\n * @memberOf module:Collections\n * @method\n * @category Collection\n * @param {Array|Iterable|Object} coll - A collection to iterate over.\n * @param {*} [accumulator] - The initial state of the transform. If omitted,\n * it will default to an empty Object or Array, depending on the type of `coll`\n * @param {AsyncFunction} iteratee - A function applied to each item in the\n * collection that potentially modifies the accumulator.\n * Invoked with (accumulator, item, key, callback).\n * @param {Function} [callback] - A callback which is called after all the\n * `iteratee` functions have finished. Result is the transformed accumulator.\n * Invoked with (err, result).\n * @example\n *\n * async.transform([1,2,3], function(acc, item, index, callback) {\n * // pointless async:\n * process.nextTick(function() {\n * acc.push(item * 2)\n * callback(null)\n * });\n * }, function(err, result) {\n * // result is now equal to [2, 4, 6]\n * });\n *\n * @example\n *\n * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) {\n * setImmediate(function () {\n * obj[key] = val * 2;\n * callback();\n * })\n * }, function (err, result) {\n * // result is equal to {a: 2, b: 4, c: 6}\n * })\n */\nfunction transform (coll, accumulator, iteratee, callback) {\n if (arguments.length <= 3) {\n callback = iteratee;\n iteratee = accumulator;\n accumulator = isArray(coll) ? [] : {};\n }\n callback = once(callback || noop);\n var _iteratee = wrapAsync(iteratee);\n\n eachOf(coll, function(v, k, cb) {\n _iteratee(accumulator, v, k, cb);\n }, function(err) {\n callback(err, accumulator);\n });\n}\n\n/**\n * It runs each task in series but stops whenever any of the functions were\n * successful. If one of the tasks were successful, the `callback` will be\n * passed the result of the successful task. If all tasks fail, the callback\n * will be passed the error and result (if any) of the final attempt.\n *\n * @name tryEach\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array|Iterable|Object} tasks - A collection containing functions to\n * run, each function is passed a `callback(err, result)` it must call on\n * completion with an error `err` (which can be `null`) and an optional `result`\n * value.\n * @param {Function} [callback] - An optional callback which is called when one\n * of the tasks has succeeded, or all have failed. It receives the `err` and\n * `result` arguments of the last attempt at completing the `task`. Invoked with\n * (err, results).\n * @example\n * async.tryEach([\n * function getDataFromFirstWebsite(callback) {\n * // Try getting the data from the first website\n * callback(err, data);\n * },\n * function getDataFromSecondWebsite(callback) {\n * // First website failed,\n * // Try getting the data from the backup website\n * callback(err, data);\n * }\n * ],\n * // optional callback\n * function(err, results) {\n * Now do something with the data.\n * });\n *\n */\nfunction tryEach(tasks, callback) {\n var error = null;\n var result;\n callback = callback || noop;\n eachSeries(tasks, function(task, callback) {\n wrapAsync(task)(function (err, res/*, ...args*/) {\n if (arguments.length > 2) {\n result = slice(arguments, 1);\n } else {\n result = res;\n }\n error = err;\n callback(!err);\n });\n }, function () {\n callback(error, result);\n });\n}\n\n/**\n * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,\n * unmemoized form. Handy for testing.\n *\n * @name unmemoize\n * @static\n * @memberOf module:Utils\n * @method\n * @see [async.memoize]{@link module:Utils.memoize}\n * @category Util\n * @param {AsyncFunction} fn - the memoized function\n * @returns {AsyncFunction} a function that calls the original unmemoized function\n */\nfunction unmemoize(fn) {\n return function () {\n return (fn.unmemoized || fn).apply(null, arguments);\n };\n}\n\n/**\n * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when\n * stopped, or an error occurs.\n *\n * @name whilst\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Function} test - synchronous truth test to perform before each\n * execution of `iteratee`. Invoked with ().\n * @param {AsyncFunction} iteratee - An async function which is called each time\n * `test` passes. Invoked with (callback).\n * @param {Function} [callback] - A callback which is called after the test\n * function has failed and repeated execution of `iteratee` has stopped. `callback`\n * will be passed an error and any arguments passed to the final `iteratee`'s\n * callback. Invoked with (err, [results]);\n * @returns undefined\n * @example\n *\n * var count = 0;\n * async.whilst(\n * function() { return count < 5; },\n * function(callback) {\n * count++;\n * setTimeout(function() {\n * callback(null, count);\n * }, 1000);\n * },\n * function (err, n) {\n * // 5 seconds have passed, n = 5\n * }\n * );\n */\nfunction whilst(test, iteratee, callback) {\n callback = onlyOnce(callback || noop);\n var _iteratee = wrapAsync(iteratee);\n if (!test()) return callback(null);\n var next = function(err/*, ...args*/) {\n if (err) return callback(err);\n if (test()) return _iteratee(next);\n var args = slice(arguments, 1);\n callback.apply(null, [null].concat(args));\n };\n _iteratee(next);\n}\n\n/**\n * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when\n * stopped, or an error occurs. `callback` will be passed an error and any\n * arguments passed to the final `iteratee`'s callback.\n *\n * The inverse of [whilst]{@link module:ControlFlow.whilst}.\n *\n * @name until\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @see [async.whilst]{@link module:ControlFlow.whilst}\n * @category Control Flow\n * @param {Function} test - synchronous truth test to perform before each\n * execution of `iteratee`. Invoked with ().\n * @param {AsyncFunction} iteratee - An async function which is called each time\n * `test` fails. Invoked with (callback).\n * @param {Function} [callback] - A callback which is called after the test\n * function has passed and repeated execution of `iteratee` has stopped. `callback`\n * will be passed an error and any arguments passed to the final `iteratee`'s\n * callback. Invoked with (err, [results]);\n */\nfunction until(test, iteratee, callback) {\n whilst(function() {\n return !test.apply(this, arguments);\n }, iteratee, callback);\n}\n\n/**\n * Runs the `tasks` array of functions in series, each passing their results to\n * the next in the array. However, if any of the `tasks` pass an error to their\n * own callback, the next function is not executed, and the main `callback` is\n * immediately called with the error.\n *\n * @name waterfall\n * @static\n * @memberOf module:ControlFlow\n * @method\n * @category Control Flow\n * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}\n * to run.\n * Each function should complete with any number of `result` values.\n * The `result` values will be passed as arguments, in order, to the next task.\n * @param {Function} [callback] - An optional callback to run once all the\n * functions have completed. This will be passed the results of the last task's\n * callback. Invoked with (err, [results]).\n * @returns undefined\n * @example\n *\n * async.waterfall([\n * function(callback) {\n * callback(null, 'one', 'two');\n * },\n * function(arg1, arg2, callback) {\n * // arg1 now equals 'one' and arg2 now equals 'two'\n * callback(null, 'three');\n * },\n * function(arg1, callback) {\n * // arg1 now equals 'three'\n * callback(null, 'done');\n * }\n * ], function (err, result) {\n * // result now equals 'done'\n * });\n *\n * // Or, with named functions:\n * async.waterfall([\n * myFirstFunction,\n * mySecondFunction,\n * myLastFunction,\n * ], function (err, result) {\n * // result now equals 'done'\n * });\n * function myFirstFunction(callback) {\n * callback(null, 'one', 'two');\n * }\n * function mySecondFunction(arg1, arg2, callback) {\n * // arg1 now equals 'one' and arg2 now equals 'two'\n * callback(null, 'three');\n * }\n * function myLastFunction(arg1, callback) {\n * // arg1 now equals 'three'\n * callback(null, 'done');\n * }\n */\nvar waterfall = function(tasks, callback) {\n callback = once(callback || noop);\n if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));\n if (!tasks.length) return callback();\n var taskIndex = 0;\n\n function nextTask(args) {\n var task = wrapAsync(tasks[taskIndex++]);\n args.push(onlyOnce(next));\n task.apply(null, args);\n }\n\n function next(err/*, ...args*/) {\n if (err || taskIndex === tasks.length) {\n return callback.apply(null, arguments);\n }\n nextTask(slice(arguments, 1));\n }\n\n nextTask([]);\n};\n\n/**\n * An \"async function\" in the context of Async is an asynchronous function with\n * a variable number of parameters, with the final parameter being a callback.\n * (`function (arg1, arg2, ..., callback) {}`)\n * The final callback is of the form `callback(err, results...)`, which must be\n * called once the function is completed. The callback should be called with a\n * Error as its first argument to signal that an error occurred.\n * Otherwise, if no error occurred, it should be called with `null` as the first\n * argument, and any additional `result` arguments that may apply, to signal\n * successful completion.\n * The callback must be called exactly once, ideally on a later tick of the\n * JavaScript event loop.\n *\n * This type of function is also referred to as a \"Node-style async function\",\n * or a \"continuation passing-style function\" (CPS). Most of the methods of this\n * library are themselves CPS/Node-style async functions, or functions that\n * return CPS/Node-style async functions.\n *\n * Wherever we accept a Node-style async function, we also directly accept an\n * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.\n * In this case, the `async` function will not be passed a final callback\n * argument, and any thrown error will be used as the `err` argument of the\n * implicit callback, and the return value will be used as the `result` value.\n * (i.e. a `rejected` of the returned Promise becomes the `err` callback\n * argument, and a `resolved` value becomes the `result`.)\n *\n * Note, due to JavaScript limitations, we can only detect native `async`\n * functions and not transpilied implementations.\n * Your environment must have `async`/`await` support for this to work.\n * (e.g. Node > v7.6, or a recent version of a modern browser).\n * If you are using `async` functions through a transpiler (e.g. Babel), you\n * must still wrap the function with [asyncify]{@link module:Utils.asyncify},\n * because the `async function` will be compiled to an ordinary function that\n * returns a promise.\n *\n * @typedef {Function} AsyncFunction\n * @static\n */\n\n/**\n * Async is a utility module which provides straight-forward, powerful functions\n * for working with asynchronous JavaScript. Although originally designed for\n * use with [Node.js](http://nodejs.org) and installable via\n * `npm install --save async`, it can also be used directly in the browser.\n * @module async\n * @see AsyncFunction\n */\n\n\n/**\n * A collection of `async` functions for manipulating collections, such as\n * arrays and objects.\n * @module Collections\n */\n\n/**\n * A collection of `async` functions for controlling the flow through a script.\n * @module ControlFlow\n */\n\n/**\n * A collection of `async` utility functions.\n * @module Utils\n */\n\nvar index = {\n apply: apply,\n applyEach: applyEach,\n applyEachSeries: applyEachSeries,\n asyncify: asyncify,\n auto: auto,\n autoInject: autoInject,\n cargo: cargo,\n compose: compose,\n concat: concat,\n concatLimit: concatLimit,\n concatSeries: concatSeries,\n constant: constant,\n detect: detect,\n detectLimit: detectLimit,\n detectSeries: detectSeries,\n dir: dir,\n doDuring: doDuring,\n doUntil: doUntil,\n doWhilst: doWhilst,\n during: during,\n each: eachLimit,\n eachLimit: eachLimit$1,\n eachOf: eachOf,\n eachOfLimit: eachOfLimit,\n eachOfSeries: eachOfSeries,\n eachSeries: eachSeries,\n ensureAsync: ensureAsync,\n every: every,\n everyLimit: everyLimit,\n everySeries: everySeries,\n filter: filter,\n filterLimit: filterLimit,\n filterSeries: filterSeries,\n forever: forever,\n groupBy: groupBy,\n groupByLimit: groupByLimit,\n groupBySeries: groupBySeries,\n log: log,\n map: map,\n mapLimit: mapLimit,\n mapSeries: mapSeries,\n mapValues: mapValues,\n mapValuesLimit: mapValuesLimit,\n mapValuesSeries: mapValuesSeries,\n memoize: memoize,\n nextTick: nextTick,\n parallel: parallelLimit,\n parallelLimit: parallelLimit$1,\n priorityQueue: priorityQueue,\n queue: queue$1,\n race: race,\n reduce: reduce,\n reduceRight: reduceRight,\n reflect: reflect,\n reflectAll: reflectAll,\n reject: reject,\n rejectLimit: rejectLimit,\n rejectSeries: rejectSeries,\n retry: retry,\n retryable: retryable,\n seq: seq,\n series: series,\n setImmediate: setImmediate$1,\n some: some,\n someLimit: someLimit,\n someSeries: someSeries,\n sortBy: sortBy,\n timeout: timeout,\n times: times,\n timesLimit: timeLimit,\n timesSeries: timesSeries,\n transform: transform,\n tryEach: tryEach,\n unmemoize: unmemoize,\n until: until,\n waterfall: waterfall,\n whilst: whilst,\n\n // aliases\n all: every,\n allLimit: everyLimit,\n allSeries: everySeries,\n any: some,\n anyLimit: someLimit,\n anySeries: someSeries,\n find: detect,\n findLimit: detectLimit,\n findSeries: detectSeries,\n forEach: eachLimit,\n forEachSeries: eachSeries,\n forEachLimit: eachLimit$1,\n forEachOf: eachOf,\n forEachOfSeries: eachOfSeries,\n forEachOfLimit: eachOfLimit,\n inject: reduce,\n foldl: reduce,\n foldr: reduceRight,\n select: filter,\n selectLimit: filterLimit,\n selectSeries: filterSeries,\n wrapSync: asyncify\n};\n\nexports['default'] = index;\nexports.apply = apply;\nexports.applyEach = applyEach;\nexports.applyEachSeries = applyEachSeries;\nexports.asyncify = asyncify;\nexports.auto = auto;\nexports.autoInject = autoInject;\nexports.cargo = cargo;\nexports.compose = compose;\nexports.concat = concat;\nexports.concatLimit = concatLimit;\nexports.concatSeries = concatSeries;\nexports.constant = constant;\nexports.detect = detect;\nexports.detectLimit = detectLimit;\nexports.detectSeries = detectSeries;\nexports.dir = dir;\nexports.doDuring = doDuring;\nexports.doUntil = doUntil;\nexports.doWhilst = doWhilst;\nexports.during = during;\nexports.each = eachLimit;\nexports.eachLimit = eachLimit$1;\nexports.eachOf = eachOf;\nexports.eachOfLimit = eachOfLimit;\nexports.eachOfSeries = eachOfSeries;\nexports.eachSeries = eachSeries;\nexports.ensureAsync = ensureAsync;\nexports.every = every;\nexports.everyLimit = everyLimit;\nexports.everySeries = everySeries;\nexports.filter = filter;\nexports.filterLimit = filterLimit;\nexports.filterSeries = filterSeries;\nexports.forever = forever;\nexports.groupBy = groupBy;\nexports.groupByLimit = groupByLimit;\nexports.groupBySeries = groupBySeries;\nexports.log = log;\nexports.map = map;\nexports.mapLimit = mapLimit;\nexports.mapSeries = mapSeries;\nexports.mapValues = mapValues;\nexports.mapValuesLimit = mapValuesLimit;\nexports.mapValuesSeries = mapValuesSeries;\nexports.memoize = memoize;\nexports.nextTick = nextTick;\nexports.parallel = parallelLimit;\nexports.parallelLimit = parallelLimit$1;\nexports.priorityQueue = priorityQueue;\nexports.queue = queue$1;\nexports.race = race;\nexports.reduce = reduce;\nexports.reduceRight = reduceRight;\nexports.reflect = reflect;\nexports.reflectAll = reflectAll;\nexports.reject = reject;\nexports.rejectLimit = rejectLimit;\nexports.rejectSeries = rejectSeries;\nexports.retry = retry;\nexports.retryable = retryable;\nexports.seq = seq;\nexports.series = series;\nexports.setImmediate = setImmediate$1;\nexports.some = some;\nexports.someLimit = someLimit;\nexports.someSeries = someSeries;\nexports.sortBy = sortBy;\nexports.timeout = timeout;\nexports.times = times;\nexports.timesLimit = timeLimit;\nexports.timesSeries = timesSeries;\nexports.transform = transform;\nexports.tryEach = tryEach;\nexports.unmemoize = unmemoize;\nexports.until = until;\nexports.waterfall = waterfall;\nexports.whilst = whilst;\nexports.all = every;\nexports.allLimit = everyLimit;\nexports.allSeries = everySeries;\nexports.any = some;\nexports.anyLimit = someLimit;\nexports.anySeries = someSeries;\nexports.find = detect;\nexports.findLimit = detectLimit;\nexports.findSeries = detectSeries;\nexports.forEach = eachLimit;\nexports.forEachSeries = eachSeries;\nexports.forEachLimit = eachLimit$1;\nexports.forEachOf = eachOf;\nexports.forEachOfSeries = eachOfSeries;\nexports.forEachOfLimit = eachOfLimit;\nexports.inject = reduce;\nexports.foldl = reduce;\nexports.foldr = reduceRight;\nexports.select = filter;\nexports.selectLimit = filterLimit;\nexports.selectSeries = filterSeries;\nexports.wrapSync = asyncify;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","// Copyright (c) 2014 Takuya Asano All Rights Reserved.\n\n(function () {\n\n \"use strict\";\n\n var TERM_CHAR = \"\\u0000\", // terminal character\n TERM_CODE = 0, // terminal character code\n ROOT_ID = 0, // index of root node\n NOT_FOUND = -1, // traverse() returns if no nodes found\n BASE_SIGNED = true,\n CHECK_SIGNED = true,\n BASE_BYTES = 4,\n CHECK_BYTES = 4,\n MEMORY_EXPAND_RATIO = 2;\n\n\n var newBC = function (initial_size) {\n\n if (initial_size == null) {\n initial_size = 1024;\n }\n\n var initBase = function (_base, start, end) { // 'end' index does not include\n for (var i = start; i < end; i++) {\n _base[i] = - i + 1; // inversed previous empty node index\n }\n if (0 < check.array[check.array.length - 1]) {\n var last_used_id = check.array.length - 2;\n while (0 < check.array[last_used_id]) {\n last_used_id--;\n }\n _base[start] = - last_used_id;\n }\n };\n\n var initCheck = function (_check, start, end) {\n for (var i = start; i < end; i++) {\n _check[i] = - i - 1; // inversed next empty node index\n }\n };\n\n var realloc = function (min_size) {\n // expand arrays size by given ratio\n var new_size = min_size * MEMORY_EXPAND_RATIO;\n // console.log('re-allocate memory to ' + new_size);\n\n var base_new_array = newArrayBuffer(base.signed, base.bytes, new_size);\n initBase(base_new_array, base.array.length, new_size); // init BASE in new range\n base_new_array.set(base.array);\n base.array = null; // explicit GC\n base.array = base_new_array;\n\n var check_new_array = newArrayBuffer(check.signed, check.bytes, new_size);\n initCheck(check_new_array, check.array.length, new_size); // init CHECK in new range\n check_new_array.set(check.array);\n check.array = null; // explicit GC\n check.array = check_new_array;\n };\n\n var first_unused_node = ROOT_ID + 1;\n\n var base = {\n signed: BASE_SIGNED,\n bytes: BASE_BYTES,\n array: newArrayBuffer(BASE_SIGNED, BASE_BYTES, initial_size)\n };\n\n var check = {\n signed: CHECK_SIGNED,\n bytes: CHECK_BYTES,\n array: newArrayBuffer(CHECK_SIGNED, CHECK_BYTES, initial_size)\n };\n\n // init root node\n base.array[ROOT_ID] = 1;\n check.array[ROOT_ID] = ROOT_ID;\n\n // init BASE\n initBase(base.array, ROOT_ID + 1, base.array.length);\n\n // init CHECK\n initCheck(check.array, ROOT_ID + 1, check.array.length);\n\n return {\n getBaseBuffer: function () {\n return base.array;\n },\n getCheckBuffer: function () {\n return check.array;\n },\n loadBaseBuffer: function (base_buffer) {\n base.array = base_buffer;\n return this;\n },\n loadCheckBuffer: function (check_buffer) {\n check.array = check_buffer;\n return this;\n },\n size: function () {\n return Math.max(base.array.length, check.array.length);\n },\n getBase: function (index) {\n if (base.array.length - 1 < index) {\n return - index + 1;\n // realloc(index);\n }\n // if (!Number.isFinite(base.array[index])) {\n // console.log('getBase:' + index);\n // throw 'getBase' + index;\n // }\n return base.array[index];\n },\n getCheck: function (index) {\n if (check.array.length - 1 < index) {\n return - index - 1;\n // realloc(index);\n }\n // if (!Number.isFinite(check.array[index])) {\n // console.log('getCheck:' + index);\n // throw 'getCheck' + index;\n // }\n return check.array[index];\n },\n setBase: function (index, base_value) {\n if (base.array.length - 1 < index) {\n realloc(index);\n }\n base.array[index] = base_value;\n },\n setCheck: function (index, check_value) {\n if (check.array.length - 1 < index) {\n realloc(index);\n }\n check.array[index] = check_value;\n },\n setFirstUnusedNode: function (index) {\n // if (!Number.isFinite(index)) {\n // throw 'assertion error: setFirstUnusedNode ' + index + ' is not finite number';\n // }\n first_unused_node = index;\n },\n getFirstUnusedNode: function () {\n // if (!Number.isFinite(first_unused_node)) {\n // throw 'assertion error: getFirstUnusedNode ' + first_unused_node + ' is not finite number';\n // }\n return first_unused_node;\n },\n shrink: function () {\n var last_index = this.size() - 1;\n while (true) {\n if (0 <= check.array[last_index]) {\n break;\n }\n last_index--;\n }\n base.array = base.array.subarray(0, last_index + 2); // keep last unused node\n check.array = check.array.subarray(0, last_index + 2); // keep last unused node\n },\n calc: function () {\n var unused_count = 0;\n var size = check.array.length;\n for (var i = 0; i < size; i++) {\n if (check.array[i] < 0) {\n unused_count++;\n }\n }\n return {\n all: size,\n unused: unused_count,\n efficiency: (size - unused_count) / size\n };\n },\n dump: function () {\n // for debug\n var dump_base = \"\";\n var dump_check = \"\";\n\n var i;\n for (i = 0; i < base.array.length; i++) {\n dump_base = dump_base + \" \" + this.getBase(i);\n }\n for (i = 0; i < check.array.length; i++) {\n dump_check = dump_check + \" \" + this.getCheck(i);\n }\n\n console.log(\"base:\" + dump_base);\n console.log(\"chck:\" + dump_check);\n\n return \"base:\" + dump_base + \" chck:\" + dump_check;\n }\n };\n };\n\n\n /**\n * Factory method of double array\n */\n function DoubleArrayBuilder(initial_size) {\n this.bc = newBC(initial_size); // BASE and CHECK\n this.keys = [];\n }\n\n\n /**\n * Append a key to initialize set\n * (This method should be called by dictionary ordered key)\n *\n * @param {String} key\n * @param {Number} value Integer value from 0 to max signed integer number - 1\n */\n DoubleArrayBuilder.prototype.append = function (key, record) {\n this.keys.push({ k: key, v: record });\n return this;\n };\n\n /**\n * Build double array for given keys\n *\n * @param {Array} keys Array of keys. A key is a Object which has properties 'k', 'v'.\n * 'k' is a key string, 'v' is a record assigned to that key.\n * @return {DoubleArray} Compiled double array\n */\n DoubleArrayBuilder.prototype.build = function (keys, sorted) {\n\n if (keys == null) {\n keys = this.keys;\n }\n\n if (keys == null) {\n return new DoubleArray(this.bc);\n }\n\n if (sorted == null) {\n sorted = false;\n }\n\n // Convert key string to ArrayBuffer\n var buff_keys =\n keys.map(function (k) {\n return {\n k: stringToUtf8Bytes(k.k + TERM_CHAR),\n v: k.v\n };\n });\n\n // Sort keys by byte order\n if (sorted) {\n this.keys = buff_keys;\n } else {\n this.keys =\n buff_keys.sort(function (k1, k2) {\n var b1 = k1.k;\n var b2 = k2.k;\n var min_length = Math.min(b1.length, b2.length);\n for (var pos = 0; pos < min_length; pos++) {\n if (b1[pos] === b2[pos]) {\n continue;\n }\n return b1[pos] - b2[pos];\n }\n return b1.length - b2.length;\n });\n }\n\n buff_keys = null; // explicit GC\n\n this._build(ROOT_ID, 0, 0, this.keys.length);\n return new DoubleArray(this.bc);\n };\n\n /**\n * Append nodes to BASE and CHECK array recursively\n */\n DoubleArrayBuilder.prototype._build = function (parent_index, position, start, length) {\n\n var children_info = this.getChildrenInfo(position, start, length);\n var _base = this.findAllocatableBase(children_info);\n\n this.setBC(parent_index, children_info, _base);\n\n for (var i = 0; i < children_info.length; i = i + 3) {\n var child_code = children_info[i];\n if (child_code === TERM_CODE) {\n continue;\n }\n var child_start = children_info[i + 1];\n var child_len = children_info[i + 2];\n var child_index = _base + child_code;\n this._build(child_index, position + 1, child_start, child_len);\n }\n };\n\n DoubleArrayBuilder.prototype.getChildrenInfo = function (position, start, length) {\n var current_char = this.keys[start].k[position];\n var i = 0;\n var children_info = new Int32Array(length * 3);\n\n children_info[i++] = current_char; // char (current)\n children_info[i++] = start; // start index (current)\n\n var next_pos = start;\n var start_pos = start;\n for (; next_pos < start + length; next_pos++) {\n var next_char = this.keys[next_pos].k[position];\n if (current_char !== next_char) {\n children_info[i++] = next_pos - start_pos; // length (current)\n\n children_info[i++] = next_char; // char (next)\n children_info[i++] = next_pos; // start index (next)\n current_char = next_char;\n start_pos = next_pos;\n }\n }\n children_info[i++] = next_pos - start_pos;\n children_info = children_info.subarray(0, i);\n\n return children_info;\n };\n\n DoubleArrayBuilder.prototype.setBC = function (parent_id, children_info, _base) {\n\n var bc = this.bc;\n\n bc.setBase(parent_id, _base); // Update BASE of parent node\n\n var i;\n for (i = 0; i < children_info.length; i = i + 3) {\n var code = children_info[i];\n var child_id = _base + code;\n\n // Update linked list of unused nodes\n\n // Assertion\n // if (child_id < 0) {\n // throw 'assertion error: child_id is negative'\n // }\n\n var prev_unused_id = - bc.getBase(child_id);\n var next_unused_id = - bc.getCheck(child_id);\n // if (prev_unused_id < 0) {\n // throw 'assertion error: setBC'\n // }\n // if (next_unused_id < 0) {\n // throw 'assertion error: setBC'\n // }\n if (child_id !== bc.getFirstUnusedNode()) {\n bc.setCheck(prev_unused_id, - next_unused_id);\n } else {\n // Update first_unused_node\n bc.setFirstUnusedNode(next_unused_id);\n }\n bc.setBase(next_unused_id, - prev_unused_id);\n\n var check = parent_id; // CHECK is parent node index\n bc.setCheck(child_id, check); // Update CHECK of child node\n\n // Update record\n if (code === TERM_CODE) {\n var start_pos = children_info[i + 1];\n // var len = children_info[i + 2];\n // if (len != 1) {\n // throw 'assertion error: there are multiple terminal nodes. len:' + len;\n // }\n var value = this.keys[start_pos].v;\n\n if (value == null) {\n value = 0;\n }\n\n var base = - value - 1; // BASE is inverted record value\n bc.setBase(child_id, base); // Update BASE of child(leaf) node\n }\n }\n };\n\n\n /**\n * Find BASE value that all children are allocatable in double array's region\n */\n DoubleArrayBuilder.prototype.findAllocatableBase = function (children_info) {\n\n var bc = this.bc;\n\n // Assertion: keys are sorted by byte order\n // var c = -1;\n // for (var i = 0; i < children_info.length; i = i + 3) {\n // if (children_info[i] < c) {\n // throw 'assertion error: not sort key'\n // }\n // c = children_info[i];\n // }\n\n // iterate linked list of unused nodes\n var _base;\n var curr = bc.getFirstUnusedNode(); // current index\n // if (curr < 0) {\n // throw 'assertion error: getFirstUnusedNode returns negative value'\n // }\n\n while (true) {\n _base = curr - children_info[0];\n\n if (_base < 0) {\n curr = - bc.getCheck(curr); // next\n\n // if (curr < 0) {\n // throw 'assertion error: getCheck returns negative value'\n // }\n\n continue;\n }\n\n var empty_area_found = true;\n for (var i = 0; i < children_info.length; i = i + 3) {\n var code = children_info[i];\n var candidate_id = _base + code;\n\n if (!this.isUnusedNode(candidate_id)) {\n // candidate_id is used node\n // next\n curr = - bc.getCheck(curr);\n // if (curr < 0) {\n // throw 'assertion error: getCheck returns negative value'\n // }\n\n empty_area_found = false;\n break;\n }\n }\n if (empty_area_found) {\n // Area is free\n return _base;\n }\n }\n };\n\n /**\n * Check this double array index is unused or not\n */\n DoubleArrayBuilder.prototype.isUnusedNode = function (index) {\n var bc = this.bc;\n var check = bc.getCheck(index);\n\n // if (index < 0) {\n // throw 'assertion error: isUnusedNode index:' + index;\n // }\n\n if (index === ROOT_ID) {\n // root node\n return false;\n }\n if (check < 0) {\n // unused\n return true;\n }\n\n // used node (incl. leaf)\n return false;\n };\n\n\n /**\n * Factory method of double array\n */\n function DoubleArray(bc) {\n this.bc = bc; // BASE and CHECK\n this.bc.shrink();\n }\n\n\n /**\n * Look up a given key in this trie\n *\n * @param {String} key\n * @return {Boolean} True if this trie contains a given key\n */\n DoubleArray.prototype.contain = function (key) {\n\n var bc = this.bc;\n\n key += TERM_CHAR;\n var buffer = stringToUtf8Bytes(key);\n\n var parent = ROOT_ID;\n var child = NOT_FOUND;\n\n for (var i = 0; i < buffer.length; i++) {\n var code = buffer[i];\n\n child = this.traverse(parent, code);\n if (child === NOT_FOUND) {\n return false;\n }\n\n if (bc.getBase(child) <= 0) {\n // leaf node\n return true;\n } else {\n // not leaf\n parent = child;\n continue;\n }\n }\n return false;\n };\n\n\n /**\n * Look up a given key in this trie\n *\n * @param {String} key\n * @return {Number} Record value assgned to this key, -1 if this key does not contain\n */\n DoubleArray.prototype.lookup = function (key) {\n\n key += TERM_CHAR;\n var buffer = stringToUtf8Bytes(key);\n\n var parent = ROOT_ID;\n var child = NOT_FOUND;\n\n for (var i = 0; i < buffer.length; i++) {\n var code = buffer[i];\n child = this.traverse(parent, code);\n if (child === NOT_FOUND) {\n return NOT_FOUND;\n }\n parent = child;\n }\n\n var base = this.bc.getBase(child);\n if (base <= 0) {\n // leaf node\n return - base - 1;\n } else {\n // not leaf\n return NOT_FOUND;\n }\n };\n\n\n /**\n * Common prefix search\n *\n * @param {String} key\n * @return {Array} Each result object has 'k' and 'v' (key and record,\n * respectively) properties assigned to matched string\n */\n DoubleArray.prototype.commonPrefixSearch = function (key) {\n\n var buffer = stringToUtf8Bytes(key);\n\n var parent = ROOT_ID;\n var child = NOT_FOUND;\n\n var result = [];\n\n for (var i = 0; i < buffer.length; i++) {\n var code = buffer[i];\n\n child = this.traverse(parent, code);\n\n if (child !== NOT_FOUND) {\n parent = child;\n\n // look forward by terminal character code to check this node is a leaf or not\n var grand_child = this.traverse(child, TERM_CODE);\n\n if (grand_child !== NOT_FOUND) {\n var base = this.bc.getBase(grand_child);\n\n var r = {};\n\n if (base <= 0) {\n // If child is a leaf node, add record to result\n r.v = - base - 1;\n }\n\n // If child is a leaf node, add word to result\n r.k = utf8BytesToString(arrayCopy(buffer, 0, i + 1));\n\n result.push(r);\n }\n continue;\n } else {\n break;\n }\n }\n\n return result;\n };\n\n DoubleArray.prototype.traverse = function (parent, code) {\n var child = this.bc.getBase(parent) + code;\n if (this.bc.getCheck(child) === parent) {\n return child;\n } else {\n return NOT_FOUND;\n }\n };\n\n DoubleArray.prototype.size = function () {\n return this.bc.size();\n };\n\n DoubleArray.prototype.calc = function () {\n return this.bc.calc();\n };\n\n DoubleArray.prototype.dump = function () {\n return this.bc.dump();\n };\n\n\n // Array utility functions\n\n var newArrayBuffer = function (signed, bytes, size) {\n if (signed) {\n switch(bytes) {\n case 1:\n return new Int8Array(size);\n case 2:\n return new Int16Array(size);\n case 4:\n return new Int32Array(size);\n default:\n throw new RangeError(\"Invalid newArray parameter element_bytes:\" + bytes);\n }\n } else {\n switch(bytes) {\n case 1:\n return new Uint8Array(size);\n case 2:\n return new Uint16Array(size);\n case 4:\n return new Uint32Array(size);\n default:\n throw new RangeError(\"Invalid newArray parameter element_bytes:\" + bytes);\n }\n }\n };\n\n var arrayCopy = function (src, src_offset, length) {\n var buffer = new ArrayBuffer(length);\n var dstU8 = new Uint8Array(buffer, 0, length);\n var srcU8 = src.subarray(src_offset, length);\n dstU8.set(srcU8);\n return dstU8;\n };\n\n\n /**\n * Convert String (UTF-16) to UTF-8 ArrayBuffer\n *\n * @param {String} str UTF-16 string to convert\n * @return {Uint8Array} Byte sequence encoded by UTF-8\n */\n var stringToUtf8Bytes = function (str) {\n\n // Max size of 1 character is 4 bytes\n var bytes = new Uint8Array(new ArrayBuffer(str.length * 4));\n\n var i = 0, j = 0;\n\n while (i < str.length) {\n var unicode_code;\n\n var utf16_code = str.charCodeAt(i++);\n if (utf16_code >= 0xD800 && utf16_code <= 0xDBFF) {\n // surrogate pair\n var upper = utf16_code; // high surrogate\n var lower = str.charCodeAt(i++); // low surrogate\n\n if (lower >= 0xDC00 && lower <= 0xDFFF) {\n unicode_code =\n (upper - 0xD800) * (1 << 10) + (1 << 16) +\n (lower - 0xDC00);\n } else {\n // malformed surrogate pair\n return null;\n }\n } else {\n // not surrogate code\n unicode_code = utf16_code;\n }\n\n if (unicode_code < 0x80) {\n // 1-byte\n bytes[j++] = unicode_code;\n\n } else if (unicode_code < (1 << 11)) {\n // 2-byte\n bytes[j++] = (unicode_code >>> 6) | 0xC0;\n bytes[j++] = (unicode_code & 0x3F) | 0x80;\n\n } else if (unicode_code < (1 << 16)) {\n // 3-byte\n bytes[j++] = (unicode_code >>> 12) | 0xE0;\n bytes[j++] = ((unicode_code >> 6) & 0x3f) | 0x80;\n bytes[j++] = (unicode_code & 0x3F) | 0x80;\n\n } else if (unicode_code < (1 << 21)) {\n // 4-byte\n bytes[j++] = (unicode_code >>> 18) | 0xF0;\n bytes[j++] = ((unicode_code >> 12) & 0x3F) | 0x80;\n bytes[j++] = ((unicode_code >> 6) & 0x3F) | 0x80;\n bytes[j++] = (unicode_code & 0x3F) | 0x80;\n\n } else {\n // malformed UCS4 code\n }\n }\n\n return bytes.subarray(0, j);\n };\n\n\n /**\n * Convert UTF-8 ArrayBuffer to String (UTF-16)\n *\n * @param {Uint8Array} bytes UTF-8 byte sequence to convert\n * @return {String} String encoded by UTF-16\n */\n var utf8BytesToString = function (bytes) {\n\n var str = \"\";\n var code, b1, b2, b3, b4, upper, lower;\n var i = 0;\n\n while (i < bytes.length) {\n\n b1 = bytes[i++];\n\n if (b1 < 0x80) {\n // 1 byte\n code = b1;\n } else if ((b1 >> 5) === 0x06) {\n // 2 bytes\n b2 = bytes[i++];\n code = ((b1 & 0x1f) << 6) | (b2 & 0x3f);\n } else if ((b1 >> 4) === 0x0e) {\n // 3 bytes\n b2 = bytes[i++];\n b3 = bytes[i++];\n code = ((b1 & 0x0f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x3f);\n } else {\n // 4 bytes\n b2 = bytes[i++];\n b3 = bytes[i++];\n b4 = bytes[i++];\n code = ((b1 & 0x07) << 18) | ((b2 & 0x3f) << 12) | ((b3 & 0x3f) << 6) | (b4 & 0x3f);\n }\n\n if (code < 0x10000) {\n\t str += String.fromCharCode(code);\n } else {\n\t // surrogate pair\n\t code -= 0x10000;\n\t upper = (0xD800 | (code >> 10));\n\t lower = (0xDC00 | (code & 0x3FF));\n\t str += String.fromCharCode(upper, lower);\n }\n }\n\n return str;\n };\n\n\n // public methods\n var doublearray = {\n builder: function (initial_size) {\n return new DoubleArrayBuilder(initial_size);\n },\n load: function (base_buffer, check_buffer) {\n var bc = newBC(0);\n bc.loadBaseBuffer(base_buffer);\n bc.loadCheckBuffer(check_buffer);\n return new DoubleArray(bc);\n }\n };\n\n if (\"undefined\" === typeof module) {\n\t // In browser\n window.doublearray = doublearray;\n } else {\n\t // In node\n module.exports = doublearray;\n }\n\n})();\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * Convert String (UTF-16) to UTF-8 ArrayBuffer\n *\n * @param {String} str UTF-16 string to convert\n * @return {Uint8Array} Byte sequence encoded by UTF-8\n */\nvar stringToUtf8Bytes = function (str) {\n\n // Max size of 1 character is 4 bytes\n var bytes = new Uint8Array(str.length * 4);\n\n var i = 0, j = 0;\n\n while (i < str.length) {\n var unicode_code;\n\n var utf16_code = str.charCodeAt(i++);\n if (utf16_code >= 0xD800 && utf16_code <= 0xDBFF) {\n // surrogate pair\n var upper = utf16_code; // high surrogate\n var lower = str.charCodeAt(i++); // low surrogate\n\n if (lower >= 0xDC00 && lower <= 0xDFFF) {\n unicode_code =\n (upper - 0xD800) * (1 << 10) + (1 << 16) +\n (lower - 0xDC00);\n } else {\n // malformed surrogate pair\n return null;\n }\n } else {\n // not surrogate code\n unicode_code = utf16_code;\n }\n\n if (unicode_code < 0x80) {\n // 1-byte\n bytes[j++] = unicode_code;\n\n } else if (unicode_code < (1 << 11)) {\n // 2-byte\n bytes[j++] = (unicode_code >>> 6) | 0xC0;\n bytes[j++] = (unicode_code & 0x3F) | 0x80;\n\n } else if (unicode_code < (1 << 16)) {\n // 3-byte\n bytes[j++] = (unicode_code >>> 12) | 0xE0;\n bytes[j++] = ((unicode_code >> 6) & 0x3f) | 0x80;\n bytes[j++] = (unicode_code & 0x3F) | 0x80;\n\n } else if (unicode_code < (1 << 21)) {\n // 4-byte\n bytes[j++] = (unicode_code >>> 18) | 0xF0;\n bytes[j++] = ((unicode_code >> 12) & 0x3F) | 0x80;\n bytes[j++] = ((unicode_code >> 6) & 0x3F) | 0x80;\n bytes[j++] = (unicode_code & 0x3F) | 0x80;\n\n } else {\n // malformed UCS4 code\n }\n }\n\n return bytes.subarray(0, j);\n};\n\n/**\n * Convert UTF-8 ArrayBuffer to String (UTF-16)\n *\n * @param {Array} bytes UTF-8 byte sequence to convert\n * @return {String} String encoded by UTF-16\n */\nvar utf8BytesToString = function (bytes) {\n\n var str = \"\";\n var code, b1, b2, b3, b4, upper, lower;\n var i = 0;\n\n while (i < bytes.length) {\n\n b1 = bytes[i++];\n\n if (b1 < 0x80) {\n // 1 byte\n code = b1;\n } else if ((b1 >> 5) === 0x06) {\n // 2 bytes\n b2 = bytes[i++];\n code = ((b1 & 0x1f) << 6) | (b2 & 0x3f);\n } else if ((b1 >> 4) === 0x0e) {\n // 3 bytes\n b2 = bytes[i++];\n b3 = bytes[i++];\n code = ((b1 & 0x0f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x3f);\n } else {\n // 4 bytes\n b2 = bytes[i++];\n b3 = bytes[i++];\n b4 = bytes[i++];\n code = ((b1 & 0x07) << 18) | ((b2 & 0x3f) << 12) | ((b3 & 0x3f) << 6) | (b4 & 0x3f);\n }\n\n if (code < 0x10000) {\n str += String.fromCharCode(code);\n } else {\n // surrogate pair\n code -= 0x10000;\n upper = (0xD800 | (code >> 10));\n lower = (0xDC00 | (code & 0x3FF));\n str += String.fromCharCode(upper, lower);\n }\n }\n\n return str;\n};\n\n/**\n * Utilities to manipulate byte sequence\n * @param {(number|Uint8Array)} arg Initial size of this buffer (number), or buffer to set (Uint8Array)\n * @constructor\n */\nfunction ByteBuffer(arg) {\n var initial_size;\n if (arg == null) {\n initial_size = 1024 * 1024;\n } else if (typeof arg === \"number\") {\n initial_size = arg;\n } else if (arg instanceof Uint8Array) {\n this.buffer = arg;\n this.position = 0; // Overwrite\n return;\n } else {\n // typeof arg -> String\n throw typeof arg + \" is invalid parameter type for ByteBuffer constructor\";\n }\n // arg is null or number\n this.buffer = new Uint8Array(initial_size);\n this.position = 0;\n}\n\nByteBuffer.prototype.size = function () {\n return this.buffer.length;\n};\n\nByteBuffer.prototype.reallocate = function () {\n var new_array = new Uint8Array(this.buffer.length * 2);\n new_array.set(this.buffer);\n this.buffer = new_array;\n};\n\nByteBuffer.prototype.shrink = function () {\n this.buffer = this.buffer.subarray(0, this.position);\n return this.buffer;\n};\n\nByteBuffer.prototype.put = function (b) {\n if (this.buffer.length < this.position + 1) {\n this.reallocate();\n }\n this.buffer[this.position++] = b;\n};\n\nByteBuffer.prototype.get = function (index) {\n if (index == null) {\n index = this.position;\n this.position += 1;\n }\n if (this.buffer.length < index + 1) {\n return 0;\n }\n return this.buffer[index];\n};\n\n// Write short to buffer by little endian\nByteBuffer.prototype.putShort = function (num) {\n if (0xFFFF < num) {\n throw num + \" is over short value\";\n }\n var lower = (0x00FF & num);\n var upper = (0xFF00 & num) >> 8;\n this.put(lower);\n this.put(upper);\n};\n\n// Read short from buffer by little endian\nByteBuffer.prototype.getShort = function (index) {\n if (index == null) {\n index = this.position;\n this.position += 2;\n }\n if (this.buffer.length < index + 2) {\n return 0;\n }\n var lower = this.buffer[index];\n var upper = this.buffer[index + 1];\n var value = (upper << 8) + lower;\n if (value & 0x8000) {\n\tvalue = -((value - 1) ^ 0xFFFF);\n }\n return value;\n};\n\n// Write integer to buffer by little endian\nByteBuffer.prototype.putInt = function (num) {\n if (0xFFFFFFFF < num) {\n throw num + \" is over integer value\";\n }\n var b0 = (0x000000FF & num);\n var b1 = (0x0000FF00 & num) >> 8;\n var b2 = (0x00FF0000 & num) >> 16;\n var b3 = (0xFF000000 & num) >> 24;\n this.put(b0);\n this.put(b1);\n this.put(b2);\n this.put(b3);\n};\n\n// Read integer from buffer by little endian\nByteBuffer.prototype.getInt = function (index) {\n if (index == null) {\n index = this.position;\n this.position += 4;\n }\n if (this.buffer.length < index + 4) {\n return 0;\n }\n var b0 = this.buffer[index];\n var b1 = this.buffer[index + 1];\n var b2 = this.buffer[index + 2];\n var b3 = this.buffer[index + 3];\n\n return (b3 << 24) + (b2 << 16) + (b1 << 8) + b0;\n};\n\nByteBuffer.prototype.readInt = function () {\n var pos = this.position;\n this.position += 4;\n return this.getInt(pos);\n};\n\nByteBuffer.prototype.putString = function (str) {\n var bytes = stringToUtf8Bytes(str);\n for (var i = 0; i < bytes.length; i++) {\n this.put(bytes[i]);\n }\n // put null character as terminal character\n this.put(0);\n};\n\nByteBuffer.prototype.getString = function (index) {\n var buf = [],\n ch;\n if (index == null) {\n index = this.position;\n }\n while (true) {\n if (this.buffer.length < index + 1) {\n break;\n }\n ch = this.get(index++);\n if (ch === 0) {\n break;\n } else {\n buf.push(ch);\n }\n }\n this.position = index;\n return utf8BytesToString(buf);\n};\n\nmodule.exports = ByteBuffer;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar ByteBuffer = require(\"../util/ByteBuffer\");\n\n/**\n * TokenInfoDictionary\n * @constructor\n */\nfunction TokenInfoDictionary() {\n this.dictionary = new ByteBuffer(10 * 1024 * 1024);\n this.target_map = {}; // trie_id (of surface form) -> token_info_id (of token)\n this.pos_buffer = new ByteBuffer(10 * 1024 * 1024);\n}\n\n// left_id right_id word_cost ...\n// ^ this position is token_info_id\nTokenInfoDictionary.prototype.buildDictionary = function (entries) {\n var dictionary_entries = {}; // using as hashmap, string -> string (word_id -> surface_form) to build dictionary\n\n for (var i = 0; i < entries.length; i++) {\n var entry = entries[i];\n\n if (entry.length < 4) {\n continue;\n }\n\n var surface_form = entry[0];\n var left_id = entry[1];\n var right_id = entry[2];\n var word_cost = entry[3];\n var feature = entry.slice(4).join(\",\"); // TODO Optimize\n\n // Assertion\n if (!isFinite(left_id) || !isFinite(right_id) || !isFinite(word_cost)) {\n console.log(entry);\n }\n\n var token_info_id = this.put(left_id, right_id, word_cost, surface_form, feature);\n dictionary_entries[token_info_id] = surface_form;\n }\n\n // Remove last unused area\n this.dictionary.shrink();\n this.pos_buffer.shrink();\n\n return dictionary_entries;\n};\n\nTokenInfoDictionary.prototype.put = function (left_id, right_id, word_cost, surface_form, feature) {\n var token_info_id = this.dictionary.position;\n var pos_id = this.pos_buffer.position;\n\n this.dictionary.putShort(left_id);\n this.dictionary.putShort(right_id);\n this.dictionary.putShort(word_cost);\n this.dictionary.putInt(pos_id);\n this.pos_buffer.putString(surface_form + \",\" + feature);\n\n return token_info_id;\n};\n\nTokenInfoDictionary.prototype.addMapping = function (source, target) {\n var mapping = this.target_map[source];\n if (mapping == null) {\n mapping = [];\n }\n mapping.push(target);\n\n this.target_map[source] = mapping;\n};\n\nTokenInfoDictionary.prototype.targetMapToBuffer = function () {\n var buffer = new ByteBuffer();\n var map_keys_size = Object.keys(this.target_map).length;\n buffer.putInt(map_keys_size);\n for (var key in this.target_map) {\n var values = this.target_map[key]; // Array\n var map_values_size = values.length;\n buffer.putInt(parseInt(key));\n buffer.putInt(map_values_size);\n for (var i = 0; i < values.length; i++) {\n buffer.putInt(values[i]);\n }\n }\n return buffer.shrink(); // Shrink-ed Typed Array\n};\n\n// from tid.dat\nTokenInfoDictionary.prototype.loadDictionary = function (array_buffer) {\n this.dictionary = new ByteBuffer(array_buffer);\n return this;\n};\n\n// from tid_pos.dat\nTokenInfoDictionary.prototype.loadPosVector = function (array_buffer) {\n this.pos_buffer = new ByteBuffer(array_buffer);\n return this;\n};\n\n// from tid_map.dat\nTokenInfoDictionary.prototype.loadTargetMap = function (array_buffer) {\n var buffer = new ByteBuffer(array_buffer);\n buffer.position = 0;\n this.target_map = {};\n buffer.readInt(); // map_keys_size\n while (true) {\n if (buffer.buffer.length < buffer.position + 1) {\n break;\n }\n var key = buffer.readInt();\n var map_values_size = buffer.readInt();\n for (var i = 0; i < map_values_size; i++) {\n var value = buffer.readInt();\n this.addMapping(key, value);\n }\n }\n return this;\n};\n\n/**\n * Look up features in the dictionary\n * @param {string} token_info_id_str Word ID to look up\n * @returns {string} Features string concatenated by \",\"\n */\nTokenInfoDictionary.prototype.getFeatures = function (token_info_id_str) {\n var token_info_id = parseInt(token_info_id_str);\n if (isNaN(token_info_id)) {\n // TODO throw error\n return \"\";\n }\n var pos_id = this.dictionary.getInt(token_info_id + 6);\n return this.pos_buffer.getString(pos_id);\n};\n\nmodule.exports = TokenInfoDictionary;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * Connection costs matrix from cc.dat file.\n * 2 dimension matrix [forward_id][backward_id] -> cost\n * @constructor\n * @param {number} forward_dimension\n * @param {number} backward_dimension\n */\nfunction ConnectionCosts(forward_dimension, backward_dimension) {\n this.forward_dimension = forward_dimension;\n this.backward_dimension = backward_dimension;\n\n // leading 2 integers for forward_dimension, backward_dimension, respectively\n this.buffer = new Int16Array(forward_dimension * backward_dimension + 2);\n this.buffer[0] = forward_dimension;\n this.buffer[1] = backward_dimension;\n}\n\nConnectionCosts.prototype.put = function (forward_id, backward_id, cost) {\n var index = forward_id * this.backward_dimension + backward_id + 2;\n if (this.buffer.length < index + 1) {\n throw \"ConnectionCosts buffer overflow\";\n }\n this.buffer[index] = cost;\n};\n\nConnectionCosts.prototype.get = function (forward_id, backward_id) {\n var index = forward_id * this.backward_dimension + backward_id + 2;\n if (this.buffer.length < index + 1) {\n throw \"ConnectionCosts buffer overflow\";\n }\n return this.buffer[index];\n};\n\nConnectionCosts.prototype.loadConnectionCosts = function (connection_costs_buffer) {\n this.forward_dimension = connection_costs_buffer[0];\n this.backward_dimension = connection_costs_buffer[1];\n this.buffer = connection_costs_buffer;\n};\n\nmodule.exports = ConnectionCosts;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\n/**\n * CharacterClass\n * @param {number} class_id\n * @param {string} class_name\n * @param {boolean} is_always_invoke\n * @param {boolean} is_grouping\n * @param {number} max_length\n * @constructor\n */\nfunction CharacterClass(class_id, class_name, is_always_invoke, is_grouping, max_length) {\n this.class_id = class_id;\n this.class_name = class_name;\n this.is_always_invoke = is_always_invoke;\n this.is_grouping = is_grouping;\n this.max_length = max_length;\n}\n\nmodule.exports = CharacterClass;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar ByteBuffer = require(\"../util/ByteBuffer\");\nvar CharacterClass = require(\"./CharacterClass\");\n\n/**\n * InvokeDefinitionMap represents invoke definition a part of char.def\n * @constructor\n */\nfunction InvokeDefinitionMap() {\n this.map = [];\n this.lookup_table = {}; // Just for building dictionary\n}\n\n/**\n * Load InvokeDefinitionMap from buffer\n * @param {Uint8Array} invoke_def_buffer\n * @returns {InvokeDefinitionMap}\n */\nInvokeDefinitionMap.load = function (invoke_def_buffer) {\n var invoke_def = new InvokeDefinitionMap();\n var character_category_definition = [];\n\n var buffer = new ByteBuffer(invoke_def_buffer);\n while (buffer.position + 1 < buffer.size()) {\n var class_id = character_category_definition.length;\n var is_always_invoke = buffer.get();\n var is_grouping = buffer.get();\n var max_length = buffer.getInt();\n var class_name = buffer.getString();\n character_category_definition.push(new CharacterClass(class_id, class_name, is_always_invoke, is_grouping, max_length));\n }\n\n invoke_def.init(character_category_definition);\n\n return invoke_def;\n};\n\n/**\n * Initializing method\n * @param {Array.<CharacterClass>} character_category_definition Array of CharacterClass\n */\nInvokeDefinitionMap.prototype.init = function (character_category_definition) {\n if (character_category_definition == null) {\n return;\n }\n for (var i = 0; i < character_category_definition.length; i++) {\n var character_class = character_category_definition[i];\n this.map[i] = character_class;\n this.lookup_table[character_class.class_name] = i;\n }\n};\n\n/**\n * Get class information by class ID\n * @param {number} class_id\n * @returns {CharacterClass}\n */\nInvokeDefinitionMap.prototype.getCharacterClass = function (class_id) {\n return this.map[class_id];\n};\n\n/**\n * For building character definition dictionary\n * @param {string} class_name character\n * @returns {number} class_id\n */\nInvokeDefinitionMap.prototype.lookup = function (class_name) {\n var class_id = this.lookup_table[class_name];\n if (class_id == null) {\n return null;\n }\n return class_id;\n};\n\n/**\n * Transform from map to binary buffer\n * @returns {Uint8Array}\n */\nInvokeDefinitionMap.prototype.toBuffer = function () {\n var buffer = new ByteBuffer();\n for (var i = 0; i < this.map.length; i++) {\n var char_class = this.map[i];\n buffer.put(char_class.is_always_invoke);\n buffer.put(char_class.is_grouping);\n buffer.putInt(char_class.max_length);\n buffer.putString(char_class.class_name);\n }\n buffer.shrink();\n return buffer.buffer;\n};\n\nmodule.exports = InvokeDefinitionMap;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar InvokeDefinitionMap = require(\"./InvokeDefinitionMap\");\nvar CharacterClass = require(\"./CharacterClass\");\nvar SurrogateAwareString = require(\"../util/SurrogateAwareString\");\n\nvar DEFAULT_CATEGORY = \"DEFAULT\";\n\n/**\n * CharacterDefinition represents char.def file and\n * defines behavior of unknown word processing\n * @constructor\n */\nfunction CharacterDefinition() {\n this.character_category_map = new Uint8Array(65536); // for all UCS2 code points\n this.compatible_category_map = new Uint32Array(65536); // for all UCS2 code points\n this.invoke_definition_map = null;\n}\n\n/**\n * Load CharacterDefinition\n * @param {Uint8Array} cat_map_buffer\n * @param {Uint32Array} compat_cat_map_buffer\n * @param {InvokeDefinitionMap} invoke_def_buffer\n * @returns {CharacterDefinition}\n */\nCharacterDefinition.load = function (cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer) {\n var char_def = new CharacterDefinition();\n char_def.character_category_map = cat_map_buffer;\n char_def.compatible_category_map = compat_cat_map_buffer;\n char_def.invoke_definition_map = InvokeDefinitionMap.load(invoke_def_buffer);\n return char_def;\n};\n\nCharacterDefinition.parseCharCategory = function (class_id, parsed_category_def) {\n var category = parsed_category_def[1];\n var invoke = parseInt(parsed_category_def[2]);\n var grouping = parseInt(parsed_category_def[3]);\n var max_length = parseInt(parsed_category_def[4]);\n if (!isFinite(invoke) || (invoke !== 0 && invoke !== 1)) {\n console.log(\"char.def parse error. INVOKE is 0 or 1 in:\" + invoke);\n return null;\n }\n if (!isFinite(grouping) || (grouping !== 0 && grouping !== 1)) {\n console.log(\"char.def parse error. GROUP is 0 or 1 in:\" + grouping);\n return null;\n }\n if (!isFinite(max_length) || max_length < 0) {\n console.log(\"char.def parse error. LENGTH is 1 to n:\" + max_length);\n return null;\n }\n var is_invoke = (invoke === 1);\n var is_grouping = (grouping === 1);\n\n return new CharacterClass(class_id, category, is_invoke, is_grouping, max_length);\n};\n\nCharacterDefinition.parseCategoryMapping = function (parsed_category_mapping) {\n var start = parseInt(parsed_category_mapping[1]);\n var default_category = parsed_category_mapping[2];\n var compatible_category = (3 < parsed_category_mapping.length) ? parsed_category_mapping.slice(3) : [];\n if (!isFinite(start) || start < 0 || start > 0xFFFF) {\n console.log(\"char.def parse error. CODE is invalid:\" + start);\n }\n return { start: start, default: default_category, compatible: compatible_category};\n};\n\nCharacterDefinition.parseRangeCategoryMapping = function (parsed_category_mapping) {\n var start = parseInt(parsed_category_mapping[1]);\n var end = parseInt(parsed_category_mapping[2]);\n var default_category = parsed_category_mapping[3];\n var compatible_category = (4 < parsed_category_mapping.length) ? parsed_category_mapping.slice(4) : [];\n if (!isFinite(start) || start < 0 || start > 0xFFFF) {\n console.log(\"char.def parse error. CODE is invalid:\" + start);\n }\n if (!isFinite(end) || end < 0 || end > 0xFFFF) {\n console.log(\"char.def parse error. CODE is invalid:\" + end);\n }\n return { start: start, end: end, default: default_category, compatible: compatible_category};\n};\n\n/**\n * Initializing method\n * @param {Array} category_mapping Array of category mapping\n */\nCharacterDefinition.prototype.initCategoryMappings = function (category_mapping) {\n // Initialize map by DEFAULT class\n var code_point;\n if (category_mapping != null) {\n for (var i = 0; i < category_mapping.length; i++) {\n var mapping = category_mapping[i];\n var end = mapping.end || mapping.start;\n for (code_point = mapping.start; code_point <= end; code_point++) {\n\n // Default Category class ID\n this.character_category_map[code_point] = this.invoke_definition_map.lookup(mapping.default);\n\n for (var j = 0; j < mapping.compatible.length; j++) {\n var bitset = this.compatible_category_map[code_point];\n var compatible_category = mapping.compatible[j];\n if (compatible_category == null) {\n continue;\n }\n var class_id = this.invoke_definition_map.lookup(compatible_category); // Default Category\n if (class_id == null) {\n continue;\n }\n var class_id_bit = 1 << class_id;\n bitset = bitset | class_id_bit; // Set a bit of class ID 例えば、class_idが3のとき、3ビット目に1を立てる\n this.compatible_category_map[code_point] = bitset;\n }\n }\n }\n }\n var default_id = this.invoke_definition_map.lookup(DEFAULT_CATEGORY);\n if (default_id == null) {\n return;\n }\n for (code_point = 0; code_point < this.character_category_map.length; code_point++) {\n // 他に何のクラスも定義されていなかったときだけ DEFAULT\n if (this.character_category_map[code_point] === 0) {\n // DEFAULT class ID に対応するビットだけ1を立てる\n this.character_category_map[code_point] = 1 << default_id;\n }\n }\n};\n\n/**\n * Lookup compatible categories for a character (not included 1st category)\n * @param {string} ch UCS2 character (just 1st character is effective)\n * @returns {Array.<CharacterClass>} character classes\n */\nCharacterDefinition.prototype.lookupCompatibleCategory = function (ch) {\n var classes = [];\n\n /*\n if (SurrogateAwareString.isSurrogatePair(ch)) {\n // Surrogate pair character codes can not be defined by char.def\n return classes;\n }*/\n var code = ch.charCodeAt(0);\n var integer;\n if (code < this.compatible_category_map.length) {\n integer = this.compatible_category_map[code]; // Bitset\n }\n\n if (integer == null || integer === 0) {\n return classes;\n }\n\n for (var bit = 0; bit < 32; bit++) { // Treat \"bit\" as a class ID\n if (((integer << (31 - bit)) >>> 31) === 1) {\n var character_class = this.invoke_definition_map.getCharacterClass(bit);\n if (character_class == null) {\n continue;\n }\n classes.push(character_class);\n }\n }\n return classes;\n};\n\n\n/**\n * Lookup category for a character\n * @param {string} ch UCS2 character (just 1st character is effective)\n * @returns {CharacterClass} character class\n */\nCharacterDefinition.prototype.lookup = function (ch) {\n\n var class_id;\n\n var code = ch.charCodeAt(0);\n if (SurrogateAwareString.isSurrogatePair(ch)) {\n // Surrogate pair character codes can not be defined by char.def, so set DEFAULT category\n class_id = this.invoke_definition_map.lookup(DEFAULT_CATEGORY);\n } else if (code < this.character_category_map.length) {\n class_id = this.character_category_map[code]; // Read as integer value\n }\n\n if (class_id == null) {\n class_id = this.invoke_definition_map.lookup(DEFAULT_CATEGORY);\n }\n\n return this.invoke_definition_map.getCharacterClass(class_id);\n};\n\nmodule.exports = CharacterDefinition;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar TokenInfoDictionary = require(\"./TokenInfoDictionary\");\nvar CharacterDefinition = require(\"./CharacterDefinition\");\nvar ByteBuffer = require(\"../util/ByteBuffer\");\n\n/**\n * UnknownDictionary\n * @constructor\n */\nfunction UnknownDictionary() {\n this.dictionary = new ByteBuffer(10 * 1024 * 1024);\n this.target_map = {}; // class_id (of CharacterClass) -> token_info_id (of unknown class)\n this.pos_buffer = new ByteBuffer(10 * 1024 * 1024);\n this.character_definition = null;\n}\n\n// Inherit from TokenInfoDictionary as a super class\nUnknownDictionary.prototype = Object.create(TokenInfoDictionary.prototype);\n\nUnknownDictionary.prototype.characterDefinition = function (character_definition) {\n this.character_definition = character_definition;\n return this;\n};\n\nUnknownDictionary.prototype.lookup = function (ch) {\n return this.character_definition.lookup(ch);\n};\n\nUnknownDictionary.prototype.lookupCompatibleCategory = function (ch) {\n return this.character_definition.lookupCompatibleCategory(ch);\n};\n\nUnknownDictionary.prototype.loadUnknownDictionaries = function (unk_buffer, unk_pos_buffer, unk_map_buffer, cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer) {\n this.loadDictionary(unk_buffer);\n this.loadPosVector(unk_pos_buffer);\n this.loadTargetMap(unk_map_buffer);\n this.character_definition = CharacterDefinition.load(cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer);\n};\n\nmodule.exports = UnknownDictionary;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar doublearray = require(\"doublearray\");\nvar TokenInfoDictionary = require(\"./TokenInfoDictionary\");\nvar ConnectionCosts = require(\"./ConnectionCosts\");\nvar UnknownDictionary = require(\"./UnknownDictionary\");\n\n/**\n * Dictionaries container for Tokenizer\n * @param {DoubleArray} trie\n * @param {TokenInfoDictionary} token_info_dictionary\n * @param {ConnectionCosts} connection_costs\n * @param {UnknownDictionary} unknown_dictionary\n * @constructor\n */\nfunction DynamicDictionaries(trie, token_info_dictionary, connection_costs, unknown_dictionary) {\n if (trie != null) {\n this.trie = trie;\n } else {\n this.trie = doublearray.builder(0).build([\n {k: \"\", v: 1}\n ]);\n }\n if (token_info_dictionary != null) {\n this.token_info_dictionary = token_info_dictionary;\n } else {\n this.token_info_dictionary = new TokenInfoDictionary();\n }\n if (connection_costs != null) {\n this.connection_costs = connection_costs;\n } else {\n // backward_size * backward_size\n this.connection_costs = new ConnectionCosts(0, 0);\n }\n if (unknown_dictionary != null) {\n this.unknown_dictionary = unknown_dictionary;\n } else {\n this.unknown_dictionary = new UnknownDictionary();\n }\n}\n\n// from base.dat & check.dat\nDynamicDictionaries.prototype.loadTrie = function (base_buffer, check_buffer) {\n this.trie = doublearray.load(base_buffer, check_buffer);\n return this;\n};\n\nDynamicDictionaries.prototype.loadTokenInfoDictionaries = function (token_info_buffer, pos_buffer, target_map_buffer) {\n this.token_info_dictionary.loadDictionary(token_info_buffer);\n this.token_info_dictionary.loadPosVector(pos_buffer);\n this.token_info_dictionary.loadTargetMap(target_map_buffer);\n return this;\n};\n\nDynamicDictionaries.prototype.loadConnectionCosts = function (cc_buffer) {\n this.connection_costs.loadConnectionCosts(cc_buffer);\n return this;\n};\n\nDynamicDictionaries.prototype.loadUnknownDictionaries = function (unk_buffer, unk_pos_buffer, unk_map_buffer, cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer) {\n this.unknown_dictionary.loadUnknownDictionaries(unk_buffer, unk_pos_buffer, unk_map_buffer, cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer);\n return this;\n};\n\nmodule.exports = DynamicDictionaries;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar path = require(\"path\");\nvar async = require(\"async\");\nvar DynamicDictionaries = require(\"../dict/DynamicDictionaries\");\n\n/**\n * DictionaryLoader base constructor\n * @param {string} dic_path Dictionary path\n * @constructor\n */\nfunction DictionaryLoader(dic_path) {\n this.dic = new DynamicDictionaries();\n this.dic_path = dic_path;\n}\n\nDictionaryLoader.prototype.loadArrayBuffer = function (file, callback) {\n throw new Error(\"DictionaryLoader#loadArrayBuffer should be overwrite\");\n};\n\n/**\n * Load dictionary files\n * @param {DictionaryLoader~onLoad} load_callback Callback function called after loaded\n */\nDictionaryLoader.prototype.load = function (load_callback) {\n var dic = this.dic;\n var dic_path = this.dic_path;\n var loadArrayBuffer = this.loadArrayBuffer;\n\n async.parallel([\n // Trie\n function (callback) {\n async.map([ \"base.dat.gz\", \"check.dat.gz\" ], function (filename, _callback) {\n loadArrayBuffer(path.join(dic_path, filename), function (err, buffer) {\n if(err) {\n return _callback(err);\n }\n _callback(null, buffer);\n });\n }, function (err, buffers) {\n if(err) {\n return callback(err);\n }\n var base_buffer = new Int32Array(buffers[0]);\n var check_buffer = new Int32Array(buffers[1]);\n\n dic.loadTrie(base_buffer, check_buffer);\n callback(null);\n });\n },\n // Token info dictionaries\n function (callback) {\n async.map([ \"tid.dat.gz\", \"tid_pos.dat.gz\", \"tid_map.dat.gz\" ], function (filename, _callback) {\n loadArrayBuffer(path.join(dic_path, filename), function (err, buffer) {\n if(err) {\n return _callback(err);\n }\n _callback(null, buffer);\n });\n }, function (err, buffers) {\n if(err) {\n return callback(err);\n }\n var token_info_buffer = new Uint8Array(buffers[0]);\n var pos_buffer = new Uint8Array(buffers[1]);\n var target_map_buffer = new Uint8Array(buffers[2]);\n\n dic.loadTokenInfoDictionaries(token_info_buffer, pos_buffer, target_map_buffer);\n callback(null);\n });\n },\n // Connection cost matrix\n function (callback) {\n loadArrayBuffer(path.join(dic_path, \"cc.dat.gz\"), function (err, buffer) {\n if(err) {\n return callback(err);\n }\n var cc_buffer = new Int16Array(buffer);\n dic.loadConnectionCosts(cc_buffer);\n callback(null);\n });\n },\n // Unknown dictionaries\n function (callback) {\n async.map([ \"unk.dat.gz\", \"unk_pos.dat.gz\", \"unk_map.dat.gz\", \"unk_char.dat.gz\", \"unk_compat.dat.gz\", \"unk_invoke.dat.gz\" ], function (filename, _callback) {\n loadArrayBuffer(path.join(dic_path, filename), function (err, buffer) {\n if(err) {\n return _callback(err);\n }\n _callback(null, buffer);\n });\n }, function (err, buffers) {\n if(err) {\n return callback(err);\n }\n var unk_buffer = new Uint8Array(buffers[0]);\n var unk_pos_buffer = new Uint8Array(buffers[1]);\n var unk_map_buffer = new Uint8Array(buffers[2]);\n var cat_map_buffer = new Uint8Array(buffers[3]);\n var compat_cat_map_buffer = new Uint32Array(buffers[4]);\n var invoke_def_buffer = new Uint8Array(buffers[5]);\n\n dic.loadUnknownDictionaries(unk_buffer, unk_pos_buffer, unk_map_buffer, cat_map_buffer, compat_cat_map_buffer, invoke_def_buffer);\n // dic.loadUnknownDictionaries(char_buffer, unk_buffer);\n callback(null);\n });\n }\n ], function (err) {\n load_callback(err, dic);\n });\n};\n\n/**\n * Callback\n * @callback DictionaryLoader~onLoad\n * @param {Object} err Error object\n * @param {DynamicDictionaries} dic Loaded dictionary\n */\n\nmodule.exports = DictionaryLoader;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar zlib = require(\"zlibjs/bin/gunzip.min.js\");\nvar DictionaryLoader = require(\"./DictionaryLoader\");\n\n/**\n * BrowserDictionaryLoader inherits DictionaryLoader, using jQuery XHR for download\n * @param {string} dic_path Dictionary path\n * @constructor\n */\nfunction BrowserDictionaryLoader(dic_path) {\n DictionaryLoader.apply(this, [dic_path]);\n}\n\nBrowserDictionaryLoader.prototype = Object.create(DictionaryLoader.prototype);\n\n/**\n * Utility function to load gzipped dictionary\n * @param {string} url Dictionary URL\n * @param {BrowserDictionaryLoader~onLoad} callback Callback function\n */\nBrowserDictionaryLoader.prototype.loadArrayBuffer = function (url, callback) {\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", url, true);\n xhr.responseType = \"arraybuffer\";\n xhr.onload = function () {\n if (this.status > 0 && this.status !== 200) {\n callback(xhr.statusText, null);\n return;\n }\n var arraybuffer = this.response;\n\n var gz = new zlib.Zlib.Gunzip(new Uint8Array(arraybuffer));\n var typed_array = gz.decompress();\n callback(null, typed_array.buffer);\n };\n xhr.onerror = function (err) {\n callback(err, null);\n };\n xhr.send();\n};\n\n/**\n * Callback\n * @callback BrowserDictionaryLoader~onLoad\n * @param {Object} err Error object\n * @param {Uint8Array} buffer Loaded buffer\n */\n\nmodule.exports = BrowserDictionaryLoader;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar Tokenizer = require(\"./Tokenizer\");\nvar DictionaryLoader = require(\"./loader/NodeDictionaryLoader\");\n\n/**\n * TokenizerBuilder create Tokenizer instance.\n * @param {Object} option JSON object which have key-value pairs settings\n * @param {string} option.dicPath Dictionary directory path (or URL using in browser)\n * @constructor\n */\nfunction TokenizerBuilder(option) {\n if (option.dicPath == null) {\n this.dic_path = \"dict/\";\n } else {\n this.dic_path = option.dicPath;\n }\n}\n\n/**\n * Build Tokenizer instance by asynchronous manner\n * @param {TokenizerBuilder~onLoad} callback Callback function\n */\nTokenizerBuilder.prototype.build = function (callback) {\n var loader = new DictionaryLoader(this.dic_path);\n loader.load(function (err, dic) {\n callback(err, new Tokenizer(dic));\n });\n};\n\n/**\n * Callback used by build\n * @callback TokenizerBuilder~onLoad\n * @param {Object} err Error object\n * @param {Tokenizer} tokenizer Prepared Tokenizer\n */\n\nmodule.exports = TokenizerBuilder;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar ConnectionCosts = require(\"../ConnectionCosts\");\n\n/**\n * Builder class for constructing ConnectionCosts object\n * @constructor\n */\nfunction ConnectionCostsBuilder() {\n this.lines = 0;\n this.connection_cost = null;\n}\n\nConnectionCostsBuilder.prototype.putLine = function (line) {\n if (this.lines === 0) {\n var dimensions = line.split(\" \");\n var forward_dimension = dimensions[0];\n var backward_dimension = dimensions[1];\n\n if (forward_dimension < 0 || backward_dimension < 0) {\n throw \"Parse error of matrix.def\";\n }\n\n this.connection_cost = new ConnectionCosts(forward_dimension, backward_dimension);\n this.lines++;\n return this;\n }\n\n var costs = line.split(\" \");\n\n if (costs.length !== 3) {\n return this;\n }\n\n var forward_id = parseInt(costs[0]);\n var backward_id = parseInt(costs[1]);\n var cost = parseInt(costs[2]);\n\n if (forward_id < 0 || backward_id < 0 || !isFinite(forward_id) || !isFinite(backward_id) ||\n this.connection_cost.forward_dimension <= forward_id || this.connection_cost.backward_dimension <= backward_id) {\n throw \"Parse error of matrix.def\";\n }\n\n this.connection_cost.put(forward_id, backward_id, cost);\n this.lines++;\n return this;\n};\n\nConnectionCostsBuilder.prototype.build = function () {\n return this.connection_cost;\n};\n\nmodule.exports = ConnectionCostsBuilder;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar CharacterDefinition = require(\"../CharacterDefinition\");\nvar InvokeDefinitionMap = require(\"../InvokeDefinitionMap\");\n\nvar CATEGORY_DEF_PATTERN = /^(\\w+)\\s+(\\d)\\s+(\\d)\\s+(\\d)/;\nvar CATEGORY_MAPPING_PATTERN = /^(0x[0-9A-F]{4})(?:\\s+([^#\\s]+))(?:\\s+([^#\\s]+))*/;\nvar RANGE_CATEGORY_MAPPING_PATTERN = /^(0x[0-9A-F]{4})\\.\\.(0x[0-9A-F]{4})(?:\\s+([^#\\s]+))(?:\\s+([^#\\s]+))*/;\n\n/**\n * CharacterDefinitionBuilder\n * @constructor\n */\nfunction CharacterDefinitionBuilder() {\n this.char_def = new CharacterDefinition();\n this.char_def.invoke_definition_map = new InvokeDefinitionMap();\n this.character_category_definition = [];\n this.category_mapping = [];\n}\n\nCharacterDefinitionBuilder.prototype.putLine = function (line) {\n var parsed_category_def = CATEGORY_DEF_PATTERN.exec(line);\n if (parsed_category_def != null) {\n var class_id = this.character_category_definition.length;\n var char_class = CharacterDefinition.parseCharCategory(class_id, parsed_category_def);\n if (char_class == null) {\n return;\n }\n this.character_category_definition.push(char_class);\n return;\n }\n var parsed_category_mapping = CATEGORY_MAPPING_PATTERN.exec(line);\n if (parsed_category_mapping != null) {\n var mapping = CharacterDefinition.parseCategoryMapping(parsed_category_mapping);\n this.category_mapping.push(mapping);\n }\n var parsed_range_category_mapping = RANGE_CATEGORY_MAPPING_PATTERN.exec(line);\n if (parsed_range_category_mapping != null) {\n var range_mapping = CharacterDefinition.parseRangeCategoryMapping(parsed_range_category_mapping);\n this.category_mapping.push(range_mapping);\n }\n};\n\nCharacterDefinitionBuilder.prototype.build = function () {\n // TODO If DEFAULT category does not exist, throw error\n this.char_def.invoke_definition_map.init(this.character_category_definition);\n this.char_def.initCategoryMappings(this.category_mapping);\n return this.char_def;\n};\n\nmodule.exports = CharacterDefinitionBuilder;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar doublearray = require(\"doublearray\");\nvar DynamicDictionaries = require(\"../DynamicDictionaries\");\nvar TokenInfoDictionary = require(\"../TokenInfoDictionary\");\nvar ConnectionCostsBuilder = require(\"./ConnectionCostsBuilder\");\nvar CharacterDefinitionBuilder = require(\"./CharacterDefinitionBuilder\");\nvar UnknownDictionary = require(\"../UnknownDictionary\");\n\n/**\n * Build dictionaries (token info, connection costs)\n *\n * Generates from matrix.def\n * cc.dat: Connection costs\n *\n * Generates from *.csv\n * dat.dat: Double array\n * tid.dat: Token info dictionary\n * tid_map.dat: targetMap\n * tid_pos.dat: posList (part of speech)\n */\nfunction DictionaryBuilder() {\n // Array of entries, each entry in Mecab form\n // (0: surface form, 1: left id, 2: right id, 3: word cost, 4: part of speech id, 5-: other features)\n this.tid_entries = [];\n this.unk_entries = [];\n this.cc_builder = new ConnectionCostsBuilder();\n this.cd_builder = new CharacterDefinitionBuilder();\n}\n\nDictionaryBuilder.prototype.addTokenInfoDictionary = function (line) {\n var new_entry = line.split(\",\");\n this.tid_entries.push(new_entry);\n return this;\n};\n\n/**\n * Put one line of \"matrix.def\" file for building ConnectionCosts object\n * @param {string} line is a line of \"matrix.def\"\n */\nDictionaryBuilder.prototype.putCostMatrixLine = function (line) {\n this.cc_builder.putLine(line);\n return this;\n};\n\nDictionaryBuilder.prototype.putCharDefLine = function (line) {\n this.cd_builder.putLine(line);\n return this;\n};\n\n/**\n * Put one line of \"unk.def\" file for building UnknownDictionary object\n * @param {string} line is a line of \"unk.def\"\n */\nDictionaryBuilder.prototype.putUnkDefLine = function (line) {\n this.unk_entries.push(line.split(\",\"));\n return this;\n};\n\nDictionaryBuilder.prototype.build = function () {\n var dictionaries = this.buildTokenInfoDictionary();\n var unknown_dictionary = this.buildUnknownDictionary();\n\n return new DynamicDictionaries(dictionaries.trie, dictionaries.token_info_dictionary, this.cc_builder.build(), unknown_dictionary);\n};\n\n/**\n * Build TokenInfoDictionary\n *\n * @returns {{trie: *, token_info_dictionary: *}}\n */\nDictionaryBuilder.prototype.buildTokenInfoDictionary = function () {\n\n var token_info_dictionary = new TokenInfoDictionary();\n\n // using as hashmap, string -> string (word_id -> surface_form) to build dictionary\n var dictionary_entries = token_info_dictionary.buildDictionary(this.tid_entries);\n\n var trie = this.buildDoubleArray();\n\n for (var token_info_id in dictionary_entries) {\n var surface_form = dictionary_entries[token_info_id];\n var trie_id = trie.lookup(surface_form);\n\n // Assertion\n // if (trie_id < 0) {\n // console.log(\"Not Found:\" + surface_form);\n // }\n\n token_info_dictionary.addMapping(trie_id, token_info_id);\n }\n\n return {\n trie: trie,\n token_info_dictionary: token_info_dictionary\n };\n};\n\nDictionaryBuilder.prototype.buildUnknownDictionary = function () {\n\n var unk_dictionary = new UnknownDictionary();\n\n // using as hashmap, string -> string (word_id -> surface_form) to build dictionary\n var dictionary_entries = unk_dictionary.buildDictionary(this.unk_entries);\n\n var char_def = this.cd_builder.build(); // Create CharacterDefinition\n\n unk_dictionary.characterDefinition(char_def);\n\n for (var token_info_id in dictionary_entries) {\n var class_name = dictionary_entries[token_info_id];\n var class_id = char_def.invoke_definition_map.lookup(class_name);\n\n // Assertion\n // if (trie_id < 0) {\n // console.log(\"Not Found:\" + surface_form);\n // }\n\n unk_dictionary.addMapping(class_id, token_info_id);\n }\n\n return unk_dictionary;\n};\n\n/**\n * Build double array trie\n *\n * @returns {DoubleArray} Double-Array trie\n */\nDictionaryBuilder.prototype.buildDoubleArray = function () {\n var trie_id = 0;\n var words = this.tid_entries.map(function (entry) {\n var surface_form = entry[0];\n return { k: surface_form, v: trie_id++ };\n });\n\n var builder = doublearray.builder(1024 * 1024);\n return builder.build(words);\n};\n\nmodule.exports = DictionaryBuilder;\n","/*\n * Copyright 2014 Takuya Asano\n * Copyright 2010-2014 Atilika Inc. and contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nvar TokenizerBuilder = require(\"./TokenizerBuilder\");\nvar DictionaryBuilder = require(\"./dict/builder/DictionaryBuilder\");\n\n// Public methods\nvar kuromoji = {\n builder: function (option) {\n return new TokenizerBuilder(option);\n },\n dictionaryBuilder: function () {\n return new DictionaryBuilder();\n }\n};\n\nmodule.exports = kuromoji;\n","export function normalizeInputText(input: string): string {\n // 1) NFD 결합문자(が/ぱ 등) 합성\n let normalized = input.normalize(\"NFC\");\n\n // 2) 반각 가타카나만 전각으로 (구두점/특수문자 최대한 보존)\n normalized = normalizeHalfwidthKatakanaOnly(normalized);\n\n // 3) 장음 기호 변종 최소 치환\n // - U+2015 HORIZONTAL BAR\n // - U+2500 BOX DRAWINGS LIGHT HORIZONTAL\n normalized = normalized.replace(/[\\u2015\\u2500]/g, \"ー\");\n\n // 4) ASCII hyphen이 가타카나 사이에 있을 때 장음 처리\n normalized = normalized\n .replace(/(?<=([\\u30A0-\\u30FF]))-/g, \"ー\")\n .replace(/-(?=[\\u30A0-\\u30FF])/g, \"ー\");\n\n return normalized;\n}\n\nfunction normalizeHalfwidthKatakanaOnly(s: string): string {\n // ✅ 반각 가타카나 + 탁점/반탁점(゙゚) + 반각 장음(ー)까지 함께 NFKC\n return s.replace(/[\\uFF66-\\uFF9F\\uFF70]+/g, (chunk) =>\n chunk.normalize(\"NFKC\"),\n );\n}\n\nexport function toHiragana(input: string): string {\n let out = \"\";\n for (const ch of input) {\n const code = ch.codePointAt(0)!;\n // カタカナ → ひらがな\n if (code >= 0x30a1 && code <= 0x30f6) {\n out += String.fromCodePoint(code - 0x60);\n continue;\n }\n if (ch === \"ー\") {\n out += ch;\n continue;\n }\n out += ch;\n }\n return out;\n}\n","// dictionary.ts\n// 한국인이 익숙한 발음을 담은 특수 사전\nexport interface SpecialDictionaryEntry {\n word: string;\n answer: string;\n hira?: boolean; // true면 히라가나 입력에도 적용\n kata?: boolean; // true면 카타카나 입력에도 적용\n}\n\nexport const SpecialDictionary: SpecialDictionaryEntry[] = [\n // [\"とうきょう\", \"도쿄\"],\n { word: \"こんにちは\", answer: \"곤니치와\", hira: true, kata: true },\n { word: \"こんばんは\", answer: \"곰방와\" },\n { word: \"すみません\", answer: \"스미마셍\" },\n { word: \"はひふへほ\", answer: \"하히후헤호\" },\n { word: \"かわいい\", answer: \"카와이\" },\n { word: \"つなみ\", answer: \"쓰나미\" },\n { word: \"ゆうり\", answer: \"유우리\" },\n { word: \"ミュージック\", answer: \"뮤지쿠\" },\n { word: \"ちゃん\", answer: \"쨩\" },\n];\n","// particleRewriter.ts\nimport type kuromoji from \"kuromoji\";\nimport type { Tokenizer } from \"./tokenizer\";\nimport { SpecialDictionary, SpecialDictionaryEntry } from \"./dictionary\";\n\n// --------------------------\n// local helper: toHiragana (protectedRanges는 hiraganaText 기준)\n// --------------------------\nfunction isKatakanaChar(ch: string) {\n const c = ch.codePointAt(0)!;\n return c >= 0x30a0 && c <= 0x30ff;\n}\n\nfunction containsKanji(s: string): boolean {\n for (const ch of s) {\n const c = ch.codePointAt(0)!;\n // CJK Unified Ideographs (U+4E00-U+9FFF) + Extension A (U+3400-U+4DBF)\n if ((c >= 0x4e00 && c <= 0x9fff) || (c >= 0x3400 && c <= 0x4dbf)) {\n return true;\n }\n }\n return false;\n}\nfunction toHiragana(s: string): string {\n const n = s.normalize(\"NFKC\");\n return Array.from(n)\n .map((ch) => {\n // 장음은 드랍\n if (ch === \"ー\") return \"\";\n if (!isKatakanaChar(ch)) return ch;\n const code = ch.codePointAt(0)!;\n // カタカナ 문자 범위 (ァ~ヶ)만 변환\n if (code >= 0x30a1 && code <= 0x30f6) {\n return String.fromCodePoint(code - 0x60);\n }\n return ch;\n })\n .join(\"\");\n}\n\nfunction dictKeysForHiraganaText(dict: SpecialDictionaryEntry[]): string[] {\n // hiraganaText에서 실제로 등장할 수 있는 키만 모으기:\n // - entry.word 자체는 넣어도 되고(못 찾으면 무해)\n // - hira:true면 toHiragana(word)를 추가로 넣는다\n const keys: string[] = [];\n for (const e of dict) {\n keys.push(e.word);\n if (e.hira) keys.push(toHiragana(e.word));\n }\n // 중복 제거\n return [...new Set(keys)].filter(Boolean);\n}\n\ntype Range = { start: number; end: number }; // [start, end)\n\nfunction rangesOverlap(a: Range, b: Range): boolean {\n return a.start < b.end && b.start < a.end;\n}\n\nfunction buildProtectedRanges(text: string, keys: string[]): Range[] {\n const sorted = [...new Set(keys)].sort((a, b) => b.length - a.length);\n const ranges: Range[] = [];\n\n for (const key of sorted) {\n if (!key) continue;\n let from = 0;\n while (true) {\n const idx = text.indexOf(key, from);\n if (idx === -1) break;\n\n const cand: Range = { start: idx, end: idx + key.length };\n if (!ranges.some((r) => rangesOverlap(r, cand))) {\n ranges.push(cand);\n }\n from = idx + 1;\n }\n }\n\n ranges.sort((a, b) => a.start - b.start);\n return ranges;\n}\n\nfunction isProtectedSpan(protectedRanges: Range[], start: number, end: number) {\n for (const r of protectedRanges) {\n if (start < r.end && end > r.start) return true;\n }\n return false;\n}\n\nexport const HARD_BOUNDARY_SURF = new Set([\n \"。\",\n \"、\",\n \"!\",\n \"?\",\n \"!\",\n \"?\",\n \" \",\n \" \",\n]);\nconst HARD_BOUNDARY_DETAIL1 = new Set([\n \"句点\",\n \"読点\",\n \"括弧開\",\n \"括弧閉\",\n \"空白\",\n]);\n\nconst LEXICAL_HE_ENDINGS = [\n \"いにしへ\",\n \"おきへ\",\n \"もとへ\",\n \"すえへ\",\n \"すゑへ\",\n \"かみへ\",\n \"くにへ\",\n \"きしへ\",\n] as const;\n\nfunction isHardBoundaryToken(t: kuromoji.IpadicFeatures): boolean {\n if (t.pos !== \"記号\") return false;\n if (HARD_BOUNDARY_SURF.has(t.surface_form)) return true;\n return HARD_BOUNDARY_DETAIL1.has(t.pos_detail_1 ?? \"\");\n}\nfunction isContentToken(t: kuromoji.IpadicFeatures): boolean {\n if (t.pos === \"記号\") return !isHardBoundaryToken(t);\n return true;\n}\n\nfunction prevContentIdx(tokens: kuromoji.IpadicFeatures[], i: number): number {\n for (let j = i - 1; j >= 0; j -= 1) if (isContentToken(tokens[j])) return j;\n return -1;\n}\nfunction nextContentIdx(tokens: kuromoji.IpadicFeatures[], i: number): number {\n for (let j = i + 1; j < tokens.length; j += 1)\n if (isContentToken(tokens[j])) return j;\n return -1;\n}\nfunction nextBoundaryOrEnd(\n tokens: kuromoji.IpadicFeatures[],\n i: number,\n): boolean {\n for (let j = i + 1; j < tokens.length; j += 1) {\n if (isHardBoundaryToken(tokens[j])) continue;\n return false;\n }\n return true;\n}\n\nexport type TokenSpan = {\n start: number; // rewritten 기준\n end: number; // rewritten 기준\n surface: string;\n\n pos?: string;\n pos1?: string;\n pos2?: string;\n pos3?: string;\n\n // ✅ 원문 기반 힌트: katakana 포함 여부(노ート 같은 케이스 차단용)\n originHadKatakana?: boolean;\n};\n\n/**\n * ✅ 핵심:\n * - 토큰화는 \"prewrite 이전\"에 수행 (원문/정규화 기준)\n * - prewrite는 \"토큰 품사\"를 쓰되, 실제 replace는 hiraganaText slice로 수행\n * - 결과로 rewrittenText + rewrittenTokenSpans를 만들어 core로 넘김\n *\n * 가정: hiraganaText와 originalText는 길이가 동일 (toHiragana는 1:1 치환)\n */\nexport function rewriteParticlesFromTokenization(\n originalText: string,\n hiraganaText: string,\n tokenizerTokens: kuromoji.IpadicFeatures[],\n): { rewritten: string; spans: TokenSpan[]; rewrittenOriginal: string } {\n // 코드포인트 배열로 변환 (kuromoji word_position이 코드포인트 기준)\n const hiraChars = Array.from(hiraganaText);\n const originChars = Array.from(originalText);\n\n // entry 기반\n const protectedRanges = buildProtectedRanges(\n hiraganaText,\n dictKeysForHiraganaText(SpecialDictionary),\n );\n\n let out = \"\";\n let origOut = \"\"; // 한자→pronunciation 변환된 원본\n const spans: TokenSpan[] = [];\n\n let cursorInText = 0;\n\n for (let i = 0; i < tokenizerTokens.length; i += 1) {\n const tok = tokenizerTokens[i];\n const wp = (tok as any).word_position as number | undefined;\n const surf = tok.surface_form;\n const surfCpLen = [...surf].length; // 코드포인트 길이\n\n // kuromoji word_position은 코드포인트 기준 (1-based)\n const start = typeof wp === \"number\" ? wp - 1 : cursorInText;\n const end = start + surfCpLen;\n cursorInText = end;\n\n // 한자가 포함된 경우 pronunciation을 사용\n const hasKanji = containsKanji(surf) && tok.pronunciation;\n const hiraSurf = hasKanji\n ? toHiragana(tok.pronunciation!)\n : hiraChars.slice(start, end).join(\"\");\n // 원본도 한자면 pronunciation에서 장음 제거 (길이 맞추기)\n const origSurfForOut = hasKanji\n ? tok.pronunciation!.replace(/ー/g, \"\")\n : originChars.slice(start, end).join(\"\");\n const originSurf = originChars.slice(start, end).join(\"\");\n\n const originHadKatakana = /[\\u30A0-\\u30FF]/.test(originSurf);\n\n // ✅ 불필요하고 위험한 isProtected(튜플 기반 + includes 난사) 제거\n // protectedRanges 기반으로만 판단\n if (isProtectedSpan(protectedRanges, start, end)) {\n const outCpStart = [...out].length;\n out += hiraSurf;\n origOut += origSurfForOut;\n spans.push({\n start: outCpStart,\n end: [...out].length,\n surface: hiraSurf,\n pos: tok.pos,\n pos1: tok.pos_detail_1 ?? undefined,\n pos2: tok.pos_detail_2 ?? undefined,\n pos3: tok.pos_detail_3 ?? undefined,\n originHadKatakana,\n });\n continue;\n }\n\n let replaced = hiraSurf;\n\n // --- は -> わ (계조사) ---\n if (tok.pos === \"助詞\" && hiraSurf === \"は\") {\n if (i > 0 && tokenizerTokens[i - 1].surface_form === \"は\") {\n // keep\n } else if (\n i + 1 < tokenizerTokens.length &&\n tokenizerTokens[i + 1].surface_form === \"は\"\n ) {\n // keep\n } else {\n const prevIdx = prevContentIdx(tokenizerTokens, i);\n if (prevIdx >= 0) {\n const nextIdx = nextContentIdx(tokenizerTokens, i);\n const hasNextContent = nextIdx >= 0;\n const isEndOrPunct = nextBoundaryOrEnd(tokenizerTokens, i);\n\n const prevTok = tokenizerTokens[prevIdx];\n const prevWpHa = (prevTok as any).word_position as number | undefined;\n const prevStartHa = typeof prevWpHa === \"number\" ? prevWpHa - 1 : 0;\n const prevEndHa = prevStartHa + [...prevTok.surface_form].length;\n const prevHira = hiraChars.slice(prevStartHa, prevEndHa).join(\"\");\n\n if (\n !prevHira.includes(\"っ\") &&\n tok.pos_detail_1 === \"係助詞\" &&\n (hasNextContent || isEndOrPunct) &&\n prevTok.pos !== \"助詞\"\n ) {\n replaced = \"わ\";\n }\n }\n }\n }\n\n // --- へ -> え (격조사) ---\n if (tok.pos === \"助詞\" && hiraSurf === \"へ\") {\n // 바로 왼쪽이 공백이면 keep (코드포인트 배열 사용)\n if (start > 0) {\n const left = hiraChars[start - 1];\n if (\n left === \" \" ||\n left === \" \" ||\n left === \"\\t\" ||\n left === \"\\n\" ||\n left === \"\\r\"\n ) {\n // keep\n } else {\n const prevIdx = prevContentIdx(tokenizerTokens, i);\n if (prevIdx >= 0) {\n const prevTok = tokenizerTokens[prevIdx];\n const prevWp = (prevTok as any).word_position as number | undefined;\n const prevStart = typeof prevWp === \"number\" ? prevWp - 1 : 0;\n const prevEnd = prevStart + [...prevTok.surface_form].length;\n\n const prevHiraSurf = hiraChars.slice(prevStart, prevEnd).join(\"\");\n\n if (\n LEXICAL_HE_ENDINGS.some((w) => (prevHiraSurf + \"へ\").endsWith(w))\n ) {\n // keep lexical endings\n } else if (prevHiraSurf.endsWith(\"の\")) {\n // keep \"...のへ\"\n } else if (tok.pos_detail_1 === \"格助詞\") {\n replaced = \"え\";\n }\n }\n }\n }\n }\n\n const outCpStart = [...out].length;\n out += replaced;\n origOut += origSurfForOut;\n\n spans.push({\n start: outCpStart,\n end: [...out].length,\n surface: replaced,\n pos: tok.pos,\n pos1: tok.pos_detail_1 ?? undefined,\n pos2: tok.pos_detail_2 ?? undefined,\n pos3: tok.pos_detail_3 ?? undefined,\n originHadKatakana,\n });\n }\n\n return { rewritten: out, spans, rewrittenOriginal: origOut };\n}\n\n/**\n * 외부에서 쓰기 편한 래퍼:\n * - originalText를 tokenizer로 먼저 tokenize\n * - hiraganaText는 호출자가 넘겨줌(길이 동일 가정)\n */\nexport function tokenizeAndRewriteParticles(\n originalText: string,\n hiraganaText: string,\n tokenizer: Tokenizer,\n): {\n rewritten: string;\n spans: TokenSpan[];\n rewrittenOriginal: string;\n rawTokens: kuromoji.IpadicFeatures[];\n} {\n const rawTokens = tokenizer.tokenize(originalText);\n // console.log(rawTokens);\n const { rewritten, spans, rewrittenOriginal } =\n rewriteParticlesFromTokenization(originalText, hiraganaText, rawTokens);\n return { rewritten, spans, rewrittenOriginal, rawTokens };\n}\n","// --- Tables (당신 코드 그대로) ---\nexport type VowelMain = \"a\" | \"i\" | \"u\" | \"e\" | \"o\";\nexport type ConsClass =\n | \"vowel\"\n | \"k\"\n | \"s\"\n | \"t\"\n | \"n\"\n | \"h\"\n | \"m\"\n | \"y\"\n | \"r\"\n | \"w\"\n | \"g\"\n | \"z\"\n | \"d\"\n | \"b\"\n | \"p\";\n\nexport type MoraInfo = {\n out: string;\n vowelMain: VowelMain;\n consClass: ConsClass;\n vowelOnly?: boolean;\n wasYouon?: boolean;\n};\n\nexport const SINGLE: Record<string, MoraInfo> = {\n あ: { out: \"아\", vowelMain: \"a\", consClass: \"vowel\", vowelOnly: true },\n い: { out: \"이\", vowelMain: \"i\", consClass: \"vowel\", vowelOnly: true },\n う: { out: \"우\", vowelMain: \"u\", consClass: \"vowel\", vowelOnly: true },\n え: { out: \"에\", vowelMain: \"e\", consClass: \"vowel\", vowelOnly: true },\n お: { out: \"오\", vowelMain: \"o\", consClass: \"vowel\", vowelOnly: true },\n\n か: { out: \"카\", vowelMain: \"a\", consClass: \"k\" },\n き: { out: \"키\", vowelMain: \"i\", consClass: \"k\" },\n く: { out: \"쿠\", vowelMain: \"u\", consClass: \"k\" },\n け: { out: \"케\", vowelMain: \"e\", consClass: \"k\" },\n こ: { out: \"코\", vowelMain: \"o\", consClass: \"k\" },\n\n さ: { out: \"사\", vowelMain: \"a\", consClass: \"s\" },\n し: { out: \"시\", vowelMain: \"i\", consClass: \"s\" },\n す: { out: \"스\", vowelMain: \"u\", consClass: \"s\" },\n せ: { out: \"세\", vowelMain: \"e\", consClass: \"s\" },\n そ: { out: \"소\", vowelMain: \"o\", consClass: \"s\" },\n\n た: { out: \"타\", vowelMain: \"a\", consClass: \"t\" },\n ち: { out: \"치\", vowelMain: \"i\", consClass: \"t\" },\n つ: { out: \"츠\", vowelMain: \"u\", consClass: \"t\" },\n て: { out: \"테\", vowelMain: \"e\", consClass: \"t\" },\n と: { out: \"토\", vowelMain: \"o\", consClass: \"t\" },\n\n な: { out: \"나\", vowelMain: \"a\", consClass: \"n\" },\n に: { out: \"니\", vowelMain: \"i\", consClass: \"n\" },\n ぬ: { out: \"누\", vowelMain: \"u\", consClass: \"n\" },\n ね: { out: \"네\", vowelMain: \"e\", consClass: \"n\" },\n の: { out: \"노\", vowelMain: \"o\", consClass: \"n\" },\n\n は: { out: \"하\", vowelMain: \"a\", consClass: \"h\" },\n ひ: { out: \"히\", vowelMain: \"i\", consClass: \"h\" },\n ふ: { out: \"후\", vowelMain: \"u\", consClass: \"h\" },\n へ: { out: \"헤\", vowelMain: \"e\", consClass: \"h\" },\n ほ: { out: \"호\", vowelMain: \"o\", consClass: \"h\" },\n\n ま: { out: \"마\", vowelMain: \"a\", consClass: \"m\" },\n み: { out: \"미\", vowelMain: \"i\", consClass: \"m\" },\n む: { out: \"무\", vowelMain: \"u\", consClass: \"m\" },\n め: { out: \"메\", vowelMain: \"e\", consClass: \"m\" },\n も: { out: \"모\", vowelMain: \"o\", consClass: \"m\" },\n\n や: { out: \"야\", vowelMain: \"a\", consClass: \"y\" },\n ゆ: { out: \"유\", vowelMain: \"u\", consClass: \"y\" },\n よ: { out: \"요\", vowelMain: \"o\", consClass: \"y\" },\n\n ら: { out: \"라\", vowelMain: \"a\", consClass: \"r\" },\n り: { out: \"리\", vowelMain: \"i\", consClass: \"r\" },\n る: { out: \"루\", vowelMain: \"u\", consClass: \"r\" },\n れ: { out: \"레\", vowelMain: \"e\", consClass: \"r\" },\n ろ: { out: \"로\", vowelMain: \"o\", consClass: \"r\" },\n\n わ: { out: \"와\", vowelMain: \"a\", consClass: \"w\" },\n を: { out: \"오\", vowelMain: \"o\", consClass: \"w\" },\n\n が: { out: \"가\", vowelMain: \"a\", consClass: \"g\" },\n ぎ: { out: \"기\", vowelMain: \"i\", consClass: \"g\" },\n ぐ: { out: \"구\", vowelMain: \"u\", consClass: \"g\" },\n げ: { out: \"게\", vowelMain: \"e\", consClass: \"g\" },\n ご: { out: \"고\", vowelMain: \"o\", consClass: \"g\" },\n\n ざ: { out: \"자\", vowelMain: \"a\", consClass: \"z\" },\n じ: { out: \"지\", vowelMain: \"i\", consClass: \"z\" },\n ず: { out: \"즈\", vowelMain: \"u\", consClass: \"z\" },\n ぜ: { out: \"제\", vowelMain: \"e\", consClass: \"z\" },\n ぞ: { out: \"조\", vowelMain: \"o\", consClass: \"z\" },\n\n だ: { out: \"다\", vowelMain: \"a\", consClass: \"d\" },\n ぢ: { out: \"지\", vowelMain: \"i\", consClass: \"d\" },\n づ: { out: \"즈\", vowelMain: \"u\", consClass: \"d\" },\n で: { out: \"데\", vowelMain: \"e\", consClass: \"d\" },\n ど: { out: \"도\", vowelMain: \"o\", consClass: \"d\" },\n\n ば: { out: \"바\", vowelMain: \"a\", consClass: \"b\" },\n び: { out: \"비\", vowelMain: \"i\", consClass: \"b\" },\n ぶ: { out: \"부\", vowelMain: \"u\", consClass: \"b\" },\n べ: { out: \"베\", vowelMain: \"e\", consClass: \"b\" },\n ぼ: { out: \"보\", vowelMain: \"o\", consClass: \"b\" },\n\n ぱ: { out: \"파\", vowelMain: \"a\", consClass: \"p\" },\n ぴ: { out: \"피\", vowelMain: \"i\", consClass: \"p\" },\n ぷ: { out: \"푸\", vowelMain: \"u\", consClass: \"p\" },\n ぺ: { out: \"페\", vowelMain: \"e\", consClass: \"p\" },\n ぽ: { out: \"포\", vowelMain: \"o\", consClass: \"p\" },\n\n ゔ: { out: \"부\", vowelMain: \"u\", consClass: \"b\" },\n};\n\nexport const YOUON: Record<string, MoraInfo> = {\n きゃ: { out: \"캬\", vowelMain: \"a\", consClass: \"k\", wasYouon: true },\n きゅ: { out: \"큐\", vowelMain: \"u\", consClass: \"k\", wasYouon: true },\n きょ: { out: \"쿄\", vowelMain: \"o\", consClass: \"k\", wasYouon: true },\n\n しゃ: { out: \"샤\", vowelMain: \"a\", consClass: \"s\", wasYouon: true },\n しゅ: { out: \"슈\", vowelMain: \"u\", consClass: \"s\", wasYouon: true },\n しょ: { out: \"쇼\", vowelMain: \"o\", consClass: \"s\", wasYouon: true },\n\n ちゃ: { out: \"챠\", vowelMain: \"a\", consClass: \"t\", wasYouon: true },\n ちゅ: { out: \"츄\", vowelMain: \"u\", consClass: \"t\", wasYouon: true },\n ちょ: { out: \"쵸\", vowelMain: \"o\", consClass: \"t\", wasYouon: true },\n てゅ: { out: \"튜\", vowelMain: \"u\", consClass: \"t\", wasYouon: true },\n でゅ: { out: \"듀\", vowelMain: \"u\", consClass: \"d\", wasYouon: true },\n\n にゃ: { out: \"냐\", vowelMain: \"a\", consClass: \"n\", wasYouon: true },\n にゅ: { out: \"뉴\", vowelMain: \"u\", consClass: \"n\", wasYouon: true },\n にょ: { out: \"뇨\", vowelMain: \"o\", consClass: \"n\", wasYouon: true },\n\n ひゃ: { out: \"햐\", vowelMain: \"a\", consClass: \"h\", wasYouon: true },\n ひゅ: { out: \"휴\", vowelMain: \"u\", consClass: \"h\", wasYouon: true },\n ひょ: { out: \"효\", vowelMain: \"o\", consClass: \"h\", wasYouon: true },\n ふゃ: { out: \"퍄\", vowelMain: \"a\", consClass: \"p\", wasYouon: true },\n ふゅ: { out: \"퓨\", vowelMain: \"u\", consClass: \"p\", wasYouon: true },\n ふょ: { out: \"표\", vowelMain: \"o\", consClass: \"p\", wasYouon: true },\n\n みゃ: { out: \"먀\", vowelMain: \"a\", consClass: \"m\", wasYouon: true },\n みゅ: { out: \"뮤\", vowelMain: \"u\", consClass: \"m\", wasYouon: true },\n みょ: { out: \"묘\", vowelMain: \"o\", consClass: \"m\", wasYouon: true },\n\n りゃ: { out: \"랴\", vowelMain: \"a\", consClass: \"r\", wasYouon: true },\n りゅ: { out: \"류\", vowelMain: \"u\", consClass: \"r\", wasYouon: true },\n りょ: { out: \"료\", vowelMain: \"o\", consClass: \"r\", wasYouon: true },\n\n ぎゃ: { out: \"갸\", vowelMain: \"a\", consClass: \"g\", wasYouon: true },\n ぎゅ: { out: \"규\", vowelMain: \"u\", consClass: \"g\", wasYouon: true },\n ぎょ: { out: \"교\", vowelMain: \"o\", consClass: \"g\", wasYouon: true },\n\n じゃ: { out: \"쟈\", vowelMain: \"a\", consClass: \"z\", wasYouon: true },\n じゅ: { out: \"쥬\", vowelMain: \"u\", consClass: \"z\", wasYouon: true },\n じょ: { out: \"죠\", vowelMain: \"o\", consClass: \"z\", wasYouon: true },\n\n びゃ: { out: \"뱌\", vowelMain: \"a\", consClass: \"b\", wasYouon: true },\n びゅ: { out: \"뷰\", vowelMain: \"u\", consClass: \"b\", wasYouon: true },\n びょ: { out: \"뵤\", vowelMain: \"o\", consClass: \"b\", wasYouon: true },\n\n ぴゃ: { out: \"퍄\", vowelMain: \"a\", consClass: \"p\", wasYouon: true },\n ぴゅ: { out: \"퓨\", vowelMain: \"u\", consClass: \"p\", wasYouon: true },\n ぴょ: { out: \"표\", vowelMain: \"o\", consClass: \"p\", wasYouon: true },\n};\n\nexport const LOAN: Record<string, MoraInfo> = {\n てぃ: { out: \"티\", vowelMain: \"i\", consClass: \"t\" },\n でぃ: { out: \"디\", vowelMain: \"i\", consClass: \"d\" },\n ちぇ: { out: \"체\", vowelMain: \"e\", consClass: \"t\" },\n しぇ: { out: \"셰\", vowelMain: \"e\", consClass: \"s\" },\n じぇ: { out: \"제\", vowelMain: \"e\", consClass: \"z\" },\n つぁ: { out: \"차\", vowelMain: \"a\", consClass: \"t\" },\n つぃ: { out: \"치\", vowelMain: \"i\", consClass: \"t\" },\n つぇ: { out: \"체\", vowelMain: \"e\", consClass: \"t\" },\n つぉ: { out: \"초\", vowelMain: \"o\", consClass: \"t\" },\n ふぁ: { out: \"파\", vowelMain: \"a\", consClass: \"p\" },\n ふぃ: { out: \"피\", vowelMain: \"i\", consClass: \"p\" },\n ふぇ: { out: \"페\", vowelMain: \"e\", consClass: \"p\" },\n ふぉ: { out: \"포\", vowelMain: \"o\", consClass: \"p\" },\n ぐぁ: { out: \"과\", vowelMain: \"a\", consClass: \"g\" },\n ぐぃ: { out: \"귀\", vowelMain: \"i\", consClass: \"g\" },\n ぐぇ: { out: \"궤\", vowelMain: \"e\", consClass: \"g\" },\n ぐぉ: { out: \"궈\", vowelMain: \"o\", consClass: \"g\" },\n くぁ: { out: \"콰\", vowelMain: \"a\", consClass: \"k\" },\n くぃ: { out: \"퀴\", vowelMain: \"i\", consClass: \"k\" },\n くぇ: { out: \"퀘\", vowelMain: \"e\", consClass: \"k\" },\n くぉ: { out: \"쿼\", vowelMain: \"o\", consClass: \"k\" },\n どぁ: { out: \"돠\", vowelMain: \"a\", consClass: \"d\" },\n どぅ: { out: \"두\", vowelMain: \"u\", consClass: \"d\" },\n どぉ: { out: \"둬\", vowelMain: \"o\", consClass: \"d\" },\n ゔぁ: { out: \"바\", vowelMain: \"a\", consClass: \"b\" },\n ゔぃ: { out: \"비\", vowelMain: \"i\", consClass: \"b\" },\n ゔぇ: { out: \"베\", vowelMain: \"e\", consClass: \"b\" },\n ゔぉ: { out: \"보\", vowelMain: \"o\", consClass: \"b\" },\n};\n\nexport const SMALL_Y = new Set([\"ゃ\", \"ゅ\", \"ょ\"]);\nexport const SMALL_V = new Set([\"ぁ\", \"ぃ\", \"ぅ\", \"ぇ\", \"ぉ\"]);\n\nexport const U_DROP_KEYS = new Set([\n \"ゆ\",\n \"きゅ\",\n \"しゅ\",\n \"ちゅ\",\n \"にゅ\",\n \"ひゅ\",\n \"みゅ\",\n \"りゅ\",\n \"ぎゅ\",\n \"じゅ\",\n \"びゅ\",\n \"ぴゅ\",\n]);\n","// coreConverter.ts\nimport { SpecialDictionary, type SpecialDictionaryEntry } from \"./dictionary\";\nimport { HARD_BOUNDARY_SURF, type TokenSpan } from \"./particleRewriter\";\nimport {\n type ConsClass,\n type MoraInfo,\n SINGLE,\n YOUON,\n LOAN,\n SMALL_Y,\n SMALL_V,\n U_DROP_KEYS,\n} from \"./mora\";\n\n// --------------------------\n// Kana normalize helpers\n// --------------------------\nfunction isHiraganaChar(ch: string) {\n const c = ch.codePointAt(0)!;\n return c >= 0x3040 && c <= 0x309f;\n}\nfunction isKatakanaChar(ch: string) {\n const c = ch.codePointAt(0)!;\n return c >= 0x30a0 && c <= 0x30ff;\n}\nfunction toHiraganaKey(s: string): string {\n const n = s.normalize(\"NFKC\");\n return Array.from(n)\n .map((ch) => {\n // 장음은 그대로 유지\n if (ch === \"ー\") return ch;\n if (!isKatakanaChar(ch)) return ch;\n const code = ch.codePointAt(0)!;\n // カタカナ 문자 범위 (ァ~ヶ)만 변환\n if (code >= 0x30a1 && code <= 0x30f6) {\n return String.fromCodePoint(code - 0x60);\n }\n return ch;\n })\n .join(\"\");\n}\nfunction toKatakanaKey(s: string): string {\n const n = s.normalize(\"NFKC\");\n return Array.from(n)\n .map((ch) =>\n isHiraganaChar(ch) ? String.fromCodePoint(ch.codePointAt(0)! + 0x60) : ch,\n )\n .join(\"\");\n}\n\ntype DictStream = \"orig\" | \"rewritten\";\ntype CompiledDictItem = {\n keyChars: string[];\n answer: string;\n stream: DictStream;\n};\n\nfunction compileSpecialDictionary(\n dict: SpecialDictionaryEntry[],\n): CompiledDictItem[] {\n const items: CompiledDictItem[] = [];\n\n for (const e of dict) {\n // 기본: exact word는 원본에서만\n items.push({\n keyChars: Array.from(e.word),\n answer: e.answer,\n stream: \"orig\",\n });\n\n // hira:true => hiragana 스트림에서만 (입력 전체가 히라로 바뀌는 파이프라인이기 때문)\n if (e.hira) {\n const k = toHiraganaKey(e.word);\n items.push({\n keyChars: Array.from(k),\n answer: e.answer,\n stream: \"rewritten\",\n });\n }\n\n // kata:true => 원본에서만\n if (e.kata) {\n const k = toKatakanaKey(e.word);\n items.push({ keyChars: Array.from(k), answer: e.answer, stream: \"orig\" });\n }\n }\n\n // 긴 키 우선\n items.sort((a, b) => b.keyChars.length - a.keyChars.length);\n return items;\n}\n\nconst COMPILED_SPECIAL_DICT = compileSpecialDictionary(SpecialDictionary);\n\nfunction isHiragana(ch: string): boolean {\n const c = ch.codePointAt(0)!;\n return c >= 0x3040 && c <= 0x309f;\n}\n\nfunction isKana(ch: string): boolean {\n return isHiragana(ch) || ch === \"ー\";\n}\n\nexport function coreKanaToHangulConvert(\n s: string,\n opts: { tokens: TokenSpan[]; original: string },\n): string {\n // 코드포인트 배열로 변환 (surrogate pair 문제 해결)\n const chars = Array.from(s);\n const origChars = Array.from(opts?.original ?? s);\n\n // --- Hangul utilities ---\n const HANGUL_BASE = 0xac00;\n const HANGUL_END = 0xd7a3;\n\n function isHangulSyllable(ch: string): boolean {\n const c = ch.codePointAt(0)!;\n return c >= HANGUL_BASE && c <= HANGUL_END;\n }\n\n const JONG = {\n NONE: 0,\n G: 1, // ㄱ\n N: 4, // ㄴ\n M: 16, // ㅁ\n B: 17, // ㅂ\n S: 19, // ㅅ\n NG: 21, // ㅇ\n } as const;\n\n function addFinal(syl: string, jong: number): string {\n if (!isHangulSyllable(syl)) return syl;\n const code = syl.codePointAt(0)! - HANGUL_BASE;\n const cho = Math.floor(code / 588);\n const jung = Math.floor((code % 588) / 28);\n return String.fromCodePoint(HANGUL_BASE + cho * 588 + jung * 28 + jong);\n }\n\n function replaceLastHangul(out: string, jong: number): string {\n if (!out) return out;\n const last = out[out.length - 1];\n if (!isHangulSyllable(last)) return out;\n return out.slice(0, -1) + addFinal(last, jong);\n }\n\n // --- Kana classification ---\n function isHiragana(ch: string): boolean {\n const c = ch.codePointAt(0)!;\n return c >= 0x3040 && c <= 0x309f;\n }\n function isKana(ch: string): boolean {\n return isHiragana(ch) || ch === \"ー\";\n }\n\n type ReadMora = { key: string; len: number; info?: MoraInfo } | null;\n\n function readMoraAt(idx: number): ReadMora {\n if (idx >= chars.length) return null;\n\n const c0 = chars[idx];\n const c1 = chars[idx + 1];\n\n if (c1 && SMALL_V.has(c1)) {\n const key2 = c0 + c1;\n const info = LOAN[key2];\n if (info) return { key: key2, len: 2, info };\n }\n\n if (c1 && SMALL_Y.has(c1)) {\n const key2 = c0 + c1;\n const info = YOUON[key2];\n if (info) return { key: key2, len: 2, info };\n }\n\n const info = SINGLE[c0];\n if (info) return { key: c0, len: 1, info };\n\n return { key: c0, len: 1, info: undefined };\n }\n\n function readOriginalMoraAt(idx: number): ReadMora {\n if (idx >= origChars.length) return null;\n\n const c0 = origChars[idx];\n const c1 = origChars[idx + 1];\n\n if (c1 && SMALL_V.has(c1)) {\n const key2 = c0 + c1;\n const info = LOAN[key2];\n if (info) return { key: key2, len: 2, info };\n }\n\n if (c1 && SMALL_Y.has(c1)) {\n const key2 = c0 + c1;\n const info = YOUON[key2];\n if (info) return { key: key2, len: 2, info };\n }\n\n const info = SINGLE[c0];\n if (info) return { key: c0, len: 1, info };\n\n return { key: c0, len: 1, info: undefined };\n }\n\n function isLabialStart(cons: ConsClass): boolean {\n return cons === \"m\" || cons === \"b\" || cons === \"p\";\n }\n\n // 토큰 컨텍스트 탐색용\n const tokens = opts?.tokens ?? null;\n let tokIdx = 0;\n\n function syncTokenIndex(charIndex: number) {\n if (!tokens) return;\n while (tokIdx + 1 < tokens.length && tokens[tokIdx].end <= charIndex) {\n tokIdx++;\n }\n }\n\n function curToken(charIndex: number): TokenSpan | null {\n if (!tokens) return null;\n syncTokenIndex(charIndex);\n const t = tokens[tokIdx];\n if (t && t.start <= charIndex && charIndex < t.end) return t;\n return null;\n }\n\n function prevToken(): TokenSpan | null {\n if (!tokens) return null;\n return tokIdx - 1 >= 0 ? tokens[tokIdx - 1] : null;\n }\n function nextToken(): TokenSpan | null {\n if (!tokens) return null;\n return tokIdx + 1 < tokens.length ? tokens[tokIdx + 1] : null;\n }\n\n // ✅ 유성화 차단 next\n const INITIAL_VOICING_BLOCK_NEXT = new Set([\"い\", \"ひ\", \"ん\", \"て\"]);\n\n function peekNextMoraKeySkippingChoonpu(fromIdx: number): string | null {\n let j = fromIdx;\n while (j < chars.length && chars[j] === \"ー\") j++;\n const m = readMoraAt(j);\n return m?.key ?? null;\n }\n\n // ✅ \"-san\" 판별 (코드포인트 인덱스 기준)\n const SAN_PARTICLES = new Set([\"は\", \"わ\", \"へ\", \"え\", \"を\", \"お\"]);\n function isSanHonorificAt(cpIdx: number): boolean {\n const t = curToken(cpIdx);\n if (!t) return false;\n if (cpIdx < 1 || chars[cpIdx - 1] !== \"さ\") return false;\n\n // t.start는 코드포인트 인덱스, chars.slice 사용\n const local = chars.slice(t.start, cpIdx + 1).join(\"\");\n if (!local.endsWith(\"さん\")) return false;\n\n const hasPrefixInsideToken = cpIdx - 1 > t.start;\n const p = prevToken();\n const prevIsAttachable =\n !!p &&\n p.end === t.start &&\n p.surface.length > 0 &&\n !HARD_BOUNDARY_SURF.has(p.surface);\n\n if (!hasPrefixInsideToken && !prevIsAttachable) return false;\n\n const n = nextToken();\n if (!n) return true;\n if (n.pos === \"記号\" && HARD_BOUNDARY_SURF.has(n.surface)) return true;\n if (n.pos === \"助詞\" && SAN_PARTICLES.has(n.surface)) return true;\n return false;\n }\n\n let out = \"\";\n let i = 0;\n\n let lastMora: MoraInfo | null = null;\n\n while (i < chars.length) {\n // 토큰 기반 \"단어 시작\" 정의: i가 content 토큰 start면 true\n let atTokenStart = false;\n let tokForI: TokenSpan | null = null;\n\n if (tokens) {\n tokForI = curToken(i);\n // ✅ 토큰 시작이면 일단 단어 시작 후보로 인정\n atTokenStart = !!tokForI && tokForI.start === i;\n\n // ✅ 유성화/단어시작 판정에서 \"기호\"와 \"원문 카타카나 토큰\"만 컷\n if (tokForI?.pos === \"記号\") atTokenStart = false;\n } else {\n atTokenStart = i === 0;\n }\n\n // --------------------------\n // ✅ SpecialDictionary (entry 기반 + hira/kata 옵션)\n // --------------------------\n let matchedSpecial = false;\n\n // 긴 키부터 순회하므로, 앞에서 걸리면 끝\n for (const it of COMPILED_SPECIAL_DICT) {\n const src = it.stream === \"orig\" ? origChars : chars; // chars=rewritten\n const len = it.keyChars.length;\n if (i + len > src.length) continue;\n\n let ok = true;\n for (let k = 0; k < len; k++) {\n if (src[i + k] !== it.keyChars[k]) {\n ok = false;\n break;\n }\n }\n if (!ok) continue;\n\n out += it.answer;\n i += len;\n\n // 사전 치환은 단어 단위 => 상태 초기화\n lastMora = null;\n\n matchedSpecial = true;\n break;\n }\n if (matchedSpecial) continue;\n\n const ch = chars[i];\n\n /**\n * ー 표시는 그냥 드랍\n */\n if (ch === \"ー\") {\n i += 1;\n continue;\n }\n\n /**\n * 비가나: 그대로\n */\n if (!isKana(ch)) {\n out += ch;\n i += 1;\n lastMora = null;\n continue;\n }\n\n /**\n * 촉음 규칙\n */\n if (ch === \"っ\") {\n if (!out || !isHangulSyllable(out[out.length - 1])) {\n // \"ッ\"으로 바꾸기\n out += \"ッ\";\n i += 1;\n lastMora = null;\n continue;\n }\n\n const next = readMoraAt(i + 1);\n\n const prevV = lastMora?.vowelMain ?? \"a\";\n const nextInfo = next?.info;\n const nextCons: ConsClass = nextInfo?.consClass ?? \"t\";\n\n let jong: number = JONG.S;\n if (nextCons === \"p\" || nextCons === \"b\") jong = JONG.B;\n else if (nextCons === \"k\" || nextCons === \"g\") {\n jong = prevV === \"e\" || prevV === \"i\" ? JONG.S : JONG.G;\n } else {\n jong = JONG.S;\n }\n\n out = replaceLastHangul(out, jong);\n i += 1;\n continue;\n }\n\n /**\n * おお 장음 규칙\n */\n if (ch === \"お\" && chars[i + 1] === \"お\") {\n let j = i;\n while (chars[j] === \"お\") j++;\n out += \"오\";\n i = j;\n lastMora = {\n out: \"오\",\n vowelMain: \"o\",\n consClass: \"vowel\",\n vowelOnly: true,\n };\n continue;\n }\n\n const mora = readMoraAt(i);\n const originalMora = readOriginalMoraAt(i);\n if (!mora) {\n out += chars[i];\n i += 1;\n lastMora = null;\n continue;\n }\n // 에러\n if (!originalMora) {\n throw Error(\"원본 모라 손실\");\n }\n\n /**\n * ん 규칙\n */\n if (mora.key === \"ん\") {\n const next = readMoraAt(i + 1);\n const nextInfo = next?.info;\n\n const hasPrevHangul =\n out.length > 0 && isHangulSyllable(out[out.length - 1]);\n if (!hasPrevHangul) {\n out += \"ㄴ\";\n i += 1;\n lastMora = null;\n continue;\n }\n\n // 토큰 컨텍스트 기반 \"-san\" → '상'\n if (lastMora?.out === \"사\" && isSanHonorificAt(i)) {\n out = replaceLastHangul(out, JONG.NG);\n i += 1;\n continue;\n }\n\n // --- 기존 ん 동화 규칙 ---\n let jong: number = JONG.N;\n if (!next || !nextInfo || !isKana(next.key[0])) {\n jong = lastMora?.wasYouon ? JONG.NG : JONG.N;\n } else {\n const nc = nextInfo.consClass;\n if (nc === \"k\" || nc === \"g\") {\n jong = JONG.NG;\n } else if (nc === \"vowel\" || nc === \"y\" || nc === \"w\") {\n jong = JONG.N;\n } else if (isLabialStart(nc)) {\n if (lastMora?.vowelOnly) jong = JONG.N;\n else jong = JONG.M;\n } else {\n jong = JONG.N;\n }\n }\n\n out = replaceLastHangul(out, jong);\n i += 1;\n continue;\n }\n\n /**\n * 유성화 규칙\n */\n const info = mora.info;\n if (!info) {\n out += mora.key;\n i += mora.len;\n lastMora = null;\n continue;\n }\n\n // ✅ 단어(토큰) 시작 유성화: と/こ만 + 예외(이/히/ん/테) + (앞이 っ이면 금지)\n let outSyl = info.out;\n if (atTokenStart && (mora.key === \"と\" || mora.key === \"こ\")) {\n const prevIsSokuon = i > 0 && chars[i - 1] === \"っ\";\n\n const nextKey = peekNextMoraKeySkippingChoonpu(i + mora.len);\n const blockedByNext =\n !!nextKey && INITIAL_VOICING_BLOCK_NEXT.has(nextKey);\n\n const isKou = mora.key === \"こ\" && chars[i + mora.len] === \"う\";\n\n // ✅ 추가: \"진짜 조사 と/こ\"로 쓰인 경우만 유성화 차단\n // - 현재 토큰이 1글자 'と'/'こ'이고,\n // - 이전 토큰이 내용어(명사/동사/형용사 등)면 => 조사로 판단 => 유성화 금지\n let blockedByParticleUsage = false;\n if (tokens && tokForI) {\n const isSingleCharToken = tokForI.surface.length === 1;\n const tokenMatchesMora = tokForI.surface === mora.key;\n\n if (isSingleCharToken && tokenMatchesMora) {\n const p = prevToken(); // curToken(i) 호출로 tokIdx는 sync된 상태\n const prevLooksLikeContent =\n !!p &&\n p.pos !== \"記号\" &&\n p.pos !== \"助詞\" &&\n p.pos !== \"助動詞\" &&\n !HARD_BOUNDARY_SURF.has(p.surface);\n\n if (prevLooksLikeContent) blockedByParticleUsage = true;\n }\n }\n\n const allowVoicing =\n !prevIsSokuon && !blockedByNext && !isKou && !blockedByParticleUsage;\n\n if (allowVoicing) {\n if (mora.key === \"と\") outSyl = \"도\";\n else if (mora.key === \"こ\") outSyl = \"고\";\n }\n }\n\n out += outSyl;\n lastMora = { ...info, out: outSyl };\n\n /**\n * 연음 드랍\n */\n const next1 = chars[i + mora.len]; // 다음 언어\n const afterLen = chars[i + mora.len + 1]; // 다다음언어\n\n // o + う 드랍\n if (next1 === \"う\" && info.vowelMain === \"o\") {\n i += mora.len + 1;\n continue;\n }\n\n // ゅう 드랍 (きゅう) // ゆう는 드랍할까말까? (유우리) 일단 ゆう도 드랍함!\n if (next1 === \"う\" && U_DROP_KEYS.has(mora.key)) {\n i += mora.len + 1;\n continue;\n }\n\n // い 드랍\n if (next1 === \"い\") {\n // せんせい -> 센세\n if (mora.key === \"せ\") {\n i += mora.len + 1;\n continue;\n }\n // 케도 장음인데, 케이사츠라고 검색하는 경우가 더 많으려나? 어떻게 할까...\n else if (mora.key === \"け\") {\n i += mora.len + 1;\n continue;\n }\n // えいご -> 에고\n else if (mora.key === \"え\") {\n // 조사 へ 감지\n if (originalMora.key !== \"へ\") {\n i += mora.len + 1;\n continue;\n }\n }\n // 오이시, 야사시 대응\n else if (mora.key === \"し\") {\n i += mora.len + 1;\n continue;\n }\n }\n\n // おねえさん 대응\n if (next1 === \"え\" && mora.key === \"ね\") {\n i += mora.len + 1;\n continue;\n }\n\n i += mora.len;\n }\n\n return out;\n}\n","// kanaToHangul.ts\n// 전체 변환 파이프라인을 orchestration만 담당하도록 정리했습니다.\nimport type { Tokenizer } from \"./tokenizer\";\nimport { normalizeInputText, toHiragana } from \"./normalizer\";\nimport { tokenizeAndRewriteParticles } from \"./particleRewriter\";\nimport { coreKanaToHangulConvert } from \"./coreConverter\";\n\nexport type KanaToHangul = (input: string) => string;\n\nexport function createKanaToHangul(tokenizer: Tokenizer): KanaToHangul {\n return (input: string) => convertWithTokenizer(input, tokenizer);\n}\n\nexport function convertWithTokenizer(\n input: string,\n tokenizer: Tokenizer,\n): string {\n const normalized = normalizeInputText(input);\n\n // ✅ 길이 1:1 보장되는 kana 변환을 먼저 수행(스팬 유지)\n const hiragana = toHiragana(normalized);\n\n // ✅ 핵심: prewrite 이전에 토큰화(=normalized 기준), prewrite는 토큰(pos)을 사용하되 slice는 hiragana 기준\n const { rewritten, spans, rewrittenOriginal } = tokenizeAndRewriteParticles(\n normalized,\n hiragana,\n tokenizer,\n );\n\n // ✅ rewritten + rewritten spans 로 core\n // 한자가 pronunciation으로 변환된 경우 rewrittenOriginal도 같은 길이로 변환됨\n return coreKanaToHangulConvert(rewritten, {\n tokens: spans,\n original: rewrittenOriginal,\n });\n}\n","import kuromoji from \"kuromoji\";\n\nexport type Tokenizer = kuromoji.Tokenizer<kuromoji.IpadicFeatures>;\n\nasync function buildTokenizer(): Promise<Tokenizer> {\n return new Promise((resolve, reject) => {\n kuromoji\n .builder({ dicPath: \"https://cdn.jsdelivr.net/npm/kuromoji@0.1.2/dict/\" })\n .build((err, tk) => {\n if (err || !tk) reject(err);\n else resolve(tk);\n });\n });\n}\n\nlet tokenizerPromise: Promise<Tokenizer> | null = null;\n\nexport async function getTokenizer(): Promise<Tokenizer> {\n if (!tokenizerPromise) {\n tokenizerPromise = buildTokenizer();\n }\n return tokenizerPromise;\n}\n","import type { KanaToHangul } from \"./kanaToHangul\";\nimport { createKanaToHangul } from \"./kanaToHangul\";\nimport { getTokenizer } from \"./tokenizer.browser\";\n\nexport class Kanabarum {\n private converter: KanaToHangul | null = null;\n\n async init(): Promise<void> {\n const tokenizer = await getTokenizer();\n this.converter = createKanaToHangul(tokenizer);\n }\n\n kanaToHangul(input: string): string {\n if (!this.converter) {\n throw new Error(\"Kanabarum is not initialized. Call init() first.\");\n }\n return this.converter(input);\n }\n}\n\nlet cachedConverter: KanaToHangul | null = null;\nlet pendingInit: Promise<KanaToHangul> | null = null;\n\nasync function initKanaToHangul(): Promise<KanaToHangul> {\n if (cachedConverter) return cachedConverter;\n if (pendingInit) return pendingInit;\n\n pendingInit = (async () => {\n const tokenizer = await getTokenizer();\n const converter = createKanaToHangul(tokenizer);\n cachedConverter = converter;\n return converter;\n })();\n\n return pendingInit;\n}\n\nexport async function kanaToHangul(input: string): Promise<string> {\n const converter = await initKanaToHangul();\n return converter(input);\n}\n\nexport type { KanaToHangul };\n"]}
|