AUI.add("liferay-autocomplete-textarea",(e=>{const t=e.Event.KeyMap,n=e.Lang,s=[t.DOWN,t.LEFT,t.RIGHT,t.UP].join(),r="inputNode",i=function AutoCompleteTextarea(){};i.prototype={_bindUIACTextarea(){const t=this,n=t.get(r);t._eventHandles=[n.on("key",e.bind("_onKeyUp",t),"up:"+s)]},_getACPositionBase(){return this.get(r).getXY()},_getACPositionOffset(){const e=this.get(r);return[0,n.toInt(e.getStyle("fontSize"))]},_getACVal(){return this.get(r).val()},_getPrevTrigger(e,t){let n=-1,s=null;const r=this._getTriggers();for(let i=t;i>=0;--i){const t=r.indexOf(e[i]);if(t>=0){n=i,s=r[t];break}}return{index:n,value:s}},_getQuery(e){const t=this;let n=null;const s=t._getCaretIndex();return s&&(e=e.substring(0,s.start),t._getTriggers().forEach((s=>{const r=e.lastIndexOf(s);if(r>=0){e=e.substring(r);const i=t._getRegExp().exec(e);i&&i.index+i[1].length+s.length===e.length&&(!n||e.length<n.length)&&(n=e)}}))),n},_onKeyUp(e){const t=this;if(!t.get("visible")||e.isKeyInSet("left","right")){const e=t.get(r),n=t._getQuery(e.val());t._processKeyUp(n)}},_setACVal(e){this.get(r).val(e)},_updateValue(e){const t=this,n=t._getCaretIndex();if(n){let s=t._getACVal();if(s){const i=t._getPrevTrigger(s,n.start),a=i.index;if(a>=0){const n=s.substring(0,a);s=s.substring(a);const o=t._getRegExp().exec(s);if(o){const a=s.substring(o[1].length+1);let g=1;a.length&&" "===a[0]||(e+=" ",g=0);const l=n+i.value+e,u=l.length+g;t._setACVal(l+a),t._setCaretIndex(t.get(r),u)}}}}},destructor(){const e=this;e._inputMirror&&e._inputMirror.remove()},initializer(){this._bindUIACTextarea()}},Liferay.AutoCompleteTextarea=e.Base.create("liferayautocompletetextarea",e.AutoComplete,[Liferay.AutoCompleteInputBase,i],{},{CSS_PREFIX:e.ClassNameManager.getClassName("aclist")})}),"",{requires:["liferay-autocomplete-input"]});
//# sourceMappingURL=autocomplete_textarea.js.map