import{r as t,c as i,h as s,H as e,g as a}from"./p-BdVwMG9u.js";import{a as h}from"./p-DBsOHTWj.js";import{i as n}from"./p-C4sZQbkT.js";import{B as o}from"./p-ByiN-QjD.js";import{d as r}from"./p-FCLKfv6B.js";import{g as l,a as d,b,e as c,f as p,i as m,h as u,j as f,c as x,d as g}from"./p-CpDHeXfo.js";import{n as y}from"./p-Ba5qjFjW.js";import"./p-B1u-Mq75.js";import"./p-D7M-7v58.js";const j=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-"+k++,this.inheritedAttributes={},this.inputValue=this.value,this.initialValue=this.value||"",this.focused=!1,this.ariaForm=r,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=l(t);i&&(this.inputValue=i.value),this.balInput.emit(this.inputValue)},this.onFocus=t=>d(this,t),this.onBlur=t=>{b(this,t);const i=t.target;i&&(i.value=this.getValue()),c(this)},this.onClick=t=>p(this,t),this.handleClick=t=>m(this,t)}debounceChanged(){this.balChange=y(this.balChange,this.debounce)}listenOnClick(t){u(this,t)}resetHandler(t){const i=t.target;(null==i?void 0:i.contains(this.el))&&f(this,this.initialValue,this.resetHandlerTimer)}connectedCallback(){this.debounceChanged(),this.initialValue=this.value||""}componentDidLoad(){this.inputValue=this.value}componentWillLoad(){this.inheritedAttributes=n(this.el,["aria-label","tabindex","title","data-hj-allow"])}async setFocus(){x(this)}async setBlur(){g(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=o.block("textarea"),a=i.element("native");return s(e,{key:"d2abd56effb14131bdbf2a744555316439a18d5f",onClick:this.handleClick,"aria-disabled":h(this.disabled),class:Object.assign({},i.class())},s("textarea",Object.assign({key:"3690740a7250086b52c268a7fe1fd09bf59c3ca3",class:Object.assign(Object.assign({},a.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":h(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,s("slot",{key:"d8bce218b9a67017b1de8e53e11548b9f258d217"})))}get el(){return a(this)}static get watchers(){return{debounce:["debounceChanged"]}}};let k=0;j.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{j as bal_textarea}