diff --git a/assets/js/wanakana.min.js b/assets/js/wanakana.min.js index ba52891..5d415e7 100644 --- a/assets/js/wanakana.min.js +++ b/assets/js/wanakana.min.js @@ -1,2 +1,2 @@ -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).wanakana={})}(this,(function(n){"use strict";function t(n){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t(n)}function e(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==e)return;var r,o,i=[],a=!0,u=!1;try{for(e=e.call(n);!(a=(r=e.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(n){u=!0,o=n}finally{try{a||null==e.return||e.return()}finally{if(u)throw o}}return i}(n,t)||o(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(n){return function(n){if(Array.isArray(n))return i(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||o(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(n,t){if(n){if("string"==typeof n)return i(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(n,t):void 0}}function i(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(n){throw n},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){e=e.call(n)},n:function(){var n=e.next();return u=n.done,n},e:function(n){c=!0,a=n},f:function(){try{u||null==e.return||e.return()}finally{if(c)throw a}}}}function u(n){return null===n?"null":n!==Object(n)?t(n):{}.toString.call(n).slice(8,-1).toLowerCase()}function c(n){return"string"!==u(n)||!n.length}function f(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0;if(c(n))return!1;var r=n.charCodeAt(0);return t<=r&&r<=e}var s={HIRAGANA:"toHiragana",KATAKANA:"toKatakana"},l={HEPBURN:"hepburn"},v={useObsoleteKana:!1,passRomaji:!1,upcaseKatakana:!1,IMEMode:!1,convertLongVowelMark:!0,romanization:l.HEPBURN},d=12353,h=12449,g=[65377,65381],p=[[12288,12351],g,[12539,12540],[65281,65295],[65306,65311],[65339,65343],[65371,65376],[65504,65518]],y=[].concat([[12352,12447],[12448,12543],g,[65382,65439]],p,[[65313,65338],[65345,65370],[65296,65305],[19968,40959],[13312,19903]]),m=[[0,127]].concat([[256,257],[274,275],[298,299],[332,333],[362,363]]),b=[[32,47],[58,63],[91,96],[123,126]].concat([[8216,8217],[8220,8221]]);function j(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return y.some((function(t){var r=e(t,2),o=r[0],i=r[1];return f(n,o,i)}))}function O(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,e="regexp"===u(t);return!c(n)&&r(n).every((function(n){var r=j(n);return e?r||t.test(n):r}))}var E=Number.isNaN||function(n){return"number"==typeof n&&n!=n};function w(n,t){if(n.length!==t.length)return!1;for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},v,n)};function C(n,t,e){var r=t;function o(n,t){var e=n.charAt(0);return i(Object.assign({"":e},r[e]),n.slice(1),t,t+1)}function i(n,t,r,a){if(!t)return e||1===Object.keys(n).length?n[""]?[[r,a,n[""]]]:[]:[[r,a,null]];if(1===Object.keys(n).length)return[[r,a,n[""]]].concat(o(t,a));var u=function(n,t){if(void 0!==n[t])return Object.assign({"":n[""]+t},n[t])}(n,t.charAt(0));return void 0===u?[[r,a,n[""]]].concat(o(t,a)):i(u,t.slice(1),r,a+1)}return o(n,0)}function R(n){return Object.entries(n).reduce((function(n,t){var r=e(t,2),o=r[0],i=r[1],a="string"===u(i);return n[o]=a?{"":i}:R(i),n}),{})}function I(n,t){return t.split("").reduce((function(n,t){return void 0===n[t]&&(n[t]={}),n[t]}),n)}function K(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return"object"===u(n)&&Object.entries(n).forEach((function(n){var r=e(n,2),o=r[0],i=r[1],a=t;o.split("").forEach((function(n){void 0===a[n]&&(a[n]={}),a=a[n]})),a[""]=i})),function(n){return function n(t,r){return void 0===t||"string"===u(t)?r:Object.entries(r).reduce((function(r,o){var i=e(o,2),a=i[0],u=i[1];return r[a]=n(t[a],u),r}),t)}(JSON.parse(JSON.stringify(n)),t)}}function z(n,t){return t?"function"===u(t)?t(n):K(t)(n):n}var L={a:"あ",i:"い",u:"う",e:"え",o:"お",k:{a:"か",i:"き",u:"く",e:"け",o:"こ"},s:{a:"さ",i:"し",u:"す",e:"せ",o:"そ"},t:{a:"た",i:"ち",u:"つ",e:"て",o:"と"},n:{a:"な",i:"に",u:"ぬ",e:"ね",o:"の"},h:{a:"は",i:"ひ",u:"ふ",e:"へ",o:"ほ"},m:{a:"ま",i:"み",u:"む",e:"め",o:"も"},y:{a:"や",u:"ゆ",o:"よ"},r:{a:"ら",i:"り",u:"る",e:"れ",o:"ろ"},w:{a:"わ",i:"ゐ",e:"ゑ",o:"を"},g:{a:"が",i:"ぎ",u:"ぐ",e:"げ",o:"ご"},z:{a:"ざ",i:"じ",u:"ず",e:"ぜ",o:"ぞ"},d:{a:"だ",i:"ぢ",u:"づ",e:"で",o:"ど"},b:{a:"ば",i:"び",u:"ぶ",e:"べ",o:"ぼ"},p:{a:"ぱ",i:"ぴ",u:"ぷ",e:"ぺ",o:"ぽ"},v:{a:"ゔぁ",i:"ゔぃ",u:"ゔ",e:"ゔぇ",o:"ゔぉ"}},T={".":"。",",":"、",":":":","/":"・","!":"!","?":"?","~":"〜","-":"ー","‘":"「","’":"」","“":"『","”":"』","[":"[","]":"]","(":"(",")":")","{":"{","}":"}"},J={k:"き",s:"し",t:"ち",n:"に",h:"ひ",m:"み",r:"り",g:"ぎ",z:"じ",d:"ぢ",b:"び",p:"ぴ",v:"ゔ",q:"く",f:"ふ"},x={ya:"ゃ",yi:"ぃ",yu:"ゅ",ye:"ぇ",yo:"ょ"},H={a:"ぁ",i:"ぃ",u:"ぅ",e:"ぇ",o:"ぉ"},U={sh:"sy",ch:"ty",cy:"ty",chy:"ty",shy:"sy",j:"zy",jy:"zy",shi:"si",chi:"ti",tsu:"tu",ji:"zi",fu:"hu"},P=Object.assign({tu:"っ",wa:"ゎ",ka:"ヵ",ke:"ヶ"},H,x),D={yi:"い",wu:"う",ye:"いぇ",wi:"うぃ",we:"うぇ",kwa:"くぁ",whu:"う",tha:"てゃ",thu:"てゅ",tho:"てょ",dha:"でゃ",dhu:"でゅ",dho:"でょ"},q={wh:"う",kw:"く",qw:"く",q:"く",gw:"ぐ",sw:"す",ts:"つ",th:"て",tw:"と",dh:"で",dw:"ど",fw:"ふ",f:"ふ"};function B(){var n=R(L),t=function(t){return I(n,t)};function o(n){return Object.entries(n).reduce((function(n,t){var r=e(t,2),i=r[0],a=r[1];return n[i]=i?o(a):"っ".concat(a),n}),{})}return Object.entries(J).forEach((function(n){var r=e(n,2),o=r[0],i=r[1];Object.entries(x).forEach((function(n){var r=e(n,2),a=r[0],u=r[1];t(o+a)[""]=i+u}))})),Object.entries(T).forEach((function(n){var r=e(n,2),o=r[0],i=r[1];t(o)[""]=i})),Object.entries(q).forEach((function(n){var r=e(n,2),o=r[0],i=r[1];Object.entries(H).forEach((function(n){var r=e(n,2),a=r[0],u=r[1];t(o+a)[""]=i+u}))})),["n","n'","xn"].forEach((function(n){t(n)[""]="ん"})),n.c=JSON.parse(JSON.stringify(n.k)),Object.entries(U).forEach((function(n){var r=e(n,2),o=r[0],i=r[1],a=o.slice(0,o.length-1),u=o.charAt(o.length-1);t(a)[u]=JSON.parse(JSON.stringify(t(i)))})),Object.entries(P).forEach((function(n){var o,i=e(n,2),a=i[0],u=i[1],c=function(n){return n.charAt(n.length-1)},f=function(n){return n.slice(0,n.length-1)},s="x".concat(a),l=t(s);l[""]=u,t("l".concat(f(a)))[c(a)]=l,(o=a,[].concat(r(Object.entries(U)),[["c","k"]]).reduce((function(n,t){var r=e(t,2),i=r[0],a=r[1];return o.startsWith(a)?n.concat(o.replace(a,i)):n}),[])).forEach((function(n){["l","x"].forEach((function(e){t(e+f(n))[c(n)]=t(e+a)}))}))})),Object.entries(D).forEach((function(n){var r=e(n,2),o=r[0],i=r[1];t(o)[""]=i})),[].concat(r(Object.keys(J)),["c","y","w","j"]).forEach((function(t){var e=n[t];e[t]=o(e)})),delete n.n.n,Object.freeze(JSON.parse(JSON.stringify(n)))}var V=null;var W=K({wi:"ゐ",we:"ゑ"});function G(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&f(n,65,90)}function $(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&12540===n.charCodeAt(0)}function _(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&12539===n.charCodeAt(0)}function X(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&(!!$(n)||f(n,d,12438))}function Z(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];return n.split("").forEach((function(n){if($(n)||_(n))t.push(n);else if(X(n)){var e=n.charCodeAt(0)+96,r=String.fromCharCode(e);t.push(r)}else t.push(n)})),t.join("")}var F=A((function(n,t,e){var r=(null==V&&(V=B()),V);return r=n?function(n){var t=JSON.parse(JSON.stringify(n));return t.n.n={"":"ん"},t.n[" "]={"":"ん"},t}(r):r,r=t?W(r):r,e&&(r=z(r,e)),r}),N);function Q(){var n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return i?n=o:(n=M(o),i=F(n.IMEMode,n.useObsoleteKana,n.customKanaMapping)),Y(t,n,i).map((function(o){var i=e(o,3),a=i[0],u=i[1],c=i[2];if(null===c)return t.slice(a);var f=n.IMEMode===s.HIRAGANA,l=n.IMEMode===s.KATAKANA||r(t.slice(a,u)).every(G);return f||!l?c:Z(c)})).join("")}function Y(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2?arguments[2]:void 0,r=t.IMEMode,o=t.useObsoleteKana,i=t.customKanaMapping;return e||(e=F(r,o,i)),C(n.toLowerCase(),e,!r)}var nn=[];function tn(n){var t=Object.assign({},M(n),{IMEMode:n.IMEMode||!0}),o=F(t.IMEMode,t.useObsoleteKana,t.customKanaMapping),i=[].concat(r(Object.keys(o)),r(Object.keys(o).map((function(n){return n.toUpperCase()}))));return function(n){var r=n.target;undefined!==r.value&&"true"!==r.dataset.ignoreComposition&&function(n,t,r,o,i){var a=e(function(){var n,t,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(0===i&&a.includes(o[0])){var u=e(un(o,a),3);n=u[0],t=u[1],r=u[2]}else if(i>0){var c=e(cn(o,i),3);n=c[0],t=c[1],r=c[2]}else{var f=e(fn(o,(function(n){return!a.includes(n)})),2);n=f[0];var s=e(fn(t=f[1],(function(n){return!O(n)})),2);t=s[0],r=s[1]}return[n,t,r]}(n.value,n.selectionEnd,o),3),u=a[0],c=a[1],f=a[2],s=Q(c,t,r);if(c!==s){var l=u.length+s.length,v=u+s+f;n.value=v,f.length?setTimeout((function(){return n.setSelectionRange(l,l)}),1):n.setSelectionRange(l,l)}}(r,t,o,i)}}function en(n){var t=n.type,e=n.target,r=n.data;/Mac/.test(window.navigator&&window.navigator.platform)&&("compositionupdate"===t&&O(r)&&(e.dataset.ignoreComposition="true"),"compositionend"===t&&(e.dataset.ignoreComposition="false"))}function rn(n,t,e){nn=nn.concat({id:n,inputHandler:t,compositionHandler:e})}function on(n){var t=n.id;nn=nn.filter((function(n){return n.id!==t}))}function an(n){return n&&nn.find((function(t){return t.id===n.getAttribute("data-wanakana-id")}))}function un(n,t){return[""].concat(r(fn(n,(function(n){return t.includes(n)||!O(n,/[0-9]/)}))))}function cn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=fn(r(n.slice(0,t)).reverse(),(function(n){return!O(n)})),i=e(o,2),a=i[0],u=i[1];return[u.reverse().join(""),a.split("").reverse().join(""),n.slice(t)]}function fn(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(n){return!!n},e=[],r=n.length,o=0;o0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&m.some((function(t){var r=e(t,2),o=r[0],i=r[1];return f(n,o,i)}))}function yn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,e="regexp"===u(t);return!c(n)&&r(n).every((function(n){var r=pn(n);return e?r||t.test(n):r}))}function mn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return f(n,h,12540)}function bn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&(X(n)||mn(n))}function jn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&r(n).every(bn)}function On(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&r(n).every(X)}function En(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&r(n).every(mn)}function wn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&12293===n.charCodeAt(0)}function An(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return f(n,19968,40879)||wn(n)}function Sn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&r(n).every(An)}function kn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{passKanji:!0},e=r(n),o=!1;return t.passKanji||(o=e.some(Sn)),(e.some(On)||e.some(En))&&e.some(yn)&&!o}var Nn=function(n,t){return $(n)&&t<1},Mn=function(n,t){return $(n)&&t>0},Cn=function(n){return["ヶ","ヵ"].includes(n)},Rn={a:"あ",i:"い",u:"う",e:"え",o:"う"};function In(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.isDestinationRomaji,o=e.convertLongVowelMark,i="";return n.split("").reduce((function(e,a,u){if(_(a)||Nn(a,u)||Cn(a))return e.concat(a);if(o&&i&&Mn(a,u)){var c=t(i).slice(-1);return mn(n[u-1])&&"o"===c&&r?e.concat("お"):e.concat(Rn[c])}if(!$(a)&&mn(a)){var f=a.charCodeAt(0)+-96,s=String.fromCharCode(f);return i=s,e.concat(s)}return i="",e.concat(a)}),[]).join("")}var Kn=null,zn={"あ":"a","い":"i","う":"u","え":"e","お":"o","か":"ka","き":"ki","く":"ku","け":"ke","こ":"ko","さ":"sa","し":"shi","す":"su","せ":"se","そ":"so","た":"ta","ち":"chi","つ":"tsu","て":"te","と":"to","な":"na","に":"ni","ぬ":"nu","ね":"ne","の":"no","は":"ha","ひ":"hi","ふ":"fu","へ":"he","ほ":"ho","ま":"ma","み":"mi","む":"mu","め":"me","も":"mo","ら":"ra","り":"ri","る":"ru","れ":"re","ろ":"ro","や":"ya","ゆ":"yu","よ":"yo","わ":"wa","ゐ":"wi","ゑ":"we","を":"wo","ん":"n","が":"ga","ぎ":"gi","ぐ":"gu","げ":"ge","ご":"go","ざ":"za","じ":"ji","ず":"zu","ぜ":"ze","ぞ":"zo","だ":"da","ぢ":"ji","づ":"zu","で":"de","ど":"do","ば":"ba","び":"bi","ぶ":"bu","べ":"be","ぼ":"bo","ぱ":"pa","ぴ":"pi","ぷ":"pu","ぺ":"pe","ぽ":"po","ゔぁ":"va","ゔぃ":"vi","ゔ":"vu","ゔぇ":"ve","ゔぉ":"vo"},Ln={"。":".","、":",",":":":","・":"/","!":"!","?":"?","〜":"~","ー":"-","「":"‘","」":"’","『":"“","』":"”","[":"[","]":"]","(":"(",")":")","{":"{","}":"}"," ":" "},Tn=["あ","い","う","え","お","や","ゆ","よ"],Jn={"ゃ":"ya","ゅ":"yu","ょ":"yo"},xn={"ぃ":"yi","ぇ":"ye"},Hn={"ぁ":"a","ぃ":"i","ぅ":"u","ぇ":"e","ぉ":"o"},Un=["き","に","ひ","み","り","ぎ","び","ぴ","ゔ","く","ふ"],Pn={"し":"sh","ち":"ch","じ":"j","ぢ":"j"},Dn={"っ":"","ゃ":"ya","ゅ":"yu","ょ":"yo","ぁ":"a","ぃ":"i","ぅ":"u","ぇ":"e","ぉ":"o"},qn={b:"b",c:"t",d:"d",f:"f",g:"g",h:"h",j:"j",k:"k",m:"m",p:"p",q:"q",r:"r",s:"s",t:"t",v:"v",w:"w",x:"x",z:"z"};function Bn(){var n,t,o;return null==Kn&&(n=R(zn),t=function(t){return I(n,t)},o=function(n,e){t(n)[""]=e},Object.entries(Ln).forEach((function(n){var r=e(n,2),o=r[0],i=r[1];t(o)[""]=i})),[].concat(r(Object.entries(Jn)),r(Object.entries(Hn))).forEach((function(n){var t=e(n,2),r=t[0],i=t[1];o(r,i)})),Un.forEach((function(n){var r=t(n)[""][0];Object.entries(Jn).forEach((function(t){var i=e(t,2),a=i[0],u=i[1];o(n+a,r+u)})),Object.entries(xn).forEach((function(t){var i=e(t,2),a=i[0],u=i[1];o(n+a,r+u)}))})),Object.entries(Pn).forEach((function(n){var t=e(n,2),r=t[0],i=t[1];Object.entries(Jn).forEach((function(n){var t=e(n,2),a=t[0],u=t[1];o(r+a,i+u[1])})),o("".concat(r,"ぃ"),"".concat(i,"yi")),o("".concat(r,"ぇ"),"".concat(i,"e"))})),n["っ"]=Vn(n),Object.entries(Dn).forEach((function(n){var t=e(n,2),r=t[0],i=t[1];o(r,i)})),Tn.forEach((function(n){o("ん".concat(n),"n'".concat(t(n)[""]))})),Kn=Object.freeze(JSON.parse(JSON.stringify(n)))),Kn}function Vn(n){return Object.entries(n).reduce((function(n,t){var r=e(t,2),o=r[0],i=r[1];if(o)n[o]=Vn(i);else{var a=i.charAt(0);n[o]=Object.keys(qn).includes(a)?qn[a]+i:i}return n}),{})}var Wn=A((function(n,t){var e=function(n){return n===l.HEPBURN?Bn():{}}(n);return t&&(e=z(e,t)),e}),N);function Gn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=M(t);return r||(r=Wn(o.romanization,o.customRomajiMapping)),$n(n,o,r).map((function(t){var r=e(t,3),i=r[0],a=r[1],u=r[2];return o.upcaseKatakana&&En(n.slice(i,a))?u.toUpperCase():u})).join("")}function $n(n,t,e){return e||(e=Wn(t.romanization,t.customRomajiMapping)),C(In(n,Gn,Object.assign({},{isDestinationRomaji:!0},t)),e,!t.IMEMode)}function _n(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&b.some((function(t){var r=e(t,2),o=r[0],i=r[1];return f(n,o,i)}))}function Xn(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!c(n)&&!wn(n)&&p.some((function(t){var r=e(t,2),o=r[0],i=r[1];return f(n,o,i)}))}var Zn=function(n){return" "===n},Fn=function(n){return" "===n},Qn=function(n){return/[0-9]/.test(n)},Yn=function(n){return/[0-9]/.test(n)},nt="en",tt="ja",et="englishNumeral",rt="japaneseNumeral",ot="englishPunctuation",it="japanesePunctuation",at="kanji",ut="hiragana",ct="katakana",ft="space",st="other";function lt(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=nt,r=tt,o=et,i=rt,a=ot,u=it,c=at,f=ut,s=ct,l=ft,v=st;if(t)switch(!0){case Qn(n):case Yn(n):return v;case Zn(n):return e;case _n(n):return v;case Fn(n):return r;case Xn(n):return v;case j(n):return r;case pn(n):return e;default:return v}else switch(!0){case Fn(n):case Zn(n):return l;case Qn(n):return i;case Yn(n):return o;case _n(n):return a;case Xn(n):return u;case An(n):return c;case X(n):return f;case mn(n):return s;case j(n):return r;case pn(n):return e;default:return v}}function vt(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.compact,o=void 0!==e&&e,i=t.detailed,a=void 0!==i&&i;if(null==n||c(n))return[];var u=r(n),f=u.shift(),s=lt(f,o);f=a?{type:s,value:f}:f;var l=u.reduce((function(n,t){var e=lt(t,o),r=e===s;s=e;var i=t;return r&&(i=(a?n.pop().value:n.pop())+i),a?n.concat({type:e,value:i}):n.concat(i)}),[f]);return l}var dt=function(n,t){return t&&!jn(n[0])},ht=function(n,t){return!t&&!jn(n[n.length-1])},gt=function(n,t){return t&&!r(t).some(Sn)||!t&&jn(n)};n.ROMANIZATIONS=l,n.TO_KANA_METHODS=s,n.VERSION="5.2.0",n.bind=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!dn.includes(n.nodeName))throw new Error("Element provided to Wanakana bind() was not a valid input or textarea element.\n Received: (".concat(JSON.stringify(n),")"));if(!n.hasAttribute("data-wanakana-id")){var r=tn(t),o=gn(),i=[{name:"data-wanakana-id",value:o},{name:"lang",value:"ja"},{name:"autoCapitalize",value:"none"},{name:"autoCorrect",value:"off"},{name:"autoComplete",value:"off"},{name:"spellCheck",value:"false"}],a={};i.forEach((function(t){a[t.name]=n.getAttribute(t.name),n.setAttribute(t.name,t.value)})),n.dataset.previousAttributes=JSON.stringify(a),n.addEventListener("input",r),n.addEventListener("compositionupdate",en),n.addEventListener("compositionend",en),rn(o,r,en),!0===e&&ln(n)}},n.isHiragana=On,n.isJapanese=O,n.isKana=jn,n.isKanji=Sn,n.isKatakana=En,n.isMixed=kn,n.isRomaji=yn,n.stripOkurigana=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.leading,r=void 0!==e&&e,o=t.matchKanji,i=void 0===o?"":o;if(!O(n)||dt(n,r)||ht(n,r)||gt(n,i))return n;var a=i||n,u=new RegExp(r?"^".concat(vt(a).shift()):"".concat(vt(a).pop(),"$"));return n.replace(u,"")},n.toHiragana=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=M(t);if(e.passRomaji)return In(n,Gn,e);if(kn(n,{passKanji:!0})){var r=In(n,Gn,e);return Q(r.toLowerCase(),e)}return yn(n)||_n(n)?Q(n.toLowerCase(),e):In(n,Gn,e)},n.toKana=Q,n.toKatakana=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=M(t);if(e.passRomaji)return Z(n);if(kn(n)||yn(n)||_n(n)){var r=Q(n.toLowerCase(),e);return Z(r)}return Z(n)},n.toRomaji=Gn,n.tokenize=vt,n.unbind=function(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=an(n);if(null==e)throw new Error("Element provided to Wanakana unbind() had no listener registered.\n Received: ".concat(JSON.stringify(n)));var r=e.inputHandler,o=e.compositionHandler,i=JSON.parse(n.dataset.previousAttributes);Object.keys(i).forEach((function(t){i[t]?n.setAttribute(t,i[t]):n.removeAttribute(t)})),n.removeAttribute("data-previous-attributes"),n.removeAttribute("data-ignore-composition"),n.removeEventListener("input",r),n.removeEventListener("compositionstart",o),n.removeEventListener("compositionupdate",o),n.removeEventListener("compositionend",o),on(e),!0===t&&vn(n)}})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).wanakana={})}(this,(function(e){"use strict";function t(e){return null===e?"null":e!==Object(e)?typeof e:{}.toString.call(e).slice(8,-1).toLowerCase()}function n(e){return"string"!==t(e)||!e.length}function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;if(n(e))return!1;const o=e.charCodeAt(0);return t<=o&&o<=r}const o={HIRAGANA:"toHiragana",KATAKANA:"toKatakana"},i={HEPBURN:"hepburn"},a={useObsoleteKana:!1,passRomaji:!1,convertLongVowelMark:!0,upcaseKatakana:!1,IMEMode:!1,romanization:i.HEPBURN},u=65,s=90,c=12353,l=12438,f=12449,d=12540,h=19968,g=40879,v=12293,p=12540,m=12539,b=[65313,65338],j=[65345,65370],y=[65377,65381],E=[[12288,12351],y,[12539,12540],[65281,65295],[65306,65311],[65339,65343],[65371,65376],[65504,65518]],A=[...[[12352,12447],[12448,12543],y,[65382,65439]],...E,b,j,[65296,65305],[19968,40959],[13312,19903]],O=[[0,127],[256,257],[274,275],[298,299],[332,333],[362,363]],N=[[32,47],[58,63],[91,96],[123,126],[8216,8217],[8220,8221]];function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return A.some((t=>{let[n,o]=t;return r(e,n,o)}))}function k(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;const o="regexp"===t(r);return!n(e)&&[...e].every((e=>{const t=w(e);return o?t||r.test(e):t}))}var M=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function S(e,t){if(e.length!==t.length)return!1;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},a,e)};function I(e,t,n){const r=t;function o(e,t){const n=e.charAt(0);return i(Object.assign({"":n},r[n]),e.slice(1),t,t+1)}function i(e,t,r,a){if(!t)return n||1===Object.keys(e).length?e[""]?[[r,a,e[""]]]:[]:[[r,a,null]];if(1===Object.keys(e).length)return[[r,a,e[""]]].concat(o(t,a));const u=function(e,t){if(void 0!==e[t])return Object.assign({"":e[""]+t},e[t])}(e,t.charAt(0));return void 0===u?[[r,a,e[""]]].concat(o(t,a)):i(u,t.slice(1),r,a+1)}return o(e,0)}function L(e){return Object.entries(e).reduce(((e,n)=>{let[r,o]=n;const i="string"===t(o);return e[r]=i?{"":o}:L(o),e}),{})}function T(e,t){return t.split("").reduce(((e,t)=>(void 0===e[t]&&(e[t]={}),e[t])),e)}function H(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n={};return"object"===t(e)&&Object.entries(e).forEach((e=>{let[t,r]=e,o=n;t.split("").forEach((e=>{void 0===o[e]&&(o[e]={}),o=o[e]})),o[""]=r})),function(e){return function e(n,r){return void 0===n||"string"===t(n)?r:Object.entries(r).reduce(((t,r)=>{let[o,i]=r;return t[o]=e(n[o],i),t}),n)}(JSON.parse(JSON.stringify(e)),n)}}function U(e,n){return n?"function"===t(n)?n(e):H(n)(e):e}const $={a:"あ",i:"い",u:"う",e:"え",o:"お",k:{a:"か",i:"き",u:"く",e:"け",o:"こ"},s:{a:"さ",i:"し",u:"す",e:"せ",o:"そ"},t:{a:"た",i:"ち",u:"つ",e:"て",o:"と"},n:{a:"な",i:"に",u:"ぬ",e:"ね",o:"の"},h:{a:"は",i:"ひ",u:"ふ",e:"へ",o:"ほ"},m:{a:"ま",i:"み",u:"む",e:"め",o:"も"},y:{a:"や",u:"ゆ",o:"よ"},r:{a:"ら",i:"り",u:"る",e:"れ",o:"ろ"},w:{a:"わ",i:"ゐ",e:"ゑ",o:"を"},g:{a:"が",i:"ぎ",u:"ぐ",e:"げ",o:"ご"},z:{a:"ざ",i:"じ",u:"ず",e:"ぜ",o:"ぞ"},d:{a:"だ",i:"ぢ",u:"づ",e:"で",o:"ど"},b:{a:"ば",i:"び",u:"ぶ",e:"べ",o:"ぼ"},p:{a:"ぱ",i:"ぴ",u:"ぷ",e:"ぺ",o:"ぽ"},v:{a:"ゔぁ",i:"ゔぃ",u:"ゔ",e:"ゔぇ",o:"ゔぉ"}},x={".":"。",",":"、",":":":","/":"・","!":"!","?":"?","~":"〜","-":"ー","‘":"「","’":"」","“":"『","”":"』","[":"[","]":"]","(":"(",")":")","{":"{","}":"}"},P={k:"き",s:"し",t:"ち",n:"に",h:"ひ",m:"み",r:"り",g:"ぎ",z:"じ",d:"ぢ",b:"び",p:"ぴ",v:"ゔ",q:"く",f:"ふ"},_={ya:"ゃ",yi:"ぃ",yu:"ゅ",ye:"ぇ",yo:"ょ"},D={a:"ぁ",i:"ぃ",u:"ぅ",e:"ぇ",o:"ぉ"},q={sh:"sy",ch:"ty",cy:"ty",chy:"ty",shy:"sy",j:"zy",jy:"zy",shi:"si",chi:"ti",tsu:"tu",ji:"zi",fu:"hu"},B=Object.assign({tu:"っ",wa:"ゎ",ka:"ヵ",ke:"ヶ"},D,_),V={yi:"い",wu:"う",ye:"いぇ",wi:"うぃ",we:"うぇ",kwa:"くぁ",whu:"う",tha:"てゃ",thu:"てゅ",tho:"てょ",dha:"でゃ",dhu:"でゅ",dho:"でょ"},G={wh:"う",kw:"く",qw:"く",q:"く",gw:"ぐ",sw:"す",ts:"つ",th:"て",tw:"と",dh:"で",dw:"ど",fw:"ふ",f:"ふ"};function W(){const e=L($),t=t=>T(e,t);function n(e){return Object.entries(e).reduce(((e,t)=>{let[r,o]=t;return e[r]=r?n(o):`っ${o}`,e}),{})}return Object.entries(P).forEach((e=>{let[n,r]=e;Object.entries(_).forEach((e=>{let[o,i]=e;t(n+o)[""]=r+i}))})),Object.entries(x).forEach((e=>{let[n,r]=e;t(n)[""]=r})),Object.entries(G).forEach((e=>{let[n,r]=e;Object.entries(D).forEach((e=>{let[o,i]=e;t(n+o)[""]=r+i}))})),["n","n'","xn"].forEach((e=>{t(e)[""]="ん"})),e.c=JSON.parse(JSON.stringify(e.k)),Object.entries(q).forEach((e=>{let[n,r]=e;const o=n.slice(0,n.length-1),i=n.charAt(n.length-1);t(o)[i]=JSON.parse(JSON.stringify(t(r)))})),Object.entries(B).forEach((e=>{let[n,r]=e;const o=e=>e.charAt(e.length-1),i=e=>e.slice(0,e.length-1),a=t(`x${n}`);a[""]=r;var u;t(`l${i(n)}`)[o(n)]=a,(u=n,[...Object.entries(q),["c","k"]].reduce(((e,t)=>{let[n,r]=t;return u.startsWith(r)?e.concat(u.replace(r,n)):e}),[])).forEach((e=>{["l","x"].forEach((r=>{t(r+i(e))[o(e)]=t(r+n)}))}))})),Object.entries(V).forEach((e=>{let[n,r]=e;t(n)[""]=r})),[...Object.keys(P),"c","y","w","j"].forEach((t=>{const r=e[t];r[t]=n(r)})),delete e.n.n,Object.freeze(JSON.parse(JSON.stringify(e)))}let X=null;const Z=H({wi:"ゐ",we:"ゑ"});function F(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&r(e,u,s)}function Q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===p}function Y(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===m}function ee(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(!!Q(e)||r(e,c,l))}function te(){const e=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split("").forEach((t=>{if(Q(t)||Y(t))e.push(t);else if(ee(t)){const n=t.charCodeAt(0)+(f-c),r=String.fromCharCode(n);e.push(r)}else e.push(t)})),e.join("")}const ne=C(((e,t,n)=>{let r=(null==X&&(X=W()),X);return r=e?function(e){const t=JSON.parse(JSON.stringify(e));return t.n.n={"":"ん"},t.n[" "]={"":"ん"},t}(r):r,r=t?Z(r):r,n&&(r=U(r,n)),r}),J);function re(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return r?e=n:(e=z(n),r=ne(e.IMEMode,e.useObsoleteKana,e.customKanaMapping)),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const{IMEMode:r,useObsoleteKana:o,customKanaMapping:i}=t;n||(n=ne(r,o,i));return I(e.toLowerCase(),n,!r)}(t,e,r).map((n=>{const[r,i,a]=n;if(null===a)return t.slice(r);const u=e.IMEMode===o.HIRAGANA,s=e.IMEMode===o.KATAKANA||[...t.slice(r,i)].every(F);return u||!s?a:te(a)})).join("")}let oe=[];function ie(e){const t=Object.assign({},z(e),{IMEMode:e.IMEMode||!0}),n=ne(t.IMEMode,t.useObsoleteKana,t.customKanaMapping),r=[...Object.keys(n),...Object.keys(n).map((e=>e.toUpperCase()))];return function(e){let{target:o}=e;undefined!==o.value&&"true"!==o.dataset.ignoreComposition&&function(e,t,n,r,o){const[i,a,u]=function(){let e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];0===o&&i.includes(r[0])?[e,t,n]=function(e,t){return["",...ue(e,(e=>t.includes(e)||!k(e,/[0-9]/)))]}(r,i):o>0?[e,t,n]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const[n,r]=ue([...e.slice(0,t)].reverse(),(e=>!k(e)));return[r.reverse().join(""),n.split("").reverse().join(""),e.slice(t)]}(r,o):([e,t]=ue(r,(e=>!i.includes(e))),[t,n]=ue(t,(e=>!k(e))));return[e,t,n]}(e.value,e.selectionEnd,r),s=re(a,t,n);if(a!==s){const t=i.length+s.length,n=i+s+u;e.value=n,u.length?setTimeout((()=>e.setSelectionRange(t,t)),1):e.setSelectionRange(t,t)}else e.value}(o,t,n,r)}}function ae(e){let{type:t,target:n,data:r}=e;/Mac/.test(window.navigator&&window.navigator.platform)&&("compositionupdate"===t&&k(r)&&(n.dataset.ignoreComposition="true"),"compositionend"===t&&(n.dataset.ignoreComposition="false"))}function ue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>!!e;const n=[],{length:r}=e;let o=0;for(;o{let{target:{value:t,selectionStart:n,selectionEnd:r}}=e;return console.log("input:",{value:t,selectionStart:n,selectionEnd:r})},compositionstart:()=>console.log("compositionstart"),compositionupdate:e=>{let{target:{value:t,selectionStart:n,selectionEnd:r},data:o}=e;return console.log("compositionupdate",{data:o,value:t,selectionStart:n,selectionEnd:r})},compositionend:()=>console.log("compositionend")},ce=["TEXTAREA","INPUT"];let le=0;function fe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&O.some((t=>{let[n,o]=t;return r(e,n,o)}))}function de(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;const o="regexp"===t(r);return!n(e)&&[...e].every((e=>{const t=fe(e);return o?t||r.test(e):t}))}function he(){return r(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",f,d)}function ge(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&(ee(e)||he(e))}function ve(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[...e].every(ge)}function pe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[...e].every(ee)}function me(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[...e].every(he)}function be(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&e.charCodeAt(0)===v}function je(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r(e,h,g)||be(e)}function ye(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&[...e].every(je)}function Ee(){const e=[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:""];let t=!1;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{passKanji:!0}).passKanji||(t=e.some(ye)),(e.some(pe)||e.some(me))&&e.some(de)&&!t}const Ae=(e,t)=>Q(e)&&t<1,Oe=(e,t)=>Q(e)&&t>0,Ne=e=>["ヶ","ヵ"].includes(e),we={a:"あ",i:"い",u:"う",e:"え",o:"う"};function ke(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,{isDestinationRomaji:n,convertLongVowelMark:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o="";return e.split("").reduce(((i,a,u)=>{if(Y(a)||Ae(a,u)||Ne(a))return i.concat(a);if(r&&o&&Oe(a,u)){const r=t(o).slice(-1);return he(e[u-1])&&"o"===r&&n?i.concat("お"):i.concat(we[r])}if(!Q(a)&&he(a)){const e=a.charCodeAt(0)+(c-f),t=String.fromCharCode(e);return o=t,i.concat(t)}return o="",i.concat(a)}),[]).join("")}let Me=null;const Se={"あ":"a","い":"i","う":"u","え":"e","お":"o","か":"ka","き":"ki","く":"ku","け":"ke","こ":"ko","さ":"sa","し":"shi","す":"su","せ":"se","そ":"so","た":"ta","ち":"chi","つ":"tsu","て":"te","と":"to","な":"na","に":"ni","ぬ":"nu","ね":"ne","の":"no","は":"ha","ひ":"hi","ふ":"fu","へ":"he","ほ":"ho","ま":"ma","み":"mi","む":"mu","め":"me","も":"mo","ら":"ra","り":"ri","る":"ru","れ":"re","ろ":"ro","や":"ya","ゆ":"yu","よ":"yo","わ":"wa","ゐ":"wi","ゑ":"we","を":"wo","ん":"n","が":"ga","ぎ":"gi","ぐ":"gu","げ":"ge","ご":"go","ざ":"za","じ":"ji","ず":"zu","ぜ":"ze","ぞ":"zo","だ":"da","ぢ":"ji","づ":"zu","で":"de","ど":"do","ば":"ba","び":"bi","ぶ":"bu","べ":"be","ぼ":"bo","ぱ":"pa","ぴ":"pi","ぷ":"pu","ぺ":"pe","ぽ":"po","ゔぁ":"va","ゔぃ":"vi","ゔ":"vu","ゔぇ":"ve","ゔぉ":"vo"},Ce={"。":".","、":",",":":":","・":"/","!":"!","?":"?","〜":"~","ー":"-","「":"‘","」":"’","『":"“","』":"”","[":"[","]":"]","(":"(",")":")","{":"{","}":"}"," ":" "},Ke=["あ","い","う","え","お","や","ゆ","よ"],Re={"ゃ":"ya","ゅ":"yu","ょ":"yo"},Je={"ぃ":"yi","ぇ":"ye"},ze={"ぁ":"a","ぃ":"i","ぅ":"u","ぇ":"e","ぉ":"o"},Ie=["き","に","ひ","み","り","ぎ","び","ぴ","ゔ","く","ふ"],Le={"し":"sh","ち":"ch","じ":"j","ぢ":"j"},Te={"っ":"","ゃ":"ya","ゅ":"yu","ょ":"yo","ぁ":"a","ぃ":"i","ぅ":"u","ぇ":"e","ぉ":"o"},He={b:"b",c:"t",d:"d",f:"f",g:"g",h:"h",j:"j",k:"k",m:"m",p:"p",q:"q",r:"r",s:"s",t:"t",v:"v",w:"w",x:"x",z:"z"};function Ue(){return null==Me&&(Me=function(){const e=L(Se),t=t=>T(e,t),n=(e,n)=>{t(e)[""]=n};return Object.entries(Ce).forEach((e=>{let[n,r]=e;t(n)[""]=r})),[...Object.entries(Re),...Object.entries(ze)].forEach((e=>{let[t,r]=e;n(t,r)})),Ie.forEach((e=>{const r=t(e)[""][0];Object.entries(Re).forEach((t=>{let[o,i]=t;n(e+o,r+i)})),Object.entries(Je).forEach((t=>{let[o,i]=t;n(e+o,r+i)}))})),Object.entries(Le).forEach((e=>{let[t,r]=e;Object.entries(Re).forEach((e=>{let[o,i]=e;n(t+o,r+i[1])})),n(`${t}ぃ`,`${r}yi`),n(`${t}ぇ`,`${r}e`)})),e["っ"]=$e(e),Object.entries(Te).forEach((e=>{let[t,r]=e;n(t,r)})),Ke.forEach((e=>{n(`ん${e}`,`n'${t(e)[""]}`)})),Object.freeze(JSON.parse(JSON.stringify(e)))}()),Me}function $e(e){return Object.entries(e).reduce(((e,t)=>{let[n,r]=t;if(n)e[n]=$e(r);else{const t=r.charAt(0);e[n]=Object.keys(He).includes(t)?He[t]+r:r}return e}),{})}const xe=C(((e,t)=>{let n=function(e){return e===i.HEPBURN?Ue():{}}(e);return t&&(n=U(n,t)),n}),J);function Pe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>2?arguments[2]:void 0;const n=z(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return t||(t=xe(n.romanization,n.customRomajiMapping)),function(e,t,n){n||(n=xe(t.romanization,t.customRomajiMapping));const r=Object.assign({},{isDestinationRomaji:!0},t);return I(ke(e,Pe,r),n,!t.IMEMode)}(e,n,t).map((t=>{const[r,o,i]=t;return n.upcaseKatakana&&me(e.slice(r,o))?i.toUpperCase():i})).join("")}function _e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&N.some((t=>{let[n,o]=t;return r(e,n,o)}))}function De(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!n(e)&&!be(e)&&E.some((t=>{let[n,o]=t;return r(e,n,o)}))}const qe=e=>" "===e,Be=e=>" "===e,Ve=e=>/[0-9]/.test(e),Ge=e=>/[0-9]/.test(e),We={EN:"en",JA:"ja",EN_NUM:"englishNumeral",JA_NUM:"japaneseNumeral",EN_PUNC:"englishPunctuation",JA_PUNC:"japanesePunctuation",KANJI:"kanji",HIRAGANA:"hiragana",KATAKANA:"katakana",SPACE:"space",OTHER:"other"};function Xe(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{EN:n,JA:r,EN_NUM:o,JA_NUM:i,EN_PUNC:a,JA_PUNC:u,KANJI:s,HIRAGANA:c,KATAKANA:l,SPACE:f,OTHER:d}=We;if(t)switch(!0){case Ve(e):case Ge(e):return d;case qe(e):return n;case _e(e):return d;case Be(e):return r;case De(e):return d;case w(e):return r;case fe(e):return n;default:return d}else switch(!0){case Be(e):case qe(e):return f;case Ve(e):return i;case Ge(e):return o;case _e(e):return a;case De(e):return u;case je(e):return s;case ee(e):return c;case he(e):return l;case w(e):return r;case fe(e):return n;default:return d}}function Ze(e){let{compact:t=!1,detailed:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||n(e))return[];const o=[...e];let i=o.shift(),a=Xe(i,t);i=r?{type:a,value:i}:i;return o.reduce(((e,n)=>{const o=Xe(n,t),i=o===a;a=o;let u=n;return i&&(u=(r?e.pop().value:e.pop())+u),r?e.concat({type:o,value:u}):e.concat(u)}),[i])}e.ROMANIZATIONS=i,e.TO_KANA_METHODS=o,e.VERSION="5.2.0",e.bind=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!ce.includes(e.nodeName))throw new Error(`Element provided to Wanakana bind() was not a valid input or textarea element.\n Received: (${JSON.stringify(e)})`);if(e.hasAttribute("data-wanakana-id"))return;const r=ie(t),o=(le+=1,`${Date.now()}${le}`),i={};var a;[{name:"data-wanakana-id",value:o},{name:"lang",value:"ja"},{name:"autoCapitalize",value:"none"},{name:"autoCorrect",value:"off"},{name:"autoComplete",value:"off"},{name:"spellCheck",value:"false"}].forEach((t=>{i[t.name]=e.getAttribute(t.name),e.setAttribute(t.name,t.value)})),e.dataset.previousAttributes=JSON.stringify(i),e.addEventListener("input",r),e.addEventListener("compositionupdate",ae),e.addEventListener("compositionend",ae),function(e,t,n){oe=oe.concat({id:e,inputHandler:t,compositionHandler:n})}(o,r,ae),!0===n&&(a=e,Object.entries(se).forEach((e=>{let[t,n]=e;return a.addEventListener(t,n)})))},e.isHiragana=pe,e.isJapanese=k,e.isKana=ve,e.isKanji=ye,e.isKatakana=me,e.isMixed=Ee,e.isRomaji=de,e.stripOkurigana=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",{leading:t=!1,matchKanji:n=""}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!k(e)||((e,t)=>t&&!ve(e[0]))(e,t)||((e,t)=>!t&&!ve(e[e.length-1]))(e,t)||((e,t)=>t&&![...t].some(ye)||!t&&ve(e))(e,n))return e;const r=n||e,o=new RegExp(t?`^${Ze(r).shift()}`:`${Ze(r).pop()}$`);return e.replace(o,"")},e.toHiragana=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=z(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});if(t.passRomaji)return ke(e,Pe,t);if(Ee(e,{passKanji:!0})){return re(ke(e,Pe,t).toLowerCase(),t)}return de(e)||_e(e)?re(e.toLowerCase(),t):ke(e,Pe,t)},e.toKana=re,e.toKatakana=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=z(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});if(t.passRomaji)return te(e);if(Ee(e)||de(e)||_e(e)){return te(re(e.toLowerCase(),t))}return te(e)},e.toRomaji=Pe,e.tokenize=Ze,e.unbind=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=(r=e)&&oe.find((e=>{let{id:t}=e;return t===r.getAttribute("data-wanakana-id")}));var r;if(null==n)throw new Error(`Element provided to Wanakana unbind() had no listener registered.\n Received: ${JSON.stringify(e)}`);const{inputHandler:o,compositionHandler:i}=n,a=JSON.parse(e.dataset.previousAttributes);var u;Object.keys(a).forEach((t=>{a[t]?e.setAttribute(t,a[t]):e.removeAttribute(t)})),e.removeAttribute("data-previous-attributes"),e.removeAttribute("data-ignore-composition"),e.removeEventListener("input",o),e.removeEventListener("compositionstart",i),e.removeEventListener("compositionupdate",i),e.removeEventListener("compositionend",i),function(e){let{id:t}=e;oe=oe.filter((e=>{let{id:n}=e;return n!==t}))}(n),!0===t&&(u=e,Object.entries(se).forEach((e=>{let[t,n]=e;return u.removeEventListener(t,n)})))}})); //# sourceMappingURL=wanakana.min.js.map diff --git a/assets/js/wanakana.min.js.map b/assets/js/wanakana.min.js.map index bdab196..3c9dfe7 100644 --- a/assets/js/wanakana.min.js.map +++ b/assets/js/wanakana.min.js.map @@ -1 +1 @@ -{"version":3,"file":"wanakana.min.js","sources":["../src/utils/typeOf.js","../src/utils/isEmpty.js","../src/utils/isCharInRange.js","../src/constants.js","../src/utils/isCharJapanese.js","../src/isJapanese.js","../node_modules/memoize-one/dist/memoize-one.esm.js","../node_modules/dequal/dist/index.mjs","../src/utils/mergeWithDefaultOptions.js","../src/utils/kanaMapping.js","../src/utils/romajiToKanaMap.js","../src/utils/isCharUpperCase.js","../src/utils/isCharLongDash.js","../src/utils/isCharSlashDot.js","../src/utils/isCharHiragana.js","../src/utils/hiraganaToKatakana.js","../src/toKana.js","../src/utils/dom.js","../src/utils/logInputEvents.js","../src/bind.js","../src/utils/isCharRomaji.js","../src/isRomaji.js","../src/utils/isCharKatakana.js","../src/utils/isCharKana.js","../src/isKana.js","../src/isHiragana.js","../src/isKatakana.js","../src/utils/isCharIterationMark.js","../src/utils/isCharKanji.js","../src/isKanji.js","../src/isMixed.js","../src/utils/katakanaToHiragana.js","../src/utils/kanaToRomajiMap.js","../src/toRomaji.js","../src/utils/isCharEnglishPunctuation.js","../src/utils/isCharJapanesePunctuation.js","../src/tokenize.js","../src/stripOkurigana.js","../src/toHiragana.js","../src/toKatakana.js","../src/unbind.js"],"sourcesContent":["/**\n * Returns detailed type as string (instead of just 'object' for arrays etc)\n * @private\n * @param {any} value js value\n * @returns {String} type of value\n * @example\n * typeOf({}); // 'object'\n * typeOf([]); // 'array'\n * typeOf(function() {}); // 'function'\n * typeOf(/a/); // 'regexp'\n * typeOf(new Date()); // 'date'\n * typeOf(null); // 'null'\n * typeOf(undefined); // 'undefined'\n * typeOf('a'); // 'string'\n * typeOf(1); // 'number'\n * typeOf(true); // 'boolean'\n * typeOf(new Map()); // 'map'\n * typeOf(new Set()); // 'map'\n */\nfunction typeOf(value) {\n if (value === null) {\n return 'null';\n }\n if (value !== Object(value)) {\n return typeof value;\n }\n return {}.toString\n .call(value)\n .slice(8, -1)\n .toLowerCase();\n}\n\nexport default typeOf;\n","import typeOf from './typeOf';\n/**\n * Checks if input string is empty\n * @param {String} input text input\n * @return {Boolean} true if no input\n */\nfunction isEmpty(input) {\n if (typeOf(input) !== 'string') {\n return true;\n }\n return !input.length;\n}\n\nexport default isEmpty;\n","import isEmpty from './isEmpty';\n\n/**\n * Takes a character and a unicode range. Returns true if the char is in the range.\n * @param {String} char unicode character\n * @param {Number} start unicode start range\n * @param {Number} end unicode end range\n * @return {Boolean}\n */\nfunction isCharInRange(char = '', start, end) {\n if (isEmpty(char)) return false;\n const code = char.charCodeAt(0);\n return start <= code && code <= end;\n}\n\nexport default isCharInRange;\n","export const VERSION = '5.2.0';\n\nexport const TO_KANA_METHODS = {\n HIRAGANA: 'toHiragana',\n KATAKANA: 'toKatakana',\n};\n\nexport const ROMANIZATIONS = {\n HEPBURN: 'hepburn',\n};\n\n/**\n * Default config for WanaKana, user passed options will be merged with these\n * @type {DefaultOptions}\n * @name defaultOptions\n * @property {Boolean} [useObsoleteKana=false] - Set to true to use obsolete characters, such as ゐ and ゑ.\n * @example\n * toHiragana('we', { useObsoleteKana: true })\n * // => 'ゑ'\n * @property {Boolean} [passRomaji=false] - Set to true to pass romaji when using mixed syllabaries with toKatakana() or toHiragana()\n * @example\n * toHiragana('only convert the katakana: ヒラガナ', { passRomaji: true })\n * // => \"only convert the katakana: ひらがな\"\n * @property {Object} [convertLongVowelMark=true] - Set to false to prevent conversions of 'ー' to extended vowels with toHiragana()\n * @example\n * toHiragana('ラーメン', { convertLongVowelMark: false });\n * // => 'らーめん\n * @property {Boolean} [upcaseKatakana=false] - Set to true to convert katakana to uppercase using toRomaji()\n * @example\n * toRomaji('ひらがな カタカナ', { upcaseKatakana: true })\n * // => \"hiragana KATAKANA\"\n * @property {Boolean|String} [IMEMode=false] - Set to true, 'toHiragana', or 'toKatakana' to handle conversion while it is being typed.\n * @property {String} [romanization='hepburn'] - choose toRomaji() romanization map (currently only 'hepburn')\n * @property {Object} [customKanaMapping] - custom map will be merged with default conversion\n * @example\n * toKana('wanakana', { customKanaMapping: { na: 'に', ka: 'Bana' }) };\n * // => 'わにBanaに'\n * @property {Object} [customRomajiMapping] - custom map will be merged with default conversion\n * @example\n * toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' }) };\n * // => 'tuzigili'\n */\nexport const DEFAULT_OPTIONS = {\n useObsoleteKana: false,\n passRomaji: false,\n upcaseKatakana: false,\n IMEMode: false,\n convertLongVowelMark: true,\n romanization: ROMANIZATIONS.HEPBURN,\n};\n\n// CharCode References\n// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml\n// http://unicode-table.com\n\nexport const LATIN_LOWERCASE_START = 0x61;\nexport const LATIN_LOWERCASE_END = 0x7a;\nexport const LATIN_UPPERCASE_START = 0x41;\nexport const LATIN_UPPERCASE_END = 0x5a;\nexport const LOWERCASE_ZENKAKU_START = 0xff41;\nexport const LOWERCASE_ZENKAKU_END = 0xff5a;\nexport const UPPERCASE_ZENKAKU_START = 0xff21;\nexport const UPPERCASE_ZENKAKU_END = 0xff3a;\nexport const HIRAGANA_START = 0x3041;\nexport const HIRAGANA_END = 0x3096;\nexport const KATAKANA_START = 0x30a1;\nexport const KATAKANA_END = 0x30fc;\nexport const KANJI_START = 0x4e00;\nexport const KANJI_END = 0x9faf;\n\nexport const KANJI_ITERATION_MARK = 0x3005; // 々\nexport const PROLONGED_SOUND_MARK = 0x30fc; // ー\nexport const KANA_SLASH_DOT = 0x30fb; // ・\n\nconst ZENKAKU_NUMBERS = [0xff10, 0xff19];\nconst ZENKAKU_UPPERCASE = [UPPERCASE_ZENKAKU_START, UPPERCASE_ZENKAKU_END];\nconst ZENKAKU_LOWERCASE = [LOWERCASE_ZENKAKU_START, LOWERCASE_ZENKAKU_END];\nconst ZENKAKU_PUNCTUATION_1 = [0xff01, 0xff0f];\nconst ZENKAKU_PUNCTUATION_2 = [0xff1a, 0xff1f];\nconst ZENKAKU_PUNCTUATION_3 = [0xff3b, 0xff3f];\nconst ZENKAKU_PUNCTUATION_4 = [0xff5b, 0xff60];\nconst ZENKAKU_SYMBOLS_CURRENCY = [0xffe0, 0xffee];\n\nconst HIRAGANA_CHARS = [0x3040, 0x309f];\nconst KATAKANA_CHARS = [0x30a0, 0x30ff];\nconst HANKAKU_KATAKANA = [0xff66, 0xff9f];\nconst KATAKANA_PUNCTUATION = [0x30fb, 0x30fc];\nconst KANA_PUNCTUATION = [0xff61, 0xff65];\nconst CJK_SYMBOLS_PUNCTUATION = [0x3000, 0x303f];\nconst COMMON_CJK = [0x4e00, 0x9fff];\nconst RARE_CJK = [0x3400, 0x4dbf];\n\nexport const KANA_RANGES = [\n HIRAGANA_CHARS,\n KATAKANA_CHARS,\n KANA_PUNCTUATION,\n HANKAKU_KATAKANA,\n];\n\nexport const JA_PUNCTUATION_RANGES = [\n CJK_SYMBOLS_PUNCTUATION,\n KANA_PUNCTUATION,\n KATAKANA_PUNCTUATION,\n ZENKAKU_PUNCTUATION_1,\n ZENKAKU_PUNCTUATION_2,\n ZENKAKU_PUNCTUATION_3,\n ZENKAKU_PUNCTUATION_4,\n ZENKAKU_SYMBOLS_CURRENCY,\n];\n\n// All Japanese unicode start and end ranges\n// Includes kanji, kana, zenkaku latin chars, punctuation, and number ranges.\nexport const JAPANESE_RANGES = [\n ...KANA_RANGES,\n ...JA_PUNCTUATION_RANGES,\n ZENKAKU_UPPERCASE,\n ZENKAKU_LOWERCASE,\n ZENKAKU_NUMBERS,\n COMMON_CJK,\n RARE_CJK,\n];\n\nconst MODERN_ENGLISH = [0x0000, 0x007f];\nconst HEPBURN_MACRON_RANGES = [\n [0x0100, 0x0101], // Ā ā\n [0x0112, 0x0113], // Ē ē\n [0x012a, 0x012b], // Ī ī\n [0x014c, 0x014d], // Ō ō\n [0x016a, 0x016b], // Ū ū\n];\nconst SMART_QUOTE_RANGES = [\n [0x2018, 0x2019], // ‘ ’\n [0x201c, 0x201d], // “ ”\n];\n\nexport const ROMAJI_RANGES = [MODERN_ENGLISH, ...HEPBURN_MACRON_RANGES];\n\nexport const EN_PUNCTUATION_RANGES = [\n [0x20, 0x2f],\n [0x3a, 0x3f],\n [0x5b, 0x60],\n [0x7b, 0x7e],\n ...SMART_QUOTE_RANGES,\n];\n","import isCharInRange from './isCharInRange';\nimport { JAPANESE_RANGES } from '../constants';\n\n/**\n * Tests a character. Returns true if the character is [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharJapanese(char = '') {\n return JAPANESE_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharJapanese;\n","import typeOf from './utils/typeOf';\nimport isEmpty from './utils/isEmpty';\nimport isCharJapanese from './utils/isCharJapanese';\n\n/**\n * Test if `input` only includes [Kanji](https://en.wikipedia.org/wiki/Kanji), [Kana](https://en.wikipedia.org/wiki/Kana), zenkaku numbers, and JA punctuation/symbols.”\n * @param {String} [input=''] text\n * @param {Regexp} [allowed] additional test allowed to pass for each char\n * @return {Boolean} true if passes checks\n * @example\n * isJapanese('泣き虫')\n * // => true\n * isJapanese('あア')\n * // => true\n * isJapanese('2月') // Zenkaku numbers allowed\n * // => true\n * isJapanese('泣き虫。!〜$') // Zenkaku/JA punctuation\n * // => true\n * isJapanese('泣き虫.!~$') // Latin punctuation fails\n * // => false\n * isJapanese('A泣き虫')\n * // => false\n * isJapanese('≪偽括弧≫', /[≪≫]/);\n * // => true\n */\nfunction isJapanese(input = '', allowed) {\n const augmented = typeOf(allowed) === 'regexp';\n return isEmpty(input)\n ? false\n : [...input].every((char) => {\n const isJa = isCharJapanese(char);\n return !augmented ? isJa : isJa || allowed.test(char);\n });\n}\n\nexport default isJapanese;\n","var safeIsNaN = Number.isNaN ||\n function ponyfill(value) {\n return typeof value === 'number' && value !== value;\n };\nfunction isEqual(first, second) {\n if (first === second) {\n return true;\n }\n if (safeIsNaN(first) && safeIsNaN(second)) {\n return true;\n }\n return false;\n}\nfunction areInputsEqual(newInputs, lastInputs) {\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n for (var i = 0; i < newInputs.length; i++) {\n if (!isEqual(newInputs[i], lastInputs[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n if (isEqual === void 0) { isEqual = areInputsEqual; }\n var cache = null;\n function memoized() {\n var newArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n newArgs[_i] = arguments[_i];\n }\n if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) {\n return cache.lastResult;\n }\n var lastResult = resultFn.apply(this, newArgs);\n cache = {\n lastResult: lastResult,\n lastArgs: newArgs,\n lastThis: this,\n };\n return lastResult;\n }\n memoized.clear = function clear() {\n cache = null;\n };\n return memoized;\n}\n\nexport { memoizeOne as default };\n","var has = Object.prototype.hasOwnProperty;\n\nfunction find(iter, tar, key) {\n\tfor (key of iter.keys()) {\n\t\tif (dequal(key, tar)) return key;\n\t}\n}\n\nexport function dequal(foo, bar) {\n\tvar ctor, len, tmp;\n\tif (foo === bar) return true;\n\n\tif (foo && bar && (ctor=foo.constructor) === bar.constructor) {\n\t\tif (ctor === Date) return foo.getTime() === bar.getTime();\n\t\tif (ctor === RegExp) return foo.toString() === bar.toString();\n\n\t\tif (ctor === Array) {\n\t\t\tif ((len=foo.length) === bar.length) {\n\t\t\t\twhile (len-- && dequal(foo[len], bar[len]));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ctor === Set) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len;\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!bar.has(tmp)) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === Map) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len[0];\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!dequal(len[1], bar.get(tmp))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === ArrayBuffer) {\n\t\t\tfoo = new Uint8Array(foo);\n\t\t\tbar = new Uint8Array(bar);\n\t\t} else if (ctor === DataView) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo.getInt8(len) === bar.getInt8(len));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ArrayBuffer.isView(foo)) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo[len] === bar[len]);\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (!ctor || typeof foo === 'object') {\n\t\t\tlen = 0;\n\t\t\tfor (ctor in foo) {\n\t\t\t\tif (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n\t\t\t\tif (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n\t\t\t}\n\t\t\treturn Object.keys(bar).length === len;\n\t\t}\n\t}\n\n\treturn foo !== foo && bar !== bar;\n}\n","import { DEFAULT_OPTIONS } from '../constants';\n/**\n * Easy re-use of merging with default options\n * @param {Object} opts user options\n * @returns user options merged over default options\n */\nconst mergeWithDefaultOptions = (opts = {}) => Object.assign({}, DEFAULT_OPTIONS, opts);\n\nexport default mergeWithDefaultOptions;\n","import typeOf from './typeOf';\n\nexport function applyMapping(string, mapping, convertEnding) {\n const root = mapping;\n\n function nextSubtree(tree, nextChar) {\n const subtree = tree[nextChar];\n if (subtree === undefined) {\n return undefined;\n }\n // if the next child node does not have a node value, set its node value to the input\n return Object.assign({ '': tree[''] + nextChar }, tree[nextChar]);\n }\n\n function newChunk(remaining, currentCursor) {\n // start parsing a new chunk\n const firstChar = remaining.charAt(0);\n\n return parse(\n Object.assign({ '': firstChar }, root[firstChar]),\n remaining.slice(1),\n currentCursor,\n currentCursor + 1\n );\n }\n\n function parse(tree, remaining, lastCursor, currentCursor) {\n if (!remaining) {\n if (convertEnding || Object.keys(tree).length === 1) {\n // nothing more to consume, just commit the last chunk and return it\n // so as to not have an empty element at the end of the result\n return tree[''] ? [[lastCursor, currentCursor, tree['']]] : [];\n }\n // if we don't want to convert the ending, because there are still possible continuations\n // return null as the final node value\n return [[lastCursor, currentCursor, null]];\n }\n\n if (Object.keys(tree).length === 1) {\n return [[lastCursor, currentCursor, tree['']]].concat(\n newChunk(remaining, currentCursor)\n );\n }\n\n const subtree = nextSubtree(tree, remaining.charAt(0));\n\n if (subtree === undefined) {\n return [[lastCursor, currentCursor, tree['']]].concat(\n newChunk(remaining, currentCursor)\n );\n }\n // continue current branch\n return parse(subtree, remaining.slice(1), lastCursor, currentCursor + 1);\n }\n\n return newChunk(string, 0);\n}\n\n// transform the tree, so that for example hepburnTree['ゔ']['ぁ'][''] === 'va'\n// or kanaTree['k']['y']['a'][''] === 'きゃ'\nexport function transform(tree) {\n return Object.entries(tree).reduce((map, [char, subtree]) => {\n const endOfBranch = typeOf(subtree) === 'string';\n // eslint-disable-next-line no-param-reassign\n map[char] = endOfBranch ? { '': subtree } : transform(subtree);\n return map;\n }, {});\n}\n\nexport function getSubTreeOf(tree, string) {\n return string.split('').reduce((correctSubTree, char) => {\n if (correctSubTree[char] === undefined) {\n // eslint-disable-next-line no-param-reassign\n correctSubTree[char] = {};\n }\n return correctSubTree[char];\n }, tree);\n}\n\n/**\n * Creates a custom mapping tree, returns a function that accepts a defaultMap which the newly created customMapping will be merged with and returned\n * (customMap) => (defaultMap) => mergedMap\n * @param {Object} customMap { 'ka' : 'な' }\n * @return {Function} (defaultMap) => defaultMergedWithCustomMap\n * @example\n * const sillyMap = createCustomMapping({ 'ちゃ': 'time', '茎': 'cookie' });\n * // sillyMap is passed defaultMapping to merge with when called in toRomaji()\n * toRomaji(\"It's 茎 ちゃ よ\", { customRomajiMapping: sillyMap });\n * // => 'It's cookie time yo';\n */\nexport function createCustomMapping(customMap = {}) {\n const customTree = {};\n\n if (typeOf(customMap) === 'object') {\n Object.entries(customMap).forEach(([roma, kana]) => {\n let subTree = customTree;\n roma.split('').forEach((char) => {\n if (subTree[char] === undefined) {\n subTree[char] = {};\n }\n subTree = subTree[char];\n });\n subTree[''] = kana;\n });\n }\n\n return function makeMap(map) {\n const mapCopy = JSON.parse(JSON.stringify(map));\n\n function transformMap(mapSubtree, customSubtree) {\n if (mapSubtree === undefined || typeOf(mapSubtree) === 'string') {\n return customSubtree;\n }\n return Object.entries(customSubtree).reduce(\n (newSubtree, [char, subtree]) => {\n // eslint-disable-next-line no-param-reassign\n newSubtree[char] = transformMap(mapSubtree[char], subtree);\n return newSubtree;\n },\n mapSubtree\n );\n }\n\n return transformMap(mapCopy, customTree);\n };\n}\n\n// allow consumer to pass either function or object as customMapping\nexport function mergeCustomMapping(map, customMapping) {\n if (!customMapping) {\n return map;\n }\n return typeOf(customMapping) === 'function'\n ? customMapping(map)\n : createCustomMapping(customMapping)(map);\n}\n","import { transform, getSubTreeOf, createCustomMapping } from './kanaMapping';\n\n// NOTE: not exactly kunrei shiki, for example ぢゃ -> dya instead of zya, to avoid name clashing\n/* eslint-disable */\n// prettier-ignore\nconst BASIC_KUNREI = {\n a: 'あ', i: 'い', u: 'う', e: 'え', o: 'お',\n k: { a: 'か', i: 'き', u: 'く', e: 'け', o: 'こ', },\n s: { a: 'さ', i: 'し', u: 'す', e: 'せ', o: 'そ', },\n t: { a: 'た', i: 'ち', u: 'つ', e: 'て', o: 'と', },\n n: { a: 'な', i: 'に', u: 'ぬ', e: 'ね', o: 'の', },\n h: { a: 'は', i: 'ひ', u: 'ふ', e: 'へ', o: 'ほ', },\n m: { a: 'ま', i: 'み', u: 'む', e: 'め', o: 'も', },\n y: { a: 'や', u: 'ゆ', o: 'よ' },\n r: { a: 'ら', i: 'り', u: 'る', e: 'れ', o: 'ろ', },\n w: { a: 'わ', i: 'ゐ', e: 'ゑ', o: 'を', },\n g: { a: 'が', i: 'ぎ', u: 'ぐ', e: 'げ', o: 'ご', },\n z: { a: 'ざ', i: 'じ', u: 'ず', e: 'ぜ', o: 'ぞ', },\n d: { a: 'だ', i: 'ぢ', u: 'づ', e: 'で', o: 'ど', },\n b: { a: 'ば', i: 'び', u: 'ぶ', e: 'べ', o: 'ぼ', },\n p: { a: 'ぱ', i: 'ぴ', u: 'ぷ', e: 'ぺ', o: 'ぽ', },\n v: { a: 'ゔぁ', i: 'ゔぃ', u: 'ゔ', e: 'ゔぇ', o: 'ゔぉ', },\n};\n\nconst SPECIAL_SYMBOLS = {\n '.': '。',\n ',': '、',\n ':': ':',\n '/': '・',\n '!': '!',\n '?': '?',\n '~': '〜',\n '-': 'ー',\n '‘': '「',\n '’': '」',\n '“': '『',\n '”': '』',\n '[': '[',\n ']': ']',\n '(': '(',\n ')': ')',\n '{': '{',\n '}': '}',\n};\n\nconst CONSONANTS = {\n k: 'き',\n s: 'し',\n t: 'ち',\n n: 'に',\n h: 'ひ',\n m: 'み',\n r: 'り',\n g: 'ぎ',\n z: 'じ',\n d: 'ぢ',\n b: 'び',\n p: 'ぴ',\n v: 'ゔ',\n q: 'く',\n f: 'ふ',\n};\nconst SMALL_Y = { ya: 'ゃ', yi: 'ぃ', yu: 'ゅ', ye: 'ぇ', yo: 'ょ' };\nconst SMALL_VOWELS = { a: 'ぁ', i: 'ぃ', u: 'ぅ', e: 'ぇ', o: 'ぉ' };\n\n// typing one should be the same as having typed the other instead\nconst ALIASES = {\n sh: 'sy', // sha -> sya\n ch: 'ty', // cho -> tyo\n cy: 'ty', // cyo -> tyo\n chy: 'ty', // chyu -> tyu\n shy: 'sy', // shya -> sya\n j: 'zy', // ja -> zya\n jy: 'zy', // jye -> zye\n\n // exceptions to above rules\n shi: 'si',\n chi: 'ti',\n tsu: 'tu',\n ji: 'zi',\n fu: 'hu',\n};\n\n// xtu -> っ\nconst SMALL_LETTERS = Object.assign(\n {\n tu: 'っ',\n wa: 'ゎ',\n ka: 'ヵ',\n ke: 'ヶ',\n },\n SMALL_VOWELS,\n SMALL_Y\n);\n\n// don't follow any notable patterns\nconst SPECIAL_CASES = {\n yi: 'い',\n wu: 'う',\n ye: 'いぇ',\n wi: 'うぃ',\n we: 'うぇ',\n kwa: 'くぁ',\n whu: 'う',\n // because it's not thya for てゃ but tha\n // and tha is not てぁ, but てゃ\n tha: 'てゃ',\n thu: 'てゅ',\n tho: 'てょ',\n dha: 'でゃ',\n dhu: 'でゅ',\n dho: 'でょ',\n};\n\nconst AIUEO_CONSTRUCTIONS = {\n wh: 'う',\n kw: 'く',\n qw: 'く',\n q: 'く',\n gw: 'ぐ',\n sw: 'す',\n ts: 'つ',\n th: 'て',\n tw: 'と',\n dh: 'で',\n dw: 'ど',\n fw: 'ふ',\n f: 'ふ',\n};\n\n/* eslint-enable */\nfunction createRomajiToKanaMap() {\n const kanaTree = transform(BASIC_KUNREI);\n // pseudo partial application\n const subtreeOf = (string) => getSubTreeOf(kanaTree, string);\n\n // add tya, sya, etc.\n Object.entries(CONSONANTS).forEach(([consonant, yKana]) => {\n Object.entries(SMALL_Y).forEach(([roma, kana]) => {\n // for example kyo -> き + ょ\n subtreeOf(consonant + roma)[''] = yKana + kana;\n });\n });\n\n Object.entries(SPECIAL_SYMBOLS).forEach(([symbol, jsymbol]) => {\n subtreeOf(symbol)[''] = jsymbol;\n });\n\n // things like うぃ, くぃ, etc.\n Object.entries(AIUEO_CONSTRUCTIONS).forEach(([consonant, aiueoKana]) => {\n Object.entries(SMALL_VOWELS).forEach(([vowel, kana]) => {\n const subtree = subtreeOf(consonant + vowel);\n subtree[''] = aiueoKana + kana;\n });\n });\n\n // different ways to write ん\n ['n', \"n'\", 'xn'].forEach((nChar) => {\n subtreeOf(nChar)[''] = 'ん';\n });\n\n // c is equivalent to k, but not for chi, cha, etc. that's why we have to make a copy of k\n kanaTree.c = JSON.parse(JSON.stringify(kanaTree.k));\n\n Object.entries(ALIASES).forEach(([string, alternative]) => {\n const allExceptLast = string.slice(0, string.length - 1);\n const last = string.charAt(string.length - 1);\n const parentTree = subtreeOf(allExceptLast);\n // copy to avoid recursive containment\n parentTree[last] = JSON.parse(JSON.stringify(subtreeOf(alternative)));\n });\n\n function getAlternatives(string) {\n return [...Object.entries(ALIASES), ...[['c', 'k']]].reduce(\n (list, [alt, roma]) => (string.startsWith(roma) ? list.concat(string.replace(roma, alt)) : list),\n []\n );\n }\n\n Object.entries(SMALL_LETTERS).forEach(([kunreiRoma, kana]) => {\n const last = (char) => char.charAt(char.length - 1);\n const allExceptLast = (chars) => chars.slice(0, chars.length - 1);\n const xRoma = `x${kunreiRoma}`;\n const xSubtree = subtreeOf(xRoma);\n xSubtree[''] = kana;\n\n // ltu -> xtu -> っ\n const parentTree = subtreeOf(`l${allExceptLast(kunreiRoma)}`);\n parentTree[last(kunreiRoma)] = xSubtree;\n\n // ltsu -> ltu -> っ\n getAlternatives(kunreiRoma).forEach((altRoma) => {\n ['l', 'x'].forEach((prefix) => {\n const altParentTree = subtreeOf(prefix + allExceptLast(altRoma));\n altParentTree[last(altRoma)] = subtreeOf(prefix + kunreiRoma);\n });\n });\n });\n\n Object.entries(SPECIAL_CASES).forEach(([string, kana]) => {\n subtreeOf(string)[''] = kana;\n });\n\n // add kka, tta, etc.\n function addTsu(tree) {\n return Object.entries(tree).reduce((tsuTree, [key, value]) => {\n if (!key) {\n // we have reached the bottom of this branch\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = `っ${value}`;\n } else {\n // more subtrees\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = addTsu(value);\n }\n return tsuTree;\n }, {});\n }\n // have to explicitly name c here, because we made it a copy of k, not a reference\n [...Object.keys(CONSONANTS), 'c', 'y', 'w', 'j'].forEach((consonant) => {\n const subtree = kanaTree[consonant];\n subtree[consonant] = addTsu(subtree);\n });\n // nn should not be っん\n delete kanaTree.n.n;\n // solidify the results, so that there there is referential transparency within the tree\n return Object.freeze(JSON.parse(JSON.stringify(kanaTree)));\n}\n\nlet romajiToKanaMap = null;\n\nexport function getRomajiToKanaTree() {\n if (romajiToKanaMap == null) {\n romajiToKanaMap = createRomajiToKanaMap();\n }\n return romajiToKanaMap;\n}\n\nexport const USE_OBSOLETE_KANA_MAP = createCustomMapping({\n wi: 'ゐ',\n we: 'ゑ',\n});\n\nexport function IME_MODE_MAP(map) {\n // in IME mode, we do not want to convert single ns\n const mapCopy = JSON.parse(JSON.stringify(map));\n mapCopy.n.n = { '': 'ん' };\n mapCopy.n[' '] = { '': 'ん' };\n return mapCopy;\n}\n","import isEmpty from './isEmpty';\nimport isCharInRange from './isCharInRange';\nimport { LATIN_UPPERCASE_START, LATIN_UPPERCASE_END } from '../constants';\n\n/**\n * Tests if char is in English unicode uppercase range\n * @param {String} char\n * @return {Boolean}\n */\nfunction isCharUpperCase(char = '') {\n if (isEmpty(char)) return false;\n return isCharInRange(char, LATIN_UPPERCASE_START, LATIN_UPPERCASE_END);\n}\n\nexport default isCharUpperCase;\n","import isEmpty from './isEmpty';\nimport { PROLONGED_SOUND_MARK } from '../constants';\n\n/**\n * Returns true if char is 'ー'\n * @param {String} char to test\n * @return {Boolean}\n */\nfunction isCharLongDash(char = '') {\n if (isEmpty(char)) return false;\n return char.charCodeAt(0) === PROLONGED_SOUND_MARK;\n}\n\nexport default isCharLongDash;\n","import isEmpty from './isEmpty';\nimport { KANA_SLASH_DOT } from '../constants';\n\n/**\n * Tests if char is '・'\n * @param {String} char\n * @return {Boolean} true if '・'\n */\nfunction isCharSlashDot(char = '') {\n if (isEmpty(char)) return false;\n return char.charCodeAt(0) === KANA_SLASH_DOT;\n}\n\nexport default isCharSlashDot;\n","import isEmpty from './isEmpty';\nimport isCharLongDash from './isCharLongDash';\nimport isCharInRange from './isCharInRange';\nimport {\n HIRAGANA_START,\n HIRAGANA_END,\n} from '../constants';\n\n/**\n * Tests a character. Returns true if the character is [Hiragana](https://en.wikipedia.org/wiki/Hiragana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharHiragana(char = '') {\n if (isEmpty(char)) return false;\n if (isCharLongDash(char)) return true;\n return isCharInRange(char, HIRAGANA_START, HIRAGANA_END);\n}\n\nexport default isCharHiragana;\n","import { KATAKANA_START, HIRAGANA_START } from '../constants';\n\nimport isCharLongDash from './isCharLongDash';\nimport isCharSlashDot from './isCharSlashDot';\nimport isCharHiragana from './isCharHiragana';\n\n/**\n * Convert [Hiragana](https://en.wikipedia.org/wiki/Hiragana) to [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * Passes through any non-hiragana chars\n * @private\n * @param {String} [input=''] text input\n * @return {String} converted text\n * @example\n * hiraganaToKatakana('ひらがな')\n * // => \"ヒラガナ\"\n * hiraganaToKatakana('ひらがな is a type of kana')\n * // => \"ヒラガナ is a type of kana\"\n */\nfunction hiraganaToKatakana(input = '') {\n const kata = [];\n input.split('').forEach((char) => {\n // Short circuit to avoid incorrect codeshift for 'ー' and '・'\n if (isCharLongDash(char) || isCharSlashDot(char)) {\n kata.push(char);\n } else if (isCharHiragana(char)) {\n // Shift charcode.\n const code = char.charCodeAt(0) + (KATAKANA_START - HIRAGANA_START);\n const kataChar = String.fromCharCode(code);\n kata.push(kataChar);\n } else {\n // Pass non-hiragana chars through\n kata.push(char);\n }\n });\n return kata.join('');\n}\n\nexport default hiraganaToKatakana;\n","import memoizeOne from 'memoize-one';\nimport { dequal } from 'dequal';\n\nimport { TO_KANA_METHODS } from './constants';\nimport mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport {\n getRomajiToKanaTree,\n IME_MODE_MAP,\n USE_OBSOLETE_KANA_MAP,\n} from './utils/romajiToKanaMap';\nimport { applyMapping, mergeCustomMapping } from './utils/kanaMapping';\nimport isCharUpperCase from './utils/isCharUpperCase';\nimport hiraganaToKatakana from './utils/hiraganaToKatakana';\n\n// memoize and deeply compare args so we only recreate when necessary\nexport const createRomajiToKanaMap = memoizeOne(\n (IMEMode, useObsoleteKana, customKanaMapping) => {\n let map = getRomajiToKanaTree();\n\n map = IMEMode ? IME_MODE_MAP(map) : map;\n map = useObsoleteKana ? USE_OBSOLETE_KANA_MAP(map) : map;\n\n if (customKanaMapping) {\n map = mergeCustomMapping(map, customKanaMapping);\n }\n\n return map;\n },\n dequal\n);\n\n/**\n * Convert [Romaji](https://en.wikipedia.org/wiki/Romaji) to [Kana](https://en.wikipedia.org/wiki/Kana), lowercase text will result in [Hiragana](https://en.wikipedia.org/wiki/Hiragana) and uppercase text will result in [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} [input=''] text\n * @param {DefaultOptions} [options=defaultOptions]\n * @return {String} converted text\n * @example\n * toKana('onaji BUTTSUUJI')\n * // => 'おなじ ブッツウジ'\n * toKana('ONAJI buttsuuji')\n * // => 'オナジ ぶっつうじ'\n * toKana('座禅‘zazen’スタイル')\n * // => '座禅「ざぜん」スタイル'\n * toKana('batsuge-mu')\n * // => 'ばつげーむ'\n * toKana('!?.:/,~-‘’“”[](){}') // Punctuation conversion\n * // => '!?。:・、〜ー「」『』[](){}'\n * toKana('we', { useObsoleteKana: true })\n * // => 'ゑ'\n * toKana('wanakana', { customKanaMapping: { na: 'に', ka: 'bana' } });\n * // => 'わにbanaに'\n */\nexport function toKana(input = '', options = {}, map) {\n let config;\n if (!map) {\n config = mergeWithDefaultOptions(options);\n map = createRomajiToKanaMap(\n config.IMEMode,\n config.useObsoleteKana,\n config.customKanaMapping\n );\n } else {\n config = options;\n }\n\n // throw away the substring index information and just concatenate all the kana\n return splitIntoConvertedKana(input, config, map)\n .map((kanaToken) => {\n const [start, end, kana] = kanaToken;\n if (kana === null) {\n // haven't converted the end of the string, since we are in IME mode\n return input.slice(start);\n }\n const enforceHiragana = config.IMEMode === TO_KANA_METHODS.HIRAGANA;\n const enforceKatakana = config.IMEMode === TO_KANA_METHODS.KATAKANA\n || [...input.slice(start, end)].every(isCharUpperCase);\n\n return enforceHiragana || !enforceKatakana\n ? kana\n : hiraganaToKatakana(kana);\n })\n .join('');\n}\n\n/**\n *\n * @private\n * @param {String} [input=''] input text\n * @param {DefaultOptions} [options=defaultOptions] toKana options\n * @param {Object} [map] custom mapping\n * @returns {Array[]} [[start, end, token]]\n * @example\n * splitIntoConvertedKana('buttsuuji')\n * // => [[0, 2, 'ぶ'], [2, 6, 'っつ'], [6, 7, 'う'], [7, 9, 'じ']]\n */\nexport function splitIntoConvertedKana(input = '', options = {}, map) {\n const { IMEMode, useObsoleteKana, customKanaMapping } = options;\n\n if (!map) {\n map = createRomajiToKanaMap(IMEMode, useObsoleteKana, customKanaMapping);\n }\n\n return applyMapping(input.toLowerCase(), map, !IMEMode);\n}\n\nexport default toKana;\n","import isJapanese from '../isJapanese';\nimport toKana, { createRomajiToKanaMap } from '../toKana';\nimport mergeWithDefaultOptions from './mergeWithDefaultOptions';\n\nlet LISTENERS = [];\n/**\n * Automagically replaces input values with converted text to kana\n * @param {defaultOptions} [options] user config overrides, default conversion is toKana()\n * @return {Function} event handler with bound options\n * @private\n */\nexport function makeOnInput(options) {\n let prevInput;\n\n // Enforce IMEMode if not already specified\n const mergedConfig = Object.assign({}, mergeWithDefaultOptions(options), {\n IMEMode: options.IMEMode || true,\n });\n\n const preConfiguredMap = createRomajiToKanaMap(\n mergedConfig.IMEMode,\n mergedConfig.useObsoleteKana,\n mergedConfig.customKanaMapping\n );\n\n const triggers = [\n ...Object.keys(preConfiguredMap),\n ...Object.keys(preConfiguredMap).map((char) => char.toUpperCase()),\n ];\n\n return function onInput({ target }) {\n if (\n target.value !== prevInput\n && target.dataset.ignoreComposition !== 'true'\n ) {\n convertInput(target, mergedConfig, preConfiguredMap, triggers, prevInput);\n }\n };\n}\n\nexport function convertInput(target, options, map, triggers, prevInput) {\n const [head, textToConvert, tail] = splitInput(\n target.value,\n target.selectionEnd,\n triggers\n );\n const convertedText = toKana(textToConvert, options, map);\n const changed = textToConvert !== convertedText;\n\n if (changed) {\n const newCursor = head.length + convertedText.length;\n const newValue = head + convertedText + tail;\n // eslint-disable-next-line no-param-reassign\n target.value = newValue;\n // eslint-disable-next-line no-param-reassign\n prevInput = newValue;\n\n if (tail.length) {\n // push later on event loop (otherwise mid-text insertion can be 1 char too far to the right)\n setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1);\n } else {\n target.setSelectionRange(newCursor, newCursor);\n }\n } else {\n // eslint-disable-next-line no-param-reassign\n prevInput = target.value;\n }\n}\n\nexport function onComposition({ type, target, data }) {\n // navigator.platform is not 100% reliable for singling out all OS,\n // but for determining desktop \"Mac OS\" it is effective enough.\n const isMacOS = /Mac/.test(window.navigator && window.navigator.platform);\n // We don't want to ignore on Android:\n // https://github.com/WaniKani/WanaKana/issues/82\n // But MacOS IME auto-closes if we don't ignore:\n // https://github.com/WaniKani/WanaKana/issues/71\n // Other platform Japanese IMEs pass through happily\n if (isMacOS) {\n if (type === 'compositionupdate' && isJapanese(data)) {\n // eslint-disable-next-line no-param-reassign\n target.dataset.ignoreComposition = 'true';\n }\n\n if (type === 'compositionend') {\n // eslint-disable-next-line no-param-reassign\n target.dataset.ignoreComposition = 'false';\n }\n }\n}\n\nexport function trackListeners(id, inputHandler, compositionHandler) {\n LISTENERS = LISTENERS.concat({\n id,\n inputHandler,\n compositionHandler,\n });\n}\n\nexport function untrackListeners({ id: targetId }) {\n LISTENERS = LISTENERS.filter(({ id }) => id !== targetId);\n}\n\nexport function findListeners(el) {\n return (\n el && LISTENERS.find(({ id }) => id === el.getAttribute('data-wanakana-id'))\n );\n}\n\n// Handle non-terminal inserted input conversion:\n// | -> わ| -> わび| -> わ|び -> わs|び -> わsh|び -> わshi|び -> わし|び\n// or multiple ambiguous positioning (to select which \"s\" to work from)\n// こsこs|こsこ -> こsこso|こsこ -> こsこそ|こsこ\nexport function splitInput(text = '', cursor = 0, triggers = []) {\n let head;\n let toConvert;\n let tail;\n\n if (cursor === 0 && triggers.includes(text[0])) {\n [head, toConvert, tail] = workFromStart(text, triggers);\n } else if (cursor > 0) {\n [head, toConvert, tail] = workBackwards(text, cursor);\n } else {\n [head, toConvert] = takeWhileAndSlice(\n text,\n (char) => !triggers.includes(char)\n );\n [toConvert, tail] = takeWhileAndSlice(\n toConvert,\n (char) => !isJapanese(char)\n );\n }\n\n return [head, toConvert, tail];\n}\n\nfunction workFromStart(text, catalystChars) {\n return [\n '',\n ...takeWhileAndSlice(\n text,\n (char) => catalystChars.includes(char) || !isJapanese(char, /[0-9]/)\n ),\n ];\n}\n\nfunction workBackwards(text = '', startIndex = 0) {\n const [toConvert, head] = takeWhileAndSlice(\n [...text.slice(0, startIndex)].reverse(),\n (char) => !isJapanese(char)\n );\n return [\n head.reverse().join(''),\n toConvert\n .split('')\n .reverse()\n .join(''),\n text.slice(startIndex),\n ];\n}\n\nfunction takeWhileAndSlice(source = {}, predicate = (x) => !!x) {\n const result = [];\n const { length } = source;\n let i = 0;\n while (i < length && predicate(source[i], i)) {\n result.push(source[i]);\n i += 1;\n }\n return [result.join(''), source.slice(i)];\n}\n","/* eslint-disable no-console */\nconst onInput = ({ target: { value, selectionStart, selectionEnd } }) => console.log('input:', { value, selectionStart, selectionEnd });\nconst onCompositionStart = () => console.log('compositionstart');\nconst onCompositionUpdate = ({\n target: { value, selectionStart, selectionEnd },\n data,\n}) => console.log('compositionupdate', {\n data,\n value,\n selectionStart,\n selectionEnd,\n});\nconst onCompositionEnd = () => console.log('compositionend');\n\nconst events = {\n input: onInput,\n compositionstart: onCompositionStart,\n compositionupdate: onCompositionUpdate,\n compositionend: onCompositionEnd,\n};\n\nexport const addDebugListeners = (input) => {\n Object.entries(events).forEach(([event, handler]) => input.addEventListener(event, handler)\n );\n};\n\nexport const removeDebugListeners = (input) => {\n Object.entries(events).forEach(([event, handler]) => input.removeEventListener(event, handler)\n );\n};\n","import { makeOnInput, onComposition, trackListeners } from './utils/dom';\nimport { addDebugListeners } from './utils/logInputEvents';\n\nconst ELEMENTS = ['TEXTAREA', 'INPUT'];\n\nlet idCounter = 0;\nconst newId = () => {\n idCounter += 1;\n return `${Date.now()}${idCounter}`;\n};\n\n/**\n * Binds eventListener for 'input' events to an input field to automagically replace values with kana\n * Can pass `{ IMEMode: 'toHiragana' || 'toKatakana' }` to enforce kana conversion type\n * @param {HTMLElement} element textarea, input[type=\"text\"] etc\n * @param {DefaultOptions} [options=defaultOptions] defaults to { IMEMode: true } using `toKana`\n * @example\n * bind(document.querySelector('#myInput'));\n */\nfunction bind(element = {}, options = {}, debug = false) {\n if (!ELEMENTS.includes(element.nodeName)) {\n throw new Error(\n `Element provided to Wanakana bind() was not a valid input or textarea element.\\n Received: (${JSON.stringify(\n element\n )})`\n );\n }\n if (element.hasAttribute('data-wanakana-id')) {\n return;\n }\n const onInput = makeOnInput(options);\n const id = newId();\n const attributes = [\n { name: 'data-wanakana-id', value: id },\n { name: 'lang', value: 'ja' },\n { name: 'autoCapitalize', value: 'none' },\n { name: 'autoCorrect', value: 'off' },\n { name: 'autoComplete', value: 'off' },\n { name: 'spellCheck', value: 'false' },\n ];\n const previousAttributes = {};\n attributes.forEach((attribute) => {\n previousAttributes[attribute.name] = element.getAttribute(attribute.name);\n element.setAttribute(attribute.name, attribute.value);\n });\n element.dataset.previousAttributes = JSON.stringify(previousAttributes);\n element.addEventListener('input', onInput);\n element.addEventListener('compositionupdate', onComposition);\n element.addEventListener('compositionend', onComposition);\n trackListeners(id, onInput, onComposition);\n if (debug === true) {\n addDebugListeners(element);\n }\n}\n\nexport default bind;\n","import isEmpty from './isEmpty';\nimport isCharInRange from './isCharInRange';\nimport { ROMAJI_RANGES } from '../constants';\n\n/**\n * Tests a character. Returns true if the character is [Romaji](https://en.wikipedia.org/wiki/Romaji) (allowing [Hepburn romanisation](https://en.wikipedia.org/wiki/Hepburn_romanization))\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharRomaji(char = '') {\n if (isEmpty(char)) return false;\n return ROMAJI_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharRomaji;\n","import typeOf from './utils/typeOf';\nimport isEmpty from './utils/isEmpty';\nimport isCharRomaji from './utils/isCharRomaji';\n\n/**\n * Test if `input` is [Romaji](https://en.wikipedia.org/wiki/Romaji) (allowing [Hepburn romanisation](https://en.wikipedia.org/wiki/Hepburn_romanization))\n * @param {String} [input=''] text\n * @param {Regexp} [allowed] additional test allowed to pass for each char\n * @return {Boolean} true if [Romaji](https://en.wikipedia.org/wiki/Romaji)\n * @example\n * isRomaji('Tōkyō and Ōsaka')\n * // => true\n * isRomaji('12a*b&c-d')\n * // => true\n * isRomaji('あアA')\n * // => false\n * isRomaji('お願い')\n * // => false\n * isRomaji('a!b&cーd') // Zenkaku punctuation fails\n * // => false\n * isRomaji('a!b&cーd', /[!ー]/)\n * // => true\n */\nfunction isRomaji(input = '', allowed) {\n const augmented = typeOf(allowed) === 'regexp';\n return isEmpty(input)\n ? false\n : [...input].every((char) => {\n const isRoma = isCharRomaji(char);\n return !augmented ? isRoma : isRoma || allowed.test(char);\n });\n}\n\nexport default isRomaji;\n","import {\n KATAKANA_START,\n KATAKANA_END,\n} from '../constants';\n\nimport isCharInRange from './isCharInRange';\n\n/**\n * Tests a character. Returns true if the character is [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharKatakana(char = '') {\n return isCharInRange(char, KATAKANA_START, KATAKANA_END);\n}\n\nexport default isCharKatakana;\n","import isEmpty from './isEmpty';\nimport isCharHiragana from './isCharHiragana';\nimport isCharKatakana from './isCharKatakana';\n\n/**\n * Tests a character. Returns true if the character is [Hiragana](https://en.wikipedia.org/wiki/Hiragana) or [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharKana(char = '') {\n if (isEmpty(char)) return false;\n return isCharHiragana(char) || isCharKatakana(char);\n}\n\nexport default isCharKana;\n","import isEmpty from './utils/isEmpty';\nimport isCharKana from './utils/isCharKana';\n\n/**\n * Test if `input` is [Kana](https://en.wikipedia.org/wiki/Kana) ([Katakana](https://en.wikipedia.org/wiki/Katakana) and/or [Hiragana](https://en.wikipedia.org/wiki/Hiragana))\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Kana](https://en.wikipedia.org/wiki/Kana)\n * @example\n * isKana('あ')\n * // => true\n * isKana('ア')\n * // => true\n * isKana('あーア')\n * // => true\n * isKana('A')\n * // => false\n * isKana('あAア')\n * // => false\n */\nfunction isKana(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharKana);\n}\n\nexport default isKana;\n","import isEmpty from './utils/isEmpty';\nimport isCharHiragana from './utils/isCharHiragana';\n\n/**\n * Test if `input` is [Hiragana](https://en.wikipedia.org/wiki/Hiragana)\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Hiragana](https://en.wikipedia.org/wiki/Hiragana)\n * @example\n * isHiragana('げーむ')\n * // => true\n * isHiragana('A')\n * // => false\n * isHiragana('あア')\n * // => false\n */\nfunction isHiragana(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharHiragana);\n}\n\nexport default isHiragana;\n","import isEmpty from './utils/isEmpty';\nimport isCharKatakana from './utils/isCharKatakana';\n\n/**\n * Test if `input` is [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * @example\n * isKatakana('ゲーム')\n * // => true\n * isKatakana('あ')\n * // => false\n * isKatakana('A')\n * // => false\n * isKatakana('あア')\n * // => false\n */\nfunction isKatakana(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharKatakana);\n}\n\nexport default isKatakana;\n","import isEmpty from './isEmpty';\nimport { KANJI_ITERATION_MARK } from '../constants';\n\n/**\n * Returns true if char is '々'\n * @param {String} char to test\n * @return {Boolean}\n */\nfunction isCharIterationMark(char = '') {\n if (isEmpty(char)) return false;\n return char.charCodeAt(0) === KANJI_ITERATION_MARK;\n}\n\nexport default isCharIterationMark;\n","import { KANJI_START, KANJI_END } from '../constants';\n\nimport isCharInRange from './isCharInRange';\nimport isCharIterationMark from './isCharIterationMark';\n/**\n * Tests a character. Returns true if the character is a CJK ideograph (kanji).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharKanji(char = '') {\n return isCharInRange(char, KANJI_START, KANJI_END) || isCharIterationMark(char);\n}\n\nexport default isCharKanji;\n","import isEmpty from './utils/isEmpty';\nimport isCharKanji from './utils/isCharKanji';\n\n/**\n * Tests if `input` is [Kanji](https://en.wikipedia.org/wiki/Kanji) ([Japanese CJK ideographs](https://en.wikipedia.org/wiki/CJK_Unified_Ideographs))\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Kanji](https://en.wikipedia.org/wiki/Kanji)\n * @example\n * isKanji('刀')\n * // => true\n * isKanji('切腹')\n * // => true\n * isKanji('勢い')\n * // => false\n * isKanji('あAア')\n * // => false\n * isKanji('🐸')\n * // => false\n */\nfunction isKanji(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharKanji);\n}\n\nexport default isKanji;\n","import isKanji from './isKanji';\nimport isHiragana from './isHiragana';\nimport isKatakana from './isKatakana';\nimport isRomaji from './isRomaji';\n\n/**\n * Test if `input` contains a mix of [Romaji](https://en.wikipedia.org/wiki/Romaji) *and* [Kana](https://en.wikipedia.org/wiki/Kana), defaults to pass through [Kanji](https://en.wikipedia.org/wiki/Kanji)\n * @param {String} input text\n * @param {Object} [options={ passKanji: true }] optional config to pass through kanji\n * @return {Boolean} true if mixed\n * @example\n * isMixed('Abあア'))\n * // => true\n * isMixed('お腹A')) // ignores kanji by default\n * // => true\n * isMixed('お腹A', { passKanji: false }))\n * // => false\n * isMixed('ab'))\n * // => false\n * isMixed('あア'))\n * // => false\n */\nfunction isMixed(input = '', options = { passKanji: true }) {\n const chars = [...input];\n let hasKanji = false;\n if (!options.passKanji) {\n hasKanji = chars.some(isKanji);\n }\n return (chars.some(isHiragana) || chars.some(isKatakana)) && chars.some(isRomaji) && !hasKanji;\n}\n\nexport default isMixed;\n","import { KATAKANA_START, HIRAGANA_START } from '../constants';\n\nimport isCharLongDash from './isCharLongDash';\nimport isCharSlashDot from './isCharSlashDot';\nimport isCharKatakana from './isCharKatakana';\nconst isCharInitialLongDash = (char, index) => isCharLongDash(char) && index < 1;\nconst isCharInnerLongDash = (char, index) => isCharLongDash(char) && index > 0;\nconst isKanaAsSymbol = (char) => ['ヶ', 'ヵ'].includes(char);\nconst LONG_VOWELS = {\n a: 'あ',\n i: 'い',\n u: 'う',\n e: 'え',\n o: 'う',\n};\n\n// inject toRomaji to avoid circular dependency between toRomaji <-> katakanaToHiragana\nfunction katakanaToHiragana(\n input = '',\n toRomaji,\n { isDestinationRomaji, convertLongVowelMark } = {}\n) {\n let previousKana = '';\n\n return input\n .split('')\n .reduce((hira, char, index) => {\n // Short circuit to avoid incorrect codeshift for 'ー' and '・'\n if (\n isCharSlashDot(char)\n || isCharInitialLongDash(char, index)\n || isKanaAsSymbol(char)\n ) {\n return hira.concat(char);\n }\n\n // Transform long vowels: 'オー' to 'おう'\n if (\n convertLongVowelMark\n && previousKana\n && isCharInnerLongDash(char, index)\n ) {\n // Transform previousKana back to romaji, and slice off the vowel\n const romaji = toRomaji(previousKana).slice(-1);\n // However, ensure 'オー' => 'おお' => 'oo' if this is a transform on the way to romaji\n if (\n isCharKatakana(input[index - 1])\n && romaji === 'o'\n && isDestinationRomaji\n ) {\n return hira.concat('お');\n }\n return hira.concat(LONG_VOWELS[romaji]);\n // Transform all other chars\n }\n\n if (!isCharLongDash(char) && isCharKatakana(char)) {\n const code = char.charCodeAt(0) + (HIRAGANA_START - KATAKANA_START);\n const hiraChar = String.fromCharCode(code);\n previousKana = hiraChar;\n return hira.concat(hiraChar);\n }\n\n // Pass non katakana chars through\n previousKana = '';\n return hira.concat(char);\n }, [])\n .join('');\n}\n\nexport default katakanaToHiragana;\n","import { transform, getSubTreeOf } from './kanaMapping';\nimport { ROMANIZATIONS } from '../constants';\n\nlet kanaToHepburnMap = null;\n\n/* eslint-disable */\n// prettier-ignore\nconst BASIC_ROMAJI = {\n あ:'a', い:'i', う:'u', え:'e', お:'o',\n か:'ka', き:'ki', く:'ku', け:'ke', こ:'ko',\n さ:'sa', し:'shi', す:'su', せ:'se', そ:'so',\n た:'ta', ち:'chi', つ:'tsu', て:'te', と:'to',\n な:'na', に:'ni', ぬ:'nu', ね:'ne', の:'no',\n は:'ha', ひ:'hi', ふ:'fu', へ:'he', ほ:'ho',\n ま:'ma', み:'mi', む:'mu', め:'me', も:'mo',\n ら:'ra', り:'ri', る:'ru', れ:'re', ろ:'ro',\n や:'ya', ゆ:'yu', よ:'yo',\n わ:'wa', ゐ:'wi', ゑ:'we', を:'wo',\n ん: 'n',\n が:'ga', ぎ:'gi', ぐ:'gu', げ:'ge', ご:'go',\n ざ:'za', じ:'ji', ず:'zu', ぜ:'ze', ぞ:'zo',\n だ:'da', ぢ:'ji', づ:'zu', で:'de', ど:'do',\n ば:'ba', び:'bi', ぶ:'bu', べ:'be', ぼ:'bo',\n ぱ:'pa', ぴ:'pi', ぷ:'pu', ぺ:'pe', ぽ:'po',\n ゔぁ:'va', ゔぃ:'vi', ゔ:'vu', ゔぇ:'ve', ゔぉ:'vo',\n};\n/* eslint-enable */\n\nconst SPECIAL_SYMBOLS = {\n '。': '.',\n '、': ',',\n ':': ':',\n '・': '/',\n '!': '!',\n '?': '?',\n '〜': '~',\n 'ー': '-',\n '「': '‘',\n '」': '’',\n '『': '“',\n '』': '”',\n '[': '[',\n ']': ']',\n '(': '(',\n ')': ')',\n '{': '{',\n '}': '}',\n ' ': ' ',\n};\n\n// んい -> n'i\nconst AMBIGUOUS_VOWELS = ['あ', 'い', 'う', 'え', 'お', 'や', 'ゆ', 'よ'];\nconst SMALL_Y = { ゃ: 'ya', ゅ: 'yu', ょ: 'yo' };\nconst SMALL_Y_EXTRA = { ぃ: 'yi', ぇ: 'ye' };\nconst SMALL_AIUEO = {\n ぁ: 'a',\n ぃ: 'i',\n ぅ: 'u',\n ぇ: 'e',\n ぉ: 'o',\n};\nconst YOON_KANA = [\n 'き',\n 'に',\n 'ひ',\n 'み',\n 'り',\n 'ぎ',\n 'び',\n 'ぴ',\n 'ゔ',\n 'く',\n 'ふ',\n];\nconst YOON_EXCEPTIONS = {\n し: 'sh',\n ち: 'ch',\n じ: 'j',\n ぢ: 'j',\n};\nconst SMALL_KANA = {\n っ: '',\n ゃ: 'ya',\n ゅ: 'yu',\n ょ: 'yo',\n ぁ: 'a',\n ぃ: 'i',\n ぅ: 'u',\n ぇ: 'e',\n ぉ: 'o',\n};\n\n// going with the intuitive (yet incorrect) solution where っや -> yya and っぃ -> ii\n// in other words, just assume the sokuon could have been applied to anything\nconst SOKUON_WHITELIST = {\n b: 'b',\n c: 't',\n d: 'd',\n f: 'f',\n g: 'g',\n h: 'h',\n j: 'j',\n k: 'k',\n m: 'm',\n p: 'p',\n q: 'q',\n r: 'r',\n s: 's',\n t: 't',\n v: 'v',\n w: 'w',\n x: 'x',\n z: 'z',\n};\n\nfunction getKanaToHepburnTree() {\n if (kanaToHepburnMap == null) {\n kanaToHepburnMap = createKanaToHepburnMap();\n }\n return kanaToHepburnMap;\n}\n\nexport function getKanaToRomajiTree(romanization) {\n switch (romanization) {\n case ROMANIZATIONS.HEPBURN:\n return getKanaToHepburnTree();\n default:\n return {};\n }\n}\n\nfunction createKanaToHepburnMap() {\n const romajiTree = transform(BASIC_ROMAJI);\n\n const subtreeOf = (string) => getSubTreeOf(romajiTree, string);\n const setTrans = (string, transliteration) => {\n subtreeOf(string)[''] = transliteration;\n };\n\n Object.entries(SPECIAL_SYMBOLS).forEach(([jsymbol, symbol]) => {\n subtreeOf(jsymbol)[''] = symbol;\n });\n\n [...Object.entries(SMALL_Y), ...Object.entries(SMALL_AIUEO)].forEach(\n ([roma, kana]) => {\n setTrans(roma, kana);\n }\n );\n\n // きゃ -> kya\n YOON_KANA.forEach((kana) => {\n const firstRomajiChar = subtreeOf(kana)[''][0];\n Object.entries(SMALL_Y).forEach(([yKana, yRoma]) => {\n setTrans(kana + yKana, firstRomajiChar + yRoma);\n });\n // きぃ -> kyi\n Object.entries(SMALL_Y_EXTRA).forEach(([yKana, yRoma]) => {\n setTrans(kana + yKana, firstRomajiChar + yRoma);\n });\n });\n\n Object.entries(YOON_EXCEPTIONS).forEach(([kana, roma]) => {\n // じゃ -> ja\n Object.entries(SMALL_Y).forEach(([yKana, yRoma]) => {\n setTrans(kana + yKana, roma + yRoma[1]);\n });\n // じぃ -> jyi, じぇ -> je\n setTrans(`${kana}ぃ`, `${roma}yi`);\n setTrans(`${kana}ぇ`, `${roma}e`);\n });\n\n romajiTree['っ'] = resolveTsu(romajiTree);\n\n Object.entries(SMALL_KANA).forEach(([kana, roma]) => {\n setTrans(kana, roma);\n });\n\n AMBIGUOUS_VOWELS.forEach((kana) => {\n setTrans(`ん${kana}`, `n'${subtreeOf(kana)['']}`);\n });\n\n // NOTE: could be re-enabled with an option?\n // // んば -> mbo\n // const LABIAL = [\n // 'ば', 'び', 'ぶ', 'べ', 'ぼ',\n // 'ぱ', 'ぴ', 'ぷ', 'ぺ', 'ぽ',\n // 'ま', 'み', 'む', 'め', 'も',\n // ];\n // LABIAL.forEach((kana) => {\n // setTrans(`ん${kana}`, `m${subtreeOf(kana)['']}`);\n // });\n\n return Object.freeze(JSON.parse(JSON.stringify(romajiTree)));\n}\n\nfunction resolveTsu(tree) {\n return Object.entries(tree).reduce((tsuTree, [key, value]) => {\n if (!key) {\n // we have reached the bottom of this branch\n const consonant = value.charAt(0);\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = Object.keys(SOKUON_WHITELIST).includes(consonant)\n ? SOKUON_WHITELIST[consonant] + value\n : value;\n } else {\n // more subtrees\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = resolveTsu(value);\n }\n return tsuTree;\n }, {});\n}\n","import memoizeOne from 'memoize-one';\nimport { dequal } from 'dequal';\n\nimport mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport katakanaToHiragana from './utils/katakanaToHiragana';\nimport isKatakana from './isKatakana';\nimport { getKanaToRomajiTree } from './utils/kanaToRomajiMap';\nimport { applyMapping, mergeCustomMapping } from './utils/kanaMapping';\n\n// memoize and deeply compare args so we only recreate when necessary\nexport const createKanaToRomajiMap = memoizeOne(\n (romanization, customRomajiMapping) => {\n let map = getKanaToRomajiTree(romanization);\n\n if (customRomajiMapping) {\n map = mergeCustomMapping(map, customRomajiMapping);\n }\n\n return map;\n },\n dequal\n);\n\n/**\n * Convert kana to romaji\n * @param {String} kana text input\n * @param {DefaultOptions} [options=defaultOptions]\n * @param {Object} map custom mapping\n * @return {String} converted text\n * @example\n * toRomaji('ひらがな カタカナ')\n * // => 'hiragana katakana'\n * toRomaji('げーむ ゲーム')\n * // => 'ge-mu geemu'\n * toRomaji('ひらがな カタカナ', { upcaseKatakana: true })\n * // => 'hiragana KATAKANA'\n * toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' } });\n * // => 'tuzigili'\n */\nexport function toRomaji(input = '', options = {}, map) {\n const config = mergeWithDefaultOptions(options);\n\n if (!map) {\n map = createKanaToRomajiMap(\n config.romanization,\n config.customRomajiMapping\n );\n }\n\n // just throw away the substring index information and simply concatenate all the kana\n return splitIntoRomaji(input, config, map)\n .map((romajiToken) => {\n const [start, end, romaji] = romajiToken;\n const makeUpperCase = config.upcaseKatakana && isKatakana(input.slice(start, end));\n return makeUpperCase ? romaji.toUpperCase() : romaji;\n })\n .join('');\n}\n\nfunction splitIntoRomaji(input, options, map) {\n if (!map) {\n map = createKanaToRomajiMap(\n options.romanization,\n options.customRomajiMapping\n );\n }\n\n const config = Object.assign({}, { isDestinationRomaji: true }, options);\n\n return applyMapping(\n katakanaToHiragana(input, toRomaji, config),\n map,\n !options.IMEMode\n );\n}\n\nexport default toRomaji;\n","import isEmpty from './isEmpty';\nimport { EN_PUNCTUATION_RANGES } from '../constants';\nimport isCharInRange from './isCharInRange';\n\n/**\n * Tests a character. Returns true if the character is considered English punctuation.\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharEnglishPunctuation(char = '') {\n if (isEmpty(char)) return false;\n return EN_PUNCTUATION_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharEnglishPunctuation;\n","import isEmpty from './isEmpty';\nimport { JA_PUNCTUATION_RANGES } from '../constants';\nimport isCharInRange from './isCharInRange';\nimport isCharIterationMark from './isCharIterationMark';\n\n/**\n * Tests a character. Returns true if the character is considered Japanese punctuation.\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharJapanesePunctuation(char = '') {\n if (isEmpty(char) || isCharIterationMark(char)) return false;\n return JA_PUNCTUATION_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharJapanesePunctuation;\n","import isEmpty from './utils/isEmpty';\nimport isCharEnglishPunctuation from './utils/isCharEnglishPunctuation';\nimport isCharJapanesePunctuation from './utils/isCharJapanesePunctuation';\nimport isCharRomaji from './utils/isCharRomaji';\nimport isCharKanji from './utils/isCharKanji';\nimport isCharHiragana from './utils/isCharHiragana';\nimport isCharKatakana from './utils/isCharKatakana';\nimport isCharJapanese from './utils/isCharJapanese';\n\nconst isCharEnSpace = (x) => x === ' ';\nconst isCharJaSpace = (x) => x === ' ';\nconst isCharJaNum = (x) => /[0-9]/.test(x);\nconst isCharEnNum = (x) => /[0-9]/.test(x);\n\nexport const TOKEN_TYPES = {\n EN: 'en',\n JA: 'ja',\n EN_NUM: 'englishNumeral',\n JA_NUM: 'japaneseNumeral',\n EN_PUNC: 'englishPunctuation',\n JA_PUNC: 'japanesePunctuation',\n KANJI: 'kanji',\n HIRAGANA: 'hiragana',\n KATAKANA: 'katakana',\n SPACE: 'space',\n OTHER: 'other',\n};\n\n// prettier-ignore\nexport function getType(input, compact = false) {\n const {\n EN, JA, EN_NUM, JA_NUM, EN_PUNC, JA_PUNC, KANJI, HIRAGANA, KATAKANA, SPACE, OTHER,\n } = TOKEN_TYPES;\n\n if (compact) {\n switch (true) {\n case isCharJaNum(input): return OTHER;\n case isCharEnNum(input): return OTHER;\n case isCharEnSpace(input): return EN;\n case isCharEnglishPunctuation(input): return OTHER;\n case isCharJaSpace(input): return JA;\n case isCharJapanesePunctuation(input): return OTHER;\n case isCharJapanese(input): return JA;\n case isCharRomaji(input): return EN;\n default: return OTHER;\n }\n } else {\n switch (true) {\n case isCharJaSpace(input): return SPACE;\n case isCharEnSpace(input): return SPACE;\n case isCharJaNum(input): return JA_NUM;\n case isCharEnNum(input): return EN_NUM;\n case isCharEnglishPunctuation(input): return EN_PUNC;\n case isCharJapanesePunctuation(input): return JA_PUNC;\n case isCharKanji(input): return KANJI;\n case isCharHiragana(input): return HIRAGANA;\n case isCharKatakana(input): return KATAKANA;\n case isCharJapanese(input): return JA;\n case isCharRomaji(input): return EN;\n default: return OTHER;\n }\n }\n}\n\n/**\n * Splits input into array of strings separated by opinionated token types\n * `'en', 'ja', 'englishNumeral', 'japaneseNumeral','englishPunctuation', 'japanesePunctuation','kanji', 'hiragana', 'katakana', 'space', 'other'`.\n * If `{ compact: true }` then many same-language tokens are combined (spaces + text, kanji + kana, numeral + punctuation).\n * If `{ detailed: true }` then return array will contain `{ type, value }` instead of `'value'`\n * @param {String} input text\n * @param {Object} [options={ compact: false, detailed: false}] options to modify output style\n * @return {String|Object[]} text split into tokens containing values, or detailed object\n * @example\n * tokenize('ふふフフ')\n * // ['ふふ', 'フフ']\n *\n * tokenize('感じ')\n * // ['感', 'じ']\n *\n * tokenize('人々')\n * // ['人々']\n *\n * tokenize('truly 私は悲しい')\n * // ['truly', ' ', '私', 'は', '悲', 'しい']\n *\n * tokenize('truly 私は悲しい', { compact: true })\n * // ['truly ', '私は悲しい']\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。!')\n * // [ '5', 'romaji', ' ', 'here', '...!?', '人々漢字', 'ひらがな', 'カタ', ' ', 'カナ', '4', '「', 'SHIO', '」。!']\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。!', { compact: true })\n * // [ '5', 'romaji here', '...!?', '人々漢字ひらがなカタ カナ', '4「', 'SHIO', '」。!']\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。! لنذهب', { detailed: true })\n * // [\n * { type: 'englishNumeral', value: '5' },\n * { type: 'en', value: 'romaji' },\n * { type: 'space', value: ' ' },\n * { type: 'en', value: 'here' },\n * { type: 'englishPunctuation', value: '...!?' },\n * { type: 'kanji', value: '人々漢字' },\n * { type: 'hiragana', value: 'ひらがな' },\n * { type: 'katakana', value: 'カタ' },\n * { type: 'space', value: ' ' },\n * { type: 'katakana', value: 'カナ' },\n * { type: 'japaneseNumeral', value: '4' },\n * { type: 'japanesePunctuation', value: '「' },\n * { type: 'ja', value: 'SHIO' },\n * { type: 'japanesePunctuation', value: '」。!' },\n * { type: 'space', value: ' ' },\n * { type: 'other', value: 'لنذهب' },\n * ]\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。! لنذهب', { compact: true, detailed: true})\n * // [\n * { type: 'other', value: '5' },\n * { type: 'en', value: 'romaji here' },\n * { type: 'other', value: '...!?' },\n * { type: 'ja', value: '人々漢字ひらがなカタ カナ' },\n * { type: 'other', value: '4「' },\n * { type: 'ja', value: 'SHIO' },\n * { type: 'other', value: '」。!' },\n * { type: 'en', value: ' ' },\n * { type: 'other', value: 'لنذهب' },\n *]\n */\nfunction tokenize(input, { compact = false, detailed = false } = {}) {\n if (input == null || isEmpty(input)) {\n return [];\n }\n const chars = [...input];\n let initial = chars.shift();\n let prevType = getType(initial, compact);\n initial = detailed ? { type: prevType, value: initial } : initial;\n\n const result = chars.reduce(\n (tokens, char) => {\n const currType = getType(char, compact);\n const sameType = currType === prevType;\n prevType = currType;\n let newValue = char;\n\n if (sameType) {\n newValue = (detailed ? tokens.pop().value : tokens.pop()) + newValue;\n }\n\n return detailed\n ? tokens.concat({ type: currType, value: newValue })\n : tokens.concat(newValue);\n },\n [initial]\n );\n return result;\n}\n\nexport default tokenize;\n","import isJapanese from './isJapanese';\nimport isKana from './isKana';\nimport isKanji from './isKanji';\nimport tokenize from './tokenize';\n\nconst isLeadingWithoutInitialKana = (input, leading) => leading && !isKana(input[0]);\nconst isTrailingWithoutFinalKana = (input, leading) => !leading && !isKana(input[input.length - 1]);\nconst isInvalidMatcher = (input, matchKanji) =>\n (matchKanji && ![...matchKanji].some(isKanji)) || (!matchKanji && isKana(input));\n\n/**\n * Strips [Okurigana](https://en.wikipedia.org/wiki/Okurigana)\n * @param {String} input text\n * @param {Object} [options={ leading: false, matchKanji: '' }] optional config\n * @return {String} text with okurigana removed\n * @example\n * stripOkurigana('踏み込む')\n * // => '踏み込'\n * stripOkurigana('お祝い')\n * // => 'お祝'\n * stripOkurigana('お腹', { leading: true });\n * // => '腹'\n * stripOkurigana('ふみこむ', { matchKanji: '踏み込む' });\n * // => 'ふみこ'\n * stripOkurigana('おみまい', { matchKanji: 'お祝い', leading: true });\n * // => 'みまい'\n */\nfunction stripOkurigana(input = '', { leading = false, matchKanji = '' } = {}) {\n if (\n !isJapanese(input) ||\n isLeadingWithoutInitialKana(input, leading) ||\n isTrailingWithoutFinalKana(input, leading) ||\n isInvalidMatcher(input, matchKanji)\n ) {\n return input;\n }\n\n const chars = matchKanji || input;\n const okuriganaRegex = new RegExp(\n leading ? `^${tokenize(chars).shift()}` : `${tokenize(chars).pop()}$`\n );\n return input.replace(okuriganaRegex, '');\n}\n\nexport default stripOkurigana;\n","import mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport katakanaToHiragana from './utils/katakanaToHiragana';\nimport isCharEnglishPunctuation from './utils/isCharEnglishPunctuation';\nimport isRomaji from './isRomaji';\nimport isMixed from './isMixed';\nimport toKana from './toKana';\nimport toRomaji from './toRomaji';\n\n/**\n * Convert input to [Hiragana](https://en.wikipedia.org/wiki/Hiragana)\n * @param {String} [input=''] text\n * @param {DefaultOptions} [options=defaultOptions]\n * @return {String} converted text\n * @example\n * toHiragana('toukyou, オオサカ')\n * // => 'とうきょう、 おおさか'\n * toHiragana('only カナ', { passRomaji: true })\n * // => 'only かな'\n * toHiragana('wi')\n * // => 'うぃ'\n * toHiragana('wi', { useObsoleteKana: true })\n * // => 'ゐ'\n */\nfunction toHiragana(input = '', options = {}) {\n const config = mergeWithDefaultOptions(options);\n if (config.passRomaji) {\n return katakanaToHiragana(input, toRomaji, config);\n }\n\n if (isMixed(input, { passKanji: true })) {\n const convertedKatakana = katakanaToHiragana(input, toRomaji, config);\n return toKana(convertedKatakana.toLowerCase(), config);\n }\n\n if (isRomaji(input) || isCharEnglishPunctuation(input)) {\n return toKana(input.toLowerCase(), config);\n }\n\n return katakanaToHiragana(input, toRomaji, config);\n}\n\nexport default toHiragana;\n","import mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport hiraganaToKatakana from './utils/hiraganaToKatakana';\nimport isCharEnglishPunctuation from './utils/isCharEnglishPunctuation';\nimport toKana from './toKana';\nimport isRomaji from './isRomaji';\nimport isMixed from './isMixed';\n\n/**\n * Convert input to [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * @param {String} [input=''] text\n * @param {DefaultOptions} [options=defaultOptions]\n * @return {String} converted text\n * @example\n * toKatakana('toukyou, おおさか')\n * // => 'トウキョウ、 オオサカ'\n * toKatakana('only かな', { passRomaji: true })\n * // => 'only カナ'\n * toKatakana('wi')\n * // => 'ウィ'\n * toKatakana('wi', { useObsoleteKana: true })\n * // => 'ヰ'\n */\nfunction toKatakana(input = '', options = {}) {\n const mergedOptions = mergeWithDefaultOptions(options);\n if (mergedOptions.passRomaji) {\n return hiraganaToKatakana(input);\n }\n\n if (isMixed(input) || isRomaji(input) || isCharEnglishPunctuation(input)) {\n const hiragana = toKana(input.toLowerCase(), mergedOptions);\n return hiraganaToKatakana(hiragana);\n }\n\n return hiraganaToKatakana(input);\n}\n\nexport default toKatakana;\n","import { findListeners, untrackListeners } from './utils/dom';\nimport { removeDebugListeners } from './utils/logInputEvents';\n\n/**\n * Unbinds eventListener from input field\n * @param {HTMLElement} element textarea, input\n */\nexport function unbind(element, debug = false) {\n const listeners = findListeners(element);\n if (listeners == null) {\n throw new Error(\n `Element provided to Wanakana unbind() had no listener registered.\\n Received: ${JSON.stringify(\n element\n )}`\n );\n }\n const { inputHandler, compositionHandler } = listeners;\n const attributes = JSON.parse(element.dataset.previousAttributes);\n Object.keys(attributes).forEach((key) => {\n if (attributes[key]) {\n element.setAttribute(key, attributes[key]);\n } else {\n element.removeAttribute(key);\n }\n });\n element.removeAttribute('data-previous-attributes');\n element.removeAttribute('data-ignore-composition');\n element.removeEventListener('input', inputHandler);\n element.removeEventListener('compositionstart', compositionHandler);\n element.removeEventListener('compositionupdate', compositionHandler);\n element.removeEventListener('compositionend', compositionHandler);\n untrackListeners(listeners);\n if (debug === true) {\n removeDebugListeners(element);\n }\n}\n\nexport default unbind;\n"],"names":["typeOf","value","Object","_typeof","toString","call","slice","toLowerCase","isEmpty","input","length","isCharInRange","char","start","arguments","undefined","end","code","charCodeAt","VERSION","TO_KANA_METHODS","HIRAGANA","KATAKANA","ROMANIZATIONS","HEPBURN","DEFAULT_OPTIONS","useObsoleteKana","passRomaji","upcaseKatakana","IMEMode","convertLongVowelMark","romanization","HIRAGANA_START","KATAKANA_START","KANA_PUNCTUATION","JA_PUNCTUATION_RANGES","JAPANESE_RANGES","concat","ZENKAKU_UPPERCASE","ROMAJI_RANGES","EN_PUNCTUATION_RANGES","SMART_QUOTE_RANGES","isCharJapanese","some","_ref","_ref2","_slicedToArray","isJapanese","allowed","augmented","_toConsumableArray","every","isJa","test","safeIsNaN","Number","isNaN","areInputsEqual","newInputs","lastInputs","i","first","second","memoizeOne","resultFn","isEqual","cache","memoized","newArgs","_i","lastThis","this","lastArgs","lastResult","apply","clear","has","prototype","hasOwnProperty","find","iter","tar","key","_step","keys","_iterator","s","n","done","dequal","err","e","f","foo","bar","ctor","len","tmp","constructor","Date","getTime","RegExp","Array","Set","size","_step2","_iterator2","_createForOfIteratorHelper","Map","_step3","_iterator3","get","ArrayBuffer","Uint8Array","DataView","byteLength","getInt8","isView","mergeWithDefaultOptions","opts","assign","applyMapping","string","mapping","convertEnding","root","newChunk","remaining","currentCursor","firstChar","charAt","parse","tree","lastCursor","subtree","nextChar","nextSubtree","transform","entries","reduce","map","endOfBranch","getSubTreeOf","split","correctSubTree","createCustomMapping","customMap","customTree","forEach","_ref3","_ref4","roma","kana","subTree","transformMap","mapSubtree","customSubtree","newSubtree","_ref5","_ref6","JSON","stringify","mergeCustomMapping","customMapping","BASIC_KUNREI","a","u","o","k","t","h","m","y","r","w","g","z","d","b","p","v","SPECIAL_SYMBOLS","CONSONANTS","q","SMALL_Y","ya","yi","yu","ye","yo","SMALL_VOWELS","ALIASES","sh","ch","cy","chy","shy","j","jy","shi","chi","tsu","ji","fu","SMALL_LETTERS","tu","wa","ka","ke","SPECIAL_CASES","wu","wi","we","kwa","whu","tha","thu","tho","dha","dhu","dho","AIUEO_CONSTRUCTIONS","wh","kw","qw","gw","sw","ts","th","tw","dh","dw","fw","createRomajiToKanaMap","kanaTree","subtreeOf","addTsu","tsuTree","_ref19","_ref20","consonant","yKana","symbol","jsymbol","_ref7","_ref8","aiueoKana","_ref9","_ref10","vowel","nChar","c","_ref11","_ref12","alternative","allExceptLast","last","_ref15","_ref16","kunreiRoma","chars","xRoma","xSubtree","list","_ref13","_ref14","alt","startsWith","replace","altRoma","prefix","_ref17","_ref18","freeze","romajiToKanaMap","USE_OBSOLETE_KANA_MAP","isCharUpperCase","isCharLongDash","isCharSlashDot","isCharHiragana","hiraganaToKatakana","kata","push","kataChar","String","fromCharCode","join","customKanaMapping","mapCopy","IME_MODE_MAP","toKana","config","options","splitIntoConvertedKana","kanaToken","_kanaToken","enforceHiragana","enforceKatakana","LISTENERS","makeOnInput","prevInput","mergedConfig","preConfiguredMap","triggers","toUpperCase","target","dataset","ignoreComposition","splitInput","_splitInput2","text","head","toConvert","tail","cursor","includes","_workFromStart2","workFromStart","_workBackwards2","workBackwards","_takeWhileAndSlice2","takeWhileAndSlice","_takeWhileAndSlice4","selectionEnd","textToConvert","convertedText","newCursor","newValue","setTimeout","setSelectionRange","convertInput","onComposition","type","data","window","navigator","platform","trackListeners","id","inputHandler","compositionHandler","untrackListeners","targetId","filter","findListeners","el","getAttribute","catalystChars","startIndex","_takeWhileAndSlice5","reverse","_takeWhileAndSlice6","source","predicate","x","result","events","_ref$target","selectionStart","console","log","compositionstart","compositionupdate","_ref2$target","compositionend","addDebugListeners","event","handler","addEventListener","removeDebugListeners","removeEventListener","ELEMENTS","idCounter","newId","now","isCharRomaji","isRomaji","isRoma","isCharKatakana","isCharKana","isKana","isHiragana","isKatakana","isCharIterationMark","isCharKanji","isKanji","isMixed","passKanji","hasKanji","isCharInitialLongDash","index","isCharInnerLongDash","isKanaAsSymbol","LONG_VOWELS","katakanaToHiragana","toRomaji","isDestinationRomaji","previousKana","hira","romaji","hiraChar","kanaToHepburnMap","BASIC_ROMAJI","あ","い","う","え","お","か","き","く","け","こ","さ","し","す","せ","そ","た","ち","つ","て","と","な","に","ぬ","ね","の","は","ひ","ふ","へ","ほ","ま","み","む","め","も","ら","り","る","れ","ろ","や","ゆ","よ","わ","ゐ","ゑ","を","ん","が","ぎ","ぐ","げ","ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で","ど","ば","び","ぶ","べ","ぼ","ぱ","ぴ","ぷ","ぺ","ぽ","ゔぁ","ゔぃ","ゔ","ゔぇ","ゔぉ","AMBIGUOUS_VOWELS","ゃ","ゅ","ょ","SMALL_Y_EXTRA","ぃ","ぇ","SMALL_AIUEO","ぁ","ぅ","ぉ","YOON_KANA","YOON_EXCEPTIONS","SMALL_KANA","っ","SOKUON_WHITELIST","getKanaToHepburnTree","romajiTree","setTrans","transliteration","firstRomajiChar","yRoma","resolveTsu","createKanaToRomajiMap","customRomajiMapping","getKanaToRomajiTree","splitIntoRomaji","romajiToken","_romajiToken","isCharEnglishPunctuation","isCharJapanesePunctuation","isCharEnSpace","isCharJaSpace","isCharJaNum","isCharEnNum","TOKEN_TYPES","getType","compact","EN","JA","EN_NUM","JA_NUM","EN_PUNC","JA_PUNC","KANJI","SPACE","OTHER","tokenize","_ref$compact","_ref$detailed","detailed","initial","shift","prevType","tokens","currType","sameType","pop","isLeadingWithoutInitialKana","leading","isTrailingWithoutFinalKana","isInvalidMatcher","matchKanji","element","debug","nodeName","Error","hasAttribute","onInput","attributes","name","previousAttributes","attribute","setAttribute","_ref$leading","_ref$matchKanji","okuriganaRegex","convertedKatakana","mergedOptions","hiragana","listeners","removeAttribute"],"mappings":"y4EAmBA,SAASA,EAAOC,GACVA,OAAU,OAAVA,EACK,OAELA,IAAUC,OAAOD,GACnBE,EAAcF,GAET,GAAGG,SACPC,KAAKJ,GACLK,MAAM,GAAI,GACVC,cCvBL,SAASC,EAAQC,GACf,MAAsB,WAAlBT,EAAOS,KAGHA,EAAMC,OCDhB,SAASC,IAAcC,IAAAA,yDAAO,GAAIC,EAAYC,UAAAJ,OAAA,EAAAI,UAAA,QAAAC,EAALC,EAAKF,UAAAJ,OAAA,EAAAI,UAAA,QAAAC,EAC5C,GAAIP,EAAQI,GAAO,OAAO,EAC1B,IAAMK,EAAOL,EAAKM,WAAW,GAC7B,OAAOL,GAASI,GAAQA,GAAQD,ECZrBG,IAEAC,EAAk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EAAmBwR,GAGrBxR,OAAAA,EAAmB/Q,yCC1BrB,SAAgBuhB,GAASC,IAAAA,0DACxBgB,EAAYzN,GAAcwM,GAC5BiB,GAAa,MAAbA,EACI,MAAA,IAAId,MACyEnY,iFAAAA,OAAAA,KAAKC,UACpF+X,KAIN,IAAQ7M,EAAqC8N,EAArC9N,aAAcC,EAAuB6N,EAAvB7N,mBAChBkN,EAAatY,KAAK7B,MAAM6Z,EAAQ9O,QAAQsP,oBAC9CtiB,OAAOkF,KAAKkd,GAAYlZ,SAAQ,SAAClE,GAC3Bod,EAAWpd,GACb8c,EAAQU,aAAaxd,EAAKod,EAAWpd,IAErC8c,EAAQkB,gBAAgBhe,MAG5B8c,EAAQkB,gBAAgB,4BACxBlB,EAAQkB,gBAAgB,2BACxBlB,EAAQ9K,oBAAoB,QAAS/B,GACrC6M,EAAQ9K,oBAAoB,mBAAoB9B,GAChD4M,EAAQ9K,oBAAoB,oBAAqB9B,GACjD4M,EAAQ9K,oBAAoB,iBAAkB9B,GAC9CC,GAAiB4N,IACH,IAAVhB,GACFhL,GAAqB+K"} \ No newline at end of file +{"version":3,"file":"wanakana.min.js","sources":["../src/utils/typeOf.js","../src/utils/isEmpty.js","../src/utils/isCharInRange.js","../src/constants.ts","../src/utils/isCharJapanese.js","../src/isJapanese.js","../node_modules/memoize-one/dist/memoize-one.esm.js","../node_modules/dequal/dist/index.mjs","../src/utils/mergeWithDefaultOptions.js","../src/utils/kanaMapping.js","../src/utils/romajiToKanaMap.js","../src/utils/isCharUpperCase.js","../src/utils/isCharLongDash.js","../src/utils/isCharSlashDot.js","../src/utils/isCharHiragana.js","../src/utils/hiraganaToKatakana.js","../src/toKana.js","../src/utils/dom.js","../src/utils/logInputEvents.js","../src/bind.js","../src/utils/isCharRomaji.js","../src/isRomaji.js","../src/utils/isCharKatakana.js","../src/utils/isCharKana.js","../src/isKana.js","../src/isHiragana.js","../src/isKatakana.js","../src/utils/isCharIterationMark.js","../src/utils/isCharKanji.js","../src/isKanji.js","../src/isMixed.js","../src/utils/katakanaToHiragana.js","../src/utils/kanaToRomajiMap.js","../src/toRomaji.js","../src/utils/isCharEnglishPunctuation.js","../src/utils/isCharJapanesePunctuation.js","../src/tokenize.js","../src/stripOkurigana.js","../src/toHiragana.js","../src/toKatakana.js","../src/unbind.js"],"sourcesContent":["/**\n * Returns detailed type as string (instead of just 'object' for arrays etc)\n * @private\n * @param {any} value js value\n * @returns {String} type of value\n * @example\n * typeOf({}); // 'object'\n * typeOf([]); // 'array'\n * typeOf(function() {}); // 'function'\n * typeOf(/a/); // 'regexp'\n * typeOf(new Date()); // 'date'\n * typeOf(null); // 'null'\n * typeOf(undefined); // 'undefined'\n * typeOf('a'); // 'string'\n * typeOf(1); // 'number'\n * typeOf(true); // 'boolean'\n * typeOf(new Map()); // 'map'\n * typeOf(new Set()); // 'map'\n */\nfunction typeOf(value) {\n if (value === null) {\n return 'null';\n }\n if (value !== Object(value)) {\n return typeof value;\n }\n return {}.toString\n .call(value)\n .slice(8, -1)\n .toLowerCase();\n}\n\nexport default typeOf;\n","import typeOf from './typeOf';\n/**\n * Checks if input string is empty\n * @param {String} input text input\n * @return {Boolean} true if no input\n */\nfunction isEmpty(input) {\n if (typeOf(input) !== 'string') {\n return true;\n }\n return !input.length;\n}\n\nexport default isEmpty;\n","import isEmpty from './isEmpty';\n\n/**\n * Takes a character and a unicode range. Returns true if the char is in the range.\n * @param {String} char unicode character\n * @param {Number} start unicode start range\n * @param {Number} end unicode end range\n * @return {Boolean}\n */\nfunction isCharInRange(char = '', start, end) {\n if (isEmpty(char)) return false;\n const code = char.charCodeAt(0);\n return start <= code && code <= end;\n}\n\nexport default isCharInRange;\n","export const VERSION = '5.2.0';\n\nexport const TO_KANA_METHODS: {\n HIRAGANA: 'toHiragana',\n KATAKANA: 'toKatakana',\n} = {\n HIRAGANA: 'toHiragana',\n KATAKANA: 'toKatakana',\n};\n\nexport const ROMANIZATIONS: { HEPBURN: 'hepburn' } = {\n HEPBURN: 'hepburn',\n};\n\nexport type DefaultOptions = {\n useObsoleteKana?: boolean,\n passRomaji?: boolean,\n convertLongVowelMark?: boolean,\n upcaseKatakana?: boolean,\n IMEMode?: boolean | 'toHiragana' | 'toKatakana',\n romanization?: 'hepburn',\n customKanaMapping?: { [index: string]: string }\n customRomajiMapping?: { [index: string]: string }\n};\n\n/**\n * Default config for WanaKana, user passed options will be merged with these\n * @type {DefaultOptions}\n * @name DefaultOptions\n * @property {Boolean} [useObsoleteKana=false] - Set to true to use obsolete characters, such as ゐ and ゑ.\n * @example\n * toHiragana('we', { useObsoleteKana: true })\n * // => 'ゑ'\n * @property {Boolean} [passRomaji=false] - Set to true to pass romaji when using mixed syllabaries with toKatakana() or toHiragana()\n * @example\n * toHiragana('only convert the katakana: ヒラガナ', { passRomaji: true })\n * // => \"only convert the katakana: ひらがな\"\n * @property {Boolean} [convertLongVowelMark=true] - Set to false to prevent conversions of 'ー' to extended vowels with toHiragana()\n * @example\n * toHiragana('ラーメン', { convertLongVowelMark: false });\n * // => 'らーめん\n * @property {Boolean} [upcaseKatakana=false] - Set to true to convert katakana to uppercase using toRomaji()\n * @example\n * toRomaji('ひらがな カタカナ', { upcaseKatakana: true })\n * // => \"hiragana KATAKANA\"\n * @property {Boolean | 'toHiragana' | 'toKatakana'} [IMEMode=false] - Set to true, 'toHiragana', or 'toKatakana' to handle conversion while it is being typed.\n * @property {'hepburn'} [romanization='hepburn'] - choose toRomaji() romanization map (currently only 'hepburn')\n * @property {Object.} [customKanaMapping] - custom map will be merged with default conversion\n * @example\n * toKana('wanakana', { customKanaMapping: { na: 'に', ka: 'Bana' }) };\n * // => 'わにBanaに'\n * @property {Object.} [customRomajiMapping] - custom map will be merged with default conversion\n * @example\n * toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' }) };\n * // => 'tuzigili'\n */\nexport const DEFAULT_OPTIONS: DefaultOptions = {\n useObsoleteKana: false,\n passRomaji: false,\n convertLongVowelMark: true,\n upcaseKatakana: false,\n IMEMode: false,\n romanization: ROMANIZATIONS.HEPBURN,\n};\n\n// CharCode References\n// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml\n// http://unicode-table.com\n\nexport const LATIN_LOWERCASE_START = 0x61;\nexport const LATIN_LOWERCASE_END = 0x7a;\nexport const LATIN_UPPERCASE_START = 0x41;\nexport const LATIN_UPPERCASE_END = 0x5a;\nexport const LOWERCASE_ZENKAKU_START = 0xff41;\nexport const LOWERCASE_ZENKAKU_END = 0xff5a;\nexport const UPPERCASE_ZENKAKU_START = 0xff21;\nexport const UPPERCASE_ZENKAKU_END = 0xff3a;\nexport const HIRAGANA_START = 0x3041;\nexport const HIRAGANA_END = 0x3096;\nexport const KATAKANA_START = 0x30a1;\nexport const KATAKANA_END = 0x30fc;\nexport const KANJI_START = 0x4e00;\nexport const KANJI_END = 0x9faf;\n\nexport const KANJI_ITERATION_MARK = 0x3005; // 々\nexport const PROLONGED_SOUND_MARK = 0x30fc; // ー\nexport const KANA_SLASH_DOT = 0x30fb; // ・\n\nconst ZENKAKU_NUMBERS = [0xff10, 0xff19];\nconst ZENKAKU_UPPERCASE = [UPPERCASE_ZENKAKU_START, UPPERCASE_ZENKAKU_END];\nconst ZENKAKU_LOWERCASE = [LOWERCASE_ZENKAKU_START, LOWERCASE_ZENKAKU_END];\nconst ZENKAKU_PUNCTUATION_1 = [0xff01, 0xff0f];\nconst ZENKAKU_PUNCTUATION_2 = [0xff1a, 0xff1f];\nconst ZENKAKU_PUNCTUATION_3 = [0xff3b, 0xff3f];\nconst ZENKAKU_PUNCTUATION_4 = [0xff5b, 0xff60];\nconst ZENKAKU_SYMBOLS_CURRENCY = [0xffe0, 0xffee];\n\nconst HIRAGANA_CHARS = [0x3040, 0x309f];\nconst KATAKANA_CHARS = [0x30a0, 0x30ff];\nconst HANKAKU_KATAKANA = [0xff66, 0xff9f];\nconst KATAKANA_PUNCTUATION = [0x30fb, 0x30fc];\nconst KANA_PUNCTUATION = [0xff61, 0xff65];\nconst CJK_SYMBOLS_PUNCTUATION = [0x3000, 0x303f];\nconst COMMON_CJK = [0x4e00, 0x9fff];\nconst RARE_CJK = [0x3400, 0x4dbf];\n\nexport const KANA_RANGES = [\n HIRAGANA_CHARS,\n KATAKANA_CHARS,\n KANA_PUNCTUATION,\n HANKAKU_KATAKANA,\n];\n\nexport const JA_PUNCTUATION_RANGES = [\n CJK_SYMBOLS_PUNCTUATION,\n KANA_PUNCTUATION,\n KATAKANA_PUNCTUATION,\n ZENKAKU_PUNCTUATION_1,\n ZENKAKU_PUNCTUATION_2,\n ZENKAKU_PUNCTUATION_3,\n ZENKAKU_PUNCTUATION_4,\n ZENKAKU_SYMBOLS_CURRENCY,\n];\n\n// All Japanese unicode start and end ranges\n// Includes kanji, kana, zenkaku latin chars, punctuation, and number ranges.\nexport const JAPANESE_RANGES = [\n ...KANA_RANGES,\n ...JA_PUNCTUATION_RANGES,\n ZENKAKU_UPPERCASE,\n ZENKAKU_LOWERCASE,\n ZENKAKU_NUMBERS,\n COMMON_CJK,\n RARE_CJK,\n];\n\nconst MODERN_ENGLISH = [0x0000, 0x007f];\nconst HEPBURN_MACRON_RANGES = [\n [0x0100, 0x0101], // Ā ā\n [0x0112, 0x0113], // Ē ē\n [0x012a, 0x012b], // Ī ī\n [0x014c, 0x014d], // Ō ō\n [0x016a, 0x016b], // Ū ū\n];\nconst SMART_QUOTE_RANGES = [\n [0x2018, 0x2019], // ‘ ’\n [0x201c, 0x201d], // “ ”\n];\n\nexport const ROMAJI_RANGES = [MODERN_ENGLISH, ...HEPBURN_MACRON_RANGES];\n\nexport const EN_PUNCTUATION_RANGES = [\n [0x20, 0x2f],\n [0x3a, 0x3f],\n [0x5b, 0x60],\n [0x7b, 0x7e],\n ...SMART_QUOTE_RANGES,\n];\n","import isCharInRange from './isCharInRange';\nimport { JAPANESE_RANGES } from '../constants.ts';\n\n/**\n * Tests a character. Returns true if the character is [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharJapanese(char = '') {\n return JAPANESE_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharJapanese;\n","import typeOf from './utils/typeOf';\nimport isEmpty from './utils/isEmpty';\nimport isCharJapanese from './utils/isCharJapanese';\n\n/**\n * Test if `input` only includes [Kanji](https://en.wikipedia.org/wiki/Kanji), [Kana](https://en.wikipedia.org/wiki/Kana), zenkaku numbers, and JA punctuation/symbols.”\n * @param {String} [input=''] text\n * @param {RegExp} [allowed] additional test allowed to pass for each char\n * @return {Boolean} true if passes checks\n * @example\n * isJapanese('泣き虫')\n * // => true\n * isJapanese('あア')\n * // => true\n * isJapanese('2月') // Zenkaku numbers allowed\n * // => true\n * isJapanese('泣き虫。!〜$') // Zenkaku/JA punctuation\n * // => true\n * isJapanese('泣き虫.!~$') // Latin punctuation fails\n * // => false\n * isJapanese('A泣き虫')\n * // => false\n * isJapanese('≪偽括弧≫', /[≪≫]/);\n * // => true\n */\nfunction isJapanese(input = '', allowed) {\n const augmented = typeOf(allowed) === 'regexp';\n return isEmpty(input)\n ? false\n : [...input].every((char) => {\n const isJa = isCharJapanese(char);\n return !augmented ? isJa : isJa || allowed.test(char);\n });\n}\n\nexport default isJapanese;\n","var safeIsNaN = Number.isNaN ||\n function ponyfill(value) {\n return typeof value === 'number' && value !== value;\n };\nfunction isEqual(first, second) {\n if (first === second) {\n return true;\n }\n if (safeIsNaN(first) && safeIsNaN(second)) {\n return true;\n }\n return false;\n}\nfunction areInputsEqual(newInputs, lastInputs) {\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n for (var i = 0; i < newInputs.length; i++) {\n if (!isEqual(newInputs[i], lastInputs[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n if (isEqual === void 0) { isEqual = areInputsEqual; }\n var cache = null;\n function memoized() {\n var newArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n newArgs[_i] = arguments[_i];\n }\n if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) {\n return cache.lastResult;\n }\n var lastResult = resultFn.apply(this, newArgs);\n cache = {\n lastResult: lastResult,\n lastArgs: newArgs,\n lastThis: this,\n };\n return lastResult;\n }\n memoized.clear = function clear() {\n cache = null;\n };\n return memoized;\n}\n\nexport { memoizeOne as default };\n","var has = Object.prototype.hasOwnProperty;\n\nfunction find(iter, tar, key) {\n\tfor (key of iter.keys()) {\n\t\tif (dequal(key, tar)) return key;\n\t}\n}\n\nexport function dequal(foo, bar) {\n\tvar ctor, len, tmp;\n\tif (foo === bar) return true;\n\n\tif (foo && bar && (ctor=foo.constructor) === bar.constructor) {\n\t\tif (ctor === Date) return foo.getTime() === bar.getTime();\n\t\tif (ctor === RegExp) return foo.toString() === bar.toString();\n\n\t\tif (ctor === Array) {\n\t\t\tif ((len=foo.length) === bar.length) {\n\t\t\t\twhile (len-- && dequal(foo[len], bar[len]));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ctor === Set) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len;\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!bar.has(tmp)) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === Map) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len[0];\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!dequal(len[1], bar.get(tmp))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === ArrayBuffer) {\n\t\t\tfoo = new Uint8Array(foo);\n\t\t\tbar = new Uint8Array(bar);\n\t\t} else if (ctor === DataView) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo.getInt8(len) === bar.getInt8(len));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ArrayBuffer.isView(foo)) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo[len] === bar[len]);\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (!ctor || typeof foo === 'object') {\n\t\t\tlen = 0;\n\t\t\tfor (ctor in foo) {\n\t\t\t\tif (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n\t\t\t\tif (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n\t\t\t}\n\t\t\treturn Object.keys(bar).length === len;\n\t\t}\n\t}\n\n\treturn foo !== foo && bar !== bar;\n}\n","import { DEFAULT_OPTIONS } from '../constants.ts';\n/**\n * Easy re-use of merging with default options\n * @param {Object} opts user options\n * @returns user options merged over default options\n */\nconst mergeWithDefaultOptions = (opts = {}) => Object.assign({}, DEFAULT_OPTIONS, opts);\n\nexport default mergeWithDefaultOptions;\n","import typeOf from './typeOf';\n\nexport function applyMapping(string, mapping, convertEnding) {\n const root = mapping;\n\n function nextSubtree(tree, nextChar) {\n const subtree = tree[nextChar];\n if (subtree === undefined) {\n return undefined;\n }\n // if the next child node does not have a node value, set its node value to the input\n return Object.assign({ '': tree[''] + nextChar }, tree[nextChar]);\n }\n\n function newChunk(remaining, currentCursor) {\n // start parsing a new chunk\n const firstChar = remaining.charAt(0);\n\n return parse(\n Object.assign({ '': firstChar }, root[firstChar]),\n remaining.slice(1),\n currentCursor,\n currentCursor + 1\n );\n }\n\n function parse(tree, remaining, lastCursor, currentCursor) {\n if (!remaining) {\n if (convertEnding || Object.keys(tree).length === 1) {\n // nothing more to consume, just commit the last chunk and return it\n // so as to not have an empty element at the end of the result\n return tree[''] ? [[lastCursor, currentCursor, tree['']]] : [];\n }\n // if we don't want to convert the ending, because there are still possible continuations\n // return null as the final node value\n return [[lastCursor, currentCursor, null]];\n }\n\n if (Object.keys(tree).length === 1) {\n return [[lastCursor, currentCursor, tree['']]].concat(\n newChunk(remaining, currentCursor)\n );\n }\n\n const subtree = nextSubtree(tree, remaining.charAt(0));\n\n if (subtree === undefined) {\n return [[lastCursor, currentCursor, tree['']]].concat(\n newChunk(remaining, currentCursor)\n );\n }\n // continue current branch\n return parse(subtree, remaining.slice(1), lastCursor, currentCursor + 1);\n }\n\n return newChunk(string, 0);\n}\n\n// transform the tree, so that for example hepburnTree['ゔ']['ぁ'][''] === 'va'\n// or kanaTree['k']['y']['a'][''] === 'きゃ'\nexport function transform(tree) {\n return Object.entries(tree).reduce((map, [char, subtree]) => {\n const endOfBranch = typeOf(subtree) === 'string';\n // eslint-disable-next-line no-param-reassign\n map[char] = endOfBranch ? { '': subtree } : transform(subtree);\n return map;\n }, {});\n}\n\nexport function getSubTreeOf(tree, string) {\n return string.split('').reduce((correctSubTree, char) => {\n if (correctSubTree[char] === undefined) {\n // eslint-disable-next-line no-param-reassign\n correctSubTree[char] = {};\n }\n return correctSubTree[char];\n }, tree);\n}\n\n/**\n * Creates a custom mapping tree, returns a function that accepts a defaultMap which the newly created customMapping will be merged with and returned\n * (customMap) => (defaultMap) => mergedMap\n * @param {Object} customMap { 'ka' : 'な' }\n * @return {Function} (defaultMap) => defaultMergedWithCustomMap\n * @example\n * const sillyMap = createCustomMapping({ 'ちゃ': 'time', '茎': 'cookie' });\n * // sillyMap is passed defaultMapping to merge with when called in toRomaji()\n * toRomaji(\"It's 茎 ちゃ よ\", { customRomajiMapping: sillyMap });\n * // => 'It's cookie time yo';\n */\nexport function createCustomMapping(customMap = {}) {\n const customTree = {};\n\n if (typeOf(customMap) === 'object') {\n Object.entries(customMap).forEach(([roma, kana]) => {\n let subTree = customTree;\n roma.split('').forEach((char) => {\n if (subTree[char] === undefined) {\n subTree[char] = {};\n }\n subTree = subTree[char];\n });\n subTree[''] = kana;\n });\n }\n\n return function makeMap(map) {\n const mapCopy = JSON.parse(JSON.stringify(map));\n\n function transformMap(mapSubtree, customSubtree) {\n if (mapSubtree === undefined || typeOf(mapSubtree) === 'string') {\n return customSubtree;\n }\n return Object.entries(customSubtree).reduce(\n (newSubtree, [char, subtree]) => {\n // eslint-disable-next-line no-param-reassign\n newSubtree[char] = transformMap(mapSubtree[char], subtree);\n return newSubtree;\n },\n mapSubtree\n );\n }\n\n return transformMap(mapCopy, customTree);\n };\n}\n\n// allow consumer to pass either function or object as customMapping\nexport function mergeCustomMapping(map, customMapping) {\n if (!customMapping) {\n return map;\n }\n return typeOf(customMapping) === 'function'\n ? customMapping(map)\n : createCustomMapping(customMapping)(map);\n}\n","import { transform, getSubTreeOf, createCustomMapping } from './kanaMapping';\n\n// NOTE: not exactly kunrei shiki, for example ぢゃ -> dya instead of zya, to avoid name clashing\n/* eslint-disable */\n// prettier-ignore\nconst BASIC_KUNREI = {\n a: 'あ', i: 'い', u: 'う', e: 'え', o: 'お',\n k: { a: 'か', i: 'き', u: 'く', e: 'け', o: 'こ', },\n s: { a: 'さ', i: 'し', u: 'す', e: 'せ', o: 'そ', },\n t: { a: 'た', i: 'ち', u: 'つ', e: 'て', o: 'と', },\n n: { a: 'な', i: 'に', u: 'ぬ', e: 'ね', o: 'の', },\n h: { a: 'は', i: 'ひ', u: 'ふ', e: 'へ', o: 'ほ', },\n m: { a: 'ま', i: 'み', u: 'む', e: 'め', o: 'も', },\n y: { a: 'や', u: 'ゆ', o: 'よ' },\n r: { a: 'ら', i: 'り', u: 'る', e: 'れ', o: 'ろ', },\n w: { a: 'わ', i: 'ゐ', e: 'ゑ', o: 'を', },\n g: { a: 'が', i: 'ぎ', u: 'ぐ', e: 'げ', o: 'ご', },\n z: { a: 'ざ', i: 'じ', u: 'ず', e: 'ぜ', o: 'ぞ', },\n d: { a: 'だ', i: 'ぢ', u: 'づ', e: 'で', o: 'ど', },\n b: { a: 'ば', i: 'び', u: 'ぶ', e: 'べ', o: 'ぼ', },\n p: { a: 'ぱ', i: 'ぴ', u: 'ぷ', e: 'ぺ', o: 'ぽ', },\n v: { a: 'ゔぁ', i: 'ゔぃ', u: 'ゔ', e: 'ゔぇ', o: 'ゔぉ', },\n};\n\nconst SPECIAL_SYMBOLS = {\n '.': '。',\n ',': '、',\n ':': ':',\n '/': '・',\n '!': '!',\n '?': '?',\n '~': '〜',\n '-': 'ー',\n '‘': '「',\n '’': '」',\n '“': '『',\n '”': '』',\n '[': '[',\n ']': ']',\n '(': '(',\n ')': ')',\n '{': '{',\n '}': '}',\n};\n\nconst CONSONANTS = {\n k: 'き',\n s: 'し',\n t: 'ち',\n n: 'に',\n h: 'ひ',\n m: 'み',\n r: 'り',\n g: 'ぎ',\n z: 'じ',\n d: 'ぢ',\n b: 'び',\n p: 'ぴ',\n v: 'ゔ',\n q: 'く',\n f: 'ふ',\n};\nconst SMALL_Y = { ya: 'ゃ', yi: 'ぃ', yu: 'ゅ', ye: 'ぇ', yo: 'ょ' };\nconst SMALL_VOWELS = { a: 'ぁ', i: 'ぃ', u: 'ぅ', e: 'ぇ', o: 'ぉ' };\n\n// typing one should be the same as having typed the other instead\nconst ALIASES = {\n sh: 'sy', // sha -> sya\n ch: 'ty', // cho -> tyo\n cy: 'ty', // cyo -> tyo\n chy: 'ty', // chyu -> tyu\n shy: 'sy', // shya -> sya\n j: 'zy', // ja -> zya\n jy: 'zy', // jye -> zye\n\n // exceptions to above rules\n shi: 'si',\n chi: 'ti',\n tsu: 'tu',\n ji: 'zi',\n fu: 'hu',\n};\n\n// xtu -> っ\nconst SMALL_LETTERS = Object.assign(\n {\n tu: 'っ',\n wa: 'ゎ',\n ka: 'ヵ',\n ke: 'ヶ',\n },\n SMALL_VOWELS,\n SMALL_Y\n);\n\n// don't follow any notable patterns\nconst SPECIAL_CASES = {\n yi: 'い',\n wu: 'う',\n ye: 'いぇ',\n wi: 'うぃ',\n we: 'うぇ',\n kwa: 'くぁ',\n whu: 'う',\n // because it's not thya for てゃ but tha\n // and tha is not てぁ, but てゃ\n tha: 'てゃ',\n thu: 'てゅ',\n tho: 'てょ',\n dha: 'でゃ',\n dhu: 'でゅ',\n dho: 'でょ',\n};\n\nconst AIUEO_CONSTRUCTIONS = {\n wh: 'う',\n kw: 'く',\n qw: 'く',\n q: 'く',\n gw: 'ぐ',\n sw: 'す',\n ts: 'つ',\n th: 'て',\n tw: 'と',\n dh: 'で',\n dw: 'ど',\n fw: 'ふ',\n f: 'ふ',\n};\n\n/* eslint-enable */\nfunction createRomajiToKanaMap() {\n const kanaTree = transform(BASIC_KUNREI);\n // pseudo partial application\n const subtreeOf = (string) => getSubTreeOf(kanaTree, string);\n\n // add tya, sya, etc.\n Object.entries(CONSONANTS).forEach(([consonant, yKana]) => {\n Object.entries(SMALL_Y).forEach(([roma, kana]) => {\n // for example kyo -> き + ょ\n subtreeOf(consonant + roma)[''] = yKana + kana;\n });\n });\n\n Object.entries(SPECIAL_SYMBOLS).forEach(([symbol, jsymbol]) => {\n subtreeOf(symbol)[''] = jsymbol;\n });\n\n // things like うぃ, くぃ, etc.\n Object.entries(AIUEO_CONSTRUCTIONS).forEach(([consonant, aiueoKana]) => {\n Object.entries(SMALL_VOWELS).forEach(([vowel, kana]) => {\n const subtree = subtreeOf(consonant + vowel);\n subtree[''] = aiueoKana + kana;\n });\n });\n\n // different ways to write ん\n ['n', \"n'\", 'xn'].forEach((nChar) => {\n subtreeOf(nChar)[''] = 'ん';\n });\n\n // c is equivalent to k, but not for chi, cha, etc. that's why we have to make a copy of k\n kanaTree.c = JSON.parse(JSON.stringify(kanaTree.k));\n\n Object.entries(ALIASES).forEach(([string, alternative]) => {\n const allExceptLast = string.slice(0, string.length - 1);\n const last = string.charAt(string.length - 1);\n const parentTree = subtreeOf(allExceptLast);\n // copy to avoid recursive containment\n parentTree[last] = JSON.parse(JSON.stringify(subtreeOf(alternative)));\n });\n\n function getAlternatives(string) {\n return [...Object.entries(ALIASES), ...[['c', 'k']]].reduce(\n (list, [alt, roma]) => (string.startsWith(roma) ? list.concat(string.replace(roma, alt)) : list),\n []\n );\n }\n\n Object.entries(SMALL_LETTERS).forEach(([kunreiRoma, kana]) => {\n const last = (char) => char.charAt(char.length - 1);\n const allExceptLast = (chars) => chars.slice(0, chars.length - 1);\n const xRoma = `x${kunreiRoma}`;\n const xSubtree = subtreeOf(xRoma);\n xSubtree[''] = kana;\n\n // ltu -> xtu -> っ\n const parentTree = subtreeOf(`l${allExceptLast(kunreiRoma)}`);\n parentTree[last(kunreiRoma)] = xSubtree;\n\n // ltsu -> ltu -> っ\n getAlternatives(kunreiRoma).forEach((altRoma) => {\n ['l', 'x'].forEach((prefix) => {\n const altParentTree = subtreeOf(prefix + allExceptLast(altRoma));\n altParentTree[last(altRoma)] = subtreeOf(prefix + kunreiRoma);\n });\n });\n });\n\n Object.entries(SPECIAL_CASES).forEach(([string, kana]) => {\n subtreeOf(string)[''] = kana;\n });\n\n // add kka, tta, etc.\n function addTsu(tree) {\n return Object.entries(tree).reduce((tsuTree, [key, value]) => {\n if (!key) {\n // we have reached the bottom of this branch\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = `っ${value}`;\n } else {\n // more subtrees\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = addTsu(value);\n }\n return tsuTree;\n }, {});\n }\n // have to explicitly name c here, because we made it a copy of k, not a reference\n [...Object.keys(CONSONANTS), 'c', 'y', 'w', 'j'].forEach((consonant) => {\n const subtree = kanaTree[consonant];\n subtree[consonant] = addTsu(subtree);\n });\n // nn should not be っん\n delete kanaTree.n.n;\n // solidify the results, so that there there is referential transparency within the tree\n return Object.freeze(JSON.parse(JSON.stringify(kanaTree)));\n}\n\nlet romajiToKanaMap = null;\n\nexport function getRomajiToKanaTree() {\n if (romajiToKanaMap == null) {\n romajiToKanaMap = createRomajiToKanaMap();\n }\n return romajiToKanaMap;\n}\n\nexport const USE_OBSOLETE_KANA_MAP = createCustomMapping({\n wi: 'ゐ',\n we: 'ゑ',\n});\n\nexport function IME_MODE_MAP(map) {\n // in IME mode, we do not want to convert single ns\n const mapCopy = JSON.parse(JSON.stringify(map));\n mapCopy.n.n = { '': 'ん' };\n mapCopy.n[' '] = { '': 'ん' };\n return mapCopy;\n}\n","import isEmpty from './isEmpty';\nimport isCharInRange from './isCharInRange';\nimport { LATIN_UPPERCASE_START, LATIN_UPPERCASE_END } from '../constants.ts';\n\n/**\n * Tests if char is in English unicode uppercase range\n * @param {String} char\n * @return {Boolean}\n */\nfunction isCharUpperCase(char = '') {\n if (isEmpty(char)) return false;\n return isCharInRange(char, LATIN_UPPERCASE_START, LATIN_UPPERCASE_END);\n}\n\nexport default isCharUpperCase;\n","import isEmpty from './isEmpty';\nimport { PROLONGED_SOUND_MARK } from '../constants.ts';\n\n/**\n * Returns true if char is 'ー'\n * @param {String} char to test\n * @return {Boolean}\n */\nfunction isCharLongDash(char = '') {\n if (isEmpty(char)) return false;\n return char.charCodeAt(0) === PROLONGED_SOUND_MARK;\n}\n\nexport default isCharLongDash;\n","import isEmpty from './isEmpty';\nimport { KANA_SLASH_DOT } from '../constants.ts';\n\n/**\n * Tests if char is '・'\n * @param {String} char\n * @return {Boolean} true if '・'\n */\nfunction isCharSlashDot(char = '') {\n if (isEmpty(char)) return false;\n return char.charCodeAt(0) === KANA_SLASH_DOT;\n}\n\nexport default isCharSlashDot;\n","import isEmpty from './isEmpty';\nimport isCharLongDash from './isCharLongDash';\nimport isCharInRange from './isCharInRange';\nimport {\n HIRAGANA_START,\n HIRAGANA_END,\n} from '../constants.ts';\n\n/**\n * Tests a character. Returns true if the character is [Hiragana](https://en.wikipedia.org/wiki/Hiragana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharHiragana(char = '') {\n if (isEmpty(char)) return false;\n if (isCharLongDash(char)) return true;\n return isCharInRange(char, HIRAGANA_START, HIRAGANA_END);\n}\n\nexport default isCharHiragana;\n","import { KATAKANA_START, HIRAGANA_START } from '../constants.ts';\n\nimport isCharLongDash from './isCharLongDash';\nimport isCharSlashDot from './isCharSlashDot';\nimport isCharHiragana from './isCharHiragana';\n\n/**\n * Convert [Hiragana](https://en.wikipedia.org/wiki/Hiragana) to [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * Passes through any non-hiragana chars\n * @private\n * @param {String} [input=''] text input\n * @return {String} converted text\n * @example\n * hiraganaToKatakana('ひらがな')\n * // => \"ヒラガナ\"\n * hiraganaToKatakana('ひらがな is a type of kana')\n * // => \"ヒラガナ is a type of kana\"\n */\nfunction hiraganaToKatakana(input = '') {\n const kata = [];\n input.split('').forEach((char) => {\n // Short circuit to avoid incorrect codeshift for 'ー' and '・'\n if (isCharLongDash(char) || isCharSlashDot(char)) {\n kata.push(char);\n } else if (isCharHiragana(char)) {\n // Shift charcode.\n const code = char.charCodeAt(0) + (KATAKANA_START - HIRAGANA_START);\n const kataChar = String.fromCharCode(code);\n kata.push(kataChar);\n } else {\n // Pass non-hiragana chars through\n kata.push(char);\n }\n });\n return kata.join('');\n}\n\nexport default hiraganaToKatakana;\n","import memoizeOne from 'memoize-one';\nimport { dequal } from 'dequal';\n\nimport { TO_KANA_METHODS } from './constants';\nimport mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport {\n getRomajiToKanaTree,\n IME_MODE_MAP,\n USE_OBSOLETE_KANA_MAP,\n} from './utils/romajiToKanaMap';\nimport { applyMapping, mergeCustomMapping } from './utils/kanaMapping';\nimport isCharUpperCase from './utils/isCharUpperCase';\nimport hiraganaToKatakana from './utils/hiraganaToKatakana';\n\n// memoize and deeply compare args so we only recreate when necessary\nexport const createRomajiToKanaMap = memoizeOne(\n (IMEMode, useObsoleteKana, customKanaMapping) => {\n let map = getRomajiToKanaTree();\n\n map = IMEMode ? IME_MODE_MAP(map) : map;\n map = useObsoleteKana ? USE_OBSOLETE_KANA_MAP(map) : map;\n\n if (customKanaMapping) {\n map = mergeCustomMapping(map, customKanaMapping);\n }\n\n return map;\n },\n dequal\n);\n\n/**\n * Convert [Romaji](https://en.wikipedia.org/wiki/Romaji) to [Kana](https://en.wikipedia.org/wiki/Kana), lowercase text will result in [Hiragana](https://en.wikipedia.org/wiki/Hiragana) and uppercase text will result in [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} [input=''] text\n * @param {DefaultOptions} [options=defaultOptions]\n * @param {Object.} [map] custom mapping\n * @return {String} converted text\n * @example\n * toKana('onaji BUTTSUUJI')\n * // => 'おなじ ブッツウジ'\n * toKana('ONAJI buttsuuji')\n * // => 'オナジ ぶっつうじ'\n * toKana('座禅‘zazen’スタイル')\n * // => '座禅「ざぜん」スタイル'\n * toKana('batsuge-mu')\n * // => 'ばつげーむ'\n * toKana('!?.:/,~-‘’“”[](){}') // Punctuation conversion\n * // => '!?。:・、〜ー「」『』[](){}'\n * toKana('we', { useObsoleteKana: true })\n * // => 'ゑ'\n * toKana('wanakana', { customKanaMapping: { na: 'に', ka: 'bana' } });\n * // => 'わにbanaに'\n */\nexport function toKana(input = '', options = {}, map) {\n let config;\n if (!map) {\n config = mergeWithDefaultOptions(options);\n map = createRomajiToKanaMap(\n config.IMEMode,\n config.useObsoleteKana,\n config.customKanaMapping\n );\n } else {\n config = options;\n }\n\n // throw away the substring index information and just concatenate all the kana\n return splitIntoConvertedKana(input, config, map)\n .map((kanaToken) => {\n const [start, end, kana] = kanaToken;\n if (kana === null) {\n // haven't converted the end of the string, since we are in IME mode\n return input.slice(start);\n }\n const enforceHiragana = config.IMEMode === TO_KANA_METHODS.HIRAGANA;\n const enforceKatakana = config.IMEMode === TO_KANA_METHODS.KATAKANA\n || [...input.slice(start, end)].every(isCharUpperCase);\n\n return enforceHiragana || !enforceKatakana\n ? kana\n : hiraganaToKatakana(kana);\n })\n .join('');\n}\n\n/**\n *\n * @private\n * @param {String} [input=''] input text\n * @param {DefaultOptions} [options=defaultOptions] toKana options\n * @param {Object} [map] custom mapping\n * @returns {Array[]} [[start, end, token]]\n * @example\n * splitIntoConvertedKana('buttsuuji')\n * // => [[0, 2, 'ぶ'], [2, 6, 'っつ'], [6, 7, 'う'], [7, 9, 'じ']]\n */\nexport function splitIntoConvertedKana(input = '', options = {}, map) {\n const { IMEMode, useObsoleteKana, customKanaMapping } = options;\n\n if (!map) {\n map = createRomajiToKanaMap(IMEMode, useObsoleteKana, customKanaMapping);\n }\n\n return applyMapping(input.toLowerCase(), map, !IMEMode);\n}\n\nexport default toKana;\n","import isJapanese from '../isJapanese';\nimport toKana, { createRomajiToKanaMap } from '../toKana';\nimport mergeWithDefaultOptions from './mergeWithDefaultOptions';\n\nlet LISTENERS = [];\n/**\n * Automagically replaces input values with converted text to kana\n * @param {defaultOptions} [options] user config overrides, default conversion is toKana()\n * @return {Function} event handler with bound options\n * @private\n */\nexport function makeOnInput(options) {\n let prevInput;\n\n // Enforce IMEMode if not already specified\n const mergedConfig = Object.assign({}, mergeWithDefaultOptions(options), {\n IMEMode: options.IMEMode || true,\n });\n\n const preConfiguredMap = createRomajiToKanaMap(\n mergedConfig.IMEMode,\n mergedConfig.useObsoleteKana,\n mergedConfig.customKanaMapping\n );\n\n const triggers = [\n ...Object.keys(preConfiguredMap),\n ...Object.keys(preConfiguredMap).map((char) => char.toUpperCase()),\n ];\n\n return function onInput({ target }) {\n if (\n target.value !== prevInput\n && target.dataset.ignoreComposition !== 'true'\n ) {\n convertInput(target, mergedConfig, preConfiguredMap, triggers, prevInput);\n }\n };\n}\n\nexport function convertInput(target, options, map, triggers, prevInput) {\n const [head, textToConvert, tail] = splitInput(\n target.value,\n target.selectionEnd,\n triggers\n );\n const convertedText = toKana(textToConvert, options, map);\n const changed = textToConvert !== convertedText;\n\n if (changed) {\n const newCursor = head.length + convertedText.length;\n const newValue = head + convertedText + tail;\n // eslint-disable-next-line no-param-reassign\n target.value = newValue;\n // eslint-disable-next-line no-param-reassign\n prevInput = newValue;\n\n if (tail.length) {\n // push later on event loop (otherwise mid-text insertion can be 1 char too far to the right)\n setTimeout(() => target.setSelectionRange(newCursor, newCursor), 1);\n } else {\n target.setSelectionRange(newCursor, newCursor);\n }\n } else {\n // eslint-disable-next-line no-param-reassign\n prevInput = target.value;\n }\n}\n\nexport function onComposition({ type, target, data }) {\n // navigator.platform is not 100% reliable for singling out all OS,\n // but for determining desktop \"Mac OS\" it is effective enough.\n const isMacOS = /Mac/.test(window.navigator && window.navigator.platform);\n // We don't want to ignore on Android:\n // https://github.com/WaniKani/WanaKana/issues/82\n // But MacOS IME auto-closes if we don't ignore:\n // https://github.com/WaniKani/WanaKana/issues/71\n // Other platform Japanese IMEs pass through happily\n if (isMacOS) {\n if (type === 'compositionupdate' && isJapanese(data)) {\n // eslint-disable-next-line no-param-reassign\n target.dataset.ignoreComposition = 'true';\n }\n\n if (type === 'compositionend') {\n // eslint-disable-next-line no-param-reassign\n target.dataset.ignoreComposition = 'false';\n }\n }\n}\n\nexport function trackListeners(id, inputHandler, compositionHandler) {\n LISTENERS = LISTENERS.concat({\n id,\n inputHandler,\n compositionHandler,\n });\n}\n\nexport function untrackListeners({ id: targetId }) {\n LISTENERS = LISTENERS.filter(({ id }) => id !== targetId);\n}\n\nexport function findListeners(el) {\n return (\n el && LISTENERS.find(({ id }) => id === el.getAttribute('data-wanakana-id'))\n );\n}\n\n// Handle non-terminal inserted input conversion:\n// | -> わ| -> わび| -> わ|び -> わs|び -> わsh|び -> わshi|び -> わし|び\n// or multiple ambiguous positioning (to select which \"s\" to work from)\n// こsこs|こsこ -> こsこso|こsこ -> こsこそ|こsこ\nexport function splitInput(text = '', cursor = 0, triggers = []) {\n let head;\n let toConvert;\n let tail;\n\n if (cursor === 0 && triggers.includes(text[0])) {\n [head, toConvert, tail] = workFromStart(text, triggers);\n } else if (cursor > 0) {\n [head, toConvert, tail] = workBackwards(text, cursor);\n } else {\n [head, toConvert] = takeWhileAndSlice(\n text,\n (char) => !triggers.includes(char)\n );\n [toConvert, tail] = takeWhileAndSlice(\n toConvert,\n (char) => !isJapanese(char)\n );\n }\n\n return [head, toConvert, tail];\n}\n\nfunction workFromStart(text, catalystChars) {\n return [\n '',\n ...takeWhileAndSlice(\n text,\n (char) => catalystChars.includes(char) || !isJapanese(char, /[0-9]/)\n ),\n ];\n}\n\nfunction workBackwards(text = '', startIndex = 0) {\n const [toConvert, head] = takeWhileAndSlice(\n [...text.slice(0, startIndex)].reverse(),\n (char) => !isJapanese(char)\n );\n return [\n head.reverse().join(''),\n toConvert\n .split('')\n .reverse()\n .join(''),\n text.slice(startIndex),\n ];\n}\n\nfunction takeWhileAndSlice(source = {}, predicate = (x) => !!x) {\n const result = [];\n const { length } = source;\n let i = 0;\n while (i < length && predicate(source[i], i)) {\n result.push(source[i]);\n i += 1;\n }\n return [result.join(''), source.slice(i)];\n}\n","/* eslint-disable no-console */\nconst onInput = ({ target: { value, selectionStart, selectionEnd } }) => console.log('input:', { value, selectionStart, selectionEnd });\nconst onCompositionStart = () => console.log('compositionstart');\nconst onCompositionUpdate = ({\n target: { value, selectionStart, selectionEnd },\n data,\n}) => console.log('compositionupdate', {\n data,\n value,\n selectionStart,\n selectionEnd,\n});\nconst onCompositionEnd = () => console.log('compositionend');\n\nconst events = {\n input: onInput,\n compositionstart: onCompositionStart,\n compositionupdate: onCompositionUpdate,\n compositionend: onCompositionEnd,\n};\n\nexport const addDebugListeners = (input) => {\n Object.entries(events).forEach(([event, handler]) => input.addEventListener(event, handler)\n );\n};\n\nexport const removeDebugListeners = (input) => {\n Object.entries(events).forEach(([event, handler]) => input.removeEventListener(event, handler)\n );\n};\n","import { makeOnInput, onComposition, trackListeners } from './utils/dom';\nimport { addDebugListeners } from './utils/logInputEvents';\n\nconst ELEMENTS = ['TEXTAREA', 'INPUT'];\n\nlet idCounter = 0;\nconst newId = () => {\n idCounter += 1;\n return `${Date.now()}${idCounter}`;\n};\n\n/**\n * Binds eventListener for 'input' events to an input field to automagically replace values with kana\n * Can pass `{ IMEMode: 'toHiragana' || 'toKatakana' }` to enforce kana conversion type\n * @param {HTMLInputElement | HTMLTextAreaElement} element textarea, input[type=\"text\"] etc\n * @param {DefaultOptions} [options=defaultOptions] defaults to { IMEMode: true } using `toKana`\n * @example\n * bind(document.querySelector('#myInput'));\n */\nfunction bind(element = {}, options = {}, debug = false) {\n if (!ELEMENTS.includes(element.nodeName)) {\n throw new Error(\n `Element provided to Wanakana bind() was not a valid input or textarea element.\\n Received: (${JSON.stringify(\n element\n )})`\n );\n }\n if (element.hasAttribute('data-wanakana-id')) {\n return;\n }\n const onInput = makeOnInput(options);\n const id = newId();\n const attributes = [\n { name: 'data-wanakana-id', value: id },\n { name: 'lang', value: 'ja' },\n { name: 'autoCapitalize', value: 'none' },\n { name: 'autoCorrect', value: 'off' },\n { name: 'autoComplete', value: 'off' },\n { name: 'spellCheck', value: 'false' },\n ];\n const previousAttributes = {};\n attributes.forEach((attribute) => {\n previousAttributes[attribute.name] = element.getAttribute(attribute.name);\n element.setAttribute(attribute.name, attribute.value);\n });\n element.dataset.previousAttributes = JSON.stringify(previousAttributes);\n element.addEventListener('input', onInput);\n element.addEventListener('compositionupdate', onComposition);\n element.addEventListener('compositionend', onComposition);\n trackListeners(id, onInput, onComposition);\n if (debug === true) {\n addDebugListeners(element);\n }\n}\n\nexport default bind;\n","import isEmpty from './isEmpty';\nimport isCharInRange from './isCharInRange';\nimport { ROMAJI_RANGES } from '../constants.ts';\n\n/**\n * Tests a character. Returns true if the character is [Romaji](https://en.wikipedia.org/wiki/Romaji) (allowing [Hepburn romanisation](https://en.wikipedia.org/wiki/Hepburn_romanization))\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharRomaji(char = '') {\n if (isEmpty(char)) return false;\n return ROMAJI_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharRomaji;\n","import typeOf from './utils/typeOf';\nimport isEmpty from './utils/isEmpty';\nimport isCharRomaji from './utils/isCharRomaji';\n\n/**\n * Test if `input` is [Romaji](https://en.wikipedia.org/wiki/Romaji) (allowing [Hepburn romanisation](https://en.wikipedia.org/wiki/Hepburn_romanization))\n * @param {String} [input=''] text\n * @param {RegExp} [allowed] additional test allowed to pass for each char\n * @return {Boolean} true if [Romaji](https://en.wikipedia.org/wiki/Romaji)\n * @example\n * isRomaji('Tōkyō and Ōsaka')\n * // => true\n * isRomaji('12a*b&c-d')\n * // => true\n * isRomaji('あアA')\n * // => false\n * isRomaji('お願い')\n * // => false\n * isRomaji('a!b&cーd') // Zenkaku punctuation fails\n * // => false\n * isRomaji('a!b&cーd', /[!ー]/)\n * // => true\n */\nfunction isRomaji(input = '', allowed) {\n const augmented = typeOf(allowed) === 'regexp';\n return isEmpty(input)\n ? false\n : [...input].every((char) => {\n const isRoma = isCharRomaji(char);\n return !augmented ? isRoma : isRoma || allowed.test(char);\n });\n}\n\nexport default isRomaji;\n","import {\n KATAKANA_START,\n KATAKANA_END,\n} from '../constants.ts';\n\nimport isCharInRange from './isCharInRange';\n\n/**\n * Tests a character. Returns true if the character is [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharKatakana(char = '') {\n return isCharInRange(char, KATAKANA_START, KATAKANA_END);\n}\n\nexport default isCharKatakana;\n","import isEmpty from './isEmpty';\nimport isCharHiragana from './isCharHiragana';\nimport isCharKatakana from './isCharKatakana';\n\n/**\n * Tests a character. Returns true if the character is [Hiragana](https://en.wikipedia.org/wiki/Hiragana) or [Katakana](https://en.wikipedia.org/wiki/Katakana).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharKana(char = '') {\n if (isEmpty(char)) return false;\n return isCharHiragana(char) || isCharKatakana(char);\n}\n\nexport default isCharKana;\n","import isEmpty from './utils/isEmpty';\nimport isCharKana from './utils/isCharKana';\n\n/**\n * Test if `input` is [Kana](https://en.wikipedia.org/wiki/Kana) ([Katakana](https://en.wikipedia.org/wiki/Katakana) and/or [Hiragana](https://en.wikipedia.org/wiki/Hiragana))\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Kana](https://en.wikipedia.org/wiki/Kana)\n * @example\n * isKana('あ')\n * // => true\n * isKana('ア')\n * // => true\n * isKana('あーア')\n * // => true\n * isKana('A')\n * // => false\n * isKana('あAア')\n * // => false\n */\nfunction isKana(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharKana);\n}\n\nexport default isKana;\n","import isEmpty from './utils/isEmpty';\nimport isCharHiragana from './utils/isCharHiragana';\n\n/**\n * Test if `input` is [Hiragana](https://en.wikipedia.org/wiki/Hiragana)\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Hiragana](https://en.wikipedia.org/wiki/Hiragana)\n * @example\n * isHiragana('げーむ')\n * // => true\n * isHiragana('A')\n * // => false\n * isHiragana('あア')\n * // => false\n */\nfunction isHiragana(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharHiragana);\n}\n\nexport default isHiragana;\n","import isEmpty from './utils/isEmpty';\nimport isCharKatakana from './utils/isCharKatakana';\n\n/**\n * Test if `input` is [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * @example\n * isKatakana('ゲーム')\n * // => true\n * isKatakana('あ')\n * // => false\n * isKatakana('A')\n * // => false\n * isKatakana('あア')\n * // => false\n */\nfunction isKatakana(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharKatakana);\n}\n\nexport default isKatakana;\n","import isEmpty from './isEmpty';\nimport { KANJI_ITERATION_MARK } from '../constants.ts';\n\n/**\n * Returns true if char is '々'\n * @param {String} char to test\n * @return {Boolean}\n */\nfunction isCharIterationMark(char = '') {\n if (isEmpty(char)) return false;\n return char.charCodeAt(0) === KANJI_ITERATION_MARK;\n}\n\nexport default isCharIterationMark;\n","import { KANJI_START, KANJI_END } from '../constants.ts';\n\nimport isCharInRange from './isCharInRange';\nimport isCharIterationMark from './isCharIterationMark';\n/**\n * Tests a character. Returns true if the character is a CJK ideograph (kanji).\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharKanji(char = '') {\n return isCharInRange(char, KANJI_START, KANJI_END) || isCharIterationMark(char);\n}\n\nexport default isCharKanji;\n","import isEmpty from './utils/isEmpty';\nimport isCharKanji from './utils/isCharKanji';\n\n/**\n * Tests if `input` is [Kanji](https://en.wikipedia.org/wiki/Kanji) ([Japanese CJK ideographs](https://en.wikipedia.org/wiki/CJK_Unified_Ideographs))\n * @param {String} [input=''] text\n * @return {Boolean} true if all [Kanji](https://en.wikipedia.org/wiki/Kanji)\n * @example\n * isKanji('刀')\n * // => true\n * isKanji('切腹')\n * // => true\n * isKanji('勢い')\n * // => false\n * isKanji('あAア')\n * // => false\n * isKanji('🐸')\n * // => false\n */\nfunction isKanji(input = '') {\n if (isEmpty(input)) return false;\n return [...input].every(isCharKanji);\n}\n\nexport default isKanji;\n","import isKanji from './isKanji';\nimport isHiragana from './isHiragana';\nimport isKatakana from './isKatakana';\nimport isRomaji from './isRomaji';\n\n/**\n * Test if `input` contains a mix of [Romaji](https://en.wikipedia.org/wiki/Romaji) *and* [Kana](https://en.wikipedia.org/wiki/Kana), defaults to pass through [Kanji](https://en.wikipedia.org/wiki/Kanji)\n * @param {String} input text\n * @param {{ passKanji: Boolean}} [options={ passKanji: true }] optional config to pass through kanji\n * @return {Boolean} true if mixed\n * @example\n * isMixed('Abあア'))\n * // => true\n * isMixed('お腹A')) // ignores kanji by default\n * // => true\n * isMixed('お腹A', { passKanji: false }))\n * // => false\n * isMixed('ab'))\n * // => false\n * isMixed('あア'))\n * // => false\n */\nfunction isMixed(input = '', options = { passKanji: true }) {\n const chars = [...input];\n let hasKanji = false;\n if (!options.passKanji) {\n hasKanji = chars.some(isKanji);\n }\n return (chars.some(isHiragana) || chars.some(isKatakana)) && chars.some(isRomaji) && !hasKanji;\n}\n\nexport default isMixed;\n","import { KATAKANA_START, HIRAGANA_START } from '../constants.ts';\n\nimport isCharLongDash from './isCharLongDash';\nimport isCharSlashDot from './isCharSlashDot';\nimport isCharKatakana from './isCharKatakana';\nconst isCharInitialLongDash = (char, index) => isCharLongDash(char) && index < 1;\nconst isCharInnerLongDash = (char, index) => isCharLongDash(char) && index > 0;\nconst isKanaAsSymbol = (char) => ['ヶ', 'ヵ'].includes(char);\nconst LONG_VOWELS = {\n a: 'あ',\n i: 'い',\n u: 'う',\n e: 'え',\n o: 'う',\n};\n\n// inject toRomaji to avoid circular dependency between toRomaji <-> katakanaToHiragana\nfunction katakanaToHiragana(\n input = '',\n toRomaji,\n { isDestinationRomaji, convertLongVowelMark } = {}\n) {\n let previousKana = '';\n\n return input\n .split('')\n .reduce((hira, char, index) => {\n // Short circuit to avoid incorrect codeshift for 'ー' and '・'\n if (\n isCharSlashDot(char)\n || isCharInitialLongDash(char, index)\n || isKanaAsSymbol(char)\n ) {\n return hira.concat(char);\n }\n\n // Transform long vowels: 'オー' to 'おう'\n if (\n convertLongVowelMark\n && previousKana\n && isCharInnerLongDash(char, index)\n ) {\n // Transform previousKana back to romaji, and slice off the vowel\n const romaji = toRomaji(previousKana).slice(-1);\n // However, ensure 'オー' => 'おお' => 'oo' if this is a transform on the way to romaji\n if (\n isCharKatakana(input[index - 1])\n && romaji === 'o'\n && isDestinationRomaji\n ) {\n return hira.concat('お');\n }\n return hira.concat(LONG_VOWELS[romaji]);\n // Transform all other chars\n }\n\n if (!isCharLongDash(char) && isCharKatakana(char)) {\n const code = char.charCodeAt(0) + (HIRAGANA_START - KATAKANA_START);\n const hiraChar = String.fromCharCode(code);\n previousKana = hiraChar;\n return hira.concat(hiraChar);\n }\n\n // Pass non katakana chars through\n previousKana = '';\n return hira.concat(char);\n }, [])\n .join('');\n}\n\nexport default katakanaToHiragana;\n","import { transform, getSubTreeOf } from './kanaMapping';\nimport { ROMANIZATIONS } from '../constants.ts';\n\nlet kanaToHepburnMap = null;\n\n/* eslint-disable */\n// prettier-ignore\nconst BASIC_ROMAJI = {\n あ:'a', い:'i', う:'u', え:'e', お:'o',\n か:'ka', き:'ki', く:'ku', け:'ke', こ:'ko',\n さ:'sa', し:'shi', す:'su', せ:'se', そ:'so',\n た:'ta', ち:'chi', つ:'tsu', て:'te', と:'to',\n な:'na', に:'ni', ぬ:'nu', ね:'ne', の:'no',\n は:'ha', ひ:'hi', ふ:'fu', へ:'he', ほ:'ho',\n ま:'ma', み:'mi', む:'mu', め:'me', も:'mo',\n ら:'ra', り:'ri', る:'ru', れ:'re', ろ:'ro',\n や:'ya', ゆ:'yu', よ:'yo',\n わ:'wa', ゐ:'wi', ゑ:'we', を:'wo',\n ん: 'n',\n が:'ga', ぎ:'gi', ぐ:'gu', げ:'ge', ご:'go',\n ざ:'za', じ:'ji', ず:'zu', ぜ:'ze', ぞ:'zo',\n だ:'da', ぢ:'ji', づ:'zu', で:'de', ど:'do',\n ば:'ba', び:'bi', ぶ:'bu', べ:'be', ぼ:'bo',\n ぱ:'pa', ぴ:'pi', ぷ:'pu', ぺ:'pe', ぽ:'po',\n ゔぁ:'va', ゔぃ:'vi', ゔ:'vu', ゔぇ:'ve', ゔぉ:'vo',\n};\n/* eslint-enable */\n\nconst SPECIAL_SYMBOLS = {\n '。': '.',\n '、': ',',\n ':': ':',\n '・': '/',\n '!': '!',\n '?': '?',\n '〜': '~',\n 'ー': '-',\n '「': '‘',\n '」': '’',\n '『': '“',\n '』': '”',\n '[': '[',\n ']': ']',\n '(': '(',\n ')': ')',\n '{': '{',\n '}': '}',\n ' ': ' ',\n};\n\n// んい -> n'i\nconst AMBIGUOUS_VOWELS = ['あ', 'い', 'う', 'え', 'お', 'や', 'ゆ', 'よ'];\nconst SMALL_Y = { ゃ: 'ya', ゅ: 'yu', ょ: 'yo' };\nconst SMALL_Y_EXTRA = { ぃ: 'yi', ぇ: 'ye' };\nconst SMALL_AIUEO = {\n ぁ: 'a',\n ぃ: 'i',\n ぅ: 'u',\n ぇ: 'e',\n ぉ: 'o',\n};\nconst YOON_KANA = [\n 'き',\n 'に',\n 'ひ',\n 'み',\n 'り',\n 'ぎ',\n 'び',\n 'ぴ',\n 'ゔ',\n 'く',\n 'ふ',\n];\nconst YOON_EXCEPTIONS = {\n し: 'sh',\n ち: 'ch',\n じ: 'j',\n ぢ: 'j',\n};\nconst SMALL_KANA = {\n っ: '',\n ゃ: 'ya',\n ゅ: 'yu',\n ょ: 'yo',\n ぁ: 'a',\n ぃ: 'i',\n ぅ: 'u',\n ぇ: 'e',\n ぉ: 'o',\n};\n\n// going with the intuitive (yet incorrect) solution where っや -> yya and っぃ -> ii\n// in other words, just assume the sokuon could have been applied to anything\nconst SOKUON_WHITELIST = {\n b: 'b',\n c: 't',\n d: 'd',\n f: 'f',\n g: 'g',\n h: 'h',\n j: 'j',\n k: 'k',\n m: 'm',\n p: 'p',\n q: 'q',\n r: 'r',\n s: 's',\n t: 't',\n v: 'v',\n w: 'w',\n x: 'x',\n z: 'z',\n};\n\nfunction getKanaToHepburnTree() {\n if (kanaToHepburnMap == null) {\n kanaToHepburnMap = createKanaToHepburnMap();\n }\n return kanaToHepburnMap;\n}\n\nexport function getKanaToRomajiTree(romanization) {\n switch (romanization) {\n case ROMANIZATIONS.HEPBURN:\n return getKanaToHepburnTree();\n default:\n return {};\n }\n}\n\nfunction createKanaToHepburnMap() {\n const romajiTree = transform(BASIC_ROMAJI);\n\n const subtreeOf = (string) => getSubTreeOf(romajiTree, string);\n const setTrans = (string, transliteration) => {\n subtreeOf(string)[''] = transliteration;\n };\n\n Object.entries(SPECIAL_SYMBOLS).forEach(([jsymbol, symbol]) => {\n subtreeOf(jsymbol)[''] = symbol;\n });\n\n [...Object.entries(SMALL_Y), ...Object.entries(SMALL_AIUEO)].forEach(\n ([roma, kana]) => {\n setTrans(roma, kana);\n }\n );\n\n // きゃ -> kya\n YOON_KANA.forEach((kana) => {\n const firstRomajiChar = subtreeOf(kana)[''][0];\n Object.entries(SMALL_Y).forEach(([yKana, yRoma]) => {\n setTrans(kana + yKana, firstRomajiChar + yRoma);\n });\n // きぃ -> kyi\n Object.entries(SMALL_Y_EXTRA).forEach(([yKana, yRoma]) => {\n setTrans(kana + yKana, firstRomajiChar + yRoma);\n });\n });\n\n Object.entries(YOON_EXCEPTIONS).forEach(([kana, roma]) => {\n // じゃ -> ja\n Object.entries(SMALL_Y).forEach(([yKana, yRoma]) => {\n setTrans(kana + yKana, roma + yRoma[1]);\n });\n // じぃ -> jyi, じぇ -> je\n setTrans(`${kana}ぃ`, `${roma}yi`);\n setTrans(`${kana}ぇ`, `${roma}e`);\n });\n\n romajiTree['っ'] = resolveTsu(romajiTree);\n\n Object.entries(SMALL_KANA).forEach(([kana, roma]) => {\n setTrans(kana, roma);\n });\n\n AMBIGUOUS_VOWELS.forEach((kana) => {\n setTrans(`ん${kana}`, `n'${subtreeOf(kana)['']}`);\n });\n\n // NOTE: could be re-enabled with an option?\n // // んば -> mbo\n // const LABIAL = [\n // 'ば', 'び', 'ぶ', 'べ', 'ぼ',\n // 'ぱ', 'ぴ', 'ぷ', 'ぺ', 'ぽ',\n // 'ま', 'み', 'む', 'め', 'も',\n // ];\n // LABIAL.forEach((kana) => {\n // setTrans(`ん${kana}`, `m${subtreeOf(kana)['']}`);\n // });\n\n return Object.freeze(JSON.parse(JSON.stringify(romajiTree)));\n}\n\nfunction resolveTsu(tree) {\n return Object.entries(tree).reduce((tsuTree, [key, value]) => {\n if (!key) {\n // we have reached the bottom of this branch\n const consonant = value.charAt(0);\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = Object.keys(SOKUON_WHITELIST).includes(consonant)\n ? SOKUON_WHITELIST[consonant] + value\n : value;\n } else {\n // more subtrees\n // eslint-disable-next-line no-param-reassign\n tsuTree[key] = resolveTsu(value);\n }\n return tsuTree;\n }, {});\n}\n","import memoizeOne from 'memoize-one';\nimport { dequal } from 'dequal';\n\nimport mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport katakanaToHiragana from './utils/katakanaToHiragana';\nimport isKatakana from './isKatakana';\nimport { getKanaToRomajiTree } from './utils/kanaToRomajiMap';\nimport { applyMapping, mergeCustomMapping } from './utils/kanaMapping';\n\n// memoize and deeply compare args so we only recreate when necessary\nexport const createKanaToRomajiMap = memoizeOne(\n (romanization, customRomajiMapping) => {\n let map = getKanaToRomajiTree(romanization);\n\n if (customRomajiMapping) {\n map = mergeCustomMapping(map, customRomajiMapping);\n }\n\n return map;\n },\n dequal\n);\n\n/**\n * Convert kana to romaji\n * @param {String} kana text input\n * @param {DefaultOptions} [options=defaultOptions]\n * @param {Object.} [map] custom mapping\n * @return {String} converted text\n * @example\n * toRomaji('ひらがな カタカナ')\n * // => 'hiragana katakana'\n * toRomaji('げーむ ゲーム')\n * // => 'ge-mu geemu'\n * toRomaji('ひらがな カタカナ', { upcaseKatakana: true })\n * // => 'hiragana KATAKANA'\n * toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' } });\n * // => 'tuzigili'\n */\nexport function toRomaji(input = '', options = {}, map) {\n const config = mergeWithDefaultOptions(options);\n\n if (!map) {\n map = createKanaToRomajiMap(\n config.romanization,\n config.customRomajiMapping\n );\n }\n\n // just throw away the substring index information and simply concatenate all the kana\n return splitIntoRomaji(input, config, map)\n .map((romajiToken) => {\n const [start, end, romaji] = romajiToken;\n const makeUpperCase = config.upcaseKatakana && isKatakana(input.slice(start, end));\n return makeUpperCase ? romaji.toUpperCase() : romaji;\n })\n .join('');\n}\n\nfunction splitIntoRomaji(input, options, map) {\n if (!map) {\n map = createKanaToRomajiMap(\n options.romanization,\n options.customRomajiMapping\n );\n }\n\n const config = Object.assign({}, { isDestinationRomaji: true }, options);\n\n return applyMapping(\n katakanaToHiragana(input, toRomaji, config),\n map,\n !options.IMEMode\n );\n}\n\nexport default toRomaji;\n","import isEmpty from './isEmpty';\nimport { EN_PUNCTUATION_RANGES } from '../constants.ts';\nimport isCharInRange from './isCharInRange';\n\n/**\n * Tests a character. Returns true if the character is considered English punctuation.\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharEnglishPunctuation(char = '') {\n if (isEmpty(char)) return false;\n return EN_PUNCTUATION_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharEnglishPunctuation;\n","import isEmpty from './isEmpty';\nimport { JA_PUNCTUATION_RANGES } from '../constants.ts';\nimport isCharInRange from './isCharInRange';\nimport isCharIterationMark from './isCharIterationMark';\n\n/**\n * Tests a character. Returns true if the character is considered Japanese punctuation.\n * @param {String} char character string to test\n * @return {Boolean}\n */\nfunction isCharJapanesePunctuation(char = '') {\n if (isEmpty(char) || isCharIterationMark(char)) return false;\n return JA_PUNCTUATION_RANGES.some(([start, end]) => isCharInRange(char, start, end));\n}\n\nexport default isCharJapanesePunctuation;\n","import isEmpty from './utils/isEmpty';\nimport isCharEnglishPunctuation from './utils/isCharEnglishPunctuation';\nimport isCharJapanesePunctuation from './utils/isCharJapanesePunctuation';\nimport isCharRomaji from './utils/isCharRomaji';\nimport isCharKanji from './utils/isCharKanji';\nimport isCharHiragana from './utils/isCharHiragana';\nimport isCharKatakana from './utils/isCharKatakana';\nimport isCharJapanese from './utils/isCharJapanese';\n\nconst isCharEnSpace = (x) => x === ' ';\nconst isCharJaSpace = (x) => x === ' ';\nconst isCharJaNum = (x) => /[0-9]/.test(x);\nconst isCharEnNum = (x) => /[0-9]/.test(x);\n\nconst TOKEN_TYPES = {\n EN: 'en',\n JA: 'ja',\n EN_NUM: 'englishNumeral',\n JA_NUM: 'japaneseNumeral',\n EN_PUNC: 'englishPunctuation',\n JA_PUNC: 'japanesePunctuation',\n KANJI: 'kanji',\n HIRAGANA: 'hiragana',\n KATAKANA: 'katakana',\n SPACE: 'space',\n OTHER: 'other',\n};\n\n// prettier-ignore\nexport function getType(input, compact = false) {\n const {\n EN, JA, EN_NUM, JA_NUM, EN_PUNC, JA_PUNC, KANJI, HIRAGANA, KATAKANA, SPACE, OTHER,\n } = TOKEN_TYPES;\n\n if (compact) {\n switch (true) {\n case isCharJaNum(input): return OTHER;\n case isCharEnNum(input): return OTHER;\n case isCharEnSpace(input): return EN;\n case isCharEnglishPunctuation(input): return OTHER;\n case isCharJaSpace(input): return JA;\n case isCharJapanesePunctuation(input): return OTHER;\n case isCharJapanese(input): return JA;\n case isCharRomaji(input): return EN;\n default: return OTHER;\n }\n } else {\n switch (true) {\n case isCharJaSpace(input): return SPACE;\n case isCharEnSpace(input): return SPACE;\n case isCharJaNum(input): return JA_NUM;\n case isCharEnNum(input): return EN_NUM;\n case isCharEnglishPunctuation(input): return EN_PUNC;\n case isCharJapanesePunctuation(input): return JA_PUNC;\n case isCharKanji(input): return KANJI;\n case isCharHiragana(input): return HIRAGANA;\n case isCharKatakana(input): return KATAKANA;\n case isCharJapanese(input): return JA;\n case isCharRomaji(input): return EN;\n default: return OTHER;\n }\n }\n}\n\n/**\n * Splits input into array of strings separated by opinionated token types\n * `'en', 'ja', 'englishNumeral', 'japaneseNumeral','englishPunctuation', 'japanesePunctuation','kanji', 'hiragana', 'katakana', 'space', 'other'`.\n * If `{ compact: true }` then many same-language tokens are combined (spaces + text, kanji + kana, numeral + punctuation).\n * If `{ detailed: true }` then return array will contain `{ type, value }` instead of `'value'`\n * @param {String} input text\n * @param {{compact: Boolean | undefined, detailed: Boolean | undefined}} [options={ compact: false, detailed: false}] options to modify output style\n * @return {(String[]|Array.<{type: String, value: String}>)} text split into tokens containing values, or detailed object\n * @example\n * tokenize('ふふフフ')\n * // ['ふふ', 'フフ']\n *\n * tokenize('感じ')\n * // ['感', 'じ']\n *\n * tokenize('人々')\n * // ['人々']\n *\n * tokenize('truly 私は悲しい')\n * // ['truly', ' ', '私', 'は', '悲', 'しい']\n *\n * tokenize('truly 私は悲しい', { compact: true })\n * // ['truly ', '私は悲しい']\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。!')\n * // [ '5', 'romaji', ' ', 'here', '...!?', '人々漢字', 'ひらがな', 'カタ', ' ', 'カナ', '4', '「', 'SHIO', '」。!']\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。!', { compact: true })\n * // [ '5', 'romaji here', '...!?', '人々漢字ひらがなカタ カナ', '4「', 'SHIO', '」。!']\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。! لنذهب', { detailed: true })\n * // [\n * { type: 'englishNumeral', value: '5' },\n * { type: 'en', value: 'romaji' },\n * { type: 'space', value: ' ' },\n * { type: 'en', value: 'here' },\n * { type: 'englishPunctuation', value: '...!?' },\n * { type: 'kanji', value: '人々漢字' },\n * { type: 'hiragana', value: 'ひらがな' },\n * { type: 'katakana', value: 'カタ' },\n * { type: 'space', value: ' ' },\n * { type: 'katakana', value: 'カナ' },\n * { type: 'japaneseNumeral', value: '4' },\n * { type: 'japanesePunctuation', value: '「' },\n * { type: 'ja', value: 'SHIO' },\n * { type: 'japanesePunctuation', value: '」。!' },\n * { type: 'space', value: ' ' },\n * { type: 'other', value: 'لنذهب' },\n * ]\n *\n * tokenize('5romaji here...!?人々漢字ひらがなカタ カナ4「SHIO」。! لنذهب', { compact: true, detailed: true})\n * // [\n * { type: 'other', value: '5' },\n * { type: 'en', value: 'romaji here' },\n * { type: 'other', value: '...!?' },\n * { type: 'ja', value: '人々漢字ひらがなカタ カナ' },\n * { type: 'other', value: '4「' },\n * { type: 'ja', value: 'SHIO' },\n * { type: 'other', value: '」。!' },\n * { type: 'en', value: ' ' },\n * { type: 'other', value: 'لنذهب' },\n *]\n */\nfunction tokenize(input, { compact = false, detailed = false } = {}) {\n if (input == null || isEmpty(input)) {\n return [];\n }\n const chars = [...input];\n let initial = chars.shift();\n let prevType = getType(initial, compact);\n initial = detailed ? { type: prevType, value: initial } : initial;\n\n const result = chars.reduce(\n (tokens, char) => {\n const currType = getType(char, compact);\n const sameType = currType === prevType;\n prevType = currType;\n let newValue = char;\n\n if (sameType) {\n newValue = (detailed ? tokens.pop().value : tokens.pop()) + newValue;\n }\n\n return detailed\n ? tokens.concat({ type: currType, value: newValue })\n : tokens.concat(newValue);\n },\n [initial]\n );\n return result;\n}\n\nexport default tokenize;\n","import isJapanese from './isJapanese';\nimport isKana from './isKana';\nimport isKanji from './isKanji';\nimport tokenize from './tokenize';\n\nconst isLeadingWithoutInitialKana = (input, leading) => leading && !isKana(input[0]);\nconst isTrailingWithoutFinalKana = (input, leading) => !leading && !isKana(input[input.length - 1]);\nconst isInvalidMatcher = (input, matchKanji) =>\n (matchKanji && ![...matchKanji].some(isKanji)) || (!matchKanji && isKana(input));\n\n/**\n * Strips [Okurigana](https://en.wikipedia.org/wiki/Okurigana)\n * @param {String} input text\n * @param {{ leading: Boolean | undefined, matchKanji: string | undefined }} [options={ leading: false, matchKanji: '' }] optional config\n * @return {String} text with okurigana removed\n * @example\n * stripOkurigana('踏み込む')\n * // => '踏み込'\n * stripOkurigana('お祝い')\n * // => 'お祝'\n * stripOkurigana('お腹', { leading: true });\n * // => '腹'\n * stripOkurigana('ふみこむ', { matchKanji: '踏み込む' });\n * // => 'ふみこ'\n * stripOkurigana('おみまい', { matchKanji: 'お祝い', leading: true });\n * // => 'みまい'\n */\nfunction stripOkurigana(input = '', { leading = false, matchKanji = '' } = {}) {\n if (\n !isJapanese(input) ||\n isLeadingWithoutInitialKana(input, leading) ||\n isTrailingWithoutFinalKana(input, leading) ||\n isInvalidMatcher(input, matchKanji)\n ) {\n return input;\n }\n\n const chars = matchKanji || input;\n const okuriganaRegex = new RegExp(\n leading ? `^${tokenize(chars).shift()}` : `${tokenize(chars).pop()}$`\n );\n return input.replace(okuriganaRegex, '');\n}\n\nexport default stripOkurigana;\n","import mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport katakanaToHiragana from './utils/katakanaToHiragana';\nimport isCharEnglishPunctuation from './utils/isCharEnglishPunctuation';\nimport isRomaji from './isRomaji';\nimport isMixed from './isMixed';\nimport toKana from './toKana';\nimport toRomaji from './toRomaji';\n\n/**\n * Convert input to [Hiragana](https://en.wikipedia.org/wiki/Hiragana)\n * @param {String} [input=''] text\n * @param {DefaultOptions} [options=defaultOptions]\n * @return {String} converted text\n * @example\n * toHiragana('toukyou, オオサカ')\n * // => 'とうきょう、 おおさか'\n * toHiragana('only カナ', { passRomaji: true })\n * // => 'only かな'\n * toHiragana('wi')\n * // => 'うぃ'\n * toHiragana('wi', { useObsoleteKana: true })\n * // => 'ゐ'\n */\nfunction toHiragana(input = '', options = {}) {\n const config = mergeWithDefaultOptions(options);\n if (config.passRomaji) {\n return katakanaToHiragana(input, toRomaji, config);\n }\n\n if (isMixed(input, { passKanji: true })) {\n const convertedKatakana = katakanaToHiragana(input, toRomaji, config);\n return toKana(convertedKatakana.toLowerCase(), config);\n }\n\n if (isRomaji(input) || isCharEnglishPunctuation(input)) {\n return toKana(input.toLowerCase(), config);\n }\n\n return katakanaToHiragana(input, toRomaji, config);\n}\n\nexport default toHiragana;\n","import mergeWithDefaultOptions from './utils/mergeWithDefaultOptions';\nimport hiraganaToKatakana from './utils/hiraganaToKatakana';\nimport isCharEnglishPunctuation from './utils/isCharEnglishPunctuation';\nimport toKana from './toKana';\nimport isRomaji from './isRomaji';\nimport isMixed from './isMixed';\n\n/**\n * Convert input to [Katakana](https://en.wikipedia.org/wiki/Katakana)\n * @param {String} [input=''] text\n * @param {DefaultOptions} [options=defaultOptions]\n * @return {String} converted text\n * @example\n * toKatakana('toukyou, おおさか')\n * // => 'トウキョウ、 オオサカ'\n * toKatakana('only かな', { passRomaji: true })\n * // => 'only カナ'\n * toKatakana('wi')\n * // => 'ウィ'\n * toKatakana('wi', { useObsoleteKana: true })\n * // => 'ヰ'\n */\nfunction toKatakana(input = '', options = {}) {\n const mergedOptions = mergeWithDefaultOptions(options);\n if (mergedOptions.passRomaji) {\n return hiraganaToKatakana(input);\n }\n\n if (isMixed(input) || isRomaji(input) || isCharEnglishPunctuation(input)) {\n const hiragana = toKana(input.toLowerCase(), mergedOptions);\n return hiraganaToKatakana(hiragana);\n }\n\n return hiraganaToKatakana(input);\n}\n\nexport default toKatakana;\n","import { findListeners, untrackListeners } from './utils/dom';\nimport { removeDebugListeners } from './utils/logInputEvents';\n\n/**\n * Unbinds eventListener from input field\n * @param {HTMLInputElement | HTMLTextAreaElement} element textarea, input\n */\nexport function unbind(element, debug = false) {\n const listeners = findListeners(element);\n if (listeners == null) {\n throw new Error(\n `Element provided to Wanakana unbind() had no listener registered.\\n Received: ${JSON.stringify(\n element\n )}`\n );\n }\n const { inputHandler, compositionHandler } = listeners;\n const attributes = JSON.parse(element.dataset.previousAttributes);\n Object.keys(attributes).forEach((key) => {\n if (attributes[key]) {\n element.setAttribute(key, attributes[key]);\n } else {\n element.removeAttribute(key);\n }\n });\n element.removeAttribute('data-previous-attributes');\n element.removeAttribute('data-ignore-composition');\n element.removeEventListener('input', inputHandler);\n element.removeEventListener('compositionstart', compositionHandler);\n element.removeEventListener('compositionupdate', compositionHandler);\n element.removeEventListener('compositionend', compositionHandler);\n untrackListeners(listeners);\n if (debug === true) {\n removeDebugListeners(element);\n }\n}\n\nexport default unbind;\n"],"names":["typeOf","value","Object","toString","call","slice","toLowerCase","isEmpty","input","length","isCharInRange","char","arguments","undefined","start","end","code","charCodeAt","VERSION","TO_KANA_METHODS","HIRAGANA","KATAKANA","ROMANIZATIONS","HEPBURN","DEFAULT_OPTIONS","useObsoleteKana","passRomaji","convertLongVowelMark","upcaseKatakana","IMEMode","romanization","LATIN_UPPERCASE_START","LATIN_UPPERCASE_END","HIRAGANA_START","HIRAGANA_END","KATAKANA_START","KATAKANA_END","KANJI_START","KANJI_END","KANJI_ITERATION_MARK","PROLONGED_SOUND_MARK","KANA_SLASH_DOT","ZENKAKU_UPPERCASE","ZENKAKU_LOWERCASE","KANA_PUNCTUATION","JA_PUNCTUATION_RANGES","JAPANESE_RANGES","ROMAJI_RANGES","EN_PUNCTUATION_RANGES","isCharJapanese","some","_ref","isJapanese","allowed","augmented","every","isJa","test","safeIsNaN","Number","isNaN","areInputsEqual","newInputs","lastInputs","i","first","second","memoizeOne","resultFn","isEqual","cache","memoized","newArgs","_i","lastThis","this","lastArgs","lastResult","apply","clear","has","prototype","hasOwnProperty","find","iter","tar","key","keys","dequal","foo","bar","ctor","len","tmp","constructor","Date","getTime","RegExp","Array","Set","size","Map","get","ArrayBuffer","Uint8Array","DataView","byteLength","getInt8","isView","mergeWithDefaultOptions","opts","assign","applyMapping","string","mapping","convertEnding","root","newChunk","remaining","currentCursor","firstChar","charAt","parse","tree","lastCursor","concat","subtree","nextChar","nextSubtree","transform","entries","reduce","map","endOfBranch","getSubTreeOf","split","correctSubTree","createCustomMapping","customMap","customTree","forEach","_ref2","roma","kana","subTree","transformMap","mapSubtree","customSubtree","newSubtree","_ref3","JSON","stringify","mergeCustomMapping","customMapping","BASIC_KUNREI","a","u","e","o","k","s","t","n","h","m","y","r","w","g","z","d","b","p","v","SPECIAL_SYMBOLS","CONSONANTS","q","f","SMALL_Y","ya","yi","yu","ye","yo","SMALL_VOWELS","ALIASES","sh","ch","cy","chy","shy","j","jy","shi","chi","tsu","ji","fu","SMALL_LETTERS","tu","wa","ka","ke","SPECIAL_CASES","wu","wi","we","kwa","whu","tha","thu","tho","dha","dhu","dho","AIUEO_CONSTRUCTIONS","wh","kw","qw","gw","sw","ts","th","tw","dh","dw","fw","createRomajiToKanaMap","kanaTree","subtreeOf","addTsu","tsuTree","_ref10","consonant","yKana","symbol","jsymbol","_ref4","aiueoKana","_ref5","vowel","nChar","c","_ref6","alternative","allExceptLast","last","_ref8","kunreiRoma","chars","xSubtree","list","_ref7","alt","startsWith","replace","altRoma","prefix","_ref9","freeze","romajiToKanaMap","USE_OBSOLETE_KANA_MAP","isCharUpperCase","isCharLongDash","isCharSlashDot","isCharHiragana","hiraganaToKatakana","kata","push","kataChar","String","fromCharCode","join","customKanaMapping","mapCopy","IME_MODE_MAP","toKana","config","options","splitIntoConvertedKana","kanaToken","enforceHiragana","enforceKatakana","LISTENERS","makeOnInput","mergedConfig","preConfiguredMap","triggers","toUpperCase","target","prevInput","dataset","ignoreComposition","head","textToConvert","tail","toConvert","text","cursor","includes","catalystChars","takeWhileAndSlice","workFromStart","startIndex","reverse","workBackwards","splitInput","selectionEnd","convertedText","newCursor","newValue","setTimeout","setSelectionRange","convertInput","onComposition","type","data","window","navigator","platform","source","predicate","x","result","events","selectionStart","console","log","compositionstart","onCompositionStart","compositionupdate","compositionend","onCompositionEnd","ELEMENTS","idCounter","isCharRomaji","isRomaji","isRoma","isCharKatakana","isCharKana","isKana","isHiragana","isKatakana","isCharIterationMark","isCharKanji","isKanji","isMixed","hasKanji","passKanji","isCharInitialLongDash","index","isCharInnerLongDash","isKanaAsSymbol","LONG_VOWELS","katakanaToHiragana","toRomaji","isDestinationRomaji","previousKana","hira","romaji","hiraChar","kanaToHepburnMap","BASIC_ROMAJI","あ","い","う","え","お","か","き","く","け","こ","さ","し","す","せ","そ","た","ち","つ","て","と","な","に","ぬ","ね","の","は","ひ","ふ","へ","ほ","ま","み","む","め","も","ら","り","る","れ","ろ","や","ゆ","よ","わ","ゐ","ゑ","を","ん","が","ぎ","ぐ","げ","ご","ざ","じ","ず","ぜ","ぞ","だ","ぢ","づ","で","ど","ば","び","ぶ","べ","ぼ","ぱ","ぴ","ぷ","ぺ","ぽ","ゔぁ","ゔぃ","ゔ","ゔぇ","ゔぉ","AMBIGUOUS_VOWELS","ゃ","ゅ","ょ","SMALL_Y_EXTRA","ぃ","ぇ","SMALL_AIUEO","ぁ","ぅ","ぉ","YOON_KANA","YOON_EXCEPTIONS","SMALL_KANA","っ","SOKUON_WHITELIST","getKanaToHepburnTree","romajiTree","setTrans","transliteration","firstRomajiChar","yRoma","resolveTsu","createKanaToHepburnMap","createKanaToRomajiMap","customRomajiMapping","getKanaToRomajiTree","splitIntoRomaji","romajiToken","isCharEnglishPunctuation","isCharJapanesePunctuation","isCharEnSpace","isCharJaSpace","isCharJaNum","isCharEnNum","TOKEN_TYPES","EN","JA","EN_NUM","JA_NUM","EN_PUNC","JA_PUNC","KANJI","SPACE","OTHER","getType","compact","tokenize","detailed","initial","shift","prevType","tokens","currType","sameType","pop","element","debug","nodeName","Error","hasAttribute","onInput","id","now","previousAttributes","name","attribute","getAttribute","setAttribute","addEventListener","inputHandler","compositionHandler","trackListeners","event","handler","leading","matchKanji","isLeadingWithoutInitialKana","isTrailingWithoutFinalKana","isInvalidMatcher","okuriganaRegex","mergedOptions","listeners","el","attributes","removeAttribute","removeEventListener","targetId","filter","untrackListeners"],"mappings":"gPAmBA,SAASA,EAAOC,GACd,OAAc,OAAVA,EACK,OAELA,IAAUC,OAAOD,UACLA,EAET,GAAGE,SACPC,KAAKH,GACLI,MAAM,GAAI,GACVC,aACL,CCxBA,SAASC,EAAQC,GACf,MAAsB,WAAlBR,EAAOQ,KAGHA,EAAMC,MAChB,CCFA,SAASC,IAAqC,IAAvBC,EAAIC,UAAAH,OAAA,QAAAI,IAAAD,UAAA,GAAAA,UAAA,GAAG,GAAIE,EAAKF,UAAAH,OAAAG,EAAAA,kBAAAC,EAAEE,EAAGH,UAAAH,OAAAG,EAAAA,kBAAAC,EAC1C,GAAIN,EAAQI,GAAO,OAAO,EAC1B,MAAMK,EAAOL,EAAKM,WAAW,GAC7B,OAAOH,GAASE,GAAQA,GAAQD,CAClC,CCbaG,MAEAC,EAGT,CACFC,SAAU,aACVC,SAAU,cAGCC,EAAwC,CACnDC,QAAS,WA6CEC,EAAkC,CAC7CC,iBAAiB,EACjBC,YAAY,EACZC,sBAAsB,EACtBC,gBAAgB,EAChBC,SAAS,EACTC,aAAcR,EAAcC,SASjBQ,EAAwB,GACxBC,EAAsB,GAKtBC,EAAiB,MACjBC,EAAe,MACfC,EAAiB,MACjBC,EAAe,MACfC,EAAc,MACdC,EAAY,MAEZC,EAAuB,MACvBC,EAAuB,MACvBC,EAAiB,MAGxBC,EAAoB,CAda,MACF,OAc/BC,EAAoB,CAjBa,MACF,OA2B/BC,EAAmB,CAAC,MAAQ,OAYrBC,EAAwB,CAXL,CAAC,MAAQ,OAavCD,EAf2B,CAAC,MAAQ,OATR,CAAC,MAAQ,OACT,CAAC,MAAQ,OACT,CAAC,MAAQ,OAC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C,EuB/FI3B,IvBiGxBtN,GAAUxM,MAAK4J,IAAA,IAACwQ,GAAEA,GAAIxQ,EAAA,OAAKwQ,IAAOqB,EAAGhB,aAAa,mBAAmB,IAFxE,IAAuBgB,EuB9F5B,GAAiB,MAAbD,EACF,MAAM,IAAIvB,MACyE9V,iFAAAA,KAAKC,UACpF0V,MAIN,MAAMc,aAAEA,EAAYC,mBAAEA,GAAuBW,EACvCE,EAAavX,KAAK5B,MAAMuX,EAAQ9M,QAAQsN,oBtBSXjf,MsBRnCN,OAAOqF,KAAKsb,GAAYjY,SAAStD,IAC3Bub,EAAWvb,GACb2Z,EAAQY,aAAava,EAAKub,EAAWvb,IAErC2Z,EAAQ6B,gBAAgBxb,EAC1B,IAEF2Z,EAAQ6B,gBAAgB,4BACxB7B,EAAQ6B,gBAAgB,2BACxB7B,EAAQ8B,oBAAoB,QAAShB,GACrCd,EAAQ8B,oBAAoB,mBAAoBf,GAChDf,EAAQ8B,oBAAoB,oBAAqBf,GACjDf,EAAQ8B,oBAAoB,iBAAkBf,GvBqEzC,SAAyB3W,GAAmB,IAAhBkW,GAAIyB,GAAU3X,EAC/CsI,GAAYA,GAAUsP,QAAOpS,IAAA,IAAC0Q,GAAEA,GAAI1Q,EAAA,OAAK0Q,IAAOyB,CAAQ,GAC1D,CuBtEEE,CAAiBP,IACH,IAAVzB,ItBN+B1e,EsBOZye,EtBNvB/e,OAAOgI,QAAQkM,IAAQxL,SAAQiG,IAAA,IAAEqR,EAAOC,GAAQtR,EAAA,OAAKrO,EAAMugB,oBAAoBb,EAAOC,EAAQ,IsBQhG","x_google_ignoreList":[6,7]} \ No newline at end of file diff --git a/docs/bind.js.html b/docs/bind.js.html index 62fe823..4894a12 100644 --- a/docs/bind.js.html +++ b/docs/bind.js.html @@ -75,7 +75,7 @@

-

+
@@ -104,7 +104,7 @@

/** * Binds eventListener for 'input' events to an input field to automagically replace values with kana * Can pass `{ IMEMode: 'toHiragana' || 'toKatakana' }` to enforce kana conversion type - * @param {HTMLElement} element textarea, input[type="text"] etc + * @param {HTMLInputElement | HTMLTextAreaElement} element textarea, input[type="text"] etc * @param {DefaultOptions} [options=defaultOptions] defaults to { IMEMode: true } using `toKana` * @example * bind(document.querySelector('#myInput')); @@ -158,7 +158,7 @@


diff --git a/docs/constants.js.html b/docs/constants.ts.html similarity index 87% rename from docs/constants.js.html rename to docs/constants.ts.html index 95def6f..a3875cb 100644 --- a/docs/constants.js.html +++ b/docs/constants.ts.html @@ -8,7 +8,7 @@ - constants.js - Documentation + constants.ts - Documentation @@ -75,13 +75,13 @@

-

+

- constants.js + constants.ts

@@ -92,19 +92,33 @@

export const VERSION = '5.2.0';
 
-export const TO_KANA_METHODS = {
+export const TO_KANA_METHODS: {
+  HIRAGANA: 'toHiragana',
+  KATAKANA: 'toKatakana',
+} = {
   HIRAGANA: 'toHiragana',
   KATAKANA: 'toKatakana',
 };
 
-export const ROMANIZATIONS = {
+export const ROMANIZATIONS: { HEPBURN: 'hepburn' } = {
   HEPBURN: 'hepburn',
 };
 
+export type DefaultOptions = {
+  useObsoleteKana?: boolean,
+  passRomaji?: boolean,
+  convertLongVowelMark?: boolean,
+  upcaseKatakana?: boolean,
+  IMEMode?: boolean | 'toHiragana' | 'toKatakana',
+  romanization?: 'hepburn',
+  customKanaMapping?: { [index: string]: string }
+  customRomajiMapping?: { [index: string]: string }
+};
+
 /**
  * Default config for WanaKana, user passed options will be merged with these
  * @type {DefaultOptions}
- * @name defaultOptions
+ * @name DefaultOptions
  * @property {Boolean} [useObsoleteKana=false] - Set to true to use obsolete characters, such as ゐ and ゑ.
  * @example
  * toHiragana('we', { useObsoleteKana: true })
@@ -113,7 +127,7 @@ 

* @example * toHiragana('only convert the katakana: ヒラガナ', { passRomaji: true }) * // => "only convert the katakana: ひらがな" - * @property {Object} [convertLongVowelMark=true] - Set to false to prevent conversions of 'ー' to extended vowels with toHiragana() + * @property {Boolean} [convertLongVowelMark=true] - Set to false to prevent conversions of 'ー' to extended vowels with toHiragana() * @example * toHiragana('ラーメン', { convertLongVowelMark: false }); * // => 'らーめん @@ -121,23 +135,23 @@

* @example * toRomaji('ひらがな カタカナ', { upcaseKatakana: true }) * // => "hiragana KATAKANA" - * @property {Boolean|String} [IMEMode=false] - Set to true, 'toHiragana', or 'toKatakana' to handle conversion while it is being typed. - * @property {String} [romanization='hepburn'] - choose toRomaji() romanization map (currently only 'hepburn') - * @property {Object} [customKanaMapping] - custom map will be merged with default conversion + * @property {Boolean | 'toHiragana' | 'toKatakana'} [IMEMode=false] - Set to true, 'toHiragana', or 'toKatakana' to handle conversion while it is being typed. + * @property {'hepburn'} [romanization='hepburn'] - choose toRomaji() romanization map (currently only 'hepburn') + * @property {Object.<String, String>} [customKanaMapping] - custom map will be merged with default conversion * @example * toKana('wanakana', { customKanaMapping: { na: 'に', ka: 'Bana' }) }; * // => 'わにBanaに' - * @property {Object} [customRomajiMapping] - custom map will be merged with default conversion + * @property {Object.<String, String>} [customRomajiMapping] - custom map will be merged with default conversion * @example * toRomaji('つじぎり', { customRomajiMapping: { じ: 'zi', つ: 'tu', り: 'li' }) }; * // => 'tuzigili' */ -export const DEFAULT_OPTIONS = { +export const DEFAULT_OPTIONS: DefaultOptions = { useObsoleteKana: false, passRomaji: false, + convertLongVowelMark: true, upcaseKatakana: false, IMEMode: false, - convertLongVowelMark: true, romanization: ROMANIZATIONS.HEPBURN, }; @@ -246,7 +260,7 @@


diff --git a/docs/global.html b/docs/global.html index be0689e..90b16a2 100644 --- a/docs/global.html +++ b/docs/global.html @@ -73,7 +73,7 @@

-

+
@@ -161,8 +161,8 @@

Members

-

- defaultOptions :DefaultOptions +

+ DefaultOptions :DefaultOptions

@@ -298,7 +298,7 @@
Properties:
- Object + Boolean @@ -390,7 +390,13 @@
Properties:
| - String + 'toHiragana' + + + | + + + 'toKatakana' @@ -433,7 +439,7 @@
Properties:
- String + 'hepburn' @@ -476,7 +482,7 @@
Properties:
- Object + Object.<String, String> @@ -517,7 +523,7 @@
Properties:
- Object + Object.<String, String> @@ -585,7 +591,7 @@
Properties:
@@ -705,7 +711,13 @@
Parameters:
- HTMLElement + HTMLInputElement + + + | + + + HTMLTextAreaElement @@ -746,7 +758,7 @@
Parameters:
- DefaultOptions + DefaultOptions @@ -1156,7 +1168,7 @@
Parameters:
- Regexp + RegExp @@ -2187,7 +2199,7 @@
Parameters:
- Regexp + RegExp @@ -2651,7 +2663,7 @@
Parameters:
- DefaultOptions + DefaultOptions @@ -2785,7 +2797,7 @@
Example

- toKana(inputopt, optionsopt) → {String} + toKana(inputopt, optionsopt, mapopt) → {String}

@@ -2883,7 +2895,7 @@
Parameters:
- DefaultOptions + DefaultOptions @@ -2919,6 +2931,49 @@
Parameters:
+ + + map + + + + + + + Object.<string, string> + + + + + + + + + + + + <optional>
+ + + + + + + + + + + + + + + +

custom mapping

+ + + + + @@ -2957,7 +3012,7 @@
Parameters:
@@ -3121,7 +3176,7 @@
Parameters:
- DefaultOptions + DefaultOptions @@ -3255,7 +3310,7 @@
Example

- tokenize(input, optionsopt) → {String|Array.<Object>} + tokenize(input, optionsopt) → {Array.<String>|Array.<{type: String, value: String}>}

@@ -3531,7 +3586,7 @@
Example

- toRomaji(kana, optionsopt, map) → {String} + toRomaji(kana, optionsopt, mapopt) → {String}

@@ -3625,7 +3680,7 @@
Parameters:
- DefaultOptions + DefaultOptions @@ -3670,7 +3725,7 @@
Parameters:
- Object + Object.<string, string> @@ -3682,6 +3737,8 @@
Parameters:
+ <optional>
+ @@ -3849,7 +3906,13 @@
Parameters:
- HTMLElement + HTMLInputElement + + + | + + + HTMLTextAreaElement @@ -3950,7 +4013,7 @@
Parameters:

diff --git a/docs/index.html b/docs/index.html index f01c673..2298956 100644 --- a/docs/index.html +++ b/docs/index.html @@ -73,7 +73,7 @@

-

+
@@ -259,7 +259,7 @@

Ports


diff --git a/docs/isHiragana.js.html b/docs/isHiragana.js.html index ee4cd41..49ffc24 100644 --- a/docs/isHiragana.js.html +++ b/docs/isHiragana.js.html @@ -75,7 +75,7 @@

-

+
@@ -123,7 +123,7 @@


diff --git a/docs/isJapanese.js.html b/docs/isJapanese.js.html index 31cf52b..a70acba 100644 --- a/docs/isJapanese.js.html +++ b/docs/isJapanese.js.html @@ -75,7 +75,7 @@

-

+
@@ -97,7 +97,7 @@

/** * Test if `input` only includes [Kanji](https://en.wikipedia.org/wiki/Kanji), [Kana](https://en.wikipedia.org/wiki/Kana), zenkaku numbers, and JA punctuation/symbols.” * @param {String} [input=''] text - * @param {Regexp} [allowed] additional test allowed to pass for each char + * @param {RegExp} [allowed] additional test allowed to pass for each char * @return {Boolean} true if passes checks * @example * isJapanese('泣き虫') @@ -138,7 +138,7 @@


diff --git a/docs/isKana.js.html b/docs/isKana.js.html index 175bc94..4977cde 100644 --- a/docs/isKana.js.html +++ b/docs/isKana.js.html @@ -75,7 +75,7 @@

-

+
@@ -127,7 +127,7 @@


diff --git a/docs/isKanji.js.html b/docs/isKanji.js.html index 6b7d887..d7e9f14 100644 --- a/docs/isKanji.js.html +++ b/docs/isKanji.js.html @@ -75,7 +75,7 @@

-

+
@@ -127,7 +127,7 @@


diff --git a/docs/isKatakana.js.html b/docs/isKatakana.js.html index 56b7933..7f7741f 100644 --- a/docs/isKatakana.js.html +++ b/docs/isKatakana.js.html @@ -75,7 +75,7 @@

-

+
@@ -125,7 +125,7 @@


diff --git a/docs/isMixed.js.html b/docs/isMixed.js.html index e9025fa..90bc3e1 100644 --- a/docs/isMixed.js.html +++ b/docs/isMixed.js.html @@ -75,7 +75,7 @@

-

+
@@ -98,7 +98,7 @@

/** * Test if `input` contains a mix of [Romaji](https://en.wikipedia.org/wiki/Romaji) *and* [Kana](https://en.wikipedia.org/wiki/Kana), defaults to pass through [Kanji](https://en.wikipedia.org/wiki/Kanji) * @param {String} input text - * @param {Object} [options={ passKanji: true }] optional config to pass through kanji + * @param {{ passKanji: Boolean}} [options={ passKanji: true }] optional config to pass through kanji * @return {Boolean} true if mixed * @example * isMixed('Abあア')) @@ -134,7 +134,7 @@


diff --git a/docs/isRomaji.js.html b/docs/isRomaji.js.html index 881d0cc..6239bf0 100644 --- a/docs/isRomaji.js.html +++ b/docs/isRomaji.js.html @@ -75,7 +75,7 @@

-

+
@@ -97,7 +97,7 @@

/** * Test if `input` is [Romaji](https://en.wikipedia.org/wiki/Romaji) (allowing [Hepburn romanisation](https://en.wikipedia.org/wiki/Hepburn_romanization)) * @param {String} [input=''] text - * @param {Regexp} [allowed] additional test allowed to pass for each char + * @param {RegExp} [allowed] additional test allowed to pass for each char * @return {Boolean} true if [Romaji](https://en.wikipedia.org/wiki/Romaji) * @example * isRomaji('Tōkyō and Ōsaka') @@ -136,7 +136,7 @@


diff --git a/docs/stripOkurigana.js.html b/docs/stripOkurigana.js.html index 1d42785..605202e 100644 --- a/docs/stripOkurigana.js.html +++ b/docs/stripOkurigana.js.html @@ -75,7 +75,7 @@

-

+
@@ -103,7 +103,7 @@

/** * Strips [Okurigana](https://en.wikipedia.org/wiki/Okurigana) * @param {String} input text - * @param {Object} [options={ leading: false, matchKanji: '' }] optional config + * @param {{ leading: Boolean | undefined, matchKanji: string | undefined }} [options={ leading: false, matchKanji: '' }] optional config * @return {String} text with okurigana removed * @example * stripOkurigana('踏み込む') @@ -147,7 +147,7 @@


diff --git a/docs/toHiragana.js.html b/docs/toHiragana.js.html index 1f4e7ba..6115918 100644 --- a/docs/toHiragana.js.html +++ b/docs/toHiragana.js.html @@ -75,7 +75,7 @@

-

+
@@ -144,7 +144,7 @@


diff --git a/docs/toKana.js.html b/docs/toKana.js.html index 010f0ce..8fd60ba 100644 --- a/docs/toKana.js.html +++ b/docs/toKana.js.html @@ -75,7 +75,7 @@

-

+
@@ -125,6 +125,7 @@

* Convert [Romaji](https://en.wikipedia.org/wiki/Romaji) to [Kana](https://en.wikipedia.org/wiki/Kana), lowercase text will result in [Hiragana](https://en.wikipedia.org/wiki/Hiragana) and uppercase text will result in [Katakana](https://en.wikipedia.org/wiki/Katakana). * @param {String} [input=''] text * @param {DefaultOptions} [options=defaultOptions] + * @param {Object.<string, string>} [map] custom mapping * @return {String} converted text * @example * toKana('onaji BUTTSUUJI') @@ -208,7 +209,7 @@


diff --git a/docs/toKatakana.js.html b/docs/toKatakana.js.html index 910e546..2d56ca3 100644 --- a/docs/toKatakana.js.html +++ b/docs/toKatakana.js.html @@ -75,7 +75,7 @@

-

+
@@ -139,7 +139,7 @@


diff --git a/docs/toRomaji.js.html b/docs/toRomaji.js.html index 1055cac..3fc6db0 100644 --- a/docs/toRomaji.js.html +++ b/docs/toRomaji.js.html @@ -75,7 +75,7 @@

-

+
@@ -117,7 +117,7 @@

* Convert kana to romaji * @param {String} kana text input * @param {DefaultOptions} [options=defaultOptions] - * @param {Object} map custom mapping + * @param {Object.<string, string>} [map] custom mapping * @return {String} converted text * @example * toRomaji('ひらがな カタカナ') @@ -179,7 +179,7 @@


diff --git a/docs/tokenize.js.html b/docs/tokenize.js.html index a794055..56a8fa6 100644 --- a/docs/tokenize.js.html +++ b/docs/tokenize.js.html @@ -75,7 +75,7 @@

-

+
@@ -104,7 +104,7 @@

const isCharJaNum = (x) => /[0-9]/.test(x); const isCharEnNum = (x) => /[0-9]/.test(x); -export const TOKEN_TYPES = { +const TOKEN_TYPES = { EN: 'en', JA: 'ja', EN_NUM: 'englishNumeral', @@ -160,8 +160,8 @@

* If `{ compact: true }` then many same-language tokens are combined (spaces + text, kanji + kana, numeral + punctuation). * If `{ detailed: true }` then return array will contain `{ type, value }` instead of `'value'` * @param {String} input text - * @param {Object} [options={ compact: false, detailed: false}] options to modify output style - * @return {String|Object[]} text split into tokens containing values, or detailed object + * @param {{compact: Boolean | undefined, detailed: Boolean | undefined}} [options={ compact: false, detailed: false}] options to modify output style + * @return {(String[]|Array.<{type: String, value: String}>)} text split into tokens containing values, or detailed object * @example * tokenize('ふふフフ') * // ['ふふ', 'フフ'] @@ -259,7 +259,7 @@


diff --git a/docs/unbind.js.html b/docs/unbind.js.html index eec3c47..56d9517 100644 --- a/docs/unbind.js.html +++ b/docs/unbind.js.html @@ -75,7 +75,7 @@

-

+
@@ -95,7 +95,7 @@

/** * Unbinds eventListener from input field - * @param {HTMLElement} element textarea, input + * @param {HTMLInputElement | HTMLTextAreaElement} element textarea, input */ export function unbind(element, debug = false) { const listeners = findListeners(element); @@ -140,7 +140,7 @@