Z31148

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z31148"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z24453",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z600",
            "Z16K2": "/**\n * officially unofficial: https://github.com/tc39/proposal-intl-segmenter \u003C=\u003E https://gist.github.com/inexorabletash/8c4d869a584bcaa18514729332300356\n */\n\n// Rough polyfill for Intl.Segmenter proposal\n//\n// https://github.com/tc39/proposal-intl-segmenter/blob/master/README.md\n//\n// Caveats and Limitations\n//  * granularity: 'line': 'strictness' option is not supported (ignored)\n//  * In Chrome, uses v8BreakIterator\n//  * Otherwise, uses very simplistic rules\n//    * Ignores locale; only \"usable\" on English\n//    * granularity: 'grapheme' does not understand combining characters\n//    * granularity: 'sentence' does not understand decimals\n\nconst Intl = (function(global) {\n\tif ('Intl' in global \u0026\u0026 'Segmenter' in global.Intl)\n\t\treturn;\n\n\tglobal.Intl = global.Intl || {};\n\n\tconst GRANULARITIES = ['grapheme', 'word','sentence', 'line'];\n\n\t// TODO: Implement http://www.unicode.org/reports/tr29/\n\tconst RULES = {\n\t\tgrapheme: {\n\t\t\tgrapheme: /^(.|\\n)/\n\t\t},\n\t\tword: {\n\t\t\tletter: /^[a-z](?:'?[a-z])*/i,\n\t\t\tnumber: /^\\d+([,.]\\d+)*/\n\t\t},\n\t\tsentence: {\n\t\t\tterminator: /^[^.?!\\r\\n]+[.?!]+[\\r\\n]?/,\n\t\t\tseparator: /^[^.?!\\r\\n]+[\\r\\n]?/\n\t\t},\n\t\tline: {\n\t\t\thard: /^\\S*[\\r\\n]/,\n\t\t\tsoft: /^\\S*\\s*/\n\t\t}\n\t};\n\n\t// Work around bug in v8BreakIterator where ICU's UWordBreak enum is\n\t// used even if granularity is not \"word\". See the code in\n\t// Runtime_BreakIteratorBreakType in runtime/runtime-i18n.cc for\n\t// details.\n\tfunction fixBreakType(value, granularity) {\n\t\t// Undo the mapping of UWordBreak to string\n\t\tconst ruleStatus = {\n\t\t\tnone: 0, // UBRK_WORD_NONE\n\t\t\tnumber: 100, // UBRK_WORD_NUMBER\n\t\t\tletter: 200, // UBRK_WORD_LETTER\n\t\t\tkana: 300, // UBRK_WORD_KANA\n\t\t\tideo: 400, // UBRK_WORD_IDEO\n\t\t\tunknown: -1\n\t\t}[value] || 0;\n\n\n\t\tswitch (granularity) {\n\t\tcase 'character':\n\t\t\treturn undefined;\n\t\tcase 'word':\n\t\t\treturn value;\n\t\tcase 'sentence':\n\t\t\t// Map ULineBreakTag rule status to string.\n\t\t\treturn {\n\t\t\t\t0: 'terminator',\n\t\t\t\t100: 'separator'\n\t\t\t}[ruleStatus] || value;\n\t\tcase 'line':\n\t\t\t// Map ULineBreakTag rule status to string.\n\t\t\treturn {\n\t\t\t\t0: 'soft',\n\t\t\t\t100: 'hard'\n\t\t\t}[ruleStatus] || value;\n\t\tdefault:\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tfunction segment(locale, granularity, string) {\n\t\tconst breaks = [];\n\t\tif ('v8BreakIterator' in global.Intl) {\n\t\t\tif (granularity === 'grapheme')\n\t\t\t\tgranularity = 'character';\n\t\t\tconst vbi = new global.Intl.v8BreakIterator(locale, {type: granularity});\n\t\t\tvbi.adoptText(string);\n\t\t\tlet last = 0;\n\t\t\tlet pos = vbi.next();\n\t\t\twhile (pos !== -1) {\n\t\t\t\tbreaks.push({\n\t\t\t\t\tpos: vbi.current(),\n\t\t\t\t\tsegment: string.slice(last, pos),\n\t\t\t\t\tbreakType: fixBreakType(vbi.breakType(), granularity)\n\t\t\t\t});\n\t\t\t\tlast = pos;\n\t\t\t\tpos = vbi.next();\n\t\t\t}\n\t\t} else {\n\t\t\tconst rules = RULES[granularity];\n\t\t\tlet pos = 0;\n\t\t\twhile (pos \u003C string.length) {\n\t\t\t\tlet found = false;\n\t\t\t\tfor (let rule of Object.keys(rules)) {\n\t\t\t\t\tconst re = rules[rule];\n\t\t\t\t\tconst m = string.slice(pos).match(re);\n\t\t\t\t\tif (m) {\n\t\t\t\t\t\tpos += m[0].length;\n\t\t\t\t\t\tbreaks.push({\n\t\t\t\t\t\t\tpos: pos,\n\t\t\t\t\t\t\tsegment: m[0],\n\t\t\t\t\t\t\tbreakType: granularity === 'grapheme' ? undefined : rule\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found) {\n\t\t\t\t\tbreaks.push({\n\t\t\t\t\t\tpos: pos + 1,\n\t\t\t\t\t\tsegment: string.slice(pos, ++pos),\n\t\t\t\t\t\tbreakType: 'none'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbreaks.initial = 0;\n\t\treturn breaks;\n\t}\n\n\tclass $SegmentIterator$ {\n\t\tconstructor(string, breaks) {\n\t\t\tthis._cur = -1;\n\t\t\tthis._type = undefined;\n\t\t\tthis._breaks = breaks;\n\t\t\tconsole.log(breaks);\n\t\t}\n\n\t\t[Symbol.iterator]() { return this; }\n\n\t\tnext() {\n\t\t\tif (this._cur \u003C this._breaks.length)\n\t\t\t\t++this._cur;\n\n\t\t\tif (this._cur \u003E= this._breaks.length) {\n\t\t\t\tthis._type = undefined;\n\t\t\t\treturn {done: true, value: undefined};\n\t\t\t}\n\n\t\t\tthis._type = this._breaks[this._cur].breakType;\n\t\t\treturn {\n\t\t\t\tdone: false,\n\t\t\t\tvalue: {\n\t\t\t\t\tsegment: this._breaks[this._cur].segment,\n\t\t\t\t\tbreakType: this._breaks[this._cur].breakType\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tfollowing(index = undefined) {\n\t\t\tif (!this._breaks.length)\n\t\t\t\treturn true;\n\t\t\tif (index === undefined) {\n\t\t\t\tif (this._cur \u003C this._breaks.length)\n\t\t\t\t\t++this._cur;\n\t\t\t} else {\n\t\t\t\t// TODO: binary search\n\t\t\t\tfor (this._cur = 0;\n\t\t\t\t\t\t this._cur \u003C this._breaks.length\n\t\t\t\t\t\t \u0026\u0026 this._breaks[this._cur].pos \u003C index;\n\t\t\t\t\t\t ++this._cur) {}\n\t\t\t}\n\n\t\t\tthis._type = this._cur \u003C this._breaks.length\n\t\t\t\t? this._breaks[this._cur].breakType : undefined;\n\t\t\treturn this._cur + 1 \u003E= this._breaks.length;\n\t\t}\n\n\t\tpreceding(index = undefined) {\n\t\t\tif (!this._breaks.length)\n\t\t\t\treturn true;\n\t\t\tif (index === undefined) {\n\t\t\t\tif (this._cur \u003E= this._breaks.length)\n\t\t\t\t\t--this._cur;\n\t\t\t\tif (this._cur \u003E= 0)\n\t\t\t\t\t--this._cur;\n\t\t\t} else {\n\t\t\t\t// TODO: binary search\n\t\t\t\tfor (this._cur = this._breaks.length - 1;\n\t\t\t\t\t\t this._cur \u003E= 0\n\t\t\t\t\t\t \u0026\u0026 this._breaks[this._cur].pos \u003E= index;\n\t\t\t\t\t\t --this._cur) {}\n\t\t\t}\n\n\t\t\tthis._type =\n\t\t\t\tthis._cur + 1 \u003E= this._breaks.length ? undefined :\n\t\t\t\tthis._breaks[this._cur + 1].breakType;\n\t\t\treturn this._cur \u003C 0;\n\t\t}\n\n\t\tget position() {\n\t\t\tif (this._cur \u003C 0 || !this._breaks.length)\n\t\t\t\treturn this._breaks.initial;\n\t\t\tif (this._cur \u003E= this._breaks.length)\n\t\t\t\treturn this._breaks[this._breaks.length - 1].pos;\n\t\t\treturn this._breaks[this._cur].pos;\n\t\t}\n\n\t\tget breakType() {\n\t\t\treturn this._type;\n\t\t}\n\t}\n\n\tglobal.Intl.Segmenter = class Segmenter {\n\t\tconstructor(locale, options) {\n\t\t\tthis._locale = Array.isArray(locale)\n\t\t\t\t? locale.map(s =\u003E String(s)) : String(locale || global.navigator.language);\n\t\t\toptions = Object.assign({granularity: 'grapheme'}, options);\n\t\t\tthis._granularity = GRANULARITIES.includes(options.granularity)\n\t\t\t\t? options.granularity : 'grapheme';\n\t\t}\n\n\t\tsegment(string) {\n\t\t\treturn new $SegmentIterator$(\n\t\t\t\tstring, segment(this._locale, this._granularity, string));\n\t\t}\n\t};\n\n\treturn global.Intl;\n}({ navigator: { language: \"mul\" } }));\n\nfunction Z24453( Z24453K1 ) {\n\treturn [...new Intl.Segmenter().segment(Z24453K1)].map(seg =\u003E seg.segment);\n}"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "String to grapheme list, Intl polyfill JS"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}