import{H as t,P as i,T as s,M as e,N as a,O as h}from"./p-CklISCW5.js";import{g as n,a as r,b as o,e as l,f as c,i as b,h as d,j as p,c as u,d as m}from"./p-BRYwT3rx.js";import{i as f}from"./p-C4sZQbkT.js";import{B as x}from"./p-ByiN-QjD.js";import{d as g}from"./p-FCLKfv6B.js";import{a as y}from"./p-DBsOHTWj.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-"+w++,this.inheritedAttributes={},this.inputValue=this.value,this.initialValue=this.value||"",this.focused=!1,this.ariaForm=g,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=n(t);i&&(this.inputValue=i.value),this.balInput.emit(this.inputValue)},this.onFocus=t=>r(this,t),this.onBlur=t=>{o(this,t);const i=t.target;i&&(i.value=this.getValue()),l(this)},this.onClick=t=>c(this,t),this.handleClick=t=>b(this,t)}debounceChanged(){this.balChange=s(this.balChange,this.debounce)}listenOnClick(t){d(this,t)}resetHandler(t){const i=t.target;(null==i?void 0:i.contains(this.el))&&p(this,this.initialValue,this.resetHandlerTimer)}connectedCallback(){this.debounceChanged(),this.initialValue=this.value||""}componentDidLoad(){this.inputValue=this.value}componentWillLoad(){this.inheritedAttributes=f(this.el,["aria-label","tabindex","title"])}async setFocus(){u(this)}async setBlur(){m(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=x.block("textarea"),s=i.element("native");return e(a,{key:"a01f3beba2e446382ad3c9119fc60557fb47b079",onClick:this.handleClick,"aria-disabled":y(this.disabled),class:Object.assign({},i.class())},e("textarea",Object.assign({key:"0564a24c6cf54e62c1943ee0c3f1c50a0ad20c7b",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":y(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:"fef46b6265d2662e61f14bebcecc2f95a89ae735"})))}get el(){return h(this)}static get watchers(){return{debounce:["debounceChanged"]}}};let w=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}