var Form,indexOf=[].indexOf;import Input from"./input.js";import autoBind from"react-autobind";export default Form=function(){class Form extends React.Component{constructor(t){var e,n,o;super(t),e=!0===t.ajaxFast,this.state={inputs:null!=t.inputs?t.inputs:t.inputs=[],values:null!=t.values?t.values:t.values=[],ajaxFast:e,ajaxInitData:null!=(n=t.ajaxInitData)?n:{},loading:e,controller:null!=(o=t.controller)?o:"",hideSubmitAndClose:!0===t.hideSubmitAndClose},autoBind(this),this.inputs={},this.form=null}componentDidMount(){var t,e,n,o;return o=this,({ajaxFast:t,controller:n,ajaxInitData:e}=this.state),t?API(n+"/getCardInfo/",{id:0,dataType:"JSON",init_data:e},function(t){return o.setState({loading:!1,inputs:t.form},o.checkRules)}):this.checkRules()}onCancel(){var t;return"function"==typeof(t=this.props).onCancel?t.onCancel():void 0}getValues(){var t,e;for(t in e={},this.inputs)e[t]=this.inputs[t].getValue();return e}onSubmitAndClose(t){var e,n;return null!=t&&t.preventDefault(),n=this.getValues(),"function"==typeof(e=this.props).onSubmitAndClose&&e.onSubmitAndClose({form:this.form,values:n}),!1}onSubmit(t){var e,n;return null!=t&&t.preventDefault(),n=this.getValues(),"function"==typeof(e=this.props).onSubmit&&e.onSubmit({form:this.form,values:n}),!1}onChange(){return this.checkRules(name)}onKeyUp(t){return this.checkRules(t,"onkeyup")}checkRule(){}doRuleActions(actions,reverse=!1){var action,input,name,results,x;for(name in results=[],actions)if(action=actions[name],input=this.inputs[name],null!=input&&void 0!==input){switch(console.log("action",action),action.action){case"show":reverse?input.hide():input.show();break;case"hide":reverse?input.show():input.hide()}console.log("typeof",typeof action.js_function),"string"==typeof action.js_function?(x=eval(action.js_function),console.log("XXXX",x),results.push(x({values:this.getValues(),inputs:this.inputs,form:this}))):results.push(void 0)}else results.push(void 0);return results}checkRules(t=null,e=null){var n,o,r,i,s,u,a;if(a=this.getValues(),void 0===this.rules)return null;for(o in n=this.rules,null!=t&&void 0!==t&&(n={},void 0!==this.rules[t]&&(n[t]=this.rules[t])),r=[],n)s=n[o],u=a[o],r.push(function(){var t,n,o;for(o=[],t=0,n=s.length;t