angular.module("monospaced.elastic",[]).constant("msdElasticConfig",{append:""}).directive("msdElastic",["$timeout","$window","msdElasticConfig",function(b,c,a){return{require:"ngModel",restrict:"A, C",link:function(d,e,u,p){var n=e[0],l=e;if(n.nodeName!=="TEXTAREA"||!c.getComputedStyle){return}l.css({overflow:"hidden","overflow-y":"hidden","word-wrap":"break-word"});var q=n.value;n.value="";n.value=q;var A=u.msdElastic||a.append,z=A==="\\n"?"\n":A,s=angular.element(c),D="position: absolute; top: -999px; right: auto; bottom: auto; left: 0 ;overflow: hidden; -webkit-box-sizing: content-box;-moz-box-sizing: content-box; box-sizing: content-box;min-height: 0 !important; height: 0 !important; padding: 0;word-wrap: break-word; border: 0;",w=angular.element('').data("elastic",true),r=w[0],m=getComputedStyle(n),B=m.getPropertyValue("resize"),o=m.getPropertyValue("box-sizing")==="border-box"||m.getPropertyValue("-moz-box-sizing")==="border-box"||m.getPropertyValue("-webkit-box-sizing")==="border-box",y=!o?{width:0,height:0}:{width:parseInt(m.getPropertyValue("border-right-width"),10)+parseInt(m.getPropertyValue("padding-right"),10)+parseInt(m.getPropertyValue("padding-left"),10)+parseInt(m.getPropertyValue("border-left-width"),10),height:parseInt(m.getPropertyValue("border-top-width"),10)+parseInt(m.getPropertyValue("padding-top"),10)+parseInt(m.getPropertyValue("padding-bottom"),10)+parseInt(m.getPropertyValue("border-bottom-width"),10)},f=parseInt(m.getPropertyValue("min-height"),10),x=parseInt(m.getPropertyValue("height"),10),j=Math.max(f,x)-y.height,t=parseInt(m.getPropertyValue("max-height"),10),k,i,g=["font-family","font-size","font-weight","font-style","letter-spacing","line-height","text-transform","word-spacing","text-indent"];if(l.data("elastic")){return}t=t&&t>0?t:90000;if(r.parentNode!==document.body){angular.element(document.body).append(r)}l.css({resize:(B==="none"||B==="vertical")?"none":"horizontal"}).data("elastic",true);function h(){k=n;m=getComputedStyle(n);angular.forEach(g,function(E){D+=E+":"+m.getPropertyValue(E)+";"});r.setAttribute("style",D)}function v(){var H,E,F,G,I;if(k!==n){h()}if(!i){i=true;r.value=n.value+z;r.style.overflowY=n.style.overflowY;H=n.style.height===""?"auto":parseInt(n.style.height,10);E=getComputedStyle(n).getPropertyValue("width");if(E.substr(E.length-2,2)==="px"){G=parseInt(E,10)-y.width;r.style.width=G+"px"}F=r.scrollHeight;if(F>t){F=t;I="scroll"}else{if(F