-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexchange.6a91b6348586c7de6c98.js
2 lines (2 loc) · 206 KB
/
exchange.6a91b6348586c7de6c98.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{1777:function(e,t,a){"use strict";var r=a(0),n=a.n(r),o=a(16),s=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var i=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),s(t,[{key:"render",value:function(){var e=this.props,t=e.price,a=e.preFormattedPrice,r=e.quote,s=e.base;if(!t&&!a)return null;var i=a||o.a.price_to_text(t,r,s);return i.full>=1?n.a.createElement("span",null,n.a.createElement("span",{className:"price-integer"},i.int,"."),i.dec?n.a.createElement("span",{className:"price-integer"},i.dec):null,i.trailing?n.a.createElement("span",{className:"price-decimal"},i.trailing):null):i.full>=.1?n.a.createElement("span",null,n.a.createElement("span",{className:"price-decimal"},i.int,"."),i.dec?n.a.createElement("span",{className:"price-integer"},i.dec):null,i.trailing?n.a.createElement("span",{className:"price-decimal"},i.trailing):null):n.a.createElement("span",null,n.a.createElement("span",{className:"price-decimal"},i.int,"."),i.dec?n.a.createElement("span",{className:"price-decimal"},i.dec):null,i.trailing?n.a.createElement("span",{className:"price-integer"},i.trailing):null)}}]),t}();t.a=i},1789:function(e,t,a){"use strict";a.d(t,"a",function(){return y}),a.d(t,"b",function(){return b});var r=a(0),n=a.n(r),o=a(119),s=a(5),i=a.n(s),l=a(251),c=a(35),u=a(16),p=a(143),d=a(59),m=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(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 g(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 b=function(e){function t(e){h(this,t);var a=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));a.statsInterval=null;var r=d.a.getMarketName(e.base,e.quote).marketName;return a.state={marketName:r},a}return g(t,n.a.Component),m(t,[{key:"_checkStats",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{close:{}},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{close:{}};return e.volumeBase!==t.volumeBase||!u.a.are_equal_shallow(e.close&&e.close.base,t.close&&t.close.base)||!u.a.are_equal_shallow(e.close&&e.close.quote,t.close&&t.close.quote)}},{key:"shouldComponentUpdate",value:function(e){return this._checkStats(e.allMarketStats.get(this.state.marketName),this.props.allMarketStats.get(this.state.marketName))||e.base.get("id")!==this.props.base.get("id")||e.quote.get("id")!==this.props.quote.get("id")}},{key:"componentWillUnmount",value:function(){this.statsInterval&&this.statsInterval()}}]),t}(),_=function(e){function t(e){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return g(t,b),m(t,[{key:"shouldComponentUpdate",value:function(e){return function e(t,a,r){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,a);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,a,r)}if("value"in n)return n.value;var s=n.get;return void 0!==s?s.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"shouldComponentUpdate",this).call(this,e)}},{key:"render",value:function(){var e=this.props.allMarketStats,t=this.state.marketName,a=e.get(t),r=a&&a.price?a.price:null;return n.a.createElement("span",{className:i()("",this.props.className)},r?n.a.createElement(p.a,{base_amount:r.base.amount,base_asset:r.base.asset_id,quote_amount:r.quote.amount,quote_asset:r.quote.asset_id,force_direction:this.props.force_direction,hide_symbols:this.props.hide_symbols}):"n/a")}}]),t}();_=Object(o.a)(_,{propNames:["quote","base"]});var y=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return g(t,n.a.Component),m(t,[{key:"render",value:function(){return n.a.createElement(_,this.props)}}]),t}();y=Object(c.a)(y,{listenTo:function(){return[l.a]},getProps:function(){return{allMarketStats:l.a.getState().allMarketStats}}})},1791:function(e,t,a){"use strict";var r=a(1803),n=a(0),o=a.n(n),s=a(1),i=a.n(s),l=a(42),c=a.n(l),u=a(104),p=a(252),d=a.n(p),m=a(3),h=a.n(m),f=a(39),g=a(105),b=a.n(g),_=a(48),y=a(32),v=a(16),k=a(5),E=a.n(k),w=a(304),C=a(332),A=a(100),S=a(19),x=a(143),N=a(14),O=a.n(N),P=a(526),T=a(11),F=a.n(T),j=a(10),q=a(21),I=a(69),R=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(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 D(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 M=function(e){function t(e){B(this,t);var a=L(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state=a._initialState(e),a}return D(t,o.a.Component),R(t,[{key:"_initialState",value:function(e){var t=e?this._getCurrentPosition(e):{};if(t.collateral){var a=v.a.get_asset_amount(t.debt,e.quote_asset),r=v.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:r?r.toString():null,collateral_ratio:this._getCollateralRatio(a,r),target_collateral_ratio:n,errors:this._getInitialErrors(),isValid:!1,useTargetCollateral:n>0,original_position:{debt:a,collateral:r,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(){b.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!(v.a.are_equal_shallow(t,this.state)&&F.a.is(e.quote_asset,this.props.quote_asset)&&!e.backing_asset.get("symbol")!==this.props.backing_asset.get("symbol")&&F.a.is(e.account,this.props.account)&&F.a.is(e.call_orders,this.props.call_orders))}},{key:"componentWillReceiveProps",value:function(e){var t=this.state,a=t.short_amount,r=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 o=this._initialState(e),s=!1;(a||r||n)&&(o.short_amount=a,o.collateral=r,o.collateral_ratio=n,s=!0),this.setState(o),s&&this._validateFields(o)}}},{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,""),r={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(r),this._validateFields(r),this._setUpdatedPosition(r)}},{key:"_onCollateralChange",value:function(e){var t=e.amount.replace(/,/g,""),a=this._getFeedPrice(),n=t/(this.state.short_amount/a),o=this._isPredictionMarket(this.props)?{short_amount:t,collateral:t,collateral_ratio:1}:{short_amount:this.state.short_amount,collateral:t,collateral_ratio:Object(r.a)(n)?n:this._getInitialCollateralRatio(this.props)};this.setState(o),this._validateFields(o),this._setUpdatedPosition(o)}},{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 r=a.value,n=void 0,o=void 0;this.state.lockedCR?(n=(this.state.collateral*t/r).toFixed(this.props.backing_asset.get("precision")),o=this.state.collateral):(n=this.state.short_amount,o=(this.state.short_amount/t*r).toFixed(this.props.backing_asset.get("precision")));var s={short_amount:n,collateral:o,collateral_ratio:r};this.setState(s),this._validateFields(s),this._setUpdatedPosition(s)}},{key:"_maximizeCollateral",value:function(){var e=this.props?this._getCurrentPosition(this.props):{},t=0;e.collateral&&(t=v.a.get_asset_amount(e.collateral,this.props.backing_asset));var a=Math.floor(Math.min(this.props.backing_balance.get("balance")/v.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=v.a.get_asset_amount(e.collateral,this.props.backing_asset));var a=this.props.backing_balance.get("balance")/v.a.get_asset_precision(this.props.backing_asset)+t-10,r={short_amount:a/this.state.collateral_ratio*this._getFeedPrice(),collateral:a,collateral_ratio:this.state.collateral_ratio};this.setState(r),this._validateFields(r),this._setUpdatedPosition(r)}},{key:"_payDebt",value:function(){var e=this.props?this._getCurrentPosition(this.props):{debt:0};if(!(e.debt<=0)){var t=v.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,r=this.props.backing_balance?this.props.backing_balance.toJS():{balance:0},n=this._getMaintenanceRatio(),o=this._getCollateralRatio(a.debt,a.collateral),s=a.collateral>0&&o<n;parseFloat(e.collateral)-a.collateral>v.a.get_asset_amount(r.balance,this.props.backing_asset.toJS())&&(t.collateral_balance=O.a.translate("borrow.errors.collateral")),s&&e.short_amount>a.debt?t.below_maintenance=O.a.translate("borrow.errors.increased_debt_on_margin_call"):s&&parseFloat(e.collateral_ratio)<=parseFloat(o)?t.below_maintenance=O.a.translate("borrow.errors.below_ratio_mcr_update",{ocr:o.toFixed(4)}):!s&&parseFloat(e.collateral_ratio)<(this._isPredictionMarket(this.props)?1:n)?t.below_maintenance=O.a.translate("borrow.errors.below",{mr:n}):parseFloat(e.collateral_ratio)<(this._isPredictionMarket(this.props)?1:n+.5)&&(t.close_maintenance=O.a.translate("borrow.errors.close",{mr:n})),this.setState({errors:t})}},{key:"_onSubmit",value:function(e){e.preventDefault();var t=v.a.get_asset_precision(this.props.quote_asset.get("precision")),a=v.a.get_asset_precision(this.props.backing_asset.get("precision")),r=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 o=A.a.new_transaction();n?o.add_type_operation("call_order_update",{fee:{amount:0,asset_id:0},funding_account:this.props.account.get("id"),delta_collateral:{amount:parseInt(this.state.collateral*a-r.collateral,10),asset_id:this.props.backing_asset.get("id")},delta_debt:{amount:parseInt(this.state.short_amount*t-r.debt,10),asset_id:this.props.quote_asset.get("id")},extensions:n}):o.add_type_operation("call_order_update",{fee:{amount:0,asset_id:0},funding_account:this.props.account.get("id"),delta_collateral:{amount:parseInt(this.state.collateral*a-r.collateral,10),asset_id:this.props.backing_asset.get("id")},delta_debt:{amount:parseInt(this.state.short_amount*t-r.debt,10),asset_id:this.props.quote_asset.get("id")}}),S.a.process_transaction(o,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/v.a.get_asset_price(this.props.quote_asset.getIn(["bitasset","current_feed","settlement_price","quote","amount"]),this.props.backing_asset,this.props.quote_asset.getIn(["bitasset","current_feed","settlement_price","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,r=t.bitasset_balance,n=t.backing_asset,s=t.backing_balance,i=this.state,l=i.short_amount,c=i.collateral,u=i.collateral_ratio,p=i.target_collateral_ratio,m=i.errors,f=i.original_position,g=i.useTargetCollateral,b=v.a.get_asset_precision(this.props.quote_asset.get("precision")),_=v.a.get_asset_precision(this.props.backing_asset.get("precision"));u&&!isNaN(u)&&u>0&&u<1e3||(u=0),r=r?r.toJS():{balance:0,id:null},s=s?s.toJS():{balance:0,id:null};var k=E()("form-group",{"has-error":m.collateral_balance}),A=E()("form-group",{"has-error":m.below_maintenance},{"has-warning":m.close_maintenance}),S=this._getCurrentPosition(this.props),N=s.id?j.ChainStore.getObject(s.id):null,T=(N?N.get("balance"):0)-parseInt(this.state.collateral*_-S.collateral,10),F=o.a.createElement("span",null,o.a.createElement("span",null,o.a.createElement(h.a,{component:"span",content:"transfer.available"}),":"," ",r.id?o.a.createElement(C.a,{balance:r.id}):o.a.createElement(y.a,{amount:0,asset:a.get("id")})),o.a.createElement("a",{onClick:this._payDebt.bind(this)},o.a.createElement(h.a,{content:"borrow.pay_max_debt"})),"|",0!=u?o.a.createElement("a",{onClick:this._maximizeDebt.bind(this)},o.a.createElement(h.a,{content:"borrow.use_max"})):o.a.createElement("span",{className:"disabled-link","data-place":"left","data-tip":O.a.translate("borrow.maximize_debt_set_ratio_slider")},o.a.createElement(h.a,{content:"borrow.use_max"}))),R=o.a.createElement("span",null,o.a.createElement("span",null,o.a.createElement(h.a,{component:"span",content:"transfer.available"}),":"," ",s.id?o.a.createElement(y.a,{amount:T,asset:n.get("id")}):o.a.createElement(y.a,{amount:0,asset:n.get("id")})),o.a.createElement("a",{onClick:this._maximizeCollateral.bind(this)},o.a.createElement(h.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)),M=f.collateral>0&&this._getCollateralRatio(f.debt,f.collateral)<L;return!D&&isNaN(B)?o.a.createElement("div",null,o.a.createElement("form",{className:"grid-container text-center no-overflow",noValidate:!0},o.a.createElement(h.a,{component:"h3",content:"borrow.no_valid",asset_symbol:a.get("symbol")})),o.a.createElement("div",{className:"grid-content button-group text-center no-overflow"},o.a.createElement(d.a,{close:this.props.modalId},o.a.createElement("div",{className:" button warning"},o.a.createElement(h.a,{content:"account.perm.cancel"}))))):o.a.createElement("div",null,o.a.createElement("form",{className:"grid-container small-10 small-offset-1 no-overflow",noValidate:!0},o.a.createElement(h.a,{component:"h3",content:"borrow.title",asset_symbol:a.get("symbol")}),o.a.createElement("div",{style:{textAlign:"left"}},this.props.hide_help?null:o.a.createElement(P.a,{path:"components/"+(D?"BorrowModalPrediction":"BorrowModal"),debt:a.get("symbol"),collateral:n.get("symbol"),borrower:this.props.account.get("name"),mr:L}),M?o.a.createElement(h.a,{component:"h6",className:"has-warning",content:"borrow.errors.below_info"}):null,D?null:o.a.createElement("div",{style:{paddingTop:"1rem",paddingBottom:"1rem"}},o.a.createElement("div",{className:"borrow-price-feeds"},o.a.createElement("span",{className:"borrow-price-label"},o.a.createElement(h.a,{content:"transaction.feed_price"}),": "),o.a.createElement(x.a,{noPopOver:!0,quote_amount:a.getIn(["bitasset","current_feed","settlement_price","base","amount"]),quote_asset:a.getIn(["bitasset","current_feed","settlement_price","base","asset_id"]),base_asset:a.getIn(["bitasset","current_feed","settlement_price","quote","asset_id"]),base_amount:a.getIn(["bitasset","current_feed","settlement_price","quote","amount"])})),o.a.createElement("b",null),o.a.createElement("div",{className:"borrow-price-final "+(m.below_maintenance?"has-error":m.close_maintenance?"has-warning":"")},o.a.createElement("span",{className:"borrow-price-label"},o.a.createElement(h.a,{content:"exchange.your_price"}),": "),this.state.newPosition?o.a.createElement(x.a,{noPopOver:!0,quote_amount:L*this.state.short_amount*b,quote_asset:a.get("id"),base_asset:n.get("id"),base_amount:this.state.collateral*_}):null)),o.a.createElement("div",{className:"form-group"},o.a.createElement("span",{style:{position:"absolute",left:20}},o.a.createElement(q.a,{onClick:this.toggleLockedCR.bind(this),name:this.state.lockedCR?"unlocked":"locked",size:"1_5x",style:{position:"relative",top:-10}})),o.a.createElement(w.a,{label:"transaction.borrow_amount",amount:l.toString(),onChange:this._onBorrowChange.bind(this),asset:a.get("id"),assets:[a.get("id")],display_balance:F,placeholder:"0.0",tabIndex:1})),o.a.createElement("div",{className:k},o.a.createElement("span",{style:{position:"absolute",left:20}},o.a.createElement(q.a,{onClick:this.toggleLockedCR.bind(this),name:this.state.lockedCR?"locked":"unlocked",size:"1_5x",style:{position:"relative",top:-10}})),o.a.createElement(w.a,{label:"transaction.collateral",amount:c.toString(),onChange:this._onCollateralChange.bind(this),asset:n.get("id"),assets:[n.get("id")],display_balance:R,placeholder:"0.0",tabIndex:1}),m.collateral_balance?o.a.createElement("div",{className:"float-left",style:{paddingTop:5}},m.collateral_balance):null),D?null:o.a.createElement("div",null,o.a.createElement("div",{className:A,style:{marginBottom:"3.5rem"}},o.a.createElement(h.a,{component:"label",content:"borrow.coll_ratio"}),o.a.createElement("span",null,o.a.createElement("input",{value:0==u?"":u,onChange:this._onRatioChange.bind(this),type:"text",style:{width:"12%",float:"right",marginTop:-10}}),o.a.createElement("input",{style:{width:"85%"},min:"0",max:"6",step:"0.01",onChange:this._onRatioChange.bind(this),value:u,type:"range"})),m.below_maintenance||m.close_maintenance?o.a.createElement("div",{style:{height:"1em",maxWidth:"85%"},className:"float-left"},m.below_maintenance,m.close_maintenance):null),o.a.createElement("div",{className:"form-group",style:{marginBottom:"3.5rem"}},o.a.createElement("span",null,o.a.createElement("label",null,o.a.createElement(h.a,{content:"borrow.target_collateral_ratio"})," ",o.a.createElement("span",{"data-place":"top","data-html":!0,"data-tip":O.a.translate("tooltip.target_collateral_ratio")},o.a.createElement(q.a,{name:"question-circle",title:"icons.question_circle"}))),g?o.a.createElement("span",null,o.a.createElement("div",{style:{marginBottom:"1em"}},o.a.createElement(I.Checkbox,{onClick:this._setUseTargetCollateral.bind(this),checked:!0},o.a.createElement(h.a,{content:"borrow.enable_target_collateral_ratio"}))),o.a.createElement("span",null,o.a.createElement("input",{value:isNaN(p)?"0":p,onChange:this._onTargetRatioChange.bind(this),type:"text",style:{float:"right",marginTop:-10,width:"12%"}}),o.a.createElement("input",{style:{width:"85%"},min:"0",max:"6",step:"0.01",onChange:this._onTargetRatioChange.bind(this),value:isNaN(p)?"0":p,type:"range"}))):o.a.createElement("div",{style:{marginBottom:"1em"}},o.a.createElement(I.Checkbox,{onClick:this._setUseTargetCollateral.bind(this)},o.a.createElement(h.a,{content:"borrow.enable_target_collateral_ratio"})))))),o.a.createElement("div",{className:"no-padding grid-content button-group no-overflow"},o.a.createElement("div",{onClick:this._onSubmit.bind(this),className:E()("button")},o.a.createElement(h.a,{content:"borrow.adjust"})),o.a.createElement("div",{onClick:function(t){t.preventDefault(),e.setState(e._initialState(e.props))},className:"button hollow primary"},o.a.createElement(h.a,{content:"wallet.reset"}))))))}}]),t}();M.propTypes={quote_asset:f.a.ChainAsset.isRequired,bitasset_balance:f.a.ChainObject,backing_asset:f.a.ChainAsset.isRequired,backing_balance:f.a.ChainObject,call_orders:f.a.ChainObjectsList,hasCallOrders:i.a.bool},M=Object(_.a)(M);var z=function(e){function t(){B(this,t);var e=L(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={smallScreen:!1,open:!1},e}return D(t,o.a.Component),R(t,[{key:"show",value:function(){var e=this;this.setState({open:!0},function(){c.a.publish(e.props.modalId,"open")})}},{key:"onClose",value:function(){this.setState({open:!1})}},{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,r=e.account,n=r.get("balances").toJS(),s=void 0,i=void 0;if(n)for(var l in n)l===a&&(s=n[l]),l===t&&(i=n[l]);return this.state.open?o.a.createElement(u.a,{id:this.props.modalId,overlay:!0,onClose:this.onClose.bind(this),ref:this.props.modalId},o.a.createElement("div",{className:"grid-block vertical"},o.a.createElement(M,{quote_asset:t,call_orders:r.get("call_orders",Object(T.List)()).toList(),hasCallOrders:r.get("call_orders")&&r.get("call_orders").size>0,modalId:this.props.modalId,bitasset_balance:i,backing_balance:s,backing_asset:a,hide_help:this.state.smallScreen,account:r}))):null}}]),t}();t.a=z},1799:function(e,t,a){"use strict";(function(e){var r=a(305),n=a(0),o=a.n(n),s=a(42),i=a.n(s),l=a(104),c=a(3),u=a.n(c),p=a(28),d=a(16),m=a(48),h=a(39),f=a(47),g=a(105),b=a.n(g),_=a(14),y=a.n(_),v=a(78),k=a(308),E=a(21),w=a(41),C=a(142),A=a(140),S=a(10),x=a(337),N=a(43),O=a(37),P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},T=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(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 q(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 I=function(t){function a(e){F(this,a);var t=j(this,(a.__proto__||Object.getPrototypeOf(a)).call(this));return t.state={toAddress:v.a.getLast(e.walletType),withdrawValue:"",amountError:null,symbol:e.asset.get("symbol"),to_withdraw:new p.a({asset_id:e.asset.get("id"),precision:e.asset.get("precision")}),fee_asset_id:"1.3.0",feeStatus:{},loading:!1,emptyAddressDeposit:!1},t._validateAddress(t.state.toAddress,e),t.addDepositAddress=t.addDepositAddress.bind(t),t._checkFeeStatus=t._checkFeeStatus.bind(t),t._checkBalance=t._checkBalance.bind(t),t._getCurrentBalance=t._getCurrentBalance.bind(t),t._getFee=t._getFee.bind(t),t._updateFee=Object(r.a)(t._updateFee.bind(t),250),t}return q(a,x["a"]),T(a,[{key:"componentWillMount",value:function(){this._getDepositAddress(),this._updateFee(),this._checkFeeStatus()}},{key:"componentWillReceiveProps",value:function(e){e.asset&&this.props.asset&&e.asset.get("id")!==this.props.asset.get("id")&&this.setState({to_withdraw:new p.a({asset_id:e.asset.get("id"),precision:e.asset.get("precision")}),gateFee:e.asset.get("gateFee"),intermediateAccount:e.asset.get("intermediateAccount"),symbol:e.asset.get("symbol"),memo:"",withdrawValue:"",receive_address:null,toAddress:v.a.getLast(e.walletType)},this._getDepositAddress)}},{key:"_getDepositAddress",value:function(){if(this.props.backingCoinType){var e=Object(v.j)({coin:"open."+this.props.backingCoinType.toLowerCase(),account:this.props.account,stateCallback:this.addDepositAddress});e?this.setState({receive_address:e}):Object(v.l)(this._getDepositObject())}}},{key:"_getDepositObject",value:function(){return{inputCoinType:this.props.backingCoinType.toLowerCase(),outputCoinType:this.props.symbol.toLowerCase(),outputAddress:this.props.sender.get("name"),stateCallback:this.addDepositAddress}}},{key:"requestDepositAddressLoad",value:function(){this.setState({loading:!0,emptyAddressDeposit:!1}),Object(v.l)(this._getDepositObject())}},{key:"addDepositAddress",value:function(e){e.error&&("no_address"===e.error.message?this.setState({emptyAddressDeposit:!0}):this.setState({emptyAddressDeposit:!1})),this.setState({receive_address:e,loading:!1})}},{key:"componentDidUpdate",value:function(){b.a.rebuild()}},{key:"onSubmit",value:function(t){if(t.preventDefault(),0===this.state.to_withdraw.getAmount())return this.setState({amountError:"transfer.errors.pos"});if(this.props.intermediateAccount){var a=this._getFee(),r=this._getGateFee(),n=this.state.to_withdraw.clone(),o=n.clone(this._getCurrentBalance().get("balance"));n.plus(r),o.lt(n)&&(n=this.state.to_withdraw.clone()),f.a.transfer(this.props.sender.get("id"),this.props.intermediateAccount,this.state.to_withdraw.getAmount(),this.state.to_withdraw.asset_id,this.props.backingCoinType.toLowerCase()+":"+this.state.toAddress+(this.state.memo?":"+new e(this.state.memo,"utf-8"):""),null,a.asset_id)}}},{key:"_updateAmount",value:function(){var e=this._getFee(),t=this._getCurrentBalance(),a=new p.a({amount:t?t.get("balance"):0,asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});a.asset_id===e.asset_id&&a.minus(e),this.state.to_withdraw.setAmount({sats:a.getAmount()}),this.setState({withdrawValue:a.getAmount({real:!0}),amountError:null},this._checkBalance)}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.sender;if(t){var a=["1.3.0",this.state.to_withdraw.asset_id],r={},n=[];a.forEach(function(a){n.push(Object(C.b)({accountID:t.get("id"),feeID:a,options:["price_per_kbyte"],data:{type:"memo",content:e.props.backingCoinType.toLowerCase()+":"+e.state.toAddress+(e.state.memo?":"+e.state.memo:"")}}))}),Promise.all(n).then(function(t){a.forEach(function(e,a){r[e]=t[a]}),d.a.are_equal_shallow(e.state.feeStatus,r)||e.setState({feeStatus:r}),e._checkBalance()}).catch(function(e){console.error(e)})}}},{key:"_updateFee",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.fee_asset_id;if(!this.props.sender)return null;Object(C.b)({accountID:this.props.sender.get("id"),feeID:t,options:["price_per_kbyte"],data:{type:"memo",content:this.props.backingCoinType.toLowerCase()+":"+this.state.toAddress+(this.state.memo?":"+this.state.memo:"")}}).then(function(t){var a=t.fee,r=t.hasBalance,n=t.hasPoolBalance;e.setState({feeAmount:a,hasBalance:r,hasPoolBalance:n,error:!r||!n},e._checkFeeStatus)})}},{key:"_getCurrentBalance",value:function(){var e=this;return this.props.balances.find(function(t){return t&&t.get("asset_type")===e.props.asset.get("id")})}},{key:"_checkBalance",value:function(){var e=this.state,t=e.feeAmount,a=e.to_withdraw,r=this.props.asset,n=this._getCurrentBalance();if(n&&t){var o=Object(C.a)(a.getAmount({real:!0}),r,this._getFee(),n,this._getGateFee());if(null!==o)return this.state.balanceError!==!o&&this.setState({balanceError:!o}),o}}},{key:"_getFee",value:function(){var e={getAmount:function(){return 0},asset_id:this.state.fee_asset_id};if(!this.state.feeStatus||!this.state.feeAmount)return e;var t=this.state.feeStatus["1.3.0"],a=this.state.feeStatus[this.state.to_withdraw.asset_id];return t&&t.hasBalance?t.fee:t&&!t.hasBalance&&a&&a.hasBalance?a.fee:t?t.fee:e}},{key:"_onInputAmount",value:function(e){try{this.state.to_withdraw.setAmount({real:parseFloat(e.target.value||0)}),this.setState({withdrawValue:e.target.value,amountError:null},this._checkBalance)}catch(e){console.error("err:",e)}}},{key:"_onInputTo",value:function(e){var t=e.target.value.trim();this.setState({withdraw_address_check_in_progress:!0,withdraw_address_selected:t,validAddress:null,toAddress:t}),this._validateAddress(t)}},{key:"_onMemoChanged",value:function(e){this.setState({memo:e.target.value},this._updateFee)}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(v.m)({url:N.f.BASE,walletType:a.walletType,newAddress:e}).then(function(a){t.state.toAddress===e&&t.setState({withdraw_address_check_in_progress:!1,validAddress:!!a})}).catch(function(e){console.error("Error when validating address:",e)})}},{key:"_openRegistrarSite",value:function(e){e.preventDefault(),window.open(SettingsStore.site_registr,"_blank").opener=null}},{key:"_getGateFee",value:function(){var e=this.props,t=e.gateFee,a=e.asset;return new p.a({real:parseFloat(t?t.replace(",",""):0),asset_id:a.get("id"),precision:a.get("precision")})}},{key:"_renderWithdraw",value:function(){var e=this.state.amountError,t=d.a.replaceName(this.props.asset).name,a=1,r=this.props.supportsMemos,n=this._getFee(),s=this._getGateFee(),i=this.state.feeStatus[n.asset_id],l=S.ChainStore.getAsset(n.asset_id),c=i&&!i.hasBalance||this.state.balanceError||!this.state.toAddress||!this.state.withdrawValue;return o.a.createElement("div",null,o.a.createElement("p",null,o.a.createElement(u.a,{content:"gateway.withdraw_funds",asset:t,wallet_name:Object(O.m)()})),this._renderCurrentBalance(),o.a.createElement("div",{className:"SimpleTrade__withdraw-row"},o.a.createElement("label",{className:"left-label"},y.a.translate("modal.withdraw.amount")),o.a.createElement("div",{className:"inline-label input-wrapper"},o.a.createElement("input",{tabIndex:a++,type:"number",min:"0",onKeyPress:this.onKeyPress.bind(this),value:this.state.withdrawValue,onChange:this._onInputAmount.bind(this)}),o.a.createElement("div",{className:"form-label select floating-dropdown"},o.a.createElement("div",{className:"dropdown-wrapper inactive"},o.a.createElement("div",null,t)))),e?o.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},o.a.createElement(u.a,{content:e})):null,this.state.balanceError?o.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},o.a.createElement(u.a,{content:"transfer.errors.insufficient"})):null),o.a.createElement("div",{className:"SimpleTrade__withdraw-row"},o.a.createElement("label",{className:"left-label"},y.a.translate("transfer.fee")),o.a.createElement("div",{className:"inline-label input-wrapper"},o.a.createElement("input",{type:"text",disabled:!0,value:n.getAmount({real:!0})}),o.a.createElement("div",{className:"form-label select floating-dropdown"},o.a.createElement("div",{className:"dropdown-wrapper inactive"},o.a.createElement("div",null,l?o.a.createElement(A.a,{name:l.get("symbol")}):null)))),i&&!i.hasBalance?o.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},o.a.createElement(u.a,{content:"transfer.errors.insufficient"})):null),o.a.createElement("div",{className:"SimpleTrade__withdraw-row"},o.a.createElement("label",{className:"left-label"},y.a.translate("gateway.fee")),o.a.createElement("div",{className:"inline-label input-wrapper"},o.a.createElement("input",{type:"text",disabled:!0,value:s.getAmount({real:!0})}),o.a.createElement("div",{className:"form-label select floating-dropdown"},o.a.createElement("div",{className:"dropdown-wrapper inactive"},o.a.createElement("div",null,o.a.createElement(A.a,{name:this.props.asset.get("symbol")}))))),i&&!i.hasBalance?o.a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},o.a.createElement(u.a,{content:"transfer.errors.insufficient"})):null),o.a.createElement("div",{className:"SimpleTrade__withdraw-row"},o.a.createElement("label",{className:"left-label"},y.a.translate("modal.withdraw.address")),o.a.createElement("div",{className:"inline-label input-wrapper"},o.a.createElement("input",{placeholder:y.a.translate("gateway.withdraw_placeholder",{asset:t}),tabIndex:a++,type:"text",value:this.state.toAddress,onChange:this._onInputTo.bind(this)}),o.a.createElement("div",{className:"form-label select floating-dropdown"},o.a.createElement("div",{className:"dropdown-wrapper inactive"},o.a.createElement("div",{"data-place":"right","data-tip":y.a.translate("tooltip.withdraw_address",{asset:t})},"?")))),!this.state.validAddress&&this.state.toAddress?o.a.createElement("div",{className:"has-error",style:{paddingTop:10}},o.a.createElement(u.a,{content:"gateway.valid_address",coin_type:t})):null),r?o.a.createElement("div",{className:"SimpleTrade__withdraw-row"},o.a.createElement("label",{className:"left-label"},y.a.translate("transfer.memo")),o.a.createElement("div",{className:"inline-label input-wrapper"},o.a.createElement("textarea",{rows:"3",value:this.state.memo,tabIndex:a++,onChange:this._onMemoChanged.bind(this)})),!this.state.validAddress&&this.state.toAddress?o.a.createElement("div",{className:"has-error",style:{paddingTop:10}},o.a.createElement(u.a,{content:"gateway.valid_address",coin_type:t})):null):null,o.a.createElement("div",{className:"button-group SimpleTrade__withdraw-row"},o.a.createElement("button",{tabIndex:a++,className:"button"+(c?" disabled":""),onClick:this.onSubmit.bind(this),type:"submit"},o.a.createElement(u.a,{content:"gateway.withdraw_now"}))))}},{key:"_renderDeposit",value:function(){var e=this.state,t=e.receive_address,a=e.loading,r=e.emptyAddressDeposit,n=d.a.replaceName(this.props.asset).name,s=t&&"memo"in t&&t.memo,i=t&&t.address||"",l=1;return o.a.createElement("div",{className:i?"":"no-overflow"},o.a.createElement("p",null,o.a.createElement(u.a,{unsafe:!0,content:"gateway.add_funds",account:this.props.sender.get("name"),wallet_name:Object(O.m)()})),this._renderCurrentBalance(),o.a.createElement("div",{className:"SimpleTrade__withdraw-row"},o.a.createElement("p",{style:{marginBottom:10},"data-place":"right","data-tip":y.a.translate("tooltip.deposit_tip",{asset:n})},o.a.createElement(u.a,{className:"help-tooltip",content:"gateway.deposit_to",asset:n}),":",o.a.createElement("label",{className:"fz_12 left-label"},o.a.createElement(u.a,{content:"gateway.deposit_notice_delay"}))),i?o.a.createElement("label",null,r?o.a.createElement(u.a,{content:"gateway.please_generate_address"}):o.a.createElement("span",{className:"inline-label"},o.a.createElement("input",{readOnly:!0,type:"text",value:i}),o.a.createElement(k.a,{text:i})," ")):o.a.createElement(w.a,{type:"three-bounce"}),s?o.a.createElement("label",null,o.a.createElement("span",{className:"inline-label"},o.a.createElement("input",{readOnly:!0,type:"text",value:y.a.translate("transfer.memo")+": "+t.memo}),o.a.createElement(k.a,{text:t.memo}))):null,t&&t.error?o.a.createElement("div",{className:"has-error",style:{paddingTop:10}},t.error.message):null),o.a.createElement("div",{className:"button-group SimpleTrade__withdraw-row"},o.a.createElement("button",{tabIndex:l++,className:"button spinner-button-circle",onClick:this.requestDepositAddressLoad.bind(this),type:"submit"},a?o.a.createElement(w.a,{type:"circle"}):null,o.a.createElement(u.a,{content:"gateway.generate_new"}))))}},{key:"_renderCurrentBalance",value:function(){var e=d.a.replaceName(this.props.asset).name,t="deposit"===this.props.action,a=this._getCurrentBalance(),r=a?new p.a({asset_id:a.get("asset_type"),precision:this.props.asset.get("precision"),amount:a.get("balance")}):null,n=t?o.a.createElement("span",{style:{border:"2px solid black",borderLeft:"none"},className:"form-label"},e):o.a.createElement("button",{"data-place":"right","data-tip":y.a.translate("tooltip.withdraw_full"),className:"button",style:{border:"2px solid black",borderLeft:"none"},onClick:this._updateAmount.bind(this,a?parseInt(a.get("balance"),10):0)},o.a.createElement(E.a,{name:"clippy",title:"icons.clippy.withdraw_full"}));return o.a.createElement("div",{className:"SimpleTrade__withdraw-row",style:{fontSize:"1rem"}},o.a.createElement("label",{style:{fontSize:"1rem"}},y.a.translate("gateway.balance_asset",{asset:e}),":",o.a.createElement("span",{className:"inline-label"},o.a.createElement("input",{disabled:!0,style:{color:"black",border:"2px solid black",padding:10,width:"100%"},value:r?r.getAmount({real:!0}):0}),n)))}},{key:"render",value:function(){var e=this.props,t=e.asset,a="deposit"===e.action;if(!t)return null;var r=d.a.replaceName(t).name,n=this.props.isDown?o.a.createElement("div",null,o.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable_OPEN",component:"p"})):this.props.isAvailable?a?this._renderDeposit():this._renderWithdraw():o.a.createElement("div",null,o.a.createElement(u.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"p"}));return o.a.createElement("div",{className:"SimpleTrade__modal"},o.a.createElement("div",{className:"Modal__header"},o.a.createElement("h3",null,o.a.createElement(u.a,{content:a?"gateway.deposit":"modal.withdraw.submit"})," ",r)),o.a.createElement("div",{className:"Modal__divider"}),o.a.createElement("div",{className:"grid-block vertical no-overflow",style:{zIndex:1002,paddingLeft:"2rem",paddingRight:"2rem",paddingTop:"1rem"}},n))}}]),a}();I.propTypes={sender:h.a.ChainAccount.isRequired,asset:h.a.ChainAsset.isRequired,coreAsset:h.a.ChainAsset.isRequired,globalObject:h.a.ChainAsset.isRequired},I.defaultProps={coreAsset:"1.3.0",globalObject:"2.0.0"},I=Object(m.a)(I);var R=function(e){function t(){F(this,t);var e=j(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={open:!1},e}return q(t,o.a.Component),T(t,[{key:"show",value:function(){var e=this;this.setState({open:!0},function(){i.a.publish(e.props.modalId,"open")})}},{key:"onClose",value:function(){this.setState({open:!1})}},{key:"render",value:function(){return this.state.open?o.a.createElement(l.a,{className:"test",onClose:this.onClose.bind(this),overlay:!0,id:this.props.modalId},this.state.open?o.a.createElement(I,P({},this.props,{open:this.state.open})):null):null}}]),t}();t.a=R}).call(this,a(118).Buffer)},1800:function(e,t,a){"use strict";var r=a(0),n=a.n(r),o=a(42),s=a.n(o),i=a(104),l=a(3),c=a.n(l),u=a(28),p=a(16),d=a(48),m=a(39),h=a(105),f=a.n(h),g=a(14),b=a.n(g),_=a(78),y=a(530),v=a(308),k=a(21),E=a(41),w=a(43),C=a(335),A=a(35),S=a(22),x=a(23),N=a(528),O=a.n(N),P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},T=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(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 q(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 I=function(e){function t(e){F(this,t);var a=j(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={toAddress:_.a.getLast(e.walletType),withdrawValue:"",amountError:null,inputAmount:0,receiveLoading:!1,limitLoading:!0,apiError:!1},a._validateAddress(a.state.toAddress,e),a.deposit_address_cache=new y.a,a}return q(t,n.a.Component),T(t,[{key:"onClose",value:function(){s.a.publish(this.props.modalId,"close")}},{key:"componentWillMount",value:function(){this._getDepositAddress()}},{key:"componentDidMount",value:function(){this._getDepositLimit(),this._estimateOutput()}},{key:"componentWillReceiveProps",value:function(e){e.inputCoinType===this.props.inputCoinType&&e.outputCoinType===this.props.outputCoinType||(this._getDepositLimit(e),this._estimateOutput(e),this._getDepositAddress(e))}},{key:"shouldComponentUpdate",value:function(e,t){return e.inputCoinType!==this.props.inputCoinType||e.outputCoinType!==this.props.outputCoinType||e.sender!==this.props.sender||e.asset!==this.props.asset||e.isAvailable!==this.props.isAvailable||e.isDown!==this.props.isDown||!p.a.are_equal_shallow(t,this.state)}},{key:"_getDepositLimit",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;this.setState({limitLoading:!0}),Object(_.k)(t.inputCoinType,t.outputCoinType).then(function(t){e.setState({depositLimit:t.depositLimit,limitLoading:!1})}).catch(function(t){console.log("deposit limit error:",t),e.setState({depositLimit:null,limitLoading:!1})})}},{key:"_onAmountChange",value:function(e,t){var a=new RegExp(/[[:digit:]]/),r=t.target;switch(a.test(r.value)||(r.value=r.value.replace(/[^0-9.]/g,"")),"."==r.value.charAt(0)&&(r.value="0."),r.value.charAt(r.value.length)!=r.value.search(".")&&r.value.substr(1),r.value=p.a.limitByPrecision(r.value,8),e){case"input":this.setState({inputAmount:r.value},this._estimateOutput.bind(this));break;case"output":this.setState({outputAmount:r.value},this._estimateInput.bind(this))}}},{key:"_estimateOutput",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;this.setState({receiveAmount:0,sendAmount:this.state.inputAmount}),this.state.inputAmount&&(this.setState({receiveLoading:!0}),Object(_.c)(this.state.inputAmount,t.inputCoinType,t.outputCoinType).then(function(t){e.setState({inputAmount:t.inputAmount,receiveAmount:t.outputAmount,receiveLoading:!1})}).catch(function(t){console.log("receive amount err:",t),e.setState({receiveLoading:!1,apiError:!0})}))}},{key:"_estimateInput",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;this.setState({receiveAmount:this.state.outputAmount,sendAmount:0}),this.state.outputAmount&&(this.setState({receiveLoading:!0}),Object(_.b)(this.state.outputAmount,t.inputCoinType,t.outputCoinType).then(function(t){e.setState({inputAmount:t.inputAmount,sendAmount:p.a.limitByPrecision(t.inputAmount,8),receiveLoading:!1})}).catch(function(t){console.log("send amount err:",t),e.setState({receiveLoading:!1,apiError:!0})}))}},{key:"_getDepositAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;if(e.inputCoinType){this.setState({receive_address:null}),Object(_.l)(this._getDepositObject(e))}}},{key:"_getDepositObject",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{inputCoinType:t.inputCoinType.toLowerCase(),outputCoinType:t.outputCoinType.toLowerCase(),outputAddress:t.sender.get("name"),url:w.a.BASE,stateCallback:function(a){e.addDepositAddress(t.inputCoinType.toLowerCase(),t.outputCoinType.toLowerCase(),t.sender.get("name"),a)}}}},{key:"addDepositAddress",value:function(e,t,a,r){this.deposit_address_cache.cacheInputAddress("blocktrades",a,e,t,r.address,r.memo),this.setState({receive_address:r})}},{key:"componentDidUpdate",value:function(){f.a.rebuild()}},{key:"_validateAddress",value:function(e){var t=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props;Object(_.m)({walletType:a.walletType,newAddress:e}).then(function(a){t.state.toAddress===e&&t.setState({withdraw_address_check_in_progress:!1,validAddress:a})}).catch(function(e){console.error("Error when validating address:",e)})}},{key:"_openRegistrarSite",value:function(e){e.preventDefault(),window.open(S.a.site_registr,"_blank").opener=null}},{key:"_onDropDownSelect",value:function(e){x.a.changeViewSetting({preferredBridge:e})}},{key:"onBlockTradesContact",value:function(){console.log("Open New Tab"),window.open("https://www.blocktrades.us/contact","_blank").focus()}},{key:"_renderDeposit",value:function(){var e=p.a.replaceName(this.props.asset),t=e.name,a=e.prefix,r=this.state,o=r.receive_address,s=r.apiError,i=o&&"memo"in o&&o.memo,l=o&&o.address||"",u=n.a.createElement("div",{className:"QR",style:{textAlign:"center"}},n.a.createElement(O.a,{size:140,value:l})),d=Object.keys(this.props.bridges.toJS()),m=this.props.inputCoinType.toUpperCase(),h=(a||"")+t,f=(this.state.receiveAmount/this.state.inputAmount).toFixed(4),g=h+"/"+m,_=this.state.inputAmount>parseFloat(this.state.depositLimit)||this.state.sendAmount>parseFloat(this.state.depositLimit),y=_?{border:"1px solid #a94442"}:null;return n.a.createElement("div",{className:"modal__body"},n.a.createElement("div",{className:"container-row"},n.a.createElement("label",{className:"left-label"},n.a.createElement(c.a,{content:"modal.buy.asset"})),n.a.createElement("div",{className:"inline-label input-wrapper"},n.a.createElement("input",{disabled:!0,type:"text",defaultValue:h}))),n.a.createElement("div",{className:"container-row"},n.a.createElement("div",{className:"grid-block"},n.a.createElement("label",{className:"left-label"},n.a.createElement(c.a,{content:"modal.buy.bridge"})),n.a.createElement("span",{"data-tip":b.a.translate("tooltip.bridge_TRADE"),className:"inline-block tooltip",onClick:this.onBlockTradesContact.bind(this)}," ",n.a.createElement(k.a,{style:{position:"relative",top:0},name:"question-circle",title:"icons.question_circle"}))),n.a.createElement("div",{className:"inline-label input-wrapper"},n.a.createElement("input",{disabled:!0,type:"text",defaultValue:"BLOCKTRADES"})," ")),n.a.createElement("span",{style:s?{display:"none"}:{display:""}},n.a.createElement("div",{className:"container-row double-row"},n.a.createElement("div",{className:"no-margin no-padding"},n.a.createElement("div",{className:"small-6",style:{paddingRight:10}},n.a.createElement("div",{className:"grid-block"},n.a.createElement("label",{className:"left-label"},n.a.createElement(c.a,{content:"transfer.send"})),_?n.a.createElement("div",{className:"error-msg inline-block tooltip","data-tip":b.a.translate("tooltip.over_limit")},n.a.createElement(c.a,{content:"gateway.over_limit"})," ",n.a.createElement(k.a,{name:"question-circle",title:"icons.question_circle"})):null),n.a.createElement("div",{className:"inline-label input-wrapper"},n.a.createElement("input",{style:y,type:"text",value:this.state.sendAmount,onInput:this._onAmountChange.bind(this,"input")}),n.a.createElement("div",{className:"form-label select floating-dropdown"},n.a.createElement(C.a,{entries:d,values:d.reduce(function(e,t){return t&&(e[t]=t),e},{}),singleEntry:d[0],value:this.props.preferredBridge||d[0],onChange:this._onDropDownSelect,upperCase:!0})))),n.a.createElement("div",{className:"small-6",style:{paddingLeft:10}},n.a.createElement("label",{className:"left-label"},n.a.createElement(c.a,{content:"gateway.deposit_limit"})),n.a.createElement("div",{className:"inline-label input-wrapper"},n.a.createElement("input",{disabled:!0,type:"number",value:this.state.depositLimit&&parseFloat(this.state.depositLimit).toFixed(4)||0}),n.a.createElement("div",{className:"input-right-symbol"},m))))),n.a.createElement("div",{className:"container-row double-row"},n.a.createElement("div",{className:"no-margin no-padding"},n.a.createElement("div",{className:"small-6",style:{paddingRight:10}},n.a.createElement("label",{className:"left-label"},n.a.createElement(c.a,{content:"exchange.receive"})),n.a.createElement("div",{className:"inline-label input-wrapper"},n.a.createElement("input",{style:y,type:"text",value:this.state.receiveAmount,onInput:this._onAmountChange.bind(this,"output")}),n.a.createElement("div",{className:"input-right-symbol"},h))),n.a.createElement("div",{className:"small-6",style:{paddingLeft:10}},n.a.createElement("div",{className:"grid-block"},n.a.createElement("label",{className:"left-label"},n.a.createElement(c.a,{content:"exchange.price"})," ",this.state.receiveLoading?n.a.createElement(c.a,{content:"footer.loading"}):"")),n.a.createElement("div",{className:"inline-label input-wrapper"},n.a.createElement("input",{disabled:!0,type:"number",value:_?0:f}),n.a.createElement("div",{className:"input-right-symbol"},g))))),l?n.a.createElement("div",{className:"container-row"},i?null:u,n.a.createElement("div",{className:"grid-block"},n.a.createElement("div",{className:"copyIcon"},n.a.createElement(v.a,{text:l,className:"copyIcon"})),n.a.createElement("div",null,n.a.createElement(c.a,{component:"div",style:{fontSize:"0.8rem",fontWeight:"bold",paddingBottom:"0.3rem"},content:"gateway.purchase_notice",inputAsset:m,outputAsset:h}),n.a.createElement("div",{className:"modal__highlight"},l))),i?n.a.createElement("div",{className:"grid-block",style:{marginTop:"10px"}},n.a.createElement("div",{className:"copyIcon"},n.a.createElement(v.a,{text:o.memo,className:"copyIcon"})),n.a.createElement("div",null,n.a.createElement(c.a,{unsafe:!0,content:"gateway.purchase_notice_memo",component:"div",style:{fontSize:"0.8rem",fontWeight:"bold",paddingBottom:"0.3rem"}}),n.a.createElement("div",{className:"modal__highlight"},o.memo))):null):n.a.createElement("div",{style:{textAlign:"center"}},n.a.createElement(E.a,{type:"three-bounce"})),n.a.createElement("div",null,n.a.createElement("div",{className:"no-margin no-padding"},n.a.createElement("button",{className:"button primary hollow",onClick:this.onClose.bind(this)},n.a.createElement(c.a,{content:"transfer.close"}))))),n.a.createElement("span",{style:s?{display:""}:{display:"none"}},n.a.createElement("div",{className:"container-row double-row"},n.a.createElement(c.a,{className:"txtlabel cancel",content:"gateway.unavailable_TRADE",component:"h3"}),n.a.createElement("button",{className:"button primary hollow",onClick:this.onClose.bind(this)},n.a.createElement(c.a,{content:"transfer.close"})))))}},{key:"_renderCurrentBalance",value:function(){var e=this,t=p.a.replaceName(this.props.asset).name,a="deposit"===this.props.action,r=this.props.balances.find(function(t){return t&&t.get("asset_type")===e.props.asset.get("id")}),o=r?new u.a({asset_id:r.get("asset_type"),precision:this.props.asset.get("precision"),amount:r.get("balance")}):null,s=a?n.a.createElement("span",{style:{border:"2px solid black",borderLeft:"none"},className:"form-label"},t):n.a.createElement("button",{"data-place":"right","data-tip":b.a.translate("tooltip.withdraw_full"),className:"button",style:{border:"2px solid black",borderLeft:"none"},onClick:this._updateAmount.bind(this,r?parseInt(r.get("balance"),10):0)},n.a.createElement(k.a,{name:"clippy",title:"icons.clippy.withdraw_full"}));return n.a.createElement("div",{className:"SimpleTrade__withdraw-row",style:{fontSize:"1rem"}},n.a.createElement("label",{style:{fontSize:"1rem"}},b.a.translate("gateway.balance_asset",{asset:t}),":",n.a.createElement("span",{className:"inline-label"},n.a.createElement("input",{disabled:!0,style:{color:"black",border:"2px solid black",padding:10,width:"100%"},value:o?o.getAmount({real:!0}):0}),s)))}},{key:"render",value:function(){return this.props.asset?n.a.createElement("div",{className:"grid-block vertical no-overflow"},n.a.createElement("div",{className:"modal__header"},n.a.createElement(c.a,{component:"p",content:"modal.buy.title"})),this.props.isDown?n.a.createElement("div",{style:{textAlign:"center"}},n.a.createElement(c.a,{className:"txtlabel cancel",content:"gateway.unavailable_TRADE",component:"p"})):this.props.isAvailable?this._renderDeposit():n.a.createElement("div",{style:{textAlign:"center"}},n.a.createElement(c.a,{className:"txtlabel cancel",content:"gateway.unavailable",component:"p"}))):null}}]),t}();I.propTypes={sender:m.a.ChainAccount.isRequired,asset:m.a.ChainAsset.isRequired},I=Object(d.a)(I);var R=function(e){function t(){return F(this,t),j(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return q(t,n.a.Component),T(t,[{key:"render",value:function(){var e=this.props,t=e.preferredBridge,a=function(e,t){var a={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=e[r]);return a}(e,["preferredBridge"]),r=this.props.bridges.get(this.props.preferredBridge);return r||(t=(r=this.props.bridges.first()).inputCoinType),n.a.createElement(I,P({},a,{preferredBridge:t},r.toJS()))}}]),t}();R=Object(A.a)(R,{listenTo:function(){return[S.a]},getProps:function(){return{preferredBridge:S.a.getState().viewSettings.get("preferredBridge","btc")}}});var B=function(e){function t(){F(this,t);var e=j(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={open:!1},e}return q(t,n.a.Component),T(t,[{key:"show",value:function(){var e=this;this.setState({open:!0},function(){s.a.publish(e.props.modalId,"open")})}},{key:"onClose",value:function(){this.setState({open:!1})}},{key:"render",value:function(){return this.props.bridges&&this.state.open?n.a.createElement(i.a,{id:this.props.modalId,onClose:this.onClose.bind(this),noCloseBtn:!0,overlay:!0},this.state.open?n.a.createElement(R,P({},this.props,{open:this.state.open})):null):null}}]),t}();t.a=B},1815:function(e,t,a){"use strict";var r=a(0),n=a.n(r),o=a(1),s=a.n(o),i=a(2056),l=a(14),c=a.n(l),u=a(1760),p=a.n(u),d=a(16),m=a(3),h=a.n(m),f=a(140),g=a(1781),b=a.n(g),_=a(1756),y=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(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 E(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)}((function(e){function t(){return v(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return E(t,n.a.Component),y(t,[{key:"render",value:function(){var e=this.props,t=e.baseSymbol,a=e.quoteSymbol;return n.a.createElement("thead",null,n.a.createElement("tr",null,n.a.createElement("th",{style:{textAlign:"right"}},n.a.createElement(h.a,{content:"exchange.price"}),n.a.createElement("br",null),t?n.a.createElement("span",{className:"header-sub-title"},"(",n.a.createElement(f.a,{name:t}),"/",n.a.createElement(f.a,{name:a}),")"):null),n.a.createElement("th",{style:{textAlign:"right"}},n.a.createElement(h.a,{content:"transfer.amount"}),n.a.createElement("br",null),a?n.a.createElement("span",{className:"header-sub-title"},"(",n.a.createElement(f.a,{name:a}),")"):null),n.a.createElement("th",{style:{textAlign:"right"}},n.a.createElement(h.a,{content:"transaction.settlement_date"}),n.a.createElement("br",null),n.a.createElement("span",{style:{visibility:"hidden"},className:"header-sub-title"},"d"))))}}]),t})()).defaultProps={quoteSymbol:null,baseSymbol:null};var w=function(e){function t(){return v(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return E(t,n.a.Component),y(t,[{key:"render",value:function(){var e=this.props,t=e.base,a=e.quote,r=e.order,o=e.showSymbols,s="1.3.0"==t.get("id")?r.getPrice()/(1+r.offset_percent/1e4):r.getPrice()*(1+r.offset_percent/1e4),i=o?" "+a.get("symbol"):null;return n.a.createElement("tr",{style:{paddingRight:5}},n.a.createElement("td",{style:{textAlign:"right",width:"25%"}},d.a.format_number(s,a.get("precision"))," ",i),n.a.createElement("td",{style:{textAlign:"right",width:"25%"}},d.a.format_number(r[r.isBid()?"amountToReceive":"amountForSale"]().getAmount({real:!0}),a.get("precision"))),n.a.createElement("td",{style:{textAlign:"right",width:"25%"}},d.a.format_number(r[r.isBid()?"amountForSale":"amountToReceive"]().getAmount({real:!0}),t.get("precision"))),n.a.createElement("td",{style:{textAlign:"right",width:"25%"},className:"tooltip","data-tip":new Date(r.settlement_date)},c.a.localize(new Date(r.settlement_date),{type:"date",format:-1!==b()().toLowerCase().indexOf("en-us")?"market_history_us":"market_history"})))}}]),t}();w.defaultProps={showSymbols:!1,invert:!1};var C=function(e){function t(){return v(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return E(t,n.a.Component),y(t,[{key:"shouldComponentUpdate",value:function(e){return e.currentAccount!==this.props.currentAccount||e.orders!==this.props.orders}},{key:"render",value:function(){var e=this.props,t=e.orders,a=e.base,r=e.quote,o=null;if(!(t.size>0&&a&&r))return null;var s=0;return o=t.sort(function(e,t){return e.isBefore(t)?-1:1}).map(function(e){return Date.now()<e.settlement_date?n.a.createElement(w,{key:s++,order:e,base:a,quote:r}):null}).toArray(),n.a.createElement(_.a,{component:"tbody",transitionName:"newrow"},o)}}]),t}();C.defaultProps={base:{},quote:{},orders:{},quoteSymbol:"",baseSymbol:""},C.propTypes={base:s.a.object.isRequired,quote:s.a.object.isRequired,orders:s.a.object.isRequired,quoteSymbol:s.a.string.isRequired,baseSymbol:s.a.string.isRequired};var A=C,S=a(1777),x=a(23),N=a(5),O=a.n(N),P=a(21),T=a(10),F=a(28),j=a(1770),q=a(1789),I=a(143),R=a(105),B=a.n(R);a.d(t,"b",function(){return V}),a.d(t,"c",function(){return W}),a.d(t,"a",function(){return G});var L=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function D(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(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 U(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 H={textAlign:"left"},W=function(e){function t(){return M(this,t),z(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return U(t,n.a.Component),L(t,[{key:"render",value:function(){var e=this.props,t=e.baseSymbol,a=e.quoteSymbol,r=e.dashboard,o=e.isMyAccount;return r?n.a.createElement("tr",null,o?n.a.createElement("th",{id:"cancelAllOrders",style:{cursor:"pointer"}},n.a.createElement(h.a,{content:"wallet.cancel"})):null,n.a.createElement("th",null,n.a.createElement(h.a,{content:"account.trade"})),n.a.createElement("th",{style:H},n.a.createElement(h.a,{content:"transaction.order_id"})),n.a.createElement("th",{style:H,colSpan:"4"},n.a.createElement(h.a,{content:"exchange.description"})),n.a.createElement("th",{style:H},n.a.createElement(h.a,{content:"exchange.price"})),n.a.createElement("th",{style:H},n.a.createElement(h.a,{content:"exchange.price_market"})),n.a.createElement("th",{style:{textAlign:"right"}},n.a.createElement(h.a,{content:"exchange.value"}))):n.a.createElement("thead",null,n.a.createElement("tr",null,n.a.createElement("th",{style:{textAlign:this.props.leftAlign?"left":""}},n.a.createElement(h.a,{className:"header-sub-title",content:"exchange.price"})),n.a.createElement("th",{style:this.props.leftAlign?{textAlign:"left"}:null},t?n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(f.a,{dataPlace:"top",name:a})):null),n.a.createElement("th",{style:this.props.leftAlign?{textAlign:"left"}:null},t?n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(f.a,{dataPlace:"top",name:t})):null),n.a.createElement("th",{style:{textAlign:this.props.leftAlign?"left":""}},n.a.createElement(h.a,{className:"header-sub-title",content:"transaction.expiration"})),n.a.createElement("th",{style:{width:"6%"}})))}}]),t}();W.defaultProps={quoteSymbol:null,baseSymbol:null};var V=function(e){function t(){return M(this,t),z(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return U(t,n.a.Component),L(t,[{key:"shouldComponentUpdate",value:function(e){return e.order.for_sale!==this.props.order.for_sale||e.order.id!==this.props.order.id||e.quote!==this.props.quote||e.base!==this.props.base||e.order.market_base!==this.props.order.market_base}},{key:"render",value:function(){var e=this.props,t=e.base,a=e.quote,r=e.order,o=e.showSymbols,s=e.dashboard,l=e.isMyAccount,u=e.settings,p=r.isBid(),m=r.isCall(),g=m?"orderHistoryCall":p?"orderHistoryBid":"orderHistoryAsk",b=o?n.a.createElement("span",null," "+t.get("symbol")+"/"+a.get("symbol")):null,_=o?" "+t.get("symbol"):null,y=o?" "+a.get("symbol"):null,v=u?u.get("unit"):"1.3.0",k=p?"value positive":"value negative",E=p?"value negative":"value positive";return s?n.a.createElement("tr",{key:r.id,className:"clickable"},l?n.a.createElement("td",{className:"text-center"},m?null:n.a.createElement("span",{style:{marginRight:0},className:"order-cancel"},n.a.createElement("input",{type:"checkbox",className:"orderCancel",onChange:this.props.onCheckCancel}))):null,n.a.createElement("td",null,n.a.createElement(i.a,{to:"/market/"+a.get("symbol")+"_"+t.get("symbol")},n.a.createElement(P.a,{name:"trade",title:"icons.trade.trade",className:"icon-14px"}))),n.a.createElement("td",{style:H},"#",r.id.substring(4)),n.a.createElement("td",{colSpan:"4",style:H,onClick:this.props.onFlip},p?n.a.createElement(h.a,{content:"exchange.buy_description",baseAsset:d.a.format_number(r[p?"amountToReceive":"amountForSale"]().getAmount({real:!0}),t.get("precision"),!1),quoteAsset:d.a.format_number(r[p?"amountForSale":"amountToReceive"]().getAmount({real:!0}),a.get("precision"),!1),baseName:n.a.createElement(f.a,{noTip:!0,customClass:k,name:a.get("symbol")}),quoteName:n.a.createElement(f.a,{noTip:!0,customClass:E,name:t.get("symbol")})}):n.a.createElement(h.a,{content:"exchange.sell_description",baseAsset:d.a.format_number(r[p?"amountToReceive":"amountForSale"]().getAmount({real:!0}),t.get("precision"),!1),quoteAsset:d.a.format_number(r[p?"amountForSale":"amountToReceive"]().getAmount({real:!0}),a.get("precision"),!1),baseName:n.a.createElement(f.a,{noTip:!0,customClass:k,name:a.get("symbol")}),quoteName:n.a.createElement(f.a,{noTip:!0,customClass:E,name:t.get("symbol")})})),n.a.createElement("td",{style:H,onClick:this.props.onFlip},n.a.createElement(I.a,{base_amount:r.sellPrice().base.amount,base_asset:r.sellPrice().base.asset_id,quote_amount:r.sellPrice().quote.amount,quote_asset:r.sellPrice().quote.asset_id,force_direction:t.get("symbol"),hide_symbols:!0})),n.a.createElement("td",{style:H,onClick:this.props.onFlip},n.a.createElement(q.a,{base:t.get("id"),quote:a.get("id"),force_direction:t.get("symbol"),hide_symbols:!0,hide_asset:!0})),n.a.createElement("td",{style:{textAlign:"right"},onClick:this.props.onFlip},n.a.createElement(j.b,{hide_asset:!0,amount:r.amountForSale().getAmount(),fromAsset:r.amountForSale().asset_id,noDecimals:!0,toAsset:v})," ",n.a.createElement(f.a,{name:v}))):n.a.createElement("tr",{key:r.id},n.a.createElement("td",{className:g,style:{paddingLeft:10}},n.a.createElement(S.a,{price:r.getPrice(),base:t,quote:a}),b),n.a.createElement("td",null,d.a.format_number(r[p?"amountToReceive":"amountForSale"]().getAmount({real:!0}),a.get("precision"))," ",y),n.a.createElement("td",null,d.a.format_number(r[p?"amountForSale":"amountToReceive"]().getAmount({real:!0}),t.get("precision"))," ",_),n.a.createElement("td",{style:{width:"25%",textAlign:"right"},className:"tooltip","data-tip":r.expiration.toLocaleString()},m?null:c.a.localize(new Date(r.expiration),{type:"date",format:"short_custom"})),n.a.createElement("td",{className:"text-center",style:{width:"6%"}},m?null:n.a.createElement("a",{style:{marginRight:0},className:"order-cancel",onClick:this.props.onCancel},n.a.createElement(P.a,{name:"cross-circle",title:"icons.cross_circle.cancel_order",className:"icon-14px"}))))}}]),t}();V.defaultProps={showSymbols:!1};var G=function(e){function t(e){M(this,t);var a=z(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={activeTab:e.activeTab},a._getOrders=a._getOrders.bind(a),a}return U(t,n.a.Component),L(t,[{key:"componentDidMount",value:function(){var e=this.refs.container;e&&p.a.initialize(e)}},{key:"componentDidUpdate",value:function(){var e=this.refs.container;e&&p.a.update(e)}},{key:"_getOrders",value:function(){var e,t=this.props,a=t.currentAccount,r=t.base,n=t.quote,o=t.feedPrice,s=a.get("orders"),i=a.get("call_orders"),l=r.get("id"),c=n.get("id"),u=(D(e={},r.get("id"),{precision:r.get("precision")}),D(e,n.get("id"),{precision:n.get("precision")}),e),p=s.toArray().map(function(e){var t=T.ChainStore.getObject(e);if(!t)return null;var a=t.getIn(["sell_price","base","asset_id"]),r=t.getIn(["sell_price","quote","asset_id"]);return a===l&&r===c||a===c&&r===l?new F.f(t.toJS(),u,n.get("id")):void 0}).filter(function(e){return!!e}),d=i.toArray().map(function(e){try{var t=T.ChainStore.getObject(e);if(!t)return null;var a=t.getIn(["call_price","base","asset_id"]),r=t.getIn(["call_price","quote","asset_id"]);if(a===l&&r===c||a===c&&r===l)return o?new F.b(t.toJS(),u,n.get("id"),o):null}catch(e){return null}}).filter(function(e){return!!e}).filter(function(e){try{return e.isMarginCalled()}catch(e){return!1}});return p.concat(d)}},{key:"_changeTab",value:function(e){x.a.changeViewSetting({ordersTab:e}),this.setState({activeTab:e});var t=this.refs.container;t.scrollTop=0,p.a.update(t),setTimeout(B.a.rebuild,1e3)}},{key:"render",value:function(){var e=this,t=this.props,a=t.base,r=t.quote,o=t.quoteSymbol,s=t.baseSymbol,i=t.settleOrders,l=this.state.activeTab;if(!a||!r)return null;var c=void 0,u=!!(a.get("bitasset_data_id")&&i.size>0),p=!!(r.get("bitasset_data_id")&&i.size>0);if(l&&(u||p)||(l="my_orders"),"my_orders"==l){var d=this._getOrders(),m=n.a.createElement("tr",null,n.a.createElement("td",{style:{textAlign:"center"},colSpan:"5"},n.a.createElement(h.a,{content:"account.no_orders"}))),g=d.filter(function(e){return e.isBid()}).sort(function(e,t){return t.getPrice()-e.getPrice()}).map(function(t){var o=t.getPrice();return n.a.createElement(V,{price:o,key:t.id,order:t,base:a,quote:r,onCancel:e.props.onCancel.bind(e,t.id)})}),b=d.filter(function(e){return!e.isBid()}).sort(function(e,t){return e.getPrice()-t.getPrice()}).map(function(t){var o=t.getPrice();return n.a.createElement(V,{price:o,key:t.id,order:t,base:a,quote:r,onCancel:e.props.onCancel.bind(e,t.id)})}),y=[];b.length&&(y=y.concat(b)),g.length&&(y=y.concat(g)),y.sort(function(e,t){return e.props.price-t.props.price}),c=n.a.createElement(_.a,{component:"tbody",transitionName:"newrow"},y.length?y:m)}l&&"open_settlement"==l&&(c=n.a.createElement(A,{key:"settle_orders",orders:i,base:a,quote:r,baseSymbol:s,quoteSymbol:o}));var v="mymarkets-header clickable",k=O()(v,{inactive:"my_orders"!==l}),E=O()(v,{inactive:"open_settlement"!==l}),w=u||p?"50%":"100%",C=u||p?"inherit":"none";return n.a.createElement("div",{style:{marginBottom:"15px"},key:"open_orders",className:this.props.className},n.a.createElement("div",{className:"exchange-bordered small-12",style:{height:"auto",minHeight:266}},n.a.createElement("div",{className:"grid-block shrink left-orderbook-header"},n.a.createElement("div",{style:{width:w},className:k,onClick:this._changeTab.bind(this,"my_orders")},n.a.createElement(h.a,{content:"exchange.my_orders"})),n.a.createElement("div",{style:{display:C},className:E,onClick:this._changeTab.bind(this,"open_settlement")},n.a.createElement(h.a,{content:"exchange.settle_orders"}))),n.a.createElement("div",{className:"grid-block shrink left-orderbook-header market-right-padding-only"},n.a.createElement("table",{className:"table order-table text-right fixed-table market-right-padding"},"my_orders"==l?n.a.createElement(W,{rightAlign:!0,type:"sell",baseSymbol:s,quoteSymbol:o}):n.a.createElement("thead",null,n.a.createElement("tr",null,n.a.createElement("th",null,n.a.createElement(h.a,{className:"header-sub-title",content:"exchange.price"})),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(f.a,{dataPlace:"top",name:o}))),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(f.a,{dataPlace:"top",name:s}))),n.a.createElement("th",null,n.a.createElement(h.a,{className:"header-sub-title",content:"explorer.block.date"})))))),n.a.createElement("div",{className:"table-container grid-block market-right-padding-only no-overflow",ref:"container",style:{overflow:"hidden",maxHeight:200}},n.a.createElement("table",{className:"table order-table text-right fixed-table market-right-padding"},c))))}}]),t}();G.defaultProps={base:{},quote:{},orders:{},quoteSymbol:"",baseSymbol:""},G.propTypes={base:s.a.object.isRequired,quote:s.a.object.isRequired,orders:s.a.object.isRequired,quoteSymbol:s.a.string.isRequired,baseSymbol:s.a.string.isRequired}},1822:function(e,t){e.exports={midnightTheme:{bidColor:"#50D2C2",bidFillColor:"rgba(80, 210, 194, 0.5)",askColor:"#E3745B",askFillColor:"rgba(227, 116, 91, 0.5)",callColor:"#BBBF2B",settleColor:"rgba(125, 134, 214, 1)",settleFillColor:"rgba(125, 134, 214, 0.5)",positiveColor:"#6BA583",negativeColor:"#DB0000",strokeColor:"#FFFF00",primaryText:"#e0e0e0",volumeColor:"#848484",tooltipBackgroundColor:"rgba(0, 0, 0, 0.4)",tooltipColor:"#fff",tooltipFillColor:"#fff",axisLabelsColor:"#fff",axisLineColor:"rgba(200, 200, 200, 0.3)",indicatorLineColor:"#FFFFFF",bgColor:"#191a1f",textColor:"#e0e0e0"},rudexDarkTheme:{bidColor:"#50D2C2",bidFillColor:"rgba(80, 210, 194, 0.5)",askColor:"#E3745B",askFillColor:"rgba(227, 116, 91, 0.5)",callColor:"#BBBF2B",settleColor:"rgba(125, 134, 214, 1)",settleFillColor:"rgba(125, 134, 214, 0.5)",positiveColor:"#6BA583",negativeColor:"#DB0000",strokeColor:"#FFFF00",primaryText:"#e0e0e0",volumeColor:"#848484",tooltipBackgroundColor:"rgba(0, 0, 0, 0.4)",tooltipColor:"#fff",tooltipFillColor:"#fff",axisLabelsColor:"#fff",axisLineColor:"#AAAAAA",indicatorLineColor:"#FFFFFF",bgColor:"#191a1f",textColor:"#e0e0e0"},darkTheme:{bidColor:"#6BA583",bidFillColor:"rgba(80, 210, 194, 0.5)",askColor:"#E3745B",askFillColor:"rgba(227, 116, 91, 0.5)",callColor:"#BBBF2B",settleColor:"rgba(125, 134, 214, 1)",settleFillColor:"rgba(125, 134, 214, 0.5)",positiveColor:"#258A14",negativeColor:"#DB0000",strokeColor:"#FFFF00",primaryText:"#e0e0e0",volumeColor:"#848484",tooltipBackgroundColor:"rgba(0, 0, 0, 0.4)",tooltipColor:"#fff",tooltipFillColor:"#fff",axisLabelsColor:"#fff",axisLineColor:"rgba(200, 200, 200, 0.3)",indicatorLineColor:"#FFFFFF",bgColor:"#2a2a2a",textColor:"#ffffff"},lightTheme:{bidColor:"#258A14",bidFillColor:"rgba(80, 210, 194, 0.5)",askColor:"#EA340B",askFillColor:"rgba(227, 116, 91, 0.5)",callColor:"#BBBF2B",settleColor:"rgba(125, 134, 214, 1)",settleFillColor:"rgba(125, 134, 214, 0.5)",positiveColor:"#528c0a",negativeColor:"rgba(225, 66, 74, 1)",strokeColor:"#000000",primaryText:"#242424",volumeColor:"#848484",tooltipBackgroundColor:"rgba(255,255,255, 0.9)",tooltipColor:"#000",tooltipFillColor:"#000",axisLabelsColor:"#000",axisLineColor:"rgba(200, 200, 200, 0.3)",indicatorLineColor:"#848484",bgColor:"#fff",textColor:"#3d3d3d"}}},1921:function(e,t,a){!function(e){"use strict";function t(e,a){var n=r({},e);for(var o in a)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==a[o]&&(n[o]=a[o]):n[o]=t(e[o],a[o]);return n}function a(){return"1.12 (internal id 630b704a @ 2018-06-06 02:16:11.305509)"}var r=Object.assign||function(e){for(var t,a=arguments,r=1,n=arguments.length;r<n;r++)for(var o in t=a[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},o={width:800,height:500,symbol:"AA",interval:"D",timezone:"UTC",container_id:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"W"},{text:"1y",resolution:"W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[]}},s=function(){function e(e){if(this._id="tradingview_"+(1048576*(1+Math.random())|0).toString(16).substring(1),this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");if(this._options=t(o,e),e.preset){var a=n[e.preset];a?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(a.disabled_features):this._options.disabled_features=a.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(a.enabled_features):this._options.enabled_features=a.enabled_features):console.warn("Unknown preset: `"+e.preset+"`")}this._create()}return e.prototype.onChartReady=function(e){this._ready?e.call(this):this._readyHandlers.push(e)},e.prototype.onGrayedObjectClicked=function(e){this._innerAPI().onGrayedObjectClicked(e)},e.prototype.onShortcut=function(e,t){this._innerWindow().createShortcutAction(e,t)},e.prototype.subscribe=function(e,t){this._innerAPI().subscribe(e,t)},e.prototype.unsubscribe=function(e,t){this._innerAPI().unsubscribe(e,t)},e.prototype.chart=function(e){return this._innerAPI().chart(e)},e.prototype.setLanguage=function(e){this.remove(),this._options.locale=e,this._create()},e.prototype.setSymbol=function(e,t,a){this._innerAPI().changeSymbol(e,t+"",a)},e.prototype.remove=function(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id];var e=this._getIFrameElement();e.contentWindow.destroyChart(),e.parentNode&&e.parentNode.removeChild(e)},e.prototype.closePopupsAndDialogs=function(){this._innerAPI().closePopupsAndDialogs()},e.prototype.selectLineTool=function(e){this._innerAPI().selectLineTool(e)},e.prototype.selectedLineTool=function(){return this._innerAPI().selectedLineTool()},e.prototype.save=function(e){this._innerAPI().saveChart(e)},e.prototype.load=function(e,t){this._innerAPI().loadChart({json:e,extendedData:t})},e.prototype.getSavedCharts=function(e){this._innerAPI().getSavedCharts(e)},e.prototype.loadChartFromServer=function(e){this._innerAPI().loadChartFromServer(e)},e.prototype.saveChartToServer=function(e,t,a,r){this._innerAPI().saveChartToServer(e,t,a,r)},e.prototype.removeChartFromServer=function(e,t){this._innerAPI().removeChartFromServer(e,t)},e.prototype.onContextMenu=function(e){this._innerAPI().onContextMenu(e)},e.prototype.createButton=function(e){return this._innerWindow().createButton(e)},e.prototype.showNoticeDialog=function(e){this._innerAPI().showNoticeDialog(e)},e.prototype.showConfirmDialog=function(e){this._innerAPI().showConfirmDialog(e)},e.prototype.showLoadChartDialog=function(){this._innerAPI().showLoadChartDialog()},e.prototype.showSaveAsChartDialog=function(){this._innerAPI().showSaveAsChartDialog()},e.prototype.symbolInterval=function(){return this._innerAPI().getSymbolInterval()},e.prototype.mainSeriesPriceFormatter=function(){return this._innerAPI().mainSeriesPriceFormatter()},e.prototype.getIntervals=function(){return this._innerAPI().getIntervals()},e.prototype.getStudiesList=function(){return this._innerAPI().getStudiesList()},e.prototype.addCustomCSSFile=function(e){this._innerWindow().addCustomCSSFile(e)},e.prototype.applyOverrides=function(e){this._options=t(this._options,{overrides:e}),this._innerWindow().applyOverrides(e)},e.prototype.applyStudiesOverrides=function(e){this._innerWindow().applyStudiesOverrides(e)},e.prototype.watchList=function(){return this._innerAPI().watchlist()},e.prototype.activeChart=function(){return this._innerAPI().activeChart()},e.prototype.chartsCount=function(){return this._innerAPI().chartsCount()},e.prototype.layout=function(){return this._innerAPI().layout()},e.prototype.setLayout=function(e){this._innerAPI().setLayout(e)},e.prototype._getIFrameElement=function(){var e=document.getElementById(this._id);if(null===e)throw new Error("There is no such iframe");return e},e.prototype._innerAPI=function(){return this._getIFrameElement().contentWindow.tradingViewApi},e.prototype._innerWindow=function(){return this._getIFrameElement().contentWindow},e.prototype._autoResizeChart=function(){this._options.fullscreen&&(this._getIFrameElement().style.height=window.innerHeight+"px")},e.prototype._create=function(){var e=this,t=this._render(),a=document.getElementById(this._options.container_id);if(null===a)throw new Error("There is no such element - #"+this._options.container_id);a.innerHTML=t;var r=this._getIFrameElement();(this._options.autosize||this._options.fullscreen)&&(r.style.width="100%",this._options.fullscreen||(r.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize();var n=function(){r.removeEventListener("load",n,!1),r.contentWindow.widgetReady(function(){e._ready=!0;for(var t=0,a=e._readyHandlers;t<a.length;t++)a[t].call(e);r.contentWindow.initializationFinished()})};r.addEventListener("load",n,!1)},e.prototype._render=function(){var e=window;e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.customFormatters,brokerFactory:this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter},this._options.saved_data&&(e[this._id].chartContent={json:this._options.saved_data});var t=(this._options.library_path||"")+"static/tv-chart.630b704a2b9d0eaf1593.html#localserver=1&symbol="+encodeURIComponent(this._options.symbol)+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+this._options.toolbar_bg.replace("#",""):"")+(this._options.studies_access?"&studiesAccess="+encodeURIComponent(JSON.stringify(this._options.studies_access)):"")+"&widgetbar="+encodeURIComponent(JSON.stringify(this._options.widgetbar))+(this._options.drawings_access?"&drawingsAccess="+encodeURIComponent(JSON.stringify(this._options.drawings_access)):"")+"&timeFrames="+encodeURIComponent(JSON.stringify(this._options.time_frames))+"&locale="+encodeURIComponent(this._options.locale)+"&uid="+encodeURIComponent(this._id)+"&clientId="+encodeURIComponent(String(this._options.client_id))+"&userId="+encodeURIComponent(String(this._options.user_id))+(this._options.charts_storage_url?"&chartsStorageUrl="+encodeURIComponent(this._options.charts_storage_url):"")+(this._options.charts_storage_api_version?"&chartsStorageVer="+encodeURIComponent(this._options.charts_storage_api_version):"")+(this._options.indicators_file_name?"&indicatorsFile="+encodeURIComponent(this._options.indicators_file_name):"")+(this._options.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+this._options.debug+(this._options.snapshot_url?"&snapshotUrl="+encodeURIComponent(this._options.snapshot_url):"")+(this._options.timezone?"&timezone="+encodeURIComponent(this._options.timezone):"")+(this._options.study_count_limit?"&studyCountLimit="+encodeURIComponent(String(this._options.study_count_limit)):"")+(this._options.symbol_search_request_delay?"&ssreqdelay="+encodeURIComponent(String(this._options.symbol_search_request_delay)):"");return'<iframe id="'+this._id+'" name="'+this._id+'" src="'+t+'"'+(this._options.autosize||this._options.fullscreen?"":' width="'+this._options.width+'" height="'+this._options.height+'"')+' frameborder="0" allowTransparency="true" scrolling="no" allowfullscreen style="display:block;"></iframe>'},e}();window.TradingView=window.TradingView||{},window.TradingView.version=a,e.version=a,e.onready=function(e){window.addEventListener("DOMContentLoaded",e,!1)},e.widget=s,Object.defineProperty(e,"__esModule",{value:!0})}(t)},2065:function(e,t,a){"use strict";a.r(t);var r=a(0),n=a.n(r),o=a(251),s=a(26),i=a(22),l=a(177),c=a(512),u=a(111),p=a(129),d=a(305),m=a(1),h=a.n(m),f=a(85),g=a(1815),b=a(1760),_=a.n(b),y=a(16),v=a(3),k=a.n(v),E=a(23),w=a(5),C=a.n(w),A=a(1777),S=a(1756),x=a(140),N=a(1889),O=a(21),P=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(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 j(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 q=a(14),I=function(e){function t(){return T(this,t),F(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return j(t,n.a.Component),P(t,[{key:"shouldComponentUpdate",value:function(e){return e.order.market_base===this.props.order.market_base&&(e.order.ne(this.props.order)||e.index!==this.props.index||e.currentAccount!==this.props.currentAccount)}},{key:"render",value:function(){var e=this.props,t=e.order,a=e.quote,r=e.base,o=e.final,s=t.isBid(),i=t.isCall()?"orderHistoryCall":s?"orderHistoryBid":"orderHistoryAsk",l=n.a.createElement(A.a,{price:t.getPrice(),quote:a,base:r});return n.a.createElement("div",{onClick:this.props.onClick,className:C()("sticky-table-row order-row",{"final-row":o},{"my-order":t.isMine(this.props.currentAccount)})},n.a.createElement("div",{className:"cell left"},y.a.format_number(t[s?"amountForSale":"amountToReceive"]().getAmount({real:!0}),r.get("precision"))),n.a.createElement("div",{className:"cell"},y.a.format_number(t[s?"amountToReceive":"amountForSale"]().getAmount({real:!0}),a.get("precision"))),n.a.createElement("div",{className:"cell "+i+" right"},l))}}]),t}(),R=function(e){return e.getBoundingClientRect().height},B=function(e){function t(){return T(this,t),F(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return j(t,n.a.Component),P(t,[{key:"shouldComponentUpdate",value:function(e){return e.order.ne(this.props.order)||e.position!==this.props.position||e.index!==this.props.index||e.currentAccount!==this.props.currentAccount}},{key:"render",value:function(){var e=this.props,t=e.order,a=e.quote,r=e.base,o=e.position,s=t.isBid(),i=t.isCall()?"orderHistoryCall":s?"orderHistoryBid":"orderHistoryAsk",l=n.a.createElement(A.a,{price:t.getPrice(),quote:a,base:r}),c=s?y.a.format_number(t.amountToReceive().getAmount({real:!0}),a.get("precision")):y.a.format_number(t.amountForSale().getAmount({real:!0}),a.get("precision")),u=s?y.a.format_number(t.amountForSale().getAmount({real:!0}),r.get("precision")):y.a.format_number(t.amountToReceive().getAmount({real:!0}),r.get("precision")),p=s?y.a.format_number(t.totalForSale().getAmount({real:!0}),r.get("precision")):y.a.format_number(t.totalToReceive().getAmount({real:!0}),r.get("precision"));return n.a.createElement("tr",{onClick:this.props.onClick,className:t.isMine(this.props.currentAccount)?"my-order":""},"left"===o?n.a.createElement("td",null,p):n.a.createElement("td",{style:{width:"25%"},className:i},l),n.a.createElement("td",null,"left"===o?u:c),n.a.createElement("td",null,"left"===o?c:u),"right"===o?n.a.createElement("td",null,p):n.a.createElement("td",{style:{width:"25%"},className:i},l))}}]),t}(),L=function(e){function t(){return T(this,t),F(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return j(t,n.a.Component),P(t,[{key:"shouldComponentUpdate",value:function(e){return e.order.market_base===this.props.order.market_base&&(e.order.ne(this.props.order)||e.index!==this.props.index||e.currentAccount!==this.props.currentAccount)}},{key:"render",value:function(){var e=this.props,t=e.order,a=e.quote,r=e.base,o=e.final,s=t.isBid(),i=s?"orderHistoryBid":"orderHistoryAsk",l=n.a.createElement(A.a,{price:t.getPrice(),quote:a,base:r});return n.a.createElement("div",{onClick:this.props.onClick,className:C()("sticky-table-row order-row",{"final-row":o})},n.a.createElement("div",{className:"cell left"},y.a.format_number(t[s?"amountForSale":"amountToReceive"]().getAmount({real:!0}),r.get("precision"))),n.a.createElement("div",{className:"cell"},y.a.format_number(t[s?"amountToReceive":"amountForSale"]().getAmount({real:!0}),a.get("precision"))),n.a.createElement("div",{className:"cell "+i+" right"},l))}}]),t}(),D=function(e){function t(){return T(this,t),F(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return j(t,n.a.Component),P(t,[{key:"shouldComponentUpdate",value:function(e){return e.order.ne(this.props.order)||e.position!==this.props.position||e.index!==this.props.index||e.currentAccount!==this.props.currentAccount}},{key:"render",value:function(){var e=this.props,t=e.order,a=e.quote,r=e.base,o=e.position,s=t.isBid(),i=s?"orderHistoryBid":"orderHistoryAsk",l=n.a.createElement(A.a,{price:t.getPrice(),quote:a,base:r}),c=s?y.a.format_number(t.amountToReceive().getAmount({real:!0}),a.get("precision")):y.a.format_number(t.amountForSale().getAmount({real:!0}),a.get("precision")),u=s?y.a.format_number(t.amountForSale().getAmount({real:!0}),r.get("precision")):y.a.format_number(t.amountToReceive().getAmount({real:!0}),r.get("precision")),p=s?y.a.format_number(t.totalForSale().getAmount({real:!0}),r.get("precision")):y.a.format_number(t.totalToReceive().getAmount({real:!0}),r.get("precision"));return n.a.createElement("tr",{onClick:this.props.onClick},"left"===o?n.a.createElement("td",null,p):n.a.createElement("td",{style:{width:"25%"},className:i},l),n.a.createElement("td",null,"left"===o?u:c),n.a.createElement("td",null,"left"===o?c:u),"right"===o?n.a.createElement("td",null,p):n.a.createElement("td",{style:{width:"25%"},className:i},l))}}]),t}(),M=function(e){function t(){T(this,t);var e=F(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state={groupLimit:""},e}return j(t,n.a.Component),P(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({groupLimit:this.props.currentGroupOrderLimit})}},{key:"render",value:function(){var e=0===this.props.trackedGroupsConfig.length,t=this.props.trackedGroupsConfig.map(function(e){return n.a.createElement("option",{value:e,key:e},e/100+"%")});return n.a.createElement("select",{dir:"rtl",value:this.state.groupLimit,onChange:this.props.handleGroupOrderLimitChange,"data-tip":e?q.translate("tooltip.no_groups_available"):null,style:e?{cursor:"not-allowed"}:null},n.a.createElement(k.a,{content:"exchange.group_order_limit",component:"option",value:"0"}),t)}}]),t}(),z=function(e){function t(e){T(this,t);var a=F(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.queryStickyTable=function(e){return a.refs.vertical_sticky_table.table.querySelector(e)},a.verticalScrollBar=function(){return a.queryStickyTable("#y-scrollbar")},a.toggleSpreadValue=function(){a.setState({displaySpreadAsPercentage:!a.state.displaySpreadAsPercentage})},a.toggleAutoScroll=function(){var e={autoScroll:!a.state.autoScroll};e.autoScroll?a.setState(e,a.centerVerticalScrollBar):a.setState(e)},a.state={flip:e.flipOrderBook,showAllBids:!1,showAllAsks:!1,rowCount:20,autoScroll:!0},a}return j(t,n.a.Component),P(t,[{key:"shouldComponentUpdate",value:function(e){return!!e.marketReady}},{key:"componentWillReceiveProps",value:function(e){var t=this;e.base.get("id")===this.props.base.get("id")&&e.quote.get("id")===this.props.quote.get("id")||(this.refs.askTransition&&(this.refs.askTransition.resetAnimation(),this.refs.hor_asks&&(this.refs.hor_asks.scrollTop=0),this.refs.hor_bids&&(this.refs.hor_bids.scrollTop=0)),this.refs.bidTransition&&this.refs.bidTransition.resetAnimation(),this.refs.vert_bids&&(this.refs.vert_bids.scrollTop=0),this.props.horizontal||this.setState({autoScroll:!0})),y.a.are_equal_shallow(e.combinedAsks,this.props.combinedAsks)&&y.a.are_equal_shallow(e.combinedBids,this.props.combinedBids)||this.setState({},function(){t.psUpdate()})}},{key:"componentDidMount",value:function(){if(this.props.horizontal){var e=this.refs.hor_bids;_.a.initialize(e);var t=this.refs.hor_asks;_.a.initialize(t)}else _.a.initialize(this.verticalScrollBar()),this.centerVerticalScrollBar()}},{key:"componentWillUpdate",value:function(){if(!this.props.horizontal){var e=this.queryStickyTable("#sticky-table-y-wrapper"),t=this.refs.center_text.offsetTop-R(e)/2+21;this.offset=e.scrollTop-t}}},{key:"centerVerticalScrollBar",value:function(){if(!this.props.horizontal){var e=this.queryStickyTable("#sticky-table-y-wrapper"),t=this.refs.center_text,a=!this.state.autoScroll&&this.offset?this.offset:0,r=t.offsetTop-R(e)/2+21+a;this.setState({ownScroll:!0},function(){return e.scrollTop=r})}}},{key:"psUpdate",value:function(){if(this.props.horizontal){var e=this.refs.hor_bids;_.a.update(e);var t=this.refs.hor_asks;_.a.update(t)}else _.a.update(this.verticalScrollBar()),this.centerVerticalScrollBar()}},{key:"_flipBuySell",value:function(){E.a.changeViewSetting({flipOrderBook:!this.state.flip}),this.setState({flip:!this.state.flip})}},{key:"_onToggleShowAll",value:function(e){"asks"===e?(this.setState({showAllAsks:!this.state.showAllAsks}),this.state.showAllAsks&&(this.refs.hor_asks.scrollTop=0)):(this.setState({showAllBids:!this.state.showAllBids}),this.state.showAllBids&&(this.refs.hor_bids.scrollTop=0))}},{key:"render",value:function(){var e=this,t=this.props,a=t.combinedBids,r=t.combinedAsks,o=t.highestBid,s=t.lowestAsk,i=t.quote,l=t.base,c=t.totalAsks,u=t.totalBids,p=t.quoteSymbol,d=t.baseSymbol,m=t.horizontal,h=t.trackedGroupsConfig,f=t.currentGroupOrderLimit,g=t.handleGroupOrderLimitChange,b=t.groupedBids,_=t.groupedAsks,v=this.state,E=v.showAllAsks,w=v.showAllBids,P=v.rowCount,T=v.displaySpreadAsPercentage,F=!s.sell_price&&!o.sell_price,j=!(!s.sell_price||!o.sell_price)&&(T?(100*(s._real_price/o._real_price-1)).toFixed(2)+"%":n.a.createElement(A.a,{price:s._real_price-o._real_price,base:l,quote:i})),R=null,z=null;if(l&&i)if(0!==this.props.currentGroupOrderLimit){R=b.map(function(t,a){return m?n.a.createElement(D,{index:a,key:t.getPrice()+(t.isBid()?"_bid":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,position:e.state.flip?"right":"left",currentAccount:e.props.currentAccount}):n.a.createElement(L,{index:a,key:t.getPrice()+(t.isBid()?"_bid":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,final:0===a,currentAccount:e.props.currentAccount})});var U=_;m||U.sort(function(e,t){return t.getPrice()-e.getPrice()}),z=U.map(function(t,a){return m?n.a.createElement(D,{index:a,key:t.getPrice()+(t.isBid()?"_bid":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,type:t.type,position:e.state.flip?"left":"right",currentAccount:e.props.currentAccount}):n.a.createElement(L,{index:a,key:t.getPrice()+(t.isBid()?"_bid":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,type:t.type,final:0===a,currentAccount:e.props.currentAccount})})}else{R=a.map(function(t,a){return m?n.a.createElement(B,{index:a,key:t.getPrice()+(t.isCall()?"_call":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,position:e.state.flip?"right":"left",currentAccount:e.props.currentAccount}):n.a.createElement(I,{index:a,key:t.getPrice()+(t.isCall()?"_call":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,final:0===a,currentAccount:e.props.currentAccount})});var H=r;H.sort(function(e,t){return m?e.getPrice()-t.getPrice():t.getPrice()-e.getPrice()}),z=H.map(function(t,a){return m?n.a.createElement(B,{index:a,key:t.getPrice()+(t.isCall()?"_call":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,type:t.type,position:e.state.flip?"left":"right",currentAccount:e.props.currentAccount}):n.a.createElement(I,{index:a,key:t.getPrice()+(t.isCall()?"_call":""),order:t,onClick:e.props.onClick.bind(e,t),base:l,quote:i,type:t.type,final:0===a,currentAccount:e.props.currentAccount})})}if(this.props.horizontal){var W=R.length,V=z.length;w||R.splice(P,R.length),E||z.splice(P,z.length);var G=n.a.createElement("thead",null,n.a.createElement("tr",{key:"top-header",className:"top-header"},n.a.createElement("th",null,n.a.createElement(k.a,{className:"header-sub-title",content:"exchange.total"}),n.a.createElement("span",{className:"header-sub-title"}," ","(",n.a.createElement(x.a,{dataPlace:"top",name:d}),")")),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{dataPlace:"top",name:d}))),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{dataPlace:"top",name:p}))),n.a.createElement("th",null,n.a.createElement(k.a,{className:(this.state.flip?"ask-total":"bid-total")+" header-sub-title",content:"exchange.price"})))),J=n.a.createElement("thead",null,n.a.createElement("tr",{key:"top-header",className:"top-header"},n.a.createElement("th",null,n.a.createElement(k.a,{className:(this.state.flip?"bid-total":"ask-total")+" header-sub-title",content:"exchange.price"})),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{dataPlace:"top",name:p}))),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{dataPlace:"top",name:d}))),n.a.createElement("th",null,n.a.createElement(k.a,{className:"header-sub-title",content:"exchange.total"}),n.a.createElement("span",{className:"header-sub-title"}," ","(",n.a.createElement(x.a,{dataPlace:"top",name:d}),")"))));return n.a.createElement("div",{className:C()(this.props.wrapperClass,"grid-block orderbook no-padding small-vertical medium-horizontal align-spaced no-overflow small-12 xlarge-8")},n.a.createElement("div",{className:C()("small-12 medium-6 middle-content",this.state.flip?"order-1":"order-2")},n.a.createElement("div",{className:"exchange-bordered"},n.a.createElement("div",{className:"exchange-content-header ask","data-intro":q.translate("walkthrough.sell_orders")},n.a.createElement(k.a,{content:"exchange.asks"}),this.state.flip?n.a.createElement("div",{style:{display:"inline-block"}},n.a.createElement("span",{onClick:this._flipBuySell.bind(this),style:{cursor:"pointer",fontSize:"1rem",marginLeft:"4px",position:"relative",top:"-2px"},className:"flip-arrow"}," ","⇆"),n.a.createElement("span",{className:"order-book-button-v",onClick:this.props.moveOrderBook},n.a.createElement(O.a,{name:"thumb-tack",title:"icons.thumb_tack",className:"icon-14px"}))):null,this.state.flip?n.a.createElement("div",{className:"float-right header-sub-title grouped_order"},h?n.a.createElement(M,{trackedGroupsConfig:h,handleGroupOrderLimitChange:g,currentGroupOrderLimit:f}):null):null,n.a.createElement("div",{style:{lineHeight:"16px"},className:"float-right header-sub-title"},n.a.createElement(k.a,{content:"exchange.total"}),n.a.createElement("span",null,": "),y.a.format_number(c,i.get("precision")),n.a.createElement("span",null," ","(",n.a.createElement(x.a,{name:p}),")"))),n.a.createElement("div",{style:{paddingRight:"0.6rem"}},n.a.createElement("table",{className:"table order-table table-hover fixed-table text-right"},this.state.flip?G:J)),n.a.createElement("div",{className:"grid-block",ref:"hor_asks",style:{paddingRight:"0.6rem",overflow:"hidden",maxHeight:210}},n.a.createElement("table",{style:{paddingBottom:5},className:"table order-table table-hover fixed-table text-right no-overflow"},n.a.createElement(S.a,{ref:"askTransition",className:"orderbook clickable",component:"tbody",transitionName:"newrow"},z))),V>P?n.a.createElement("div",{className:"orderbook-showall"},n.a.createElement("a",{onClick:this._onToggleShowAll.bind(this,"asks")},n.a.createElement(k.a,{content:E?"exchange.hide":"exchange.show_asks"}),E?null:n.a.createElement("span",null," (",V,")"))):null)),n.a.createElement("div",{className:C()("small-12 medium-6 middle-content",this.state.flip?"order-2":"order-1")},n.a.createElement("div",{className:"exchange-bordered"},n.a.createElement("div",{className:"exchange-content-header bid","data-intro":q.translate("walkthrough.buy_orders")},n.a.createElement(k.a,{content:"exchange.bids"}),this.state.flip?null:n.a.createElement("div",{style:{display:"inline-block"}},n.a.createElement("span",{onClick:this._flipBuySell.bind(this),style:{cursor:"pointer",fontSize:"1rem",marginLeft:"4px",position:"relative",top:"-2px"},className:"flip-arrow"}," ","⇆"),n.a.createElement("span",{className:"order-book-button-v",onClick:this.props.moveOrderBook},n.a.createElement(O.a,{name:"thumb-tack",title:"icons.thumb_tack",className:"icon-14px"}))),this.state.flip?null:n.a.createElement("div",{className:"float-right header-sub-title grouped_order"},h?n.a.createElement(M,{trackedGroupsConfig:h,handleGroupOrderLimitChange:g,currentGroupOrderLimit:f}):null),n.a.createElement("div",{style:{lineHeight:"16px"},className:"float-right header-sub-title"},n.a.createElement(k.a,{content:"exchange.total"}),n.a.createElement("span",null,": "),y.a.format_number(u,l.get("precision")),n.a.createElement("span",null," ","(",n.a.createElement(x.a,{name:d}),")"))),n.a.createElement("div",{style:{paddingRight:"0.6rem"}},n.a.createElement("table",{className:"table order-table table-hover fixed-table text-right"},this.state.flip?J:G)),n.a.createElement("div",{className:"grid-block",ref:"hor_bids",style:{paddingRight:"0.6rem",overflow:"hidden",maxHeight:210}},n.a.createElement("table",{style:{paddingBottom:5},className:"table order-table table-hover fixed-table text-right no-overflow"},n.a.createElement(S.a,{ref:"bidTransition",className:"orderbook clickable",component:"tbody",transitionName:"newrow"},R))),W>P?n.a.createElement("div",{className:"orderbook-showall"},n.a.createElement("a",{onClick:this._onToggleShowAll.bind(this,"bids")},n.a.createElement(k.a,{content:w?"exchange.hide":"exchange.show_bids"}),w?null:n.a.createElement("span",null," (",W,")"))):null)))}return n.a.createElement("div",{className:"left-order-book no-padding no-overflow"},n.a.createElement("div",{className:"order-table-container"},n.a.createElement(N.StickyTable,{stickyColumnCount:0,className:"order-table table",ref:"vertical_sticky_table"},n.a.createElement("div",{className:"sticky-table-row top-header"},n.a.createElement("div",{className:"cell header-cell left"},n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{name:d}))),n.a.createElement("div",{className:"cell header-cell"},n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{name:p}))),n.a.createElement("div",{className:"cell header-cell right"},n.a.createElement(k.a,{className:"header-sub-title",content:"exchange.price"}))),n.a.createElement(S.a,{ref:"askTransition",className:"transition-container clickable",component:"div",transitionName:"newrow"},z.length>0?z:F||n.a.createElement("div",{className:"sticky-table-row"},n.a.createElement("td",{className:"cell no-orders padtop",colSpan:"3"},n.a.createElement(k.a,{content:"exchange.no_asks"})))),n.a.createElement("div",{className:"sticky-table-row",ref:"center_text"},F?n.a.createElement("td",{colSpan:3,className:"no-orders padtop"},n.a.createElement(k.a,{content:"exchange.no_orders"})):n.a.createElement("td",{className:"cell center-cell",colSpan:"3"},n.a.createElement("div",{className:"orderbook-latest-price"},n.a.createElement("div",{className:"text-center spread"},!!j&&n.a.createElement("span",{className:"clickable left",onClick:this.toggleSpreadValue},n.a.createElement(k.a,{content:"exchange.spread"})," ",n.a.createElement("span",{className:"spread-value"},j)),n.a.createElement(O.a,{className:"lock-unlock clickable",onClick:this.toggleAutoScroll,name:this.state.autoScroll?"locked":"unlocked",title:this.state.autoScroll?"icons.locked.enable_auto_scroll":"icons.unlocked.disable_auto_scroll"}),!!this.props.latest&&n.a.createElement("span",{className:"right"},n.a.createElement(k.a,{content:"exchange.latest"})," ",n.a.createElement("span",{className:this.props.changeClass},n.a.createElement(A.a,{price:this.props.latest,base:this.props.base,quote:this.props.quote}))))))),n.a.createElement(S.a,{ref:"bidTransition",className:"transition-container clickable",component:"div",transitionName:"newrow"},R.length>0?R:F||n.a.createElement("div",{className:"sticky-table-row"},n.a.createElement("td",{className:"cell no-orders",colSpan:"3"},n.a.createElement(k.a,{content:"exchange.no_bids"})))))),n.a.createElement("div",{className:"v-align no-padding align-center grid-block footer shrink bottom-header"},n.a.createElement("div",{className:"v-align grid-block align-center",style:{height:"2rem",overflow:"hidden"}},n.a.createElement(O.a,{name:"thumb-untack",title:"icons.thumb_untack",className:"icon-14px order-book-button-h",style:{top:"-0.5rem"},onClick:this.props.moveOrderBook})),n.a.createElement("div",{className:"v-align grid-block align-center grouped_order"},h?n.a.createElement(M,{trackedGroupsConfig:h,handleGroupOrderLimitChange:g,currentGroupOrderLimit:f}):null)))}}]),t}();z.defaultProps={bids:[],asks:[],orders:{}},z.propTypes={bids:h.a.array.isRequired,asks:h.a.array.isRequired,orders:h.a.object.isRequired};var U=z,H=a(11),W=a.n(H),V=a(59),G=a(35),J=a(10),Q=a(14),K=a.n(Q),Y=a(135),X=a(239),Z=a(105),$=a.n(Z),ee=a(1781),te=a.n(ee),ae=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var re=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),ae(t,[{key:"componentWillMount",value:function(){this.props.blockHeader||X.a.getHeader.defer(this.props.block_number)}},{key:"shouldComponentUpdate",value:function(e){return e.blockHeader&&!this.props.blockHeader&&setTimeout($.a.rebuild,1e3),e.blockHeader!==this.props.blockHeader}},{key:"render",value:function(){var e=this.props,t=e.blockHeader,a=e.tooltip,r=e.component,o=e.format;return t?n.a.createElement(r,{className:a?"tooltip":"","data-tip":a?t.timestamp:""},n.a.createElement("span",null,K.a.localize(t.timestamp,{type:"date",format:o}))):n.a.createElement(r)}}]),t}();re.defaultProps={format:-1!==te()().toLowerCase().indexOf("en-us")?"market_history_us":"market_history",tooltip:!1,component:"span"};var ne=re=Object(G.a)(re,{listenTo:function(){return[Y.a]},getProps:function(e){return{blockHeader:Y.a.getState().blockHeaders.get(e.block_number)}}}),oe=a(28),se=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function ie(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var le=J.ChainTypes.operations,ce=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);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));return a.state={activeTab:e.viewSettings.get("historyTab","history")},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),se(t,[{key:"shouldComponentUpdate",value:function(e,t){return!!e.marketReady&&(!W.a.is(e.history,this.props.history)||e.baseSymbol!==this.props.baseSymbol||e.quoteSymbol!==this.props.quoteSymbol||e.className!==this.props.className||t.activeTab!==this.state.activeTab||e.currentAccount!==this.props.currentAccount)}},{key:"componentDidMount",value:function(){var e=this.refs.history;_.a.initialize(e)}},{key:"componentDidUpdate",value:function(){var e=this.refs.history;_.a.update(e)}},{key:"_changeTab",value:function(e){E.a.changeViewSetting({historyTab:e}),this.setState({activeTab:e});var t=this.refs.history;t.scrollTop=0,_.a.update(t),setTimeout($.a.rebuild,1e3)}},{key:"render",value:function(){var e,t=this,a=this.props,r=a.history,o=a.myHistory,s=a.base,i=a.quote,l=a.baseSymbol,c=a.quoteSymbol,u=a.isNullAccount,p=this.state.activeTab,d=null;u&&(p="history");var m=(ie(e={},i.get("id"),{precision:i.get("precision")}),ie(e,s.get("id"),{precision:s.get("precision")}),e);"my_history"===p&&o&&o.size?d=o.filter(function(e){return e.getIn(["op",0])===le.fill_order}).filter(function(e){var t=i.get("id"),a=s.get("id"),r=e.getIn(["op",1,"pays","asset_id"]),n=e.getIn(["op",1,"receives","asset_id"]);return(t===r||t===n)&&(a===r||a===n)}).sort(function(e,t){return t.get("block_num")-e.get("block_num")}).map(function(e){var a=new oe.d(e.toJS(),m,i.get("id"));return n.a.createElement("tr",{key:a.id},n.a.createElement("td",{className:a.className},n.a.createElement(A.a,{price:a.getPrice(),base:t.props.base,quote:t.props.quote})),n.a.createElement("td",null,a.amountToReceive()),n.a.createElement("td",null,a.amountToPay()),n.a.createElement(ne,{component:"td",block_number:a.block,tooltip:!0}))}).toArray():r&&r.size&&(d=this.props.history.take(100).map(function(e){return n.a.createElement("tr",{key:"history_"+e.id},n.a.createElement("td",{className:e.className},n.a.createElement(A.a,{price:e.getPrice(),base:t.props.base,quote:t.props.quote})),n.a.createElement("td",null,e.amountToReceive()),n.a.createElement("td",null,e.amountToPay()),n.a.createElement("td",{className:"tooltip","data-tip":e.time},K.a.localize(e.time,{type:"date",format:-1!==te()().toLowerCase().indexOf("en-us")?"market_history_us":"market_history"})))}).toArray());var h="mymarkets-header clickable",f=C()(h,{inactive:"my_history"===p}),g=C()(h,{inactive:"history"===p});return n.a.createElement("div",{className:this.props.className},n.a.createElement("div",{className:"exchange-bordered small-12",style:{height:"auto"}},n.a.createElement("div",{style:this.props.headerStyle,className:"grid-block shrink left-orderbook-header bottom-header"},n.a.createElement("div",{className:C()(g,{disabled:u}),onClick:this._changeTab.bind(this,"my_history")},n.a.createElement(k.a,{content:"exchange.my_history"})),n.a.createElement("div",{className:f,onClick:this._changeTab.bind(this,"history")},n.a.createElement(k.a,{content:"exchange.history"}))),n.a.createElement("div",{className:"grid-block shrink left-orderbook-header market-right-padding-only"},n.a.createElement("table",{className:"table order-table text-right fixed-table market-right-padding"},n.a.createElement("thead",null,n.a.createElement("tr",null,n.a.createElement("th",null,n.a.createElement(k.a,{className:"header-sub-title",content:"exchange.price"})),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{dataPlace:"top",name:c}))),n.a.createElement("th",null,n.a.createElement("span",{className:"header-sub-title"},n.a.createElement(x.a,{dataPlace:"top",name:l}))),n.a.createElement("th",null,n.a.createElement(k.a,{className:"header-sub-title",content:"explorer.block.date"})))))),n.a.createElement("div",{className:"table-container grid-block market-right-padding-only no-overflow",ref:"history",style:{maxHeight:210,overflow:"hidden"}},n.a.createElement("table",{className:"table order-table text-right fixed-table market-right-padding"},n.a.createElement(S.a,{component:"tbody",transitionName:"newrow"},d)))))}}]),t}();ce.defaultProps={history:[]},ce.propTypes={history:h.a.object.isRequired};var ue=Object(G.a)(ce,{listenTo:function(){return[i.a]},getProps:function(){return{viewSettings:i.a.getState().viewSettings}}}),pe=a(1862),de=a(36),me=a(39),he=a(48),fe=a(1799),ge=a(1800),be=a(337),_e=a(333),ye=a(1895),ve=a.n(ye),ke=a(30),Ee=a.n(ke),we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Ce=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var Ae=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),Ce(t,[{key:"shouldComponentUpdate",value:function(e){return e.amount!==this.props.amount||e.onBorrow!==this.props.onBorrow||e.total!==this.props.total||e.currentPrice!==this.props.currentPrice||e.price!==this.props.price||e.balance!==this.props.balance||e.account!==this.props.account||e.className!==this.props.className||!(!e.fee||!this.props.fee)&&e.fee.ne(this.props.fee)||e.isPredictionMarket!==this.props.isPredictionMarket||e.feeAsset!==this.props.feeAsset||e.isOpen!==this.props.isOpen||e.hasFeeBalance!==this.props.hasFeeBalance||e.expirationType!==this.props.expirationType||e.expirationCustomTime!==this.props.expirationCustomTime}},{key:"_addBalance",value:function(e){"bid"===this.props.type?this.props.totalChange({target:{value:e.getAmount({real:!0}).toString()}}):this.props.amountChange({target:{value:e.getAmount({real:!0}).toString()}})}},{key:"_setPrice",value:function(e){this.props.priceChange({target:{value:e.toString()}})}},{key:"_onDeposit",value:function(e){e.preventDefault(),this.refs.deposit_modal.show()}},{key:"_onBuy",value:function(e){e.preventDefault(),this.refs.bridge_modal.show()}},{key:"render",value:function(){var e=this,t=this.props,r=t.type,o=t.quote,s=t.base,l=t.amountChange,c=t.fee,u=t.isPredictionMarket,p=t.priceChange,d=t.onSubmit,m=t.balance,h=t.totalChange,f=t.balancePrecision,g=t.currentPrice,b=t.currentPriceObject,_=t.feeAsset,v=t.feeAssets,E=t.hasFeeBalance,w=t.backedCoin,S=void 0,N=void 0,P=void 0,T=this.props.isOpen?n.a.createElement("span",null,"▼"):n.a.createElement("span",null,"▲");this.props.amount&&(S=this.props.amount),this.props.price&&(N=this.props.price),this.props.total&&(P=this.props.total);var F=new oe.a({amount:m?m.get("balance"):0,precision:f,asset_id:this.props.balanceId}),j=new oe.a({amount:s.getIn(["options","max_market_fee"]),asset_id:s.get("asset_id"),precision:s.get("precision")}),q=new oe.a({amount:o.getIn(["options","max_market_fee"]),asset_id:o.get("asset_id"),precision:o.get("precision")}),I=s.getIn(["options","market_fee_percent"])/100+"%",R=o.getIn(["options","market_fee_percent"])/100+"%",B=S?Math.min(q.getAmount({real:!0}),S*o.getIn(["options","market_fee_percent"])/1e4).toFixed(q.precision):0,L=S?Math.min(j.getAmount({real:!0}),P*s.getIn(["options","market_fee_percent"])/1e4).toFixed(j.precision):0,D=_e.a.getFlagBooleans(s.getIn(["options","flags"]),s.has("bitasset_data_id")),M=_e.a.getFlagBooleans(o.getIn(["options","flags"]),o.has("bitasset_data_id")),z=y.a.replaceName(this.props.base),U=z.name,H=z.prefix,W=D.charge_market_fee||M.charge_market_fee,V=D.charge_market_fee?n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"explorer.asset.summary.market_fee"}),": ",I),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-input"},n.a.createElement("input",{disabled:!0,type:"text",id:"baseMarketFee",value:L,autoComplete:"off"})),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-box"},n.a.createElement(x.a,{noTip:!0,name:s.get("symbol")}),n.a.createElement("span",{"data-tip":K.a.translate("tooltip.market_fee",{percent:s.getIn(["options","market_fee_percent"])/100,asset:(H||"")+U}),className:"inline-block tooltip"}," ",n.a.createElement(O.a,{style:{position:"relative",top:3},name:"question-circle",title:"icons.question_circle"})))):W?n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{style:{visibility:"hidden"},className:"grid-block small-3 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"explorer.asset.summary.market_fee"}),":")):null,G=y.a.replaceName(this.props.quote),J=G.name,Q=G.prefix,Y=M.charge_market_fee?n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"explorer.asset.summary.market_fee"}),": ",R),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-input"},n.a.createElement("input",{disabled:!0,type:"text",id:"quoteMarketFee",value:B,autoComplete:"off"})),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-box"},n.a.createElement(x.a,{noTip:!0,name:o.get("symbol")}),n.a.createElement("span",{"data-tip":K.a.translate("tooltip.market_fee",{percent:o.getIn(["options","market_fee_percent"])/100,asset:(Q||"")+J}),className:"inline-block tooltip"}," ",n.a.createElement(O.a,{style:{position:"relative",top:3},name:"question-circle",title:"icons.question-circle"})))):W?n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{style:{visibility:"hidden"},className:"grid-block small-3 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"explorer.asset.summary.market_fee"}),":")):null,X="bid"===r,Z=X&&Y?Y:!X&&V?V:null,$=X?F.getAmount({real:!0})>=parseFloat(P):F.getAmount({real:!0})>=parseFloat(S),ee=u?K.a.translate("exchange.short"):X?K.a.translate("exchange.buy"):K.a.translate("exchange.sell"),te=X?K.a.translate("exchange.buy"):K.a.translate("exchange.sell"),ae=!u&&!(F.getAmount()>0&&$),re=!(N>0),ne=!(S>0),se=ae||re||ne,ie=C()("button buySellButton",r,{disabled:se}),le=X?s.get("symbol"):o.get("symbol"),ce=re?K.a.translate("exchange.invalid_price"):ne?K.a.translate("exchange.invalid_amount"):ae?K.a.translate("exchange.no_balance"):null;v[1]&&"1.3.0"===v[1].getIn(["options","core_exchange_rate","quote","asset_id"])&&"1.3.0"===v[1].getIn(["options","core_exchange_rate","base","asset_id"])&&(_=v[0],v.splice(1,1));var ue=0,pe=v.map(function(e){var t=y.a.replaceName(e),a=t.name,r=t.prefix;return n.a.createElement("option",{key:e.get("id"),value:ue++},r,a)}),me=void 0;me=_.get("symbol")===le?F.clone(F.getAmount()-c.getAmount()):F;var he=y.a.replaceName(this.props[X?"base":"quote"]),ye=(he.name,he.prefix,a(14)),ke=null;"bid"==r&&(ke=ye.translate("walkthrough.buy_form")),"ask"==r&&(ke=ye.translate("walkthrough.sell_form"));var Ce=Object.keys(this.props.expirations).map(function(t,a){return n.a.createElement("option",{value:t,key:t},e.props.expirations[t].title)}),Ae=i.a.getState().settings.get("themes"),Se=Ee()();return n.a.createElement("div",{className:this.props.className},n.a.createElement("div",{className:"exchange-bordered buy-sell-container"},n.a.createElement("div",{className:"exchange-content-header "+r,"data-intro":ke},n.a.createElement("span",null,n.a.createElement(de.a,{string:"exchange.buysell_formatter",noLink:!0,noTip:!1,keys:[{type:"asset",value:o.get("symbol"),arg:"asset"},{type:"translate",value:u?"exchange.short":X?"exchange.buy":"exchange.sell",arg:"direction"}]})),this.props.onFlip?n.a.createElement("span",{onClick:this.props.onFlip,style:{cursor:"pointer",fontSize:"1rem"},className:"flip-arrow"}," ","⇆"):"null",this.props.onTogglePosition?n.a.createElement("span",{onClick:this.props.onTogglePosition,style:{cursor:"pointer",fontSize:"1rem"},className:"flip-arrow"}," ","⇅"):"null",n.a.createElement("div",{onClick:this.props.onToggleOpen,className:"float-right clickable hide-for-xlarge",style:{paddingLeft:10}},T),this.props.currentBridges?n.a.createElement("div",{className:"float-right buy-sell-deposit"},n.a.createElement("a",{onClick:this._onBuy.bind(this)},n.a.createElement(de.a,{string:"exchange.buysell_formatter",noLink:!0,keys:[{type:"asset",value:this.props[X?"base":"quote"].get("symbol"),arg:"asset"},{type:"translate",value:"exchange.buy",arg:"direction"}]}))):null,this.props.backedCoin?n.a.createElement("div",{className:"float-right buy-sell-deposit"},n.a.createElement("a",{onClick:this._onDeposit.bind(this)},n.a.createElement(de.a,{string:"exchange.buysell_formatter",noLink:!0,keys:[{type:"asset",value:this.props[X?"base":"quote"].get("symbol"),arg:"asset"},{type:"translate",value:"exchange.deposit",arg:"direction"}]}))):null,this.props.onBorrow?n.a.createElement("div",{className:"float-right buy-sell-deposit"},n.a.createElement("a",{onClick:this.props.onBorrow},n.a.createElement(de.a,{string:"exchange.buysell_formatter",noLink:!0,keys:[{type:"asset",value:this.props[X?"base":"quote"].get("symbol"),arg:"asset"},{type:"translate",value:"exchange.borrow",arg:"direction"}]}))):null),n.a.createElement("form",{className:(this.props.isOpen?"":"hide-container ")+"order-form",noValidate:!0},n.a.createElement("div",{className:"grid-block vertical no-overflow no-padding"},n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{className:"grid-block small-3 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"exchange.price"}),":"),n.a.createElement("div",{className:"grid-block small-5 no-margin no-overflow buy-sell-input"},n.a.createElement(be.b,{id:r+"Price",value:N,onChange:p,autoComplete:"off",placeholder:"0.0"})),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-box"},n.a.createElement(x.a,{dataPlace:"right",name:s.get("symbol")})," / ",n.a.createElement(x.a,{dataPlace:"right",name:o.get("symbol")}))),n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{className:"grid-block small-3 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"transfer.amount"}),":"),n.a.createElement("div",{className:"grid-block small-5 no-margin no-overflow buy-sell-input"},n.a.createElement(be.b,{id:r+"Amount",value:S,onChange:l,autoComplete:"off",placeholder:"0.0"})),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-box"},n.a.createElement(x.a,{dataPlace:"right",name:o.get("symbol")}))),n.a.createElement("div",{className:"grid-block buy-sell-row bottom-row"},n.a.createElement("div",{className:"grid-block small-3 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"exchange.total"}),":"),n.a.createElement("div",{className:"grid-block small-5 no-margin no-overflow buy-sell-input"},n.a.createElement(be.b,{id:r+"Total",value:P,onChange:h,autoComplete:"off",placeholder:"0.0"})),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-box"},n.a.createElement(x.a,{dataPlace:"right",name:s.get("symbol")}))),n.a.createElement("div",{className:"grid-block no-padding buy-sell-row"},n.a.createElement("div",{className:"grid-block small-3 no-margin no-overflow buy-sell-label"},n.a.createElement(k.a,{content:"transfer.fee"}),":"),n.a.createElement("div",{className:"grid-block small-5 no-margin no-overflow buy-sell-input"},n.a.createElement("input",{className:E?"":"no-balance",disabled:!0,type:"text",id:r+"Fee",value:E?c.getAmount({real:!0}):K.a.translate("transfer.errors.insufficient"),autoComplete:"off"})),n.a.createElement("div",{className:"grid-block small-4 no-margin no-overflow buy-sell-box",style:{paddingLeft:1!==v.length?0:5}},n.a.createElement("select",{style:1===v.length?{background:"none"}:null,disabled:1===v.length,value:v.indexOf(this.props.feeAsset),className:"form-control"+(1!==v.length?" buysell-select":""),onChange:this.props.onChangeFeeAsset},pe))),Z),n.a.createElement("div",null,n.a.createElement("div",{className:"grid-content clear-fix no-padding"},n.a.createElement("table",{className:"float-left"},n.a.createElement("tbody",null,n.a.createElement("tr",{className:"buy-sell-info"},n.a.createElement("td",null,n.a.createElement(k.a,{content:"exchange.balance"}),":"),n.a.createElement("td",{style:{paddingLeft:5,textAlign:"right"}},n.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this._addBalance.bind(this,me)},y.a.format_number(F.getAmount({real:!0}),f)," ",n.a.createElement(x.a,{name:le})))),n.a.createElement("tr",{className:"buy-sell-info"},n.a.createElement("td",{style:{paddingTop:5}},X?n.a.createElement(k.a,{content:"exchange.lowest_ask"}):n.a.createElement(k.a,{content:"exchange.highest_bid"}),": "),g?n.a.createElement("td",{style:{paddingLeft:5,textAlign:"right",paddingTop:5,verticalAlign:"bottom"}},n.a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this.props.setPrice.bind(this,r,b.sellPrice())},n.a.createElement(A.a,{price:g,quote:o,base:s})," ",n.a.createElement(x.a,{name:s.get("symbol")}),"/",n.a.createElement(x.a,{name:o.get("symbol")}))):null),n.a.createElement("tr",{className:"buy-sell-info"},n.a.createElement("td",{style:{paddingTop:5}},n.a.createElement(k.a,{content:"transaction.expiration"}),":"),n.a.createElement("td",{className:"expiration-datetime-picker"},n.a.createElement("select",{onChange:this.props.onExpirationTypeChange,value:this.props.expirationType},Ce),"SPECIFIC"===this.props.expirationType?n.a.createElement(ve.a,{pickerPosition:"bottom center",wrapperClassName:Ae,timePicker:!0,min:Se,inputFormat:"Do MMM YYYY hh:mm A",value:this.props.expirationCustomTime,onChange:this.props.onExpirationCustomChange}):null)))),ce?n.a.createElement("div",{className:"float-right","data-tip":ce,"data-place":"right"},n.a.createElement("input",{style:{margin:0},className:ie,type:"submit",onClick:d.bind(this,!0),value:ee})):n.a.createElement("div",{className:"float-right","data-tip":""},n.a.createElement("input",{style:{margin:0},className:ie,type:"submit",onClick:d.bind(this,!0),value:ee})),ce&&u?n.a.createElement("div",{style:{paddingRight:10},className:"float-right","data-tip":ce,"data-place":"right"},n.a.createElement("input",{style:{margin:0},className:ie,type:"submit",onClick:d.bind(this,!1),value:te})):u?n.a.createElement("div",{style:{paddingRight:10},className:"float-right","data-tip":""},n.a.createElement("input",{style:{margin:0},className:ie,type:"submit",onClick:d.bind(this,!1),value:te})):null)))),n.a.createElement(fe.a,we({ref:"deposit_modal",action:"deposit",fiatModal:!1,account:this.props.currentAccount.get("name"),sender:this.props.currentAccount.get("id"),asset:this.props[X?"base":"quote"].get("id"),modalId:"simple_deposit_modal"+("bid"===r?"":"_ask"),balances:[this.props.balance]},w)),n.a.createElement(ge.a,{ref:"bridge_modal",action:"deposit",account:this.props.currentAccount.get("name"),sender:this.props.currentAccount.get("id"),asset:this.props.balanceId,modalId:"simple_bridge_modal"+("bid"===r?"":"_ask"),balances:[this.props.balance],bridges:this.props.currentBridges}))}}]),t}();Ae.propTypes={balance:me.a.ChainObject,type:h.a.string,amountChange:h.a.func.isRequired,priceChange:h.a.func.isRequired,onSubmit:h.a.func.isRequired,onExpirationTypeChange:h.a.func.isRequired,onExpirationCustomChange:h.a.func.isRequired},Ae.defaultProps={type:"bid"};var Se=Object(he.a)(Ae),xe=a(529),Ne=a(2056),Oe=a(41),Pe=a(423),Te=a(124),Fe=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(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 Ie(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 Re=function(e){function t(){je(this,t);var e=qe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.state=e.initialState(),e.getAssetList=Object(d.a)(Pe.a.getAssetList.defer,150),e}return Ie(t,n.a.Component),Fe(t,[{key:"initialState",value:function(){return{marketsList:"",issuersList:"",lookupQuote:null,allMarkets:"",allIssuers:"",inputValue:""}}},{key:"componentWillReceiveProps",value:function(e){e.marketPickerAsset!==this.props.marketPickerAsset&&this.setState(this.initialState()),e.searchAssets!==this.props.searchAssets&&this.assetFilter()}},{key:"shouldComponentUpdate",value:function(e,t){return e.marketPickerAsset!==this.props.marketPickerAsset||e.searchAssets!==this.props.searchAssets||t.marketsList!==this.state.marketsList||t.issuersList!==this.state.issuersList||!y.a.are_equal_shallow(t,this.state)}},{key:"_onSelectIssuer",value:function(e){var t="0"==e.target.value?null:e.target.value;this.assetFilter(t)}},{key:"_onInputName",value:function(e,t){var a=this,r=t.target.value.trim().toUpperCase(),n=!J.ChainValidation.is_valid_symbol_error(r,!0);this.setState({inputValue:t.target.value.trim(),activeSearch:!0,allMarkets:"",allIssuers:"",marketsList:"",issuersList:""}),n?(this.state.inputValue!==r&&this.timer&&clearTimeout(this.timer),this.timer=setTimeout(function(){a._lookupAssets(r,e)},1500)):this.setState({activeSearch:!1})}},{key:"_lookupAssets",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e||""===e){var a=e.toUpperCase();this.getAssetList(a,10,t),this.setState({activeSearch:!1,lookupQuote:a})}}},{key:"_changeMarketPickerFilter",value:function(e){this.setState({marketsList:"",issuersList:"",lookupQuote:null,allMarkets:"",allIssuers:"",inputValue:"",marketPickerTab:e,activeSearch:!1})}},{key:"_fetchIssuer",value:function(e){var t=J.ChainStore.getObject(e.issuer,!1,!1);return t||void 0}},{key:"assetFilter",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=this.props,r=a.searchAssets,o=a.marketPickerAsset,s=this.state,i=s.inputValue,l=s.lookupQuote,c=s.marketPickerTab;this.setState({activeSearch:!0});var u=0,p=[],d=[],m=this.props.baseAsset.get("symbol"),h=this.props.quoteAsset.get("symbol");r.size&&i&&i.length>2&&r.filter(function(e){try{if(e.options.description){var t=JSON.parse(e.options.description);if("visible"in t&&!t.visible)return!1}}catch(e){}return-1!==e.symbol.indexOf(l)}).forEach(function(a){if(!(u>100)){u++;var r=e._fetchIssuer(a),n=e.props.baseAsset.get("symbol"),s=a.symbol+"_"+n,l=h==o,f=l&&a.symbol!=m||!l&&a.symbol!=h;!f||t&&t!=r.get("name")||("search"!=c||!a.symbol.startsWith(i.toUpperCase()))&&c&&"filter"!=c||p.push([s,{quote:a.symbol,base:n,issuer:r?r.get("name"):null}]),f&&r&&!d.includes(r.get("name"))&&d.push(r.get("name"))}});var g=this.state.marketsList,b=this.state.issuersList;b=d?d.sort(function(e,t){return e>t?1:e<t?-1:0}).map(function(e){return n.a.createElement("option",{key:e,value:e},e)}):null,g=p?p.sort(function(e,t){var a=Object(Te.f)(e[1].quote),r=Object(Te.f)(t[1].quote);return a&&!r?-1:r&&!a?1:e[1].quote>t[1].quote?1:e[1].quote<t[1].quote?-1:0}).map(function(t){return n.a.createElement("li",{key:t[0]},n.a.createElement(x.a,{name:t[1].quote}),n.a.createElement("span",{style:{float:"right"}},n.a.createElement(Ne.a,{onClick:function(){e.props.onToggleMarketPicker(null),f.a.switchMarket()},to:h==o?"/market/"+t[1].quote+"_"+m:"/market/"+h+"_"+t[1].quote},n.a.createElement(k.a,{content:"exchange.market_picker.use"}))))}):null,this.setState({allMarkets:p,allIssuers:d,marketsList:g,issuersList:b,activeSearch:!1})}},{key:"render",value:function(){var e=this.props.marketPickerAsset,t=this.state,a=t.marketPickerTab,r=t.inputValue,o=t.allMarkets,s=t.issuersList,i=t.marketsList;return n.a.createElement("div",{className:"marketPicker"},n.a.createElement("div",{className:"marketPicker__header"},n.a.createElement("div",{className:"marketPicker__filterType"},n.a.createElement(k.a,{className:"marketPicker__filterHeader",component:"span",content:"exchange.market_picker.search_mode"}),n.a.createElement(O.a,{style:{marginLeft:5,cursor:"pointer"},className:this.state.marketPickerTab&&"filter"!=this.state.marketPickerTab?"":"blue-icon",size:"1_5x",onClick:this._changeMarketPickerFilter.bind(this,"filter"),name:"filter",title:"icons.filter"}),n.a.createElement(O.a,{style:{marginLeft:5,cursor:"pointer"},className:"search"==this.state.marketPickerTab?"blue-icon":"",size:"1_5x",onClick:this._changeMarketPickerFilter.bind(this,"search"),name:"zoom",title:"icons.zoom"})),n.a.createElement(k.a,{className:"marketPicker__title",component:"span",content:"exchange.market_picker.title"})),n.a.createElement("div",{className:"marketPicker__subHeader"},n.a.createElement(k.a,{content:"exchange.market_picker.sub_title"})," ",n.a.createElement(Ne.a,{to:"/asset/"+e,style:{cursor:"pointer",color:"lightblue !important"}},n.a.createElement(x.a,{name:e}),n.a.createElement(O.a,{className:"blue-icon",style:{marginLeft:5},name:"info-circle-o",title:"icons.info_circle_o"}))),n.a.createElement("hr",null),n.a.createElement("div",{id:"search",style:{display:"search"==a?"":"none"}},n.a.createElement("div",null,n.a.createElement("section",{className:"block-list no-border-bottom"},n.a.createElement("header",null,n.a.createElement(k.a,{component:"span",content:"exchange.market_picker.search_for_asset"})),n.a.createElement("input",{type:"text",value:r,onChange:this._onInputName.bind(this,!1),placeholder:K.a.translate("exchange.market_picker.search"),maxLength:"16",tabIndex:2})))),n.a.createElement("div",{id:"filter",style:{display:this.state.marketPickerTab&&"filter"!=this.state.marketPickerTab?"none":""}},n.a.createElement("div",null,n.a.createElement("section",{className:"block-list no-border-bottom"},n.a.createElement("header",null,n.a.createElement(k.a,{component:"span",content:"exchange.market_picker.find_by_asset"})),n.a.createElement("input",{type:"text",value:r,onChange:this._onInputName.bind(this,!0),placeholder:K.a.translate("exchange.market_picker.search"),maxLength:"16",tabIndex:2}))),n.a.createElement("div",null,n.a.createElement("section",{className:"block-list no-border-bottom"},n.a.createElement("header",null,n.a.createElement(k.a,{component:"span",content:"exchange.market_picker.filter_by_issuer"})),n.a.createElement("ul",null,n.a.createElement("li",{className:"with-dropdpwn"},n.a.createElement("select",{className:"settings-select",onChange:this._onSelectIssuer.bind(this),style:{border:0}},n.a.createElement("option",{key:"0",value:"0"},K.a.translate("exchange.market_picker.show_all")," "),s)))))),n.a.createElement("section",{className:"block-list no-border-bottom"},n.a.createElement(k.a,{component:"header",content:"exchange.market_picker.results",total_assets:o?o.length:0})),this.state.activeSearch&&0!=this.state.inputValue.length?n.a.createElement("div",{style:{textAlign:"center"}},n.a.createElement(Oe.a,{type:"three-bounce"})):n.a.createElement("div",{className:"results"},n.a.createElement("ul",{style:{marginLeft:0}},i)))}}]),t}(),Be=function(e){function t(){return je(this,t),qe(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Ie(t,n.a.Component),Fe(t,[{key:"render",value:function(){return n.a.createElement(Re,this.props)}}]),t}(),Le=Be=Object(G.a)(Be,{listenTo:function(){return[xe.a]},getProps:function(){return{searchAssets:xe.a.getState().assets,assetsLoading:xe.a.getState().assetsLoading}}}),De=a(1822),Me=a.n(De),ze=a(1922),Ue=a.n(ze),He=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],r=!0,n=!1,o=void 0;try{for(var s,i=e[Symbol.iterator]();!(r=(s=i.next()).done)&&(a.push(s.value),!t||a.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{!r&&i.return&&i.return()}finally{if(n)throw o}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),We=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function Ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ge(e){return e.map(function(e){var t=e/60,a=t/60/24,r=a/7;if(t<1)return e+"S";if(a<1&&parseInt(t,10)===t)return t.toString();if(r<1){if(a>=1&&parseInt(a,10)===a)return 1===a?"D":a+"D"}else if(r>=1&&parseInt(r,10)===r)return r+"D";return null}).filter(function(e){return!!e})}var Je=function(){function e(){Ve(this,e)}return We(e,[{key:"update",value:function(e){for(var t in e)switch(t){case"resolutions":this.supported_resolutions=Ge(e.resolutions);break;case"onMarketChange":o.a.unsubscribe("market_change"),o.a.subscribe("market_change",e[t]);break;default:this[t]=e[t]}}},{key:"clearSubs",value:function(){o.a.clearSubs()}},{key:"onReady",value:function(e){var t=this;setTimeout(function(){e({exchanges:[{value:"OPEN.",name:"Openledger",desc:"Openledger Gateway"}],symbols_types:[],supported_resolutions:t.supported_resolutions,supports_marks:!1,supports_search:!1,supports_time:!0})},10)}},{key:"searchSymbols",value:function(e,t,a,r){console.log("searchSymbols",e,t,a),r([])}},{key:"resolveSymbol",value:function(e,t,a){var r=this,n=e.split("_"),o=He(n,2),s=o[0],i=o[1];Promise.all([Object(J.FetchChain)("getAsset",s),Object(J.FetchChain)("getAsset",i)]).then(function(a){var n=He(a,2),o=n[0],s=n[1];t(new function e(t){Ve(this,e),this.name=t.ticker,this.ticker=t.ticker;var a=Object(Te.c)(t.quoteAsset),r=Object(Te.c)(t.baseAsset),n=a===r?a:a&&!r?a:!a&&r?r:a+" / "+r,o=y.a.replaceName(t.baseAsset),s=o.name,i=o.prefix,l=y.a.replaceName(t.quoteAsset),c=l.name,u=l.prefix;this.description=""+(u||"")+c+" / "+(i||"")+s+" "+(n?"("+n+")":""),this.type="bitcoin",this.session="24x7",this.timezone=Ue.a.tz.guess(),this.data_status="streaming",this.supported_resolutions=t.resolutions,this.has_empty_bars=!0,this.pricescale=Math.pow(10,t.baseAsset.get("precision")),this.quoteAsset=t.quoteAsset,this.baseAsset=t.baseAsset,this.minmov=1,this.has_intraday=this.supported_resolutions.reduce(function(e,t){return e||!isNaN(parseInt(t,10))},!1),this.intraday_multipliers=this.supported_resolutions.filter(function(e){return!isNaN(parseInt(e,10))}),this.has_seconds=this.supported_resolutions.reduce(function(e,t){return e||-1!==t.indexOf("S")},!1),this.seconds_multipliers=this.supported_resolutions.filter(function(e){return-1!==e.indexOf("S")}),this.has_daily=this.supported_resolutions.reduce(function(e,t){return e||-1!==t.indexOf("D")},!1),this.has_daily=this.supported_resolutions.reduce(function(e,t){return e||-1!==t.indexOf("D")},!1)}({ticker:e,quoteAsset:o,baseAsset:s,resolutions:r.supported_resolutions}))}).catch(a)}},{key:"getBars",value:function(e,t,a,r,n,o,s){var i=this;a*=1e3,r*=1e3;var l=this._getHistory();if(this.latestBar=l[l.length-1],l=l.filter(function(e){return e.time>=a&&e.time<=r}),this.interval!==t){if(!s)return;var c=function(e){return"D"===e?86400:-1!==e.indexOf("W")?7*parseInt(e.replace("D",""),10)*24*60*60:-1!==e.indexOf("D")?24*parseInt(e.replace("D",""),10)*60*60:-1!==e.indexOf("S")?parseInt(e.replace("S",""),10):60*parseInt(e,10)}(t);return f.a.changeBucketSize(c),f.a.unSubscribeMarket(e.quoteAsset.get("id"),e.baseAsset.get("id")).then(function(){f.a.subscribeMarket(e.baseAsset,e.quoteAsset,c).then(function(){var e=i._getHistory();if(i.latestBar=e[e.length-1],e=e.filter(function(e){return e.time>=a&&e.time<=r}),i.interval=t,!e.length)return n(e,{noData:!0});n(e)})})}if(this.interval=t,!l.length)return n(l,{noData:!0});n(l)}},{key:"_getHistory",value:function(){return o.a.getState().priceData}},{key:"subscribeBars",value:function(e,t,a,r,n){var s=this;o.a.unsubscribe("subscribeBars"),n(),o.a.subscribe("subscribeBars",function(){var e=s._getHistory(),t=e.filter(function(e){return!s.latestBar||e.time>s.latestBar.time});if(t.length)t.forEach(function(e){a(e)}),s.latestBar=t[t.length-1];else{var r=!1;for(var n in s.latestBar)s.latestBar[n]!==e[e.length-1][n]&&(r=!0);r&&a(e[e.length-1])}})}},{key:"unsubscribeBars",value:function(){}},{key:"calculateHistoryDepth",value:function(e,t,a){}},{key:"getServerTime",value:function(e){e((new Date).getTime()/1e3)}}]),e}(),Qe=["America/Argentina/Buenos_Aires","America/Bogota","America/Caracas","America/Chicago","America/El_Salvador","America/Los_Angeles","America/Mexico_City","America/New_York","America/Phoenix","America/Sao_Paulo","America/Toronto","America/Vancouver","Asia/Almaty","Asia/Ashkhabad","Asia/Bangkok","Asia/Dubai","Asia/Hong_Kong","Asia/Kathmandu","Asia/Kolkata","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Taipei","Asia/Tehran","Asia/Tokyo","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Sydney","Europe/Athens","Europe/Berlin","Europe/Istanbul","Europe/London","Europe/Madrid","Europe/Moscow","Europe/Paris","Europe/Warsaw","Europe/Zurich","Pacific/Auckland","Pacific/Chatham","Pacific/Fakaofo","Pacific/Honolulu","US/Mountain"];var Ke=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var Ye=a(1921),Xe=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),Ke(t,[{key:"loadTradingView",value:function(e){var t=this,a=e.dataFeed,r=Me.a[e.theme];if(a&&!this.tvWidget){0,a.update({resolutions:e.buckets,ticker:e.quoteSymbol+"_"+e.baseSymbol,interval:Ge([e.bucketSize])[0]});var n=["header_saveload","symbol_info","symbol_search_hot_key","border_around_the_chart","header_symbol_search","header_compare"];this.props.mobile&&(n.push("chart_scroll"),n.push("chart_zoom")),this.tvWidget=new Ye.widget({fullscreen:!1,symbol:e.quoteSymbol+"_"+e.baseSymbol,interval:Ge([e.bucketSize])[0],library_path:"/charting_library/",datafeed:a,container_id:"tv_chart",charts_storage_url:"https://saveload.tradingview.com",charts_storage_api_version:"1.1",client_id:"tradingview.com",user_id:"public_user_id",autosize:!0,locale:e.locale,timezone:function(){var e=Ue.a.tz.guess();if(-1!==Qe.indexOf(e))return e;for(var t=Ue()().toISOString(),a=Ue.a.tz(t,e).format(),r=0;r<Qe.length;r++)if(Ue.a.tz(t,Qe[r]).format()===a)return Qe[r];return console.log("No matching timezone found for "+e+", setting to default value of Europe/London"),"Europe/London"}(),toolbar_bg:r.bgColor,overrides:{"paneProperties.background":r.bgColor,"paneProperties.horzGridProperties.color":r.axisLineColor,"paneProperties.vertGridProperties.color":r.axisLineColor,"scalesProperties.lineColor":r.axisLineColor,"scalesProperties.textColor":r.textColor},custom_css_url:e.theme+".css",enabled_features:["study_templates","keep_left_toolbar_visible_on_small_screens"],disabled_features:n,debug:!1,preset:this.props.mobile?"mobile":""}),this.tvWidget.onChartReady(function(){a.update({onMarketChange:t._setSymbol.bind(t)})})}}},{key:"componentWillReceiveProps",value:function(e){e.marketReady&&!this.props.dataFeed&&e.dataFeed&&loadTradingView(e)}},{key:"_setSymbol",value:function(e){this.tvWidget&&this.tvWidget.setSymbol(e,Ge([this.props.bucketSize])[0])}},{key:"componentDidMount",value:function(){this.loadTradingView(this.props)}},{key:"componentWillUnmount",value:function(){this.props.dataFeed.clearSubs()}},{key:"shouldComponentUpdate",value:function(e){return e.chartHeight!==this.props.chartHeight||!this.tvWidget&&!!e.marketReady}},{key:"render",value:function(){return n.a.createElement("div",{className:"small-12"},n.a.createElement("div",{className:"exchange-bordered",style:{marginTop:10,marginBottom:10,height:this.props.chartHeight+"px"},id:"tv_chart"}))}}]),t}(),Ze=a(544),$e=a(1790),et=a.n($e),tt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var at=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),tt(t,[{key:"shouldComponentUpdate",value:function(e){var t=!isNaN(e.feedPrice)&&e.feedPrice!==this.props.feedPrice;return Object(oe.j)(e.orders,this.props.orders)||Object(oe.j)(e.call_orders,this.props.call_orders)||t||e.feedPrice!==this.props.feedPrice||e.height!==this.props.height||e.leftOrderBook!==this.props.leftOrderBook||e.LCP!==this.props.LCP||e.showCallLimit!==this.props.showCallLimit||e.hasPrediction!==this.props.hasPrediction||e.feedPrice!==this.props.feedPrice||e.marketReady!==this.props.marketReady}},{key:"componentDidMount",value:function(){this.reflowChart(500)}},{key:"componentWillReceiveProps",value:function(e){this.refs.depthChart&&e.verticalOrderbook!==this.props.verticalOrderbook&&this.reflowChart(100)}},{key:"componentWillUpdate",value:function(){this.props.centerRef&&(this.tempScroll=this.props.centerRef.scrollTop)}},{key:"componentDidUpdate",value:function(){this.props.centerRef&&(this.props.centerRef.scrollTop=this.tempScroll)}},{key:"reflowChart",value:function(e){var t=this;setTimeout(function(){t.refs.depthChart&&t.refs.depthChart.chart.reflow()},e)}},{key:"_getThemeColors",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return Me.a[e.theme]}},{key:"render",value:function(){var e=this.props,t=e.flat_bids,a=e.flat_asks,r=e.flat_calls,o=e.flat_settles,s=e.totalBids,i=e.totalAsks,l=e.base,c=e.quote,u=e.feedPrice,p=this._getThemeColors(),d=p.primaryText,m=p.callColor,h=p.settleColor,f=p.settleFillColor,g=p.bidColor,b=p.bidFillColor,_=p.askColor,v=p.askFillColor,E=p.axisLineColor,w=y.a.replaceName(l),C=w.name,A=w.prefix,S=y.a.replaceName(c),N=S.name,O=S.prefix;C=(A||"")+C,N=(O||"")+N;var P=Object(Ze.a)(t),T=Object(Ze.a)(a),F=Object(Ze.a)(r),j=Object(Ze.a)(o),q={chart:{type:"area",backgroundColor:"rgba(255, 0, 0, 0)",spacing:[10,0,5,0]},title:{text:null},credits:{enabled:!1},legend:{enabled:!1},rangeSelector:{enabled:!1},navigator:{enabled:!1},scrollbar:{enabled:!1},dataGrouping:{enabled:!1},tooltip:{shared:!1,backgroundColor:"rgba(0, 0, 0, 0.75)",useHTML:!0,formatter:function(){return"\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>"+K.a.translate("exchange.price")+':</td>\n\t\t\t\t\t\t\t<td style="text-align: right">'+y.a.format_number(this.x,l.get("precision"))+" "+C+"/"+N+"</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>"+K.a.translate("exchange.quantity")+':</td>\n\t\t\t\t\t\t\t<td style="text-align: right">'+y.a.format_number(this.y,c.get("precision"))+" "+N+"</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t"},style:{color:"#FFFFFF"}},series:[],yAxis:{labels:{enabled:!0,style:{color:d},formatter:function(){return y.a.format_number(this.value,c.get("precision"))}},opposite:!1,title:{text:null,style:{color:"#FFFFFF"}},gridLineWidth:1,gridLineColor:"rgba(196, 196, 196, 0.30)",gridZIndex:1,crosshair:{snap:!1},currentPriceIndicator:{enabled:!1}},xAxis:{labels:{style:{color:d}},ordinal:!1,lineColor:"#000000",title:{text:null},plotLines:[]},plotOptions:{area:{animation:!1,marker:{enabled:!1},series:{enableMouseTracking:!1}}}};if(P.length>0&&T.length>0){var I=(T[0][0]+P[P.length-1][0])/2;q.xAxis.min=.4*I,q.xAxis.max=1.6*I,q.xAxis.max<T[0][0]&&(q.xAxis.max=1.5*T[0][0]),q.xAxis.min>P[P.length-1][0]&&(q.xAxis.min=.5*P[P.length-1][0]);var R=0;P.forEach(function(e){e[0]>=q.xAxis.min&&(R=Math.max(e[1],R))}),T.forEach(function(e){e[0]<=q.xAxis.max&&(R=Math.max(e[1],R))}),q.yAxis.max=1.15*R;var B=R>10?0:R>1?2:5;q.yAxis.labels.formatter=function(){return y.a.format_number(this.value,B)}}else P.length&&!T.length?(q.xAxis.min=.4*P[P.length-1][0],q.xAxis.max=1.6*P[P.length-1][0]):T.length&&!P.length&&(q.xAxis.min=0,q.xAxis.max=2*T[0][0]);if(this.props.hasPrediction&&(q.xAxis.min=-.05,q.xAxis.max=1.05),this.props.LCP&&q.xAxis.plotLines.push({color:E,id:"plot_line",dashStyle:"longdash",value:this.props.LCP,label:{text:K.a.translate("explorer.block.call_limit"),style:{color:d,fontWeight:"bold"}},width:2,zIndex:5}),u){var L=l.has("bitasset")?_:g;q.xAxis.plotLines.push({color:L,id:"plot_line",dashStyle:"solid",value:u,label:{text:K.a.translate("explorer.block.feed_price"),style:{color:d,fontWeight:"bold"}},width:2,zIndex:5}),F&&F.length&&q.series.push({name:"Call "+N,data:F,color:m})}return u&&j&&j.length&&q.series.push({name:"Settle "+N,data:j,color:h,fillColor:f}),P.length&&q.series.push({step:"right",name:"Bid "+N,data:P,color:g,fillColor:b}),T.length&&q.series.push({step:"left",name:"Ask "+N,data:T,color:_,fillColor:v}),this.props.height?q.chart.height=this.props.height:q.chart.height="400px",this.props.onClick&&(q.chart.events={click:this.props.onClick.bind(this)}),this.props.noFrame?n.a.createElement("div",{className:"grid-content no-overflow no-padding"},P.length||T.length||F.length?null:n.a.createElement("span",{className:"no-data"},n.a.createElement(k.a,{content:"exchange.no_data"})),this.props.noText?null:n.a.createElement("p",{className:"bid-total"},y.a.format_number(s,l.get("precision"))," ",C),this.props.noText?null:n.a.createElement("p",{className:"ask-total"},y.a.format_number(i,c.get("precision"))," ",N),P||T||F?n.a.createElement(et.a,{config:q}):null):n.a.createElement("div",{className:"grid-content no-overflow no-padding middle-content"},n.a.createElement("div",{className:"exchange-bordered",style:{margin:10}},n.a.createElement("div",{className:"exchange-content-header"},this.props.noText?null:n.a.createElement("span",{className:"bid-total"},y.a.format_number(s,l.get("precision"))," ",n.a.createElement(x.a,{name:l.get("symbol")})),this.props.noText?null:n.a.createElement("span",{className:"ask-total float-right"},y.a.format_number(i,c.get("precision"))," ",n.a.createElement(x.a,{name:c.get("symbol")}))),P.length||T.length||F.length?null:n.a.createElement("span",{className:"no-data"},n.a.createElement(k.a,{content:"exchange.no_data"})),P||T||F?n.a.createElement(et.a,{ref:"depthChart",config:q}):null))}}]),t}();at.defaultProps={flat_bids:[],flat_asks:[],orders:{},noText:!1,noFrame:!0},at.propTypes={flat_bids:h.a.array.isRequired,flat_asks:h.a.array.isRequired,orders:h.a.object.isRequired};var rt=at,nt=a(1791),ot=a(67),st=a(1926),it=a.n(st),lt=a(42),ct=a.n(lt),ut=a(533),pt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var dt=J.ChainTypes.operations,mt=Object.keys(dt),ht=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),pt(t,[{key:"componentWillReceiveProps",value:function(e){if(e.account&&e.account.size&&this.props.account&&this.props.account.get("history")){var t=this.props.account.get("history")&&this.props.account.get("history").first()?this.props.account.get("history").first().toJS():null,a=e.account.get("history")&&e.account.get("history").first()?e.account.get("history").first().toJS():null;a&&t&&"fill_order"===mt[a.op[0]]&&(!t&&a.id||a.id!==t.id)&&(ct.a.publish("account-notify","open"),setTimeout(function(){ct.a.publish("account-notify","close")},5e3))}}},{key:"shouldComponentUpdate",value:function(e){return!(!e.account||!this.props.account)&&(!W.a.is(e.account.get("history"),this.props.account.get("history"))||!W.a.is(e.account,this.props.account))}},{key:"render",value:function(){var e=this.props.account;if(!e)return n.a.createElement("div",null);var t=void 0,a=void 0;return this.props.account.get("history")&&this.props.account.get("history").size&&(t=this.props.account.get("history").first().toJS())&&(a=n.a.createElement(ut.a,{key:t.id,op:t.op,result:t.result,block:t.block_num,current:e.get("id"),hideDate:!0,hideFee:!0})),t?n.a.createElement(it.a.Static,{id:"account-notify",title:null,image:"",wrapperElement:"div"},n.a.createElement("table",{className:"table"},n.a.createElement("tbody",null,a))):n.a.createElement("div",null)}}]),t}();ht.propTypes={account:me.a.ChainAccount.isRequired};var ft=ht=Object(he.a)(ht),gt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var bt=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),gt(t,[{key:"render",value:function(){return n.a.createElement(p.a,{stores:[s.a],inject:{account:function(){return s.a.getState().currentAccount}}},n.a.createElement(ft,null))}}]),t}(),_t=a(104),yt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var vt=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),yt(t,[{key:"show",value:function(){var e="modal_confirm_"+this.props.type;ct.a.publish(e,"open")}},{key:"_onForce",value:function(e,t){var a="modal_confirm_"+this.props.type;t.preventDefault(),ct.a.publish(a,"close"),e&&this.props.onForce()}},{key:"render",value:function(){var e=this.props,t=e.type,a=e.diff,r=e.hasOrders;return n.a.createElement(_t.a,{id:"modal_confirm_"+t,overlay:!0},n.a.createElement(k.a,{component:"h3",content:"transaction.confirm"}),n.a.createElement("div",{className:"grid-block vertical"},r?n.a.createElement(k.a,{content:"exchange.confirm_"+t,diff:y.a.format_number(a,2)}):n.a.createElement(k.a,{content:"exchange.confirm_no_orders_"+t}),n.a.createElement("div",{className:"button-group",style:{paddingTop:"2rem"}},n.a.createElement("input",{onClick:this._onForce.bind(this,!0),className:"button success",type:"submit",value:"Yes"}),n.a.createElement("input",{onClick:this._onForce.bind(this,!1),className:"button info",type:"submit",value:"No"}))))}}]),t}(),kt=a(1757),Et=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var wt=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=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));return e.state={change:null,curMarket:null,marketChange:!1},e}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),Et(t,[{key:"shouldComponentUpdate",value:function(e){return!(!e.volume2||e.volume2===this.props.volume2)||(e.price!==this.props.price||e.ready!==this.props.ready)}},{key:"componentWillReceiveProps",value:function(e){var t={change:0},a=e.market,r=this.state.curMarket!==a,n=null!=this.state.curMarket&&r;t.marketChange=n,t.curMarket=a,t.prevAsset=this.state.marketAsset,e.ready&&this.props.ready&&(t.change=parseFloat(e.price)-parseFloat(this.props.price)),this.setState(t)}},{key:"componentDidUpdate",value:function(){$.a.rebuild()}},{key:"render",value:function(){var e=this.props,t=e.base,a=e.quote,r=e.price,o=e.content,s=e.ready,i=e.volume,l=e.toolTip,c=e.ignoreColorChange,u=this.state,p=u.change,d=null;!u.marketChange&&p&&null!==p&&!0!==c&&(d=p>0?"pulsate green":"pulsate red");var m=i?y.a.format_volume(r):y.a.price_text(r,a,t);return n.a.createElement("li",{className:C()("stressed-stat",this.props.className,d),onClick:this.props.onClick,"data-place":"bottom","data-tip":l},n.a.createElement("span",null,n.a.createElement("span",{className:"value stat-primary"},s?m:0," "),n.a.createElement("span",{className:"symbol-text"},n.a.createElement(x.a,{name:t.get("symbol")}))),o?n.a.createElement("div",{className:"stat-text"},n.a.createElement(k.a,{content:o})):null)}}]),t}(),Ct=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},At=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function St(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xt(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 Nt(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 Ot=function(e){function t(){return St(this,t),xt(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Nt(t,n.a.Component),At(t,[{key:"_getFeedPrice",value:function(){return this.props?1/y.a.get_asset_price(this.props.debtAsset.getIn(["bitasset","current_feed","settlement_price","quote","amount"]),this.props.collateralAsset,this.props.debtAsset.getIn(["bitasset","current_feed","settlement_price","base","amount"]),this.props.debtAsset):1}},{key:"_getCollateralRatio",value:function(){var e=this.props.object.toJS();return y.a.get_asset_amount(e.collateral,this.props.collateralAsset)/(y.a.get_asset_amount(e.debt,this.props.debtAsset)/this._getFeedPrice())}},{key:"_getMR",value:function(){return this.props.debtAsset.getIn(["bitasset","current_feed","maintenance_collateral_ratio"])/1e3}},{key:"_getStatusClass",value:function(){var e=this._getCollateralRatio(),t=this._getMR();return isNaN(e)?null:e<t?"danger":e<t+.5?"warning":""}},{key:"_getCRTip",value:function(){var e=this._getStatusClass(),t=this._getMR();return e&&""!==e?"danger"===e?K.a.translate("tooltip.cr_danger",{mr:t}):"warning"===e?K.a.translate("tooltip.cr_warning",{mr:t}):null:null}},{key:"render",value:function(){var e=this.props.object.toJS(),t=this._getCollateralRatio(),a=(y.a.get_asset_amount(e.debt,this.props.debtAsset),this._getStatusClass());return n.a.createElement("li",{className:C()("stressed-stat",this.props.className),onClick:this.props.onClick,"data-place":"bottom","data-tip":this._getCRTip()},n.a.createElement("span",null,n.a.createElement("span",{className:C()("value stat-primary",a)},y.a.format_number(t,2))),n.a.createElement("div",{className:"stat-text"},n.a.createElement(k.a,{content:"header.collateral_ratio"})))}}]),t}();Ot.propTypes={debtAsset:me.a.ChainAsset.isRequired,collateralAsset:me.a.ChainAsset.isRequired},Ot=Object(he.a)(Ot);var Pt=function(e){function t(){return St(this,t),xt(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Nt(t,n.a.Component),At(t,[{key:"render",value:function(){var e=this.props,t=e.object,a=e.account,r=t.getIn(["call_price","quote","asset_id"]),o=t.getIn(["call_price","base","asset_id"]);return n.a.createElement(Ot,Ct({debtAsset:r,collateralAsset:o,account:a},this.props))}}]),t}();Pt.propTypes={object:me.a.ChainObject.isRequired};var Tt=Pt=Object(he.a)(Pt),Ft=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var jt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);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));return a.state={volumeShowQuote:!0,chartHeight:e.chartHeight},a.setChartHeight=a.setChartHeight.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),Ft(t,[{key:"shouldComponentUpdate",value:function(e){return!!e.marketReady}},{key:"_addMarket",value:function(e,t){var a=e+"_"+t;this.props.starredMarkets.has(a)?E.a.removeStarMarket(e,t):E.a.addStarMarket(e,t)}},{key:"changeVolumeBase",value:function(){this.setState({volumeShowQuote:!this.state.volumeShowQuote})}},{key:"marketPicker",value:function(e){var t=this.state.selectedMarketPickerAsset;t=t&&t==e?null:e,this.setState({selectedMarketPickerAsset:t}),this.props.onToggleMarketPicker(t)}},{key:"setChartHeight",value:function(){this.props.onChangeChartHeight({value:this.state.chartHeight})}},{key:"render",value:function(){var e=this,t=this.props,r=t.quoteAsset,o=t.baseAsset,s=t.starredMarkets,i=t.hasPrediction,l=t.feedPrice,c=t.showCallLimit,u=t.lowestCallPrice,p=t.marketReady,d=t.latestPrice,m=t.marketStats,h=t.showDepthChart,g=t.account,b=o.get("symbol"),_=r.get("symbol"),y=_+"_"+b,v=s.has(y)?"gold-star":"grey-star",E=m.get("change"),w=0===parseFloat(E)?"":parseFloat(E)<0?"negative":"positive",C=m.get("volumeBase"),A=m.get("volumeQuote"),S=E>0?"+"+E:E,N=this.state.volumeShowQuote?A:C,P=this.state.volumeShowQuote?r:o,T=!1,F=r.get("id"),j=o.get("id"),q="1.3.0"===F?j:"1.3.0"===j?F:null,I=q?J.ChainStore.getAsset(q):null,R="",B=null;if(!!I&&!!I.get("bitasset")){if(g.toJS&&g.has("call_orders"))for(var L=g.get("call_orders").toJS(),D=0;D<L.length;D++){var M=L[D];if(J.ChainStore.getObject(M).getIn(["call_price","quote","asset_id"])===q){R=M,T=!0;break}}var z="1.3.0"==o.get("id")?r:"1.3.0"==r.get("id")?o:null;if(z&&l){var U=z.getIn(["bitasset","options"]).toJS().force_settlement_offset_percent;B="1.3.0"==o.get("id")?l.toReal()/(1+U/1e4):l.toReal()*(1+U/1e4)}}var H=a(14),W=!!this.state.selectedMarketPickerAsset&&this.state.selectedMarketPickerAsset==_,V=!!this.state.selectedMarketPickerAsset&&this.state.selectedMarketPickerAsset==b;return n.a.createElement("div",{className:"grid-block shrink no-padding overflow-visible top-bar"},n.a.createElement("div",{className:"grid-block overflow-visible"},n.a.createElement("div",{className:"grid-block shrink"},n.a.createElement("div",{style:{padding:"10px"}},n.a.createElement(kt.a,{replaceNoneToBts:!1,maxWidth:40,name:r.get("symbol")})),n.a.createElement("div",{style:{padding:"10px"}},i?n.a.createElement("a",{className:"market-symbol"},n.a.createElement("span",null,_+" : "+b)):n.a.createElement("div",{style:{padding:"0 5px",fontSize:"18px",marginTop:"1px"}},n.a.createElement("span",{onClick:this.marketPicker.bind(this,_),className:"underline",style:{cursor:"pointer",color:W?"#2196f3":""}},n.a.createElement(x.a,{name:_,replace:!0,noTip:!0})),n.a.createElement("span",{style:{padding:"0 5px"}},"/"),n.a.createElement("span",{onClick:this.marketPicker.bind(this,b),className:"underline",style:{cursor:"pointer",color:V?"#2196f3":""}},n.a.createElement(x.a,{name:b,replace:!0,noTip:!0}))),n.a.createElement("div",{className:"label-actions"},n.a.createElement(k.a,{component:"span",style:{padding:"5px 0 0 5px"},className:"stat-text",content:"exchange.trading_pair"}),n.a.createElement(Ne.a,{onClick:function(){f.a.switchMarket()},to:"/market/"+b+"_"+_,"data-intro":H.translate("walkthrough.switch_button")},n.a.createElement(O.a,{className:"shuffle",name:"shuffle",title:"icons.shuffle"})),n.a.createElement("a",{onClick:function(){e._addMarket(e.props.quoteAsset.get("symbol"),e.props.baseAsset.get("symbol"))},"data-intro":H.translate("walkthrough.favourite_button")},n.a.createElement(O.a,{className:v,name:"fi-star",title:"icons.fi_star.market"}))))),n.a.createElement("div",{className:"grid-block vertical",style:{overflow:"visible"}},n.a.createElement("div",{className:"grid-block wrap market-stats-container"},n.a.createElement("ul",{className:"market-stats stats top-stats"},d?n.a.createElement(wt,{ignoreColorChange:!0,ready:p,price:d,quote:r,base:o,market:y,content:"exchange.latest"}):null,n.a.createElement("li",{className:"hide-order-1 stressed-stat daily_change "+w},n.a.createElement("span",null,n.a.createElement("b",{className:"value"},p?S:0),n.a.createElement("span",null," %")),n.a.createElement(k.a,{component:"div",className:"stat-text",content:"account.hour_24"})),C>=0?n.a.createElement(wt,{ignoreColorChange:!0,onClick:this.changeVolumeBase.bind(this),ready:p,decimals:0,volume:!0,price:N,className:"hide-order-2 clickable",base:P,market:y,content:"exchange.volume_24"}):null,!i&&l?n.a.createElement(wt,{ignoreColorChange:!0,toolTip:K.a.translate("tooltip.feed_price"),ready:p,className:"hide-order-3",price:l.toReal(),quote:r,base:o,market:y,content:"exchange.feed_price"}):null,!i&&l?n.a.createElement(wt,{ignoreColorChange:!0,toolTip:K.a.translate("tooltip.settle_price"),ready:p,className:"hide-order-4",price:B,quote:r,base:o,market:y,content:"exchange.settle"}):null,T?n.a.createElement(Tt,{object:R,account:g}):null,u&&c?n.a.createElement(wt,{toolTip:K.a.translate("tooltip.call_limit"),ready:p,className:"hide-order-5 is-call",price:u,quote:r,base:o,market:y,content:"explorer.block.call_limit"}):null,l&&c?n.a.createElement(wt,{toolTip:K.a.translate("tooltip.margin_price"),ready:p,className:"hide-order-6 is-call",price:l.getSqueezePrice({real:!0}),quote:r,base:o,market:y,content:"exchange.squeeze"}):null),n.a.createElement("ul",{className:"market-stats stats top-stats"},n.a.createElement("li",{className:"stressed-stat input clickable hide-order-0",style:{padding:"16px"},onClick:function(){ct.a.publish("chart_options","open")}},n.a.createElement(k.a,{content:"exchange.chart_modal"})))))),n.a.createElement(_t.a,{id:"chart_options",overlay:!0,modalHeader:"exchange.chart_modal",noLogo:!0},n.a.createElement("section",{className:"block-list no-border-bottom"},n.a.createElement("header",null,n.a.createElement(k.a,{content:"exchange.chart_type"}),":"),n.a.createElement("ul",null,n.a.createElement("li",{className:"with-dropdown"},n.a.createElement("select",{value:h?"depth_chart":"price_chart",className:"settings-select",onChange:function(t){(h&&"price_chart"===t.target.value||!h&&"market_depth"===t.target.value)&&e.props.onToggleCharts()}},n.a.createElement("option",{value:"market_depth"},K.a.translate("exchange.order_depth")),n.a.createElement("option",{value:"price_chart"},K.a.translate("exchange.price_history")))))),n.a.createElement("section",{className:"block-list no-border-bottom"},n.a.createElement("header",null,n.a.createElement(k.a,{content:"exchange.chart_height"}),":"),n.a.createElement("label",null,n.a.createElement("span",{className:"inline-label"},n.a.createElement("input",{onKeyDown:function(t){13===t.keyCode&&e.setChartHeight()},type:"number",value:this.state.chartHeight,onChange:function(t){return e.setState({chartHeight:t.target.value})}}),n.a.createElement("div",{className:"button no-margin",onClick:this.setChartHeight},"Set"))))))}}]),t}(),qt=a(13),It=a(142),Rt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();var Bt=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),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)).apply(this,arguments))}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),Rt(t,[{key:"render",value:function(){var e=this.props.height||"30%",t=i.a.getState().settings.get("locale"),a=null;return a="https://chat.rudex.org/"+t+"/",n.a.createElement("iframe",{style:{height:e,width:"100%"},src:a,sandbox:"allow-same-origin allow-forms allow-scripts allow-popups"})}}]),t}();Bt.propTypes={height:h.a.string};var Lt=Bt,Dt=a(712),Mt=a.n(Dt),zt=a(69),Ut=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],r=!0,n=!1,o=void 0;try{for(var s,i=e[Symbol.iterator]();!(r=(s=i.next()).done)&&(a.push(s.value),!t||a.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{!r&&i.return&&i.return()}finally{if(n)throw o}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Ht=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Wt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function Vt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Gt=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);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));return a.EXPIRATIONS={HOUR:{title:"1 hour",get:function(){return Ee()().add(1,"hour").valueOf()}},"12HOURS":{title:"12 hours",get:function(){return Ee()().add(12,"hour").valueOf()}},"24HOURS":{title:"24 hours",get:function(){return Ee()().add(1,"day").valueOf()}},"7DAYS":{title:"7 days",get:function(){return Ee()().add(7,"day").valueOf()}},MONTH:{title:"30 days",get:function(){return Ee()().add(30,"day").valueOf()}},YEAR:{title:"1 year",get:function(){return Ee()().add(1,"year").valueOf()}},SPECIFIC:{title:"Specific",get:function(e){return a.state.expirationCustomTime[e].valueOf()}}},a.state=Ht({},a._initialState(e),{expirationType:{bid:e.exchange.getIn(["lastExpiration","bid"])||"YEAR",ask:e.exchange.getIn(["lastExpiration","ask"])||"YEAR"},expirationCustomTime:{bid:Ee()().add(1,"day"),ask:Ee()().add(1,"day")},feeStatus:{}}),a._getWindowSize=Object(d.a)(a._getWindowSize.bind(a),150),a._checkFeeStatus=a._checkFeeStatus.bind(a),a._handleExpirationChange=a._handleExpirationChange.bind(a),a._handleCustomExpirationChange=a._handleCustomExpirationChange.bind(a),a.psInit=!0,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),Wt(t,[{key:"_handleExpirationChange",value:function(e,t){var a=Ht({},this.state.expirationType,Vt({},e,t.target.value));"SPECIFIC"!==t.target.value&&E.a.setExchangeLastExpiration(Ht({},this.props.exchange.has("lastExpiration")&&this.props.exchange.get("lastExpiration").toJS()||{},Vt({},e,t.target.value))),this.setState({expirationType:a})}},{key:"_handleCustomExpirationChange",value:function(e,t){var a=Ht({},this.state.expirationCustomTime,Vt({},e,t));this.setState({expirationCustomTime:a})}},{key:"_initialState",value:function(e){var t=e.viewSettings,a={forSaleText:"",toReceiveText:"",priceText:"",for_sale:new oe.a({asset_id:e.baseAsset.get("id"),precision:e.baseAsset.get("precision")}),to_receive:new oe.a({asset_id:e.quoteAsset.get("id"),precision:e.quoteAsset.get("precision")})};a.price=new oe.h({base:a.for_sale,quote:a.to_receive});var r={forSaleText:"",toReceiveText:"",priceText:"",for_sale:new oe.a({asset_id:e.quoteAsset.get("id"),precision:e.quoteAsset.get("precision")}),to_receive:new oe.a({asset_id:e.baseAsset.get("id"),precision:e.baseAsset.get("precision")})};return r.price=new oe.h({base:r.for_sale,quote:r.to_receive}),{history:[],buySellOpen:t.get("buySellOpen",!0),bid:a,ask:r,flipBuySell:t.get("flipBuySell",!1),favorite:!1,showDepthChart:t.get("showDepthChart",!1),leftOrderBook:t.get("leftOrderBook",!0),buyDiff:!1,sellDiff:!1,buySellTop:t.get("buySellTop",!0),buyFeeAssetIdx:t.get("buyFeeAssetIdx",0),sellFeeAssetIdx:t.get("sellFeeAssetIdx",0),height:window.innerHeight,width:window.innerWidth,hidePanel:!1,chartHeight:t.get("chartHeight",600),currentPeriod:t.get("currentPeriod",7776e3)}}},{key:"_getLastMarketKey",value:function(){var e=qt.Apis.instance().chain_id;return"lastMarket"+(e?"_"+e.substr(0,8):"")}},{key:"componentWillMount",value:function(){this._checkFeeStatus()}},{key:"componentDidMount",value:function(){f.a.getTrackedGroupsConfig(),E.a.changeViewSetting.defer(Vt({},this._getLastMarketKey(),this.props.quoteAsset.get("symbol")+"_"+this.props.baseAsset.get("symbol"))),window.addEventListener("resize",this._getWindowSize,{capture:!1,passive:!0})}},{key:"shouldComponentUpdate",value:function(e,t){if(!e.marketReady&&!this.props.marketReady)return!1;var a=!1;for(var r in e)if(e.hasOwnProperty(r)&&(a=a||!y.a.are_equal_shallow(e[r],this.props[r])))break;return a||!y.a.are_equal_shallow(t,this.state)}},{key:"_checkFeeStatus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[this.props.coreAsset,this.props.baseAsset,this.props.quoteAsset],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props.currentAccount,r={},n=[];t.forEach(function(e){n.push(Object(It.b)({accountID:a.get("id"),feeID:e.get("id"),type:"limit_order_create"}))}),Promise.all(n).then(function(a){t.forEach(function(e,t){r[e.get("id")]=a[t]}),y.a.are_equal_shallow(e.state.feeStatus,r)||e.setState({feeStatus:r})}).catch(function(t){console.log("checkFeeStatusAsync error",t),e.setState({feeStatus:{}})})}},{key:"_getWindowSize",value:function(){var e=window,t=e.innerHeight,a=e.innerWidth;if(t!==this.state.height||a!==this.state.width){this.setState({height:t,width:a});var r=this.refs.center;r&&_.a.update(r)}}},{key:"componentDidUpdate",value:function(e,t){if(this._initPsContainer(),!this.props.exchange.get("tutorialShown")&&e.coreAsset&&t.feeStatus&&!this.tutorialShown){this.tutorialShown=!0;var a=this.props.settings.get("themes");Mt.a.introJs().setOptions({tooltipClass:a,highlightClass:a,showBullets:!1,hideNext:!0,hidePrev:!0,nextLabel:K.a.translate("walkthrough.next_label"),prevLabel:K.a.translate("walkthrough.prev_label"),skipLabel:K.a.translate("walkthrough.skip_label"),doneLabel:K.a.translate("walkthrough.done_label")}).start(),E.a.setExchangeTutorialShown.defer(!0)}}},{key:"_initPsContainer",value:function(){if(this.refs.center&&this.psInit){var e=this.refs.center;e&&(_.a.initialize(e),this.psInit=!1)}}},{key:"componentWillReceiveProps",value:function(e){if(this._initPsContainer(),e.quoteAsset===this.props.quoteAsset&&e.baseAsset===this.props.baseAsset&&e.currentAccount===this.props.currentAccount||this._checkFeeStatus([e.coreAsset,e.baseAsset,e.quoteAsset],e.currentAccount),e.quoteAsset.get("symbol")!==this.props.quoteAsset.get("symbol")||e.baseAsset.get("symbol")!==this.props.baseAsset.get("symbol"))return this.setState(this._initialState(e)),E.a.changeViewSetting(Vt({},this._getLastMarketKey(),e.quoteAsset.get("symbol")+"_"+e.baseAsset.get("symbol")))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._getWindowSize)}},{key:"_getFeeAssets",value:function(e,t,a){var r=this,n=this.props.currentAccount,o=this.state.feeStatus;function s(e,t){-1===e.indexOf(t)&&e.push(t)}var i=[a,e===a?t:e];s(i,e),s(i,t);var l=[a,t===a?e:t];s(l,e),s(l,t);var c={};function u(e,t,r){var n=void 0;return(e=e.filter(function(e){return!!t[e.get("id")]&&(function(e){return o[e]&&o[e].hasPoolBalance}(e.get("id"))&&function(e){return o[e]&&o[e].hasBalance}(e.get("id")))})).length?n=e[Math.min(e.length-1,r)]:(n=a,e.push(a)),{assets:e,asset:n}}n.get("balances",[]).filter(function(a,r){return["1.3.0",e.get("id"),t.get("id")].indexOf(r)>=0}).forEach(function(e,t){var a=J.ChainStore.getObject(e);c[t]={balance:a?parseInt(a.get("balance"),10):0,fee:r._getFee(J.ChainStore.getAsset(t))}});var p=u(i,c,this.state.sellFeeAssetIdx),d=p.assets,m=p.asset,h=u(l,c,this.state.buyFeeAssetIdx),f=h.assets,g=h.asset;return{sellFeeAsset:m,sellFeeAssets:d,sellFee:this._getFee(m),buyFeeAsset:g,buyFeeAssets:f,buyFee:this._getFee(g)}}},{key:"_getFee",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.coreAsset;return this.state.feeStatus[e.get("id")]&&this.state.feeStatus[e.get("id")].fee}},{key:"_verifyFee",value:function(e,t,a,r){var n=this._getFee();return"1.3.0"===e.asset_id?n.getAmount()<=r?"1.3.0":null:(t.asset_id===e.asset_id?e.getAmount()+t.getAmount():t.getAmount())<=a?e.asset_id:n.getAmount()<=r&&"1.3.0"!==e.asset_id?"1.3.0":null}},{key:"_createLimitOrderConfirm",value:function(e,t,a,r,n,o){var s=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];arguments[7].preventDefault();var i=this.props.marketData,l=i.highestBid,c=i.lowestAsk,u=this.state["sell"===o?"ask":"bid"];a=u.for_sale.clone(a?parseInt(J.ChainStore.getObject(a).toJS().balance,10):0),r=new oe.a({amount:r?parseInt(J.ChainStore.getObject(r).toJS().balance,10):0});var p=this._getFee(n),d=this._verifyFee(p,u.for_sale,a.getAmount(),r.getAmount());if(!d)return ot.a.addNotification({message:"Insufficient funds to pay fees",level:"error"});if("buy"===o&&c){var m=this.state.bid.price.toReal()/c.getPrice();if(m>1.2)return this.refs.buy.show(),this.setState({buyDiff:m})}else if("sell"===o&&l){var h=1/(this.state.ask.price.toReal()/l.getPrice());if(h>1.2)return this.refs.sell.show(),this.setState({sellDiff:h})}var f=t.getIn(["bitasset","is_prediction_market"]);return u.for_sale.gt(a)&&!f?ot.a.addNotification({message:"Insufficient funds to place order, you need at least "+u.for_sale.getAmount({real:!0})+" "+t.get("symbol"),level:"error"}):u.for_sale.getAmount()>0&&u.to_receive.getAmount()>0?"sell"===o&&f&&s?this._createPredictionShort(d):void this._createLimitOrder(o,d):ot.a.addNotification({message:"Please enter a valid amount and price",level:"error"})}},{key:"_createLimitOrder",value:function(e,t){var a="sell"===e?"ask":"bid",r=this.state[a],n=null;n="SPECIFIC"===this.state.expirationType[a]?this.EXPIRATIONS[this.state.expirationType[a]].get(a):this.EXPIRATIONS[this.state.expirationType[a]].get();var o=new oe.g({for_sale:r.for_sale,expiration:new Date(n||!1),to_receive:r.to_receive,seller:this.props.currentAccount.get("id"),fee:{asset_id:t,amount:0}}),s=V.a.getMarketName(this.props.baseAsset,this.props.quoteAsset),i=s.marketName,l=s.first,c=this.props.marketDirections.get(i);if(c&&l.get("id")!==this.props.baseAsset.get("id")||!c&&l.get("id")!==this.props.baseAsset.get("id")){var u={};u[i]=!c,E.a.changeMarketDirection(u)}return console.log("order:",JSON.stringify(o.toObject())),f.a.createLimitOrder2(o).then(function(e){e.error&&"wallet locked"!==e.error.message&&ot.a.addNotification({message:"Unknown error. Failed to place order for "+r.to_receive.getAmount({real:!0})+" "+r.to_receive.asset_id,level:"error"})}).catch(function(e){console.log("order failed:",e)})}},{key:"_createPredictionShort",value:function(e){var t=this.state.ask,a=new oe.g({for_sale:t.for_sale,to_receive:t.to_receive,seller:this.props.currentAccount.get("id"),fee:{asset_id:e,amount:0}});Promise.all([Object(J.FetchChain)("getAsset",this.props.quoteAsset.getIn(["bitasset","options","short_backing_asset"]))]).then(function(e){var t=Ut(e,1)[0],r=new oe.a({amount:a.amount_for_sale.getAmount(),asset_id:t.get("id"),precision:t.get("precision")});f.a.createPredictionShort(a,r).then(function(e){e.error&&"wallet locked"!==e.error.message&&ot.a.addNotification({message:"Unknown error. Failed to place order for "+buyAssetAmount+" "+buyAsset.symbol,level:"error"})})})}},{key:"_forceBuy",value:function(e,t,a,r){var n=this.state["sell"===e?"ask":"bid"];a=n.for_sale.clone(a?parseInt(J.ChainStore.getObject(a).get("balance"),10):0),r=new oe.a({amount:r?parseInt(J.ChainStore.getObject(r).toJS().balance,10):0});var o=this._getFee(t),s=this._verifyFee(o,n.for_sale,a.getAmount(),r.getAmount());s?this._createLimitOrder(e,s):console.error("Unable to pay fees, aborting limit order creation")}},{key:"_forceSell",value:function(e,t,a,r){var n=this.state["sell"===e?"ask":"bid"];a=n.for_sale.clone(a?parseInt(J.ChainStore.getObject(a).get("balance"),10):0),r=new oe.a({amount:r?parseInt(J.ChainStore.getObject(r).toJS().balance,10):0});var o=this._getFee(t),s=this._verifyFee(o,n.for_sale,a.getAmount(),r.getAmount());s?this._createLimitOrder(e,s):console.error("Unable to pay fees, aborting limit order creation")}},{key:"_cancelLimitOrder",value:function(e,t){t.preventDefault();var a=this.props.currentAccount;f.a.cancelLimitOrder(a.get("id"),e)}},{key:"_changeZoomPeriod",value:function(e,t){t.preventDefault(),e!==this.state.currentPeriod&&(this.setState({currentPeriod:e}),E.a.changeViewSetting({currentPeriod:e}))}},{key:"_depthChartClick",value:function(e,t,a){a.preventDefault();var r=this.state,n=r.bid,o=r.ask;n.price=new oe.h({base:this.state.bid.for_sale,quote:this.state.bid.to_receive,real:a.xAxis[0].value}),n.priceText=n.price.toReal(),o.price=new oe.h({base:this.state.ask.to_receive,quote:this.state.ask.for_sale,real:a.xAxis[0].value}),o.priceText=o.price.toReal();var s={bid:n,ask:o,depthLine:n.price.toReal()};this._setForSale(n,!0)||this._setReceive(n,!0),this._setReceive(o)||this._setForSale(o),this._setPriceText(n,!0),this._setPriceText(o,!1),this.setState(s)}},{key:"_togglePanel",value:function(){this.setState({hidePanel:!this.state.hidePanel})}},{key:"_flipBuySell",value:function(){this.setState({flipBuySell:!this.state.flipBuySell}),E.a.changeViewSetting({flipBuySell:!this.state.flipBuySell})}},{key:"_toggleOpenBuySell",value:function(){E.a.changeViewSetting({buySellOpen:!this.state.buySellOpen}),this.setState({buySellOpen:!this.state.buySellOpen})}},{key:"_toggleCharts",value:function(){E.a.changeViewSetting({showDepthChart:!this.state.showDepthChart}),this.setState({showDepthChart:!this.state.showDepthChart})}},{key:"_toggleMarketPicker",value:function(e){var t=!!e;this.setState({showMarketPicker:t,marketPickerAsset:e})}},{key:"_moveOrderBook",value:function(){E.a.changeViewSetting({leftOrderBook:!this.state.leftOrderBook}),this.setState({leftOrderBook:!this.state.leftOrderBook})}},{key:"_currentPriceClick",value:function(e,t){var a="bid"===e,r=this.state[e];r.price=t[a?"invert":"clone"](),r.priceText=r.price.toReal(),a?this._setForSale(r,a)||this._setReceive(r,a):this._setReceive(r,a)||this._setForSale(r,a),this.forceUpdate()}},{key:"_orderbookClick",value:function(e){var t=e.isBid(),a=e.totalToReceive({noCache:!0}),r=a.times(e.sellPrice()),n=new oe.h({base:t?r:a,quote:t?a:r}),o=this.state[t?"bid":"ask"];o.price=n,o.priceText=n.toReal();var s=Vt({},t?"ask":"bid",{for_sale:a,forSaleText:a.getAmount({real:!0}),to_receive:r,toReceiveText:r.getAmount({real:!0}),price:n,priceText:n.toReal()});t?this._setForSale(o,t)||this._setReceive(o,t):this._setReceive(o,t)||this._setForSale(o,t),this.setState(s)}},{key:"_borrowQuote",value:function(){this.refs.borrowQuote.show()}},{key:"_borrowBase",value:function(){this.refs.borrowBase.show()}},{key:"_getSettlementInfo",value:function(){var e=this.props,t=e.lowestCallPrice,a=e.feedPrice,r=e.quoteAsset,n=!1;return a&&(n=a.inverted?t<=a.toReal():t>=a.toReal()),!(!n||!t||r.getIn(["bitasset","is_prediction_market"]))}},{key:"onChangeFeeAsset",value:function(e,t){t.preventDefault(),"buy"===e?(this.setState({buyFeeAssetIdx:t.target.value}),E.a.changeViewSetting({buyFeeAssetIdx:t.target.value})):(this.setState({sellFeeAssetIdx:t.target.value}),E.a.changeViewSetting({sellFeeAssetIdx:t.target.value}))}},{key:"onChangeChartHeight",value:function(e){var t=e.value,a=e.increase,r=t||this.state.chartHeight+(a?20:-20);this.setState({chartHeight:r}),E.a.changeViewSetting({chartHeight:r})}},{key:"_toggleBuySellPosition",value:function(){this.setState({buySellTop:!this.state.buySellTop}),E.a.changeViewSetting({buySellTop:!this.state.buySellTop})}},{key:"_setReceive",value:function(e,t){return!(!e.price.isValid()||!e.for_sale.hasAmount())&&(e.to_receive=e.for_sale.times(e.price),e.toReceiveText=e.to_receive.getAmount({real:!0}).toString(),!0)}},{key:"_setForSale",value:function(e,t){return!(!e.price.isValid()||!e.to_receive.hasAmount())&&(e.for_sale=e.to_receive.times(e.price,!0),e.forSaleText=e.for_sale.getAmount({real:!0}).toString(),!0)}},{key:"_setPrice",value:function(e){return!(!e.for_sale.hasAmount()||!e.to_receive.hasAmount())&&(e.price=new oe.h({base:e.for_sale,quote:e.to_receive}),e.priceText=e.price.toReal().toString(),!0)}},{key:"_setPriceText",value:function(e,t){var a=e[t?"for_sale":"to_receive"],r=e[t?"to_receive":"for_sale"];a.hasAmount()&&r.hasAmount()&&(e.priceText=new oe.h({base:a,quote:r}).toReal().toString())}},{key:"_onInputPrice",value:function(e,t){var a=this.state[e],r="bid"===e;a.price=new oe.h({base:a[r?"for_sale":"to_receive"],quote:a[r?"to_receive":"for_sale"],real:parseFloat(t.target.value)||0}),r?this._setForSale(a,r)||this._setReceive(a,r):this._setReceive(a,r)||this._setForSale(a,r),a.priceText=t.target.value,this.forceUpdate()}},{key:"_onInputSell",value:function(e,t,a){var r=this.state[e];r.for_sale.setAmount({real:parseFloat(a.target.value)||0}),r.price.isValid()?this._setReceive(r,t):this._setPrice(r),r.forSaleText=a.target.value,this._setPriceText(r,"bid"===e),this.forceUpdate()}},{key:"_onInputReceive",value:function(e,t,a){var r=this.state[e];r.to_receive.setAmount({real:parseFloat(a.target.value)||0}),r.price.isValid()?this._setForSale(r,t):this._setPrice(r),r.toReceiveText=a.target.value,this._setPriceText(r,"bid"===e),this.forceUpdate()}},{key:"isMarketFrozen",value:function(){var e=this.props,t=e.baseAsset,a=e.quoteAsset,r=t.getIn(["options","whitelist_markets"]).toJS(),n=a.getIn(["options","whitelist_markets"]).toJS(),o=t.getIn(["options","blacklist_markets"]).toJS(),s=a.getIn(["options","blacklist_markets"]).toJS();return n.length&&-1===n.indexOf(t.get("id"))?{isFrozen:!0,frozenAsset:a.get("symbol")}:r.length&&-1===r.indexOf(a.get("id"))?{isFrozen:!0,frozenAsset:t.get("symbol")}:s.length&&-1!==s.indexOf(t.get("id"))?{isFrozen:!0,frozenAsset:a.get("symbol")}:o.length&&-1!==o.indexOf(a.get("id"))?{isFrozen:!0,frozenAsset:t.get("symbol")}:{isFrozen:!1}}},{key:"_toggleChat",value:function(){E.a.changeViewSetting({viewChat:!this.props.viewChat})}},{key:"_toggleMiniChart",value:function(){E.a.changeViewSetting({miniDepthChart:!this.props.miniDepthChart})}},{key:"_onGroupOrderLimitChange",value:function(e){var t=this;e&&e.preventDefault();var a=parseInt(e.target.value);if(f.a.changeCurrentGroupLimit(a),a!==this.props.currentGroupOrderLimit){f.a.changeCurrentGroupLimit(a);var r=this.props.sub.split("_");f.a.unSubscribeMarket(r[0],r[1]).then(function(){t.props.subToMarket(t.props,t.props.bucketSize,a)})}}},{key:"render",value:function(){var e=this.props,t=e.currentAccount,a=e.marketLimitOrders,r=e.marketCallOrders,o=e.marketData,s=e.activeMarketHistory,i=e.invertedCalls,l=e.starredMarkets,c=e.quoteAsset,u=e.baseAsset,p=e.lowestCallPrice,d=e.marketStats,m=e.marketReady,h=e.marketSettleOrders,f=e.bucketSize,b=e.totals,_=e.feedPrice,y=e.buckets,v=e.coreAsset,E=e.trackedGroupsConfig,w=e.currentGroupOrderLimit,A=o.combinedBids,S=o.combinedAsks,x=o.lowestAsk,N=o.highestBid,O=o.flatBids,P=o.flatAsks,T=o.flatCalls,F=o.flatSettles,j=o.groupedBids,q=o.groupedAsks,I=this.state,R=I.bid,B=I.ask,L=I.leftOrderBook,D=I.showDepthChart,M=I.chartHeight,z=I.buyDiff,H=I.sellDiff,W=I.width,V=I.buySellTop,G=I.hidePanel,J=this.isMarketFrozen(),Q=J.isFrozen,K=J.frozenAsset,Y=null,X=null,Z=null,$=null,ee=null,te=null,ae=void 0,re=void 0,ne=!1,oe=void 0,se=void 0,ie=this.props.viewSettings.get("showVolumeChart",!0);if(c.size&&u.size&&t.size){if(X=c,re=(Y=u).get("symbol"),ae=X.get("symbol"),Z=t.get("balances").toJS())for(var le in Z)le===X.get("id")&&($=Z[le]),le===Y.get("id")&&(ee=Z[le]),"1.3.0"===le&&(te=Z[le]);ne=this._getSettlementInfo()}var ce=!!c.get("bitasset_data_id"),de=!!u.get("bitasset_data_id"),me=x&&N?x.getPrice()-N.getPrice():0;if(s.size){var he=s.take(2);oe=he.first();var fe=he.last();se=oe.getPrice()===fe.getPrice()?"":oe.getPrice()-fe.getPrice()>0?"change-up":"change-down"}if(!v||!Object.keys(this.state.feeStatus).length)return null;var ge=this._getFeeAssets(X,Y,v),be=ge.sellFeeAsset,ye=ge.sellFeeAssets,ve=ge.sellFee,ke=ge.buyFeeAsset,Ee=ge.buyFeeAssets,we=ge.buyFee,Ce=Y.getIn(["bitasset","is_prediction_market"])||X.getIn(["bitasset","is_prediction_market"]),Ae=null;Ce&&(Ae=c.getIn(["options","description"]),Ae=_e.a.parseDescription(Ae).main);var xe=!1;W<1e3&&(xe=!0,L=!1);var Ne=L?2:1,Pe=(Math.max(this.state.height>1100?M:M-125,300),this.state.expirationType),Te=this.state.expirationCustomTime,Fe=!G&&!xe,je=xe?null:n.a.createElement("div",{className:"clickable",style:{width:"auto",paddingTop:"calc(50vh - 120px)"},onClick:this._togglePanel.bind(this)},n.a.createElement(zt.Icon,{type:G?"caret-left":"caret-right"})),qe=Q?null:n.a.createElement(Se,{onBorrow:de?this._borrowBase.bind(this):null,currentAccount:t,backedCoin:this.props.backedCoins.find(function(e){return e.symbol===Y.get("symbol")}),currentBridges:this.props.bridgeCoins.get(Y.get("symbol"))||null,smallScreen:xe,isOpen:this.state.buySellOpen,onToggleOpen:this._toggleOpenBuySell.bind(this),className:C()("small-12 no-padding middle-content",L||xe?"medium-6":"medium-6 xlarge-4",this.state.flipBuySell?"order-"+(V?2:5*Ne)+" sell-form":"order-"+(V?1:4*Ne)+" buy-form"),type:"bid",expirationType:Pe.bid,expirations:this.EXPIRATIONS,expirationCustomTime:Te.bid,onExpirationTypeChange:this._handleExpirationChange.bind(this,"bid"),onExpirationCustomChange:this._handleCustomExpirationChange.bind(this,"bid"),amount:R.toReceiveText,price:R.priceText,total:R.forSaleText,quote:X,base:Y,amountChange:this._onInputReceive.bind(this,"bid",!0),priceChange:this._onInputPrice.bind(this,"bid"),setPrice:this._currentPriceClick.bind(this),totalChange:this._onInputSell.bind(this,"bid",!1),balance:ee,balanceId:Y.get("id"),onSubmit:this._createLimitOrderConfirm.bind(this,X,Y,ee,te,ke,"buy"),balancePrecision:Y.get("precision"),quotePrecision:X.get("precision"),totalPrecision:Y.get("precision"),currentPrice:x.getPrice(),currentPriceObject:x,account:t.get("name"),fee:we,hasFeeBalance:this.state.feeStatus[we.asset_id].hasBalance,feeAssets:Ee,feeAsset:ke,onChangeFeeAsset:this.onChangeFeeAsset.bind(this,"buy"),isPredictionMarket:Y.getIn(["bitasset","is_prediction_market"]),onFlip:this.state._flipBuySell?null:this._flipBuySell.bind(this),onTogglePosition:this.state._toggleBuySellPosition?null:this._toggleBuySellPosition.bind(this)}),Ie=Q?null:n.a.createElement(Se,{onBorrow:ce?this._borrowQuote.bind(this):null,currentAccount:t,backedCoin:this.props.backedCoins.find(function(e){return e.symbol===X.get("symbol")}),currentBridges:this.props.bridgeCoins.get(X.get("symbol"))||null,smallScreen:xe,isOpen:this.state.buySellOpen,onToggleOpen:this._toggleOpenBuySell.bind(this),className:C()("small-12 no-padding middle-content",L||xe?"medium-6":"medium-6 xlarge-4",this.state.flipBuySell?"order-"+(V?1:4*Ne)+" buy-form":"order-"+(V?2:5*Ne)+" sell-form"),type:"ask",amount:B.forSaleText,price:B.priceText,total:B.toReceiveText,quote:X,base:Y,expirationType:Pe.ask,expirations:this.EXPIRATIONS,expirationCustomTime:Te.ask,onExpirationTypeChange:this._handleExpirationChange.bind(this,"ask"),onExpirationCustomChange:this._handleCustomExpirationChange.bind(this,"ask"),amountChange:this._onInputSell.bind(this,"ask",!1),priceChange:this._onInputPrice.bind(this,"ask"),setPrice:this._currentPriceClick.bind(this),totalChange:this._onInputReceive.bind(this,"ask",!0),balance:$,balanceId:X.get("id"),onSubmit:this._createLimitOrderConfirm.bind(this,Y,X,$,te,be,"sell"),balancePrecision:X.get("precision"),quotePrecision:X.get("precision"),totalPrecision:Y.get("precision"),currentPrice:N.getPrice(),currentPriceObject:N,account:t.get("name"),fee:ve,hasFeeBalance:this.state.feeStatus[ve.asset_id].hasBalance,feeAssets:ye,feeAsset:be,onChangeFeeAsset:this.onChangeFeeAsset.bind(this,"sell"),isPredictionMarket:X.getIn(["bitasset","is_prediction_market"]),onFlip:this.state._flipBuySell?null:this._flipBuySell.bind(this),onTogglePosition:this.state._toggleBuySellPosition?null:this._toggleBuySellPosition.bind(this)}),Re=n.a.createElement(U,{latest:oe&&oe.getPrice(),changeClass:se,orders:a,calls:r,invertedCalls:i,combinedBids:A,combinedAsks:S,highestBid:N,lowestAsk:x,totalBids:b.bid,totalAsks:b.ask,base:Y,quote:X,baseSymbol:re,quoteSymbol:ae,onClick:this._orderbookClick.bind(this),horizontal:!L,moveOrderBook:this._moveOrderBook.bind(this),flipOrderBook:this.props.viewSettings.get("flipOrderBook"),marketReady:m,wrapperClass:"order-"+(V?3:1)+" xlarge-order-"+(V?4:1),currentAccount:this.props.currentAccount.get("id"),handleGroupOrderLimitChange:this._onGroupOrderLimitChange.bind(this),trackedGroupsConfig:E,currentGroupOrderLimit:w,groupedBids:j,groupedAsks:q});return n.a.createElement("div",{className:"grid-block vertical"},this.props.marketReady?null:n.a.createElement(Oe.a,null),n.a.createElement(jt,{account:this.props.currentAccount,quoteAsset:c,baseAsset:u,hasPrediction:Ce,starredMarkets:l,lowestAsk:x,highestBid:N,lowestCallPrice:p,showCallLimit:ne,feedPrice:_,marketReady:m,latestPrice:oe&&oe.getPrice(),showDepthChart:D,marketStats:d,onToggleCharts:this._toggleCharts.bind(this),onToggleMarketPicker:this._toggleMarketPicker.bind(this),showVolumeChart:ie,chartHeight:M,onChangeChartHeight:this.onChangeChartHeight.bind(this)}),n.a.createElement("div",{className:"grid-block page-layout market-layout"},this.state.showMarketPicker?n.a.createElement(Le,Ht({marketPickerAsset:this.state.marketPickerAsset,onToggleMarketPicker:this._toggleMarketPicker.bind(this)},this.props)):null,n.a.createElement(bt,null),L?n.a.createElement("div",{className:"grid-block left-column shrink no-overflow"},Re):null,n.a.createElement("div",{style:{paddingTop:0},className:C()("grid-block main-content vertical no-overflow")},n.a.createElement("div",{className:"grid-block vertical no-padding ps-container",id:"CenterContent",ref:"center"},D?n.a.createElement("div",{className:"grid-block vertical no-padding shrink"},n.a.createElement(rt,{marketReady:m,orders:a,showCallLimit:ne,call_orders:r,flat_asks:P,flat_bids:O,flat_calls:ne?T:[],flat_settles:this.props.settings.get("showSettles")&&F,settles:h,invertedCalls:i,totalBids:b.bid,totalAsks:b.ask,base:Y,quote:X,height:this.state.height>1100?M:M-150,onClick:this._depthChartClick.bind(this,Y,X),feedPrice:!Ce&&_&&_.toReal(),spread:me,LCP:ne?p:null,leftOrderBook:L,hasPrediction:Ce,noFrame:!1,verticalOrderbook:L,theme:this.props.settings.get("themes"),centerRef:this.refs.center})):n.a.createElement("div",{className:"grid-block shrink no-overflow",id:"market-charts"},n.a.createElement(Xe,{locale:this.props.locale,dataFeed:this.props.dataFeed,baseSymbol:re,quoteSymbol:ae,leftOrderBook:L,marketReady:m,theme:this.props.settings.get("themes"),buckets:y,bucketSize:f,currentPeriod:this.state.currentPeriod,chartHeight:this.state.height>1100?M:M-150,mobile:W<800})),n.a.createElement("div",{className:"grid-block no-overflow wrap shrink"},Ce?n.a.createElement("div",{className:"small-12 no-overflow",style:{margin:"0 10px",lineHeight:"1.2rem"}},n.a.createElement("p",null,Ae)):null,Q?n.a.createElement("div",{className:"error small-12 no-overflow",style:{margin:"0 10px",lineHeight:"1.2rem"}},n.a.createElement(k.a,{content:"exchange.market_frozen",asset:K,component:"p"})):null,qe,Ie,n.a.createElement(ue,{className:C()(xe||L?"":"medium-6 xlarge-4","no-padding no-overflow middle-content small-12 medium-6 order-5 xlarge-order-3"),headerStyle:{paddingTop:0},history:s,currentAccount:t,myHistory:t.get("history"),base:Y,quote:X,baseSymbol:re,quoteSymbol:ae,marketReady:m}),L?null:Re,n.a.createElement(vt,{type:"buy",ref:"buy",onForce:this._forceBuy.bind(this,"buy",ke,ee,te),diff:z,hasOrders:S.length>0}),n.a.createElement(vt,{type:"sell",ref:"sell",onForce:this._forceSell.bind(this,"sell",be,$,te),diff:H,hasOrders:A.length>0}),a.size>0&&Y&&X?n.a.createElement(g.a,{smallScreen:this.props.smallScreen,className:C()(xe||L?"":"medium-6 xlarge-4","small-12 medium-6 no-padding align-spaced ps-container middle-content order-6"),key:"open_orders",orders:a,settleOrders:h,currentAccount:t,base:Y,quote:X,baseSymbol:re,quoteSymbol:ae,activeTab:this.props.viewSettings.get("ordersTab"),onCancel:this._cancelLimitOrder.bind(this),flipMyOrders:this.props.viewSettings.get("flipMyOrders"),feedPrice:this.props.feedPrice}):null))),n.a.createElement("div",{className:"grid-block shrink right-column no-overflow",style:{maxWidth:450}},je,Fe?n.a.createElement("div",{style:{minWidth:358},className:"grid-block shrink right-column no-overflow vertical no-padding"},n.a.createElement("div",{className:"grid-block no-padding no-margin vertical"},n.a.createElement(pe.a,{className:"left-order-book no-padding no-overflow",headerStyle:{paddingTop:0},columns:[{name:"star",index:1},{name:"market",index:2},{name:"vol",index:3},{name:"price",index:4},{name:"change",index:5}],findColumns:[{name:"market",index:1},{name:"issuer",index:2},{name:"vol",index:3},{name:"add",index:4}],current:ae+"_"+re,location:this.props.location,history:this.props.history})),n.a.createElement("div",{style:{padding:this.props.viewChat?"0 0 0 0":0},className:"grid-block no-margin vertical shrink"},n.a.createElement("div",{onClick:this._toggleChat.bind(this),className:"exchange-content-header clickable",style:{textAlign:"left",paddingRight:10}},this.props.viewChat?n.a.createElement("span",null,"▼"):n.a.createElement("span",null,"▲"),n.a.createElement(k.a,{content:"exchange.trollbox"})),this.props.viewChat?n.a.createElement(Lt,{height:"300px"}):null),n.a.createElement("div",{style:{padding:this.props.miniDepthChart?"0 0 40px 0":0},className:"grid-block no-margin vertical shrink"},n.a.createElement("div",{onClick:this._toggleMiniChart.bind(this),className:"exchange-content-header clickable",style:{textAlign:"left",paddingRight:10}},this.props.miniDepthChart?n.a.createElement("span",null,"▼"):n.a.createElement("span",null,"▲")),this.props.miniDepthChart?n.a.createElement(rt,{marketReady:m,orders:a,showCallLimit:ne,call_orders:r,flat_asks:P,flat_bids:O,flat_calls:ne?T:[],flat_settles:this.props.settings.get("showSettles")&&F,settles:h,invertedCalls:i,totalBids:b.bid,totalAsks:b.ask,base:Y,quote:X,height:200,onClick:this._depthChartClick.bind(this,Y,X),settlementPrice:!Ce&&_&&_.toReal(),spread:me,LCP:ne?p:null,leftOrderBook:L,hasPrediction:Ce,noText:!0,theme:this.props.settings.get("themes")}):null)):null),ce?n.a.createElement(nt.a,{ref:"borrowQuote",modalId:"borrow_modal_quote_"+c.get("id"),quote_asset:c.get("id"),backing_asset:c.getIn(["bitasset","options","short_backing_asset"]),account:t}):null,de?n.a.createElement(nt.a,{ref:"borrowBase",modalId:"borrow_modal_base_"+u.get("id"),quote_asset:u.get("id"),backing_asset:u.getIn(["bitasset","options","short_backing_asset"]),account:t}):null))}}]),t}();Gt.propTypes={marketCallOrders:h.a.object.isRequired,activeMarketHistory:h.a.object.isRequired,viewSettings:h.a.object.isRequired},Gt.defaultProps={marketCallOrders:[],activeMarketHistory:{},viewSettings:{}};var Jt=Gt,Qt=a(537),Kt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Yt=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();function Xt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zt(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 $t(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 ea=function(e){function t(){return Xt(this,t),Zt(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return $t(t,n.a.Component),Yt(t,[{key:"render",value:function(){var e=this.props.match.params.marketID.toUpperCase().split("_");return e[0]===e[1]?n.a.createElement(Qt.a,{subtitle:"market_not_found_subtitle"}):n.a.createElement(p.a,{stores:[o.a,s.a,i.a,u.a,c.a],inject:{locale:function(){return c.a.getState().currentLocale},lockedWalletState:function(){return u.a.getState().locked},marketLimitOrders:function(){return o.a.getState().marketLimitOrders},marketCallOrders:function(){return o.a.getState().marketCallOrders},invertedCalls:function(){return o.a.getState().invertedCalls},marketSettleOrders:function(){return o.a.getState().marketSettleOrders},marketData:function(){return o.a.getState().marketData},totals:function(){return o.a.getState().totals},activeMarketHistory:function(){return o.a.getState().activeMarketHistory},bucketSize:function(){return o.a.getState().bucketSize},buckets:function(){return o.a.getState().buckets},lowestCallPrice:function(){return o.a.getState().lowestCallPrice},feedPrice:function(){return o.a.getState().feedPrice},currentAccount:function(){return s.a.getState().currentAccount},myActiveAccounts:function(){return s.a.getState().myActiveAccounts},viewSettings:function(){return i.a.getState().viewSettings},settings:function(){return i.a.getState().settings},exchange:function(){return i.a.getState().exchange},starredMarkets:function(){return i.a.getState().starredMarkets},marketDirections:function(){return i.a.getState().marketDirections},marketStats:function(){return o.a.getState().marketStats},marketReady:function(){return o.a.getState().marketReady},backedCoins:function(){return l.a.getState().backedCoins.get("OPEN",[])},bridgeCoins:function(){return l.a.getState().bridgeCoins},miniDepthChart:function(){return i.a.getState().viewSettings.get("miniDepthChart",!0)},viewChat:function(){return i.a.getState().viewSettings.get("viewChat",!0)},dataFeed:function(){return new Je},trackedGroupsConfig:function(){return o.a.getState().trackedGroupsConfig},currentGroupOrderLimit:function(){return o.a.getState().currentGroupLimit}}},n.a.createElement(ia,{history:this.props.history,location:this.props.location,quoteAsset:e[0],baseAsset:e[1]}))}}]),t}(),ta=Object(J.EmitterInstance)(),aa=void 0,ra=void 0,na=void 0,oa=void 0,sa=void 0,ia=function(e){function t(e){Xt(this,t);var a=Zt(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={sub:null},a._subToMarket=a._subToMarket.bind(a),a}return $t(t,n.a.Component),Yt(t,[{key:"componentWillMount",value:function(){var e=this;null!==this.props.quoteAsset&&null!==this.props.baseAsset&&(this.props.quoteAsset.toJS&&this.props.baseAsset.toJS&&this._subToMarket(this.props),ta.on("cancel-order",ra=f.a.cancelLimitOrderSuccess),ta.on("close-call",aa=f.a.closeCallOrderSuccess),ta.on("call-order-update",na=function(t){var a=t.call_price.base.asset_id,r=t.call_price.quote.asset_id,n=e.props.baseAsset.get("id"),o=e.props.quoteAsset.get("id");a!==n&&a!==o||r!==n&&r!==o||f.a.callOrderUpdate(t)}),ta.on("bitasset-update",oa=f.a.feedUpdate),ta.on("settle-order-update",sa=function(t){var a=market_utils.isMarketAsset(e.props.quoteAsset,e.props.baseAsset),r=a.isMarketAsset,n=a.marketAsset;r&&n.id===t.balance.asset_id&&f.a.settleOrderUpdate(n.id)}))}},{key:"componentWillReceiveProps",value:function(e){var t=this;if(null!==e.quoteAsset&&null!==e.baseAsset){if(e.baseAsset&&e.baseAsset.getIn(["bitasset","is_prediction_market"])&&this.props.history.push("/market/"+e.baseAsset.get("symbol")+"_"+e.quoteAsset.get("symbol")),e.quoteAsset&&e.baseAsset&&!this.state.sub)return this._subToMarket(e);if(e.quoteAsset.get("symbol")!==this.props.quoteAsset.get("symbol")||e.baseAsset.get("symbol")!==this.props.baseAsset.get("symbol")){var a=this.state.sub.split("_");f.a.unSubscribeMarket(a[0],a[1]).then(function(){t._subToMarket(e)})}}}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.quoteAsset,a=e.baseAsset;null!==t&&null!==a&&(f.a.unSubscribeMarket(t.get("id"),a.get("id")),ta&&(ta.off("cancel-order",ra),ta.off("close-call",aa),ta.off("call-order-update",na),ta.off("bitasset-update",oa),ta.off("settle-order-update",sa)))}},{key:"_subToMarket",value:function(e,t,a){var r=e.quoteAsset,n=e.baseAsset,o=e.bucketSize,s=e.currentGroupOrderLimit;t&&(o=t),a&&(s=a),r.get("id")&&n.get("id")&&(f.a.subscribeMarket.defer(n,r,o,s),this.setState({sub:r.get("id")+"_"+n.get("id")}))}},{key:"render",value:function(){return null===this.props.quoteAsset||null===this.props.baseAsset?n.a.createElement(Qt.a,{subtitle:"market_not_found_subtitle"}):n.a.createElement(Jt,Kt({},this.props,{sub:this.state.sub,subToMarket:this._subToMarket}))}}]),t}();ia.propTypes={currentAccount:me.a.ChainAccount.isRequired,quoteAsset:me.a.ChainAsset.isRequired,baseAsset:me.a.ChainAsset.isRequired,coreAsset:me.a.ChainAsset.isRequired},ia.defaultProps={currentAccount:"1.2.3",coreAsset:"1.3.0"},ia=Object(he.a)(ia,{show_loader:!0});t.default=ea}}]);
//# sourceMappingURL=exchange.js.map