-
Notifications
You must be signed in to change notification settings - Fork 13
/
exchange.31d015beb0a120aa738c.js
1 lines (1 loc) · 243 KB
/
exchange.31d015beb0a120aa738c.js
1
(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[552],{69673:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>Os});var a=s(96540),r=s(58586),i=s(55840),n=s(74248),o=s(53615),l=s(92646),c=s(14644),d=s(57127),h=s(64741),p=s(62716),m=s(72090),u=s(46128),g=s(32485),b=s.n(g),_=s(10658),y=s.n(_),f=s(22176),A=s.n(f),E=s(95093),v=s.n(E),k=s(68477),S=s.n(k),C=s(5556),w=s.n(C),x=s(84259),N=s(36247),T=s(64143),P=s(88587),B=s(24609),F=s(15483),O=s(87040),M=s(80849),q=s.n(M),I=s(16e3),R=s(12569),L=s(72342);class D extends a.Component{render(){let{price:e,preFormattedPrice:t,quote:s,base:r}=this.props;if(!e&&!t)return null;let i=t||O.A.price_to_text(e,s,r);return i.full>=1?a.createElement("span",null,a.createElement("span",{className:"price-integer"},i.int,"."),i.dec?a.createElement("span",{className:"price-integer"},i.dec):null,i.trailing?a.createElement("span",{className:"price-decimal"},i.trailing):null):i.full>=.1?a.createElement("span",null,a.createElement("span",{className:"price-decimal"},i.int,"."),i.dec?a.createElement("span",{className:"price-integer"},i.dec):null,i.trailing?a.createElement("span",{className:"price-decimal"},i.trailing):null):a.createElement("span",null,a.createElement("span",{className:"price-decimal"},i.int,"."),i.dec?a.createElement("span",{className:"price-decimal"},i.dec):null,i.trailing?a.createElement("span",{className:"price-integer"},i.trailing):null)}}const V=D;var z=s(91001),H=s(63806),U=s(10344),W=s(36234),$=s(85551),j=s(39744);class G extends a.Component{static propTypes={balance:R.A.ChainObject,type:w().string,amountChange:w().func.isRequired,priceChange:w().func.isRequired,onSubmit:w().func.isRequired,onExpirationTypeChange:w().func.isRequired,onExpirationCustomChange:w().func.isRequired};static defaultProps={type:"bid"};constructor(){super(),this.state={forceReRender:!1,isSettleModalVisible:!1},this.showSettleModal=this.showSettleModal.bind(this),this.hideSettleModal=this.hideSettleModal.bind(this)}_forceRender(e){this.state.forceReRender&&this.setState({forceReRender:!1}),this.props.parentWidth!==e.parentWidth&&this.setState({forceReRender:!0})}shouldComponentUpdate(e,t){return this._forceRender(e,t),t.isSettleModalVisible!==this.state.isSettleModalVisible||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||e.parentWidth!==this.props.parentWidth||t.forceReRender!==this.state.forceReRender||e.singleColumnOrderForm!==this.props.singleColumnOrderForm||e.hideFunctionButtons!==this.props.hideFunctionButtons||t.isQuickDepositVisible!==this.state.isQuickDepositVisible}getDatePickerRef=e=>{this.datePricker=e};showSettleModal(){this.setState({isSettleModalVisible:!0})}hideSettleModal(){this.setState({isSettleModalVisible:!1})}_addBalance(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()}})}_setPrice(e){this.props.priceChange({target:{value:e.toString()}})}handleQuickDepositVisibleChange=e=>{this.setState({isQuickDepositVisible:e}),e&&setTimeout((()=>{j.A.rebuild()}),20)};onDeposit(){this.setState({isQuickDepositVisible:!1}),this.props.onDeposit()}onBuy(){this.setState({isQuickDepositVisible:!1}),this.props.onBuy()}onExpirationSelectChange=e=>{"SPECIFIC"===e.target.value?this.datePricker.picker.handleOpenChange(!0):this.datePricker.picker.handleOpenChange(!1),this.props.onExpirationTypeChange(e)};onExpirationSelectClick=e=>{"SPECIFIC"===e.target.value&&(this.firstClick&&(this.secondClick=!0),this.firstClick=!0,this.secondClick&&(this.datePricker.picker.handleOpenChange(!0),this.firstClick=!1,this.secondClick=!1))};onExpirationSelectBlur=()=>{this.firstClick=!1,this.secondClick=!1};render(){let{type:e,quote:t,base:s,amountChange:r,fee:n,isPredictionMarket:l,priceChange:c,onSubmit:d,balance:h,totalChange:p,balancePrecision:m,currentPrice:g,currentPriceObject:_,feeAsset:f,feeAssets:A,hasFeeBalance:E,hideHeader:k,verticalOrderForm:S}=this.props;const{expirationCustomTime:C}=this.props;let w,x,N,P=!!((this.refs.order_form?this.refs.order_form.clientWidth:0)<450||this.props.singleColumnOrderForm);this.props.amount&&(w=this.props.amount),this.props.price&&(x=this.props.price),this.props.total&&(N=this.props.total);let F=new B.Vd({amount:h?h.get("balance"):0,precision:m,asset_id:this.props.balanceId});const M=new B.Vd({amount:s.getIn(["options","max_market_fee"]),asset_id:s.get("asset_id"),precision:s.get("precision")}),R=new B.Vd({amount:t.getIn(["options","max_market_fee"]),asset_id:t.get("asset_id"),precision:t.get("precision")}),L=s.getIn(["options","market_fee_percent"])/100+"%",D=t.getIn(["options","market_fee_percent"])/100+"%",j=w?Math.min(R.getAmount({real:!0}),w*t.getIn(["options","market_fee_percent"])/1e4).toFixed(R.precision):0,G=w?Math.min(M.getAmount({real:!0}),N*s.getIn(["options","market_fee_percent"])/1e4).toFixed(M.precision):0,Q=T.A.getFlagBooleans(s.getIn(["options","flags"]),s.has("bitasset_data_id")),K=T.A.getFlagBooleans(t.getIn(["options","flags"]),t.has("bitasset_data_id")),{name:Y,prefix:J}=O.A.replaceName(this.props.base);var Z=Q.charge_market_fee?S?a.createElement(u.Tooltip,{title:y().translate("tooltip.market_fee",{percent:L,asset:(J||"")+Y})},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"}),", ",L),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{placeholder:"0.0",id:"baseMarketFee",defaultValue:G,value:G,addonAfter:a.createElement("span",null,a.createElement(z.A,{noTip:!0,name:s.get("symbol")}))})))):P?a.createElement(u.Tooltip,{title:y().translate("tooltip.market_fee",{percent:L,asset:(J||"")+Y})},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-3 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"}),", ",L),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{placeholder:"0.0",id:"baseMarketFee",defaultValue:G,value:G,addonAfter:a.createElement("span",null,a.createElement(z.A,{noTip:!0,name:s.get("symbol")}))})))):a.createElement(u.Tooltip,{title:y().translate("tooltip.market_fee",{percent:L,asset:(J||"")+Y})},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"}),", ",L),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{placeholder:"0.0",id:"baseMarketFee",defaultValue:G,value:G,addonAfter:a.createElement("span",null,a.createElement(z.A,{noTip:!0,name:s.get("symbol")}))})))):null;const{name:X,prefix:ee}=O.A.replaceName(this.props.quote);var te=K.charge_market_fee?S?a.createElement(u.Tooltip,{title:y().translate("tooltip.market_fee",{percent:D,asset:(ee||"")+X})},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"}),", ",D),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{placeholder:"0.0",id:"quoteMarketFee",defaultValue:j,value:j,addonAfter:a.createElement("span",null,a.createElement(z.A,{style:{width:100},noTip:!0,name:t.get("symbol")}))})))):P?a.createElement(u.Tooltip,{title:y().translate("tooltip.market_fee",{percent:D,asset:(ee||"")+X})},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-3 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"}),", ",D),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{placeholder:"0.0",id:"quoteMarketFee",defaultValue:j,value:j,addonAfter:a.createElement("span",null,a.createElement(z.A,{style:{width:100},noTip:!0,name:t.get("symbol")}))})))):a.createElement(u.Tooltip,{title:y().translate("tooltip.market_fee",{percent:D,asset:(ee||"")+X})},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-12 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"}),", ",D),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{placeholder:"0.0",id:"quoteMarketFee",defaultValue:j,value:j,addonAfter:a.createElement("span",null,a.createElement(z.A,{style:{width:100},noTip:!0,name:t.get("symbol")}))})))):null,se=S?null:a.createElement("div",{style:{visibility:"hidden"},className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-3 buy-sell-label"},a.createElement(q(),{content:"explorer.asset.summary.market_fee"})),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{placeholder:"0.0",id:"emptyPlaceholder",defaultValue:"0",addonAfter:a.createElement("span",null,a.createElement(z.A,{style:{width:100},noTip:!0,name:t.get("symbol")}))})));const ae="bid"===e;let re=ae&&te?te:!ae&&Z?Z:te||Z?se:null,ie=ae?F.getAmount({real:!0})>=parseFloat(N):F.getAmount({real:!0})>=parseFloat(w),ne=ae?y().translate("exchange.buy"):y().translate("exchange.sell"),oe=!(l||F.getAmount()>0&&ie),le=!(x>0),ce=!(w>0),de=oe||le||ce,he=b()(e,{disabled:de}),pe=ae?s.get("symbol"):t.get("symbol"),me=le?y().translate("exchange.invalid_price"):ce?y().translate("exchange.invalid_amount"):oe?y().translate("exchange.no_balance"):null;A[1]&&"1.3.0"===A[1].getIn(["options","core_exchange_rate","quote","asset_id"])&&"1.3.0"===A[1].getIn(["options","core_exchange_rate","base","asset_id"])&&(f=A[0],A.splice(1,1));let ue,ge,be=0,_e=A.map((e=>{let{name:t,prefix:s}=O.A.replaceName(e);return a.createElement(u.Select.Option,{key:e.get("id"),value:be++},s,t)}));ue=f.get("symbol")===pe?F.clone(F.getAmount()-n.getAmount()):F,ae?y().translate("walkthrough.buy_form"):y().translate("walkthrough.sell_form"),"SPECIFIC"!==this.props.expirationType&&(ge=this.props.expirations[this.props.expirationType].get());const ye=Object.keys(this.props.expirations).map((e=>a.createElement("option",{value:e,key:e},"SPECIFIC"===e&&"Specific"!==C?v()(C).format("Do MMM YYYY hh:mm A"):this.props.expirations[e].title))),fe="small-12";let Ae;Ae=S?a.createElement("div",{className:fe},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-12 buy-sell-label",content:"exchange.price"}),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{id:`${e}Price`,value:x,onChange:c,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")})," / ",a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")}))}))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-12 buy-sell-label",content:"transfer.amount"}),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{id:`${e}Amount`,value:w,onChange:r,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")}))}))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-12 buy-sell-label",content:"exchange.total"}),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{id:`${e}Total`,value:N,onChange:p,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")}))}))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-12 buy-sell-label",content:"transfer.fee"}),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{id:`${e}Fee`,placeholder:"0.0",defaultValue:E?n.getAmount({real:!0}):y().translate("transfer.errors.insufficient"),disabled:!0,addonAfter:a.createElement(u.Select,{style:{width:100},disabled:1===A.length,defaultValue:A.indexOf(this.props.feeAsset),onChange:this.props.onChangeFeeAsset},_e)}))),re):P?a.createElement("div",{className:fe},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"exchange.price"}),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{id:`${e}Price`,value:x,onChange:c,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")})," / ",a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")}))}))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"transfer.amount"}),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{id:`${e}Amount`,value:w,onChange:r,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")}))}))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"exchange.total"}),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{id:`${e}Total`,value:N,onChange:p,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")}))}))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"transfer.fee"}),a.createElement("div",{className:"inputAddon small-9"},a.createElement(H.A,{id:`${e}Fee`,placeholder:"0.0",value:E?n.getAmount({real:!0}):y().translate("transfer.errors.insufficient"),disabled:!0,addonAfter:a.createElement(u.Select,{style:{width:100},disabled:1===A.length,defaultValue:A.indexOf(this.props.feeAsset),onChange:this.props.onChangeFeeAsset},_e)}))),re):a.createElement("div",{className:fe},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("div",{className:"small-11 grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"exchange.price"}),a.createElement("div",{className:"small-9 buy-sell-label",style:{textAlign:"right"}},a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this.props.setPrice.bind(this,e,_.sellPrice())},a.createElement(V,{price:g,quote:t,base:s})," "))),a.createElement("div",{className:"inputAddon small-11"},a.createElement(H.A,{id:`${e}Price`,value:x,onChange:c,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")})," / ",a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")}))}))),a.createElement("div",{className:"small-6"},a.createElement("div",{className:"small-12 grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"exchange.total"}),a.createElement("div",{className:"small-9 buy-sell-label",style:{textAlign:"right"}},a.createElement(q(),{className:"small-3 buy-sell-label",content:"exchange.balance"})," ",a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this._addBalance.bind(this,ue)},O.A.format_number(F.getAmount({real:!0}),m)," "))),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{id:`${e}Total`,value:N,onChange:p,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")}))})))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"transfer.amount"}),a.createElement("div",{className:"inputAddon small-11"},a.createElement(H.A,{id:`${e}Amount`,value:w,onChange:r,autoComplete:"off",placeholder:"0.0",addonAfter:a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")}))}))),a.createElement("div",{className:"small-6"},a.createElement(q(),{className:"small-3 buy-sell-label",content:"transfer.fee"}),a.createElement("div",{className:"inputAddon small-12"},a.createElement(H.A,{id:`${e}Fee`,placeholder:"0.0",defaultValue:E?n.getAmount({real:!0}):y().translate("transfer.errors.insufficient"),disabled:!0,addonAfter:a.createElement(u.Select,{style:{width:100},disabled:1===A.length,defaultValue:A.indexOf(this.props.feeAsset),onChange:this.props.onChangeFeeAsset},_e)})))));const Ee=ae?s:t,ve=!!Ee.get("bitasset")&&Ee.get("bitasset").get("settlement_fund")>0;return i.A.getState().currentAccount,a.createElement("div",{className:b()(this.props.className),style:this.props.styles},a.createElement("div",{className:"buy-sell-container",style:{paddingRight:5}},k?null:a.createElement("div",{className:"exchange-content-header exchange-content-header--buy-sell-form "+e},a.createElement("span",null,a.createElement(I.A,{string:"exchange.buysell_formatter",noLink:!0,noTip:!0,keys:[{type:"asset",value:t.get("symbol"),arg:"asset"},{type:"translate",value:l?"exchange.short":ae?"exchange.buy":"exchange.sell",arg:"direction"}]})),this.props.onFlip&&!this.props.hideFunctionButtons?a.createElement("span",{onClick:this.props.onFlip,style:{cursor:"pointer",fontSize:"1rem"},className:"flip-arrow"}," ","⇆"):null,this.props.onTogglePosition&&!this.props.hideFunctionButtons?a.createElement("span",{onClick:this.props.onTogglePosition,style:{cursor:"pointer",fontSize:"1rem"},className:"flip-arrow"}," ","⇅"):null,this.props.moveOrderForm&&!this.props.hideFunctionButtons?a.createElement(W.A,{onClick:this.props.moveOrderForm,name:"thumb-tack",className:"icon-14px icon-fill order-book-button-v",style:{marginLeft:5}}):null),a.createElement("form",{ref:"order_form",className:(this.props.isOpen?"":"hide-container ")+"order-form",style:{fontSize:"14px"},noValidate:!0},a.createElement("div",{className:"grid-block no-overflow wrap shrink"},this.props.moveOrderForm&&S?a.createElement("div",{style:{width:"100%",textAlign:"right"},onClick:this.props.moveOrderForm},a.createElement(W.A,{name:"thumb-tack",className:"icon-18px icon-fill order-book-button-v"})):null,Ae),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:P?"small-12 grid-block":"small-6"},a.createElement(q(),{className:"small-4 buy-sell-label",content:"transaction.expiration"}),a.createElement("div",{className:"small-8 expiration-datetime-picker"},a.createElement(U.A,{ref:this.getDatePickerRef,className:"expiration-datetime-picker--hidden",showTime:!0,showToday:!1,disabledDate:e=>e<v()().add(59,"minutes"),value:"Specific"!==C?C:v()().add(1,"hour"),onChange:this.props.onExpirationCustomChange}),a.createElement("select",{className:"cursor-pointer",onChange:this.onExpirationSelectChange,onClick:this.onExpirationSelectClick,onBlur:this.onExpirationSelectBlur,"data-tip":ge&&v()(ge).format("Do MMM YYYY hh:mm A"),value:this.props.expirationType},ye))),P?null:a.createElement("div",{className:"small-6"},re),a.createElement("div",{className:"small-12 medium-12 xlarge-12"},P?a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-4 buy-sell-label",content:ae?"exchange.lowest_ask":"exchange.highest_bid"}),a.createElement("div",{className:"small-8 buy-sell-label"},a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this.props.setPrice.bind(this,e,_.sellPrice())},a.createElement(V,{price:g,quote:t,base:s})," ",a.createElement(z.A,{name:s.get("symbol"),noTip:!0}),"/",a.createElement(z.A,{name:t.get("symbol"),noTip:!0})))):null,P?a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement(q(),{className:"small-4 buy-sell-label",content:"exchange.balance"}),a.createElement("div",{className:"small-8 buy-sell-label"},a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this._addBalance.bind(this,ue)},O.A.format_number(F.getAmount({real:!0}),m)," ",a.createElement(z.A,{name:pe,noTip:!0})))):null,a.createElement("div",{style:{marginTop:10}},a.createElement("div",null,a.createElement(u.Tooltip,{placement:"top",title:me||""},a.createElement(u.Button,{className:de?null:he,disabled:de,onClick:d.bind(this,!0),type:"primary",style:{margin:5}},ae?"Buy":"Sell")),this.props.currentBridges&&!this.props.backedCoin?a.createElement(u.Tooltip,{title:o.A.isDown("TRADE")?y().translate("external_service_provider.is_down"):y().translate("exchange.quick_deposit_bridge",{target:ae?Y:X})},a.createElement(u.Button,{style:{margin:5},onClick:this.props.onBuy.bind(this),disabled:o.A.isDown("TRADE")||!this.props.currentAccount||"1.2.3"===this.props.currentAccount.get("id")},a.createElement(q(),{content:"exchange.quick_deposit",asset:ae?Y:X}))):null,this.props.backedCoin&&!this.props.currentBridges?a.createElement(u.Tooltip,{title:o.A.isDown("OPEN")?y().translate("external_service_provider.is_down"):y().translate("tooltip.gateway")},a.createElement(u.Button,{style:{margin:5},onClick:this.props.onDeposit.bind(this),disabled:o.A.isDown("OPEN")||!this.props.currentAccount||"1.2.3"===this.props.currentAccount.get("id")},a.createElement(q(),{content:"exchange.quick_deposit",asset:ae?Y:X}))):null,this.props.currentBridges&&this.props.backedCoin?a.createElement(u.Popover,{title:a.createElement(q(),{content:"exchange.quick_deposit",asset:ae?Y:X}),trigger:"click",visible:this.state.isQuickDepositVisible,onVisibleChange:this.handleQuickDepositVisibleChange,content:a.createElement("div",null,a.createElement(u.Tooltip,{title:o.A.isDown("OPEN")?y().translate("external_service_provider.is_down"):y().translate("exchange.quick_deposit_gateway",{asset:ae?Y:X})},a.createElement(u.Button,{style:{marginRight:5},onClick:this.onDeposit.bind(this),disabled:o.A.isDown("OPEN")},a.createElement(q(),{content:"exchange.quick_deposit_gateway_button"}))),a.createElement(u.Tooltip,{title:o.A.isDown("TRADE")?y().translate("external_service_provider.is_down"):y().translate("exchange.quick_deposit_bridge",{target:ae?Y:X})},a.createElement(u.Button,{onClick:this.onBuy.bind(this),disabled:o.A.isDown("TRADE")},a.createElement(q(),{content:"exchange.quick_deposit_bridge_button"}))))},a.createElement(u.Tooltip,{title:y().translate("exchange.quick_deposit_tooltip",{asset:ae?Y:X})},a.createElement(u.Button,{style:{margin:5},disabled:!this.props.currentAccount||"1.2.3"===this.props.currentAccount.get("id")},a.createElement(q(),{content:"exchange.quick_deposit",asset:ae?Y:X})))):null,this.props.onBorrow&&!ve?a.createElement(u.Button,{style:{margin:5},disabled:!this.props.currentAccount||"1.2.3"===this.props.currentAccount.get("id"),onClick:this.props.onBorrow},a.createElement(q(),{content:"exchange.borrow"})):null,ve?a.createElement(u.Button,{style:{margin:5},disabled:!this.props.currentAccount||"1.2.3"===this.props.currentAccount.get("id"),onClick:this.showSettleModal,"data-tip":y().translate("exchange.settle_globally_settled_tooltip")},a.createElement(q(),{content:"exchange.settle_globally_settled"})):null)))),a.createElement("div",null,a.createElement("div",{className:"grid-content clear-fix no-padding"},me&&l?a.createElement(u.Tooltip,{title:me,placement:"right"},a.createElement("div",{style:{paddingRight:10},className:"float-right"},a.createElement("input",{style:{margin:0},className:he,type:"submit",onClick:d.bind(this,!1),value:ne}))):l?a.createElement(u.Tooltip,{title:"",placement:"right"},a.createElement("div",{style:{paddingRight:10},className:"float-right"},a.createElement("input",{style:{margin:0},className:he,type:"submit",onClick:d.bind(this,!1),value:ne}))):null)))),ve&&!!this.props.currentAccount&&a.createElement($.A,{visible:this.state.isSettleModalVisible,hideModal:this.hideSettleModal,showModal:this.showSettleModal,asset:Ee.get("id"),account:this.props.currentAccount}))}}const Q=(0,L.A)(G);var K=s(24923),Y=s(58336);const J={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},Z={integer:e=>Z.number(e)&&parseInt(e,10)===Number(e),float:e=>Z.number(e)&&!Z.integer(e),array:e=>Array.isArray(e),regexp(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:e=>"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear,number:e=>!isNaN(e)&&!isNaN(Number(e))&&"number"==typeof Number(e),object:e=>"object"==typeof e&&!Z.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&!!e.match(J.email)&&e.length<255,url:e=>"string"==typeof e&&!!e.match(J.url),hex:e=>"string"==typeof e&&!!e.match(J.hex),string:e=>"string"==typeof e,boolean:e=>"boolean"==typeof e,enum:(e,t)=>Array.isArray(t)&&t.indexOf(e)>=-1},X=Z,ee=(e="")=>e?y().translate("validation.messages.requiredNamed",{name:e}):y().translate("validation.messages.required"),te=(e="",t="")=>t?y().translate(`validation.messages.types.${e}Named`,{name:t,type:e}):y().translate(`validation.messages.types.${e}`,{type:e}),se=(e,t,s)=>s?y().translate("validation.messages.rangeNamed",{name:s,min:e,max:t}):y().translate("validation.messages.range",{min:e,max:t}),ae=(e,t)=>t?y().translate("validation.messages.minNamed",{name:t,min:e}):y().translate("validation.messages.min",{min:e}),re=(e,t)=>t?y().translate("validation.messages.maxNamed",{name:t,max:e}):y().translate("validation.messages.max",{max:e}),ie=e=>e?y().translate("validation.messages.numberNamed",{name:e}):y().translate("validation.messages.number"),ne=e=>e?y().translate("validation.messages.integerNamed",{name:e}):y().translate("validation.messages.integer"),oe=e=>e?y().translate("validation.messages.floatNamed",{name:e}):y().translate("validation.messages.float"),le=e=>e?y().translate("validation.messages.emailNamed",{name:e}):y().translate("validation.messages.email"),ce=e=>e?y().translate("validation.messages.urlNamed",{name:e}):y().translate("validation.messages.url"),de=(e,t)=>e?y().translate("validation.messages.oneOfNamed",{name:e,list:t}):y().translate("validation.messages.oneOf",{list:t}),he={required:function(e={}){let t="";return t="string"==typeof e?e:e&&e.name,{required:!0,message:ee(t)}},type:function(e){let t="",s="";if("string"==typeof e&&(t=e),e&&e.type&&(t=e.type),e&&e.name&&(s=e.name),""===t)throw new Error("[Validation] Rules.Type the property type is missed");if(!X[t])throw new Error(`[Validation] Rules.Type the property type '${e&&e.type}' is not listed in supported types`);return{validator:(e,s,a)=>X[t](s)?a():a(!1),message:te(t,s)}},range:function(e={}){let t=Number(e.max),s=Number(e.min);if(void 0===t||isNaN(t))throw new Error(`[Validation] Rules.Range the property max '${e&&e.max}' is incorrect. Should be a number`);if(void 0===s||isNaN(s))throw new Error(`[Validation] Rules.Range the property min '${e&&e.min}' is incorrect. Should be a number`);if(t<s)throw new Error(`[Validation] Rules.Range the property min '${e&&e.min}' cannot be higher than max '${e&&e.max}'`);return{validator:(e,a,r)=>(a=Number(a),isNaN(a)||a<s||a>t?r(!1):r()),message:se(s,t,e.name||"")}},min:function(e){let t;if(t=Number("object"==typeof e?e&&e.min:e),void 0===t||isNaN(t))throw new Error(`[Validation] Rules.Min the property min '${e&&e.min}' is incorrect. Should be a number`);return{validator:(s,a,r)=>{if(a=Number(a),e&&e.higherThan){if(isNaN(a)||a<=t)return r(!1)}else if(isNaN(a)||a<t)return r(!1);return r()},message:ae(t,e.name||"")}},max:function(e){let t;if(t=Number("object"==typeof e?e&&e.max:e),void 0===t||isNaN(t))throw new Error(`[Validation] Rules.Min the property max '${e&&e.max}' is incorrect. Should be a number`);return{validator:(e,s,a)=>(s=Number(s),isNaN(s)||s>t?a(!1):a()),message:re(t,e.name||"")}},number:function(e){return{validator:(e,t,s)=>X.number(t)?s():s(!1),message:ie(e||"")}},integer:function(e){return{validator:(e,t,s)=>X.integer(t)?s():s(!1),message:ne(e||"")}},float:function(e){return{validator:(e,t,s)=>X.float(t)?s():s(!1),message:oe(e||"")}},email:function(e){return{validator:(e,t,s)=>X.email(t)?s():s(!1),message:le(e||"")}},url:function(e){return{validator:(e,t,s)=>X.url(t)?s():s(!1),message:ce(e||"")}},oneOf:function(e={}){let t;if(!Array.isArray(e&&e.list))throw new Error("[Validation] Rules.oneOf the property list is missed or incorrect");return t=e.list,{validator:(e,s,a)=>-1===t.indexOf(s)?a(!1):a(),message:de(e&&e.name||"",t.toString().replace(/,([a-z])/g,", $1"))}},balance:function(e={}){return{validator:he.range({min:0,max:e.balance}).validator,message:(t=e.balance,s=e.symbol,y().translate("validation.messages.balance",{balance:t,symbol:s}))};var t,s}},pe={Rules:he},me=e=>(t,s,a=6)=>+e(t,s).toFixed(a),ue=(e,t)=>e+t,ge=(e,t)=>e-t,be=(e,t)=>e*t,_e=(e,t)=>e/t,ye=(e,t,s)=>me(ue)(e,t,s),fe=(e,t,s)=>me(ge)(e,t,s),Ae=(e,t,s)=>me(be)(e,t,s),Ee=(e,t,s)=>me(_e)(e,t,s);function ve(){return ve=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},ve.apply(this,arguments)}class ke extends a.Component{constructor(e){super(e),this.state={orderCount:1,feeAssets:[]},this.handleClickBalance=this.handleClickBalance.bind(this),this.handleCurrentPriceClick=this.handleCurrentPriceClick.bind(this)}componentDidMount(){this._checkFeeAssets()}componentDidUpdate(){const e=Number(this._getFormValues().orderCount||1),t=Number(this.state.orderCount);isNaN(t)||isNaN(e)||Number(this.state.orderCount)===e||this.setState({orderCount:e},(()=>{this._checkFeeAssets()}))}isFormValid(){const e=this._getFormValues();return!(!e||!e.priceLower||isNaN(Number(e.priceLower))||Number(e.priceLower)<=0||!e.amount||isNaN(Number(e.amount))||Number(e.amount)<=0||!e.priceUpper||isNaN(Number(e.priceUpper))||Number(e.priceUpper)<=0||Number(e.priceUpper)<=Number(e.priceLower)||!e.orderCount||isNaN(Number(e.orderCount))||Number(e.orderCount)<=1)}_getBaseAssetFlags(){return T.A.getFlagBooleans(this.props.baseAsset.getIn(["options","flags"]),this.props.baseAsset.has("bitasset_data_id"))}_getQuoteAssetFlags(){return T.A.getFlagBooleans(this.props.quoteAsset.getIn(["options","flags"]),this.props.quoteAsset.has("bitasset_data_id"))}_isMarketFeeVisible(){const e=this._getBaseAssetFlags(),t=this._getQuoteAssetFlags();return!(this._getFormValues().action!==K.x6.SELL||!e.charge_market_fee)||!(this._getFormValues().action!==K.x6.BUY||!t.charge_market_fee)}_getFormValues(){return this.props.form.getFieldsValue()}_filterFeeStatuses(e){return e.filter((e=>e&&e.hasPoolBalance&&e.hasBalance)).map((e=>({fee:e,amount:e.fee.getAmount()/Math.pow(10,e.fee.precision),asset:Y.A.getAsset(e.fee.asset_id)})))}_checkFeeAssets(){this._getAccountAssetsFeeStatus().then((e=>{let t=this._filterFeeStatuses(e);this.setState({feeAssets:t})}))}_getAccountAssetsFeeStatus(){const{currentAccount:e}=this.props,{orderCount:t}=this._getFormValues();return!!(e&&e.get&&e.get("balances"))&&new Promise((s=>{let a=[];e.get("balances").forEach((s=>{let r=Y.A.getObject(s),i=(0,F.hQ)({accountID:e.get("id"),feeID:r.get("asset_type"),type:"limit_order_create",operationsCount:t});a.push(i)})),Promise.all(a).then((e=>{s(e)}))}))}_getFee(){const e=this._getFormValues();let t=0;return e&&e.feeCurrency&&this.state.feeAssets.forEach((s=>{s&&s.asset&&s.asset.get("symbol")===e.feeCurrency&&(t=s.amount)})),t}_getMarketFee(){const e=this._getFormValues(),t=this.props.baseAsset,s=this.props.quoteAsset,a=Number(this._getTotal()),r=e.action;if(isNaN(a))return null;let i=null;if(r===K.x6.SELL&&(i=t),r===K.x6.BUY&&(i=s),!i||!i.get||!i.getIn)return null;const n=new B.Vd({amount:i.getIn(["options","max_market_fee"]),asset_id:i.get("asset_id"),precision:i.get("precision")}),o=this._getMarketFeePercentage();return a?Math.min(n.getAmount({real:!0}),a/100*o).toFixed(n.precision):0}_getMarketFeePercentage(){const{action:e}=this._getFormValues(),t=this.props.baseAsset,s=this.props.quoteAsset;let a=null;return e===K.x6.SELL&&(a=t),e===K.x6.BUY&&(a=s),Number(a.getIn(["options","market_fee_percent"])/100)}_getTotal(){const e=this._getFormValues(),t=Number(e.amount),s=Number(e.priceLower),a=Number(e.priceUpper),r=Number(e.orderCount),i=e=>!isNaN(e);if(!i(s)||!i(a)||!i(t)||!i(r)||r<=1||r<=0||s>=a)return 0;const n=Ee(fe(a,s),fe(r,1)),o=Ee(t,r);let l=0;for(let e=0;e<r;e+=1)l=ye(l,Ae(o,ye(s,Ae(n,e))));return l}_getQuantityFromTotal(e){const t=this._getFormValues(),s=Number(t.priceLower),a=Number(t.priceUpper),r=Number(t.orderCount),i=e=>!isNaN(e);if(!i(s)||!i(a)||!i(e)||!i(r)||r<=0||s>=a)return 0;const n=Ee(fe(a,s),fe(r,1));let o=0;for(let e=0;e<r;e+=1)o=ye(o,Number(Ee(ye(s,Ae(n,e)),r)));return Ee(e,o)}_getPreviewDataSource(){const e=this._getFormValues(),t=[],s=e.action,a=Number(e.amount),r=Number(e.priceLower),i=Number(e.priceUpper),n=Number(e.orderCount),o=e=>!isNaN(e);if(!o(r)||!o(i)||!o(a)||!o(n)||n<=0||r>=i)return[];const l=((i-r)/(n-1)).toFixed(6),c=a/n;for(let e=0;e<n;e+=1)t.push({quote:c.toFixed(6),base:(c*(r+l*e)).toFixed(6),price:(r+l*e).toFixed(6)});return s===K.x6.BUY?t.reverse():t}getDatePickerRef=e=>{this.datePricker=e};handleClickBalance(){"bid"===this.props.type?this.props.form.setFieldsValue({amount:this._getQuantityFromTotal(this.props.baseAssetBalance)}):this.props.form.setFieldsValue({amount:this.props.quoteAssetBalance})}handleCurrentPriceClick(){this.props.form.setFieldsValue({priceLower:this.props.currentPrice})}onExpirationSelectChange=e=>{"SPECIFIC"===e.target.value?this.datePricker.picker.handleOpenChange(!0):this.datePricker.picker.handleOpenChange(!1),this.props.onExpirationTypeChange(e)};onExpirationSelectClick=e=>{"SPECIFIC"===e.target.value&&(this.firstClick&&(this.secondClick=!0),this.firstClick=!0,this.secondClick&&(this.datePricker.picker.handleOpenChange(!0),this.firstClick=!1,this.secondClick=!1))};onExpirationSelectBlur=()=>{this.firstClick=!1,this.secondClick=!1};render(){const{type:e,quoteAsset:t,baseAsset:s,expirationCustomTime:r}=this.props,i="bid"===e,n=t,o=s,{getFieldDecorator:l}=this.props.form,c=i?a.createElement(z.A,{name:this.props.quoteAsset.get("symbol")}):a.createElement(z.A,{name:this.props.baseAsset.get("symbol")}),d=a.createElement(z.A,{name:this.props.quoteAsset.get("symbol")}),h=a.createElement(z.A,{name:this.props.baseAsset.get("symbol")}),p=a.createElement("span",null,a.createElement(z.A,{dataPlace:"right",name:s.get("symbol")})," / ",a.createElement(z.A,{dataPlace:"right",name:t.get("symbol")})),m={labelCol:{span:6},wrapperCol:{span:16,offset:2}},g=(l("action",{initialValue:i?K.x6.BUY:K.x6.SELL})(a.createElement(u.Radio.Group,null,a.createElement(u.Radio,{value:K.x6.BUY},y().translate("scaled_orders.action.buy")),a.createElement(u.Radio,{value:K.x6.SELL},y().translate("scaled_orders.action.sell")))),l("priceLower",{validateFirst:!0,validateTrigger:"onBlur",rules:[pe.Rules.required(),pe.Rules.number(),pe.Rules.min({min:0,name:"Price",higherThan:!0})]})(a.createElement(u.Input,{placeholder:"0.0",style:{width:"100%"},autoComplete:"off",addonAfter:p}))),b=this._getFormValues(),_=Number(b&&b.priceLower||0),f=l("priceUpper",{validateFirst:!0,validateTrigger:"onBlur",rules:[pe.Rules.required(),pe.Rules.number(),pe.Rules.min({min:_,name:"Price",higherThan:!0})]})(a.createElement(u.Input,{placeholder:"0.0",style:{width:"100%"},autoComplete:"off",addonAfter:p})),A=l("feeCurrency",{initialValue:Y.A.getAsset("1.3.0")&&Y.A.getAsset("1.3.0").get&&Y.A.getAsset("1.3.0").get("symbol")})(a.createElement(u.Select,{showSearch:!0,dropdownMatchSelectWidth:!1,style:{minWidth:"80px",maxWidth:"120px"}},this.state.feeAssets&&this.state.feeAssets.map&&this.state.feeAssets.map((e=>a.createElement(u.Select.Option,{key:e.asset.get("symbol"),value:`${e.asset.get("symbol")}`},a.createElement(z.A,{name:e.asset.get("symbol"),noTip:!0})))))),E=a.createElement(u.Input,{disabled:!0,placeholder:"0.0",style:{width:"100%"},autoComplete:"off",addonAfter:A,value:this._getFee()}),k=a.createElement(u.Input,{disabled:!0,style:{width:"100%"},autoComplete:"off",addonAfter:c,value:this._getMarketFee()}),S=a.createElement(u.Input,{disabled:!0,style:{width:"100%"},autoComplete:"off",addonAfter:h,value:this._getTotal()}),C=pe.Rules.balance({balance:this.props.baseAssetBalance,symbol:this.props.baseAsset.get("symbol")}),w=C.validator(null,this._getTotal(),(e=>void 0===e)),x=i&&!w?C.message:null,N=i&&!w?"error":"",T=[pe.Rules.required(),pe.Rules.number(),pe.Rules.min({min:0,higherThan:!0,name:"Quantity"})];i||T.push(pe.Rules.balance({balance:this.props.quoteAssetBalance,symbol:this.props.quoteAsset.get("symbol")}));const P=l("amount",{validateFirst:!0,validateTrigger:"onBlur",rules:T})(a.createElement(u.Input,{placeholder:"0.0",style:{width:"100%"},autoComplete:"off",addonAfter:d})),B=l("orderCount",{validateFirst:!0,rules:[pe.Rules.required(),pe.Rules.number(),pe.Rules.min({min:1,name:"Orders Count",higherThan:!0})]})(a.createElement(u.Input,{style:{width:"100%"},placeholder:"0",autoComplete:"off",addonAfter:y().translate("scaled_orders.order_s")})),F=y().translate(i?"exchange.lowest_ask":"exchange.highest_bid");let O;"SPECIFIC"!==this.props.expirationType&&(O=this.props.expirations[this.props.expirationType].get());const M=Object.keys(this.props.expirations).map((e=>a.createElement("option",{value:e,key:e},"SPECIFIC"===e&&"Specific"!==r?v()(r).format("Do MMM YYYY hh:mm A"):this.props.expirations[e].title)));return a.createElement("div",{className:"buy-sell-container",style:{padding:"5px"}},a.createElement(u.Form,{className:"order-form",layout:"horizontal",hideRequiredMark:!0,style:{padding:"8px 15px"}},a.createElement(u.Form.Item,ve({},m,{label:y().translate("scaled_orders.price_lower")}),g),a.createElement(u.Form.Item,ve({},m,{label:y().translate("scaled_orders.price_upper")}),f),a.createElement(u.Form.Item,ve({},m,{label:y().translate("scaled_orders.quantity")}),P),a.createElement(u.Form.Item,ve({},m,{label:y().translate("scaled_orders.order_count")}),B),a.createElement(u.Form.Item,ve({},m,{help:x,validateStatus:N,label:y().translate("scaled_orders.total")}),S),a.createElement(u.Form.Item,ve({},m,{label:y().translate("scaled_orders.fee")}),E),this._isMarketFeeVisible()?a.createElement(u.Form.Item,ve({},m,{label:`${y().translate("scaled_orders.market_fee")} ${this._getMarketFeePercentage()}%`}),k):null,a.createElement(u.Form.Item,ve({label:y().translate("transaction.expiration")},m),a.createElement("div",{className:"expiration-datetime-picker scaled-orders",style:{marginTop:"5px"}},a.createElement(U.A,{ref:this.getDatePickerRef,className:"expiration-datetime-picker--hidden",showTime:!0,showToday:!1,disabledDate:e=>e<v()().add(59,"minutes"),value:"Specific"!==r?r:v()().add(1,"hour"),onChange:this.props.onExpirationCustomChange}),a.createElement("select",{className:"cursor-pointer",style:{marginTop:"5px"},onChange:this.onExpirationSelectChange,onClick:this.onExpirationSelectClick,onBlur:this.onExpirationSelectBlur,"data-tip":O&&v()(O).format("Do MMM YYYY hh:mm A"),value:this.props.expirationType},M))),a.createElement(u.Form.Item,ve({label:F},m),a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this.handleCurrentPriceClick},a.createElement(V,{price:this.props.currentPrice,quote:n,base:o})," ",a.createElement(z.A,{name:o.get("symbol"),noTip:!0}),"/",a.createElement(z.A,{name:n.get("symbol"),noTip:!0}))),a.createElement(u.Form.Item,ve({label:y().translate("exchange.balance")},m),a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"},onClick:this.handleClickBalance},i?this.props.baseAssetBalance:this.props.quoteAssetBalance," ",a.createElement(z.A,{name:i?o.get("symbol"):n.get("symbol"),noTip:!0}))),a.createElement(u.Button,{onClick:this.props.handleSubmit,type:"primary",disabled:!this.isFormValid()},y().translate(i?"scaled_orders.action.buy":"scaled_orders.action.sell"))))}}ke=u.Form.create({})(ke);class Se extends a.Component{constructor(e){super(e),this.saveFormRef=this.saveFormRef.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}componentDidUpdate(e){this.props.baseAsset&&e.baseAsset&&this.props.baseAsset.get&&e.baseAsset.get&&this.props.baseAsset.get("id")!==e.baseAsset.get("id")&&this.formRef&&this.formRef.props&&this.formRef.props.form&&this.formRef.props.form.resetFields(),this.props.lastClickedPrice&&this.props.lastClickedPrice!==e.lastClickedPrice&&this.formRef&&this.formRef.props&&this.formRef.props.form&&this.formRef.props.form.setFieldsValue&&this.formRef.props.form.setFieldsValue({priceLower:Number(this.props.lastClickedPrice)})}prepareOrders(e){const t=[],s=Number(e.amount),a=Number(e.priceLower),r=Number(e.priceUpper),i=Number(e.orderCount);let n=null;this.props.expirationType,n=this.props.expirations[this.props.expirationType].get(this.props.type);const o=e=>!isNaN(e);if(!o(a)||!o(r)||!o(s)||!o(i)||i<=0||a>=r)return[];const l=((r-a)/(i-1)).toPrecision(5),c=s/i,d=e.action===K.x6.SELL?this.props.quoteAsset:this.props.baseAsset,h=e.action===K.x6.BUY?this.props.quoteAsset:this.props.baseAsset,p=t=>{let s=c*(a+l*t);return e.action===K.x6.BUY?Number(s.toPrecision(5))*Math.pow(10,d.get("precision")):Number(c.toPrecision(5))*Math.pow(10,d.get("precision"))},m=t=>{let s=c*(a+l*t);return e.action===K.x6.SELL?Number(s.toPrecision(5))*Math.pow(10,h.get("precision")):Number(c.toPrecision(5))*Math.pow(10,h.get("precision"))};for(let e=0;e<i;e+=1)t.push({for_sale:new B.Vd({asset_id:d.get("id"),precision:d.get("precision"),amount:p(e)}),to_receive:new B.Vd({asset_id:h.get("id"),precision:h.get("precision"),amount:m(e)}),expirationTime:n});this.props.createScaledOrder(t,Y.A.getAsset(e.feeCurrency).get("id"))}handleSubmit(){this.formRef.props.form.validateFields(((e,t)=>{e||this.prepareOrders(t)}))}handleCancel(){this.props.hideModal()}saveFormRef(e){this.formRef=e}_getBalanceByAssetId(e,t){let s=0,a=this.props.currentAccount.get("balances");return void 0!==a.get(e)&&(s=Y.A.getObject(a.get(e)).get("balance")/Math.pow(10,t)),s}render(){let e=this._getBalanceByAssetId(this.props.baseAsset.get("id"),this.props.baseAsset.get("precision")),t=this._getBalanceByAssetId(this.props.quoteAsset.get("id"),this.props.quoteAsset.get("precision"));return a.createElement(ke,ve({},this.props,{wrappedComponentRef:this.saveFormRef,baseAssetBalance:e,quoteAssetBalance:t,handleSubmit:this.handleSubmit}))}}const Ce=Se;var we=s(54625);class xe extends a.Component{constructor(){super(),this.state={change:null,curMarket:null,marketChange:!1}}shouldComponentUpdate(e){return!!(e.volume2&&e.volume2!==this.props.volume2||e.base!==this.props.base)||e.price!==this.props.price||e.ready!==this.props.ready}UNSAFE_componentWillReceiveProps(e){let t={change:0},{market:s}=e,a=this.state.curMarket!==s,r=null!=this.state.curMarket&&a;t.marketChange=r,t.curMarket=s,t.prevAsset=this.state.marketAsset,e.ready&&this.props.ready&&(t.change=parseFloat(e.price)-parseFloat(this.props.price)),this.setState(t)}componentDidUpdate(){j.A.rebuild()}render(){let{base:e,quote:t,price:s,content:r,ready:i,volume:n,toolTip:o,ignoreColorChange:l}=this.props,{change:c,marketChange:d}=this.state,h=null;!d&&c&&null!==c&&!0!==l&&(h=c>0?"pulsate green":"pulsate red");let p=n?O.A.format_volume(s):O.A.price_text(s,t,e);return a.createElement("li",{className:b()("stressed-stat",this.props.className,h),onClick:this.props.onClick},a.createElement(u.Tooltip,{placement:"bottom",title:o},a.createElement("span",null,a.createElement("span",{className:"value stat-primary"},i?p:0," "),a.createElement("span",{className:"symbol-text"},a.createElement(z.A,{name:e.get("symbol")}))),r?a.createElement("div",{className:"stat-text"},a.createElement(q(),{content:r})):null))}}function Ne(){return Ne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Ne.apply(this,arguments)}class Te extends a.Component{static propTypes={debtAsset:R.A.ChainAsset.isRequired,collateralAsset:R.A.ChainAsset.isRequired};_getFeedPrice(){return this.props?1/O.A.get_asset_price(T.A.extractRawFeedPrice(this.props.debtAsset).getIn(["quote","amount"]),this.props.collateralAsset,T.A.extractRawFeedPrice(this.props.debtAsset).getIn(["base","amount"]),this.props.debtAsset):1}_getCollateralRatio(){const e=this.props.object.toJS();return O.A.get_asset_amount(e.collateral,this.props.collateralAsset)/(O.A.get_asset_amount(e.debt,this.props.debtAsset)/this._getFeedPrice())}_getMR(){return this.props.debtAsset.getIn(["bitasset","current_feed","maintenance_collateral_ratio"])/1e3}_getStatusClass(){let e=this._getCollateralRatio();const t=this._getMR();return isNaN(e)?null:e<t?"danger":e<t+.5?"warning":""}_getCRTip(){const e=this._getStatusClass(),t=this._getMR();return e&&""!==e?"danger"===e?y().translate("tooltip.cr_danger",{mr:t}):"warning"===e?y().translate("tooltip.cr_warning",{mr:t}):null:null}render(){let{object:e}=this.props;const t=e.toJS(),s=this._getCollateralRatio(),r=(O.A.get_asset_amount(t.debt,this.props.debtAsset),this._getStatusClass());return a.createElement(u.Tooltip,{placement:"bottom",title:this._getCRTip()},a.createElement("li",{className:b()("stressed-stat",this.props.className),onClick:this.props.onClick},a.createElement("span",null,a.createElement("span",{className:b()("value stat-primary",r)},O.A.format_number(s,2))),a.createElement("div",{className:"stat-text"},a.createElement(q(),{content:"header.collateral_ratio"}))))}}Te=(0,L.A)(Te);class Pe extends a.Component{static propTypes={object:R.A.ChainObject.isRequired};render(){let{object:e,account:t}=this.props,s=e.getIn(["call_price","quote","asset_id"]),r=e.getIn(["call_price","base","asset_id"]);return a.createElement(Te,Ne({debtAsset:s,collateralAsset:r,account:t},this.props))}}const Be=Pe=(0,L.A)(Pe);class Fe extends a.Component{constructor(e){super(),this.state={isModalVisible:!1,volumeShowQuote:!0,selectedMarketPickerAsset:e.selectedMarketPickerAsset}}UNSAFE_componentWillReceiveProps(e){this.setState({selectedMarketPickerAsset:e.selectedMarketPickerAsset})}shouldComponentUpdate(e){return!!e.marketReady}_addMarket(e,t){let s=`${e}_${t}`;this.props.starredMarkets.has(s)?x.A.removeStarMarket(e,t):x.A.addStarMarket(e,t)}changeVolumeBase(){this.setState({volumeShowQuote:!this.state.volumeShowQuote})}marketPicker(e){let{selectedMarketPickerAsset:t}=this.state;t=t&&t==e?null:e,this.setState({selectedMarketPickerAsset:t}),this.props.onToggleMarketPicker(t)}render(){const{quoteAsset:e,baseAsset:t,starredMarkets:r,hasPrediction:i,feedPrice:n,showCallLimit:o,lowestCallPrice:l,marketReady:c,latestPrice:d,marketStats:h,account:p}=this.props,g=t.get("symbol"),b=e.get("symbol"),_=`${b}_${g}`,f=r.has(_)?"gold-star":"grey-star",A=h.get("change"),E=0===parseFloat(A)||isNaN(A)?"":parseFloat(A)<0?"negative":"positive",v=h.get("volumeBase"),k=h.get("volumeQuote"),S=isNaN(A)?void 0:A>0?"+"+A:A,C=this.state.volumeShowQuote?k:v,w=this.state.volumeShowQuote?e:t;let x=!1;const T=e.get("id"),P=t.get("id"),F="1.3.0"===T?P:"1.3.0"===P?T:null,O=F?m.ChainStore.getAsset(F):null;let M="",I=null,R="exchange.settle",L="tooltip.settle_price";if(O&&O.get("bitasset")){if(p.toJS&&p.has("call_orders")){const e=p.get("call_orders").toJS();for(let t=0;t<e.length;t++){let s=e[t];if(m.ChainStore.getObject(s).getIn(["call_price","quote","asset_id"])===F){M=s,x=!0;break}}}let s="1.3.0"==P?e:"1.3.0"==T?t:e;if(O.get("bitasset").get("settlement_fund")>0)R="exchange.global_settle",L="tooltip.global_settle_price",I=O.get("bitasset").get("settlement_price").toJS(),I.base.asset_id==t.get("id")?(I.base.precision=t.get("precision"),I.quote.precision=e.get("precision")):(I.quote.precision=t.get("precision"),I.base.precision=e.get("precision")),I=new B.gm({quote:new B.Vd({asset_id:I.quote.asset_id,precision:I.quote.precision,amount:I.quote.amount}),base:new B.Vd({asset_id:I.base.asset_id,precision:I.base.precision,amount:I.base.amount})}).toReal(),I="1.3.0"==P?1/I:I;else if(s&&n){let e=s.getIn(["bitasset","options"]).toJS().force_settlement_offset_percent;I="1.3.0"==P?n.toReal()/(1+e/1e4):n.toReal()*(1+e/1e4)}}const D=s(10658);let V=!!this.state.selectedMarketPickerAsset&&this.state.selectedMarketPickerAsset==b,H=!!this.state.selectedMarketPickerAsset&&this.state.selectedMarketPickerAsset==g,U=this.props.hasAnyPriceAlert?"exchange--price-alert--show-modal--active":"";return a.createElement("div",{className:"grid-block shrink no-padding overflow-visible top-bar"},a.createElement("div",{className:"grid-block overflow-visible"},a.createElement("div",{className:"grid-block shrink"},a.createElement("div",{style:{padding:"10px"}},i?a.createElement("a",{className:"market-symbol"},a.createElement("span",null,`${b} : ${g}`)):a.createElement("div",{style:{padding:"0 5px",fontSize:this.props.tinyScreen?"13px":"18px",marginTop:"1px"}},a.createElement(u.Icon,{onClick:this.props.showPriceAlertModal,type:"bell",className:`exchange--price-alert--show-modal ${U}`,"data-intro":D.translate("walkthrough.price_alerts")}),a.createElement("span",{onClick:this.marketPicker.bind(this,b),className:"underline",style:{cursor:"pointer",color:V?"#2196f3":""}},a.createElement(z.A,{name:b,replace:!0,noTip:!0})),a.createElement("span",{style:{padding:"0 5px"}},"/"),a.createElement("span",{onClick:this.marketPicker.bind(this,g),className:"underline",style:{cursor:"pointer",color:H?"#2196f3":""}},a.createElement(z.A,{name:g,replace:!0,noTip:!0}))),a.createElement("div",{className:"label-actions",style:{padding:"5px 0 0 5px"}},a.createElement(q(),{component:"span",className:"stat-text",content:"exchange.trading_pair"}),a.createElement(we.N_,{onClick:()=>{N.A.switchMarket()},to:`/market/${g}_${b}`,"data-intro":D.translate("walkthrough.switch_button")},a.createElement(W.A,{className:"shuffle",name:"shuffle",title:"icons.shuffle"})),a.createElement("a",{onClick:()=>{this._addMarket(this.props.quoteAsset.get("symbol"),this.props.baseAsset.get("symbol"))},"data-intro":D.translate("walkthrough.favourite_button")},a.createElement(W.A,{className:f,name:"fi-star",title:"icons.fi_star.market"}))))),a.createElement("div",{className:"grid-block vertical",style:{overflow:"visible"}},a.createElement("div",{className:"grid-block wrap market-stats-container"},a.createElement("ul",{className:"market-stats stats top-stats"},d?a.createElement(xe,{ignoreColorChange:!0,ready:c,price:d,quote:e,base:t,market:_,content:"exchange.latest"}):null,a.createElement("li",{className:"hide-order-1 stressed-stat daily_change "+E},a.createElement("span",null,a.createElement("b",{className:"value"},S?c?S:0:"-"),S&&a.createElement("span",null," %")),a.createElement(q(),{component:"div",className:"stat-text",content:"account.hour_24"})),v>=0?a.createElement(xe,{ignoreColorChange:!0,onClick:this.changeVolumeBase.bind(this),ready:c,decimals:0,volume:!0,price:C,className:"hide-order-2 clickable",base:w,market:_,content:"exchange.volume_24"}):null,!i&&n?a.createElement(xe,{ignoreColorChange:!0,toolTip:y().translate("tooltip.feed_price"),ready:c,className:"hide-order-3",price:n.toReal(),quote:e,base:t,market:_,content:"exchange.feed_price"}):null,!i&&I?a.createElement(xe,{ignoreColorChange:!0,toolTip:y().translate(L),ready:c,className:"hide-order-4",price:I,quote:e,base:t,market:_,content:R}):null,x?a.createElement(Be,{object:M,account:p,className:"hide-order-1"}):null,l&&o?a.createElement(xe,{toolTip:y().translate("tooltip.call_limit"),ready:c,className:"hide-order-5 is-call",price:l,quote:e,base:t,market:_,content:"explorer.block.call_limit"}):null,n&&o?a.createElement(xe,{toolTip:y().translate("tooltip.margin_price"),ready:c,className:"hide-order-6 is-call",price:n.getSqueezePrice({real:!0}),quote:e,base:t,market:_,content:"exchange.squeeze"}):null),a.createElement("ul",{className:"market-stats stats top-stats","data-position":"left","data-step":"1","data-intro":D.translate("walkthrough.personalize")},a.createElement("li",{className:"stressed-stat input clickable",style:{padding:"16px 16px 16px 0px"},onClick:this.props.onTogglePersonalize.bind(this)},a.createElement(u.Icon,{type:"setting",style:{paddingRight:5}}),a.createElement(q(),{className:"hide-order-2",content:"exchange.settings.header.title"})))))))}}var Oe=s(2552),Me=s.n(Oe),qe=s(14830);class Ie extends a.Component{render(){let{baseSymbol:e,quoteSymbol:t}=this.props;return a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{textAlign:"right"}},a.createElement(q(),{content:"exchange.price"}),a.createElement("br",null),e?a.createElement("span",{className:"header-sub-title"},"(",a.createElement(z.A,{name:e}),"/",a.createElement(z.A,{name:t}),")"):null),a.createElement("th",{style:{textAlign:"right"}},a.createElement(q(),{content:"transfer.amount"}),a.createElement("br",null),t?a.createElement("span",{className:"header-sub-title"},"(",a.createElement(z.A,{name:t}),")"):null),a.createElement("th",{style:{textAlign:"right"}},a.createElement(q(),{content:"transaction.settlement_date"}),a.createElement("br",null),a.createElement("span",{style:{visibility:"hidden"},className:"header-sub-title"},"d"))))}}Ie.defaultProps={quoteSymbol:null,baseSymbol:null};class Re extends a.Component{render(){let{base:e,quote:t,order:s,showSymbols:r}=this.props,i="1.3.0"==e.get("id")?s.getPrice()/(1+s.offset_percent/1e4):s.getPrice()*(1+s.offset_percent/1e4),n=r?" "+t.get("symbol"):null;return a.createElement("tr",null,a.createElement("td",{className:"text-center",style:{width:"6%"}}," "),a.createElement("td",null,O.A.format_number(i,t.get("precision"))," ",n),a.createElement("td",null,O.A.format_number(s[s.isBid()?"amountToReceive":"amountForSale"]().getAmount({real:!0}),t.get("precision"))),a.createElement("td",null,O.A.format_number(s[s.isBid()?"amountForSale":"amountToReceive"]().getAmount({real:!0}),e.get("precision"))),a.createElement("td",null,a.createElement(u.Tooltip,{title:new Date(s.settlement_date).toString()},a.createElement("div",{style:{textAlign:"right",whiteSpace:"nowrap"}},y().localize(new Date(s.settlement_date),{type:"date",format:-1!==Me()().toLowerCase().indexOf("en-us")?"market_history_us":"market_history"})))))}}Re.defaultProps={showSymbols:!1,invert:!1};class Le extends a.Component{shouldComponentUpdate(e){return e.currentAccount!==this.props.currentAccount||e.orders!==this.props.orders}render(){let{orders:e,base:t,quote:s}=this.props,r=null;const i=a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{textAlign:"center",lineHeight:4,fontStyle:"italic"},colSpan:"5"},a.createElement(q(),{content:"account.no_orders"}))));return e.size>0&&t&&s&&(r=e.sort(((e,t)=>e.isBefore(t)?-1:1)).map((e=>a.createElement(Re,{key:e.id,order:e,base:t,quote:s}))).toArray()),a.createElement(qe.A,{ref:"contentTransition",component:"tbody",transitionName:"newrow"},r||i)}}Le.defaultProps={base:{},quote:{},orders:{},quoteSymbol:"",baseSymbol:""},Le.propTypes={base:w().object.isRequired,quote:w().object.isRequired,orders:w().object.isRequired,quoteSymbol:w().string.isRequired,baseSymbol:w().string.isRequired};const De=Le,Ve={textAlign:"right"};function ze({baseSymbol:e,quoteSymbol:t,selected:s,onCancelToggle:r}){return a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{width:"6%",textAlign:"center"}},r?a.createElement(u.Tooltip,{title:y().translate("exchange.cancel_order_select_all"),placement:"left"},a.createElement(u.Checkbox,{className:"order-cancel-toggle",checked:s,onChange:r})):null),a.createElement("th",{style:Ve},a.createElement(q(),{className:"header-sub-title",content:"exchange.price"})),a.createElement("th",{style:Ve},e?a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:t})):null),a.createElement("th",{style:Ve},e?a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:e})):null),a.createElement("th",{style:Ve},a.createElement(q(),{className:"header-sub-title",content:"transaction.expiration"}))))}function He({order:e,selected:t,base:s,quote:r,onCheckCancel:i}){const n=e.isBid(),o=e.isCall(),l=o?"orderHistoryCall":n?"orderHistoryBid":"orderHistoryAsk";return a.createElement("tr",{key:e.id},a.createElement("td",{className:"text-center",style:{width:"6%"}},o?null:a.createElement(u.Checkbox,{className:"orderCancel",checked:t,onChange:i})),a.createElement("td",{className:l,style:{paddingLeft:10}},a.createElement(V,{price:e.getPrice(),base:s,quote:r})),a.createElement("td",null,O.A.format_number(e[n?"amountToReceive":"amountForSale"]().getAmount({real:!0}),r.get("precision"))," "),a.createElement("td",null,O.A.format_number(e[n?"amountForSale":"amountToReceive"]().getAmount({real:!0}),s.get("precision"))," "),a.createElement("td",null,a.createElement(u.Tooltip,{title:e.expiration.toLocaleString()},a.createElement("div",{style:{textAlign:"right",whiteSpace:"nowrap"}},o?null:y().localize(new Date(e.expiration),{type:"date",format:"short_custom"})))))}ze.defaultProps={quoteSymbol:null,baseSymbol:null};class Ue extends a.Component{render(){let{style:e,className:t,innerClass:s,innerStyle:r,headerStyle:i,noHeader:n,isSelected:o,tinyScreen:l,activeTab:c,baseSymbol:d,quoteSymbol:h,contentContainer:p,footerContainer:m,onCancelToggle:u}=this.props;return a.createElement("div",{style:e,key:"open_orders",className:t},a.createElement("div",{className:s,style:r},n?null:a.createElement("div",{style:i,className:"exchange-content-header"},"my_orders"==c?a.createElement(q(),{content:"exchange.my_orders"}):null,"open_settlement"==c?a.createElement(q(),{content:"exchange.settle_orders"}):null),a.createElement("div",{className:"grid-block shrink left-orderbook-header market-right-padding-only"},a.createElement("table",{className:"table order-table text-right fixed-table market-right-padding"},a.createElement(ze,{baseSymbol:d,quoteSymbol:h,selected:o,onCancelToggle:"my_orders"==c?u:null}))),a.createElement("div",{className:"table-container grid-block market-right-padding-only no-overflow",ref:"container",style:{overflow:"hidden",minHeight:l?260:0,maxHeight:260,lineHeight:"13px"}},a.createElement("table",{className:"table order-table table-highlight-hover table-hover no-stripes text-right fixed-table market-right-padding"},p)),m))}}var We=s(81461);class $e extends a.Component{shouldComponentUpdate(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||e.selected!==this.props.selected}render(){let{base:e,quote:t,order:s,selected:r}=this.props;return a.createElement(He,{key:s.id,order:s,selected:r,base:e,quote:t,onCheckCancel:this.props.onCheckCancel.bind(this)})}}class je extends a.Component{constructor(e){super(),this.state={activeTab:e.activeTab,rowCount:20,showAll:!1,selectedOrders:[]},this._getOrders=this._getOrders.bind(this)}shouldComponentUpdate(e,t){return e.baseSymbol!==this.props.baseSymbol||e.quoteSymbol!==this.props.quoteSymbol||e.className!==this.props.className||e.activeTab!==this.props.activeTab||t.activeTab!==this.state.activeTab||t.showAll!==this.state.showAll||e.currentAccount!==this.props.currentAccount||t.selectedOrders!==this.state.selectedOrders||e.settleOrders!==this.props.settleOrders}componentDidMount(){this.props.hideScrollbars||this.updateContainer(1)}componentDidUpdate(e){let{hideScrollbars:t}=this.props,{showAll:s}=this.state;e.showAll!=s&&(s&&!t?this.updateContainer(2):s||t?s&&t?this.updateContainer(1):this.updateContainer(0):this.updateContainer(3))}UNSAFE_componentWillReceiveProps(e){e.activeTab!==this.state.activeTab&&this.changeTab(e.activeTab),e.baseSymbol===this.props.baseSymbol&&e.quoteSymbol===this.props.quoteSymbol||(this.setState({showAll:!1}),this.updateContainer(0),this.props.hideScrollbars||this.updateContainer(1)),e.hideScrollbars!==this.props.hideScrollbars&&(this.updateContainer(0),e.hideScrollbars||this.updateContainer(1))}updateContainer(e=2){let t=this.refs.view.refs.container,s=this.refs.contentTransition;t&&(0==e?(t.scrollTop=0,S().destroy(t)):1==e?(S().initialize(t),this.updateContainer(3)):2==e?S().update(t):3==e&&(t.scrollTop=0,S().update(t)),s&&s.resetAnimation())}_onSetShowAll(){this.setState({showAll:!this.state.showAll})}changeTab(e){x.A.changeViewSetting({ordersTab:e}),this.setState({activeTab:e}),this.updateContainer(3),setTimeout(j.A.rebuild,1e3)}onCheckCancel(e,t){let{selectedOrders:s}=this.state;if(t.target.checked)this.setState({selectedOrders:s.concat([e])});else{let t=s.indexOf(e);t>-1&&this.setState({selectedOrders:s.slice(0,t).concat(s.slice(t+1))})}}cancelSelected(){this._cancelLimitOrders.call(this)}resetSelected(){this.setState({selectedOrders:[]})}onCancelToggle(e){const t=this._getOrders();let s=[];t.forEach((e=>{s.push(e.id)})),e.target.checked?this.setState({selectedOrders:s}):this.resetSelected()}_getSelectedOrders(e){let t=this.props.currentAccount.get("orders").toArray().filter((t=>-1!=e.indexOf(t)));return(0,m.FetchChain)("getObject",t)}_cancelLimitOrders(){this._getSelectedOrders(this.state.selectedOrders).then((e=>{let t=e.toJS().map((e=>e.sell_price.base.asset_id));N.A.cancelLimitOrders(this.props.currentAccount.get("id"),this.state.selectedOrders,t).then((()=>{this.resetSelected()})).catch((e=>{"string"==typeof e&&e.startsWith("Insufficient balance")?We.A.error(e):console.log("cancel orders error:",e)}))}))}_getOrders(){const{currentAccount:e,base:t,quote:s,feedPrice:a}=this.props,r=e.get("orders"),i=e.get("call_orders"),n=t.get("id"),o=s.get("id"),l={[t.get("id")]:{precision:t.get("precision")},[s.get("id")]:{precision:s.get("precision")}};let c=r.toArray().map((e=>{let t=m.ChainStore.getObject(e);if(!t)return null;let a=t.getIn(["sell_price","base","asset_id"]),r=t.getIn(["sell_price","quote","asset_id"]);return a===n&&r===o||a===o&&r===n?new B.qw(t.toJS(),l,s.get("id")):void 0})).filter((e=>!!e)),d=i.toArray().map((e=>{try{let t=m.ChainStore.getObject(e);if(!t)return null;let r=t.getIn(["call_price","base","asset_id"]),i=t.getIn(["call_price","quote","asset_id"]);if(r===n&&i===o||r===o&&i===n)return a?new B.Vt(t.toJS(),l,s.get("id"),a):null}catch(e){return null}})).filter((e=>!!e)).filter((e=>{try{return e.isMarginCalled()}catch(e){return!1}}));return c.concat(d)}render(){let e,t,{base:s,quote:r,quoteSymbol:i,baseSymbol:n,settleOrders:o}=this.props,{activeTab:l,showAll:c,rowCount:d,selectedOrders:h}=this.state;if(!s||!r)return null;let p=0;if(!l||"my_orders"==l){const i=this._getOrders();let n=i.filter((e=>e.isBid())).sort(((e,t)=>t.getPrice()-e.getPrice())).map((e=>{let t=e.getPrice();return a.createElement($e,{price:t,key:e.id,order:e,base:s,quote:r,selected:this.state.selectedOrders.length>0&&this.state.selectedOrders.includes(e.id),onCancel:this.props.onCancel.bind(this,e.id),onCheckCancel:this.onCheckCancel.bind(this,e.id)})})),o=i.filter((e=>!e.isBid())).sort(((e,t)=>e.getPrice()-t.getPrice())).map((e=>{let t=e.getPrice();return a.createElement($e,{price:t,key:e.id,order:e,base:s,quote:r,selected:this.state.selectedOrders.length>0&&this.state.selectedOrders.includes(e.id),onCancel:this.props.onCancel.bind(this,e.id),onCheckCancel:this.onCheckCancel.bind(this,e.id)})})),l=[];o.length&&(l=l.concat(o)),n.length&&(l=l.concat(n)),l.sort(((e,t)=>e.props.price-t.props.price)),p=l.length,p>0&&!c&&l.splice(d,l.length);let m=a.createElement("tr",null,a.createElement("td",{style:{textAlign:"center",lineHeight:4,fontStyle:"italic"},colSpan:"5"},a.createElement(q(),{content:"account.no_orders"}))),g=a.createElement("div",{style:{display:"grid"}},a.createElement(u.Button,{onClick:this.cancelSelected.bind(this)},a.createElement(q(),{content:"exchange.cancel_selected_orders"})));e=a.createElement(qe.A,{ref:"contentTransition",component:"tbody",transitionName:"newrow"},l.length?l:m),t=p>11?a.createElement(a.Fragment,null,a.createElement("div",{className:"orderbook-showall"},a.createElement("a",{onClick:this._onSetShowAll.bind(this)},a.createElement(q(),{content:c?"exchange.hide":"exchange.show_all_orders",rowcount:p}))),h.length>0?g:null):h.length>0?g:null}l&&"open_settlement"==l&&(p=o.length,p>0&&!c&&o.splice(d,o.length),e=a.createElement(De,{key:"settle_orders",orders:o,base:s,quote:r,baseSymbol:n,quoteSymbol:i}),t=p>11&&a.createElement("div",{className:"orderbook-showall"},a.createElement("a",{onClick:this._onSetShowAll.bind(this)},a.createElement(q(),{content:c?"exchange.hide":"exchange.show_all_orders",rowcount:p}))));let m=this.state.selectedOrders.length>0&&this.state.selectedOrders.length==p;return a.createElement(Ue,{ref:"view",style:this.props.style,className:this.props.className,innerClass:this.props.innerClass,innerStyle:this.props.innerStyle,headerStyle:this.props.headerStyle,noHeader:this.props.noHeader,isSelected:m,tinyScreen:this.props.tinyScreen,activeTab:l,baseSymbol:n,quoteSymbol:i,contentContainer:e,footerContainer:t,onCancelToggle:this.onCancelToggle.bind(this)})}}je.defaultProps={base:{},quote:{},orders:{},quoteSymbol:"",baseSymbol:""},je.propTypes={base:w().object.isRequired,quote:w().object.isRequired,orders:w().object.isRequired,quoteSymbol:w().string.isRequired,baseSymbol:w().string.isRequired};var Ge=s(94726),Qe=s(40961);class Ke extends a.Component{static propTypes={orderRows:w().array.isRequired,noOrders:w().bool.isRequired,isBid:w().bool.isRequired};render(){let{orderRows:e,noOrders:t,isBid:s,id:r}=this.props;return a.createElement(qe.A,{id:r,ref:s?"bidTransition":"askTransaction",component:null,transitionName:"newrow"},e.length>0?e:t||a.createElement("div",{className:"sticky-table-row"},a.createElement("td",{className:"cell no-orders",colSpan:"3"},s?a.createElement(q(),{content:"exchange.no_bids"}):a.createElement(q(),{content:"exchange.no_asks"}))))}}class Ye extends a.Component{shouldComponentUpdate(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||e.isPanelActive!==this.props.isPanelActive||e.horizontal!==this.props.horizontal)}render(){let{order:e,quote:t,base:s,final:r}=this.props;const i=e.isBid();let n=e.isCall()?"orderHistoryCall":i?"orderHistoryBid":"orderHistoryAsk",o=a.createElement(V,{price:e.getPrice(),quote:t,base:s});return a.createElement(Ge.Row,{onClick:this.props.onClick,className:b()("sticky-table-row order-row",{"final-row":r},{"my-order":e.isMine(this.props.currentAccount)},"clickable")},a.createElement(Ge.Cell,{className:"cell left"},O.A.format_number(e[i?"amountForSale":"amountToReceive"]().getAmount({real:!0}),s.get("precision"))),a.createElement(Ge.Cell,{className:"cell"},O.A.format_number(e[i?"amountToReceive":"amountForSale"]().getAmount({real:!0}),t.get("precision"))),a.createElement(Ge.Cell,{className:`cell ${n} right`},o))}}const Je=e=>e?e.getBoundingClientRect().height:0;class Ze extends a.Component{shouldComponentUpdate(e){return e.order.ne(this.props.order)||e.position!==this.props.position||e.index!==this.props.index||e.currentAccount!==this.props.currentAccount||e.quoteTotal!==this.props.quoteTotal}render(){let{order:e,quote:t,base:s,position:r,quoteTotal:i}=this.props;const n=e.isBid();let o=e.isCall()?"orderHistoryCall":n?"orderHistoryBid":"orderHistoryAsk",l=a.createElement(V,{price:e.getPrice(),quote:t,base:s}),c=n?O.A.format_number(e.amountToReceive().getAmount({real:!0}),t.get("precision")):O.A.format_number(e.amountForSale().getAmount({real:!0}),t.get("precision")),d=n?O.A.format_number(e.amountForSale().getAmount({real:!0}),s.get("precision")):O.A.format_number(e.amountToReceive().getAmount({real:!0}),s.get("precision"));const h=i?e.totalToReceive():e.totalForSale(),p=i?e.totalForSale():e.totalToReceive(),m=i?t:s,u=n?O.A.format_number(h.getAmount({real:!0}),m.get("precision")):O.A.format_number(p.getAmount({real:!0}),m.get("precision"));let g="";return this.props.marketDepthPercentage&&!this.props.isBid?g=`linear-gradient(to right, rgba(255,0,0,.15) ${this.props.marketDepthPercentage||0}%, rgba(0,0,0,0) ${this.props.marketDepthPercentage||0}%)`:this.props.marketDepthPercentage&&this.props.isBid&&(g=`linear-gradient(to left, rgba(0,255,0,.15) ${this.props.marketDepthPercentage||0}%, rgba(0,0,0,0) ${this.props.marketDepthPercentage||0}%)`),a.createElement("tr",{onClick:this.props.onClick,className:e.isMine(this.props.currentAccount)?"my-order":"",style:{backgroundImage:g}},"left"===r?a.createElement("td",{className:"column-hide-xs"},u):a.createElement("td",{style:{width:"25%"},className:o},l),a.createElement("td",null,"left"===r?d:c),a.createElement("td",null,"left"===r?c:d),"right"===r?a.createElement("td",{className:"column-hide-xs"},u):a.createElement("td",{style:{width:"25%"},className:o},l))}}class Xe extends a.Component{shouldComponentUpdate(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)}render(){let{order:e,quote:t,base:s,final:r}=this.props;const i=e.isBid();let n=i?"orderHistoryBid":"orderHistoryAsk",o=a.createElement(V,{price:e.getPrice(),quote:t,base:s});return a.createElement(Ge.Row,{onClick:this.props.onClick,className:b()("sticky-table-row order-row",{"final-row":r},"clickable")},a.createElement(Ge.Cell,{className:"cell left"},O.A.format_number(e[i?"amountForSale":"amountToReceive"]().getAmount({real:!0}),s.get("precision"))),a.createElement(Ge.Cell,{className:"cell"},O.A.format_number(e[i?"amountToReceive":"amountForSale"]().getAmount({real:!0}),t.get("precision"))),a.createElement(Ge.Cell,{className:`cell ${n} right`},o))}}class et extends a.Component{shouldComponentUpdate(e){return e.order.ne(this.props.order)||e.position!==this.props.position||e.index!==this.props.index||e.currentAccount!==this.props.currentAccount||e.quoteTotal!==this.props.quoteTotal}render(){let{order:e,quote:t,base:s,position:r,quoteTotal:i}=this.props;const n=e.isBid();let o=n?"orderHistoryBid":"orderHistoryAsk",l=a.createElement(V,{price:e.getPrice(),quote:t,base:s}),c=n?O.A.format_number(e.amountToReceive().getAmount({real:!0}),t.get("precision")):O.A.format_number(e.amountForSale().getAmount({real:!0}),t.get("precision")),d=n?O.A.format_number(e.amountForSale().getAmount({real:!0}),s.get("precision")):O.A.format_number(e.amountToReceive().getAmount({real:!0}),s.get("precision"));const h=i?e.totalToReceive():e.totalForSale(),p=i?e.totalForSale():e.totalToReceive(),m=i?t:s,u=n?O.A.format_number(h.getAmount({real:!0}),m.get("precision")):O.A.format_number(p.getAmount({real:!0}),m.get("precision"));return a.createElement("tr",{onClick:this.props.onClick},"left"===r?a.createElement("td",{className:"column-hide-xs"},u):a.createElement("td",{style:{width:"25%"},className:o},l),a.createElement("td",null,"left"===r?d:c),a.createElement("td",null,"left"===r?c:d),"right"===r?a.createElement("td",{className:"column-hide-xs"},u):a.createElement("td",{style:{width:"25%"},className:o},l))}}class tt extends a.Component{constructor(){super(),this.state={groupLimit:""}}static getDerivedStateFromProps(e){return{groupLimit:e.currentGroupOrderLimit}}render(){const e=0===this.props.trackedGroupsConfig.length,t=this.props.trackedGroupsConfig.map((e=>this.props.globalSettingsSelector?a.createElement(u.Select.Option,{value:e,key:e},e/100+"%"):a.createElement("option",{value:e,key:e},e/100+"%")));return this.props.globalSettingsSelector?a.createElement(u.Select,{placeholder:"Select option",style:{width:"100%"},value:this.props.currentGroupOrderLimit,disabled:e,onChange:this.props.handleGroupOrderLimitChange.bind(this)},e?a.createElement(u.Select.Option,{value:0},a.createElement(q(),{content:"tooltip.no_groups_available"})):a.createElement(u.Select.Option,{value:0},a.createElement(q(),{content:"settings.disabled"})),t):a.createElement(u.Tooltip,{placement:"bottom",title:e?y().translate("tooltip.no_groups_available"):null},a.createElement("select",{value:this.state.groupLimit,onChange:this.props.handleGroupOrderLimitChange,className:"settings-select",style:e?{cursor:"not-allowed"}:null},a.createElement(q(),{content:"exchange.group_order_limit",component:"option",value:"0"}),t))}}class st extends a.Component{constructor(e){super(),this.state={flip:e.flipOrderBook,showAllBids:!1,showAllAsks:!1,rowCount:20,autoScroll:e.autoScroll,quoteTotalBids:!1,quoteTotalAsks:!1},this.verticalStickyTable=a.createRef(),this.centerText=a.createRef(),this.hor_bids=a.createRef(),this.hor_asks=a.createRef(),this.askTransition=a.createRef(),this.bidTransition=a.createRef()}shouldComponentUpdate(e,t){if(this.props.horizontal&&this.props.hideScrollbars&&t.showAllAsks!=this.state.showAllAsks){let e=this.hor_asks.current;t.showAllAsks?(S().initialize(e),this.psUpdate()):S().destroy(e),this.askTransition.current.resetAnimation(),this.hor_asks.current&&(this.hor_asks.current.scrollTop=0)}if(this.props.horizontal&&this.props.hideScrollbars&&t.showAllBids!=this.state.showAllBids){let e=this.hor_bids.current;t.showAllBids?(S().initialize(e),this.psUpdate()):S().destroy(e),this.bidTransition.current.resetAnimation(),this.hor_bids.current&&(this.hor_bids.current.scrollTop=0)}return!0}componentDidUpdate(e,t,s){const a=this.props;a.base.get("id")===e.base.get("id")&&a.quote.get("id")===e.quote.get("id")||(this.askTransition.current&&(this.askTransition.current.resetAnimation(),this.hor_asks.current&&(this.hor_asks.current.scrollTop=0),this.hor_bids.current&&(this.hor_bids.current.scrollTop=0)),this.bidTransition.current&&this.bidTransition.current.resetAnimation(),this.refs.vert_bids&&(this.refs.vert_bids.scrollTop=0),this.props.horizontal||this.setState({autoScroll:this.state.autoScroll}));let r=this.hor_bids.current,i=this.hor_asks.current;this.props.horizontal&&a.hideScrollbars!==this.props.hideScrollbars&&a.hideScrollbars&&(S().destroy(r),S().destroy(i)),this.props.horizontal&&a.hideScrollbars!==this.props.hideScrollbars&&!a.hideScrollbars&&(S().initialize(r),S().initialize(i),this.askTransition.current.resetAnimation(),this.bidTransition.current.resetAnimation(),i&&(i.scrollTop=0),r&&(r.scrollTop=0),this.psUpdate()),this.centerVerticalScrollBar()}queryStickyTable=(e=null)=>{const t=Qe.findDOMNode(this.verticalStickyTable.current);return null==e?t:t.querySelector(e)};verticalScrollBar=()=>this.queryStickyTable();componentDidMount(){if(this.props.horizontal){if(!this.props.hideScrollbars){let e=this.hor_bids.current;S().initialize(e);let t=this.hor_asks.current;S().initialize(t)}}else S().initialize(this.verticalScrollBar())}centerVerticalScrollBar(){if(!this.props.horizontal&&this.state.autoScroll){const e=this.queryStickyTable(),t=this.queryStickyTable(".top-header"),s=this.centerText.current,a=Je(this.queryStickyTable(".order-row")),r=(0!==this.props.currentGroupOrderLimit?this.props.orderBookReversed?this.props.groupedBids:this.props.groupedAsks:this.props.orderBookReversed?this.props.combinedBids:this.props.combinedAsks).length*a,i=Je(e)-Je(t),n=r+Je(s)/2-i/2;e.scrollTop=n}}psUpdate(){if(this.props.horizontal){let e=this.hor_bids.current;S().update(e);let t=this.hor_asks.current;S().update(t)}else S().update(this.verticalScrollBar())}_onSetShowAll(e){"asks"===e?(this.setState({showAllAsks:!this.state.showAllAsks}),this.state.showAllAsks&&(this.hor_asks.current.scrollTop=0)):(this.setState({showAllBids:!this.state.showAllBids}),this.state.showAllBids&&(this.hor_bids.current.scrollTop=0))}toggleSpreadValue=()=>{this.setState({displaySpreadAsPercentage:!this.state.displaySpreadAsPercentage})};toggleAutoScroll=()=>{this.setState({autoScroll:!this.state.autoScroll})};toggleTotalAsset(e){const t=e?"quoteTotalBids":"quoteTotalAsks";this.setState({[t]:!this.state[t]})}render(){let{combinedBids:e,combinedAsks:t,highestBid:s,lowestAsk:r,quote:i,base:n,totalAsks:o,totalBids:l,quoteSymbol:c,baseSymbol:d,horizontal:h,trackedGroupsConfig:p,currentGroupOrderLimit:m,handleGroupOrderLimitChange:u,orderBookReversed:g,groupedBids:_,groupedAsks:f,flipOrderBook:A}=this.props,{showAllAsks:E,showAllBids:v,rowCount:k,displaySpreadAsPercentage:S}=this.state;const C=!r.sell_price&&!s.sell_price,w=!(!r.sell_price||!s.sell_price)&&(S?`${(100*(r._real_price/s._real_price-1)).toFixed(2)}%`:a.createElement(V,{price:r._real_price-s._real_price,base:n,quote:i}));let x=null,N=null,T=0!==this.props.currentGroupOrderLimit?f:t,P=0!==this.props.currentGroupOrderLimit?_:e;if(h||g?!h&&g&&(P.sort(((e,t)=>e.getPrice()-t.getPrice())),T.sort(((e,t)=>e.getPrice()-t.getPrice()))):(P.sort(((e,t)=>t.getPrice()-e.getPrice())),T.sort(((e,t)=>t.getPrice()-e.getPrice()))),n&&i)if(0!==this.props.currentGroupOrderLimit)x=P.map(((e,t)=>h?a.createElement(et,{index:t,key:e.getPrice()+(e.isBid()?"_bid":""),order:e,onClick:this.props.onClick.bind(this,e),base:n,quote:i,position:A?"right":"left",currentAccount:this.props.currentAccount,quoteTotal:this.state.quoteTotalBids}):a.createElement(Xe,{index:t,key:e.getPrice()+(e.isBid()?"_bid":""),order:e,onClick:this.props.onClick.bind(this,e),base:n,quote:i,final:0===t,currentAccount:this.props.currentAccount}))),N=T.map(((e,t)=>h?a.createElement(et,{index:t,key:e.getPrice()+(e.isBid()?"_bid":""),order:e,onClick:this.props.onClick.bind(this,e),base:n,quote:i,type:e.type,position:A?"left":"right",currentAccount:this.props.currentAccount,quoteTotal:this.state.quoteTotalAsks}):a.createElement(Xe,{index:t,key:e.getPrice()+(e.isBid()?"_bid":""),order:e,onClick:this.props.onClick.bind(this,e),base:n,quote:i,type:e.type,final:0===t,currentAccount:this.props.currentAccount})));else{let e=P.length?P[P.length-1].totalForSale().getAmount():0;x=P.map(((t,s)=>{const r=t.totalForSale().getAmount(),o=Math.ceil(100*r/e);return h?a.createElement(Ze,{index:s,key:t.getPrice()+(t.isCall()?"_call":""),marketDepthPercentage:o,isBid:!0,order:t,onClick:this.props.onClick.bind(this,t),base:n,quote:i,position:A?"right":"left",currentAccount:this.props.currentAccount,quoteTotal:this.state.quoteTotalBids}):a.createElement(Ye,{index:s,key:t.getPrice()+(t.isCall()?"_call":""),order:t,onClick:this.props.onClick.bind(this,t),base:n,quote:i,final:0===s,currentAccount:this.props.currentAccount})}));let t=T.length?T[T.length-1].totalForSale().getAmount():0;N=T.map(((e,s)=>{const r=e.totalForSale().getAmount(),o=Math.ceil(100*r/t);return h?a.createElement(Ze,{index:s,marketDepthPercentage:o,isBid:!1,key:e.getPrice()+(e.isCall()?"_call":""),order:e,onClick:this.props.onClick.bind(this,e),base:n,quote:i,type:e.type,position:A?"left":"right",currentAccount:this.props.currentAccount,quoteTotal:this.state.quoteTotalAsks}):a.createElement(Ye,{index:s,key:e.getPrice()+(e.isCall()?"_call":""),order:e,onClick:this.props.onClick.bind(this,e),base:n,quote:i,type:e.type,final:0===s,currentAccount:this.props.currentAccount})}))}if(this.props.horizontal){let e=x.length,t=N.length;v||x.splice(k,x.length),E||N.splice(k,N.length);let s=a.createElement("thead",null,a.createElement("tr",{key:"top-header",className:"top-header"},a.createElement("th",{className:"column-hide-xs"},a.createElement(q(),{className:"header-sub-title",content:"exchange.total"}),a.createElement("a",{onClick:()=>this.toggleTotalAsset(!0),className:"header-sub-title underline-title"}," ",a.createElement(z.A,{dataPlace:"top",name:this.state.quoteTotalBids?c:d,noTip:!0}))),a.createElement("th",null,a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:d}))),a.createElement("th",null,a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:c}))),a.createElement("th",null,a.createElement(q(),{className:(A?"ask-total":"bid-total")+" header-sub-title",content:"exchange.price"})))),r=a.createElement("thead",null,a.createElement("tr",{key:"top-header",className:"top-header"},a.createElement("th",null,a.createElement(q(),{className:(A?"bid-total":"ask-total")+" header-sub-title",content:"exchange.price"})),a.createElement("th",null,a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:c}))),a.createElement("th",null,a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:d}))),a.createElement("th",{className:"column-hide-xs"},a.createElement(q(),{className:"header-sub-title",content:"exchange.total"}),a.createElement("a",{onClick:()=>this.toggleTotalAsset(),className:"header-sub-title underline-title"}," ",a.createElement(z.A,{dataPlace:"top",name:this.state.quoteTotalAsks?c:d,noTip:!0}))))),h=this.props.wrapperClass,g=this.props.innerClass;return a.createElement("div",{ref:"order_book",style:{marginRight:this.props.smallScreen?10:0},className:b()(h)},a.createElement("div",{className:b()(g,A?"order-1":"order-2")},a.createElement("div",null,a.createElement("div",{className:"exchange-content-header ask"},a.createElement(q(),{content:"exchange.asks"}),A&&!this.props.hideFunctionButtons?a.createElement("div",{style:{display:"inline-block"}},a.createElement("span",{onClick:this.props.onFlipOrderBook.bind(this),style:{cursor:"pointer",fontSize:"1rem",marginLeft:"4px",position:"relative",top:"-2px"},className:"flip-arrow"}," ","⇆")):null,A&&!this.props.hideFunctionButtons?a.createElement("div",{className:"float-right header-sub-title grouped_order"},p?a.createElement(tt,{trackedGroupsConfig:p,handleGroupOrderLimitChange:u,currentGroupOrderLimit:m}):null):null,this.props.onTogglePosition&&!this.props.hideFunctionButtons?a.createElement("span",{onClick:this.props.onTogglePosition,style:{cursor:"pointer",fontSize:"1rem"},className:"flip-arrow"}," ","⇅"):null,A&&!this.props.hideFunctionButtons?a.createElement("span",{className:"order-book-button-v",onClick:this.props.moveOrderBook},a.createElement(W.A,{name:"thumb-tack",className:"icon-14px icon-fill"})):null,a.createElement("div",{style:{lineHeight:"16px"},className:"header-sub-title float-right"},a.createElement(q(),{content:"exchange.market_depth"}),a.createElement("span",null,": "),O.A.format_number(o,i.get("precision")),a.createElement("span",null," ","(",a.createElement(z.A,{name:c}),")"))),a.createElement("div",{className:"market-right-padding-only",style:{paddingRight:"0.6rem"}},a.createElement("table",{className:"table order-table table-hover fixed-table text-right"},A?s:r)),a.createElement("div",{className:"grid-block",ref:this.hor_asks,style:{paddingRight:"0.6rem",overflow:"hidden",maxHeight:260,lineHeight:"13px"}},a.createElement("table",{style:{paddingBottom:5},className:"table order-table no-stripes table-hover fixed-table text-right no-overflow"},a.createElement(qe.A,{ref:this.askTransition,className:"orderbook clickable",component:"tbody",transitionName:"newrow",id:"top-order-rows"},N))),t>11?a.createElement("div",{className:"orderbook-showall"},a.createElement("a",{onClick:this._onSetShowAll.bind(this,"asks")},a.createElement(q(),{content:E?"exchange.hide":"exchange.show_asks",ordercount:t}))):null)),a.createElement("div",{className:b()(g,A?"order-2":"order-1")},a.createElement("div",null,a.createElement("div",{className:"exchange-content-header bid"},a.createElement(q(),{content:"exchange.bids"}),A||this.props.hideFunctionButtons?null:a.createElement("div",{style:{display:"inline-block"}},a.createElement("span",{onClick:this.props.onFlipOrderBook.bind(this),style:{cursor:"pointer",fontSize:"1rem",marginLeft:"4px",position:"relative",top:"-2px"},className:"flip-arrow"}," ","⇆")),A||this.props.hideFunctionButtons?null:a.createElement("div",{className:"float-right header-sub-title grouped_order"},p?a.createElement(tt,{trackedGroupsConfig:p,handleGroupOrderLimitChange:u,currentGroupOrderLimit:m}):null),0!==m&&this.props.hideFunctionButtons&&a.createElement(W.A,{name:"grouping",className:"float-right icon-14px",title:y().translate("icons.order_grouping"),style:{marginLeft:"0.5rem"}}),this.props.onTogglePosition&&!this.props.hideFunctionButtons?a.createElement("span",{onClick:this.props.onTogglePosition,style:{cursor:"pointer",fontSize:"1rem"},className:"flip-arrow"}," ","⇅"):null,A||this.props.hideFunctionButtons?null:a.createElement("span",{className:"order-book-button-v",onClick:this.props.moveOrderBook},a.createElement(W.A,{name:"thumb-tack",className:"icon-14px"})),a.createElement("div",{style:{lineHeight:"16px"},className:"float-right header-sub-title"},a.createElement(q(),{content:"exchange.market_depth"}),a.createElement("span",null,": "),O.A.format_number(l,n.get("precision")),a.createElement("span",null," ","(",a.createElement(z.A,{name:d}),")"))),a.createElement("div",{className:"market-right-padding-only",style:{paddingRight:"0.6rem"}},a.createElement("table",{className:"table order-table table-hover fixed-table text-right"},A?r:s)),a.createElement("div",{className:"grid-block",ref:this.hor_bids,style:{paddingRight:"0.6rem",overflow:"hidden",maxHeight:260,lineHeight:"13px"}},a.createElement("table",{style:{paddingBottom:5},className:"table order-table no-stripes table-hover fixed-table text-right no-overflow"},a.createElement(qe.A,{ref:this.bidTransition,className:"orderbook clickable",component:"tbody",transitionName:"newrow"},x))),e>k?a.createElement("div",{className:"orderbook-showall"},a.createElement("a",{onClick:this._onSetShowAll.bind(this,"bids")},a.createElement(q(),{content:v?"exchange.hide":"exchange.show_bids",ordercount:e}))):null)))}return a.createElement("div",{className:"order-table-container"},a.createElement(Ge.StickyTable,{borderWidth:"0px",borderColor:"grey",leftStickyColumnCount:0,className:"order-table table",ref:this.verticalStickyTable},a.createElement(Ge.Row,{className:"top-header sticky-table-header"},a.createElement(Ge.Cell,{className:"cell header-cell left"},a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{name:d}))),a.createElement(Ge.Cell,{className:"cell header-cell"},a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{name:c}))),a.createElement(Ge.Cell,{className:"cell header-cell right"},a.createElement(q(),{className:"header-sub-title",content:"exchange.price"}))),g?a.createElement(Ke,{id:"top-order-rows",noOrders:C,orderRows:x,isBid:!0}):a.createElement(Ke,{id:"top-order-rows",noOrders:C,orderRows:N,isBid:!1}),C?a.createElement(Ge.Row,{className:"sticky-table-row",ref:this.centerText},a.createElement(Ge.Cell,{className:"cell"}),a.createElement(Ge.Cell,{className:"cell no-orders padtop"},a.createElement(q(),{content:"exchange.no_orders"}))):a.createElement(Ge.Row,{className:"sticky-table-row orderbook-latest-price",ref:this.centerText,style:{padding:0}},a.createElement(Ge.Cell,{className:"cell right"},a.createElement("span",{className:"clickable left",onClick:this.toggleSpreadValue},a.createElement(q(),{className:"orderbook-center-title",content:"exchange.spread"})," ",a.createElement("span",{className:"spread-value"},w||"0"))),a.createElement(Ge.Cell,{className:"cell cell-center"},a.createElement("span",{style:{width:75}},this.props.hideFunctionButtons?null:a.createElement(W.A,{className:"lock-unlock clickable icon-fill",onClick:this.toggleAutoScroll,name:this.state.autoScroll?"locked":"unlocked",title:this.state.autoScroll?"icons.unlocked.disable_auto_scroll":"icons.locked.enable_auto_scroll"})," ",this.props.hideFunctionButtons?null:a.createElement(W.A,{onClick:this.props.moveOrderBook,name:"thumb-tack",className:"icon-14px icon-fill order-book-button-v clickable",title:this.props.horizontal?"icons.thumb_tack":"icons.thumb_untack",style:{marginLeft:0}})," ",0==m?null:a.createElement(W.A,{name:"grouping",className:"icon-14px",title:y().translate("icons.order_grouping"),style:{marginLeft:0}}))),a.createElement(Ge.Cell,{className:"cell",style:{textAlign:"center"}},!!this.props.latest&&a.createElement("span",{className:"right"},a.createElement("span",{className:this.props.changeClass?this.props.changeClass:"spread-value"},a.createElement(V,{price:this.props.latest,base:this.props.base,quote:this.props.quote}))))),g?a.createElement(Ke,{noOrders:C,orderRows:N,isBid:!1}):a.createElement(Ke,{noOrders:C,orderRows:x,isBid:!0})))}}st.defaultProps={bids:[],asks:[],orders:{}},st.propTypes={bids:w().array.isRequired,asks:w().array.isRequired,orders:w().object.isRequired};var at=s(9404),rt=s.n(at),it=s(9476),nt=s(77157),ot=s(6882);class lt extends a.Component{static defaultProps={format:-1!==Me()().toLowerCase().indexOf("en-us")?"market_history_us":"market_history",tooltip:!1,component:"span"};UNSAFE_componentWillMount(){this.props.blockHeader||ot.A.getHeader.defer(this.props.block_number)}shouldComponentUpdate(e){return e.blockHeader&&!this.props.blockHeader&&setTimeout(j.A.rebuild,1e3),e.blockHeader!==this.props.blockHeader}render(){const{blockHeader:e,tooltip:t,component:s,format:r}=this.props;return e?a.createElement(s,{className:t?"tooltip":""},a.createElement(u.Tooltip,{title:t?e.timestamp.toString():"",placement:"left"},a.createElement("span",null,y().localize(e.timestamp,{type:"date",format:r})))):a.createElement(s)}}const ct=lt=(0,it.N)(lt,{listenTo:()=>[nt.A],getProps:e=>({blockHeader:nt.A.getState().blockHeaders.get(e.block_number)})});function dt({fill:e,base:t,quote:s}){const r=-1!==e.id.indexOf("5.0")?a.createElement("td",null,a.createElement(u.Tooltip,{title:e.time.toString(),placement:"left"},a.createElement("div",{className:"tooltip",style:{whiteSpace:"nowrap"}},y().localize(e.time,{type:"date",format:-1!==Me()().toLowerCase().indexOf("en-us")?"market_history_us":"market_history"})))):a.createElement(ct,{component:"td",block_number:e.block,tooltip:!0});return a.createElement("tr",null,a.createElement("td",{className:e.className},a.createElement(V,{price:e.getPrice(),base:t,quote:s})),a.createElement("td",null,e.amountToReceive()),a.createElement("td",null,e.amountToPay()),r)}class ht extends a.Component{render(){let{className:e,innerClass:t,innerStyle:s,noHeader:r,headerStyle:i,activeTab:n,quoteSymbol:o,baseSymbol:l,tinyScreen:c,totalRows:d,historyRows:h,showAll:p}=this.props;const m=a.createElement("tr",null,a.createElement("td",{style:{textAlign:"center",lineHeight:4,fontStyle:"italic"},colSpan:"5"},a.createElement(q(),{content:"account.no_trades"})));return a.createElement("div",{className:b()(e)},a.createElement("div",{className:t,style:s},r?null:a.createElement("div",{style:i,className:"exchange-content-header"},"my_history"===n?a.createElement(q(),{content:"exchange.my_history"}):null,"history"===n?a.createElement(q(),{content:"exchange.history"}):null),a.createElement("div",{className:"grid-block shrink left-orderbook-header market-right-padding-only"},a.createElement("table",{className:"table table-no-padding order-table text-left fixed-table market-right-padding"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{textAlign:"right"}},a.createElement(q(),{className:"header-sub-title",content:"exchange.price"})),a.createElement("th",{style:{textAlign:"right"}},a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:o}))),a.createElement("th",{style:{textAlign:"right"}},a.createElement("span",{className:"header-sub-title"},a.createElement(z.A,{dataPlace:"top",name:l}))),a.createElement("th",{style:{textAlign:"right"}},a.createElement(q(),{className:"header-sub-title",content:"explorer.block.date"})))))),a.createElement("div",{className:"table-container grid-block market-right-padding-only no-overflow",ref:"history",style:{minHeight:c?0:260,maxHeight:260,overflow:"hidden",lineHeight:"13px"}},a.createElement("table",{className:"table order-table no-stripes table-hover fixed-table text-right no-overflow"},a.createElement(qe.A,{ref:"historyTransition",component:"tbody",transitionName:"newrow",className:"orderbook"},h&&h.length>0?h:m))),h&&d>11?a.createElement("div",{className:"orderbook-showall"},a.createElement("a",{onClick:e=>this.props.onSetShowAll(e)},a.createElement(q(),{content:p?"exchange.hide":"exchange.show_all_trades",rowcount:d}))):null))}}const{operations:pt}=m.ChainTypes;class mt extends a.Component{constructor(e){super(),this.state={activeTab:e.viewSettings.get("historyTab","history"),rowCount:20,showAll:!1}}shouldComponentUpdate(e,t){return!rt().is(e.history,this.props.history)||e.baseSymbol!==this.props.baseSymbol||e.quoteSymbol!==this.props.quoteSymbol||e.className!==this.props.className||e.activeTab!==this.props.activeTab||t.activeTab!==this.state.activeTab||t.showAll!==this.state.showAll||e.currentAccount!==this.props.currentAccount||e.isPanelActive!==this.props.isPanelActive||e.hideScrollbars!==this.props.hideScrollbars}componentDidMount(){this.props.hideScrollbars||this.updateContainer(1)}componentDidUpdate(e){let{hideScrollbars:t}=this.props,{showAll:s}=this.state;e.showAll!=s&&(s&&!t?this.updateContainer(2):s||t?s&&t?this.updateContainer(1):this.updateContainer(0):this.updateContainer(3))}UNSAFE_componentWillReceiveProps(e){e.activeTab!==this.props.activeTab&&this.changeTab(e.activeTab),e.baseSymbol===this.props.baseSymbol&&e.quoteSymbol===this.props.quoteSymbol||(this.setState({showAll:!1}),this.updateContainer(0),this.props.hideScrollbars||this.updateContainer(1)),e.hideScrollbars!==this.props.hideScrollbars&&(this.updateContainer(0),e.hideScrollbars||this.updateContainer(1))}updateContainer(e=2){let t=this.refs.view.refs.history,s=this.refs.view.refs.historyTransition;t&&(0==e?(t.scrollTop=0,S().destroy(t)):1==e?(S().initialize(t),this.updateContainer(3)):2==e?S().update(t):3==e&&(t.scrollTop=0,S().update(t)),s&&s.resetAnimation())}onSetShowAll(){this.setState({showAll:!this.state.showAll})}changeTab(e){x.A.changeViewSetting({historyTab:e}),this.setState({activeTab:e}),this.updateContainer(3),setTimeout(j.A.rebuild,1e3)}render(){let{history:e,myHistory:t,base:s,quote:r,baseSymbol:i,quoteSymbol:n,isNullAccount:o,activeTab:l}=this.props,{rowCount:c,showAll:d}=this.state,h=null;if(o&&(l="history"),"my_history"===l&&t&&t.size){const e={[r.get("id")]:{precision:r.get("precision")},[s.get("id")]:{precision:s.get("precision")}};h=t.filter((e=>e.getIn(["op",0])===pt.fill_order)).filter((e=>{let t=r.get("id"),a=s.get("id"),i=e.getIn(["op",1,"pays","asset_id"]),n=e.getIn(["op",1,"receives","asset_id"]);return!(t!==i&&t!==n||a!==i&&a!==n)})).sort(((e,t)=>t.get("block_num")-e.get("block_num"))).map((t=>{let i=new B.yK(t.toJS(),e,r.get("id"));return a.createElement(dt,{key:i.id,fill:i,base:s,quote:r})})).toArray()}else e&&e.size&&(h=this.props.history.take(100).map((e=>a.createElement(dt,{key:e.id,fill:e,base:s,quote:r}))).toArray());let p=h?h.length:null;return!d&&h&&h.splice(c,h.length),a.createElement(ht,{ref:"view",className:this.props.className,innerClass:this.props.innerClass,innerStyle:this.props.innerStyle,noHeader:this.props.noHeader,headerStyle:this.props.headerStyle,activeTab:l,quoteSymbol:n,baseSymbol:i,tinyScreen:this.props.tinyScreen,historyRows:h,totalRows:p,showAll:d,onSetShowAll:this.onSetShowAll.bind(this)})}}mt.defaultProps={history:[]},mt.propTypes={history:w().object.isRequired};const ut=(0,it.N)(mt,{listenTo:()=>[n.A],getProps:()=>({viewSettings:n.A.getState().viewSettings})});var gt=s(9540),bt=s(44352),_t=s(72181),yt=s(44483);function ft(){return ft=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},ft.apply(this,arguments)}class At extends a.Component{static propTypes={onClose:w().func,quoteSymbol:w().string,baseSymbol:w().string,market:w().array,marketPickerAsset:w().string};onKeyPress(e,t){"Enter"==t.key&&this.props.history.push(e)}render(){const{quoteSymbol:e,baseSymbol:t,market:s,marketPickerAsset:r}=this.props,{onClose:i}=this.props,n=s[1].quote,o=e==r?`/market/${n}_${t}`:`/market/${e}_${n}`;return a.createElement("li",{key:s[0],style:{height:40},onKeyPress:this.onKeyPress.bind(this,o),tabIndex:this.props.tabIndex},a.createElement(we.N_,{style:{display:"flex"},onClick:i,to:o},a.createElement("div",{style:{flex:2}},a.createElement(z.A,{name:s[1].quote})),a.createElement("div",{style:{flex:3}},s[1].issuer)))}}class Et extends a.Component{constructor(){super(),this.state=this.initialState(),this.getAssetList=(0,h.A)(bt.A.getAssetList.defer,150),this.setState=this.setState.bind(this),this._checkAndUpdateMarketList=this._checkAndUpdateMarketList.bind(this)}initialState(){return{marketsList:[],lookupQuote:null,inputValue:""}}componentDidMount(){this.refs.marketPicker_input.focus()}componentDidUpdate(){this.refs.marketPicker_input.focus()}UNSAFE_componentWillReceiveProps(e){e.marketPickerAsset!==this.props.marketPickerAsset&&this.setState(this.initialState()),e.searchAssets!==this.props.searchAssets&&(0,yt.DB)({searchAssets:this.props.searchAssets,marketPickerAsset:this.props.marketPickerAsset,baseAsset:this.props.baseAsset,quoteAsset:this.props.quoteAsset},{inputValue:this.state.inputValue,lookupQuote:this.state.lookupQuote},this.setState,this._checkAndUpdateMarketList)}shouldComponentUpdate(e,t){return e.visible!==this.props.visible||e.marketPickerAsset!==this.props.marketPickerAsset||e.searchAssets!==this.props.searchAssets||t.marketsList!==this.state.marketsList||!O.A.are_equal_shallow(t,this.state)}componentWillUnmount(){this.intervalId&&clearInterval(this.intervalId)}_onInputName(e,t){let s=t.target.value.trim().toUpperCase();m.ChainValidation.is_valid_symbol_error(s,!0)?this.setState({inputValue:s,activeSearch:!1,marketsList:[]}):(this.setState({inputValue:s,activeSearch:!0,marketsList:[]}),this.state.inputValue!==s&&this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{(0,yt.YY)(s,e,this.getAssetList,this.setState)}),1500))}_checkAndUpdateMarketList(e){clearInterval(this.intervalId),this.intervalId=setInterval((()=>{let t=0;for(let[,s]of e)s.issuer||(s.issuer=(0,yt.nM)(s.issuerId),s.issuer||t++);t||(clearInterval(this.intervalId),this.setState({marketsList:e,activeSearch:!1}))}),300)}renderSearchBar(){const{inputValue:e}=this.state,t=y().translate("exchange.market_picker.find_by_asset").toUpperCase();return a.createElement("div",{id:"filter"},a.createElement(u.Form.Item,{label:t},a.createElement(u.Input,{type:"text",ref:"marketPicker_input",value:e,onChange:this._onInputName.bind(this,!0),placeholder:y().translate("exchange.market_picker.search"),maxLength:16,tabIndex:2})))}renderResults(){const{marketsList:e}=this.state,{activeSearch:t,inputValue:s}=this.state,r=t&&0!=s.length;let{marketPickerAsset:i}=this.props,n=this.props.baseAsset.get("symbol"),o=this.props.quoteAsset.get("symbol");return r?a.createElement(u.Icon,{style:{marginLeft:"8px"},type:"loading",theme:"outlined"}):a.createElement("div",{className:"results"},a.createElement("ul",{style:{marginLeft:0,minHeight:"20px"}},e.map(((e,t)=>a.createElement(At,{key:t,tabIndex:t+100,baseSymbol:n,quoteSymbol:o,market:e,marketPickerAsset:i,history:this.props.history,onClose:this.props.onClose.bind(this)})))))}render(){const{marketPickerAsset:e}=this.props;return a.createElement("div",{className:"marketPicker"},a.createElement("div",{className:"marketPicker__subHeader"},a.createElement(q(),{content:"exchange.market_picker.sub_title"})," ",a.createElement(we.N_,{to:`/asset/${e}`,style:{cursor:"pointer",color:"lightblue !important"}},a.createElement(z.A,{name:e}))),this.renderSearchBar(),this.renderResults())}}class vt extends a.Component{constructor(){super(),this.state={open:!1,smallScreen:!1}}UNSAFE_componentWillMount(){this.setState({smallScreen:window.innerWidth<=800})}UNSAFE_componentWillReceiveProps(e){this.props.quoteAsset.get("id")===e.quoteAsset.get("id")&&this.props.baseAsset.get("id")===e.baseAsset.get("id")||this.onClose()}show(){this.props.showModal()}onClose(){this.props.onToggleMarketPicker(null),this.props.hideModal()}render(){return a.createElement(u.Modal,ft({title:y().translate("exchange.market_picker.title"),closable:!1,visible:this.props.visible,id:this.props.modalId,overlay:!0,onCancel:this.onClose.bind(this),noHeaderContainer:!0,footer:null,ref:this.props.modalId},this.props),a.createElement(Et,ft({onClose:this.onClose.bind(this)},this.props)))}}const kt=vt=(0,it.N)(vt,{listenTo:()=>[_t.A],getProps:()=>({searchAssets:_t.A.getState().assets,assetsLoading:_t.A.getState().assetsLoading})});class St extends a.Component{constructor(e){super(e),this.submit=this.submit.bind(this),this.cancel=this.cancel.bind(this)}_onForce(e,t){t.preventDefault(),this.props.hideModal(),e&&this.props.onForce()}submit(e){this._onForce(!0,e)}cancel(e){this._onForce(!1,e)}render(){let{type:e,diff:t,hasOrders:s}=this.props;const r=[a.createElement(u.Button,{key:"submit",onClick:this.submit},y().translate("settings.yes")),a.createElement(u.Button,{key:"cancel",type:"primary",onClick:this.cancel},y().translate("settings.no"))];return a.createElement(u.Modal,{footer:r,visible:this.props.visible,onCancel:this.cancel,title:y().translate("transaction.confirm")},a.createElement("div",{className:"grid-block vertical"},s?a.createElement(q(),{content:"exchange.confirm_"+e,diff:O.A.format_number(t,2)}):a.createElement(q(),{content:"exchange.confirm_no_orders_"+e})))}}class Ct extends a.Component{constructor(e){super(),this.state={open:!1,smallScreen:!1,autoScroll:e.viewSettings.get("global_AutoScroll",!0)},this.setChartHeight=this.setChartHeight.bind(this)}UNSAFE_componentWillMount(){this.setState({smallScreen:window.innerWidth<=800})}onClose(){this.props.hideModal()}setChartHeight(e){this.props.onChangeChartHeight({value:e})}setAutoscroll(e){let t=1==e;this.setState({autoScroll:t}),x.A.changeViewSetting({global_AutoScroll:t}),this.props.onSetAutoscroll(t)}_getGroupingOptions(e){return a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},onChange:this.props.onSetPanelTabs.bind(this,e),value:this.props.panelTabs[e]},a.createElement(u.Select.Option,{value:0},a.createElement(q(),{content:"exchange.settings.options.grouping_standalone"})),a.createElement(u.Select.Option,{value:1},a.createElement(q(),{content:"exchange.settings.options.grouping_1"})),a.createElement(u.Select.Option,{value:2},a.createElement(q(),{content:"exchange.settings.options.grouping_2"})))}render(){let{chartType:e,chartHeight:t}=this.props;return a.createElement(u.Modal,{title:y().translate("exchange.settings.header.title"),visible:this.props.visible,id:this.props.modalId,overlay:!0,footer:[a.createElement(u.Button,{key:"close",onClick:this.onClose.bind(this)},y().translate("modal.close"))],onCancel:this.onClose.bind(this),noHeaderContainer:!0,ref:this.props.modalId},a.createElement(u.Form.Item,null,a.createElement("header",null,a.createElement(q(),{content:"exchange.settings.header.chart_options"})),this.props.tinyScreen?null:a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.chart_type"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_type")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"}))," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_reload")},a.createElement(u.Icon,{type:"info-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},value:e,onChange:this.props.onToggleChart.bind(this)},a.createElement(u.Select.Option,{value:"market_depth"},y().translate("exchange.order_depth")),a.createElement(u.Select.Option,{value:"price_chart"},y().translate("exchange.price_history")),a.createElement(u.Select.Option,{value:"hidden_chart"},y().translate("exchange.settings.options.hidden_chart"))))),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.chart_height"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_height")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.InputNumber,{value:"number"==typeof t&&t,onChange:this.setChartHeight.bind(this)}))),!this.props.tinyScreen&&"price_chart"==e&&a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.chart_tools"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_tools")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"}))," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_reload")},a.createElement(u.Icon,{type:"info-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.props.chartTools,onChange:this.props.onChartTools.bind(this)}))),!this.props.tinyScreen&&"price_chart"==e&&a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.chart_zoom"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_zoom")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"}))," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_reload")},a.createElement(u.Icon,{type:"info-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.props.chartZoom,onChange:this.props.onChartZoom.bind(this)}))),a.createElement("header",null,a.createElement(q(),{content:"exchange.settings.header.order_options"})),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.order_book_grouping"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.order_book_grouping")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},this.props.trackedGroupsConfig?a.createElement(tt,{globalSettingsSelector:!0,trackedGroupsConfig:this.props.trackedGroupsConfig,handleGroupOrderLimitChange:this.props.handleGroupOrderLimitChange.bind(this),currentGroupOrderLimit:this.props.currentGroupOrderLimit}):null)),!this.props.tinyScreen&&!this.props.smallScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.order_style"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.order_style")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},value:this.props.verticalOrderBook.toString(),onSelect:this.props.onMoveOrderBook.bind(this)},a.createElement(u.Select.Option,{value:"true"},a.createElement(q(),{content:"exchange.settings.options.vertical"})),a.createElement(u.Select.Option,{value:"false"},a.createElement(q(),{content:"exchange.settings.options.horizontal"}))))),!this.props.tinyScreen&&!this.props.verticalOrderBook||this.props.smallScreen?a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingTop:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.position_order_form"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.position_order_form")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},value:this.props.flipBuySell.toString(),onSelect:this.props.onFlipBuySell.bind(this)},a.createElement(u.Select.Option,{value:"false"},a.createElement(q(),{content:"exchange.settings.options.position_order_form_opt1"})),a.createElement(u.Select.Option,{value:"true"},a.createElement(q(),{content:"exchange.settings.options.position_order_form_opt2"}))))):null,!this.props.tinyScreen&&!this.props.verticalOrderBook||this.props.smallScreen?a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingTop:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.position_order_orders"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.position_order_orders")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},value:this.props.flipOrderBook.toString(),onSelect:this.props.onFlipOrderBook.bind(this)},a.createElement(u.Select.Option,{value:"false"},a.createElement(q(),{content:"exchange.settings.options.position_order_orders_opt1"})),a.createElement(u.Select.Option,{value:"true"},a.createElement(q(),{content:"exchange.settings.options.position_order_orders_opt2"}))))):null,!this.props.tinyScreen&&!this.props.verticalOrderBook||this.props.smallScreen?a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingTop:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.position_order_asset"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.position_order_asset")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},value:this.props.buySellTop.toString(),onSelect:this.props.onToggleBuySellPosition.bind(this)},a.createElement(u.Select.Option,{value:"false"},a.createElement(q(),{content:"exchange.settings.options.position_order_asset_opt1"})),a.createElement(u.Select.Option,{value:"true"},a.createElement(q(),{content:"exchange.settings.options.position_order_asset_opt2"}))))):null,!this.props.tinyScreen&&this.props.verticalOrderBook?a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingTop:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.orderbook_auto_scroll"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.orderbook_auto_scroll")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.state.autoScroll,onChange:this.setAutoscroll.bind(this)}))):null,!this.props.tinyScreen&&this.props.verticalOrderBook?a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.reverse_order_book"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.reverse_order_book")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.props.orderBookReversed,onChange:this.props.onOrderBookReversed.bind(this)}))):null,!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6",style:{paddingRight:5}},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.single_colum_order_form"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.single_colum_order_form")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.props.singleColumnOrderForm,onChange:this.props.onToggleSingleColumnOrderForm.bind(this)}))),!this.props.tinyScreen&&a.createElement("header",null,a.createElement(q(),{content:"exchange.settings.header.panel_grouping"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.panel_grouping")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"}))),!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingBottom:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.my_trades"}))),a.createElement("div",{className:"small-6"},this._getGroupingOptions("my_history"))),!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingBottom:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.market_trades"}))),a.createElement("div",{className:"small-6"},this._getGroupingOptions("history"))),!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingBottom:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.open_orders"}))),a.createElement("div",{className:"small-6"},this._getGroupingOptions("my_orders"))),!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingBottom:"0.5em"}},a.createElement("div",{className:"small-6"},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.settlements"}))),a.createElement("div",{className:"small-6"},this._getGroupingOptions("open_settlement"))),!this.props.tinyScreen&&a.createElement("header",null,a.createElement(q(),{content:"exchange.settings.header.general"})),!this.props.tinyScreen&&!this.props.smallScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink",style:{paddingBottom:"0.5em"}},a.createElement("div",{className:"small-6",style:{paddingRight:5}},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.market_location"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.market_location")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Select,{placeholder:y().translate("settings.placeholder_select"),style:{width:"100%"},value:this.props.mirrorPanels.toString(),onSelect:this.props.onMirrorPanels.bind(this)},a.createElement(u.Select.Option,{value:"false"},a.createElement(q(),{content:"settings.left"})),a.createElement(u.Select.Option,{value:"true"},a.createElement(q(),{content:"settings.right"}))))),!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6",style:{paddingRight:5}},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.reduce_scrollbars"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.reduce_scrollbars")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"}))," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.reload")},a.createElement(u.Icon,{type:"info-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.props.hideScrollbars,onChange:this.props.onToggleScrollbars.bind(this)}))),!this.props.tinyScreen&&a.createElement("div",{className:"grid-block no-overflow wrap shrink"},a.createElement("div",{className:"small-6",style:{paddingRight:5}},a.createElement("h6",{style:{margin:9}},a.createElement(q(),{content:"exchange.settings.title.hide_function_buttons"})," ",a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.hide_function_buttons")},a.createElement(u.Icon,{type:"question-circle",theme:"filled"})))),a.createElement("div",{className:"small-6"},a.createElement(u.Switch,{style:{margin:6},checked:this.props.hideFunctionButtons,onChange:this.props.onHideFunctionButtons.bind(this)})))))}}const wt=Ct;var xt=s(37385),Nt=s.n(xt),Tt=s(84743),Pt=s.n(Tt),Bt=s(41321);class Ft{constructor(e){this.name=e.ticker,this.ticker=e.ticker;const t=(0,Bt.ML)(e.quoteAsset),s=(0,Bt.ML)(e.baseAsset);let a=t===s||t&&!s?t:!t&&s?s:`${t} / ${s}`,{name:r,prefix:i}=O.A.replaceName(e.baseAsset),{name:n,prefix:o}=O.A.replaceName(e.quoteAsset);this.description=`${o||""}${n} / ${i||""}${r} ${a?`(${a})`:""}`,this.type="bitcoin",this.session="24x7",this.timezone=Pt().tz.guess(),this.data_status="streaming",this.supported_resolutions=e.resolutions,this.has_empty_bars=!0,this.pricescale=Math.pow(10,e.baseAsset.get("precision")),this.quoteAsset=e.quoteAsset,this.baseAsset=e.baseAsset,this.minmov=1,this.has_intraday=this.supported_resolutions.reduce(((e,t)=>e||!isNaN(parseInt(t,10))),!1),this.intraday_multipliers=this.supported_resolutions.filter((e=>!isNaN(parseInt(e,10)))),this.has_seconds=this.supported_resolutions.reduce(((e,t)=>e||-1!==t.indexOf("S")),!1),this.seconds_multipliers=this.supported_resolutions.filter((e=>-1!==e.indexOf("S"))),this.has_daily=this.supported_resolutions.reduce(((e,t)=>e||-1!==t.indexOf("D")),!1),this.has_daily=this.supported_resolutions.reduce(((e,t)=>e||-1!==t.indexOf("D")),!1)}}function Ot(e,t=!1){return e.map((e=>{let s=e/60,a=s/60/24;return s<1&&!t?e+"S":a<1&&parseInt(s,10)===s&&!t?s.toString():(a=parseInt(a,10),1!==a||t?0===a?"1D":a+"D":"D")})).filter((e=>!!e))}class Mt{update(e){for(let t in e)switch(t){case"resolutions":this.supported_resolutions=Ot(e.resolutions);break;case"onMarketChange":r.A.unsubscribe("market_change"),r.A.subscribe("market_change",e[t]);break;default:this[t]=e[t]}}clearSubs(){r.A.clearSubs()}onReady(e){setTimeout((()=>{e({exchanges:[{value:"OPEN.",name:"Openledger",desc:"Openledger Gateway"}],symbols_types:[],supported_resolutions:this.supported_resolutions,supports_marks:!1,supports_search:!1,supports_time:!0})}),10)}searchSymbols(e,t,s,a){console.log("searchSymbols",e,t,s),a([])}resolveSymbol(e,t,s){let[a,r]=e.split("_");Promise.all([(0,m.FetchChain)("getAsset",a),(0,m.FetchChain)("getAsset",r)]).then((s=>{let[a,r]=s;t(new Ft({ticker:e,quoteAsset:a,baseAsset:r,resolutions:this.supported_resolutions}))})).catch(s)}getBars(e,t,s,a,r,i,n){s*=1e3,a*=1e3;let o=this._getHistory();if(this.latestBar=o[o.length-1],o=o.filter((e=>e.time>=s&&e.time<=a)),this.interval!==t){if(!n)return;let i="D"===(l=t)?86400:-1!==l.indexOf("W")?7*parseInt(l.replace("D",""),10)*24*60*60:-1!==l.indexOf("D")?24*parseInt(l.replace("D",""),10)*60*60:-1!==l.indexOf("S")?parseInt(l.replace("S",""),10):60*parseInt(l,10);return N.A.changeBucketSize(i),N.A.unSubscribeMarket(e.quoteAsset.get("id"),e.baseAsset.get("id")).then((()=>{N.A.subscribeMarket(e.baseAsset,e.quoteAsset,i).then((()=>{let e=this._getHistory();if(this.latestBar=e[e.length-1],e=e.filter((e=>e.time>=s&&e.time<=a)),this.interval=t,!e.length)return r(e,{noData:!0});r(e)}))}))}var l;if(this.interval=t,!o.length)return r(o,{noData:!0});r(o)}_getHistory(){return r.A.getState().priceData}subscribeBars(e,t,s,a,i){r.A.unsubscribe("subscribeBars"),i(),r.A.subscribe("subscribeBars",(()=>{let e=this._getHistory(),t=e.filter((e=>!this.latestBar||e.time>this.latestBar.time));if(t.length)t.forEach((e=>{s(e)})),this.latestBar=t[t.length-1];else{let t=!1;for(let s in this.latestBar)this.latestBar[s]!==e[e.length-1][s]&&(t=!0);t&&s(e[e.length-1])}}))}unsubscribeBars(){}calculateHistoryDepth(e,t,s){}getServerTime(e){e((new Date).getTime()/1e3)}}const qt=["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"];function It(){const e=Pt().tz.guess();if(-1!==qt.indexOf(e))return e;{const s=Pt()().toISOString(),a=Pt().tz(s,e).format();for(var t=0;t<qt.length;t++)if(Pt().tz(s,qt[t]).format()===a)return qt[t]}return console.log(`No matching timezone found for ${e}, setting to default value of Europe/London`),"Europe/London"}const Rt=s(24400);class Lt extends a.Component{constructor(e){super(),this.state={showSaveModal:!1,showLoadModal:!1,error:!1},this.layoutName=a.createRef(),this.hideModal=this.hideModal.bind(this),this.resetError=this.resetError.bind(this),this.loadLastChart=this.loadLastChart.bind(this)}loadTradingView(e){const{dataFeed:t}=e;let s=Nt()[e.theme];const a=this;if(!t)return;if(this.tvWidget)return;t.update({resolutions:e.buckets,ticker:e.quoteSymbol+"_"+e.baseSymbol,interval:Ot([e.bucketSize])[0]});let r=["symbol_info","symbol_search_hot_key","border_around_the_chart","header_symbol_search","header_compare","header_saveload","header_settings"],i=[];!this.props.mobile&&this.props.chartZoom||(r.push("chart_scroll"),r.push("chart_zoom")),this.props.mobile||!this.props.chartTools?(r.push("left_toolbar"),r.push("chart_crosshair_menu"),r.push("chart_events"),r.push("footer_share_buttons"),r.push("footer_screenshot"),r.push("timeframes_toolbar"),r.push("footer_publish_idea_button"),r.push("caption_buttons_text_if_possible"),r.push("line_tool_templates"),r.push("widgetbar_tabs"),r.push("support_manage_drawings"),r.push("support_multicharts"),r.push("right_bar_stays_on_scroll"),r.push("charts_auto_save"),r.push("edit_buttons_in_legend"),r.push("context_menus"),r.push("control_bar"),r.push("header_fullscreen_button"),r.push("header_widget"),r.push("symbollist_context_menu"),r.push("show_pro_features")):(i.push("study_templates"),i.push("keep_left_toolbar_visible_on_small_screens"));const n=e.buckets.map((e=>({text:Ot([250*e],!0)[0],resolution:Ot([e])[0]})));this.tvWidget=new Rt.widget({fullscreen:!1,symbol:e.quoteSymbol+"_"+e.baseSymbol,interval:Ot([e.bucketSize])[0],timeframe:Ot([250*e.bucketSize],!0)[0],time_frames:n,library_path:"/charting_library/",datafeed:t,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:It(),overrides:{"paneProperties.background":s.bgColor,"paneProperties.horzGridProperties.color":s.axisLineColor,"paneProperties.vertGridProperties.color":s.axisLineColor},custom_css_url:e.theme+".css",enabled_features:i,disabled_features:r,debug:!1,preset:this.props.mobile?"mobile":""}),this.tvWidget.onChartReady((()=>{let e=this.tvWidget;!this.props.mobile&&this.props.chartTools&&e.headerReady().then((()=>{const e=this.tvWidget.createButton();e.setAttribute("title",y().translate("exchange.load_custom_charts")),e.classList.add("apply-common-tooltip"),e.addEventListener("click",(()=>{a.setState({showLoadModal:!0})})),e.innerHTML=`<span>${y().translate("exchange.chart_load")}</span>`;const t=this.tvWidget.createButton();t.setAttribute("title",y().translate("exchange.save_custom_charts")),t.classList.add("apply-common-tooltip"),t.addEventListener("click",(()=>{a.setState({showSaveModal:!0})})),t.innerHTML=`<span>${y().translate("exchange.chart_save")}</span>`})),t.update({onMarketChange:this._setSymbol.bind(this)}),this.loadLastChart()})),this._onWheel=this._onWheel.bind(this)}UNSAFE_componentWillReceiveProps(e){e.marketReady&&!this.props.dataFeed&&e.dataFeed&&this.loadTradingView(e)}_setSymbol(e){this.tvWidget&&(this.tvWidget.chart().removeAllShapes(),this.loadLastChart(),this.tvWidget.setSymbol(e,Ot([this.props.bucketSize])[0]))}componentDidMount(){this.loadTradingView(this.props)}componentWillUnmount(){this.props.dataFeed.clearSubs()}shouldComponentUpdate(e,t){return t.showLoadModal!==this.state.showLoadModal||t.showSaveModal!==this.state.showSaveModal||e.chartHeight!==this.props.chartHeight||this.props.charts.size!==e.charts.size||!this.tvWidget||e.marketReady}_onWheel(e){console.log("Test wheel interception")}onSubmitConfirmation(e){const{layoutName:t}=this,s=this.props.charts.some((e=>e.key===t.current.state.value&&e.symbol===this.props.quoteSymbol+"_"+this.props.baseSymbol)),a=this;s?this.setState({error:s}):(this.resetError(),this.tvWidget.save((function(e){let s={};s.key=t.current.state.value||"",s.object=e,s.name=t.current.state.value||"",s.symbol=a.props.quoteSymbol+"_"+a.props.baseSymbol,s.modified=(new Date).toLocaleDateString("en-US"),x.A.addChartLayout(s),a.setState({showSaveModal:!1},(()=>{a.layoutName.current.state&&(a.layoutName.current.state.value=null)}))})))}hideModal(){this.resetError(),this.setState({showSaveModal:!1,showLoadModal:!1})}handleDelete(e){x.A.deleteChartLayout(e)}resetError(){this.setState({error:!1})}loadLastChart(){const{charts:e,quoteSymbol:t,baseSymbol:s}=this.props,a=e.toArray().filter((e=>e.symbol===t+"_"+s&&e.enabled));a[0]&&this.tvWidget.load(a[0].object)}render(){const{charts:e,quoteSymbol:t,baseSymbol:s}=this.props,{error:r}=this.state;let i=r?"has-error":"",n=e.toArray().filter((e=>e.symbol===t+"_"+s));const o=[{title:y().translate("exchange.layout_name"),dataIndex:"name",key:"name"},{title:y().translate("exchange.modified"),dataIndex:"modified",key:"modified"},{title:y().translate("exchange.actions"),dataIndex:"actions",key:"actions",render:(e,t)=>a.createElement(u.Icon,{style:{width:"32px"},onClick:this.handleDelete.bind(this,t.name),type:"delete"})}];return a.createElement("div",{className:"small-12"},a.createElement("div",{className:"exchange-bordered",style:{height:this.props.chartHeight+"px"},id:"tv_chart"}),a.createElement(u.Modal,{title:y().translate("exchange.load_chart_layout"),closable:!1,visible:this.state.showLoadModal,footer:[a.createElement(u.Button,{key:"cancel",onClick:this.hideModal},y().translate("modal.close"))]},a.createElement(u.Table,{dataSource:n||[],columns:o,onRow:e=>({onClick:t=>{"td"===t.target.localName?(this.hideModal(),x.A.addChartLayout(e),this.tvWidget.load(e.object)):1===t.currentTarget.parentElement.childElementCount&&this.hideModal()}})})),a.createElement(u.Modal,{title:y().translate("exchange.save_new_chart_layout"),closable:!1,visible:this.state.showSaveModal,footer:[a.createElement(u.Button,{key:"submit",type:"primary",onClick:this.onSubmitConfirmation.bind(this)},y().translate("modal.save")),a.createElement(u.Button,{key:"cancel",onClick:this.hideModal},y().translate("modal.close"))]},a.createElement("div",null,r?a.createElement("span",{className:i},a.createElement(q(),{content:"exchange.chart_error"})):null,a.createElement("span",{className:i,style:{borderBottom:"#A09F9F 1px dotted"}},a.createElement(u.Input,{placeholder:y().translate("exchange.enter_chart_layout_name"),ref:this.layoutName,onChange:this.resetError,onPressEnter:this.onSubmitConfirmation.bind(this)})))))}}const Dt=(0,it.N)(Lt,{listenTo:()=>[n.A],getProps:()=>({charts:n.A.getState().chartLayouts})});var Vt=s(20903),zt=s(58921),Ht=s.n(zt);function Ut(e){let t="";"-"==(e+="").charAt(0)&&(e=e.substring(1),t="-");let s=e.split(/[eE]/g);if(s.length<2)return t+e;let a=s[1],r=1.1.toLocaleString().substring(1,2);s=s[0].split(r);let i=s[1]||"",n=s[0];if(a>=0)a>i.length&&(i+="0".repeat(a-i.length)),i=i.slice(0,a)+r+i.slice(a),i.charAt(i.length-1)==r&&(i=i.slice(0,-1));else{let e=Math.abs(a)-n.length;e>0&&(n="0".repeat(e)+n),n=n.slice(0,a)+r+n.slice(a),n.charAt(0)==r&&(n="0"+n)}return t+(n+i).replace(/^0*(\d+|\d+\.\d+?)\.?0*$/,"$1")}class Wt extends a.Component{shouldComponentUpdate(e){let t=!isNaN(e.feedPrice)&&e.feedPrice!==this.props.feedPrice;return(0,B.Tg)(e.orders,this.props.orders)||(0,B.Tg)(e.call_orders,this.props.call_orders)||t||e.feedPrice!==this.props.feedPrice||e.height!==this.props.height||e.isPanelActive!==this.props.isPanelActive||e.activePanels!==this.props.activePanels||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}componentDidMount(){this.reflowChart(500)}UNSAFE_componentWillReceiveProps(e){this.refs.depthChart&&e.activePanels!==this.props.activePanels&&this.reflowChart(100)}UNSAFE_componentWillUpdate(){this.props.centerRef&&(this.tempScroll=this.props.centerRef.scrollTop)}componentDidUpdate(){this.props.centerRef&&(this.props.centerRef.scrollTop=this.tempScroll)}reflowChart(e){setTimeout((()=>{this.refs.depthChart&&this.refs.depthChart.chart.reflow()}),e)}_getThemeColors(e=this.props){return Nt()[e.theme]}render(){let{flat_bids:e,flat_asks:t,flat_calls:s,flat_settles:r,totalBids:i,totalAsks:n,base:o,quote:l,feedPrice:c}=this.props;const{primaryText:d,callColor:h,settleColor:p,settleFillColor:m,bidColor:u,bidFillColor:g,askColor:b,askFillColor:_,axisLineColor:f}=this._getThemeColors();let{name:A,prefix:E}=O.A.replaceName(o),{name:v,prefix:k}=O.A.replaceName(l);A=(E||"")+A,v=(k||"")+v;let S=(0,Vt.A)(e),C=(0,Vt.A)(t),w=(0,Vt.A)(s),x=(0,Vt.A)(r),N={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>${y().translate("exchange.price")}:</td>\n\t\t\t\t\t\t\t<td style="text-align: right">${O.A.format_number(this.x,o.get("precision"))} ${A}/${v}</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>${y().translate("exchange.quantity")}:</td>\n\t\t\t\t\t\t\t<td style="text-align: right">${O.A.format_number(this.y,l.get("precision"))} ${v}</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 O.A.format_number(this.value,l.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},formatter:function(){return Ut(this.value)}},ordinal:!1,lineColor:"#000000",title:{text:null},plotLines:[]},plotOptions:{area:{animation:!1,marker:{enabled:!1},series:{enableMouseTracking:!1}}}};if(S.length>0&&C.length>0){let e=(C[0][0]+S[S.length-1][0])/2;N.xAxis.min=.4*e,N.xAxis.max=1.6*e,N.xAxis.max<C[0][0]&&(N.xAxis.max=1.5*C[0][0]),N.xAxis.min>S[S.length-1][0]&&(N.xAxis.min=.5*S[S.length-1][0]);let t=0;S.forEach((e=>{e[0]>=N.xAxis.min&&(t=Math.max(e[1],t))})),C.forEach((e=>{e[0]<=N.xAxis.max&&(t=Math.max(e[1],t))})),N.yAxis.max=1.15*t;let s=t>10?0:t>1?2:5;N.yAxis.labels.formatter=function(){return O.A.format_number(this.value,s)}}else S.length&&!C.length?(N.xAxis.min=.4*S[S.length-1][0],N.xAxis.max=1.6*S[S.length-1][0]):C.length&&!S.length&&(N.xAxis.min=0,N.xAxis.max=2*C[0][0]);if(this.props.hasPrediction&&(N.xAxis.min=-.05,N.xAxis.max=1.05),this.props.LCP){let e=o.get("bitasset_data_id")?o:l,t=e.getIn(["bitasset","current_feed","maintenance_collateral_ratio"])/1e3,s=e.getIn(["bitasset","current_feed","maximum_short_squeeze_ratio"])/1e3,a=this.props.invertedCalls?this.props.LCP/t*s:this.props.LCP*t/s;N.xAxis.plotLines.push({color:f,id:"plot_line",dashStyle:"longdash",value:this.props.LCP,label:{text:y().translate("explorer.block.call_limit",{price:this.props.LCP.toFixed(4)}),style:{color:d,fontWeight:"bold"},x:this.props.invertedCalls?5:-10},width:2,zIndex:5}),N.xAxis.plotLines.push({color:f,id:"plot_line",dashStyle:"longdash",value:a,label:{text:y().translate("explorer.block.gs_support",{price:a.toFixed(4)}),style:{color:d,fontWeight:"bold"},x:this.props.invertedCalls?-10:5},width:2,zIndex:5})}if(c){const e=o.has("bitasset")?b:u;N.xAxis.plotLines.push({color:e,id:"plot_line",dashStyle:"solid",value:c,label:{text:y().translate("explorer.block.feed_price",{price:c.toFixed(4)}),style:{color:d,fontWeight:"bold"},x:this.props.invertedCalls?5:-10},width:2,zIndex:5}),w&&w.length&&N.series.push({name:`Call ${v}`,data:w,color:h})}return c&&x&&x.length&&N.series.push({name:`Settle ${v}`,data:x,color:p,fillColor:m}),S.length&&N.series.push({step:"right",name:`Bid ${v}`,data:S,color:u,fillColor:g}),C.length&&N.series.push({step:"left",name:`Ask ${v}`,data:C,color:b,fillColor:_}),this.props.height?N.chart.height=this.props.height:N.chart.height="400px",this.props.onClick&&(N.chart.events={click:this.props.onClick.bind(this)}),this.props.noFrame?a.createElement("div",{className:"grid-content no-overflow no-padding"},S.length||C.length||w.length?null:a.createElement("span",{className:"no-data"},a.createElement(q(),{content:"exchange.no_data"})),this.props.noText?null:a.createElement("p",{className:"bid-total"},O.A.format_number(i,o.get("precision"))," ",A),this.props.noText?null:a.createElement("p",{className:"ask-total"},O.A.format_number(n,l.get("precision"))," ",v),S||C||w?a.createElement(Ht(),{config:N}):null):a.createElement("div",{className:"grid-content no-overflow no-padding middle-content"},a.createElement("div",{className:"exchange-bordered",id:"depth_chart"},a.createElement("div",{className:"exchange-content-header"},this.props.noText?null:a.createElement("span",{className:"bid-total"},O.A.format_number(i,o.get("precision"))," ",a.createElement(z.A,{name:o.get("symbol")})),this.props.noText?null:a.createElement("span",{className:"ask-total float-right"},O.A.format_number(n,l.get("precision"))," ",a.createElement(z.A,{name:l.get("symbol")}))),S.length||C.length||w.length?null:a.createElement("span",{className:"no-data"},a.createElement(q(),{content:"exchange.no_data"})),S||C||w?a.createElement(Ht(),{ref:"depthChart",config:N}):null))}}Wt.defaultProps={flat_bids:[],flat_asks:[],orders:{},noText:!1,noFrame:!0},Wt.propTypes={flat_bids:w().array.isRequired,flat_asks:w().array.isRequired,orders:w().object.isRequired};const $t=Wt;var jt=s(40702),Gt=s(35277),Qt=s(41223),Kt=s.n(Qt),Yt=s(54392),Jt=s.n(Yt),Zt=s(35917);let{operations:Xt}=m.ChainTypes,es=Object.keys(Xt);class ts extends a.Component{static propTypes={account:R.A.ChainAccount.isRequired};UNSAFE_componentWillReceiveProps(e){if(e.account&&e.account.size&&this.props.account&&this.props.account.get("history")){let t=this.props.account.get("history")&&this.props.account.get("history").first()?this.props.account.get("history").first().toJS():null,s=e.account.get("history")&&e.account.get("history").first()?e.account.get("history").first().toJS():null;s&&t&&"fill_order"===es[s.op[0]]&&(!t&&s.id||s.id!==t.id)&&(Jt().publish("account-notify","open"),setTimeout((function(){Jt().publish("account-notify","close")}),5e3))}}shouldComponentUpdate(e){return!(!e.account||!this.props.account||rt().is(e.account.get("history"),this.props.account.get("history"))&&rt().is(e.account,this.props.account))}render(){let e,t,{account:s}=this.props;return s?(this.props.account.get("history")&&this.props.account.get("history").size&&(e=this.props.account.get("history").first().toJS(),e&&(t=a.createElement(Zt.A,{key:e.id,op:e.op,result:e.result,block:e.block_num,current:s.get("id"),hideDate:!0,hideFee:!0}))),e?a.createElement(Kt().Static,{id:"account-notify",title:null,image:"",wrapperElement:"div"},a.createElement("table",{className:"table"},a.createElement("tbody",null,t))):a.createElement("div",null)):a.createElement("div",null)}}const ss=ts=(0,L.A)(ts);class as extends a.Component{render(){return a.createElement(d.A,{stores:[i.A],inject:{account:()=>i.A.getState().currentAccount}},a.createElement(ss,null))}}const rs=as;var is=s(99429),ns=s(52550),os=s(21561),ls=s(6356),cs=s(18450),ds=s(45964),hs=s(84181),ps=s(48287).Buffer;function ms(){return ms=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},ms.apply(this,arguments)}class us extends ls.x{static propTypes={balance:R.A.ChainObject,sender:R.A.ChainAccount.isRequired,asset:R.A.ChainAsset.isRequired,coreAsset:R.A.ChainAsset.isRequired,globalObject:R.A.ChainAsset.isRequired};static defaultProps={coreAsset:"1.3.0",globalObject:"2.0.0"};constructor(e){super(),this.state={toAddress:ns.fH.getLast(e.walletType),withdrawValue:"",amountError:null,symbol:e.asset.get("symbol"),to_withdraw:new B.Vd({asset_id:e.asset.get("id"),precision:e.asset.get("precision")}),feeAsset:{asset_id:m.ChainStore.assets_by_symbol.get(e.fee_asset_symbol)||"1.3.0",amount:0},loading:!1,emptyAddressDeposit:!1},this._validateAddress(this.state.toAddress,e),this.addDepositAddress=this.addDepositAddress.bind(this),this._checkBalance=this._checkBalance.bind(this),this._getCurrentBalance=this._getCurrentBalance.bind(this)}UNSAFE_componentWillMount(){this._getDepositAddress()}UNSAFE_componentWillReceiveProps(e){e.asset&&this.props.asset&&e.asset.get("id")!==this.props.asset.get("id")&&this.setState({to_withdraw:new B.Vd({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:ns.fH.getLast(e.walletType)},this._getDepositAddress)}_getDepositAddress(){if(!this.props.backingCoinType)return;let e=(0,ns.rZ)({coin:`open.${this.props.backingCoinType.toLowerCase()}`,account:this.props.account,stateCallback:this.addDepositAddress});e?this.setState({receive_address:e}):(0,ns.e4)(this._getDepositObject())}_getDepositObject(){return{inputCoinType:this.props.backingCoinType.toLowerCase(),outputCoinType:this.props.symbol.toLowerCase(),outputAddress:this.props.sender.get("name"),stateCallback:this.addDepositAddress}}requestDepositAddressLoad(){this.setState({loading:!0,emptyAddressDeposit:!1}),(0,ns.e4)(this._getDepositObject())}addDepositAddress(e){e.error&&("no_address"===e.error.message?this.setState({emptyAddressDeposit:!0}):this.setState({emptyAddressDeposit:!1})),this.setState({receive_address:e,loading:!1})}componentDidUpdate(){j.A.rebuild()}getMemo(){return this.props.backingCoinType.toLowerCase()+":"+this.state.toAddress+(this.state.memo?":"+new ps(this.state.memo,"utf-8"):"")}onSubmit(e){if(e.preventDefault(),0===this.state.to_withdraw.getAmount())return this.setState({amountError:"transfer.errors.pos"});if(!this.props.intermediateAccount)return;const t=this.state.feeAsset,s=this._getGateFee();let a=this.state.to_withdraw.clone(),r=a.clone(this._getCurrentBalance().get("balance"));a.plus(s),r.lt(a)&&(a=this.state.to_withdraw.clone()),is.A.transfer(this.props.sender.get("id"),this.props.intermediateAccount,this.state.to_withdraw.getAmount(),this.state.to_withdraw.asset_id,this.getMemo(),null,t.asset_id)}_updateAmount(){const{feeAsset:e}=this.state,t=this._getCurrentBalance();let s=new B.Vd({amount:t?t.get("balance"):0,asset_id:this.props.asset.get("id"),precision:this.props.asset.get("precision")});s.asset_id===e.asset_id&&s.minus(e),this.state.to_withdraw.setAmount({sats:s.getAmount()}),this.setState({withdrawValue:s.getAmount({real:!0}),amountError:null},this._checkBalance)}_getCurrentBalance(){let e=this.props.balance?[m.ChainStore.getObject(this.props.balance)]:this.props.balances;return e?e.find((e=>e&&e.get("asset_type")===this.props.asset.get("id"))):null}_checkBalance(){const{feeAsset:e,to_withdraw:t}=this.state,{asset:s}=this.props,a=this._getCurrentBalance();if(!a||!e)return;const r=(0,F.rT)(t.getAmount({real:!0}),s,e,a,this._getGateFee());return null!==r?(this.state.balanceError!==!r&&this.setState({balanceError:!r}),r):void 0}_onInputAmount(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)}}_onInputTo(e){let t=e.target.value.trim();this.setState({withdraw_address_check_in_progress:!0,withdraw_address_selected:t,validAddress:null,toAddress:t}),this._validateAddress(t)}_onMemoChanged(e){this.setState({memo:e.target.value})}_validateAddress(e,t=this.props){(0,ns.jl)({url:cs.TH.BASE,walletType:t.walletType,newAddress:e}).then((t=>{this.state.toAddress===e&&this.setState({withdraw_address_check_in_progress:!1,validAddress:!!t})})).catch((e=>{console.error("Error when validating address:",e)}))}_openRegistrarSite(e){e.preventDefault(),window.open(n.A.site_registr,"_blank").opener=null}_getGateFee(){const{gateFee:e,asset:t}=this.props;return new B.Vd({real:parseFloat(e?e.replace(",",""):0),asset_id:t.get("id"),precision:t.get("precision")})}onFeeChanged(e){this.setState({feeAsset:e})}_renderWithdraw(){const{amountError:e,toAddress:t,memo:s,feeAsset:r,balanceError:i,withdrawValue:n,validAddress:o}=this.state,{supportsMemos:l,asset:c,account:d}=this.props,{name:h}=O.A.replaceName(c);let p=1;const m=r,g=this.getMemo(),b=!m||i||!t||!n;return a.createElement("div",null,a.createElement("p",null,a.createElement(q(),{content:"gateway.withdraw_funds",asset:h,wallet_name:(0,ds.vj)()})),this._renderCurrentBalance(),a.createElement("div",{className:"SimpleTrade__withdraw-row"},a.createElement("label",{className:"left-label"},y().translate("modal.withdraw.amount")),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("input",{tabIndex:p++,type:"number",min:"0",onKeyPress:this.onKeyPress.bind(this),value:n,onChange:this._onInputAmount.bind(this)}),a.createElement("div",{className:"form-label select floating-dropdown"},a.createElement("div",{className:"dropdown-wrapper inactive"},a.createElement("div",null,h)))),e?a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},a.createElement(q(),{content:e})):null,this.state.balanceError?a.createElement("p",{className:"has-error no-margin",style:{paddingTop:10}},a.createElement(q(),{content:"transfer.errors.insufficient"})):null),a.createElement("div",{className:"SimpleTrade__withdraw-row withdraw-fee-selector"},a.createElement(hs.A,{label:"showcases.barter.fee_when_proposal_executes",account:d,transaction:{type:"transfer",options:["price_per_kbyte"],data:{type:"memo",content:g}},onChange:this.onFeeChanged.bind(this)})),a.createElement("div",{className:"SimpleTrade__withdraw-row"},a.createElement("label",{className:"left-label"},y().translate("modal.withdraw.address")),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("input",{placeholder:y().translate("gateway.withdraw_placeholder",{asset:h}),tabIndex:p++,type:"text",value:t,onChange:this._onInputTo.bind(this)}),a.createElement("div",{className:"form-label select floating-dropdown"},a.createElement("div",{className:"dropdown-wrapper inactive"},a.createElement(u.Tooltip,{placement:"right",title:y().translate("tooltip.withdraw_address",{asset:h})},"?")))),!o&&t?a.createElement("div",{className:"has-error",style:{paddingTop:10}},a.createElement(q(),{content:"gateway.valid_address",coin_type:h})):null),l?a.createElement("div",{className:"SimpleTrade__withdraw-row"},a.createElement("label",{className:"left-label"},y().translate("transfer.memo")),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("textarea",{rows:"3",value:s,tabIndex:p++,onChange:this._onMemoChanged.bind(this)})),!o&&t?a.createElement("div",{className:"has-error",style:{paddingTop:10}},a.createElement(q(),{content:"gateway.valid_address",coin_type:h})):null):null,a.createElement("div",{className:"button-group SimpleTrade__withdraw-row"},a.createElement("button",{tabIndex:p++,className:"button"+(b?" disabled":""),onClick:this.onSubmit.bind(this),type:"submit"},a.createElement(q(),{content:"gateway.withdraw_now"}))))}_renderDeposit(){const{receive_address:e,loading:t,emptyAddressDeposit:s}=this.state,{name:r}=O.A.replaceName(this.props.asset),i=e&&"memo"in e&&e.memo,n=e&&e.address||"";let o=1;return a.createElement("div",{className:n?"":"no-overflow"},a.createElement("p",null,a.createElement(q(),{unsafe:!0,content:"gateway.add_funds",account:this.props.sender.get("name"),wallet_name:(0,ds.vj)()})),this._renderCurrentBalance(),a.createElement("div",{className:"SimpleTrade__withdraw-row"},a.createElement(u.Tooltip,{placement:"right",title:y().translate("tooltip.deposit_tip",{asset:r})},a.createElement("p",{style:{marginBottom:10}},a.createElement(q(),{className:"help-tooltip",content:"gateway.deposit_to",asset:r}),":",a.createElement("label",{className:"fz_12 left-label"},a.createElement(q(),{content:"gateway.deposit_notice_delay"})))),n?a.createElement("label",null,s?a.createElement(q(),{content:"gateway.please_generate_address"}):a.createElement("span",{className:"inline-label"},a.createElement("input",{readOnly:!0,type:"text",value:n}),a.createElement(os.A,{text:n})," ")):a.createElement(jt.A,{type:"three-bounce"}),i?a.createElement("label",null,a.createElement("span",{className:"inline-label"},a.createElement("input",{readOnly:!0,type:"text",value:y().translate("transfer.memo")+": "+e.memo}),a.createElement(os.A,{text:e.memo}))):null,e&&e.error?a.createElement("div",{className:"has-error",style:{paddingTop:10}},e.error.message):null),a.createElement("div",{className:"button-group SimpleTrade__withdraw-row"},a.createElement("button",{tabIndex:o++,className:"button spinner-button-circle",onClick:this.requestDepositAddressLoad.bind(this),type:"submit"},t?a.createElement(jt.A,{type:"circle"}):null,a.createElement(q(),{content:"gateway.generate_new"}))))}_renderCurrentBalance(){const{name:e}=O.A.replaceName(this.props.asset),t="deposit"===this.props.action;let s=this._getCurrentBalance(),r=s?new B.Vd({asset_id:s.get("asset_type"),precision:this.props.asset.get("precision"),amount:s.get("balance")}):null;const i=t?a.createElement("span",{style:{border:"2px solid black",borderLeft:"none"},className:"form-label"},e):a.createElement(u.Tooltip,{placement:"right",title:y().translate("tooltip.withdraw_full")},a.createElement("button",{className:"button",style:{border:"2px solid black",borderLeft:"none"},onClick:this._updateAmount.bind(this,s?parseInt(s.get("balance"),10):0)},a.createElement(W.A,{name:"clippy",title:"icons.clippy.withdraw_full"})));return a.createElement("div",{className:"SimpleTrade__withdraw-row",style:{fontSize:"1rem"}},a.createElement("label",{style:{fontSize:"1rem"}},y().translate("gateway.balance_asset",{asset:e}),":",a.createElement("span",{className:"inline-label"},a.createElement("input",{disabled:!0,style:{color:"black",border:"2px solid black",padding:10,width:"100%"},value:r?r.getAmount({real:!0}):0}),i)))}render(){let{asset:e,action:t}=this.props,s="deposit"===t;if(!e)return null;const{name:r}=O.A.replaceName(e);let i=this.props.isDown?a.createElement("div",null,a.createElement(q(),{className:"txtlabel cancel",content:"gateway.unavailable_OPEN",component:"p"})):this.props.isAvailable?s?this._renderDeposit():this._renderWithdraw():a.createElement("div",null,a.createElement(q(),{className:"txtlabel cancel",content:"gateway.unavailable",component:"p"}));return a.createElement("div",{className:"SimpleTrade__modal"},a.createElement("div",{className:"grid-block vertical no-overflow",style:{zIndex:1002,paddingLeft:"2rem",paddingRight:"2rem",paddingTop:"1rem"}},i))}}us=(0,it.N)(us,{listenTo:()=>[n.A],getProps:e=>({fee_asset_symbol:n.A.getState().settings.get("fee_asset")})}),us=(0,L.A)(us);class gs extends a.Component{constructor(){super(),this.state={open:!1}}show(){this.setState({open:!0},(()=>{Jt().publish(this.props.modalId,"open")}))}onClose(){this.setState({open:!1})}render(){const e="deposit"===this.props.action?y().translate("gateway.deposit"):y().translate("modal.withdraw.submit");return a.createElement(u.Modal,{title:e,footer:[],visible:this.props.visible,onCancel:this.props.hideModal,className:"test",onClose:this.onClose.bind(this),overlay:!0,id:this.props.modalId},this.props.visible?a.createElement(us,ms({},this.props,{open:this.props.visible})):null)}}var bs=s(15255),_s=s(60819);class ys extends a.Component{constructor(e){super(e),this.state={rules:[]},this.handleSave=this.handleSave.bind(this),this.handleAddRule=this.handleAddRule.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleDeleteRule=this.handleDeleteRule.bind(this),this.handlePriceChange=this.handlePriceChange.bind(this),this.handlePriceFieldBlur=this.handlePriceFieldBlur.bind(this)}componentDidUpdate(e){if(!e.visible&&this.props.visible){let e={type:K.zD.HIGHER_THAN,price:this.props.latestPrice?Number(this.props.latestPrice):null},t=[];t=this.props.rules.length?this.props.rules:this.state.openedPreviously?[]:[e],this.setState({rules:t,openedPreviously:!0})}}handleTypeChange(e){return t=>{let s=this.state.rules.map(((s,a)=>{if(Number(e)!==Number(a))return s;let r=this.validatePrice(t,Number(s.price),Number(this.props.latestPrice));return{...s,...r,type:String(t)}}));this.setState({rules:s})}}validatePrice(e,t,s){return e===K.zD.HIGHER_THAN&&t<s?{validateStatus:"error",help:"Price of Alert should be higher than current price"}:e===K.zD.LOWER_THAN&&t>s?{validateStatus:"error",help:"Price of Alert should be lower than current price"}:{validateStatus:"success",help:""}}validatePriceFieldByKey(e){let t=this.state.rules.map(((t,s)=>{if(Number(e)!==Number(s))return t;const a=this.validatePrice(t.type,Number(t.price),Number(this.props.latestPrice));return{...t,validateStatus:a.validateStatus,help:a.help}}));this.setState({rules:t})}handlePriceFieldBlur(e){return()=>{this.validatePriceFieldByKey(e)}}handlePriceChange(e){return t=>{let s=this.state.rules.map(((s,a)=>{if(Number(e)!==Number(a))return s;let r={};return s.validateStatus&&(r=this.validatePrice(s.type,Number(t.target.value),Number(this.props.latestPrice))),{...s,...r,price:t.target.value}}));this.setState({rules:s})}}handleAddRule(){let e=[...this.state.rules];e.push({type:K.zD.HIGHER_THAN,price:this.props.latestPrice?Number(this.props.latestPrice):null}),this.setState({rules:e})}handleDeleteRule(e){return()=>{let t=this.state.rules.filter(((t,s)=>Number(s)!==Number(e)));this.setState({rules:t})}}handleSave(){this.props.onSave(this.state.rules)}render(){if(!(this.props.quoteAsset&&this.props.quoteAsset.get&&this.props.baseAsset&&this.props.baseAsset.get))return null;const e=[a.createElement(u.Button,{key:"submit",type:"primary",onClick:this.handleSave},y().translate("modal.save")),a.createElement(u.Button,{key:"cancel",onClick:this.props.hideModal},y().translate("modal.cancel"))],t=this.props.baseAsset.get("symbol"),s=this.props.quoteAsset.get("symbol"),r=`${s}_${t}`;return a.createElement(u.Modal,{visible:this.props.visible,onCancel:this.props.hideModal,title:y().translate("exchange.price_alert.title"),footer:e},a.createElement("div",{className:"exchange--price-alert"},a.createElement("div",{className:"exchange--price-alert--description"},this.state.rules.length?a.createElement("div",null,y().translate("exchange.price_alert.alert_when")," ",a.createElement(we.N_,{to:r},a.createElement(z.A,{name:s}),"/",a.createElement(z.A,{name:t}))," ","price:"):a.createElement("div",null,y().translate("exchange.price_alert.use_button"),a.createElement(we.N_,{to:r},a.createElement(z.A,{name:s}),"/",a.createElement(z.A,{name:t})),":"),a.createElement(u.Form,{layout:"vertical"},a.createElement("div",{className:"exchange--price-alert--items"},this.state.rules.map(((e,s)=>a.createElement(u.Form.Item,{key:s,validateStatus:e.validateStatus||null,help:e.help||null},a.createElement(u.Input.Group,{className:"exchange--price-alert--item",compact:!0},a.createElement(u.Select,{value:e.type,style:{width:"200px"},onChange:this.handleTypeChange(s)},a.createElement(u.Select.Option,{value:K.zD.HIGHER_THAN,key:"1"},y().translate("exchange.price_alert.higher_than")),a.createElement(u.Select.Option,{value:K.zD.LOWER_THAN,key:"2"},y().translate("exchange.price_alert.lower_than"))),a.createElement(u.Input,{onBlur:this.handlePriceFieldBlur(s),style:{width:"calc(100% - 200px - 32px)",marginTop:"1px"},onChange:this.handlePriceChange(s),value:e.price,className:"exchange--price-alert--item--price",placeholder:y().translate("exchange.price_alert.price"),addonAfter:a.createElement(z.A,{name:t})}),a.createElement(u.Button,{style:{width:"32px"},onClick:this.handleDeleteRule(s),className:"exchange--price-alert--item--control",type:"icon",icon:"delete"})))))),a.createElement("div",{className:"exchange--price-alert--items--add"},a.createElement("a",{href:"javascript:void(0)",onClick:this.handleAddRule},a.createElement(u.Icon,{type:"plus"})," ",y().translate("exchange.price_alert.add_rule")))))))}}const fs=ys=(0,_s.A)(ys,{propNames:["quoteAsset","baseAsset"]});function As(){return As=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},As.apply(this,arguments)}class Es extends a.Component{static propTypes={marketCallOrders:w().object.isRequired,activeMarketHistory:w().object.isRequired,viewSettings:w().object.isRequired};static defaultProps={marketCallOrders:[],activeMarketHistory:{},viewSettings:{}};constructor(e){super(),this.state={...this._initialState(e),expirationType:{bid:e.exchange.getIn(["lastExpiration","bid"])||"YEAR",ask:e.exchange.getIn(["lastExpiration","ask"])||"YEAR"},expirationCustomTime:{bid:"Specific",ask:"Specific"},feeStatus:{}},this._getWindowSize=(0,h.A)(this._getWindowSize.bind(this),150),this._checkFeeStatus=this._checkFeeStatus.bind(this),this._handleExpirationChange=this._handleExpirationChange.bind(this),this._handleCustomExpirationChange=this._handleCustomExpirationChange.bind(this),this.showPersonalizeModal=this.showPersonalizeModal.bind(this),this.hidePersonalizeModal=this.hidePersonalizeModal.bind(this),this.showConfirmSellOrderModal=this.showConfirmSellOrderModal.bind(this),this.hideConfirmSellOrderModal=this.hideConfirmSellOrderModal.bind(this),this.showConfirmBuyOrderModal=this.showConfirmBuyOrderModal.bind(this),this.hideConfirmBuyOrderModal=this.hideConfirmBuyOrderModal.bind(this),this.showMarketPickerModal=this.showMarketPickerModal.bind(this),this.hideMarketPickerModal=this.hideMarketPickerModal.bind(this),this.showDepositBridgeModal=this.showDepositBridgeModal.bind(this),this.hideDepositBridgeModal=this.hideDepositBridgeModal.bind(this),this.showDepositModal=this.showDepositModal.bind(this),this.hideDepositModal=this.hideDepositModal.bind(this),this.showBorrowQuoteModal=this.showBorrowQuoteModal.bind(this),this.hideBorrowQuoteModal=this.hideBorrowQuoteModal.bind(this),this.showBorrowBaseModal=this.showBorrowBaseModal.bind(this),this.hideBorrowBaseModal=this.hideBorrowBaseModal.bind(this),this.showPriceAlertModal=this.showPriceAlertModal.bind(this),this.hidePriceAlertModal=this.hidePriceAlertModal.bind(this),this.showScaledOrderModal=this.showScaledOrderModal.bind(this),this.hideScaledOrderModal=this.hideScaledOrderModal.bind(this),this.handlePriceAlertSave=this.handlePriceAlertSave.bind(this),this._createScaledOrder=this._createScaledOrder.bind(this),this.psInit=!0}handleOrderTypeTabChange(e,t){x.A.changeViewSetting({[`order-form-${e}`]:t})}handlePriceAlertSave(e=[]){e=e.map((e=>({type:e.type,price:e.price,baseAssetSymbol:this.props.baseAsset.get("symbol"),quoteAssetSymbol:this.props.quoteAsset.get("symbol")})));let t=this.props.priceAlert.filter((e=>e&&this.props.baseAsset&&this.props.quoteAsset&&(e.get("baseAssetSymbol")!==this.props.baseAsset.get("symbol")||e.get("quoteAssetSymbol")!==this.props.quoteAsset.get("symbol"))));t=[...t,...e],x.A.setPriceAlert(t),this.hidePriceAlertModal()}getPriceAlertRules(){return this.props.priceAlert.filter((e=>e&&this.props.baseAsset&&this.props.quoteAsset&&e.get("baseAssetSymbol")===this.props.baseAsset.get("symbol")&&e.get("quoteAssetSymbol")===this.props.quoteAsset.get("symbol"))).toJS()}_handleExpirationChange(e,t){let s={...this.state.expirationType,[e]:t.target.value};"SPECIFIC"!==t.target.value&&x.A.setExchangeLastExpiration({...this.props.exchange.has("lastExpiration")&&this.props.exchange.get("lastExpiration").toJS()||{},[e]:t.target.value}),this.setState({expirationType:s})}_handleCustomExpirationChange(e,t){let s={...this.state.expirationCustomTime,[e]:t};this.setState({expirationCustomTime:s})}EXPIRATIONS={HOUR:{title:"1 hour",get:()=>v()().add(1,"hour").valueOf()},"12HOURS":{title:"12 hours",get:()=>v()().add(12,"hour").valueOf()},"24HOURS":{title:"24 hours",get:()=>v()().add(1,"day").valueOf()},"7DAYS":{title:"7 days",get:()=>v()().add(7,"day").valueOf()},MONTH:{title:"30 days",get:()=>v()().add(30,"day").valueOf()},YEAR:{title:"1 year",get:()=>v()().add(1,"year").valueOf()},SPECIFIC:{title:"Specific",get:e=>this.state.expirationCustomTime[e].valueOf()}};_initialOrderState(e){let t={forSaleText:"",toReceiveText:"",priceText:"",for_sale:new B.Vd({asset_id:e.baseAsset.get("id"),precision:e.baseAsset.get("precision")}),to_receive:new B.Vd({asset_id:e.quoteAsset.get("id"),precision:e.quoteAsset.get("precision")})};t.price=new B.gm({base:t.for_sale,quote:t.to_receive});let s={forSaleText:"",toReceiveText:"",priceText:"",for_sale:new B.Vd({asset_id:e.quoteAsset.get("id"),precision:e.quoteAsset.get("precision")}),to_receive:new B.Vd({asset_id:e.baseAsset.get("id"),precision:e.baseAsset.get("precision")})};return s.price=new B.gm({base:s.for_sale,quote:s.to_receive}),{ask:s,bid:t}}_initialState(e){let t=e.viewSettings,{ask:s,bid:a}=this._initialOrderState(e),r=t.get("chartHeight",620);return 620==r&&window.innerWidth<640&&(r=425),{isDepositBridgeModelLoaded:!1,isDepositModalLoaded:!1,isPersonalizeModalLoaded:!1,isMarketPickerModalLoaded:!1,isBorrowQuoteModalLoaded:!1,isBorrowBaseModalLoaded:!1,isDepositBridgeModalVisible:!1,isDepositModalVisible:!1,isPersonalizeModalVisible:!1,isMarketPickerModalVisible:!1,isBorrowQuoteModalVisible:!1,isBorrowBaseModalVisible:!1,history:[],isConfirmBuyOrderModalVisible:!1,isConfirmBuyOrderModalLoaded:!1,isConfirmSellOrderModalVisible:!1,isPriceAlertModalVisible:!1,isScaledOrderModalVisible:!1,isConfirmSellOrderModalLoaded:!1,tabVerticalPanel:t.get("tabVerticalPanel","my-market"),tabBuySell:t.get("tabBuySell","buy"),buySellOpen:t.get("buySellOpen",!0),bid:a,ask:s,height:window.innerHeight,width:window.innerWidth,favorite:!1,buyDiff:!1,sellDiff:!1,autoScroll:t.get("global_AutoScroll",!0),buySellTop:t.get("buySellTop",!0),buyFeeAssetIdx:t.get("buyFeeAssetIdx",0),sellFeeAssetIdx:t.get("sellFeeAssetIdx",0),verticalOrderBook:t.get("verticalOrderBook",!1),verticalOrderForm:t.get("verticalOrderForm",!1),hidePanel:t.get("hidePanel",!1),hideScrollbars:t.get("hideScrollbars",!1),singleColumnOrderForm:t.get("singleColumnOrderForm",!0),flipOrderBook:t.get("flipOrderBook",!1),flipBuySell:t.get("flipBuySell",!1),orderBookReversed:t.get("orderBookReversed",!1),chartType:t.get("chartType","price_chart"),chartHeight:r,chartZoom:t.get("chartZoom",!0),chartTools:t.get("chartTools",!1),hideFunctionButtons:t.get("hideFunctionButtons",!0),currentPeriod:t.get("currentPeriod",7776e3),showMarketPicker:!1,activePanels:t.get("activePanels",["left","right"]),mobileKey:[""],forceReRender:0,panelWidth:0,mirrorPanels:t.get("mirrorPanels",!1),panelTabs:t.get("panelTabs",{my_history:1,history:1,my_orders:2,open_settlement:2}),panelTabsActive:t.get("panelTabsActive",{1:"my_history",2:"my_orders"})}}showMarketPickerModal(){this.setState({isMarketPickerModalVisible:!0,isMarketPickerModalLoaded:!0})}hideMarketPickerModal(){this.setState({isMarketPickerModalVisible:!1})}showPersonalizeModal(){this.setState({isPersonalizeModalVisible:!0,isPersonalizeModalLoaded:!0})}hidePersonalizeModal(){this.setState({isPersonalizeModalVisible:!1})}showPriceAlertModal(){this.setState({isPriceAlertModalVisible:!0})}hidePriceAlertModal(){this.setState({isPriceAlertModalVisible:!1})}showScaledOrderModal(){this.setState({isScaledOrderModalVisible:!0})}hideScaledOrderModal(){this.setState({isScaledOrderModalVisible:!1})}showBorrowQuoteModal(){this.setState({isBorrowQuoteModalVisible:!0,isBorrowQuoteModalLoaded:!0})}hideBorrowQuoteModal(){this.setState({isBorrowQuoteModalVisible:!1})}showBorrowBaseModal(){this.setState({isBorrowBaseModalVisible:!0,isBorrowBaseModalLoaded:!0})}hideBorrowBaseModal(){this.setState({isBorrowBaseModalVisible:!1})}showDepositBridgeModal(){this.setState({isDepositBridgeModalVisible:!0,isDepositBridgeModalLoaded:!0})}hideDepositBridgeModal(){this.setState({isDepositBridgeModalVisible:!1})}showDepositModal(){this.setState({isDepositModalVisible:!0,isDepositModalLoaded:!0})}hideDepositModal(){this.setState({isDepositModalVisible:!1})}_getLastMarketKey(){const e=p.Apis.instance().chain_id;return"lastMarket"+(e?"_"+e.substr(0,8):"")}showConfirmBuyOrderModal(){this.setState({isConfirmBuyOrderModalVisible:!0,isConfirmBuyOrderModalLoaded:!0})}hideConfirmBuyOrderModal(){this.setState({isConfirmBuyOrderModalVisible:!1})}showConfirmSellOrderModal(){this.setState({isConfirmSellOrderModalVisible:!0,isConfirmSellOrderModalLoaded:!0})}hideConfirmSellOrderModal(){this.setState({isConfirmSellOrderModalVisible:!1})}UNSAFE_componentWillMount(){window.addEventListener("resize",this._setDimensions,{capture:!1,passive:!0}),this._checkFeeStatus()}componentDidMount(){N.A.getTrackedGroupsConfig(),x.A.changeViewSetting.defer({[this._getLastMarketKey()]:this.props.quoteAsset.get("symbol")+"_"+this.props.baseAsset.get("symbol")}),window.addEventListener("resize",this._getWindowSize,{capture:!1,passive:!0})}_forceRender(e,t){this.state.forceReRender&&this.setState({forceReRender:!1}),O.A.are_equal_shallow(this.state.activePanels,t.activePanels)&&O.A.are_equal_shallow(this.state.verticalOrderBook,t.verticalOrderBook)&&e.quoteAsset===this.props.quoteAsset&&e.baseAsset===this.props.baseAsset||this.setState({forceReRender:!0})}shouldComponentUpdate(e,t){let{expirationType:s}=this.state;if(this._forceRender(e,t),!e.marketReady&&!this.props.marketReady)return!1;let a=!1,r=!1;e.quoteAsset===this.props.quoteAsset&&e.baseAsset===this.props.baseAsset||this.setState({expirationType:{bid:"SPECIFIC"==s.bid?s.bid:"YEAR",ask:"SPECIFIC"==s.ask?s.ask:"YEAR"}});for(let t in e)if(e.hasOwnProperty(t)&&(a=a||!O.A.are_equal_shallow(e[t],this.props[t]),a))break;for(let e in t.panelTabsActive)r=!O.A.are_equal_shallow(t.panelTabsActive[e],this.state.panelTabsActive[e]);return a||r||!O.A.are_equal_shallow(t,this.state)}_checkFeeStatus(e=[this.props.coreAsset,this.props.baseAsset,this.props.quoteAsset],t=this.props.currentAccount){let s={},a=[];e.forEach((e=>{a.push((0,F.hQ)({accountID:t.get("id"),feeID:e.get("id"),type:"limit_order_create"}))})),Promise.all(a).then((t=>{e.forEach(((e,a)=>{s[e.get("id")]=t[a]})),O.A.are_equal_shallow(this.state.feeStatus,s)||this.setState({feeStatus:s})})).catch((e=>{console.error("checkFeeStatusAsync error",e),this.setState({feeStatus:{}})}))}_getWindowSize(){let{innerHeight:e,innerWidth:t}=window;if(e!==this.state.height||t!==this.state.width){this.setState({height:e,width:t});let s=this.refs.center;s&&S().update(s)}}componentDidUpdate(e,t){if(this._initPsContainer(),!this.props.exchange.get("tutorialShown")&&e.coreAsset&&t.feeStatus&&!this.tutorialShown){this.tutorialShown=!0;const e=this.props.settings.get("themes");A().introJs().setOptions({tooltipClass:e,highlightClass:e,showBullets:!1,hideNext:!0,hidePrev:!0,nextLabel:y().translate("walkthrough.next_label"),prevLabel:y().translate("walkthrough.prev_label"),skipLabel:y().translate("walkthrough.skip_label"),doneLabel:y().translate("walkthrough.done_label")}).start(),x.A.setExchangeTutorialShown.defer(!0)}}_initPsContainer(){if(this.refs.center&&this.psInit){let e=this.refs.center;e&&(S().initialize(e),this.psInit=!1)}}UNSAFE_componentWillReceiveProps(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)),x.A.changeViewSetting({[this._getLastMarketKey()]:e.quoteAsset.get("symbol")+"_"+e.baseAsset.get("symbol")})}componentWillUnmount(){window.removeEventListener("resize",this._getWindowSize)}_getFeeAssets(e,t,s){let{currentAccount:a}=this.props;const{feeStatus:r}=this.state;function i(e,t){-1===e.indexOf(t)&&e.push(t)}let n=[s,e===s?t:e];i(n,e),i(n,t);let o=[s,t===s?e:t];i(o,e),i(o,t);let l={};function c(e,t,a){let i;return(e=e.filter((e=>{return!!t[e.get("id")]&&(s=e.get("id"),r[s]&&r[s].hasPoolBalance&&function(e){return r[e]&&r[e].hasBalance}(e.get("id")));var s}))).length?i=e[Math.min(e.length-1,a)]:(i=s,e.push(s)),{assets:e,asset:i}}a.get("balances",[]).filter(((s,a)=>["1.3.0",e.get("id"),t.get("id")].indexOf(a)>=0)).forEach(((e,t)=>{let s=m.ChainStore.getObject(e);l[t]={balance:s?parseInt(s.get("balance"),10):0,fee:this._getFee(m.ChainStore.getAsset(t))}}));let{assets:d,asset:h}=c(n,l,this.state.sellFeeAssetIdx),{assets:p,asset:u}=c(o,l,this.state.buyFeeAssetIdx);return{sellFeeAsset:h,sellFeeAssets:d,sellFee:this._getFee(h),buyFeeAsset:u,buyFeeAssets:p,buyFee:this._getFee(u)}}_getFee(e=this.props.coreAsset){return this.state.feeStatus[e.get("id")]&&this.state.feeStatus[e.get("id")].fee}_verifyFee(e,t,s,a){let r=this._getFee();return"1.3.0"===e.asset_id?r.getAmount()<=a?"1.3.0":null:(t.asset_id===e.asset_id?e.getAmount()+t.getAmount():t.getAmount())<=s?e.asset_id:r.getAmount()<=a&&"1.3.0"!==e.asset_id?"1.3.0":null}_createLimitOrderConfirm(e,t,s,a,r,i,n=!0,o){o.preventDefault();let{highestBid:l,lowestAsk:c}=this.props.marketData,d=this.state["sell"===i?"ask":"bid"];s=d.for_sale.clone(s?parseInt(m.ChainStore.getObject(s).toJS().balance,10):0),a=new B.Vd({amount:a?parseInt(m.ChainStore.getObject(a).toJS().balance,10):0});let h=this._getFee(r),p=this._verifyFee(h,d.for_sale,s.getAmount(),a.getAmount());if(!p)return u.Notification.error({message:y().translate("notifications.exchange_insufficient_funds_for_fees")});if("buy"===i&&c){let e=this.state.bid.price.toReal()/c.getPrice();if(e>1.2)return this.showConfirmBuyOrderModal(),this.setState({buyDiff:e})}else if("sell"===i&&l){let e=1/(this.state.ask.price.toReal()/l.getPrice());if(e>1.2)return this.showConfirmSellOrderModal(),this.setState({sellDiff:e})}let g=t.getIn(["bitasset","is_prediction_market"]);return d.for_sale.gt(s)&&!g?u.Notification.error({message:y().translate("notifications.exchange_insufficient_funds_to_place_order",{amount:d.for_sale.getAmount({real:!0}),symbol:t.get("symbol")})}):d.for_sale.getAmount()>0&&d.to_receive.getAmount()>0?"sell"===i&&g&&n?this._createPredictionShort(p):void this._createLimitOrder(i,p):u.Notification.warning({message:y().translate("notifications.exchange_enter_valid_values")})}_createScaledOrder(e,t){const s=e.map((e=>new B.uw({for_sale:e.for_sale,expiration:new Date(e.expirationTime||!1),to_receive:e.to_receive,seller:this.props.currentAccount.get("id"),fee:{asset_id:t,amount:0}})));return N.A.createLimitOrder2(s).then((e=>{e.error&&"wallet locked"!==e.error.message&&u.Notification.error({message:y().translate("notifications.exchange_unknown_error_place_scaled_order")}),console.log("order success")})).catch((e=>{console.log("order failed:",e)}))}_createLimitOrder(e,t){let s="sell"===e?"ask":"bid",a=this.state[s],r=null;r="SPECIFIC"===this.state.expirationType[s]?this.EXPIRATIONS[this.state.expirationType[s]].get(s):this.EXPIRATIONS[this.state.expirationType[s]].get();const i=new B.uw({for_sale:a.for_sale,expiration:new Date(r||!1),to_receive:a.to_receive,seller:this.props.currentAccount.get("id"),fee:{asset_id:t,amount:0}}),{marketName:n,first:o}=P.A.getMarketName(this.props.baseAsset,this.props.quoteAsset),l=this.props.marketDirections.get(n);if(l&&o.get("id")!==this.props.baseAsset.get("id")||!l&&o.get("id")===this.props.baseAsset.get("id")){let e={};e[n]=!l,x.A.changeMarketDirection(e)}return N.A.createLimitOrder2(i).then((e=>{e.error&&"wallet locked"!==e.error.message&&u.Notification.error({message:y().translate("notifications.exchange_unknown_error_place_order",{amount:a.to_receive.getAmount({real:!0}),symbol:a.to_receive.asset_id})})})).catch((e=>{console.error("order failed:",e)}))}_clearForms(e){let{ask:t,bid:s}=this._initialOrderState(this.props);e?"ask"==e?this.setState({ask:t}):"bid"==e&&this.setState({bid:s}):this.setState({bid:s,ask:t})}_createPredictionShort(e){let t=this.state.ask;const s=new B.uw({for_sale:t.for_sale,to_receive:t.to_receive,seller:this.props.currentAccount.get("id"),fee:{asset_id:e,amount:0}});Promise.all([(0,m.FetchChain)("getAsset",this.props.quoteAsset.getIn(["bitasset","options","short_backing_asset"]))]).then((e=>{let[t]=e,a=new B.Vd({amount:s.amount_for_sale.getAmount(),asset_id:t.get("id"),precision:t.get("precision")});N.A.createPredictionShort(s,a).then((e=>{e.error&&"wallet locked"!==e.error.message&&u.Notification.error({message:y().translate("notifications.exchange_unknown_error_place_order",{amount:buyAssetAmount,symbol:buyAsset.symbol})})}))}))}_forceBuy(e,t,s,a){let r=this.state["sell"===e?"ask":"bid"];s=r.for_sale.clone(s?parseInt(m.ChainStore.getObject(s).get("balance"),10):0),a=new B.Vd({amount:a?parseInt(m.ChainStore.getObject(a).toJS().balance,10):0});let i=this._getFee(t),n=this._verifyFee(i,r.for_sale,s.getAmount(),a.getAmount());n?this._createLimitOrder(e,n):console.error("Unable to pay fees, aborting limit order creation")}_forceSell(e,t,s,a){let r=this.state["sell"===e?"ask":"bid"];s=r.for_sale.clone(s?parseInt(m.ChainStore.getObject(s).get("balance"),10):0),a=new B.Vd({amount:a?parseInt(m.ChainStore.getObject(a).toJS().balance,10):0});let i=this._getFee(t),n=this._verifyFee(i,r.for_sale,s.getAmount(),a.getAmount());n?this._createLimitOrder(e,n):console.error("Unable to pay fees, aborting limit order creation")}_cancelLimitOrder(e,t){t.preventDefault();let{currentAccount:s}=this.props;N.A.cancelLimitOrder(s.get("id"),e)}_changeZoomPeriod(e,t){t.preventDefault(),e!==this.state.currentPeriod&&(this.setState({currentPeriod:e}),x.A.changeViewSetting({currentPeriod:e}))}_onGroupOrderLimitChange(e){let t;if("object"==typeof e&&(e.preventDefault(),t=parseInt(e.target.value)),"number"==typeof e&&(t=parseInt(e)),N.A.changeCurrentGroupLimit(t),t!==this.props.currentGroupOrderLimit){N.A.changeCurrentGroupLimit(t);let e=this.props.sub.split("_");N.A.unSubscribeMarket(e[0],e[1]).then((()=>{this.props.subToMarket(this.props,this.props.bucketSize,t)}))}}_depthChartClick(e,t,s){s.preventDefault();let{bid:a,ask:r}=this.state;a.price=new B.gm({base:this.state.bid.for_sale,quote:this.state.bid.to_receive,real:s.xAxis[0].value}),a.priceText=a.price.toReal(),r.price=new B.gm({base:this.state.ask.to_receive,quote:this.state.ask.for_sale,real:s.xAxis[0].value}),r.priceText=r.price.toReal();let i={bid:a,ask:r,depthLine:a.price.toReal()};this._setForSale(a,!0)||this._setReceive(a,!0),this._setReceive(r)||this._setForSale(r),this._setPriceText(a,!0),this._setPriceText(r,!1),this.setState(i)}_setAutoscroll(e){this.setState({autoScroll:e})}_togglePanel(e){if(!e)return;let t=[];this.state.activePanels.forEach((s=>{s!==e&&t.push(s)})),this.state.activePanels.includes(e)||t.push(e),this.setState({activePanels:t}),x.A.changeViewSetting({activePanels:t})}_toggleChart(e){this.setState({chartType:e}),x.A.changeViewSetting({chartType:e})}_chartZoom=()=>{x.A.changeViewSetting({chartZoom:!this.state.chartZoom});let e=this.state.chartType;this.setState({chartZoom:!this.state.chartZoom,chartType:"hidden_chart"}),setTimeout((()=>{this.setState({chartType:e})}),100)};_chartTools=()=>{x.A.changeViewSetting({chartTools:!this.state.chartTools});let e=this.state.chartType;this.setState({chartTools:!this.state.chartTools,chartType:"hidden_chart"}),setTimeout((()=>{this.setState({chartType:e})}),100)};_flipBuySell(){this.setState({flipBuySell:!this.state.flipBuySell}),x.A.changeViewSetting({flipBuySell:!this.state.flipBuySell})}_flipOrderBook=()=>{x.A.changeViewSetting({flipOrderBook:!this.state.flipOrderBook}),this.setState({flipOrderBook:!this.state.flipOrderBook})};_orderBookReversed=()=>{x.A.changeViewSetting({orderBookReversed:!this.state.orderBookReversed}),this.setState({orderBookReversed:!this.state.orderBookReversed})};_hideFunctionButtons=()=>{x.A.changeViewSetting({hideFunctionButtons:!this.state.hideFunctionButtons}),this.setState({hideFunctionButtons:!this.state.hideFunctionButtons})};_toggleOpenBuySell(){x.A.changeViewSetting({buySellOpen:!this.state.buySellOpen}),this.setState({buySellOpen:!this.state.buySellOpen})}_toggleMarketPicker(e){let t=!!e;t&&this.showMarketPickerModal(),this.setState({showMarketPicker:t,marketPickerAsset:e})}_moveOrderBook(){this.state.verticalOrderForm&&this._moveOrderForm(),x.A.changeViewSetting({verticalOrderBook:!this.state.verticalOrderBook}),this.setState({verticalOrderBook:!this.state.verticalOrderBook})}_moveOrderForm(){this.state.verticalOrderBook&&this._moveOrderBook(),x.A.changeViewSetting({verticalOrderForm:!this.state.verticalOrderForm}),this.setState({verticalOrderForm:!this.state.verticalOrderForm})}_togglePersonalize(){this.state.isPersonalizeModalVisible?this.setState({isPersonalizeModalVisible:!this.state.isPersonalizeModalVisible}):this.setState({isPersonalizeModalVisible:!this.state.isPersonalizeModalVisible,isPersonalizeModalLoaded:!0})}_toggleScrollbars(){x.A.changeViewSetting({hideScrollbars:!this.state.hideScrollbars}),this.setState({hideScrollbars:!this.state.hideScrollbars})}_toggleSingleColumnOrderForm(){x.A.changeViewSetting({singleColumnOrderForm:!this.state.singleColumnOrderForm}),this.setState({singleColumnOrderForm:!this.state.singleColumnOrderForm})}_mirrorPanels(){this.setState({mirrorPanels:!this.state.mirrorPanels}),x.A.changeViewSetting({mirrorPanels:!this.state.mirrorPanels})}_currentPriceClick(e,t){const s="bid"===e;let a=this.state[e];a.price=t[s?"invert":"clone"](),a.priceText=a.price.toReal(),s?this._setForSale(a,s)||this._setReceive(a,s):this._setReceive(a,s)||this._setForSale(a,s),this.forceUpdate()}_orderbookClick(e){const t=e.isBid();let s=e.totalToReceive({noCache:!0}),a=s.times(e.sellPrice()),r=new B.gm({base:t?a:s,quote:t?s:a}),i=this.state[t?"bid":"ask"];i.price=r,i.priceText=r.toReal();let n={[t?"ask":"bid"]:{for_sale:s,forSaleText:s.getAmount({real:!0}),to_receive:a,toReceiveText:a.getAmount({real:!0}),price:r,priceText:r.toReal()}};t?this._setForSale(i,t)||this._setReceive(i,t):this._setReceive(i,t)||this._setForSale(i,t),this.setState(n)}_borrowQuote(){this.showBorrowQuoteModal()}_borrowBase(){this.showBorrowBaseModal()}_onDeposit(e){this.setState({depositModalType:e}),this.showDepositModal()}_onBuy(e){this.setState({buyModalType:e}),this.showDepositBridgeModal()}_getSettlementInfo(){let{lowestCallPrice:e,feedPrice:t,quoteAsset:s}=this.props,a=!1;return t&&(a=t.inverted?e<=t.toReal():e>=t.toReal()),!(!a||!e||s.getIn(["bitasset","is_prediction_market"]))}_setTabVerticalPanel(e){this.setState({tabVerticalPanel:e}),x.A.changeViewSetting({tabVerticalPanel:e})}_setTabBuySell(e){this.setState({tabBuySell:e}),x.A.changeViewSetting({tabBuySell:e})}_setPanelTabInGroup(e,t){let{panelTabsActive:s}=this.state;Object.keys(s).map((a=>{a==e&&(s[a]=t)})),this.setState({panelTabsActive:s,forceReRender:!0}),x.A.changeViewSetting({panelTabsActive:s})}_setPanelTabs(e,t){let{panelTabs:s,panelTabsActive:a}=this.state,r={panelTabs:s,panelTabsActive:a};Object.keys(s).map((a=>{r.panelTabs[a]=a==e?t:s[a]})),Object.keys(a).map((e=>{r.panelTabsActive[e]=""})),this.setState({newState:r}),x.A.changeViewSetting({...r})}onChangeFeeAsset(e,t){"buy"===e?(this.setState({buyFeeAssetIdx:t}),x.A.changeViewSetting({buyFeeAssetIdx:t})):(this.setState({sellFeeAssetIdx:t}),x.A.changeViewSetting({sellFeeAssetIdx:t}))}onChangeChartHeight({value:e,increase:t}){let s=e||this.state.chartHeight+(t?20:-20);s<425&&(s=425),s>1e3&&(s=1e3),this.setState({chartHeight:s}),x.A.changeViewSetting({chartHeight:s})}_toggleBuySellPosition(){this.setState({buySellTop:!this.state.buySellTop}),x.A.changeViewSetting({buySellTop:!this.state.buySellTop})}_setReceive(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))}_setForSale(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))}_setPrice(e){return!(!e.for_sale.hasAmount()||!e.to_receive.hasAmount()||(e.price=new B.gm({base:e.for_sale,quote:e.to_receive}),e.priceText=e.price.toReal().toString(),0))}_setPriceText(e,t){const s=e[t?"for_sale":"to_receive"],a=e[t?"to_receive":"for_sale"];s.hasAmount()&&a.hasAmount()&&(e.priceText=new B.gm({base:s,quote:a}).toReal().toString())}_onInputPrice(e,t){let s=this.state[e];const a="bid"===e;s.price=new B.gm({base:s[a?"for_sale":"to_receive"],quote:s[a?"to_receive":"for_sale"],real:parseFloat(t.target.value)||0}),a?this._setForSale(s,a)||this._setReceive(s,a):this._setReceive(s,a)||this._setForSale(s,a),s.priceText=t.target.value,this.forceUpdate()}_onInputSell(e,t,s){let a=this.state[e];a.for_sale.setAmount({real:parseFloat(s.target.value)||0}),a.price.isValid()?this._setReceive(a,t):this._setPrice(a),a.forSaleText=s.target.value,this._setPriceText(a,"bid"===e),this.forceUpdate()}_onInputReceive(e,t,s){let a=this.state[e];a.to_receive.setAmount({real:parseFloat(s.target.value)||0}),a.price.isValid()?this._setForSale(a,t):this._setPrice(a),a.toReceiveText=s.target.value,this._setPriceText(a,"bid"===e),this.forceUpdate()}isMarketFrozen(){let{baseAsset:e,quoteAsset:t}=this.props,s=e.getIn(["options","whitelist_markets"]).toJS(),a=t.getIn(["options","whitelist_markets"]).toJS(),r=e.getIn(["options","blacklist_markets"]).toJS(),i=t.getIn(["options","blacklist_markets"]).toJS();return a.length&&-1===a.indexOf(e.get("id"))?{isFrozen:!0,frozenAsset:t.get("symbol")}:s.length&&-1===s.indexOf(t.get("id"))?{isFrozen:!0,frozenAsset:e.get("symbol")}:i.length&&-1!==i.indexOf(e.get("id"))?{isFrozen:!0,frozenAsset:t.get("symbol")}:r.length&&-1!==r.indexOf(t.get("id"))?{isFrozen:!0,frozenAsset:e.get("symbol")}:{isFrozen:!1}}_toggleMiniChart(){x.A.changeViewSetting({miniDepthChart:!this.props.miniDepthChart})}_onChangeMobilePanel(e){this.setState({mobileKey:e})}render(){let{currentAccount:e,marketLimitOrders:t,marketCallOrders:s,marketData:r,activeMarketHistory:i,invertedCalls:n,starredMarkets:o,quoteAsset:l,baseAsset:c,lowestCallPrice:d,marketStats:h,marketReady:p,marketSettleOrders:m,bucketSize:g,totals:_,feedPrice:f,buckets:A,coreAsset:E,trackedGroupsConfig:v,currentGroupOrderLimit:k}=this.props;const{combinedBids:S,combinedAsks:C,lowestAsk:w,highestBid:x,flatBids:N,flatAsks:P,flatCalls:B,flatSettles:F,groupedBids:O,groupedAsks:M}=r;let{bid:q,ask:R,verticalOrderBook:L,verticalOrderForm:D,chartHeight:V,chartType:z,flipBuySell:H,buyDiff:U,sellDiff:W,width:$,buySellTop:j,tabBuySell:G,tabVerticalPanel:K,hidePanel:Y,hideScrollbars:J,buyModalType:Z,depositModalType:X,autoScroll:ee,activePanels:te,panelWidth:se,mirrorPanels:ae,panelTabsActive:re,panelTabs:ie,singleColumnOrderForm:ne,flipOrderBook:oe,orderBookReversed:le,chartZoom:ce,chartTools:de,hideFunctionButtons:he}=this.state;const{isFrozen:pe,frozenAsset:me}=this.isMarketFrozen();let ue=$;this.refs.center&&(ue=this.refs.center.clientWidth);let ge,be,_e,ye,fe=null,Ae=null,Ee=null,ve=null,ke=null,Se=null,we=!1;const xe=this.props.viewSettings.get("showVolumeChart",!0);let Ne=$<850,Te=$<640;if(J=!!Te||J,l.size&&c.size&&e.size){if(fe=c,Ae=l,be=fe.get("symbol"),ge=Ae.get("symbol"),Ee=e.get("balances").toJS(),Ee)for(let e in Ee)e===Ae.get("id")&&(ve=Ee[e]),e===fe.get("id")&&(ke=Ee[e]),"1.3.0"===e&&(Se=Ee[e]);we=this._getSettlementInfo()}let Pe=!!l.get("bitasset_data_id"),Be=!!c.get("bitasset_data_id"),Oe=w&&x?w.getPrice()-x.getPrice():0;if(i.size){let e=i.take(2);_e=e.first();let t=e.last();ye=_e.getPrice()===t.getPrice()?"":_e.getPrice()-t.getPrice()>0?"change-up":"change-down"}if(!E||!Object.keys(this.state.feeStatus).length)return null;let{sellFeeAsset:Me,sellFeeAssets:qe,sellFee:Ie,buyFeeAsset:Re,buyFeeAssets:Le,buyFee:De}=this._getFeeAssets(Ae,fe,E),Ve=fe.getIn(["bitasset","is_prediction_market"])||Ae.getIn(["bitasset","is_prediction_market"]),ze=null;Ve&&(ze=l.getIn(["options","description"]),ze=T.A.parseDescription(ze).main);const He=Math.max(this.state.height>1100?V:V-125,300);let Ue=this.state.expirationType,We=this.state.expirationCustomTime,$e=te.length>=1,Ge=fe.getIn(["bitasset","is_prediction_market"]),Qe=0;const Ke=e=>a.createElement("div",{className:"exchange-content-header"},a.createElement(I.A,{string:"exchange.buysell_formatter",noLink:!0,noTip:!0,keys:[{type:"asset",value:this.props.quoteAsset.get("symbol"),arg:"asset"},{type:"translate",value:e?"exchange.buy":"exchange.sell",arg:"direction"}]}));let Ye=pe||Te&&!this.state.mobileKey.includes("buySellTab")?null:a.createElement(u.Tabs,{animated:!1,activeKey:this.props.viewSettings.get("order-form-bid")||"limit",onChange:this.handleOrderTypeTabChange.bind(this,"bid"),tabBarExtraContent:a.createElement("div",null,Ke(!0)),defaultActiveKey:"limit",className:b()("exchange--buy-sell-form",D&&!Ne?"":ue>1200?"medium-6 large-6 xlarge-4":ue>800?"medium-6":"","small-12 exchange-padded middle-content",H?`order-${j?2:3} large-order-${j?2:5} sell-form`:`order-${j?1:2} large-order-${j?1:4} buy-form`)},a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.limit"),key:"limit"},a.createElement(Q,{showScaledOrderModal:this.showScaledOrderModal,key:"actionCard_"+Qe++,onBorrow:Be?this._borrowBase.bind(this):null,onBuy:this._onBuy.bind(this,"bid"),onDeposit:this._onDeposit.bind(this,"bid"),currentAccount:e,backedCoin:this.props.backedCoins.find((e=>e.symbol===fe.get("symbol"))),currentBridges:this.props.bridgeCoins.get(fe.get("symbol"))||null,isOpen:this.state.buySellOpen,onToggleOpen:this._toggleOpenBuySell.bind(this),parentWidth:ue,styles:{padding:5,paddingRight:ae?15:5},type:"bid",hideHeader:!0,expirationType:Ue.bid,expirations:this.EXPIRATIONS,expirationCustomTime:We.bid,onExpirationTypeChange:this._handleExpirationChange.bind(this,"bid"),onExpirationCustomChange:this._handleCustomExpirationChange.bind(this,"bid"),amount:Ut(q.toReceiveText),price:Ut(q.priceText),total:Ut(q.forSaleText),quote:Ae,base:fe,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),clearForm:this._clearForms.bind(this,"bid"),balance:ke,balanceId:fe.get("id"),onSubmit:this._createLimitOrderConfirm.bind(this,Ae,fe,ke,Se,Re,"buy"),balancePrecision:fe.get("precision"),quotePrecision:Ae.get("precision"),totalPrecision:fe.get("precision"),currentPrice:w.getPrice(),currentPriceObject:w,account:e.get("name"),fee:De,hasFeeBalance:this.state.feeStatus[De.asset_id].hasBalance,feeAssets:Le,feeAsset:Re,onChangeFeeAsset:this.onChangeFeeAsset.bind(this,"buy"),isPredictionMarket:fe.getIn(["bitasset","is_prediction_market"]),onFlip:H?null:this._flipBuySell.bind(this),onTogglePosition:this.state.buySellTop&&!L?this._toggleBuySellPosition.bind(this):null,moveOrderForm:Ne||H&&!D?null:this._moveOrderForm.bind(this),verticalOrderForm:!Ne&&D,isPanelActive:$e,activePanels:te,singleColumnOrderForm:ne,hideFunctionButtons:he})),a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.scaled"),key:"scaled"},a.createElement(Ce,{expirationType:Ue.bid,expirations:this.EXPIRATIONS,expirationCustomTime:We.bid,onExpirationTypeChange:this._handleExpirationChange.bind(this,"bid"),onExpirationCustomChange:this._handleCustomExpirationChange.bind(this,"bid"),currentPrice:w.getPrice(),lastClickedPrice:this.state.ask&&this.state.ask.priceText,currentAccount:e,createScaledOrder:this._createScaledOrder,type:"bid",quoteAsset:Ae,baseAsset:fe}))),Je=pe||Te&&!this.state.mobileKey.includes("buySellTab")?null:a.createElement(u.Tabs,{activeKey:this.props.viewSettings.get("order-form-ask")||"limit",onChange:this.handleOrderTypeTabChange.bind(this,"ask"),animated:!1,tabBarExtraContent:a.createElement("div",null,Ke(!1)),defaultActiveKey:"limit",className:b()("exchange--buy-sell-form",D&&!Ne?"":ue>1200?"medium-6 large-6 xlarge-4":ue>800?"medium-6":"","small-12 exchange-padded middle-content",H?`order-${j?1:2} large-order-${j?1:4} buy-form`:`order-${j?2:3} large-order-${j?2:5} sell-form`)},a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.limit"),key:"limit"},a.createElement(Q,{showScaledOrderModal:this.showScaledOrderModal,key:"actionCard_"+Qe++,onBorrow:Pe?this._borrowQuote.bind(this):null,onBuy:this._onBuy.bind(this,"ask"),onDeposit:this._onDeposit.bind(this,"ask"),currentAccount:e,backedCoin:this.props.backedCoins.find((e=>e.symbol===Ae.get("symbol"))),currentBridges:this.props.bridgeCoins.get(Ae.get("symbol"))||null,isOpen:this.state.buySellOpen,onToggleOpen:this._toggleOpenBuySell.bind(this),parentWidth:ue,styles:{padding:5,paddingRight:ae?15:5},type:"ask",hideHeader:!0,amount:Ut(R.forSaleText),price:Ut(R.priceText),total:Ut(R.toReceiveText),quote:Ae,base:fe,expirationType:Ue.ask,expirations:this.EXPIRATIONS,expirationCustomTime:We.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),clearForm:this._clearForms.bind(this,"ask"),balance:ve,balanceId:Ae.get("id"),onSubmit:this._createLimitOrderConfirm.bind(this,fe,Ae,ve,Se,Me,"sell"),balancePrecision:Ae.get("precision"),quotePrecision:Ae.get("precision"),totalPrecision:fe.get("precision"),currentPrice:x.getPrice(),currentPriceObject:x,account:e.get("name"),fee:Ie,hasFeeBalance:this.state.feeStatus[Ie.asset_id].hasBalance,feeAssets:qe,feeAsset:Me,onChangeFeeAsset:this.onChangeFeeAsset.bind(this,"sell"),isPredictionMarket:Ae.getIn(["bitasset","is_prediction_market"]),onFlip:H?this._flipBuySell.bind(this):null,onTogglePosition:this.state.buySellTop&&!L?this._toggleBuySellPosition.bind(this):null,moveOrderForm:Ne||!H&&!D?null:this._moveOrderForm.bind(this),verticalOrderForm:!Ne&&D,isPanelActive:$e,activePanels:te,singleColumnOrderForm:ne,hideFunctionButtons:he})),a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.scaled"),key:"scaled"},a.createElement(Ce,{expirationType:Ue.ask,expirations:this.EXPIRATIONS,expirationCustomTime:We.ask,onExpirationTypeChange:this._handleExpirationChange.bind(this,"ask"),onExpirationCustomChange:this._handleCustomExpirationChange.bind(this,"ask"),currentPrice:x.getPrice(),lastClickedPrice:this.state.ask&&this.state.ask.priceText,currentAccount:e,createScaledOrder:this._createScaledOrder,type:"ask",baseAsset:fe,quoteAsset:Ae}))),Ze=Te&&!this.state.mobileKey.includes("myMarkets")?null:a.createElement(gt.A,{key:"actionCard_"+Qe++,className:"left-order-book no-overflow order-9",style:{minWidth:350,height:Ne?680:"calc(100vh - 215px)",padding:Ne?10:0},headerStyle:{width:"100%",display:Ne?"":"display: none"},noHeader:!0,listHeight:this.state.height-450,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:`${ge}_${be}`,location:this.props.location,history:this.props.history,activeTab:K||"my-market"}),Xe=Te&&!this.state.mobileKey.includes("orderBook")?null:a.createElement(st,{ref:"order_book",key:"actionCard_"+Qe++,latest:_e&&_e.getPrice(),changeClass:ye,orders:t,calls:s,invertedCalls:n,combinedBids:S,combinedAsks:C,highestBid:x,lowestAsk:w,totalBids:_.bid,totalAsks:_.ask,base:fe,quote:Ae,baseSymbol:be,quoteSymbol:ge,onClick:this._orderbookClick.bind(this),horizontal:!(L&&!Ne),flipOrderBook:oe,orderBookReversed:le,marketReady:p,wrapperClass:b()(ue>1200?"xlarge-8":"","medium-12 large-12","small-12 grid-block orderbook no-padding align-spaced no-overflow wrap shrink",`order-${j?3:1} xlarge-order-${j?4:1}`),innerClass:b()(ue>1200?"medium-6":ue>800?"medium-6 large-6":"","small-12 middle-content",Te?"":"exchange-padded"),currentAccount:this.props.currentAccount.get("id"),handleGroupOrderLimitChange:this._onGroupOrderLimitChange.bind(this),trackedGroupsConfig:v,currentGroupOrderLimit:k,groupedBids:O,groupedAsks:M,isPanelActive:te.length>=1,onTogglePosition:this.state.buySellTop?null:this._toggleBuySellPosition.bind(this),moveOrderBook:Ne?null:this._moveOrderBook.bind(this),smallScreen:Ne,hideScrollbars:J,autoScroll:ee,onFlipOrderBook:this._flipOrderBook.bind(this),hideFunctionButtons:he});se=350,this.refs.order_book&&this.refs.order_book.verticalStickyTable&&this.refs.order_book.verticalStickyTable.current&&this.refs.order_book.verticalStickyTable.current.scrollData&&(se=this.refs.order_book.verticalStickyTable.current.scrollData.scrollWidth);let et=Te&&!this.state.mobileKey.includes("marketHistory")?null:a.createElement(ut,{key:"actionCard_"+Qe++,className:b()(0==ie.history?ue>1200?"medium-6 large-6 xlarge-4":ue>800?"medium-6":"":"medium-12","no-padding no-overflow middle-content small-12 order-6"),innerClass:Te?"":"exchange-padded",innerStyle:{paddingBottom:Te?"0":"1.2rem"},noHeader:0!=ie.history,history:i,currentAccount:e,myHistory:e.get("history"),base:fe,quote:Ae,baseSymbol:be,quoteSymbol:ge,activeTab:"history",tinyScreen:Te,isPanelActive:$e,hideScrollbars:J}),tt=Te&&!this.state.mobileKey.includes("myMarketHistory")?null:a.createElement(ut,{key:"actionCard_"+Qe++,className:b()(0==ie.my_history?ue>1200?"medium-6 large-6 xlarge-4":ue>800?"medium-6":"":"medium-12","no-padding no-overflow middle-content small-12",L||D?"order-4":"order-3"),innerClass:Te?"":"exchange-padded",innerStyle:{paddingBottom:Te?"0":"1.2rem"},noHeader:0!=ie.my_history,history:i,currentAccount:e,myHistory:e.get("history"),base:fe,quote:Ae,baseSymbol:be,quoteSymbol:ge,activeTab:"my_history",tinyScreen:Te,isPanelActive:$e,hideScrollbars:J}),at=Te&&!this.state.mobileKey.includes("myOpenOrders")?null:a.createElement(je,{key:"actionCard_"+Qe++,style:{marginBottom:Te?0:15},className:b()(0==ie.my_orders?ue>1200?"medium-6 large-6 xlarge-4":ue>800?"medium-6":"":"medium-12","no-padding no-overflow middle-content small-12 order-7"),innerClass:Te?"":"exchange-padded",innerStyle:{paddingBottom:Te?"0":"1.2rem"},noHeader:0!=ie.my_orders,orders:t,settleOrders:m,currentAccount:e,base:fe,quote:Ae,baseSymbol:be,quoteSymbol:ge,activeTab:"my_orders",onCancel:this._cancelLimitOrder.bind(this),flipMyOrders:this.props.viewSettings.get("flipMyOrders"),feedPrice:this.props.feedPrice,smallScreen:Ne,tinyScreen:Te,hidePanel:Y,isPanelActive:$e,hideScrollbars:J}),rt=0===m.size||Te&&!this.state.mobileKey.includes("settlementOrders")?null:a.createElement(je,{key:"actionCard_"+Qe++,style:{marginBottom:Te?0:15},className:b()(0==ie.open_settlement?ue>1200?"medium-6 large-6 xlarge-4":ue>800?"medium-6":"":"medium-12","no-padding no-overflow middle-content small-12 order-8"),innerClass:Te?"":"exchange-padded",innerStyle:{paddingBottom:Te?"0":"1.2rem"},noHeader:0!=ie.open_settlement,orders:t,settleOrders:m,currentAccount:e,base:fe,quote:Ae,baseSymbol:be,quoteSymbol:ge,activeTab:"open_settlement",onCancel:this._cancelLimitOrder.bind(this),flipMyOrders:this.props.viewSettings.get("flipMyOrders"),feedPrice:this.props.feedPrice,smallScreen:Ne,tinyScreen:Te,hidePanel:Y,isPanelActive:$e,hideScrollbars:J}),it=!Te&&"price_chart"!=z||Te&&!this.state.mobileKey.includes("tradingViewChart")?null:a.createElement(Dt,{locale:this.props.locale,dataFeed:this.props.dataFeed,baseSymbol:be,quoteSymbol:ge,marketReady:p,theme:this.props.settings.get("themes"),buckets:A,bucketSize:g,currentPeriod:this.state.currentPeriod,chartHeight:He,chartZoom:!Te&&ce,chartTools:!Te&&de,mobile:Te}),nt=!Te&&"market_depth"!=z||Te&&!this.state.mobileKey.includes("deptHighChart")?null:a.createElement($t,{marketReady:p,orders:t,showCallLimit:we,call_orders:s,flat_asks:P,flat_bids:N,flat_calls:we?B:[],flat_settles:this.props.settings.get("showSettles")&&F,settles:m,invertedCalls:n,totalBids:_.bid,totalAsks:_.ask,base:fe,quote:Ae,height:He,isPanelActive:$e,onClick:this._depthChartClick.bind(this,fe,Ae),feedPrice:!Ve&&f&&f.toReal(),spread:Oe,LCP:we?d:null,hasPrediction:Ve,noFrame:!1,theme:this.props.settings.get("themes"),centerRef:this.refs.center,activePanels:te}),ot=a.createElement("div",{className:"exchange--chart-control",style:{height:33,right:"price_chart"==z?"6rem":"15rem",top:"1px",position:"absolute",zIndex:1,padding:"0.2rem"}},"price_chart"==z&&a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.chart_tools")},a.createElement(u.Icon,{style:{cursor:"pointer",fontSize:"1.4rem",marginRight:"0.6rem"},onClick:this._chartTools.bind(this),type:"tool"})),a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.increase_chart_height")},a.createElement(u.Icon,{style:{cursor:"pointer",fontSize:"1.4rem",marginRight:"0.6rem"},onClick:()=>{this.onChangeChartHeight({increase:!0})},type:"up"})),a.createElement(u.Tooltip,{title:y().translate("exchange.settings.tooltip.decrease_chart_height")},a.createElement(u.Icon,{style:{cursor:"pointer",fontSize:"1.4rem",marginRight:"0.6rem"},onClick:()=>{this.onChangeChartHeight({increase:!1})},type:"down"})),a.createElement(u.Tooltip,{title:"market_depth"==z?y().translate("exchange.settings.tooltip.show_price_chart"):y().translate("exchange.settings.tooltip.show_market_depth")},a.createElement(u.Icon,{style:{cursor:"pointer",fontSize:"1.4rem"},onClick:()=>{"market_depth"==z?this._toggleChart("price_chart"):this._toggleChart("market_depth")},type:"market_depth"==z?"bar-chart":"area-chart"}))),lt=a.createElement("div",{key:"actionCard_"+Qe++,className:"left-order-book small-12",style:{paddingLeft:5,width:Ne?"auto":300}},a.createElement(u.Tabs,{defaultActiveKey:"buy",activeKey:G,onChange:this._setTabBuySell.bind(this),style:{padding:"0px !important",margin:"0px !important"}},a.createElement(u.Tabs.TabPane,{tab:a.createElement(I.A,{string:"exchange.buysell_formatter",noLink:!0,noTip:!1,keys:[{type:"asset",value:Ae.get("symbol"),arg:"asset"},{type:"translate",value:Ge?"exchange.short":"exchange.buy",arg:"direction"}]}),key:"buy"},Ye),a.createElement(u.Tabs.TabPane,{tab:a.createElement(I.A,{string:"exchange.buysell_formatter",noLink:!0,noTip:!1,keys:[{type:"asset",value:Ae.get("symbol"),arg:"asset"},{type:"translate",value:Ge?"exchange.short":"exchange.sell",arg:"direction"}]}),key:"sell"},Je))),ct={1:[],2:[]},dt=[];Object.keys(ie).sort().map((e=>{0==ie[e]?("my_history"==e&&dt.push(tt),"history"==e&&dt.push(et),"my_orders"==e&&dt.push(at),"open_settlement"==e&&null!==rt&&dt.push(rt)):("my_history"==e&&ct[ie[e]].push(a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.my_history"),key:"my_history"},tt)),"history"==e&&ct[ie[e]].push(a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.history"),key:"history"},et)),"my_orders"==e&&ct[ie[e]].push(a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.my_orders"),key:"my_orders"},at)),"open_settlement"==e&&null!==rt&&ct[ie[e]].push(a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.settle_orders"),key:"open_settlement"},rt)))})),Object.keys(re).map((e=>{Object.keys(ie).map((t=>{let s=!1;s||e!=ie[t]||(re[e]=re[e]?re[e]:t,s=!0)}))}));let ht=dt.length;Object.keys(ct).map((e=>{ct[e].length&&ht++}));let pt=ct[1].length>0?a.createElement("div",{key:"actionCard_"+Qe++,className:b()(ue>1200?1==ht?"medium-12 xlarge-4":"medium-6 xlarge-4 ":ue>800?1==ht?"medium-12":"medium-6":"","small-12 order-5",L?"xlarge-order-5":"",L||D?"":ue<1200?"xlarge-order-5":"xlarge-order-2"),style:{paddingRight:5}},a.createElement(u.Tabs,{activeKey:re[1],onChange:this._setPanelTabInGroup.bind(this,1)},ct[1])):null,mt=ct[2].length>0?a.createElement("div",{key:"actionCard_"+Qe++,className:b()(ue>1200?1==ht?"medium-12 xlarge-4":"medium-6 xlarge-4 ":ue>800?1==ht?"medium-12":"medium-6":"","small-12 order-6"),style:{paddingRight:5}},a.createElement(u.Tabs,{activeKey:re[2],onChange:this._setPanelTabInGroup.bind(this,2)},ct[2])):null,bt=ht>2?null:a.createElement("div",{className:b()(ue>1200&&(L||L)?"xlarge-order-6 xlarge-8 order-9":"","small-12 grid-block orderbook no-padding align-spaced no-overflow wrap"),key:"actionCard_"+Qe++}," "),_t=[];Ne?Te?_t=a.createElement(u.Collapse,{activeKey:this.state.mobileKey,onChange:this._onChangeMobilePanel.bind(this),style:{paddingRight:8}},a.createElement(u.Collapse.Panel,{header:y().translate("exchange.price_history"),key:"tradingViewChart"},it),a.createElement(u.Collapse.Panel,{header:y().translate("exchange.order_depth"),key:"deptHighChart"},nt),a.createElement(u.Collapse.Panel,{header:y().translate("exchange.buy_sell"),key:"buySellTab"},lt),a.createElement(u.Collapse.Panel,{header:y().translate("exchange.order_book"),key:"orderBook"},Xe),a.createElement(u.Collapse.Panel,{header:y().translate("exchange.history"),key:"marketHistory"},et),null!==rt?a.createElement(u.Collapse.Panel,{header:y().translate("exchange.settle_orders"),key:"settlementOrders"},rt):null,a.createElement(u.Collapse.Panel,{header:y().translate("exchange.my_history"),key:"myMarketHistory"},tt),a.createElement(u.Collapse.Panel,{header:y().translate("exchange.my_orders"),key:"myOpenOrders"},at),a.createElement(u.Collapse.Panel,{header:y().translate("exchange.market_name"),key:"myMarkets"},a.createElement(u.Tabs,{defaultActiveKey:"my-market",activeKey:K,onChange:this._setTabVerticalPanel.bind(this)},a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.market_name"),key:"my-market"}),a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.more"),key:"find-market"})),Ze)):(_t.push(Ye),_t.push(Je),_t.push(Xe),_t.push(dt),_t.push(pt),_t.push(mt),_t.push(a.createElement("div",{className:"order-10 small-12",key:"actionCard_"+Qe++},a.createElement(u.Tabs,{defaultActiveKey:"my-market",activeKey:K,onChange:this._setTabVerticalPanel.bind(this)},a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.market_name"),key:"my-market"}),a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.more"),key:"find-market"})),Ze))):(D||(_t.push(Ye),_t.push(Je)),L||_t.push(Xe),(L||D)&&_t.push(bt),_t.push(dt),_t.push(pt),_t.push(mt));let yt=null,ft=null,At=null,Et=null,vt=!1,Ct=!1;return Ne||(L&&(yt=a.createElement("div",{className:"left-order-book no-padding no-overflow",style:{display:"block",height:"calc(100vh - 170px)",width:se}},Xe)),D&&(yt=a.createElement("div",{className:"left-order-book no-padding no-overflow",style:{display:"block",height:"calc(100vh - 170px)",width:300}},lt)),ft=a.createElement("div",{className:"left-order-book no-padding no-overflow",style:{display:"block"},key:"actionCard_"+Qe++},a.createElement("div",{className:"v-align no-padding align-center grid-block footer shrink column","data-intro":y().translate("walkthrough.my_markets")},a.createElement(u.Tabs,{defaultActiveKey:"my-market",activeKey:K,onChange:this._setTabVerticalPanel.bind(this)},a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.market_name"),key:"my-market"}),a.createElement(u.Tabs.TabPane,{tab:y().translate("exchange.more"),key:"find-market"}))),Ze),(!ae&&yt||ae&&ft)&&(vt=!0),(!ae&&ft||ae&&yt)&&(Ct=!0),At=a.createElement("div",{className:"grid-block left-column shrink no-overflow"},te.includes("left")?ae?ft:yt:null,vt?a.createElement("div",{style:{width:"auto",paddingTop:"calc(50vh - 80px)"},onClick:this._togglePanel.bind(this,"left")},a.createElement(u.Icon,{"data-intro":y().translate("walkthrough.panel_hide"),type:te.includes("left")?"caret-left":"caret-right"})):null),Et=a.createElement("div",{className:"grid-block left-column shrink no-overflow"},Ct?a.createElement("div",{style:{width:"auto",paddingTop:"calc(50vh - 80px)"},onClick:this._togglePanel.bind(this,"right")},a.createElement(u.Icon,{"data-intro":y().translate("walkthrough.panel_hide"),type:te.includes("right")?"caret-right":"caret-left"})):null,te.includes("right")?ae?yt:ft:null)),a.createElement("div",{className:"grid-block vertical"},this.props.marketReady?null:a.createElement(jt.A,null),a.createElement(Fe,{hasAnyPriceAlert:this.props.hasAnyPriceAlert,showPriceAlertModal:this.showPriceAlertModal,account:this.props.currentAccount,quoteAsset:l,baseAsset:c,hasPrediction:Ve,starredMarkets:o,lowestAsk:w,highestBid:x,lowestCallPrice:d,showCallLimit:we,feedPrice:f,marketReady:p,latestPrice:_e&&_e.getPrice(),marketStats:h,selectedMarketPickerAsset:this.state.marketPickerAsset,onToggleMarketPicker:this._toggleMarketPicker.bind(this),onTogglePersonalize:this._togglePersonalize.bind(this),showVolumeChart:xe}),a.createElement("div",{className:"grid-block page-layout market-layout"},this.state.isMarketPickerModalVisible||this.state.isMarketPickerModalLoaded?a.createElement(kt,As({visible:this.state.isMarketPickerModalVisible,showModal:this.showMarketPickerModal,hideModal:this.hideMarketPickerModal,marketPickerAsset:this.state.marketPickerAsset,onToggleMarketPicker:this._toggleMarketPicker.bind(this)},this.props)):null,this.state.isPersonalizeModalVisible||this.state.isPersonalizeModalLoaded?a.createElement(wt,{visible:this.state.isPersonalizeModalVisible,showModal:this.showPersonalizeModal,hideModal:this.hidePersonalizeModal,viewSettings:this.props.viewSettings,chartType:z,chartHeight:V,onTogglePersonalize:this._togglePersonalize.bind(this),onChangeChartHeight:this.onChangeChartHeight.bind(this),handleGroupOrderLimitChange:this._onGroupOrderLimitChange.bind(this),trackedGroupsConfig:v,currentGroupOrderLimit:k,verticalOrderBook:L,hideScrollbars:J,mirrorPanels:ae,panelTabs:ie,singleColumnOrderForm:ne,buySellTop:j,flipBuySell:H,flipOrderBook:oe,tinyScreen:Te,smallScreen:Ne,orderBookReversed:le,chartZoom:ce,chartTools:de,hideFunctionButtons:he,onMoveOrderBook:this._moveOrderBook.bind(this),onMirrorPanels:this._mirrorPanels.bind(this),onToggleScrollbars:this._toggleScrollbars.bind(this),onSetAutoscroll:this._setAutoscroll.bind(this),onToggleChart:this._toggleChart.bind(this),onSetPanelTabs:this._setPanelTabs.bind(this),onToggleSingleColumnOrderForm:this._toggleSingleColumnOrderForm.bind(this),onToggleBuySellPosition:this._toggleBuySellPosition.bind(this),onFlipBuySell:this._flipBuySell.bind(this),onFlipOrderBook:this._flipOrderBook.bind(this),onOrderBookReversed:this._orderBookReversed.bind(this),onChartZoom:this._chartZoom.bind(this),onChartTools:this._chartTools.bind(this),onHideFunctionButtons:this._hideFunctionButtons.bind(this)}):null,a.createElement(rs,null),At,a.createElement("div",{style:{paddingTop:0},className:b()("grid-block main-content vertical no-overflow")},a.createElement("div",{className:"grid-block vertical no-padding ps-container",id:"CenterContent",ref:"center","data-intro":Te?y().translate("walkthrough.collapsed_items"):null},Te?null:a.createElement("div",null,ot,z&&"price_chart"==z?a.createElement("div",{className:"grid-block shrink no-overflow",id:"market-charts"},it):null,z&&"market_depth"==z?a.createElement("div",{className:"grid-block vertical no-padding shrink"},nt):null),a.createElement("div",{className:"grid-block no-overflow wrap shrink"},_t))),Et),Pe&&(this.state.isBorrowQuoteModalVisible||this.state.isBorrowQuoteModalLoaded)?a.createElement(Gt.A,{visible:this.state.isBorrowQuoteModalVisible,hideModal:this.hideBorrowQuoteModal,quoteAssetObj:l.get("id"),backingAssetObj:l.getIn(["bitasset","options","short_backing_asset"]),accountObj:e}):null,Be&&(this.state.isBorrowBaseModalVisible||this.state.isBorrowBaseModalLoaded)?a.createElement(Gt.A,{visible:this.state.isBorrowBaseModalVisible,hideModal:this.hideBorrowBaseModal,quoteAssetObj:c.get("id"),backingAssetObj:c.getIn(["bitasset","options","short_backing_asset"]),accountObj:e}):null,this.state.isDepositModalVisible||this.state.isDepositModalLoaded?a.createElement(gs,As({visible:this.state.isDepositModalVisible,hideModal:this.hideDepositModal,ref:"deposit_modal",action:"deposit",fiatModal:!1,account:e,sender:e,asset:"bid"===X?fe:Ae,modalId:"simple_deposit_modal"+("bid"===X?"":"_ask"),balance:"bid"===X?ke:ve},this.props.backedCoins.find((e=>e.symbol===("bid"===X?fe.get("symbol"):Ae.get("symbol")))))):null,this.state.isDepositBridgeModalVisible||this.state.isDepositBridgeModalLoaded?a.createElement(bs.A,{visible:this.state.isDepositBridgeModalVisible,hideModal:this.hideDepositBridgeModal,ref:"bridge_modal",action:"deposit",account:e.get("name"),sender:e.get("id"),asset:"bid"===Z?fe.get("id"):Ae.get("id"),modalId:"simple_bridge_modal"+("bid"===Z?"":"_ask"),balances:["bid"===Z?ke:ve],bridges:this.props.bridgeCoins.get("bid"===Z?fe.get("symbol"):Ae.get("symbol"))||null}):null,this.state.isConfirmBuyOrderModalVisible||this.state.isConfirmBuyOrderModalLoaded?a.createElement(St,{visible:this.state.isConfirmBuyOrderModalVisible,hideModal:this.hideConfirmBuyOrderModal,type:"buy",onForce:this._forceBuy.bind(this,"buy",Re,ke,Se),diff:U,hasOrders:C.length>0}):null,this.state.isConfirmSellOrderModalVisible||this.state.isConfirmSellOrderModalLoaded?a.createElement(St,{visible:this.state.isConfirmSellOrderModalVisible,hideModal:this.hideConfirmSellOrderModal,type:"sell",onForce:this._forceSell.bind(this,"sell",Me,ve,Se),diff:W,hasOrders:S.length>0}):null,a.createElement(fs,{onSave:this.handlePriceAlertSave,rules:this.getPriceAlertRules(),latestPrice:_e&&_e.getPrice(),quoteAsset:this.props.quoteAsset.get("id"),baseAsset:this.props.baseAsset.get("id"),visible:this.state.isPriceAlertModalVisible,showModal:this.showPriceAlertModal,hideModal:this.hidePriceAlertModal}))}}const vs=Es;var ks=s(188);function Ss(){return Ss=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},Ss.apply(this,arguments)}class Cs extends a.Component{render(){let e=this.props.match.params.marketID.toUpperCase().split("_");return e[0]===e[1]?a.createElement(ks.A,{subtitle:"market_not_found_subtitle"}):a.createElement(d.A,{stores:[r.A,i.A,n.A,c.A,l.A],inject:{hasAnyPriceAlert:()=>n.A.hasAnyPriceAlert(e[0],e[1]),priceAlert:()=>n.A.getState().priceAlert,locale:()=>l.A.getState().currentLocale,lockedWalletState:()=>c.A.getState().locked,marketLimitOrders:()=>r.A.getState().marketLimitOrders,marketCallOrders:()=>r.A.getState().marketCallOrders,invertedCalls:()=>r.A.getState().invertedCalls,marketSettleOrders:()=>r.A.getState().marketSettleOrders,marketData:()=>r.A.getState().marketData,totals:()=>r.A.getState().totals,activeMarketHistory:()=>r.A.getState().activeMarketHistory,bucketSize:()=>r.A.getState().bucketSize,buckets:()=>r.A.getState().buckets,lowestCallPrice:()=>r.A.getState().lowestCallPrice,feedPrice:()=>r.A.getState().feedPrice,currentAccount:()=>i.A.getState().currentAccount,myActiveAccounts:()=>i.A.getState().myActiveAccounts,viewSettings:()=>n.A.getState().viewSettings,settings:()=>n.A.getState().settings,exchange:()=>n.A.getState().exchange,starredMarkets:()=>n.A.getState().starredMarkets,marketDirections:()=>n.A.getState().marketDirections,marketStats:()=>r.A.getState().marketStats,marketReady:()=>r.A.getState().marketReady,backedCoins:()=>o.A.getState().backedCoins.get("OPEN",[]),bridgeCoins:()=>o.A.getState().bridgeCoins,miniDepthChart:()=>n.A.getState().viewSettings.get("miniDepthChart",!0),dataFeed:()=>new Mt,trackedGroupsConfig:()=>r.A.getState().trackedGroupsConfig,currentGroupOrderLimit:()=>r.A.getState().currentGroupLimit}},a.createElement(Fs,{history:this.props.history,location:this.props.location,quoteAsset:e[0],baseAsset:e[1]}))}}let ws,xs,Ns,Ts,Ps,Bs=(0,m.EmitterInstance)();class Fs extends a.Component{static propTypes={currentAccount:R.A.ChainAccount.isRequired,quoteAsset:R.A.ChainAsset.isRequired,baseAsset:R.A.ChainAsset.isRequired,coreAsset:R.A.ChainAsset.isRequired};static defaultProps={currentAccount:"1.2.3",coreAsset:"1.3.0"};constructor(e){super(),this.state={sub:null},this._subToMarket=this._subToMarket.bind(this)}UNSAFE_componentWillMount(){null!==this.props.quoteAsset&&null!==this.props.baseAsset&&(this.props.quoteAsset.toJS&&this.props.baseAsset.toJS&&this._subToMarket(this.props),Bs.on("cancel-order",xs=N.A.cancelLimitOrderSuccess),Bs.on("close-call",ws=N.A.closeCallOrderSuccess),Bs.on("call-order-update",Ns=e=>{let{asset_id:t}=e.call_price.base,{asset_id:s}=e.call_price.quote,a=this.props.baseAsset.get("id"),r=this.props.quoteAsset.get("id");t!==a&&t!==r||s!==a&&s!==r||N.A.callOrderUpdate(e)}),Bs.on("bitasset-update",Ts=N.A.feedUpdate),Bs.on("settle-order-update",Ps=e=>{let{isMarketAsset:t,marketAsset:s}=market_utils.isMarketAsset(this.props.quoteAsset,this.props.baseAsset);t&&s.id===e.balance.asset_id&&N.A.settleOrderUpdate(s.id)}))}UNSAFE_componentWillReceiveProps(e){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")){let t=this.state.sub.split("_");N.A.unSubscribeMarket(t[0],t[1]).then((()=>{this._subToMarket(e)}))}}}componentWillUnmount(){let{quoteAsset:e,baseAsset:t}=this.props;null!==e&&null!==t&&(N.A.unSubscribeMarket(e.get("id"),t.get("id")),Bs&&(Bs.off("cancel-order",xs),Bs.off("close-call",ws),Bs.off("call-order-update",Ns),Bs.off("bitasset-update",Ts),Bs.off("settle-order-update",Ps)))}_subToMarket(e,t,s){let{quoteAsset:a,baseAsset:r,bucketSize:i,currentGroupOrderLimit:n}=e;t&&(i=t),s&&(n=s),a.get("id")&&r.get("id")&&(N.A.subscribeMarket.defer(r,a,i,n),this.setState({sub:`${a.get("id")}_${r.get("id")}`}))}render(){return null===this.props.quoteAsset||null===this.props.baseAsset?a.createElement(ks.A,{subtitle:"market_not_found_subtitle"}):a.createElement(vs,Ss({},this.props,{sub:this.state.sub,subToMarket:this._subToMarket}))}}Fs=(0,L.A)(Fs,{show_loader:!0});const Os=Cs},25277:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>W});var a=s(96540),r=s(46128),i=s(10658),n=s.n(i),o=s(72090),l=s(1951),c=s(79260),d=s(68289),h=s(77910),p=s.n(h),m=s(80849),u=s.n(m),g=s(21561),b=s(48287).Buffer;let _=1;class y extends a.Component{constructor(e){super(e),this.state={invoice:null,invoiceData:null,recipient_name:null,recipient_name_account:null,currency:"BTS",defaultAssets:["BTS","CNY","USD","XBTSX.USDT","HONEST.USD","GDEX.USDT","HONEST.CNY","URTHR","SKULD","VERTHANDI","HERTZ"]}}componentDidMount(){this.setState({recipient_name:this.props.currentAccount.get("name")})}_printInvoice(e){this.props.validateFormat(e)&&(0,d.Bc)(JSON.stringify(e),9,((t,s)=>{const a=p().encode(b.from(t));this.setState({invoiceData:a}),console.log("Invoice data",e,a)}))}UNSAFE_componentWillReceiveProps(e,t){null==this.state.recipient_name&&this.props.currentAccount&&this.setState({recipient_name:this.props.currentAccount.get("name")})}fromChanged(e){this.setState({recipient_name:e,recipient_name_account:null})}onFromAccountChanged(e){this.setState({recipient_name_account:e})}hasErrors=()=>{let e=!1;const t=this.props.form.getFieldsValue(["line_items","memo","keys"]);return e=Object.keys(t).some((e=>"line_items"!==e?!t[e]:t.keys?t.keys.some((s=>!t[e][s].label||!t[e][s].price||!t[e][s].quantity)):void 0)),e||!this.state.recipient_name};remove=e=>{const{form:t}=this.props,s=t.getFieldValue("keys");if(1===s.length)return;const a=s.filter((t=>t!==e));t.setFieldsValue({keys:a})};add=()=>{const{form:e}=this.props,t=e.getFieldValue("keys").concat(_++);e.setFieldsValue({keys:t})};handleSubmit(e){const{currency:t}=this.state;e.preventDefault(),this.props.form.validateFields(((e,s)=>{if(!e){let{line_items:e,memo:a,note:r,to_label:i}=s;e=e.filter((e=>!!e)),this._printInvoice({currency:t,line_items:e,memo:a,note:r,to:this.state.recipient_name,to_label:i})}}))}onChangeCurrency(e){const t=o.ChainStore.getAsset(e);this.setState({currency:t.get("symbol")})}render(){const{getFieldValue:e,getFieldDecorator:t}=this.props.form,{currency:s,defaultAssets:i}=this.state;t("keys",{initialValue:[0]});let o=e("keys");const d=a.createElement(a.Fragment,null,a.createElement(r.Row,{style:{marginTop:"0.5rem",marginBottom:"0.5rem"}},a.createElement(r.Col,{span:12},a.createElement(u(),{component:"span",content:"invoice.request.items"})),a.createElement(r.Col,{span:5},a.createElement(u(),{component:"span",content:"invoice.request.quantity"})),a.createElement(r.Col,{span:5},a.createElement(u(),{component:"span",content:"invoice.request.price"})),a.createElement(r.Col,{span:2},a.createElement(u(),{component:"span",content:"invoice.request.action"}))),o.map(((e,s)=>a.createElement(r.Form.Item,{key:e,style:{marginBottom:"0px"}},a.createElement(r.Input.Group,{compact:!0},a.createElement(r.Row,null,a.createElement(r.Col,{span:12},t(`line_items[${e}]label`)(a.createElement(r.Input,null))),a.createElement(r.Col,{span:5},t(`line_items[${e}]quantity`)(a.createElement(r.Input,{type:"number"}))),a.createElement(r.Col,{span:5},t(`line_items[${e}]price`)(a.createElement(r.Input,{type:"number"}))),a.createElement(r.Col,{span:2},e==o[o.length-1]?a.createElement(r.Button,{type:"primary",icon:"plus-circle-o",onClick:()=>this.add(e)}):a.createElement(r.Button,{type:"primary",icon:"minus-circle-o",onClick:()=>this.remove(e)})))))))),h=this.hasErrors();return a.createElement("div",{className:"merchant-protocol--request"},a.createElement(l.A,{className:"invoice-request-input",label:"invoice.request.recipient_account",accountName:this.state.recipient_name,onChange:this.fromChanged.bind(this),onAccountChanged:this.onFromAccountChanged.bind(this),account:this.state.recipient_name,typeahead:!0,size:32}),a.createElement(r.Form,{onSubmit:this.handleSubmit.bind(this),required:!0},a.createElement(r.Form.Item,{className:"invoice-request-input",label:a.createElement("span",null,n().translate("invoice.request.identifier"),a.createElement(r.Tooltip,{placement:"topLeft",title:n().translate("invoice.request.identifier_tooltip")}," ",a.createElement(r.Icon,{type:"question-circle",theme:"filled"})))},t("memo")(a.createElement(r.Input,null))),a.createElement(r.Form.Item,{className:"invoice-request-input",label:a.createElement("span",null,n().translate("invoice.request.payment_asset"),a.createElement(r.Tooltip,{placement:"topLeft",title:n().translate("invoice.request.payment_asset_tooltip")}," ",a.createElement(r.Icon,{type:"question-circle",theme:"filled"})))},a.createElement(c.A,{value:s,assets:i,onChange:this.onChangeCurrency.bind(this)})),a.createElement(r.Form.Item,{className:"invoice-request-input",label:a.createElement("span",null,n().translate("invoice.request.recipient_name"),a.createElement(r.Tooltip,{placement:"topLeft",title:n().translate("invoice.request.recipient_name_tooltip")}," ",a.createElement(r.Icon,{type:"question-circle",theme:"filled"})))},t("to_label")(a.createElement(r.Input,null))),a.createElement(r.Form.Item,{className:"invoice-request-input",label:a.createElement("span",null,n().translate("invoice.request.note"),a.createElement(r.Tooltip,{placement:"topLeft",title:n().translate("invoice.request.note_tooltip")}," ",a.createElement(r.Icon,{type:"question-circle",theme:"filled"})))},t("note")(a.createElement(r.Input.TextArea,{rows:3}))),d,a.createElement(r.Form.Item,null,a.createElement(r.Button,{type:"primary",htmlType:"submit",disabled:h},a.createElement(u(),{content:"invoice.request.create_invoice_string"})))),this.state.invoiceData&&a.createElement(a.Fragment,null,a.createElement("div",{style:{marginTop:"2rem"}},a.createElement(r.Input.TextArea,{disabled:!0,rows:4,value:this.state.invoiceData})),a.createElement("div",{style:{float:"right"}},a.createElement(g.A,{useDiv:!1,text:this.state.invoiceData}))))}}const f=y=r.Form.create({name:"invoice_request"})(y);var A=s(96366),E=s(99429),v=s(89247),k=s(81461),S=s(18483),C=s(54755),w=(s(13246),s(77157)),x=s(6882);const N=({data:e,parsePrice:t})=>{const s=n().translate("invoice.print_receipt");return e.blockNum&&x.A.getHeader.defer(e.blockNum),a.createElement(r.Tooltip,{placement:"left",title:n().translate("tooltip.print_receipt")},a.createElement(r.Button,{type:"primary",icon:"download",onClick:()=>(({data:e,parsePrice:t})=>{const{line_items:s,to:a,asset:r,from:i,total_amount:o,memo:l,currency:c,blockNum:d,to_name:h,note:p}=e,m=10;let u=0,g=[],b="",_="";i&&(i.get("history").forEach((e=>{e.get("block_num")!==d||(b=e.get("id"))})),_=i.get("name"));const y=w.A.getState().blockHeaders.get(d),f=y?y.timestamp.toLocaleDateString("en-US").replace(/\//g,"."):(new Date).toLocaleDateString("en-US").replace(/\//g,"."),A=new C.default({orientation:"portrait",compressPdf:!0});A.setFontStyle("bold"),A.setFontSize(16),A.text(n().translate("invoice.pay_to",{locale:"en"}).toUpperCase(),15,u+=25),A.setFontStyle("normal"),A.text(h,15,u+=m),A.text(a,15,u+=m),A.autoTable({body:[["",n().translate("invoice.memo",{locale:"en"}),l],[{content:n().translate("invoice.paid_by",{locale:"en"}).toUpperCase(),styles:{fontStyle:"bold"}},n().translate("invoice.date",{locale:"en"}),f],[_,n().translate("invoice.transaction",{locale:"en"}),b],[{content:n().translate("invoice.note",{locale:"en"}).toUpperCase(),styles:{fontStyle:"bold"}},"",""],[p,"",""]],bodyStyles:{valign:"top"},styles:{cellWidth:"wrap",rowPageBreak:"auto",halign:"justify"},columnStyles:{0:{halign:"left",cellWidth:90},1:{fontStyle:"bold"},2:{cellWidth:40}},startY:u+=m,theme:"plain"}),A.line(5,u=A.autoTable.previous.finalY+m,205,u),A.setFontSize(20),A.text(n().translate("invoice.receipt_total",{locale:"en"}).toUpperCase(),15,u+=m),A.text(`${o} ${c}`,150,u),A.line(5,u+=5,205,u),A.setFontStyle("normal"),A.setFontSize(16);for(let e of s){const s=t(e.price),a=`${s} ${r}`,i=`${e.quantity*s} ${r}`;g=[...g,{descrption:e.label,unit:a,amount:e.quantity,total:i}]}A.autoTable({columns:[{header:{content:"DESCRIPTION",styles:{halign:"left"}},dataKey:"descrption"},{header:"AMOUNT",dataKey:"amount"},{header:"UNIT",dataKey:"unit"},{header:"TOTAL",dataKey:"total"}],body:g,startY:u+m,bodyStyles:{valign:"top"},styles:{cellWidth:"auto",rowPageBreak:"auto",halign:"right"},columnStyles:{descrption:{halign:"left"}},theme:"plain"}),A.save("bitshares-receipt-"+a+".pdf")})({data:e,parsePrice:t})},s))};var T=s(87040),P=s(37556),B=s(35917),F=s(15286),O=s.n(F),M=s(5556),q=s.n(M),I=s(8378);function R({labelContent:e,handleQrScanSuccess:t,onInputChange:s,inputValue:i,submitBtnText:n,dataFoundText:o}){return a.createElement("div",{style:{marginBottom:"1em"}},a.createElement("label",{className:"left-label"},e),a.createElement("div",null,a.createElement("div",{className:"inline-label"},a.createElement(r.Input.TextArea,{style:{marginBottom:0},rows:3,onChange:s,value:i}),a.createElement("span",null,a.createElement(I.A,{label:"Scan",onSuccess:t,submitBtnText:n,dataFoundText:o})))))}R.propTypes={labelContent:q().oneOfType([q().string,q().element]),handleQrScanSuccess:q().func.isRequired,onInputChange:q().func.isRequired,inputValue:q().string,submitBtnText:q().oneOfType([q().string,q().element]),dataFoundText:q().oneOfType([q().string,q().element])};var L=s(48287).Buffer;class D extends a.Component{constructor(e){super(e),this.state={invoice:null,pay_from_name:null,pay_from_account:null,pay_to_account:null,error:null,blockNum:null,invoiceQr:!1,rawDataInputValue:"",isRawDataInputVisible:!1},this.onBroadcastAndConfirm=this.onBroadcastAndConfirm.bind(this),this.getTotal=this.getTotal.bind(this)}_printExampleInvoice(){(0,d.Bc)(JSON.stringify({to:"sschiessl",to_label:"Stefan S.",currency:"BTS",memo:"Invoice #1234",line_items:[{label:"Something to Buy",quantity:1,price:"0.1"},{label:"10 things to Buy",quantity:10,price:"0.02"}],note:"Something the merchant wants to say to the user"}),9,((e,t)=>{p(),console.log(p().encode(L.from(e)))}))}async componentDidMount(){let e=p().decode(this.props.match.params.data);S.A.unlisten(this.onBroadcastAndConfirm),S.A.listen(this.onBroadcastAndConfirm);try{const t=await this.decompressRawData(e);await this.parseInvoiceData(t)}catch(e){this.setState({isRawDataInputVisible:!0})}}UNSAFE_componentWillReceiveProps(e,t){if(null==this.state.pay_from_name&&this.props.currentAccount){let e=this._findPayment();this.setState({pay_from_name:this.props.currentAccount.get("name"),paymentOperation:e})}}decompressRawData=e=>new Promise(((t,s)=>{(0,d.mF)(e,((e,a)=>{a?s(a):t(e)}))}));async parseInvoiceData(e){try{e=T.A.sanitize(e,{whiteList:[],stripIgnoreTag:!0});let t=JSON.parse(e);if(this.props.validateFormat(t)){let e=await(0,o.FetchChainObjects)(o.ChainStore.getAsset,[t.currency]),s=await(0,o.FetchChain)("getAccount",t.to,void 0,{[t.to]:!1});this.setState({invoice:t,asset:e[0],pay_to_account:s,pay_from_name:this.props.currentAccount.get("name"),error:null,isRawDataInputVisible:!1},this.getTotal)}else this.setState({error:n().translate("invoice.invalid_format")})}catch(e){this.setState({error:e.message})}}handleRawInvoiceDataChange=e=>{const t=e.target.value.replace(/\s/g,"");this.setState({rawDataInputValue:t},(async()=>{try{const e=p().decode(t),s=await this.decompressRawData(e);this.parseInvoiceData(s)}catch(e){console.log(e),this.setState({error:e.message})}}))};handleQrScanSuccess=async({address:e})=>{try{const t=p().decode(e),s=await this.decompressRawData(t);this.parseInvoiceData(s)}catch(e){console.log(e),this.setState({error:e.message})}};parsePrice(e){let t=e.match(/([\d\,\.\s]+)/);return!t||t.length,parseFloat(t[1].replace(/[\,\s]/g,""))}_findPayment(){if((0,P.K)(this.props.currentAccount)&&this.state.total_amount&&this.state.pay_to_account){const e=this.state.pay_to_account.get("id"),t=this.state.asset.get("id"),s=this.state.total_amount*Math.pow(10,this.state.asset.get("precision"));let a=null;return this.props.currentAccount.get("history").toJS().forEach((r=>{const i=r.op;if(0==i[0]){i[1].from;const n=i[1].to,o=i[1].amount.amount,l=i[1].amount.asset_id;this.state.invoice,console.log(e,n,t,l,s,o),e==n&&t==l&&s==o&&(a=r)}})),a}}getTotal(){const e=this.state.invoice.line_items;if(!e||0===e.length)return 0;let t=e.reduce(((e,t)=>{let s=this.parsePrice(t.price);return s?e+t.quantity*s:e}),0),s=this._findPayment();this.setState({total_amount:parseFloat(t.toFixed(this.state.asset.get("precision"))),paymentOperation:s})}onBroadcastAndConfirm(e){e.included&&e.broadcasted_transaction&&(S.A.unlisten(this.onBroadcastAndConfirm),S.A.reset(),this.setState({blockNum:e.trx_block_num}))}onPayClick(e){e.preventDefault();let{asset:t,total_amount:s}=this.state,a=T.A.get_asset_precision(t.get("precision")),r=o.ChainStore.getAccount(this.state.invoice.to);r?E.A.transfer(this.state.pay_from_account.get("id"),r.get("id"),parseInt(s*a,10),t.get("id"),this.state.invoice.memo).then((()=>{S.A.unlisten(this.onBroadcastAndConfirm),S.A.listen(this.onBroadcastAndConfirm)})).catch((e=>{console.log("error: ",e)})):k.A.error(`Account ${this.state.invoice.to} not found`)}fromChanged(e){this.setState({pay_from_name:e,pay_from_account:null})}onFromAccountChanged(e){this.setState({pay_from_account:e})}onToAccountChanged(e){this.setState({pay_to_account:e})}render(){const{data:e}=this.props.match.params;if(this.state.isRawDataInputVisible)return a.createElement("div",null,a.createElement(R,{labelContent:a.createElement(u(),{component:"span",content:"invoice.raw_invoice_data"}),submitBtnText:n().translate("invoice.use_invoice_data"),dataFoundText:n().translate("invoice.invoice_data_found")+":",onInputChange:this.handleRawInvoiceDataChange,inputValue:this.state.rawDataInputValue,handleQrScanSuccess:this.handleQrScanSuccess}),a.createElement("br",null),a.createElement("h4",{className:"has-error text-center"},this.state.error));if(this.state.error)return a.createElement("div",null,a.createElement("br",null),a.createElement("h4",{className:"has-error text-center"},this.state.error));if(!this.state.invoice)return null;if(!this.state.asset)return a.createElement("div",null,a.createElement(u(),{className:"has-error text-center",component:"h4",content:"transfer.errors.asset_unsupported",currency:this.state.invoice.currency}));let{invoice:t,total_amount:s}=this.state;const i=t.currency;let o=null;t.to_label&&(t.to_name=t.to_label);const c={...t,total_amount:s?s.toString():0,asset:i,from:this.state.pay_from_account,blockNum:this.state.blockNum};if(this.state.pay_from_account){const e=this.state.pay_from_account.get("balances").get(this.state.asset.get("id"));o=a.createElement("span",null,a.createElement(u(),{component:"span",content:"transfer.available"}),a.createElement("span",{style:{borderBottom:"#A09F9F 1px dotted",cursor:"pointer"}},a.createElement(v.A,{balance:e})))}let d=t.line_items.map(((e,t)=>{let s=this.parsePrice(e.price),n=e.quantity*s;return a.createElement(r.Row,{key:"invoice_item_"+t},a.createElement(r.Col,{span:10},a.createElement("div",{className:"item-name"},e.label),a.createElement("div",{className:"item-description"})),a.createElement(r.Col,{span:3},e.quantity," x"),a.createElement(r.Col,{span:5},a.createElement(A.A,{amount:e.price,asset:i,exact_amount:!0})),a.createElement(r.Col,{span:5},a.createElement(A.A,{amount:n,asset:i,exact_amount:!0})))}));const h="pay"!==e?e:this.state.rawDataInputValue;let p=null;return this.state.invoiceQr?p=h:this.state.pay_from_name&&t.to!==this.state.pay_from_name&&(p=`bitshares:operation/transfer?to=${t.to}&from=${this.state.pay_from_name}&asset=${i}&amount=${s}`+(t.memo?`&memo=${t.memo}`:"")),a.createElement("div",{className:"merchant-protocol--pay"},a.createElement("div",{style:{float:"right"}},a.createElement(N,{data:c,parsePrice:this.parsePrice})),a.createElement(u(),{component:"h3",content:"invoice.payment_request"}),a.createElement("br",null),a.createElement(r.Row,null,a.createElement(r.Col,{span:10,style:{width:"30rem"}},a.createElement("h4",null,t.memo),a.createElement(l.A,{label:"invoice.paid_by",accountName:this.state.pay_from_name,onChange:this.fromChanged.bind(this),onAccountChanged:this.onFromAccountChanged.bind(this),account:this.state.pay_from_name,typeahead:!0,size:32}),a.createElement(l.A,{label:"invoice.pay_to",accountName:t.to,disabled:!0,onAccountChanged:this.onToAccountChanged.bind(this),account:this.state.pay_to_account,size:32})),a.createElement(r.Col,{span:6,offset:4},a.createElement("div",{className:"inline-block"},a.createElement(u(),{component:"h4",content:"invoice.pay.barcode"}),a.createElement(r.Button,{type:"secondary",style:{width:"180px",marginBottom:"20px"},onClick:()=>{this.setState({invoiceQr:!this.state.invoiceQr})}},a.createElement(u(),{component:"span",content:this.state.invoiceQr?"invoice.pay.invoice_qr_code":"invoice.pay.payment_qr_code"}))),a.createElement(O(),{size:180,value:p||"",bgColor:p?void 0:"#000000"}))),t.to_name&&a.createElement("div",null,a.createElement(u(),{content:"invoice.request.recipient_name"}),a.createElement("p",null,t.to_name)),t.note&&a.createElement("div",null,a.createElement(u(),{content:"invoice.note"}),a.createElement("p",null,t.note)),a.createElement(r.Row,null,a.createElement(r.Col,{span:10},a.createElement(u(),{component:"span",content:"invoice.items"})),a.createElement(r.Col,{span:3},a.createElement(u(),{component:"span",content:"invoice.amount"})),a.createElement(r.Col,{span:5},a.createElement(u(),{component:"span",content:"invoice.unit"})),a.createElement(r.Col,{span:5},a.createElement(u(),{component:"span",content:"invoice.total"}))),a.createElement("div",{className:"divider"}),d,a.createElement("div",{className:"divider"}),a.createElement(r.Row,null,a.createElement(r.Col,{span:18},a.createElement(u(),{component:"span",content:"invoice.total"})),a.createElement(r.Col,{span:5},a.createElement(A.A,{amount:s,asset:i,exact_amount:!0}))),this.state.paymentOperation?a.createElement("div",null,a.createElement("h3",null,n().translate("invoice.payment_proof")," ",a.createElement(r.Tooltip,{title:n().translate("invoice.tooltip_payment_proof"),mouseEnterDelay:.5},a.createElement(r.Icon,{type:"question-circle"}))),a.createElement("table",{className:"table"},a.createElement("tbody",null,a.createElement(B.A,{includeOperationId:!0,key:this.state.paymentOperation.id,operationId:this.state.paymentOperation.id,op:this.state.paymentOperation.op,result:this.state.paymentOperation.result,block:this.state.paymentOperation.block_num,current:this.props.currentAccount.get("id")})))):a.createElement(r.Button,{type:"primary",style:{marginTop:"30px"},disabled:!this.state.pay_from_account,onClick:this.onPayClick.bind(this)},a.createElement(u(),{content:"invoice.pay_button",asset:a.createElement(A.A,{amount:s,asset:i,exact_amount:!0}),name:t.to})))}}const V=D;var z=s(15304);function H(){return H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},H.apply(this,arguments)}class U extends a.Component{constructor(e){super(e),this.state={tabs:[{name:"Request",link:"/invoice/request",translate:"invoice.request.title",content:a.createElement(f,H({},e,{validateFormat:this._validateFormat.bind(this)}))},{name:"Pay",link:"/invoice/pay",translate:"invoice.pay.title",content:a.createElement(V,H({},e,{validateFormat:this._validateFormat.bind(this)}))}]}}_validateFormat(e){return!(0,z.t)(e,{type:"object",properties:{to:{type:"string"},to_label:{type:"string"},currency:{type:"string"},memo:{type:"string"},line_items:{type:"array",items:{type:"object",properties:{label:{type:"string"},quantity:{type:"float",minimum:1},price:{type:"float"}}}},note:{type:"string"},required:["to","currency","line_items"]}}).errors.length}componentDidMount(){this.state.tabs.some((e=>e.link===this.props.match.url))||this.props.history.push("/invoice/pay")}onTabChange(e){this.props.history.push(e)}render(){return a.createElement("div",{className:"merchant-protocol center"},a.createElement(r.Card,null,a.createElement(r.Tabs,{activeKey:this.props.location.pathname,animated:!1,onChange:this.onTabChange.bind(this)},this.state.tabs.map((e=>a.createElement(r.Tabs.TabPane,{key:e.link,tab:n().translate(e.translate)},a.createElement("div",{className:"padding"},e.content)))))))}}const W=U=(0,P.V)(U)},37556:(e,t,s)=>{"use strict";s.d(t,{K:()=>d,V:()=>h});var a=s(96540),r=s(12569),i=s(83599),n=s(72342),o=s(9476),l=s(55840),c=s(40702);const d=function(e){return!!e&&!!e.get("id")},h=function(e){let t=class extends a.Component{static propTypes={currentAccount:r.A.ChainAccount};static defaultProps={autosubscribe:!0};constructor(e){super(e)}render(){return d(this.props.currentAccount)?a.createElement(e,this.props):a.createElement(c.A,null)}};return t=(0,n.A)(t),t=(0,i.Ay)(t,100,{leading:!1}),(0,o.N)(t,{listenTo:()=>[l.A],getProps(){let e=l.A.getState().currentAccount||l.A.getState().passwordAccount||"please-login";return{currentAccount:new Map([["name",e]])}}})}},27584:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var a=s(96540),r=s(5556),i=s.n(r),n=s(46128),o=s(10658),l=s.n(o);function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},c.apply(this,arguments)}const d=a.createRef();function h({onChange:e,value:t,placeholder:s,maxLength:r,style:i,className:o,name:l,autoComplete:h,onClear:p,type:m,...u}){return null==p&&(p=()=>{e({target:{value:""}}),d.current.focus()}),a.createElement(n.Input,c({ref:d,autoComplete:h,style:i,type:m,className:o+" search-input",placeholder:s,maxLength:r,name:l,value:t,onChange:e,addonAfter:a.createElement(n.Icon,{type:"search"}),suffix:p?a.createElement(n.Icon,{onClick:p,type:"close",className:t?"cursor-pointer":"hide"}):a.createElement("span",null)},u))}h.propTypes={onChange:i().func.isRequired,value:i().string,placeholder:i().string,style:i().object,className:i().string,type:i().string,name:i().string,autoComplete:i().string,maxLength:i().number,onClear:i().func},h.defaultProps={placeholder:l().translate("exchange.filter"),style:{width:"200px"},className:"",type:"text",name:"focus",autoComplete:"off",maxLength:16,onClear:void 0}},37385:e=>{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"},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"}}},44483:(e,t,s)=>{"use strict";s.d(t,{DB:()=>n,YY:()=>i,nM:()=>l});var a=s(41321),r=s(72090);function i(e,t=!1,s,a){if(!e&&""!==e)return;let r=e.toUpperCase();r.startsWith("BIT")&&r.length>=6&&(r=e.substr(3,r.length-1)),s(r,10,t),a({lookupQuote:r})}function n({searchAssets:e,marketPickerAsset:t,baseAsset:s,quoteAsset:r},{inputValue:i,lookupQuote:n},c,d){c({activeSearch:!0});let h=0,p=[],m=s.get("symbol"),u=r.get("symbol");e.size&&i&&i.length>2&&e.filter((e=>{try{if(e.options.description){let t=JSON.parse(e.options.description);if("visible"in t&&!t.visible)return!1}}catch(e){}return-1!==e.symbol.indexOf(n)})).forEach((e=>{if(h>100)return;h++;let a=l(e.issuer),r=s.get("symbol"),i=e.symbol+"_"+r,n=u==t;(n&&e.symbol!=m||!n&&e.symbol!=u)&&p.push([i,{quote:e.symbol,base:r,issuerId:e.issuer,issuer:a}])}));const g=function(e,t){return t.startsWith("BIT")&&t.length>=6&&(t=t.substr(3,t.length-1)),e.sort((([,e],[,s])=>{const r=o(e),i=o(s);if(r.asset!==i.asset){if(r.asset===t)return-1;if(i.asset===t)return 1;if(r.asset>i.asset)return-1;if(r.asset<i.asset)return 1}if(r.isCommittee^i.isCommittee){if(r.isCommittee)return-1;if(i.isCommittee)return 1}const n=(0,a.DC)(e.quote),l=(0,a.DC)(s.quote);return n&&!l?-1:l&&!n||r.gateway>i.gateway?1:r.gateway<i.gateway?-1:0}))}(p,i);d(g)}function o(e){const t={},s=e.quote;if(-1!==s.indexOf(".")){const[e,a]=s.split(".");t.gateway=e,t.asset=a}else t.asset=s;return"1.2.0"===e.issuerId&&(t.isCommittee=!0),t}function l(e){let t=r.ChainStore.getObject(e,!1,!1);return t?t.get("name"):void 0}},77910:(e,t,s)=>{e.exports=s(16763)},24400:(e,t,s)=>{"use strict";s.r(t),s.d(t,{version:()=>o,widget:()=>l});var a=function(){return(a=Object.assign||function(e){for(var t,s=arguments,a=1,r=arguments.length;a<r;a++)for(var i in t=s[a])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function r(e,t){var s=a({},e);for(var i in t)"object"!=typeof e[i]||null===e[i]||Array.isArray(e[i])?void 0!==t[i]&&(s[i]=t[i]):s[i]=r(e[i],t[i]);return s}var i={mobile:{disabled_features:["left_toolbar","header_widget","timeframes_toolbar","edit_buttons_in_legend","context_menus","control_bar","border_around_the_chart"],enabled_features:[]}},n={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container_id:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{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:[]}};function o(){return"CL v17.025 (internal id 2f0c4150 @ 2020-11-19T09:50:09.264Z)"}var l=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=r(n,e),e.preset){var t=i[e.preset];t?(void 0!==this._options.disabled_features?this._options.disabled_features=this._options.disabled_features.concat(t.disabled_features):this._options.disabled_features=t.disabled_features,void 0!==this._options.enabled_features?this._options.enabled_features=this._options.enabled_features.concat(t.enabled_features):this._options.enabled_features=t.enabled_features):console.warn("Unknown preset: `"+e.preset+"`")}"Dark"===this._options.theme&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._create()}return e.prototype.onChartReady=function(e){this._ready?e.call(this):this._readyHandlers.push(e)},e.prototype.headerReady=function(){var e=this;return this._innerWindowLoaded.then((function(){return e._innerWindow().headerReady()}))},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.getLanguage=function(){return this._options.locale},e.prototype.setSymbol=function(e,t,s){this._innerAPI().changeSymbol(e,t,s)},e.prototype.remove=function(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)},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,s){this._innerAPI().saveChartToServer(e,t,s)},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=r(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.layoutName=function(){return this._innerAPI().layoutName()},e.prototype.changeTheme=function(e,t){this._innerWindow().changeTheme(e,t)},e.prototype.getTheme=function(){return this._innerWindow().getTheme()},e.prototype.takeScreenshot=function(){this._innerAPI().takeScreenshot()},e.prototype.lockAllDrawingTools=function(){return this._innerAPI().lockAllDrawingTools()},e.prototype.hideAllDrawingTools=function(){return this._innerAPI().hideAllDrawingTools()},e.prototype.drawOnAllCharts=function(e){this._innerAPI().drawOnAllCharts(e)},e.prototype.magnetEnabled=function(){return this._innerAPI().magnetEnabled()},e.prototype.magnetMode=function(){return this._innerAPI().magnetMode()},e.prototype.undoRedoState=function(){return this._innerAPI().undoRedoState()},e.prototype.setIntervalLinkingEnabled=function(e){this._innerAPI().setIntervalLinkingEnabled(e)},e.prototype.setTimeFrame=function(e){this._innerAPI().setTimeFrame(e)},e.prototype.symbolSync=function(){return this._innerAPI().symbolSync()},e.prototype.intervalSync=function(){return this._innerAPI().intervalSync()},e.prototype.crosshairSync=function(){return this._innerAPI().crosshairSync()},e.prototype.timeSync=function(){return this._innerAPI().timeSync()},e.prototype.getAllFeatures=function(){return this._innerWindow().getAllFeatures()},e.prototype.takeClientScreenshot=function(){return this._innerAPI().takeClientScreenshot()},e.prototype._innerAPI=function(){return this._innerWindow().tradingViewApi},e.prototype._innerWindow=function(){return this._iFrame.contentWindow},e.prototype._autoResizeChart=function(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px")},e.prototype._create=function(){var e=this,t=this._render(),s=document.getElementById(this._options.container_id);if(null===s)throw new Error("There is no such element - #"+this._options.container_id);s.innerHTML=t,this._iFrame=s.querySelector("#"+this._id);var a=this._iFrame;(this._options.autosize||this._options.fullscreen)&&(a.style.width="100%",this._options.fullscreen||(a.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded=new Promise((function(e){var t=function(){a.removeEventListener("load",t,!1),e()};a.addEventListener("load",t,!1)})),this._innerWindowLoaded.then((function(){e._innerWindow().widgetReady((function(){e._ready=!0;for(var t=0,s=e._readyHandlers;t<s.length;t++){var a=s[t];try{a.call(e)}catch(e){console.error(e)}}e._innerWindow().initializationFinished()}))}))},e.prototype._render=function(){var e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters||this._options.customFormatters,brokerFactory:this._options.broker_factory||this._options.brokerFactory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||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,getCustomIndicators:this._options.custom_indicators_getter},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data};else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");var t=(this._options.library_path||"")+(encodeURIComponent(this._options.locale)+"-tv-chart.2f0c4150.html#symbol=")+encodeURIComponent(this._options.symbol||"")+"&interval="+encodeURIComponent(this._options.interval)+(this._options.timeframe?"&timeframe="+encodeURIComponent(this._options.timeframe):"")+(this._options.toolbar_bg?"&toolbarbg="+encodeURIComponent(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.custom_css_url?"&customCSS="+encodeURIComponent(this._options.custom_css_url):"")+(this._options.auto_save_delay?"&autoSaveDelay="+encodeURIComponent(String(this._options.auto_save_delay)):"")+"&debug="+encodeURIComponent(String(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)):"")+(this._options.compare_symbols?"&compareSymbols="+encodeURIComponent(JSON.stringify(this._options.compare_symbols)):"")+(this._options.theme?"&theme="+encodeURIComponent(String(this._options.theme)):"");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=o}}]);