import{H as t,P as i,T as s,M as e,N as a,O as h}from"./p-PmQf2Yvi.js";import{a as n}from"./p-DBsOHTWj.js";import{i as o}from"./p-C4sZQbkT.js";import{B as r}from"./p-ByiN-QjD.js";import{d as l}from"./p-FCLKfv6B.js";import{g as c,a as b,b as d,e as p,f as m,i as u,h as f,j as x,c as g,d as y}from"./p-DoMopbMR.js";const k=class{constructor(s){t(this,s),this.balChange=i(this,"balChange"),this.balInput=i(this,"balInput"),this.balBlur=i(this,"balBlur"),this.balKeyPress=i(this,"balKeyPress"),this.balFocus=i(this,"balFocus"),this.inputId="bal-textarea-"+j++,this.inheritedAttributes={},this.inputValue=this.value,this.initialValue=this.value||"",this.focused=!1,this.ariaForm=l,this.name=this.inputId,this.invalid=!1,this.autocapitalize="none",this.autocomplete="off",this.autofocus=!1,this.debounce=0,this.disabled=!1,this.readonly=!1,this.required=!1,this.clickable=!1,this.value="",this.autoInvalidOff=!1,this.onInput=t=>{const i=c(t);i&&(this.inputValue=i.value),this.balInput.emit(this.inputValue)},this.onFocus=t=>b(this,t),this.onBlur=t=>{d(this,t);const i=t.target;i&&(i.value=this.getValue()),p(this)},this.onClick=t=>m(this,t),this.handleClick=t=>u(this,t)}debounceChanged(){this.balChange=s(this.balChange,this.debounce)}listenOnClick(t){f(this,t)}resetHandler(t){const i=t.target;(null==i?void 0:i.contains(this.el))&&x(this,this.initialValue,this.resetHandlerTimer)}connectedCallback(){this.debounceChanged(),this.initialValue=this.value||""}componentDidLoad(){this.inputValue=this.value}componentWillLoad(){this.inheritedAttributes=o(this.el,["aria-label","tabindex","title","data-hj-allow"])}async setFocus(){g(this)}async setBlur(){y(this)}getInputElement(){return Promise.resolve(this.nativeInput)}async setAriaForm(t){this.ariaForm=Object.assign({},t)}getValue(){return this.value||""}render(){const t=this.getValue(),i=r.block("textarea"),s=i.element("native");return e(a,{key:"6abf8c53f5514217abc01dfc9a34d2f77eeae25c",onClick:this.handleClick,"aria-disabled":n(this.disabled),class:Object.assign({},i.class())},e("textarea",Object.assign({key:"e133831d646f2a4483a98ecbf19a74ca4b086896",class:Object.assign(Object.assign({},s.class()),{textarea:!0,"is-disabled":this.disabled||this.readonly,"is-danger":this.invalid,clickable:this.clickable}),"data-testid":"bal-textarea-input",ref:t=>this.nativeInput=t,name:this.name,id:this.ariaForm.controlId||this.inputId,"aria-labelledby":this.ariaForm.labelId,"aria-describedby":this.ariaForm.messageId,"aria-invalid":!0===this.invalid?"true":"false","aria-disabled":n(this.disabled),disabled:this.disabled,readonly:this.readonly,required:this.required,autoCapitalize:this.autocapitalize,autocomplete:this.autocomplete,autoFocus:this.autofocus,minLength:this.minLength,maxLength:this.maxLength,placeholder:this.placeholder,inputMode:this.inputmode,value:this.value,cols:this.cols,rows:this.rows,wrap:this.wrap,onFocus:this.onFocus,onInput:t=>this.onInput(t),onBlur:this.onBlur,onClick:this.onClick,onKeyPress:t=>this.balKeyPress.emit(t)},this.inheritedAttributes),t,e("slot",{key:"b5b22f948ec25bca265d654f1f8dfc397aca839a"})))}get el(){return h(this)}static get watchers(){return{debounce:["debounceChanged"]}}};let j=0;k.style=".bal-textarea{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;position:relative;-ms-flex:1;flex:1;width:100%;font-family:var(--bal-font-family-text);white-space:pre-wrap;-webkit-box-sizing:border-box;box-sizing:border-box}.bal-textarea__native{margin:0;display:block;width:100%;max-width:100%;max-height:100%;outline:none;background:rgba(0,0,0,0);-webkit-box-sizing:border-box;box-sizing:border-box;resize:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:calc(.75em - 2px)}.bal-textarea__native::-webkit-input-placeholder{padding:0;font-family:inherit}.bal-textarea__native::-moz-placeholder{padding:0;font-family:inherit}.bal-textarea__native:-ms-input-placeholder{padding:0;font-family:inherit}.bal-textarea__native::-ms-input-placeholder{padding:0;font-family:inherit}.bal-textarea__native::placeholder{padding:0;font-family:inherit}";export{k as bal_textarea}