{"version":3,"file":"textarea-autosize.umd.cjs","sources":["../src/textarea-autosize.js"],"sourcesContent":["class TextareaAutoSize {\n  constructor(element) {\n    this.element = element;\n\n    this.verticalBorderSize = (this._styleProp(\"borderTopWidth\") + this._styleProp(\"borderBottomWidth\")) || 0;\n\n    this._inputHandler = this._inputHandler.bind(this);\n    element.addEventListener(\"input\", this._inputHandler)\n\n    this.update()\n  }\n\n  _inputHandler(event) {\n    this.update()\n  }\n\n  destroy() {\n    this.removeEventListener(\"input\", this._inputHandler)\n    this.element = null\n  }\n\n  update() {\n    const smallestHeight = this._styleProp(\"fontSize\")\n    this.element.style.height = `${smallestHeight}px`\n\n    // Firefox still triggers a vertical scrollbar but as long as we add the\n    // top/bottom padding to the scroll height, it's not shown. Other browsers\n    // do the same regardless of whether this value is added or not.\n    const newHeight = this.element.scrollHeight + this.verticalBorderSize\n    this.element.style.height = `${newHeight}px`\n  }\n\n  _styleProp(name) {\n    const computedStyle = getComputedStyle(this.element, null)\n    return parseInt(computedStyle[name])\n  }\n}\n\nexport { TextareaAutoSize }\n"],"names":["TextareaAutoSize","element","event","smallestHeight","newHeight","name","computedStyle"],"mappings":"wOAAA,MAAMA,CAAiB,CACrB,YAAYC,EAAS,CACnB,KAAK,QAAUA,EAEf,KAAK,mBAAsB,KAAK,WAAW,gBAAgB,EAAI,KAAK,WAAW,mBAAmB,GAAM,EAExG,KAAK,cAAgB,KAAK,cAAc,KAAK,IAAI,EACjDA,EAAQ,iBAAiB,QAAS,KAAK,aAAa,EAEpD,KAAK,OAAQ,CACd,CAED,cAAcC,EAAO,CACnB,KAAK,OAAQ,CACd,CAED,SAAU,CACR,KAAK,oBAAoB,QAAS,KAAK,aAAa,EACpD,KAAK,QAAU,IAChB,CAED,QAAS,CACP,MAAMC,EAAiB,KAAK,WAAW,UAAU,EACjD,KAAK,QAAQ,MAAM,OAAS,GAAGA,MAK/B,MAAMC,EAAY,KAAK,QAAQ,aAAe,KAAK,mBACnD,KAAK,QAAQ,MAAM,OAAS,GAAGA,KAChC,CAED,WAAWC,EAAM,CACf,MAAMC,EAAgB,iBAAiB,KAAK,QAAS,IAAI,EACzD,OAAO,SAASA,EAAcD,EAAK,CACpC,CACH"}