/* @license selix - github.com/bilde - MIT License */ (function(){var e,t,n,a,r,o,c;n=function(e,t){return e.value.slice(0,t).split("\r\n").length-1},e=function(e){var t,a,r,o;return e.focus(),"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:document.selection&&document.selection.createRange&&e.createTextRange?(t=e.createTextRange(),t.moveToBookmark(document.selection.createRange().getBookmark()),r=e.createTextRange(),r.collapse(!1),t.compareEndPoints("StartToEnd",r)>=0?o=a=e.value.length:(o=-t.moveStart("character",-e.value.length),o+=n(e,o),t.compareEndPoints("EndToEnd",r)>=0?a=e.value.length:(a=-t.moveEnd("character",-e.value.length),a+=n(e,a))),{start:o,end:a}):void 0},r=function(e,t,a){var r;return null==a&&(a=t),e.focus(),"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd?(e.selectionStart=t,e.selectionEnd=a):document.selection&&document.selection.createRange&&e.createTextRange?(r=e.createTextRange(),r.collapse(!0),r.moveEnd("character",a-n(e,a)),r.moveStart("character",t-n(e,t)),r.select()):void 0},t=function(t){var n;return n=e(t),t.value.slice(n.start,n.end)},o=function(t,n,a){var o;return o=e(t),t.value=t.value.slice(0,o.start)+n+t.value.slice(o.end),a?r(t,o.start,o.start+n.length):void 0},c=function(n,a,c){var l,s,u;return l=e(n),u=t(n),o(n,a+u+c),s=l.start+a.length,r(n,s,s+u.length)},a={getCaret:e,setCaret:r,getText:t,setText:o,wrap:c},"undefined"!=typeof exports?module.exports=a:"undefined"!=typeof window&&(window.selix=a)}).call(this);