import{b as a}from"./runtime-dom.esm-bundler.36191dca.js";import{_ as o}from"./_plugin-vue_export-helper.eefbdd86.js";import{aj as l,o as h,a3 as u,a5 as m}from"./runtime-core.esm-bundler.50cb9e6d.js";const p={props:{modelValue:{type:[String,Number],default:""},autosize:{type:Boolean,default:!0},minHeight:{type:[Number],default:null},maxHeight:{type:[Number],default:null},important:{type:[Boolean,Array],default:!1}},data(){return{val:this.modelValue??null,maxHeightScroll:!1,height:"auto"}},watch:{modelValue(t){this.val=t},val(t){this.$nextTick(this.resize),this.$emit("update:modelValue",t)},minHeight(){this.$nextTick(this.resize)},maxHeight(){this.$nextTick(this.resize)},autosize(t){t&&this.resize()}},computed:{computedStyles(){return this.autosize?{resize:this.isResizeImportant?"none !important":"none",height:this.height,overflow:this.maxHeightScroll?"auto":this.isOverflowImportant?"hidden !important":"hidden"}:{height:this.minHeight?this.minHeight+"px":""}},isResizeImportant(){const t=this.important;return t===!0||Array.isArray(t)&&t.includes("resize")},isOverflowImportant(){const t=this.important;return t===!0||Array.isArray(t)&&t.includes("overflow")},isHeightImportant(){const t=this.important;return t===!0||Array.isArray(t)&&t.includes("height")}},methods:{resize(){const t=this.isHeightImportant?"important":"";return this.height=`auto${t?" !important":""}`,this.$nextTick(()=>{let e=this.$el.scrollHeight+1;this.minHeight&&(e=e<this.minHeight?this.minHeight:e),this.maxHeight&&(e>this.maxHeight?(e=this.maxHeight,this.maxHeightScroll=!0):this.maxHeightScroll=!1);const s=e+"px";this.height=`${s}${t?" !important":""}`}),this}},created(){this.val=this.modelValue},mounted(){this.resize()}};function c(t,e,s,g,n,i){return l((h(),u("textarea",{class:"aioseo-textarea-autosize",style:m(i.computedStyles),"onUpdate:modelValue":e[0]||(e[0]=r=>n.val=r),onFocus:e[1]||(e[1]=(...r)=>i.resize&&i.resize(...r))},null,36)),[[a,n.val]])}const y=o(p,[["render",c]]);export{y as B};
