!function(){function e(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var t,a,i=[],l=!0,o=!1;try{for(n=n.call(e);!(l=(t=n.next()).done)&&(i.push(t.value),!r||i.length!==r);l=!0);}catch(c){o=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(o)throw a}}return i}(e,r)||n(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n0&&void 0!==arguments[0]?arguments[0]:e.rules;return new Promise((function(n){G(),r?N(r).then((function(){u.validateFailed?n({name:e.name,message:u.validateMessage}):n()})):n()}))},X=function(r){if(s&&e.rules){var n=s.props.validateTrigger===r,t=e.rules.filter((function(e){return e.trigger?e.trigger===r:n}));t.length&&R(t)}},$=function(n){var t=e.maxlength;if(M(t)&&J(n)>t){var a=g();return a&&J(a)===+t?a:function(e,n){return r(e).slice(0,n).join("")}(n,+t)}return n},Q=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"onChange";if(r=$(r),"number"===e.type||"digit"===e.type){var t="number"===e.type;r=I(r,t,t)}e.formatter&&n===e.formatTrigger&&(r=e.formatter(r)),f.value&&f.value.value!==r&&(f.value.value=r),r!==e.modelValue&&o("update:modelValue",r)},Y=function(e){e.target.composing||Q(e.target.value)},Z=function(){var e;return null==(e=f.value)?void 0:e.blur()},ee=function(){var r=f.value;"textarea"===e.type&&e.autosize&&r&&function(e,r){var n=t();e.style.height="auto";var l=e.scrollHeight;if(i(r)){var o=r.maxHeight,c=r.minHeight;void 0!==o&&(l=Math.min(l,o)),void 0!==c&&(l=Math.max(l,c))}l&&(e.style.height="".concat(l,"px"),a(n))}(r,e.autosize)},re=function(e){u.focused=!0,o("focus",e),S(ee),E("readonly")&&Z()},ne=function(e){E("readonly")||(u.focused=!1,Q(g(),"onBlur"),o("blur",e),X("onBlur"),S(ee),B())},te=function(e){return o("click-input",e)},ae=function(e){return o("click-left-icon",e)},ie=function(e){return o("click-right-icon",e)},le=function(e){j(e),o("update:modelValue",""),o("clear",e)},oe=y((function(){return"boolean"==typeof e.error?e.error:!!(s&&s.props.showError&&u.validateFailed)||void 0})),ce=y((function(){var e=E("labelWidth");if(e)return{width:_(e)}})),de=function(r){13===r.keyCode&&(s&&s.props.submitOnEnter||"textarea"===e.type||j(r),"search"===e.type&&Z());o("keypress",r)},ue=function(){return e.id||"".concat(d,"-input")},fe=function(){var r=U("control",[E("inputAlign"),{error:oe.value,custom:!!c.input,"min-height":"textarea"===e.type&&!e.autosize}]);if(c.input)return A("div",{class:r,onClick:te},[c.input()]);var n,t={id:ue(),ref:f,name:e.name,rows:void 0!==e.rows?+e.rows:void 0,class:r,value:e.modelValue,disabled:E("disabled"),readonly:E("readonly"),autofocus:e.autofocus,placeholder:e.placeholder,autocomplete:e.autocomplete,"aria-labelledby":e.label?"".concat(d,"-label"):void 0,onBlur:ne,onFocus:re,onInput:Y,onClick:te,onChange:D,onKeypress:de,onCompositionend:D,onCompositionstart:H};return"textarea"===e.type?A("textarea",t,null):A("input",F("number"===(n=e.type)?{type:"text",inputmode:"decimal"}:"digit"===n?{type:"tel",inputmode:"numeric"}:{type:n},t),null)},ve=function(){var r=c["right-icon"];if(e.rightIcon||r)return A("div",{class:U("right-icon"),onClick:ie},[r?r():A(V,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},se=function(){if(e.showWordLimit&&e.maxlength){var r=J(g());return A("div",{class:U("word-limit")},[A("span",{class:U("word-num")},[r]),T("/"),e.maxlength])}},ge=function(){if(!s||!1!==s.props.showErrorMessage){var r=e.errorMessage||u.validateMessage;if(r){var n=c["error-message"],t=E("errorMessageAlign");return A("div",{class:U("error-message",t)},[n?n({message:r}):r])}}},me=function(){return[A("div",{class:U("body")},[fe(),P.value&&A(V,{name:e.clearIcon,class:U("clear"),onTouchstart:le},null),ve(),c.button&&A("div",{class:U("button")},[c.button()])]),se(),ge()]};return x({blur:Z,focus:function(){var e;return null==(e=f.value)?void 0:e.focus()},validate:R,formValue:K,resetValidation:G}),w(k,{customValue:v,resetValidation:G,validateWithTrigger:X}),z((function(){return e.modelValue}),(function(){Q(g()),G(),X("onChange"),S(ee)})),C((function(){Q(g(),e.formatTrigger),S(ee)})),function(){var r,n,t,a,i=E("disabled"),l=E("labelAlign"),o=(r=E("colon")?":":"",c.label?[c.label(),r]:e.label?A("label",{id:"".concat(d,"-label"),for:ue()},[e.label+r]):void 0),u=function(){var r=c["left-icon"];if(e.leftIcon||r)return A("div",{class:U("left-icon"),onClick:ae},[r?r():A(V,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])}();return A(O,{size:e.size,icon:e.leftIcon,class:U((n={error:oe.value,disabled:i},t="label-".concat(l),a=l,t in n?Object.defineProperty(n,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[t]=a,n)),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:ce.value,valueClass:U("value"),titleClass:[U("label",[l,{required:e.required}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:u?function(){return u}:null,title:o?function(){return o}:null,value:me,extra:c.extra})}}});n("F",E(X))}}}))}();