text: !function(a){"function"==typeof define&&define.amd?define(["jquery","./scroll"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c,require("./scroll")),c}:a(jQuery)}(function(a){"use strict";a.fn.getCursorPosition=function(){var b=a(this).get(0),c=0;if("selectionStart"in b)c=b.selectionStart;else if("selection"in document){b.focus();var d=document.selection.createRange(),e=document.selection.createRange().text.length;d.moveStart("character",-b.value.length),c=d.text.length-e}return c};var b=function(a,b){var c=a.parents(".mCSB_container"),d=a.parents(".textarea-wrapper"),e=a.val(),f=a.getCursorPosition();e="<span>"+e.substr(0,f)+"</span>"+e.substr(f,e.length),e=e.replace(/\n/g,"<br />"),b.html(e+"<br />"),a.css("height",b.height()),d.nScrollbar("update");var g=b.children("span"),h=0,i=parseInt(b.css("min-height"))-h,j=Math.round(g.height()+c.position().top),k=parseInt(a.css("line-height"));if(j>i||h>j){var l=parseInt((g.height()-h)/k)*k;d.mCustomScrollbar("scrollTo",l)}};a(document).ready(function(){a.each(a(".content-scroll"),function(c,d){var e=a(d),f=e.find(".n-textarea"),g=parseInt(e.css("height"))-17;f.css("height",g),f.wrap("<div class='textarea-wrapper' />");var h=f.parent(".textarea-wrapper");h.css("height",e.css("height")),h.addClass("textarea-wrapper-normal"),h.mCustomScrollbar({scrollInertia:0,advanced:{autoScrollOnFocus:!1}});var i=a(document.createElement("div"));i.addClass("textareaHiddenDiv"),i.css("width",parseInt(f.css("width"))-12),i.css("min-height",g),a("body").prepend(i),f.length>0&&(b(f,i),f.bind("keyup keydown",function(){b(a(this),i)}),f.bind("focus",function(){var b=a(this).parents(".textarea-wrapper");b.removeClass("textarea-wrapper-normal"),b.addClass("textarea-wrapper-focus")}),f.bind("blur",function(){var b=a(this).parents(".textarea-wrapper");b.removeClass("textarea-wrapper-focus"),b.addClass("textarea-wrapper-normal")}))})})});