-
Notifications
You must be signed in to change notification settings - Fork 1
/
account~settings.js.map
1 lines (1 loc) · 25.7 KB
/
account~settings.js.map
1
{"version":3,"file":"account~settings.8ff576b43a77ef748e22.js","sources":["webpack:///account~settings.8ff576b43a77ef748e22.js"],"sourcesContent":["(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{1949:function(e,t,a){\"use strict\";var o=a(0),n=a.n(o),s=a(2),r=a.n(s),l=a(33),i=a(1952),c=a(11),p=a.n(c),u=a(4),h=a.n(u),_=a(140),d=a(15),m=a(1),g=a.n(m),b=a(271),f=function(){function e(e,t){for(var a=0;a<t.length;a++){var o=t[a];o.enumerable=o.enumerable||!1,o.configurable=!0,\"value\"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,a,o){return a&&e(t.prototype,a),o&&e(t,o),t}}();function v(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function y(e,t){if(!e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function k(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var C=function(e){function t(){return v(this,t),y(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return k(t,n.a.Component),f(t,[{key:\"shouldComponentUpdate\",value:function(e){return!d.a.are_equal_shallow(e.assets,this.props.assets)||e.value!==this.props.value||e.scroll_length!==this.props.scroll_length}},{key:\"render\",value:function(){return this.props.assets.length?n.a.createElement(i.a,{entries:this.props.assets.map(function(e){return e&&e.get(\"symbol\")}).filter(function(e){return!!e}),values:this.props.assets.reduce(function(e,t){return t&&t.get(\"symbol\")&&(e[t.get(\"symbol\")]=t),e},{}),singleEntry:this.props.assets[0]?n.a.createElement(l.a,{asset:this.props.assets[0].get(\"id\"),amount:0,hide_amount:!0}):null,value:this.props.value,onChange:this.props.onChange,scroll_length:this.props.scroll_length}):null}}]),t}();C.propTypes={value:g.a.string,onChange:g.a.func,scroll_length:g.a.number},C=Object(_.a)(C,{asList:!0});var w=function(e){function t(){return v(this,t),y(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return k(t,b[\"a\"]),f(t,[{key:\"componentDidMount\",value:function(){this.onAssetChange(this.props.asset)}},{key:\"formatAmount\",value:function(e){return e||(e=\"\"),\"number\"==typeof e&&(e=e.toString()),e.trim().replace(/,/g,\"\")}},{key:\"_onChange\",value:function(e){this.props.onChange&&this.props.onChange({amount:this.getNumericEventValue(e),asset:this.props.asset})}},{key:\"onAssetChange\",value:function(e){this.props.onChange&&this.props.onChange({amount:this.props.amount,asset:e})}},{key:\"render\",value:function(){var e=this.props.error?h.a.translate(this.props.error):this.formatAmount(this.props.amount);return n.a.createElement(\"div\",{className:\"amount-selector\",style:this.props.style},n.a.createElement(\"label\",{className:\"right-label\"},this.props.display_balance),n.a.createElement(r.a,{className:\"left-label\",component:\"label\",content:this.props.label}),n.a.createElement(\"div\",{className:\"inline-label input-wrapper\"},n.a.createElement(\"input\",{disabled:this.props.disabled,type:\"text\",value:e||\"\",placeholder:this.props.placeholder,onChange:this._onChange.bind(this),tabIndex:this.props.tabIndex,onPaste:this.props.onPaste||this.onPaste.bind(this),onKeyPress:this.onKeyPress.bind(this)}),n.a.createElement(\"div\",{className:\"form-label select floating-dropdown\"},this.props.isPrice?n.a.createElement(\"div\",{className:\"dropdown-wrapper inactive\"},n.a.createElement(\"div\",null,this.props.asset.get(\"symbol\"),\"/\",this.props.base)):n.a.createElement(C,{ref:this.props.refCallback,value:this.props.asset.get(\"symbol\"),assets:p.a.List(this.props.assets),onChange:this.onAssetChange.bind(this),scroll_length:this.props.scroll_length}))))}}]),t}();w.propTypes={label:g.a.string,assets:g.a.array,amount:g.a.any,placeholder:g.a.string,onChange:g.a.func,tabIndex:g.a.number,error:g.a.string,scroll_length:g.a.number},w.defaultProps={disabled:!1,tabIndex:0},w=Object(_.a)(w),t.a=w},1952:function(e,t,a){\"use strict\";var o=a(0),n=a.n(o),s=a(15),r=a(1),l=a.n(r),i=function(){function e(e,t){for(var a=0;a<t.length;a++){var o=t[a];o.enumerable=o.enumerable||!1,o.configurable=!0,\"value\"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,a,o){return a&&e(t.prototype,a),o&&e(t,o),t}}();var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}(this,t);e.scroll_length;var a=function(e,t){if(!e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state={active:!1},a.listener=!1,a.onBodyClick=a.onBodyClick.bind(a),a}return function(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,n.a.Component),i(t,[{key:\"componentDidMount\",value:function(){this._setListener()}},{key:\"shouldComponentUpdate\",value:function(e,t){return!s.a.are_equal_shallow(e.entries,this.props.entries)||!s.a.are_equal_shallow(t,this.state)||e.value!==this.props.value}},{key:\"_setListener\",value:function(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props).entries.length>1&&!this.listener&&(this.listener=!0,document.body.addEventListener(\"click\",this.onBodyClick,{capture:!1,passive:!0}))}},{key:\"_removeListener\",value:function(){document.body.removeEventListener(\"click\",this.onBodyClick),this.listener=!1}},{key:\"componentWillReceiveProps\",value:function(e){1===e.entries.length?this._removeListener():e.entries.length>1&&this._setListener(e)}},{key:\"componentWillUnmount\",value:function(){this._removeListener()}},{key:\"onBodyClick\",value:function(e){var t=e.target,a=!1;do{if(t.classList&&t.classList.contains(\"dropdown\")&&t.id===this.props.id){a=!0;break}}while(t=t.parentNode);a?e.stopPropagation():this.setState({active:!1})}},{key:\"onChange\",value:function(e,t){t.preventDefault(),t.stopPropagation(),this.props.onChange(e),this.setState({active:!1})}},{key:\"_toggleDropdown\",value:function(){this.setState({active:!this.state.active})}},{key:\"render\",value:function(){var e=this,t=this.props,a=t.entries,o=t.value,s=this.state.active;if(0===a.length)return null;if(1==a.length)return n.a.createElement(\"div\",{className:\"dropdown-wrapper inactive\"+(this.props.upperCase?\" upper-case\":\"\")},n.a.createElement(\"div\",null,this.props.singleEntry?this.props.singleEntry:a[0]));var r=a.map(function(t){return n.a.createElement(\"li\",{className:e.props.upperCase?\"upper-case\":\"\",key:t,onClick:e.onChange.bind(e,e.props.values[t])},n.a.createElement(\"span\",null,t))});return n.a.createElement(\"div\",{onClick:this._toggleDropdown.bind(this),className:\"dropdown-wrapper\"+(s?\" active\":\"\")+(this.props.upperCase?\" upper-case\":\"\")},n.a.createElement(\"div\",{style:{paddingRight:15}},o||n.a.createElement(\"span\",{className:\"hidden\"},\"A\")),n.a.createElement(\"ul\",{className:\"dropdown\",style:{overflow:a.length>this.props.scroll_length?\"auto\":\"hidden\"}},r))}}]),t}();c.propTypes={scroll_length:l.a.number},c.defaultProps={scroll_length:9},t.a=c},1979:function(e,t,a){\"use strict\";var o=a(1989),n=a(0),s=a.n(n),r=a(1),l=a.n(r),i=a(141),c=a.n(i),p=(a(856),a(857),a(2)),u=a.n(p),h=a(43),_=a(53),d=a.n(_),m=a(45),g=a(33),b=a(15),f=a(3),v=a.n(f),y=a(1949),k=a(357),C=a(94),w=a(19),E=a(127),P=a(4),x=a.n(P),O=a(568),S=a(11),R=a.n(S),N=a(5),q=a(22),j=a(7),F=a(107),I=function(){function e(e,t){for(var a=0;a<t.length;a++){var o=t[a];o.enumerable=o.enumerable||!1,o.configurable=!0,\"value\"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,a,o){return a&&e(t.prototype,a),o&&e(t,o),t}}();function M(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}function T(e,t){if(!e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!t||\"object\"!=typeof t&&\"function\"!=typeof t?e:t}function B(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var L=function(e){function t(e){M(this,t);var a=T(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return a.state=a._initialState(e),a._onSubmit=a._onSubmit.bind(a),a}return B(t,s.a.Component),I(t,[{key:\"_initialState\",value:function(e){var t=e?this._getCurrentPosition(e):{};if(t.collateral){var a=b.a.get_asset_amount(t.debt,e.quote_asset),o=b.a.get_asset_amount(t.collateral,e.backing_asset),n=isNaN(t.target_collateral_ratio)?0:t.target_collateral_ratio/1e3;return{short_amount:a?a.toString():null,collateral:o?o.toString():null,collateral_ratio:this._getCollateralRatio(a,o),target_collateral_ratio:n,errors:this._getInitialErrors(),isValid:!1,useTargetCollateral:n>0,original_position:{debt:a,collateral:o,target_collateral_ratio:n}}}return{short_amount:0,collateral:0,collateral_ratio:this._getInitialCollateralRatio(e),target_collateral_ratio:0,errors:this._getInitialErrors(),isValid:!1,useTargetCollateral:!1,original_position:{debt:0,collateral:0}}}},{key:\"componentDidUpdate\",value:function(){d.a.rebuild()}},{key:\"componentDidMount\",value:function(){var e=this._initialState(this.props);this.setState(e),this._setUpdatedPosition(e)}},{key:\"shouldComponentUpdate\",value:function(e,t){return!(this.props.visible===e.visible&&b.a.are_equal_shallow(t,this.state)&&R.a.is(e.quote_asset,this.props.quote_asset)&&!e.backing_asset.get(\"symbol\")!==this.props.backing_asset.get(\"symbol\")&&R.a.is(e.account,this.props.account)&&R.a.is(e.call_orders,this.props.call_orders))}},{key:\"componentWillReceiveProps\",value:function(e){var t=this.state,a=t.short_amount,o=t.collateral,n=t.collateral_ratio;if(e.account!==this.props.account||e.hasCallOrders!==this.props.hasCallOrders||e.quote_asset.get(\"id\")!==this.props.quote_asset.get(\"id\")){var s=this._initialState(e),r=!1;(a||o||n)&&(s.short_amount=a,s.collateral=o,s.collateral_ratio=n,r=!0),this.setState(s),r&&this._validateFields(s)}}},{key:\"_getInitialErrors\",value:function(){return{collateral_balance:null,ratio_too_high:null}}},{key:\"_getMaintenanceRatio\",value:function(){return this.props.quote_asset.getIn([\"bitasset\",\"current_feed\",\"maintenance_collateral_ratio\"])/1e3}},{key:\"confirmClicked\",value:function(e){e.preventDefault(),c.a.publish(this.props.modalId,\"close\")}},{key:\"toggleLockedCR\",value:function(e){e.preventDefault(),this.setState({lockedCR:!this.state.lockedCR})}},{key:\"_onBorrowChange\",value:function(e){var t=this._getFeedPrice(),a=e.amount.replace(/,/g,\"\"),o={short_amount:a,collateral:(this.state.collateral_ratio*(a/t)).toFixed(this.props.backing_asset.get(\"precision\")),collateral_ratio:this.state.collateral_ratio};this.setState(o),this._validateFields(o),this._setUpdatedPosition(o)}},{key:\"_onCollateralChange\",value:function(e){var t=e.amount.replace(/,/g,\"\"),a=this._getFeedPrice(),n=t/(this.state.short_amount/a),s=this._isPredictionMarket(this.props)?{short_amount:t,collateral:t,collateral_ratio:1}:{short_amount:this.state.short_amount,collateral:t,collateral_ratio:Object(o.a)(n)?n:this._getInitialCollateralRatio(this.props)};this.setState(s),this._validateFields(s),this._setUpdatedPosition(s)}},{key:\"_onTargetRatioChange\",value:function(e){var t=e.target;new RegExp(/[[:digit:]]/).test(t.value)||(t.value=t.value.replace(/[^0-9.]/g,\"\"));var a=t.value;this.setState({target_collateral_ratio:a})}},{key:\"_onRatioChange\",value:function(e){var t=this._getFeedPrice(),a=e.target;new RegExp(/[[:digit:]]/).test(a.value)||(a.value=a.value.replace(/[^0-9.]/g,\"\"));var o=a.value,n=void 0,s=void 0;this.state.lockedCR?(n=(this.state.collateral*t/o).toFixed(this.props.backing_asset.get(\"precision\")),s=this.state.collateral):(n=this.state.short_amount,s=(this.state.short_amount/t*o).toFixed(this.props.backing_asset.get(\"precision\")));var r={short_amount:n,collateral:s,collateral_ratio:o};this.setState(r),this._validateFields(r),this._setUpdatedPosition(r)}},{key:\"_maximizeCollateral\",value:function(){var e=this.props?this._getCurrentPosition(this.props):{},t=0;e.collateral&&(t=b.a.get_asset_amount(e.collateral,this.props.backing_asset));var a=Math.floor(Math.min(this.props.backing_balance.get(\"balance\")/b.a.get_asset_precision(this.props.backing_asset)+t-10,this.state.short_amount/this._getFeedPrice()*1e3));this._onCollateralChange(new Object({amount:a.toString()}))}},{key:\"_maximizeDebt\",value:function(){var e=this.props?this._getCurrentPosition(this.props):{},t=0;e.collateral&&(t=b.a.get_asset_amount(e.collateral,this.props.backing_asset));var a=this.props.backing_balance.get(\"balance\")/b.a.get_asset_precision(this.props.backing_asset)+t-10,o={short_amount:a/this.state.collateral_ratio*this._getFeedPrice(),collateral:a,collateral_ratio:this.state.collateral_ratio};this.setState(o),this._validateFields(o),this._setUpdatedPosition(o)}},{key:\"_payDebt\",value:function(){var e=this.props?this._getCurrentPosition(this.props):{debt:0};if(!(e.debt<=0)){var t=b.a.get_asset_amount(Math.max(e.debt-this.props.bitasset_balance.get(\"balance\"),0),this.props.quote_asset);this._onBorrowChange({amount:t.toString()})}}},{key:\"_setUpdatedPosition\",value:function(e){this.setState({newPosition:parseFloat(e.short_amount)/parseFloat(e.collateral)})}},{key:\"_validateFields\",value:function(e){var t=this._getInitialErrors(),a=this.state.original_position,o=this.props.backing_balance?this.props.backing_balance.toJS():{balance:0},n=this._getMaintenanceRatio(),s=this._getCollateralRatio(a.debt,a.collateral),r=a.collateral>0&&s<n;parseFloat(e.collateral)-a.collateral>b.a.get_asset_amount(o.balance,this.props.backing_asset.toJS())&&(t.collateral_balance=x.a.translate(\"borrow.errors.collateral\")),r&&e.short_amount>a.debt?t.below_maintenance=x.a.translate(\"borrow.errors.increased_debt_on_margin_call\"):r&&parseFloat(e.collateral_ratio)<=parseFloat(s)?t.below_maintenance=x.a.translate(\"borrow.errors.below_ratio_mcr_update\",{ocr:s.toFixed(4)}):!r&&parseFloat(e.collateral_ratio)<(this._isPredictionMarket(this.props)?1:n)?t.below_maintenance=x.a.translate(\"borrow.errors.below\",{mr:n}):parseFloat(e.collateral_ratio)<(this._isPredictionMarket(this.props)?1:n+.5)&&(t.close_maintenance=x.a.translate(\"borrow.errors.close\",{mr:n})),this.setState({errors:t})}},{key:\"_onSubmit\",value:function(e){e.preventDefault(),this.props.hideModal();var t=b.a.get_asset_precision(this.props.quote_asset.get(\"precision\")),a=b.a.get_asset_precision(this.props.backing_asset.get(\"precision\")),o=this._getCurrentPosition(this.props),n=!1;!!(void 0!==this.state.target_collateral_ratio&&this.state.target_collateral_ratio>0&&this.state.useTargetCollateral)&&(n={target_collateral_ratio:parseInt(1e3*this.state.target_collateral_ratio,10)});var s=parseInt(this.state.collateral*a-o.collateral,10),r=parseInt(this.state.short_amount*t-o.debt,10);0==s&&0==r&&(s=1);var l=C.a.new_transaction();n?l.add_type_operation(\"call_order_update\",{fee:{amount:0,asset_id:0},funding_account:this.props.account.get(\"id\"),delta_collateral:{amount:s,asset_id:this.props.backing_asset.get(\"id\")},delta_debt:{amount:r,asset_id:this.props.quote_asset.get(\"id\")},extensions:n}):l.add_type_operation(\"call_order_update\",{fee:{amount:0,asset_id:0},funding_account:this.props.account.get(\"id\"),delta_collateral:{amount:s,asset_id:this.props.backing_asset.get(\"id\")},delta_debt:{amount:r,asset_id:this.props.quote_asset.get(\"id\")}}),w.a.process_transaction(l,null,!0).catch(function(e){}),c.a.publish(this.props.modalId,\"close\")}},{key:\"_getCurrentPosition\",value:function(e){var t={collateral:null,debt:null};return e&&e.hasCallOrders&&e.call_orders&&(t=(t=e.call_orders.filter(function(e){return!!e}).find(function(t){return t.getIn([\"call_price\",\"quote\",\"asset_id\"])===e.quote_asset.get(\"id\")}))?t.toJS():{collateral:null,debt:null}),t}},{key:\"_getFeedPrice\",value:function(){return this.props?this._isPredictionMarket(this.props)?1:1/b.a.get_asset_price(F.a.extractRawFeedPrice(this.props.quote_asset).getIn([\"quote\",\"amount\"]),this.props.backing_asset,F.a.extractRawFeedPrice(this.props.quote_asset).getIn([\"base\",\"amount\"]),this.props.quote_asset):1}},{key:\"_getInitialCollateralRatio\",value:function(e){return this._isPredictionMarket(e)?1:0}},{key:\"_getCollateralRatio\",value:function(e,t){return t/(e/this._getFeedPrice())}},{key:\"_isPredictionMarket\",value:function(e){return e.quote_asset.getIn([\"bitasset\",\"is_prediction_market\"])}},{key:\"_setUseTargetCollateral\",value:function(){this.setState({useTargetCollateral:!this.state.useTargetCollateral})}},{key:\"render\",value:function(){var e=this,t=this.props,a=t.quote_asset,o=t.bitasset_balance,n=t.backing_asset,r=t.backing_balance,l=this.state,i=l.short_amount,c=l.collateral,p=l.collateral_ratio,h=l.target_collateral_ratio,_=l.errors,d=l.original_position,m=l.useTargetCollateral,f=b.a.get_asset_precision(this.props.quote_asset.get(\"precision\")),C=b.a.get_asset_precision(this.props.backing_asset.get(\"precision\"));p&&!isNaN(p)&&p>0&&p<1e3||(p=0),o=o?o.toJS():{balance:0,id:null},r=r?r.toJS():{balance:0,id:null};var w=v()(\"form-group\",{\"has-error\":_.collateral_balance}),P=v()(\"form-group\",{\"has-error\":_.below_maintenance},{\"has-warning\":_.close_maintenance}),S=this._getCurrentPosition(this.props),R=r.id?N.ChainStore.getObject(r.id):null,I=(R?R.get(\"balance\"):0)-parseInt(this.state.collateral*C-S.collateral,10),M=s.a.createElement(\"span\",null,s.a.createElement(\"span\",null,s.a.createElement(u.a,{component:\"span\",content:\"transfer.available\"}),\":\",\" \",o.id?s.a.createElement(k.a,{balance:o.id}):s.a.createElement(g.a,{amount:0,asset:a.get(\"id\")})),s.a.createElement(\"a\",{onClick:this._payDebt.bind(this)},s.a.createElement(u.a,{content:\"borrow.pay_max_debt\"})),\"|\",0!=p?s.a.createElement(\"a\",{onClick:this._maximizeDebt.bind(this)},s.a.createElement(u.a,{content:\"borrow.use_max\"})):s.a.createElement(j.Tooltip,{placement:\"left\",title:x.a.translate(\"borrow.maximize_debt_set_ratio_slider\")},s.a.createElement(\"span\",{className:\"disabled-link\"},s.a.createElement(u.a,{content:\"borrow.use_max\"})))),T=s.a.createElement(\"span\",null,s.a.createElement(\"span\",null,s.a.createElement(u.a,{component:\"span\",content:\"transfer.available\"}),\":\",\" \",r.id?s.a.createElement(g.a,{amount:I,asset:n.get(\"id\")}):s.a.createElement(g.a,{amount:0,asset:n.get(\"id\")})),s.a.createElement(\"a\",{onClick:this._maximizeCollateral.bind(this)},s.a.createElement(u.a,{content:\"borrow.use_max\"}))),B=this._getFeedPrice(),L=this._getMaintenanceRatio(),D=(this.props.quote_asset.getIn([\"bitasset\",\"current_feed\",\"maximum_short_squeeze_ratio\"]),this._isPredictionMarket(this.props)),U=d.collateral>0&&this._getCollateralRatio(d.debt,d.collateral)<L,z=s.a.createElement(\"div\",null,s.a.createElement(\"form\",{className:\"grid-container text-center no-overflow\",noValidate:!0},s.a.createElement(u.a,{component:\"h3\",content:\"borrow.no_valid\",asset_symbol:a.get(\"symbol\")}))),A=[];return!D&&isNaN(B)?A.push(s.a.createElement(j.Button,{onClick:this.props.hideModal},x.a.translate(\"account.perm.cancel\"))):(A.push(s.a.createElement(j.Button,{key:\"submit\",type:\"primary\",onClick:this._onSubmit},x.a.translate(\"borrow.adjust\"))),A.push(s.a.createElement(j.Button,{key:\"cancel\",onClick:function(){e.props.hideModal(),e.setState(e._initialState(e.props))}},x.a.translate(\"wallet.reset\")))),s.a.createElement(j.Modal,{title:x.a.translate(\"borrow.title\",{asset_symbol:a.get(\"symbol\")}),visible:this.props.visible,onCancel:this.props.hideModal,footer:A},!D&&isNaN(B)?z:s.a.createElement(\"div\",null,s.a.createElement(\"form\",{className:\"grid-container small-10 small-offset-1 no-overflow\",noValidate:!0},s.a.createElement(\"div\",{style:{textAlign:\"left\"}},this.props.hide_help?null:s.a.createElement(O.a,{path:\"components/\"+(D?\"BorrowModalPrediction\":\"BorrowModal\"),debt:a.get(\"symbol\"),collateral:n.get(\"symbol\"),borrower:this.props.account.get(\"name\"),mr:L}),U?s.a.createElement(u.a,{component:\"h6\",className:\"has-warning\",content:\"borrow.errors.below_info\"}):null,D?null:s.a.createElement(\"div\",{style:{paddingTop:\"1rem\",paddingBottom:\"1rem\"}},s.a.createElement(\"div\",{className:\"borrow-price-feeds\"},s.a.createElement(\"span\",{className:\"borrow-price-label\"},s.a.createElement(u.a,{content:\"transaction.feed_price\"}),\": \"),s.a.createElement(E.a,{noPopOver:!0,quote_amount:F.a.extractRawFeedPrice(a).getIn([\"base\",\"amount\"]),quote_asset:F.a.extractRawFeedPrice(a).getIn([\"base\",\"asset_id\"]),base_asset:F.a.extractRawFeedPrice(a).getIn([\"quote\",\"asset_id\"]),base_amount:F.a.extractRawFeedPrice(a).getIn([\"quote\",\"amount\"])})),s.a.createElement(\"b\",null),s.a.createElement(\"div\",{className:\"borrow-price-final \"+(_.below_maintenance?\"has-error\":_.close_maintenance?\"has-warning\":\"\")},s.a.createElement(\"span\",{className:\"borrow-price-label\"},s.a.createElement(u.a,{content:\"exchange.your_price\"}),\": \"),this.state.newPosition?s.a.createElement(E.a,{noPopOver:!0,quote_amount:L*this.state.short_amount*f,quote_asset:a.get(\"id\"),base_asset:n.get(\"id\"),base_amount:this.state.collateral*C}):null)),s.a.createElement(\"div\",{className:\"form-group\"},s.a.createElement(\"span\",{style:{position:\"absolute\",left:20}},s.a.createElement(q.a,{onClick:this.toggleLockedCR.bind(this),name:this.state.lockedCR?\"unlocked\":\"locked\",size:\"1_5x\",style:{position:\"relative\",top:-10}})),s.a.createElement(y.a,{label:\"transaction.borrow_amount\",amount:i.toString(),onChange:this._onBorrowChange.bind(this),asset:a.get(\"id\"),assets:[a.get(\"id\")],display_balance:M,placeholder:\"0.0\",tabIndex:1})),s.a.createElement(\"div\",{className:w},s.a.createElement(\"span\",{style:{position:\"absolute\",left:20}},s.a.createElement(q.a,{onClick:this.toggleLockedCR.bind(this),name:this.state.lockedCR?\"locked\":\"unlocked\",size:\"1_5x\",style:{position:\"relative\",top:-10}})),s.a.createElement(y.a,{label:\"transaction.collateral\",amount:c.toString(),onChange:this._onCollateralChange.bind(this),asset:n.get(\"id\"),assets:[n.get(\"id\")],display_balance:T,placeholder:\"0.0\",tabIndex:1}),_.collateral_balance?s.a.createElement(\"div\",{className:\"float-left\",style:{paddingTop:5}},_.collateral_balance):null),D?null:s.a.createElement(\"div\",null,s.a.createElement(\"div\",{className:P,style:{marginBottom:\"3.5rem\"}},s.a.createElement(u.a,{component:\"label\",content:\"borrow.coll_ratio\"}),s.a.createElement(\"span\",null,s.a.createElement(\"input\",{value:0==p?\"\":p,onChange:this._onRatioChange.bind(this),type:\"text\",style:{width:\"12%\",float:\"right\",marginTop:-10}}),s.a.createElement(\"input\",{style:{width:\"85%\"},min:\"0\",max:\"6\",step:\"0.01\",onChange:this._onRatioChange.bind(this),value:p,type:\"range\"})),_.below_maintenance||_.close_maintenance?s.a.createElement(\"div\",{style:{height:\"1em\",maxWidth:\"85%\"},className:\"float-left\"},_.below_maintenance,_.close_maintenance):null),s.a.createElement(\"div\",{className:\"form-group\",style:{marginBottom:\"3.5rem\"}},s.a.createElement(\"span\",null,s.a.createElement(\"label\",null,s.a.createElement(u.a,{content:\"borrow.target_collateral_ratio\"}),\" \",s.a.createElement(j.Tooltip,{placement:\"top\",title:x.a.translate(\"tooltip.target_collateral_ratio\")},s.a.createElement(\"span\",null,s.a.createElement(q.a,{name:\"question-circle\",title:\"icons.question_circle\"})))),m?s.a.createElement(\"span\",null,s.a.createElement(\"div\",{style:{marginBottom:\"1em\"}},s.a.createElement(j.Checkbox,{onClick:this._setUseTargetCollateral.bind(this),checked:!0},s.a.createElement(u.a,{content:\"borrow.enable_target_collateral_ratio\"}))),s.a.createElement(\"span\",null,s.a.createElement(\"input\",{value:isNaN(h)?\"0\":h,onChange:this._onTargetRatioChange.bind(this),type:\"text\",style:{float:\"right\",marginTop:-10,width:\"12%\"}}),s.a.createElement(\"input\",{style:{width:\"85%\"},min:\"0\",max:\"6\",step:\"0.01\",onChange:this._onTargetRatioChange.bind(this),value:isNaN(h)?\"0\":h,type:\"range\"}))):s.a.createElement(\"div\",{style:{marginBottom:\"1em\"}},s.a.createElement(j.Checkbox,{onClick:this._setUseTargetCollateral.bind(this)},s.a.createElement(u.a,{content:\"borrow.enable_target_collateral_ratio\"}))))))))))}}]),t}();L.propTypes={quote_asset:h.a.ChainAsset.isRequired,bitasset_balance:h.a.ChainObject,backing_asset:h.a.ChainAsset.isRequired,backing_balance:h.a.ChainObject,call_orders:h.a.ChainObjectsList,hasCallOrders:l.a.bool},L=Object(m.a)(L);var D=function(e){function t(){M(this,t);var e=T(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={smallScreen:!1,open:!1},e}return B(t,s.a.Component),I(t,[{key:\"show\",value:function(){this.props.showModal()}},{key:\"componentWillMount\",value:function(){this.setState({smallScreen:window.innerHeight<=800})}},{key:\"render\",value:function(){var e=this.props,t=e.quote_asset,a=e.backing_asset,o=e.account,n=o.get(\"balances\").toJS(),r=void 0,l=void 0;if(n)for(var i in n)i===a&&(r=n[i]),i===t&&(l=n[i]);return s.a.createElement(L,{visible:this.props.visible,hideModal:this.props.hideModal,showModal:this.props.showModal,quote_asset:t,call_orders:o.get(\"call_orders\",Object(S.List)()).toList(),hasCallOrders:o.get(\"call_orders\")&&o.get(\"call_orders\").size>0,modalId:this.props.modalId,bitasset_balance:l,backing_balance:r,backing_asset:a,hide_help:this.state.smallScreen,account:o})}}]),t}();t.a=D}}]);"],"mappings":"AAAA","sourceRoot":""}