import{s as f,f as a,E,G as k,aG as F,a4 as g,K as m,bT as R,y as T,z as i,P as u,Q as n,aZ as L,a1 as P,ah as S}from"./index-BPRWoLf4.js";var O=function(s){f(e,s);function e(){var t=s!==null&&s.apply(this,arguments)||this;return t.domRef=a.createRef(),t.state={isOpened:!1},t}return e.prototype.close=function(){this.setState({isOpened:!1})},e.prototype.open=function(){this.setState({isOpened:!0})},e.prototype.handleClick=function(){this.state.isOpened?this.close():this.open()},e.prototype.handleChange=function(t){return E(this,void 0,void 0,function(){var r,p,d,o;return k(this,function(l){switch(l.label){case 0:return r=this.props,p=r.dispatchEvent,d=r.onChange,[4,p("change",S(this.props,{value:t}))];case 1:return o=l.sent(),o!=null&&o.prevented?[2]:(d(t),[2])}})})},e.prototype.getParent=function(){var t;return(t=this.domRef.current)===null||t===void 0?void 0:t.parentElement},e.prototype.getTarget=function(){return this.domRef.current},e.prototype.doAction=function(t,r,p){var d,o,l,c=this.props,_=c.resetValue,h=c.onChange,v=c.formStore,y=c.store,C=c.name,b=t==null?void 0:t.actionType;switch(b){case"clear":h("");break;case"reset":h==null||h((l=(o=F((d=v==null?void 0:v.pristine)!==null&&d!==void 0?d:y==null?void 0:y.pristine,C))!==null&&o!==void 0?o:_)!==null&&l!==void 0?l:"");break}},e.prototype.renderStatic=function(t){t===void 0&&(t="-");var r=this.props;r.classnames;var p=r.value;return this.props.translate,p?a.createElement("div",{className:this.props.classnames("LocationControl",{"is-mobile":g()}),ref:this.domRef},a.createElement("span",null,p.address)):a.createElement(a.Fragment,null,t)},e.prototype.render=function(){var t=this.props;t.style;var r=t.env;return m(this.props.ak,this.props.data)||r.locationPickerAK,a.createElement("div",{className:this.props.classnames("LocationControl",{"is-mobile":g()})},a.createElement(R,T({},this.props,{ak:m(this.props.ak,this.props.data),onChange:this.handleChange})))},e.defaultProps={vendor:"baidu",coordinatesType:"bd09"},i([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"close",null),i([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"open",null),i([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"handleClick",null),i([u,n("design:type",Function),n("design:paramtypes",[Object]),n("design:returntype",Promise)],e.prototype,"handleChange",null),i([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"getParent",null),i([u,n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"getTarget",null),i([L(),n("design:type",Function),n("design:paramtypes",[]),n("design:returntype",void 0)],e.prototype,"render",null),e}(a.Component),x=function(s){f(e,s);function e(){return s!==null&&s.apply(this,arguments)||this}return e=i([P({type:"location-picker"})],e),e}(O);export{O as LocationControl,x as LocationRenderer};
