import{s as R,ai as y,E as m,G as g,bl as f,ah as b,f as C,c3 as D,T,z as d,P as p,Q as i,D as U,a3 as j}from"./index-DT8qTvyx.js";var O=function(v){R(n,v);function n(t,e){var a=v.call(this,t)||this;a.state={value:y(t)||""};var r=e;return r.registerComponent(a),a}return n.prototype.componentWillUnmount=function(){var t=this.context;t.unRegisterComponent(this)},n.prototype.handleChange=function(t){return m(this,void 0,void 0,function(){var e,a,r,o;return g(this,function(s){switch(s.label){case 0:return e=this.props,a=e.onChange,r=e.dispatchEvent,this.setState({value:t}),[4,r("change",b(this.props,{value:t}))];case 1:return o=s.sent(),o!=null&&o.prevented?[2]:(a==null||a(t),[2])}})})},n.prototype.handleCancel=function(){var t=this.props.name,e=this.props.onQuery,a=y(this.props);if(a!==""){var r={};f(r,t,""),e==null||e(r)}},n.prototype.handleSearch=function(t){return m(this,void 0,void 0,function(){var e,a,r,o,s,l;return g(this,function(c){switch(c.label){case 0:return e=this.props,a=e.name,r=e.onQuery,o=e.dispatchEvent,s={},f(s,a,t),[4,o("search",j(this.props.data,s))];case 1:return l=c.sent(),l!=null&&l.prevented?[2]:(r==null||r(s),[2])}})})},n.prototype.dispatchEvent=function(t){var e=this.props.dispatchEvent;e(t,b(this.props,{value:this.state.value}))},n.prototype.doAction=function(t,e,a,r){var o=t==null?void 0:t.actionType;o==="clear"&&this.setState({value:""})},n.prototype.setData=function(t){typeof t=="string"&&this.handleChange(t)},n.prototype.render=function(){var t=this,e=this.props;e.data;var a=e.name,r=e.disabled,o=e.onQuery,s=e.mini,l=e.enhance,c=e.clearable,E=e.searchImediately,S=e.clearAndSubmit,_=e.placeholder,I=e.onChange,x=e.className,B=e.style,Q=e.mobileUI,A=e.loading,w=e.loadingConfig,h=e.onEvent,F=e.testIdBuilder,u=this.state.value,P=!o&&!(h!=null&&h.search)||r;return C.createElement(D,{className:x,style:B,name:a,disabled:P,loading:A,loadingConfig:w,defaultActive:!!u,defaultValue:I?void 0:u,value:u,mini:s,enhance:l,clearable:c,searchImediately:E,clearAndSubmit:S,onSearch:this.handleSearch,onCancel:this.handleCancel,placeholder:_,onChange:this.handleChange,onFocus:function(){return t.dispatchEvent("focus")},onBlur:function(){return t.dispatchEvent("blur")},mobileUI:Q,testIdBuilder:F})},n.defaultProps={name:"keywords",mini:!1,enhance:!1,clearable:!1,searchImediately:!1,clearAndSubmit:!1},n.contextType=T,n.propsList=["mini","searchImediately"],d([p,i("design:type",Function),i("design:paramtypes",[String]),i("design:returntype",Promise)],n.prototype,"handleChange",null),d([p,i("design:type",Function),i("design:paramtypes",[]),i("design:returntype",void 0)],n.prototype,"handleCancel",null),d([p,i("design:type",Function),i("design:paramtypes",[String]),i("design:returntype",Promise)],n.prototype,"handleSearch",null),d([p,i("design:type",Function),i("design:paramtypes",[String]),i("design:returntype",void 0)],n.prototype,"dispatchEvent",null),n=d([U({type:"search-box"}),i("design:paramtypes",[Object,Object])],n),n}(C.Component);export{O as SearchBoxRenderer};
