// Built from https://github.com/deshiknaves/caret-pos without editable support
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["caret-pos"]={})}(this,function(t){"use strict";function s(e,t){var o,n,r,i=document.createElement("div");return o=t,n={position:"absolute",left:-9999,top:0,zIndex:-2e3},"TEXTAREA"===e.tagName&&u.push("width"),u.forEach(function(t){n[t]=getComputedStyle(e)[t]}),r=n,Object.keys(r).forEach(function(t){i.style[t]=r[t]}),i.innerHTML=o,e.parentNode.insertBefore(i,e.nextSibling),{rect:function(){var t=i.ownerDocument.getElementById("caret-position-marker"),e={left:t.offsetLeft,top:t.offsetTop,height:t.offsetHeight};return i.parentNode.removeChild(i),e}}}function f(t){var e=0<arguments.length&&void 0!==t?t:{},o=e.customPos,n=e.iframe,r=e.noShadowCaret;return n?{iframe:n,window:n.contentWindow,document:n.contentDocument||n.contentWindow.document,noShadowCaret:r,customPos:o}:{window:window,document:document,noShadowCaret:r,customPos:o}}function r(t,e){var o=e&&e.window||window,n=e&&e.document||document,r=t.getBoundingClientRect(),i=n.documentElement,f=o.pageXOffset||i.scrollLeft,l=o.pageYOffset||i.scrollTop;return{top:r.top+l,left:r.left+f}}function l(t){return"object"===(void 0===t?"undefined":e(t))&&null!==t}function o(l,d){function u(){return l.selectionStart}var n=function(t){function e(t){return t.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>")}!d.customPos&&0!==d.customPos||(t=d.customPos);var o=void 0===t?u():t,n=l.value.slice(0,o),r=l.value.slice(o),i='<span style="position: relative; display: inline;">'+e(n)+"</span>";i+='<span id="caret-position-marker" style="position: relative; display: inline;">|</span>',i+='<span style="position: relative; display: inline;">'+e(r)+"</span>";var f=s(l,i).rect();return f.pos=u(),f};return{getPos:u,setPos:function(t){return l.setSelectionRange(t,t),l},getOffset:function(t){var e=r(l),o=n(t);return{top:e.top+o.top+d.document.body.scrollTop,left:e.left+o.left+d.document.body.scrollLeft,height:o.height}},getPosition:n}}function d(t,e){return o(t,e)}var u=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.position=function(t,e,o){var n=2<arguments.length&&void 0!==o?o:{};l(e)&&(n=e,e=null);var r=f(n),i=d(t,r);return e||0===e?i.setPos(e):i.getPosition()},t.offset=function(t,e,o){var n=2<arguments.length&&void 0!==o?o:{};l(e)&&(n=e,e=null);var r=f(n);return d(t,r).getOffset(e)},t.getOffset=r,Object.defineProperty(t,"__esModule",{value:!0})});
