11cb0ef41Sopenharmony_civar eaw = {};
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciif ('undefined' == typeof module) {
41cb0ef41Sopenharmony_ci  window.eastasianwidth = eaw;
51cb0ef41Sopenharmony_ci} else {
61cb0ef41Sopenharmony_ci  module.exports = eaw;
71cb0ef41Sopenharmony_ci}
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_cieaw.eastAsianWidth = function(character) {
101cb0ef41Sopenharmony_ci  var x = character.charCodeAt(0);
111cb0ef41Sopenharmony_ci  var y = (character.length == 2) ? character.charCodeAt(1) : 0;
121cb0ef41Sopenharmony_ci  var codePoint = x;
131cb0ef41Sopenharmony_ci  if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
141cb0ef41Sopenharmony_ci    x &= 0x3FF;
151cb0ef41Sopenharmony_ci    y &= 0x3FF;
161cb0ef41Sopenharmony_ci    codePoint = (x << 10) | y;
171cb0ef41Sopenharmony_ci    codePoint += 0x10000;
181cb0ef41Sopenharmony_ci  }
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci  if ((0x3000 == codePoint) ||
211cb0ef41Sopenharmony_ci      (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
221cb0ef41Sopenharmony_ci      (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
231cb0ef41Sopenharmony_ci    return 'F';
241cb0ef41Sopenharmony_ci  }
251cb0ef41Sopenharmony_ci  if ((0x20A9 == codePoint) ||
261cb0ef41Sopenharmony_ci      (0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
271cb0ef41Sopenharmony_ci      (0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
281cb0ef41Sopenharmony_ci      (0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
291cb0ef41Sopenharmony_ci      (0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
301cb0ef41Sopenharmony_ci      (0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
311cb0ef41Sopenharmony_ci      (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
321cb0ef41Sopenharmony_ci    return 'H';
331cb0ef41Sopenharmony_ci  }
341cb0ef41Sopenharmony_ci  if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
351cb0ef41Sopenharmony_ci      (0x11A3 <= codePoint && codePoint <= 0x11A7) ||
361cb0ef41Sopenharmony_ci      (0x11FA <= codePoint && codePoint <= 0x11FF) ||
371cb0ef41Sopenharmony_ci      (0x2329 <= codePoint && codePoint <= 0x232A) ||
381cb0ef41Sopenharmony_ci      (0x2E80 <= codePoint && codePoint <= 0x2E99) ||
391cb0ef41Sopenharmony_ci      (0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
401cb0ef41Sopenharmony_ci      (0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
411cb0ef41Sopenharmony_ci      (0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
421cb0ef41Sopenharmony_ci      (0x3001 <= codePoint && codePoint <= 0x303E) ||
431cb0ef41Sopenharmony_ci      (0x3041 <= codePoint && codePoint <= 0x3096) ||
441cb0ef41Sopenharmony_ci      (0x3099 <= codePoint && codePoint <= 0x30FF) ||
451cb0ef41Sopenharmony_ci      (0x3105 <= codePoint && codePoint <= 0x312D) ||
461cb0ef41Sopenharmony_ci      (0x3131 <= codePoint && codePoint <= 0x318E) ||
471cb0ef41Sopenharmony_ci      (0x3190 <= codePoint && codePoint <= 0x31BA) ||
481cb0ef41Sopenharmony_ci      (0x31C0 <= codePoint && codePoint <= 0x31E3) ||
491cb0ef41Sopenharmony_ci      (0x31F0 <= codePoint && codePoint <= 0x321E) ||
501cb0ef41Sopenharmony_ci      (0x3220 <= codePoint && codePoint <= 0x3247) ||
511cb0ef41Sopenharmony_ci      (0x3250 <= codePoint && codePoint <= 0x32FE) ||
521cb0ef41Sopenharmony_ci      (0x3300 <= codePoint && codePoint <= 0x4DBF) ||
531cb0ef41Sopenharmony_ci      (0x4E00 <= codePoint && codePoint <= 0xA48C) ||
541cb0ef41Sopenharmony_ci      (0xA490 <= codePoint && codePoint <= 0xA4C6) ||
551cb0ef41Sopenharmony_ci      (0xA960 <= codePoint && codePoint <= 0xA97C) ||
561cb0ef41Sopenharmony_ci      (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
571cb0ef41Sopenharmony_ci      (0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
581cb0ef41Sopenharmony_ci      (0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
591cb0ef41Sopenharmony_ci      (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
601cb0ef41Sopenharmony_ci      (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
611cb0ef41Sopenharmony_ci      (0xFE30 <= codePoint && codePoint <= 0xFE52) ||
621cb0ef41Sopenharmony_ci      (0xFE54 <= codePoint && codePoint <= 0xFE66) ||
631cb0ef41Sopenharmony_ci      (0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
641cb0ef41Sopenharmony_ci      (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
651cb0ef41Sopenharmony_ci      (0x1F200 <= codePoint && codePoint <= 0x1F202) ||
661cb0ef41Sopenharmony_ci      (0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
671cb0ef41Sopenharmony_ci      (0x1F240 <= codePoint && codePoint <= 0x1F248) ||
681cb0ef41Sopenharmony_ci      (0x1F250 <= codePoint && codePoint <= 0x1F251) ||
691cb0ef41Sopenharmony_ci      (0x20000 <= codePoint && codePoint <= 0x2F73F) ||
701cb0ef41Sopenharmony_ci      (0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
711cb0ef41Sopenharmony_ci      (0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
721cb0ef41Sopenharmony_ci    return 'W';
731cb0ef41Sopenharmony_ci  }
741cb0ef41Sopenharmony_ci  if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
751cb0ef41Sopenharmony_ci      (0x00A2 <= codePoint && codePoint <= 0x00A3) ||
761cb0ef41Sopenharmony_ci      (0x00A5 <= codePoint && codePoint <= 0x00A6) ||
771cb0ef41Sopenharmony_ci      (0x00AC == codePoint) ||
781cb0ef41Sopenharmony_ci      (0x00AF == codePoint) ||
791cb0ef41Sopenharmony_ci      (0x27E6 <= codePoint && codePoint <= 0x27ED) ||
801cb0ef41Sopenharmony_ci      (0x2985 <= codePoint && codePoint <= 0x2986)) {
811cb0ef41Sopenharmony_ci    return 'Na';
821cb0ef41Sopenharmony_ci  }
831cb0ef41Sopenharmony_ci  if ((0x00A1 == codePoint) ||
841cb0ef41Sopenharmony_ci      (0x00A4 == codePoint) ||
851cb0ef41Sopenharmony_ci      (0x00A7 <= codePoint && codePoint <= 0x00A8) ||
861cb0ef41Sopenharmony_ci      (0x00AA == codePoint) ||
871cb0ef41Sopenharmony_ci      (0x00AD <= codePoint && codePoint <= 0x00AE) ||
881cb0ef41Sopenharmony_ci      (0x00B0 <= codePoint && codePoint <= 0x00B4) ||
891cb0ef41Sopenharmony_ci      (0x00B6 <= codePoint && codePoint <= 0x00BA) ||
901cb0ef41Sopenharmony_ci      (0x00BC <= codePoint && codePoint <= 0x00BF) ||
911cb0ef41Sopenharmony_ci      (0x00C6 == codePoint) ||
921cb0ef41Sopenharmony_ci      (0x00D0 == codePoint) ||
931cb0ef41Sopenharmony_ci      (0x00D7 <= codePoint && codePoint <= 0x00D8) ||
941cb0ef41Sopenharmony_ci      (0x00DE <= codePoint && codePoint <= 0x00E1) ||
951cb0ef41Sopenharmony_ci      (0x00E6 == codePoint) ||
961cb0ef41Sopenharmony_ci      (0x00E8 <= codePoint && codePoint <= 0x00EA) ||
971cb0ef41Sopenharmony_ci      (0x00EC <= codePoint && codePoint <= 0x00ED) ||
981cb0ef41Sopenharmony_ci      (0x00F0 == codePoint) ||
991cb0ef41Sopenharmony_ci      (0x00F2 <= codePoint && codePoint <= 0x00F3) ||
1001cb0ef41Sopenharmony_ci      (0x00F7 <= codePoint && codePoint <= 0x00FA) ||
1011cb0ef41Sopenharmony_ci      (0x00FC == codePoint) ||
1021cb0ef41Sopenharmony_ci      (0x00FE == codePoint) ||
1031cb0ef41Sopenharmony_ci      (0x0101 == codePoint) ||
1041cb0ef41Sopenharmony_ci      (0x0111 == codePoint) ||
1051cb0ef41Sopenharmony_ci      (0x0113 == codePoint) ||
1061cb0ef41Sopenharmony_ci      (0x011B == codePoint) ||
1071cb0ef41Sopenharmony_ci      (0x0126 <= codePoint && codePoint <= 0x0127) ||
1081cb0ef41Sopenharmony_ci      (0x012B == codePoint) ||
1091cb0ef41Sopenharmony_ci      (0x0131 <= codePoint && codePoint <= 0x0133) ||
1101cb0ef41Sopenharmony_ci      (0x0138 == codePoint) ||
1111cb0ef41Sopenharmony_ci      (0x013F <= codePoint && codePoint <= 0x0142) ||
1121cb0ef41Sopenharmony_ci      (0x0144 == codePoint) ||
1131cb0ef41Sopenharmony_ci      (0x0148 <= codePoint && codePoint <= 0x014B) ||
1141cb0ef41Sopenharmony_ci      (0x014D == codePoint) ||
1151cb0ef41Sopenharmony_ci      (0x0152 <= codePoint && codePoint <= 0x0153) ||
1161cb0ef41Sopenharmony_ci      (0x0166 <= codePoint && codePoint <= 0x0167) ||
1171cb0ef41Sopenharmony_ci      (0x016B == codePoint) ||
1181cb0ef41Sopenharmony_ci      (0x01CE == codePoint) ||
1191cb0ef41Sopenharmony_ci      (0x01D0 == codePoint) ||
1201cb0ef41Sopenharmony_ci      (0x01D2 == codePoint) ||
1211cb0ef41Sopenharmony_ci      (0x01D4 == codePoint) ||
1221cb0ef41Sopenharmony_ci      (0x01D6 == codePoint) ||
1231cb0ef41Sopenharmony_ci      (0x01D8 == codePoint) ||
1241cb0ef41Sopenharmony_ci      (0x01DA == codePoint) ||
1251cb0ef41Sopenharmony_ci      (0x01DC == codePoint) ||
1261cb0ef41Sopenharmony_ci      (0x0251 == codePoint) ||
1271cb0ef41Sopenharmony_ci      (0x0261 == codePoint) ||
1281cb0ef41Sopenharmony_ci      (0x02C4 == codePoint) ||
1291cb0ef41Sopenharmony_ci      (0x02C7 == codePoint) ||
1301cb0ef41Sopenharmony_ci      (0x02C9 <= codePoint && codePoint <= 0x02CB) ||
1311cb0ef41Sopenharmony_ci      (0x02CD == codePoint) ||
1321cb0ef41Sopenharmony_ci      (0x02D0 == codePoint) ||
1331cb0ef41Sopenharmony_ci      (0x02D8 <= codePoint && codePoint <= 0x02DB) ||
1341cb0ef41Sopenharmony_ci      (0x02DD == codePoint) ||
1351cb0ef41Sopenharmony_ci      (0x02DF == codePoint) ||
1361cb0ef41Sopenharmony_ci      (0x0300 <= codePoint && codePoint <= 0x036F) ||
1371cb0ef41Sopenharmony_ci      (0x0391 <= codePoint && codePoint <= 0x03A1) ||
1381cb0ef41Sopenharmony_ci      (0x03A3 <= codePoint && codePoint <= 0x03A9) ||
1391cb0ef41Sopenharmony_ci      (0x03B1 <= codePoint && codePoint <= 0x03C1) ||
1401cb0ef41Sopenharmony_ci      (0x03C3 <= codePoint && codePoint <= 0x03C9) ||
1411cb0ef41Sopenharmony_ci      (0x0401 == codePoint) ||
1421cb0ef41Sopenharmony_ci      (0x0410 <= codePoint && codePoint <= 0x044F) ||
1431cb0ef41Sopenharmony_ci      (0x0451 == codePoint) ||
1441cb0ef41Sopenharmony_ci      (0x2010 == codePoint) ||
1451cb0ef41Sopenharmony_ci      (0x2013 <= codePoint && codePoint <= 0x2016) ||
1461cb0ef41Sopenharmony_ci      (0x2018 <= codePoint && codePoint <= 0x2019) ||
1471cb0ef41Sopenharmony_ci      (0x201C <= codePoint && codePoint <= 0x201D) ||
1481cb0ef41Sopenharmony_ci      (0x2020 <= codePoint && codePoint <= 0x2022) ||
1491cb0ef41Sopenharmony_ci      (0x2024 <= codePoint && codePoint <= 0x2027) ||
1501cb0ef41Sopenharmony_ci      (0x2030 == codePoint) ||
1511cb0ef41Sopenharmony_ci      (0x2032 <= codePoint && codePoint <= 0x2033) ||
1521cb0ef41Sopenharmony_ci      (0x2035 == codePoint) ||
1531cb0ef41Sopenharmony_ci      (0x203B == codePoint) ||
1541cb0ef41Sopenharmony_ci      (0x203E == codePoint) ||
1551cb0ef41Sopenharmony_ci      (0x2074 == codePoint) ||
1561cb0ef41Sopenharmony_ci      (0x207F == codePoint) ||
1571cb0ef41Sopenharmony_ci      (0x2081 <= codePoint && codePoint <= 0x2084) ||
1581cb0ef41Sopenharmony_ci      (0x20AC == codePoint) ||
1591cb0ef41Sopenharmony_ci      (0x2103 == codePoint) ||
1601cb0ef41Sopenharmony_ci      (0x2105 == codePoint) ||
1611cb0ef41Sopenharmony_ci      (0x2109 == codePoint) ||
1621cb0ef41Sopenharmony_ci      (0x2113 == codePoint) ||
1631cb0ef41Sopenharmony_ci      (0x2116 == codePoint) ||
1641cb0ef41Sopenharmony_ci      (0x2121 <= codePoint && codePoint <= 0x2122) ||
1651cb0ef41Sopenharmony_ci      (0x2126 == codePoint) ||
1661cb0ef41Sopenharmony_ci      (0x212B == codePoint) ||
1671cb0ef41Sopenharmony_ci      (0x2153 <= codePoint && codePoint <= 0x2154) ||
1681cb0ef41Sopenharmony_ci      (0x215B <= codePoint && codePoint <= 0x215E) ||
1691cb0ef41Sopenharmony_ci      (0x2160 <= codePoint && codePoint <= 0x216B) ||
1701cb0ef41Sopenharmony_ci      (0x2170 <= codePoint && codePoint <= 0x2179) ||
1711cb0ef41Sopenharmony_ci      (0x2189 == codePoint) ||
1721cb0ef41Sopenharmony_ci      (0x2190 <= codePoint && codePoint <= 0x2199) ||
1731cb0ef41Sopenharmony_ci      (0x21B8 <= codePoint && codePoint <= 0x21B9) ||
1741cb0ef41Sopenharmony_ci      (0x21D2 == codePoint) ||
1751cb0ef41Sopenharmony_ci      (0x21D4 == codePoint) ||
1761cb0ef41Sopenharmony_ci      (0x21E7 == codePoint) ||
1771cb0ef41Sopenharmony_ci      (0x2200 == codePoint) ||
1781cb0ef41Sopenharmony_ci      (0x2202 <= codePoint && codePoint <= 0x2203) ||
1791cb0ef41Sopenharmony_ci      (0x2207 <= codePoint && codePoint <= 0x2208) ||
1801cb0ef41Sopenharmony_ci      (0x220B == codePoint) ||
1811cb0ef41Sopenharmony_ci      (0x220F == codePoint) ||
1821cb0ef41Sopenharmony_ci      (0x2211 == codePoint) ||
1831cb0ef41Sopenharmony_ci      (0x2215 == codePoint) ||
1841cb0ef41Sopenharmony_ci      (0x221A == codePoint) ||
1851cb0ef41Sopenharmony_ci      (0x221D <= codePoint && codePoint <= 0x2220) ||
1861cb0ef41Sopenharmony_ci      (0x2223 == codePoint) ||
1871cb0ef41Sopenharmony_ci      (0x2225 == codePoint) ||
1881cb0ef41Sopenharmony_ci      (0x2227 <= codePoint && codePoint <= 0x222C) ||
1891cb0ef41Sopenharmony_ci      (0x222E == codePoint) ||
1901cb0ef41Sopenharmony_ci      (0x2234 <= codePoint && codePoint <= 0x2237) ||
1911cb0ef41Sopenharmony_ci      (0x223C <= codePoint && codePoint <= 0x223D) ||
1921cb0ef41Sopenharmony_ci      (0x2248 == codePoint) ||
1931cb0ef41Sopenharmony_ci      (0x224C == codePoint) ||
1941cb0ef41Sopenharmony_ci      (0x2252 == codePoint) ||
1951cb0ef41Sopenharmony_ci      (0x2260 <= codePoint && codePoint <= 0x2261) ||
1961cb0ef41Sopenharmony_ci      (0x2264 <= codePoint && codePoint <= 0x2267) ||
1971cb0ef41Sopenharmony_ci      (0x226A <= codePoint && codePoint <= 0x226B) ||
1981cb0ef41Sopenharmony_ci      (0x226E <= codePoint && codePoint <= 0x226F) ||
1991cb0ef41Sopenharmony_ci      (0x2282 <= codePoint && codePoint <= 0x2283) ||
2001cb0ef41Sopenharmony_ci      (0x2286 <= codePoint && codePoint <= 0x2287) ||
2011cb0ef41Sopenharmony_ci      (0x2295 == codePoint) ||
2021cb0ef41Sopenharmony_ci      (0x2299 == codePoint) ||
2031cb0ef41Sopenharmony_ci      (0x22A5 == codePoint) ||
2041cb0ef41Sopenharmony_ci      (0x22BF == codePoint) ||
2051cb0ef41Sopenharmony_ci      (0x2312 == codePoint) ||
2061cb0ef41Sopenharmony_ci      (0x2460 <= codePoint && codePoint <= 0x24E9) ||
2071cb0ef41Sopenharmony_ci      (0x24EB <= codePoint && codePoint <= 0x254B) ||
2081cb0ef41Sopenharmony_ci      (0x2550 <= codePoint && codePoint <= 0x2573) ||
2091cb0ef41Sopenharmony_ci      (0x2580 <= codePoint && codePoint <= 0x258F) ||
2101cb0ef41Sopenharmony_ci      (0x2592 <= codePoint && codePoint <= 0x2595) ||
2111cb0ef41Sopenharmony_ci      (0x25A0 <= codePoint && codePoint <= 0x25A1) ||
2121cb0ef41Sopenharmony_ci      (0x25A3 <= codePoint && codePoint <= 0x25A9) ||
2131cb0ef41Sopenharmony_ci      (0x25B2 <= codePoint && codePoint <= 0x25B3) ||
2141cb0ef41Sopenharmony_ci      (0x25B6 <= codePoint && codePoint <= 0x25B7) ||
2151cb0ef41Sopenharmony_ci      (0x25BC <= codePoint && codePoint <= 0x25BD) ||
2161cb0ef41Sopenharmony_ci      (0x25C0 <= codePoint && codePoint <= 0x25C1) ||
2171cb0ef41Sopenharmony_ci      (0x25C6 <= codePoint && codePoint <= 0x25C8) ||
2181cb0ef41Sopenharmony_ci      (0x25CB == codePoint) ||
2191cb0ef41Sopenharmony_ci      (0x25CE <= codePoint && codePoint <= 0x25D1) ||
2201cb0ef41Sopenharmony_ci      (0x25E2 <= codePoint && codePoint <= 0x25E5) ||
2211cb0ef41Sopenharmony_ci      (0x25EF == codePoint) ||
2221cb0ef41Sopenharmony_ci      (0x2605 <= codePoint && codePoint <= 0x2606) ||
2231cb0ef41Sopenharmony_ci      (0x2609 == codePoint) ||
2241cb0ef41Sopenharmony_ci      (0x260E <= codePoint && codePoint <= 0x260F) ||
2251cb0ef41Sopenharmony_ci      (0x2614 <= codePoint && codePoint <= 0x2615) ||
2261cb0ef41Sopenharmony_ci      (0x261C == codePoint) ||
2271cb0ef41Sopenharmony_ci      (0x261E == codePoint) ||
2281cb0ef41Sopenharmony_ci      (0x2640 == codePoint) ||
2291cb0ef41Sopenharmony_ci      (0x2642 == codePoint) ||
2301cb0ef41Sopenharmony_ci      (0x2660 <= codePoint && codePoint <= 0x2661) ||
2311cb0ef41Sopenharmony_ci      (0x2663 <= codePoint && codePoint <= 0x2665) ||
2321cb0ef41Sopenharmony_ci      (0x2667 <= codePoint && codePoint <= 0x266A) ||
2331cb0ef41Sopenharmony_ci      (0x266C <= codePoint && codePoint <= 0x266D) ||
2341cb0ef41Sopenharmony_ci      (0x266F == codePoint) ||
2351cb0ef41Sopenharmony_ci      (0x269E <= codePoint && codePoint <= 0x269F) ||
2361cb0ef41Sopenharmony_ci      (0x26BE <= codePoint && codePoint <= 0x26BF) ||
2371cb0ef41Sopenharmony_ci      (0x26C4 <= codePoint && codePoint <= 0x26CD) ||
2381cb0ef41Sopenharmony_ci      (0x26CF <= codePoint && codePoint <= 0x26E1) ||
2391cb0ef41Sopenharmony_ci      (0x26E3 == codePoint) ||
2401cb0ef41Sopenharmony_ci      (0x26E8 <= codePoint && codePoint <= 0x26FF) ||
2411cb0ef41Sopenharmony_ci      (0x273D == codePoint) ||
2421cb0ef41Sopenharmony_ci      (0x2757 == codePoint) ||
2431cb0ef41Sopenharmony_ci      (0x2776 <= codePoint && codePoint <= 0x277F) ||
2441cb0ef41Sopenharmony_ci      (0x2B55 <= codePoint && codePoint <= 0x2B59) ||
2451cb0ef41Sopenharmony_ci      (0x3248 <= codePoint && codePoint <= 0x324F) ||
2461cb0ef41Sopenharmony_ci      (0xE000 <= codePoint && codePoint <= 0xF8FF) ||
2471cb0ef41Sopenharmony_ci      (0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
2481cb0ef41Sopenharmony_ci      (0xFFFD == codePoint) ||
2491cb0ef41Sopenharmony_ci      (0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
2501cb0ef41Sopenharmony_ci      (0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
2511cb0ef41Sopenharmony_ci      (0x1F130 <= codePoint && codePoint <= 0x1F169) ||
2521cb0ef41Sopenharmony_ci      (0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
2531cb0ef41Sopenharmony_ci      (0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
2541cb0ef41Sopenharmony_ci      (0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
2551cb0ef41Sopenharmony_ci      (0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
2561cb0ef41Sopenharmony_ci    return 'A';
2571cb0ef41Sopenharmony_ci  }
2581cb0ef41Sopenharmony_ci
2591cb0ef41Sopenharmony_ci  return 'N';
2601cb0ef41Sopenharmony_ci};
2611cb0ef41Sopenharmony_ci
2621cb0ef41Sopenharmony_cieaw.characterLength = function(character) {
2631cb0ef41Sopenharmony_ci  var code = this.eastAsianWidth(character);
2641cb0ef41Sopenharmony_ci  if (code == 'F' || code == 'W' || code == 'A') {
2651cb0ef41Sopenharmony_ci    return 2;
2661cb0ef41Sopenharmony_ci  } else {
2671cb0ef41Sopenharmony_ci    return 1;
2681cb0ef41Sopenharmony_ci  }
2691cb0ef41Sopenharmony_ci};
2701cb0ef41Sopenharmony_ci
2711cb0ef41Sopenharmony_ci// Split a string considering surrogate-pairs.
2721cb0ef41Sopenharmony_cifunction stringToArray(string) {
2731cb0ef41Sopenharmony_ci  return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
2741cb0ef41Sopenharmony_ci}
2751cb0ef41Sopenharmony_ci
2761cb0ef41Sopenharmony_cieaw.length = function(string) {
2771cb0ef41Sopenharmony_ci  var characters = stringToArray(string);
2781cb0ef41Sopenharmony_ci  var len = 0;
2791cb0ef41Sopenharmony_ci  for (var i = 0; i < characters.length; i++) {
2801cb0ef41Sopenharmony_ci    len = len + this.characterLength(characters[i]);
2811cb0ef41Sopenharmony_ci  }
2821cb0ef41Sopenharmony_ci  return len;
2831cb0ef41Sopenharmony_ci};
2841cb0ef41Sopenharmony_ci
2851cb0ef41Sopenharmony_cieaw.slice = function(text, start, end) {
2861cb0ef41Sopenharmony_ci  textLen = eaw.length(text)
2871cb0ef41Sopenharmony_ci  start = start ? start : 0;
2881cb0ef41Sopenharmony_ci  end = end ? end : 1;
2891cb0ef41Sopenharmony_ci  if (start < 0) {
2901cb0ef41Sopenharmony_ci      start = textLen + start;
2911cb0ef41Sopenharmony_ci  }
2921cb0ef41Sopenharmony_ci  if (end < 0) {
2931cb0ef41Sopenharmony_ci      end = textLen + end;
2941cb0ef41Sopenharmony_ci  }
2951cb0ef41Sopenharmony_ci  var result = '';
2961cb0ef41Sopenharmony_ci  var eawLen = 0;
2971cb0ef41Sopenharmony_ci  var chars = stringToArray(text);
2981cb0ef41Sopenharmony_ci  for (var i = 0; i < chars.length; i++) {
2991cb0ef41Sopenharmony_ci    var char = chars[i];
3001cb0ef41Sopenharmony_ci    var charLen = eaw.length(char);
3011cb0ef41Sopenharmony_ci    if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
3021cb0ef41Sopenharmony_ci        if (eawLen + charLen <= end) {
3031cb0ef41Sopenharmony_ci            result += char;
3041cb0ef41Sopenharmony_ci        } else {
3051cb0ef41Sopenharmony_ci            break;
3061cb0ef41Sopenharmony_ci        }
3071cb0ef41Sopenharmony_ci    }
3081cb0ef41Sopenharmony_ci    eawLen += charLen;
3091cb0ef41Sopenharmony_ci  }
3101cb0ef41Sopenharmony_ci  return result;
3111cb0ef41Sopenharmony_ci};
312