(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[13],{188:function(e,t,n){"use strict";var a=n(0),c=n(5);t.a=e=>class extends a.Component{constructor(){super(...arguments),this.defaultCommodity={currency:"CNY",symbol:"\uffe5"},this.currentCommodity=window.localStorage.getItem("ledgerCurrency")}render(){return Object(c.jsx)(e,{...this.props,commodity:this.currentCommodity?JSON.parse(this.currentCommodity):this.defaultCommodity})}}},189:function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},197:function(e,t,n){var a=n(208),c=n(189),r=n(132),i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(r(e))return NaN;if(c(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=c(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=a(e);var n=o.test(e);return n||s.test(e)?l(e.slice(2),n?2:8):i.test(e)?NaN:+e}},206:function(e,t,n){var a=n(189),c=n(207),r=n(197),i=Math.max,o=Math.min;e.exports=function(e,t,n){var s,l,u,d,m,f,p=0,b=!1,h=!1,j=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function O(t){var n=s,a=l;return s=l=void 0,p=t,d=e.apply(a,n)}function v(e){var n=e-f;return void 0===f||n>=t||n<0||h&&e-p>=u}function y(){var e=c();if(v(e))return x(e);m=setTimeout(y,function(e){var n=t-(e-f);return h?o(n,u-(e-p)):n}(e))}function x(e){return m=void 0,j&&s?O(e):(s=l=void 0,d)}function g(){var e=c(),n=v(e);if(s=arguments,l=this,f=e,n){if(void 0===m)return function(e){return p=e,m=setTimeout(y,t),b?O(e):d}(f);if(h)return clearTimeout(m),m=setTimeout(y,t),O(f)}return void 0===m&&(m=setTimeout(y,t)),d}return t=r(t)||0,a(n)&&(b=!!n.leading,u=(h="maxWait"in n)?i(r(n.maxWait)||0,t):u,j="trailing"in n?!!n.trailing:j),g.cancel=function(){void 0!==m&&clearTimeout(m),p=0,s=f=l=m=void 0},g.flush=function(){return void 0===m?d:x(c())},g}},207:function(e,t,n){var a=n(131);e.exports=function(){return a.Date.now()}},208:function(e,t,n){var a=n(209),c=/^\s+/;e.exports=function(e){return e?e.slice(0,a(e)+1).replace(c,""):e}},209:function(e,t){var n=/\s/;e.exports=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}},217:function(e,t,n){"use strict";var a=n(3),c=n(1),r=n(4),i=n(10),o=n.n(i),s=n(206),l=n.n(s),u=n(68),d=n(0),m=n(42),f=n(56),p=n(47),b=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var c=0;for(a=Object.getOwnPropertySymbols(e);c{this.setState({loading:!0}),Object(f.d)("/api/check",{method:"POST"}).then((e=>{this.setState({checkStatus:"ok"})})).catch((()=>{this.setState({checkStatus:"error"})})).finally((()=>{this.setState({loading:!1})}))},this.handleNextStep=()=>{this.setState({loading:!0}),Object(f.d)("/api/config",{method:"GET"}).then((e=>{this.setState({config:e,showForm:!0})})).finally((()=>{this.setState({loading:!1})}))},this.handleReCheck=()=>{this.checkReq()},this.handleSubmitServerConfig=e=>{this.setState({loading:!0}),Object(f.d)("/api/config",{method:"POST",body:e}).then((()=>{this.props.history.replace("/ledger")})).finally((()=>{this.setState({loading:!1})}))}}componentDidMount(){this.checkReq()}render(){return"error"===this.state.checkStatus?Object(h.jsxs)("div",{children:[Object(h.jsx)(a.a,{message:"\u68c0\u6d4b\u5931\u8d25",description:"\u4f9d\u8d56\u672a\u5b89\u88c5\uff0c\u8bf7\u5148\u5b89\u88c5 beancount",type:"error",showIcon:!0}),Object(h.jsx)("div",{style:{marginTop:"1rem"},children:Object(h.jsx)(c.a,{block:!0,type:"danger",loading:this.state.loading,onClick:this.handleReCheck,children:"\u91cd\u65b0\u68c0\u6d4b"})}),Object(h.jsx)("div",{style:{marginTop:"1rem"},children:Object(h.jsx)("a",{href:"https://www.yuque.com/chuyi-ble7p/beancount-ns/sqwwqa#RwqnF",target:"_blank",children:"\u600e\u4e48\u5b89\u88c5 beancount ?"})})]}):"ok"===this.state.checkStatus?this.state.showForm?Object(h.jsx)("div",{children:Object(h.jsxs)(r.a,{name:"init-form",className:"page-form",size:"middle",layout:"vertical",style:{textAlign:"left"},ref:this.formRef,onFinish:this.handleSubmitServerConfig,validateMessages:j,children:[Object(h.jsx)(r.a.Item,{label:Object(h.jsxs)(d.Fragment,{children:[Object(h.jsx)("span",{children:"\u8d26\u672c\u5b58\u50a8\u4f4d\u7f6e"}),"\xa0",Object(h.jsx)(i.a,{title:"\u5982\u679c\u662fdocker\u5bb9\u5668\u90e8\u7f72\uff0c\u6b64\u5904\u9ed8\u8ba4\u4e3a\uff1a/data/beancount",children:Object(h.jsx)(u.a,{})})]}),name:"dataPath",initialValue:this.state.config.dataPath,rules:[{required:!0}],children:Object(h.jsx)(o.a,{placeholder:"\u8d26\u672c\u5b58\u50a8\u4f4d\u7f6e"})}),Object(h.jsx)(r.a.Item,{label:"\u8d26\u672c\u5f00\u59cb\u65e5\u671f",name:"startDate",initialValue:this.state.config.startDate,rules:[{required:!0}],children:Object(h.jsx)(o.a,{type:"date",placeholder:"\u8d26\u672c\u5f00\u59cb\u65e5\u671f"})}),Object(h.jsx)(r.a.Item,{label:"\u5e01\u79cd",name:"operatingCurrency",initialValue:this.state.config.operatingCurrency,rules:[{required:!0}],children:Object(h.jsx)(o.a,{placeholder:"\u5e01\u79cd"})}),Object(h.jsx)(r.a.Item,{label:"\u5e73\u8861\u8d26\u6237\u540d\u79f0\u8bbe\u7f6e",name:"openingBalances",initialValue:this.state.config.openingBalances,rules:[{required:!0}],children:Object(h.jsx)(o.a,{placeholder:"\u5e73\u8861\u8d26\u6237\u540d\u79f0\u8bbe\u7f6e"})}),Object(h.jsx)(r.a.Item,{label:"\u4fee\u6539\u6e90\u6587\u4ef6\u65f6\u662f\u5426\u5907\u4efd\u6570\u636e",name:"isBak",valuePropName:"checked",initialValue:this.state.config.isBak,children:Object(h.jsx)(s.a,{})}),Object(h.jsx)(r.a.Item,{label:Object(h.jsxs)(d.Fragment,{children:[Object(h.jsx)("span",{children:"\u5bc6\u94a5"}),"\xa0",Object(h.jsx)(i.a,{title:"\u53ef\u4ee5\u5728\u542f\u52a8\u65e5\u5fd7\u4e2d\u67e5\u770b",children:Object(h.jsx)(u.a,{})})]}),name:"secret",rules:[{required:!0}],children:Object(h.jsx)(o.a.Password,{placeholder:"\u5bc6\u94a5"})}),Object(h.jsx)(r.a.Item,{children:Object(h.jsx)(c.a,{block:!0,type:"primary",htmlType:"submit",loading:this.state.loading,className:"submit-button",children:"\u786e\u8ba4"})})]})}):Object(h.jsxs)("div",{children:[Object(h.jsx)(a.a,{message:"\u68c0\u6d4b\u901a\u8fc7",description:"beancount\u5df2\u5b89\u88c5\uff0c\u70b9\u51fb\u4e0b\u4e00\u6b65\u6765\u5b8c\u6210\u521d\u59cb\u914d\u7f6e",type:"success",showIcon:!0}),Object(h.jsx)("div",{style:{marginTop:"1rem"}}),Object(h.jsx)(c.a,{type:"primary",block:!0,onClick:this.handleNextStep,children:"\u4e0b\u4e00\u6b65"})]}):Object(h.jsx)(l.a,{tip:"Loading...",children:Object(h.jsx)(a.a,{message:"\u68c0\u6d4b\u4e2d",description:"\u6b63\u5728\u68c0\u6d4b beancount \u662f\u5426\u5df2\u5b89\u88c5",type:"info",showIcon:!0})})}}O.contextType=p.a,t.default=Object(b.a)(O)}}]);