-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaccount.19840d4e8016454e22cc.js
1 lines (1 loc) · 297 KB
/
account.19840d4e8016454e22cc.js
1
(this.webpackChunkRuDEX3_light=this.webpackChunkRuDEX3_light||[]).push([[809],{66072:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>an});var a=s(67294),n=s(82050),i=s(32793),o=s(39014),r=s(29548),l=s(23037),c=s(82267),d=s(89449),p=s(36345),m=s(43393),h=s.n(m),u=s(65601),g=s(5977),_=s(41737),b=s(99111),E=s(45697),v=s.n(E),y=s(73727),f=s(58074),w=s.n(f),k=s(7453),C=s(89233),x=s(21019),A=s(52531),S=s(13973),N=s(112),M=s.n(N),I=s(11390),Z=s(108),P=s(57351),O=s(76660),B=s(48764).Buffer;class T extends a.Component{static propTypes={asset_to_issue:l.Z.ChainAsset.isRequired};constructor(e){super(e),this.state={amount:e.amount,to:e.to,to_id:null,memo:""}}onAmountChanged({amount:e}){this.setState({amount:e})}onToAccountChanged(e){let t=e?{to:e.get("name"),to_id:e.get("id")}:{to_id:null};this.setState(t)}onToChanged(e){this.setState({to:e,to_id:null})}onSubmit(){this.props.hideModal();let{asset_to_issue:e}=this.props,t=S.Z.get_asset_precision(e.get("precision")),s=this.state.amount.toString().replace(/,/g,"");s*=t,I.Z.issue_asset(this.state.to_id,e.get("issuer"),e.get("id"),s,this.state.memo?new B(this.state.memo,"utf-8"):this.state.memo).catch((e=>{console.log("issue error caught here:",e),O.Notification.error({message:M().translate("notifications.asset_issue_failure")})})),this.setState({amount:0,to:"",to_id:null,memo:""})}onMemoChanged(e){this.setState({memo:e.target.value})}render(){let e=this.props.asset_to_issue.get("id"),t=1,s=[a.createElement(O.Button,{type:"primary",key:"submit",onClick:this.onSubmit.bind(this,this.state.to,this.state.amount),disabled:!this.state.to_id||!this.state.amount},M().translate("modal.issue.submit")),a.createElement(O.Button,{key:"cancel",onClick:this.props.hideModal},M().translate("cancel"))];return a.createElement(O.Modal,{title:M().translate("modal.issue.submit"),visible:this.props.visible,onCancel:this.props.hideModal,footer:s},a.createElement("form",{className:"grid-block vertical full-width-content"},a.createElement("div",{className:"grid-container "},a.createElement("div",{className:"content-block"},a.createElement(Z.Z,{label:"modal.issue.to",accountName:this.state.to,onAccountChanged:this.onToAccountChanged.bind(this),typeahead:!0,onChange:this.onToChanged.bind(this),account:this.state.to,tabIndex:t++})),a.createElement("div",{className:"content-block"},a.createElement(P.Z,{label:"modal.issue.amount",amount:this.state.amount,onChange:this.onAmountChanged.bind(this),asset:e,assets:[e],tabIndex:t++})),a.createElement("div",{className:"content-block"},a.createElement("label",null,a.createElement(w(),{component:"span",content:"transfer.memo"})," ","(",a.createElement(w(),{content:"transfer.optional"}),")"),a.createElement("textarea",{rows:"3",value:this.state.memo,tabIndex:t++,onChange:this.onMemoChanged.bind(this)})))))}}const R=(0,c.Z)(T);var L=s(7581),D=s(52521),F=s(34091),V=s(91684);class q extends a.Component{static defaultProps={symbol:"",name:"",description:"",max_supply:0,precision:0};static propTypes={symbol:v().string.isRequired};constructor(e){super(e),this.state={isIssueAssetModalVisible:!1,create:{symbol:"",name:"",description:"",max_supply:1e15,precision:4},issue:{amount:0,to:"",to_id:"",asset_id:"",symbol:""},errors:{symbol:null},isValid:!1,searchTerm:""},this._searchAccounts=(0,b.Z)(this._searchAccounts,150),this.showIssueAssetModal=this.showIssueAssetModal.bind(this),this.hideIssueAssetModal=this.hideIssueAssetModal.bind(this)}showIssueAssetModal(){this.setState({isIssueAssetModalVisible:!0})}hideIssueAssetModal(){this.setState({isIssueAssetModalVisible:!1})}_checkAssets(e,t){if(this.props.account.get("assets").size)return;let s=e.sort(((e,t)=>e.symbol>t.symbol?1:e.symbol<t.symbol?-1:0)).last();0===e.size||t?(k.Z.getAssetList.defer("A",100),this.setState({assetsFetched:100})):e.size>=this.state.assetsFetched&&(k.Z.getAssetList.defer(s.symbol,100),this.setState({assetsFetched:this.state.assetsFetched+99}))}UNSAFE_componentWillReceiveProps(e){this._checkAssets(e.assets)}UNSAFE_componentWillMount(){this._checkAssets(this.props.assets,!0)}_onIssueInput(e,t){let s=t.target.id,{issue:a}=this.state;if("to"===s){this._searchAccounts(t.target.value),a.to=t.target.value;let e=this.props.searchAccounts.findEntry((e=>e===t.target.value));a.to_id=e?e[0]:null}else a[e]=t.target.value;this.setState({issue:a})}_searchAccounts(e){n.Z.accountSearch(e)}_issueButtonClick(e,t,s){s.preventDefault();let{issue:a}=this.state;a.asset_id=e,a.symbol=t,this.setState({issue:a}),this.showIssueAssetModal()}_editButtonClick(e,t,s){s.preventDefault(),this.props.history.push(`/account/${t}/update-asset/${e}`)}_createButtonClick(e){this.props.history.push(`/account/${e}/create-asset`)}render(){let{account:e,account_name:t,assets:s,assetsList:n}=this.props,i=!0;if(!e)return a.createElement(A.Z,{type:"circle"});if(e.notFound&&(i=!1),!i)return a.createElement("div",{className:"grid-block"},a.createElement("h5",null,a.createElement(w(),{component:"h5",content:"account.errors.not_found",name:t})));n.length&&(s=s.clear(),n.forEach((e=>{e&&(s=s.set(e.get("id"),e.toJS()))})));let o=s.filter((t=>t.issuer===e.get("id"))).sort(((e,t)=>parseInt(e.id.substring(4,e.id.length),10)-parseInt(t.id.substring(4,t.id.length),10))).map((e=>{let s=L.Z.parseDescription(e.options.description),n=s.short_name?s.short_name:s.main;n.length>100&&(n=n.substr(0,100)+"...");const i=this.props.getDynamicObject(e.dynamic_asset_data_id);return a.createElement("tr",{key:e.symbol},a.createElement("td",{style:{textAlign:"left"}},a.createElement(y.rU,{to:`/asset/${e.symbol}`},e.symbol)),a.createElement("td",{style:{textAlign:"left"}},"bitasset"in e?e.bitasset.is_prediction_market?a.createElement(w(),{content:"account.user_issued_assets.pm"}):a.createElement(w(),{content:"account.user_issued_assets.mpa"}):"User Issued Asset"),a.createElement("td",{style:{textAlign:"right"}},i?a.createElement(x.Z,{hide_asset:!0,amount:parseInt(i.get("current_supply"),10),asset:e.id}):null),a.createElement("td",{style:{textAlign:"right"}},a.createElement(x.Z,{hide_asset:!0,amount:parseInt(e.options.max_supply,10),asset:e.id})),a.createElement("td",null,e.bitasset_data_id?null:a.createElement("a",{onClick:this._issueButtonClick.bind(this,e.id,e.symbol)},a.createElement(V.Z,{name:"cross-circle",className:"rotate45"}))),a.createElement("td",null,a.createElement("a",{onClick:this._editButtonClick.bind(this,e.symbol,t)},a.createElement(V.Z,{name:"dashboard"}))))})).toArray();return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(F.m,{segmented:!1,setting:"issuedAssetsTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding"},a.createElement(F.O,{title:"account.user_issued_assets.issued_assets"},a.createElement("div",{className:"content-block"},a.createElement("table",{className:"table dashboard-table"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{textAlign:"left"}},a.createElement(w(),{content:"account.user_issued_assets.symbol"})),a.createElement("th",{style:{textAlign:"left"}},a.createElement(w(),{content:"explorer.asset.summary.asset_type"})),a.createElement(w(),{component:"th",content:"markets.supply",style:{textAlign:"right"}}),a.createElement("th",{style:{textAlign:"right"}},a.createElement(w(),{content:"account.user_issued_assets.max_supply"})),a.createElement("th",{style:{textAlign:"center"}},a.createElement(w(),{content:"transaction.trxTypes.asset_issue"})),a.createElement("th",{style:{textAlign:"center"}},a.createElement(w(),{content:"transaction.trxTypes.asset_update"})))),a.createElement("tbody",null,o))),a.createElement("div",{className:"content-block"},a.createElement("button",{className:"button",onClick:this._createButtonClick.bind(this,t)},a.createElement(w(),{content:"transaction.trxTypes.asset_create"})))))),a.createElement(R,{visible:this.state.isIssueAssetModalVisible,hideModal:this.hideIssueAssetModal,showModal:this.showIssueAssetModal,asset_to_issue:this.state.issue.asset_id})))}}q=(0,D.Z)(q,{propNames:["assetsList"],asList:!0,withDynamic:!0});const U=(0,d.$)(q,{listenTo:()=>[C.Z],getProps(e){let t=(0,m.Map)(),s=(0,m.List)();return e.account.get("assets",[]).size?e.account.get("assets",[]).forEach((e=>{s=s.push(e)})):t=C.Z.getState().assets,{assets:t,assetsList:s}}});var j=s(94184),W=s.n(j),z=s(21660),K=s(30806),J=s(94939),G=s(905),H=s(35922),Q=s.n(H),X=s(81237);let Y=new G.Z(Q().GRAPHENE_MAX_SHARE_SUPPLY);class $ extends a.Component{static propTypes={backingAsset:l.Z.ChainAsset.isRequired,isUpdate:v().bool};static defaultProps={isUpdate:!1};constructor(e){super(e),this.state={backingAsset:e.backingAsset.get("symbol"),error:null}}_onInputBackingAsset(e){this.props.disableBackingAssetChange?this.props.disabledBackingAssetChangeCallback():this.setState({backingAsset:e.toUpperCase(),error:null})}_onFoundBackingAsset(e){if(e){let t=e.get("bitasset")&&K.ChainStore.getAsset(e.getIn(["bitasset","options","short_backing_asset"])),s=t&&t.get("bitasset")&&K.ChainStore.getAsset(t.getIn(["bitasset","options","short_backing_asset"]));s&&"1.3.0"!==s?(this.setState({error:M().translate("account.user_issued_assets.error_too_deep")}),this.props.onUpdate("invalid",!0)):e.getIn(["bitasset","is_prediction_market"])?(this.setState({error:M().translate("account.user_issued_assets.error_invalid")}),this.props.onUpdate("invalid",!0)):this.props.isPredictionMarket&&e.get("precision")!==parseInt(this.props.assetPrecision,10)?(this.setState({error:M().translate("account.user_issued_assets.error_precision",{asset:this.props.assetSymbol})}),this.props.onUpdate("invalid",!0)):(this.props.onUpdate("short_backing_asset",e.get("id")),this.props.onUpdate("invalid",!1))}else this.props.onUpdate("invalid",!0)}render(){let{bitasset_opts:e}=this.props,{error:t}=this.state;return a.createElement("div",{className:"small-12 grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.feed_lifetime_sec"}),a.createElement("input",{type:"number",value:e.feed_lifetime_sec/60,onChange:this.props.onUpdate.bind(this,"feed_lifetime_sec")})),a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.minimum_feeds"}),a.createElement("input",{type:"number",value:e.minimum_feeds,onChange:this.props.onUpdate.bind(this,"minimum_feeds")})),a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.force_settlement_delay_sec"}),a.createElement("input",{type:"number",value:e.force_settlement_delay_sec/60,onChange:this.props.onUpdate.bind(this,"force_settlement_delay_sec")})),a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.force_settlement_offset_percent"}),a.createElement("input",{type:"number",value:e.force_settlement_offset_percent/Q().GRAPHENE_1_PERCENT,onChange:this.props.onUpdate.bind(this,"force_settlement_offset_percent")})),a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.maximum_force_settlement_volume"}),a.createElement("input",{type:"number",value:e.maximum_force_settlement_volume/Q().GRAPHENE_1_PERCENT,onChange:this.props.onUpdate.bind(this,"maximum_force_settlement_volume")})),a.createElement("div",{className:"grid-block no-margin small-12"},a.createElement(J.Z,{label:"account.user_issued_assets.backing",onChange:this._onInputBackingAsset.bind(this),asset:this.state.backingAsset,assetInput:this.state.backingAsset,tabIndex:1,style:{width:"100%",paddingRight:"10px"},onFound:this._onFoundBackingAsset.bind(this)}),t?a.createElement("div",{className:"content-block has-error"},t):null))}}$=(0,c.Z)($);class ee extends a.Component{static propTypes={core:l.Z.ChainAsset.isRequired,globalObject:l.Z.ChainObject.isRequired};static defaultProps={globalObject:"2.0.0",core:"1.3.0"};constructor(e){super(e),this.state=this.resetState(e)}resetState(e){S.Z.get_asset_precision(4),S.Z.get_asset_precision(e.core.get("precision"));let{flagBooleans:t,permissionBooleans:s}=this._getPermissions({isBitAsset:!1});return K.ChainStore.getAsset("1.3.0").get("symbol"),{update:{symbol:"",precision:4,max_supply:1e5,max_market_fee:0,market_fee_percent:0,description:{main:""},reward_percent:0},errors:{max_supply:null},isValid:!0,flagBooleans:t,permissionBooleans:s,isBitAsset:!1,is_prediction_market:!1,core_exchange_rate:{quote:{asset_id:null,amount:1},base:{asset_id:"1.3.0",amount:1}},bitasset_opts:{feed_lifetime_sec:86400,minimum_feeds:7,force_settlement_delay_sec:86400,force_settlement_offset_percent:1*Q().GRAPHENE_1_PERCENT,maximum_force_settlement_volume:20*Q().GRAPHENE_1_PERCENT,short_backing_asset:"1.3.0"},marketInput:""}}_getPermissions(e){return{flagBooleans:L.Z.getFlagBooleans(0,e.isBitAsset),permissionBooleans:L.Z.getFlagBooleans("all",e.isBitAsset)}}_createAsset(e){e.preventDefault();let{update:t,flagBooleans:s,permissionBooleans:a,core_exchange_rate:n,isBitAsset:i,is_prediction_market:o,bitasset_opts:r}=this.state,{account:l}=this.props,c=L.Z.getFlags(s,i),d=L.Z.getPermissions(a,i);this.state.marketInput!==t.description.market&&(t.description.market="");let p=JSON.stringify(t.description);k.Z.createAsset(l.get("id"),t,c,d,n,i,o,r,p).then((e=>{console.log("... AssetActions.createAsset(account_id, update)",l.get("id"),t,c,d)}))}_hasChanged(){return!S.Z.are_equal_shallow(this.state,this.resetState(this.props))}_reset(e){e.preventDefault(),this.setState(this.resetState(this.props))}_forcePositive(e){return parseFloat(e)<0?"0":e}_onUpdateDescription(e,t){let{update:s}=this.state,a=!0;switch(e){case"condition":if(t.target.value.length>60)return void(a=!1);s.description[e]=t.target.value;break;case"short_name":if(t.target.value.length>32)return void(a=!1);s.description[e]=t.target.value;break;case"market":s.description[e]=t;break;case"visible":s.description[e]=!s.description[e];break;default:s.description[e]=t.target.value}a&&(this.forceUpdate(),this._validateEditFields(s))}onChangeBitAssetOpts(e,t){let{bitasset_opts:s,errors:a}=this.state;switch(e){case"force_settlement_offset_percent":case"maximum_force_settlement_volume":s[e]=parseFloat(t.target.value)*Q().GRAPHENE_1_PERCENT;break;case"minimum_feeds":s[e]=parseInt(t.target.value,10);break;case"feed_lifetime_sec":case"force_settlement_delay_sec":console.log(t.target.value,parseInt(60*parseFloat(t.target.value),10)),s[e]=parseInt(60*parseFloat(t.target.value),10);break;case"short_backing_asset":s[e]=t;break;case"invalid":a.invalid_bitasset=t;break;default:s[e]=t.target.value}let n=!a.symbol&&!a.max_supply&&!a.invalid_bitasset;this.setState({isValid:n,errors:a})}_onUpdateInput(e,t){let{update:s,errors:a}=this.state,n=!1,i=S.Z.get_asset_precision(this.state.update.precision);const o=t.target,r=o.selectionStart,l=o.value;switch(e){case"market_fee_percent":case"reward_percent":case"precision":s[e]=this._forcePositive(o.value);break;case"max_market_fee":if(new G.Z(l).times(i).gt(Y))return a.max_market_fee="The number you tried to enter is too large",this.setState({errors:a});o.value=S.Z.limitByPrecision(o.value,this.state.update.precision),s[e]=o.value;break;case"max_supply":n=!0,new RegExp(/[[:digit:]]/).test(o.value)||(o.value=o.value.replace(/[^0-9.]/g,"")),"."==o.value.charAt(0)&&(o.value="0."),o.value.charAt(o.value.length)!=o.value.search(".")&&o.value.substr(1),o.value=S.Z.limitByPrecision(o.value,this.state.update.precision),s[e]=o.value;break;case"symbol":n=!0;const t=o.value.toUpperCase();let r=new RegExp("^[.A-Z0-9]+$");if(""!==t&&!r.test(t))break;K.ChainStore.getAsset(t),s[e]=this._forcePositive(t);break;default:s[e]=o.value}this.setState({update:s},(()=>{if(n){const t=r-(l.length-s[e].length);o.setSelectionRange(t,t)}})),this._validateEditFields(s)}_validateEditFields(e){let{errors:t}=this.state;t.max_supply=null,t.symbol=K.ChainValidation.is_valid_symbol_error(e.symbol),K.ChainStore.getAsset(e.symbol)&&(t.symbol=M().translate("account.user_issued_assets.exists"));try{t.max_supply=e.max_supply<=0?M().translate("account.user_issued_assets.max_positive"):new G.Z(e.max_supply).times(Math.pow(10,e.precision)).gt(Y)?M().translate("account.user_issued_assets.too_large"):null}catch(e){console.log("err:",e),t.max_supply=M().translate("account.user_issued_assets.too_large")}let s=!t.symbol&&!t.max_supply&&!t.invalid_bitasset;this.setState({isValid:s,errors:t})}_onFlagChange(e){let t=this.state.flagBooleans;t[e]=!t[e],this.setState({flagBooleans:t})}_onPermissionChange(e){let t=this.state.permissionBooleans;t[e]=!t[e],this.setState({permissionBooleans:t})}_onInputCoreAsset(e,t){"quote"===e?this.setState({quoteAssetInput:t}):"base"===e&&this.setState({baseAssetInput:t})}_onFoundCoreAsset(e,t){if(t){let s=this.state.core_exchange_rate;s[e].asset_id=t.get("id"),this.setState({core_exchange_rate:s}),this._validateEditFields({max_supply:this.state.max_supply,core_exchange_rate:s})}}_onInputMarket(e){this.setState({marketInput:e})}_onFoundMarketAsset(e){e&&this._onUpdateDescription("market",e.get("symbol"))}_onCoreRateChange(e,t){let s,a;if("quote"===e)s=S.Z.limitByPrecision(t.target.value,this.state.update.precision),a=null;else{if(!t||!("amount"in t))return;s=""==t.amount?"0":S.Z.limitByPrecision(t.amount.toString().replace(/,/g,""),this.props.core.get("precision")),a=t.asset.get("id")}let{core_exchange_rate:n}=this.state;n[e]={amount:s,asset_id:a},this.forceUpdate()}_onToggleBitAsset(){let{update:e}=this.state;this.state.isBitAsset=!this.state.isBitAsset,this.state.isBitAsset||(this.state.is_prediction_market=!1);let{flagBooleans:t,permissionBooleans:s}=this._getPermissions(this.state);this.state.flagBooleans=t,this.state.permissionBooleans=s,this.forceUpdate()}_onTogglePM(){this.state.is_prediction_market=!this.state.is_prediction_market,this.state.update.precision=this.props.core.get("precision"),this.state.core_exchange_rate.base.asset_id=this.props.core.get("id"),this.forceUpdate()}render(){let{globalObject:e,core:t}=this.props,{errors:s,isValid:n,update:i,flagBooleans:o,permissionBooleans:r,core_exchange_rate:l,is_prediction_market:c,isBitAsset:d,bitasset_opts:p}=this.state,m=i.symbol.length,h="N/A";3===m?h=a.createElement(x.Z,{amount:(0,X.uQ)("asset_create",["symbol3"],e),asset:"1.3.0"}):4===m?h=a.createElement(x.Z,{amount:(0,X.uQ)("asset_create",["symbol4"],e),asset:"1.3.0"}):m>4&&(h=a.createElement(x.Z,{amount:(0,X.uQ)("asset_create",["long_symbol"],e),asset:"1.3.0"}));let u=[],g=(e,t,s)=>a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(w(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none",textAlign:"right"}},a.createElement(O.Switch,{checked:s,onChange:t})))));for(let e in r)r[e]&&"charge_market_fee"!==e&&u.push(g(e,this._onFlagChange.bind(this,e),o[e]));u.push(g("visible",this._onUpdateDescription.bind(this,"visible"),!i.description.visible&&!1===i.description.visible));let _=[];for(let e in r)_.push(a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(w(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(O.Switch,{checked:r[e],onChange:this._onPermissionChange.bind(this,e)}))))));const b=a.createElement("div",null,a.createElement("button",{className:"button",onClick:this._reset.bind(this),value:M().translate("account.perm.reset")},a.createElement(w(),{content:"account.perm.reset"})),a.createElement("button",{className:W()("button",{disabled:!n}),onClick:this._createAsset.bind(this)},a.createElement(w(),{content:"header.create_asset"})));return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement("div",{className:"tabs-header"},a.createElement("h3",null,a.createElement(w(),{content:"header.create_asset"}))),a.createElement(F.m,{setting:"createAssetTab",className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block",contentClass:"grid-block shrink small-vertical medium-horizontal padding",segmented:!1,actionButtons:b},a.createElement(F.O,{title:"account.user_issued_assets.primary"},a.createElement("div",{className:"small-12 grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.symbol"}),a.createElement("input",{type:"text",value:i.symbol,onChange:this._onUpdateInput.bind(this,"symbol")})),s.symbol?a.createElement("p",{className:"grid-content has-error"},s.symbol):null,a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.max_supply"})," ",i.symbol?a.createElement("span",null,"(",i.symbol,")"):null,a.createElement("input",{type:"text",value:i.max_supply,onChange:this._onUpdateInput.bind(this,"max_supply")})),s.max_supply?a.createElement("p",{className:"grid-content has-error"},s.max_supply):null,a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.decimals"}),a.createElement("input",{min:"0",max:"8",step:"1",type:"range",value:i.precision,onChange:this._onUpdateInput.bind(this,"precision")})),a.createElement("p",null,i.precision),a.createElement("div",{style:{marginBottom:10},className:"txtlabel cancel"},a.createElement(w(),{content:"account.user_issued_assets.precision_warning"})),a.createElement("table",{className:"table",style:{width:"inherit"}},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none"}},a.createElement(w(),{content:"account.user_issued_assets.mpa"}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(O.Switch,{checked:d,onChange:this._onToggleBitAsset.bind(this)}))))),d?a.createElement("table",{className:"table",style:{width:"inherit"}},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none"}},a.createElement(w(),{content:"account.user_issued_assets.pm"}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(O.Switch,{checked:c,onChange:this._onTogglePM.bind(this)}))))):null,a.createElement(w(),{component:"h3",content:"account.user_issued_assets.core_exchange_rate"}),a.createElement("label",null,a.createElement("div",{className:"grid-block no-margin"},s.quote_asset?a.createElement("p",{className:"grid-content has-error"},s.quote_asset):null,s.base_asset?a.createElement("p",{className:"grid-content has-error"},s.base_asset):null,a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement("div",{className:"amount-selector",style:{width:"100%",paddingRight:"10px"}},a.createElement(w(),{component:"label",content:"account.user_issued_assets.quote"}),a.createElement("div",{className:"inline-label"},a.createElement("input",{type:"text",placeholder:"0.0",onChange:this._onCoreRateChange.bind(this,"quote"),value:l.quote.amount})))),a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(P.Z,{label:"account.user_issued_assets.base",amount:l.base.amount,onChange:this._onCoreRateChange.bind(this,"base"),asset:l.base.asset_id,assets:[l.base.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingLeft:"10px"}}))),a.createElement("div",null,a.createElement("h5",null,a.createElement(w(),{content:"exchange.price"}),a.createElement("span",null,":"," ",S.Z.format_number(S.Z.get_asset_price(l.quote.amount*S.Z.get_asset_precision(i.precision),{precision:i.precision},l.base.amount*S.Z.get_asset_precision(t),t),2+(parseInt(i.precision,10)||8))),a.createElement("span",null," ",i.symbol,"/",t.get("symbol"))))),a.createElement("div",null,a.createElement(w(),{content:"account.user_issued_assets.cer_warning_1",component:"label",className:"has-error"}),a.createElement(w(),{content:"account.user_issued_assets.cer_warning_2",component:"p"})),a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",h))),a.createElement(F.O,{title:"account.user_issued_assets.description"},a.createElement("div",{className:"small-12 grid-content"},a.createElement(w(),{component:"label",content:"account.user_issued_assets.description"}),a.createElement("label",null,a.createElement("textarea",{style:{height:"7rem"},rows:"1",value:i.description.main,onChange:this._onUpdateDescription.bind(this,"main")})),a.createElement(w(),{component:"label",content:"account.user_issued_assets.short"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:i.description.short_name,onChange:this._onUpdateDescription.bind(this,"short_name")})),a.createElement(w(),{component:"label",content:"account.user_issued_assets.market"}),a.createElement(J.Z,{label:"account.user_issued_assets.name",onChange:this._onInputMarket.bind(this),asset:this.state.marketInput,assetInput:this.state.marketInput,style:{width:"100%",paddingRight:"10px"},onFound:this._onFoundMarketAsset.bind(this)}),c?a.createElement("div",null,a.createElement(w(),{component:"h3",content:"account.user_issued_assets.condition"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:i.description.condition,onChange:this._onUpdateDescription.bind(this,"condition")})),a.createElement(w(),{component:"h3",content:"account.user_issued_assets.expiry"}),a.createElement("label",null,a.createElement("input",{type:"date",value:i.description.expiry,onChange:this._onUpdateDescription.bind(this,"expiry")}))):null)),d?a.createElement(F.O,{title:"account.user_issued_assets.bitasset_opts"},a.createElement($,{bitasset_opts:p,onUpdate:this.onChangeBitAssetOpts.bind(this),backingAsset:p.short_backing_asset,assetPrecision:i.precision,assetSymbol:i.symbol,isPredictionMarket:c})):null,a.createElement(F.O,{title:"account.permissions"},a.createElement("div",{className:"small-12 grid-content"},a.createElement("div",{style:{maxWidth:800}},a.createElement(z.Z,{path:"components/AccountAssetCreate",section:"permissions"})),_)),a.createElement(F.O,{title:"account.user_issued_assets.flags"},a.createElement("div",{className:"small-12 grid-content"},a.createElement("div",{style:{maxWidth:800}},a.createElement(z.Z,{path:"components/AccountAssetCreate",section:"flags"})),r.charge_market_fee?a.createElement("div",null,a.createElement("h3",null,a.createElement(w(),{component:"span",content:"account.user_issued_assets.market_fee",style:{paddingRight:"20px"}}),a.createElement(O.Switch,{checked:o.charge_market_fee,onChange:this._onFlagChange.bind(this,"charge_market_fee")})),a.createElement("div",{className:W()({disabled:!o.charge_market_fee}),style:{marginTop:"10px",marginLeft:"30px"}},a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.market_fee"})," ","(%)",a.createElement("input",{type:"number",value:i.market_fee_percent,onChange:this._onUpdateInput.bind(this,"market_fee_percent")})),a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.max_market_fee"})," ","(",i.symbol,")",a.createElement("input",{type:"number",value:i.max_market_fee,onChange:this._onUpdateInput.bind(this,"max_market_fee")})),a.createElement("div",{className:W()({disabled:!(i.market_fee_percent>0)})},a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.reward_percent"})," ","(%)",a.createElement("input",{type:"number",value:i.reward_percent,onChange:this._onUpdateInput.bind(this,"reward_percent")}))),s.max_market_fee?a.createElement("p",{className:"grid-content has-error"},s.max_market_fee):null)):null,a.createElement("h3",null,a.createElement(w(),{content:"account.user_issued_assets.flags"})),u))))))}}ee=(0,c.Z)(ee);class te extends a.Component{static propTypes={globalObject:l.Z.ChainObject.isRequired,opType:v().string,options:v().array};static defaultProps={globalObject:"2.0.0",options:[]};getFee(){return(0,X.uQ)(this.props.opType,this.props.options,this.props.globalObject)}render(){let{opType:e,options:t,globalObject:s}=this.props;if(!e||!t||!s)return null;let n=(0,X.uQ)(e,t,s);return a.createElement(x.Z,{amount:n,asset:"1.3.0"})}}const se=(0,c.Z)(te);var ae=s(33951),ne=s(3841),ie=s(38715),oe=s(55294);class re extends a.Component{constructor(e){super(),this.state={listType:e.assetWhiteListType,accountTable:-1===e.assetWhiteListType.indexOf("markets"),listTypes:["whitelist_authorities","blacklist_authorities","whitelist_markets","blacklist_markets","whitelist_market_fee_sharing"],assetInput:null,asset_id:null}}renderAccountTables(){const{listType:e}=this.state;let t=!1,s="explorer.asset.whitelist.enable_flag";return"whitelist_market_fee_sharing"===e?this.props.marketFeeEnabled||(t=!0,s="explorer.asset.whitelist.market_fee_enable_flag"):t=!this.props.whiteListEnabled,t?a.createElement("div",null,a.createElement(w(),{className:"txtlabel cancel",component:"p",content:s})):a.createElement("div",null,a.createElement("table",{className:"table dashboard-table table-hover"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,a.createElement(w(),{content:"explorer.account.title"})),a.createElement("th",null,a.createElement(w(),{content:"account.perm.remove_text"})))),a.createElement("tbody",null,this.props[e].map((t=>a.createElement("tr",{key:t},a.createElement("td",null,a.createElement(ne.Z,{account:t})),a.createElement("td",{className:"clickable",onClick:this.props.onChangeList.bind(this,e,"remove",t)},a.createElement(V.Z,{name:"cross-circle",title:"icons.cross_circle.remove",className:"icon-14px"}))))))),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement(Z.Z,{label:`account.whitelist.${e}`,accountName:this.props.authority_name,account:this.props.authority_name,onChange:this.props.onAccountNameChanged.bind(this,"authority_name"),onAccountChanged:this.props.onAccountChanged.bind(this,"new_authority_id"),error:null,tabIndex:1,action_label:"account.perm.confirm_add",onAction:this.props.onChangeList.bind(this,e,"add",this.props.new_authority_id)})))}_onAssetChange(e){this.setState({assetInput:e})}_onAssetFound(e){this.setState({asset_id:e?e.get("id"):null})}renderMarketTable(){const{listType:e}=this.state;return a.createElement("div",null,a.createElement("table",{className:"table dashboard-table table-hover"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,a.createElement(w(),{content:"explorer.asset.title"})),a.createElement("th",null,a.createElement(w(),{content:"account.perm.remove_text"})))),a.createElement("tbody",null,this.props[e].map((t=>a.createElement("tr",{key:t},a.createElement("td",null,a.createElement(ie.Z,{asset:t})),a.createElement("td",{className:"clickable",onClick:this.props.onChangeList.bind(this,e,"remove",t)},a.createElement(V.Z,{name:"cross-circle",title:"icons.cross_circle.remove",className:"icon-14px"}))))))),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement(J.Z,{label:`explorer.asset.whitelist.${e}`,onChange:this._onAssetChange.bind(this),asset:this.state.assetInput,assetInput:this.state.assetInput,tabIndex:1,style:{width:"100%"},onFound:this._onAssetFound.bind(this),action_label:"account.perm.confirm_add",onAction:this.props.onChangeList.bind(this,e,"add",this.state.asset_id)})))}_onSwitchType(e){this.setState({listType:e,accountTable:-1===e.indexOf("markets")}),oe.Z.changeViewSetting({assetWhiteListType:e})}render(){const{accountTable:e,listType:t}=this.state,s=this.state.listTypes.indexOf(this.state.listType);return a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement("div",null,a.createElement("div",{className:"header-selector",style:{paddingBottom:"2rem"}},a.createElement("div",{className:"selector"},this.state.listTypes.map(((e,t)=>a.createElement("div",{key:e,className:W()("inline-block",{inactive:s!==t}),onClick:this._onSwitchType.bind(this,e)},a.createElement(w(),{content:`explorer.asset.whitelist.${e}`})))))),e?this.renderAccountTables():this.renderMarketTable(),this.props.children))}}const le=(0,d.$)(re,{listenTo:()=>[o.Z],getProps:()=>({assetWhiteListType:o.Z.getState().viewSettings.get("assetWhiteListType","whitelist_authorities")})});class ce extends a.Component{constructor(e){super(e),this.state={producer_name:null}}onAccountChanged(e){this.setState({new_producer_id:e?e.get("id"):null})}onAccountNameChanged(e){this.setState({producer_name:e})}render(){const{witnessFed:e,committeeFed:t}=this.props;return e||t?a.createElement("div",{className:"grid-content small-12 large-8 large-offset-2"},a.createElement(w(),{component:"p",content:"account.user_issued_assets.feed_not_allowed_1",className:"has-error"}),a.createElement(w(),{component:"p",content:"account.user_issued_assets.feed_not_allowed_2"})):a.createElement("div",{className:"grid-content small-12 large-8 large-offset-2"},a.createElement("table",{className:"table dashboard-table table-hover"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null),a.createElement("th",{style:{textAlign:"left"}},a.createElement(w(),{content:"explorer.account.title"})),a.createElement("th",null,a.createElement(w(),{content:"account.perm.remove_text"})))),a.createElement("tbody",null,this.props.producers.map(((e,t)=>a.createElement("tr",{key:e},a.createElement("td",{style:{textAlign:"left"}},"#",t+1),a.createElement("td",{style:{textAlign:"left"}},a.createElement(ne.Z,{account:e})),a.createElement("td",{className:"clickable",onClick:this.props.onChangeList.bind(this,"remove",e)},a.createElement(V.Z,{name:"cross-circle",title:"icons.cross_circle.remove",className:"icon-14px"}))))))),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement(Z.Z,{label:"account.user_issued_assets.add_feed",accountName:this.state.producer_name,account:this.state.producer_name,onChange:this.onAccountNameChanged.bind(this),onAccountChanged:this.onAccountChanged.bind(this),error:null,tabIndex:1,action_label:"account.perm.confirm_add",onAction:this.props.onChangeList.bind(this,"add",this.state.new_producer_id)})))}}function de(){return de=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},de.apply(this,arguments)}let pe=new G.Z(Q().GRAPHENE_MAX_SHARE_SUPPLY);const me=()=>{O.Notification.error({message:M().translate("account.user_issued_assets.invalid_backing_asset_change")})};class he extends a.Component{static propTypes={globalObject:l.Z.ChainObject.isRequired};static defaultProps={globalObject:"2.0.0"};constructor(e){super(e),this.state=this.resetState(e),this.showAssetUpdateConfirmationModal=this.showAssetUpdateConfirmationModal.bind(this),this.hideAssetUpdateConfirmationModal=this.hideAssetUpdateConfirmationModal.bind(this)}_openConfirm(){this.showAssetUpdateConfirmationModal()}_cancelConfirm(){this.hideAssetUpdateConfirmationModal()}resetState(e){let t=e.asset.toJS(),s=void 0!==t.bitasset_data_id,a=S.Z.get_asset_precision(t.precision),n=S.Z.get_asset_precision(e.core.get("precision")),i=new G.Z(t.options.max_market_fee).div(a).toString(),o=new G.Z(t.options.max_supply).div(a).toString(),r=t.options.core_exchange_rate;r.quote.amount=r.quote.asset_id===t.id?new G.Z(r.quote.amount).div(a).toString():new G.Z(r.quote.amount).div(n).toString(),r.base.amount=r.base.asset_id===t.id?new G.Z(r.base.amount).div(a).toString():new G.Z(r.base.amount).div(n).toString();let l=L.Z.getFlagBooleans(t.options.flags,s),c=L.Z.getFlagBooleans(t.options.issuer_permissions,s);t.options.market_fee_percent/=100,null!==t.options.extensions&&null!==t.options.extensions.reward_percent&&(t.options.extensions.reward_percent/=100);let d=K.ChainStore.getAsset(r.quote.asset_id).get("symbol"),p=K.ChainStore.getAsset(r.base.asset_id).get("symbol"),m=e.asset.getIn(["options","extensions","whitelist_market_fee_sharing"]);return{isAssetUpdateConfirmationModalVisible:!1,update:{max_supply:o,max_market_fee:i,reward_percent:void 0===e.asset.getIn(["options","extensions","reward_percent"])?void 0:t.options.extensions.reward_percent,market_fee_percent:t.options.market_fee_percent,description:L.Z.parseDescription(t.options.description)},core_exchange_rate:r,issuer:t.issuer,new_issuer_account_id:null,new_funder_account:e.account.get("id"),asset_to_update:t.id,errors:{max_supply:null},new_authority_id:null,authority_name:null,isValid:!0,flagBooleans:l,permissionBooleans:c,isBitAsset:s,coreRateQuoteAssetName:d,quoteAssetInput:d,coreRateBaseAssetName:p,baseAssetInput:p,claimFeesAmount:0,bitasset_opts:s?t.bitasset.options:null,original_bitasset_opts:s?e.asset.getIn(["bitasset","options"]).toJS():null,marketInput:"",whitelist_authorities:e.asset.getIn(["options","whitelist_authorities"]),blacklist_authorities:e.asset.getIn(["options","blacklist_authorities"]),whitelist_markets:e.asset.getIn(["options","whitelist_markets"]),whitelist_market_fee_sharing:m,blacklist_markets:e.asset.getIn(["options","blacklist_markets"]),maxFeedProducers:e.globalObject.getIn(["parameters","maximum_asset_feed_publishers"]),feedProducers:s?e.asset.getIn(["bitasset","feeds"],[]).map((e=>e.first())):null,originalFeedProducers:s?e.asset.getIn(["bitasset","feeds"],[]).map((e=>e.first())):null}}hideAssetUpdateConfirmationModal(){this.setState({isAssetUpdateConfirmationModalVisible:!1})}showAssetUpdateConfirmationModal(){this.setState({isAssetUpdateConfirmationModalVisible:!0})}assetChanged(){let e=this.state,t=this.resetState(this.props);return JSON.stringify(e.update)!==JSON.stringify(t.update)||JSON.stringify(e.core_exchange_rate)!==JSON.stringify(t.core_exchange_rate)||null!==e.new_issuer_account_id&&e.new_issuer_account_id!==e.issuer||JSON.stringify(e.flagBooleans)!==JSON.stringify(t.flagBooleans)||JSON.stringify(e.permissionBooleans)!==JSON.stringify(t.permissionBooleans)||JSON.stringify(e.whitelist_authorities)!==JSON.stringify(t.whitelist_authorities)||JSON.stringify(e.blacklist_authorities)!==JSON.stringify(t.blacklist_authorities)||JSON.stringify(e.whitelist_markets)!==JSON.stringify(t.whitelist_markets)||JSON.stringify(e.blacklist_markets)!==JSON.stringify(t.blacklist_markets)||JSON.stringify(e.whitelist_market_fee_sharing)!==JSON.stringify(t.whitelist_market_fee_sharing)}tabChanged(e){let t=this.tabsChanged();return!!t[e]&&t[e]}tabsChanged(){let e=this.state,t=this.resetState(this.props),s=[];return e.update.max_supply===t.update.max_supply&&e.core_exchange_rate.base.amount===t.core_exchange_rate.base.amount&&e.core_exchange_rate.quote.amount===t.core_exchange_rate.quote.amount||(s[0]=!0),JSON.stringify(e.whitelist_authorities)===JSON.stringify(t.whitelist_authorities)&&JSON.stringify(e.blacklist_authorities)===JSON.stringify(t.blacklist_authorities)&&JSON.stringify(e.whitelist_markets)===JSON.stringify(t.whitelist_markets)&&JSON.stringify(e.blacklist_markets)===JSON.stringify(t.blacklist_markets)&&JSON.stringify(e.whitelist_market_fee_sharing)===JSON.stringify(t.whitelist_market_fee_sharing)||(s[1]=!0),e.update.description.main===t.update.description.main&&e.update.description.short_name===t.update.description.short_name&&e.update.description.market===t.update.description.market||(s[2]=!0),JSON.stringify(e.bitasset_opts)!==JSON.stringify(t.original_bitasset_opts)&&(s[3]=!0),JSON.stringify(e.permissionBooleans)!==JSON.stringify(t.permissionBooleans)&&(s[4]=!0),JSON.stringify(e.flagBooleans)===JSON.stringify(t.flagBooleans)&&e.update.market_fee_percent===t.update.market_fee_percent&&e.update.max_market_fee===t.update.max_market_fee&&e.update.reward_percent===t.update.reward_percent||(s[5]=!0),JSON.stringify(e.feedProducers)!==JSON.stringify(t.originalFeedProducers)&&(s[6]=!0),s}pageChanged(){let{isBitAsset:e,bitasset_opts:t,original_bitasset_opts:s,feedProducers:a,originalFeedProducers:n}=this.state;return this.assetChanged()||e&&(JSON.stringify(t)!==JSON.stringify(s)||!S.Z.are_equal_shallow(a.toJS(),n.toJS()))}_updateAsset(e){e.preventDefault(),this.hideAssetUpdateConfirmationModal();let{update:t,issuer:s,new_issuer_account_id:a,core_exchange_rate:n,flagBooleans:i,permissionBooleans:o,isBitAsset:r,bitasset_opts:l,original_bitasset_opts:c,feedProducers:d,originalFeedProducers:p}=this.state,m=L.Z.getFlags(i);128&this.props.asset.getIn(["options","flags"])&&!(128&this.props.asset.getIn(["options","issuer_permissions"]))&&(m+=128);let h=L.Z.getPermissions(o,r);this.state.marketInput!==t.description.market&&(t.description.market="");let u=JSON.stringify(t.description),g={whitelist_authorities:this.state.whitelist_authorities,blacklist_authorities:this.state.blacklist_authorities,whitelist_markets:this.state.whitelist_markets,blacklist_markets:this.state.blacklist_markets,whitelist_market_fee_sharing:this.state.whitelist_market_fee_sharing},_=r?d.toJS():null,b=r?p.toJS():null;k.Z.updateAsset(s,a,t,n,this.props.asset,m,h,r,l,c,u,g,_,b,this.assetChanged()).then((()=>{console.log("... AssetActions.updateAsset(account_id, update)",s,a,this.props.asset.get("id"),t),setTimeout((()=>{K.ChainStore.getAsset(this.props.asset.get("id")),this.setState(this.resetState(this.props))}),3e3)}))}_reset(e){e.preventDefault(),this.setState(this.resetState(this.props))}_forcePositive(e){return parseFloat(e)<0?"0":e}_onUpdateDescription(e,t){let{update:s}=this.state,a=!0;switch(e){case"condition":if(t.target.value.length>60)return void(a=!1);s.description[e]=t.target.value;break;case"short_name":if(t.target.value.length>32)return void(a=!1);s.description[e]=t.target.value;break;case"market":s.description[e]=t;break;case"visible":s.description[e]=!s.description[e];break;default:s.description[e]=t.target.value}a&&(this.forceUpdate(),this._validateEditFields(s))}onChangeBitAssetOpts(e,t){let{bitasset_opts:s}=this.state;switch(e){case"force_settlement_offset_percent":case"maximum_force_settlement_volume":s[e]=parseFloat(t.target.value)*Q().GRAPHENE_1_PERCENT;break;case"feed_lifetime_sec":case"force_settlement_delay_sec":console.log(t.target.value,parseInt(60*parseFloat(t.target.value),10)),s[e]=parseInt(60*parseFloat(t.target.value),10);break;case"short_backing_asset":s[e]=t;break;case"minimum_feeds":s[e]=parseInt(t.target.value,10)}this.forceUpdate()}_onUpdateInput(e,t){let{update:s}=this.state,a=!0,n=S.Z.get_asset_precision(this.props.asset.get("precision"));switch(e){case"market_fee_percent":case"reward_percent":s[e]=this._forcePositive(t.target.value);break;case"max_market_fee":let i=t.amount.replace(/,/g,"");if(new G.Z(i).times(n).gt(pe))return a=!1,this.setState({errors:{max_market_fee:"The number you tried to enter is too large"}});s[e]=S.Z.limitByPrecision(i,this.props.asset.get("precision"));break;case"max_supply":let o=t.amount.replace(/,/g,"");s[e]=S.Z.limitByPrecision(o,this.props.asset.get("precision"));break;default:s[e]=t.target.value}a&&(this.setState({update:s}),this._validateEditFields(s))}_validateEditFields(e){let t=e.core_exchange_rate,s=e.feedProducers?e.feedProducers:this.state.feedProducers,a=this.state.flagBooleans,{asset:n,core:i}=this.props,o={max_supply:null,quote_asset:null,base_asset:null,max_feed_producer:null,conflict_producer:null,invalid_market_pair:null};const r=this.props.asset.get("precision");try{o.max_supply=e.max_supply<=0?M().translate("account.user_issued_assets.max_positive"):new G.Z(parseInt(e.max_supply,10)).times(Math.pow(10,r)).gt(pe)?M().translate("account.user_issued_assets.too_large"):null}catch(e){console.log("err:",e),o.max_supply=M().translate("account.user_issued_assets.too_large")}t&&(t.quote.asset_id!==n.get("id")&&t.base.asset_id!==n.get("id")&&(o.quote_asset=M().translate("account.user_issued_assets.need_asset",{name:n.get("symbol")})),t.quote.asset_id!==i.get("id")&&t.base.asset_id!==i.get("id")&&(o.base_asset=M().translate("account.user_issued_assets.need_asset",{name:i.get("symbol")}))),s&&s.size>this.state.maxFeedProducers&&(o.max_feed_producer=M().translate("account.user_issued_assets.too_many_feed",{max:this.state.maxFeedProducers})),a.committee_fed_asset&&a.witness_fed_asset&&(o.conflict_producer=M().translate("account.user_issued_assets.conflict_feed")),this.state.marketInput==this.props.asset.get("symbol")&&(o.invalid_market_pair=M().translate("account.user_issued_assets.invalid_market_pair"));let l=!(o.invalid_market_pair||o.max_supply||o.base_asset||o.quote_asset||o.max_feed_producer||o.conflict_producer);this.setState({isValid:l,errors:o})}_onCoreRateChange(e,t){t.amount=""==t.amount?"0":t.amount.replace(/,/g,""),t.amount=S.Z.limitByPrecision(t.amount,t.asset.get("precision"));let{core_exchange_rate:s}=this.state;s[e]={amount:t.amount,asset_id:t.asset.get("id")},this.forceUpdate()}onAccountChanged(e,t){this.setState({[e]:t?t.get("id"):null})}onAccountNameChanged(e,t){this.setState({[e]:t})}_onInputCoreAsset(e,t){"quote"===e?this.setState({quoteAssetInput:t}):"base"===e&&this.setState({baseAssetInput:t})}_onFoundCoreAsset(e,t){if(t){let s=this.state.core_exchange_rate;s[e].asset_id=t.get("id"),this.setState({core_exchange_rate:s}),this._validateEditFields({max_supply:this.state.max_supply,core_exchange_rate:s})}}_onInputMarket(e){this.setState({marketInput:e})}_onFoundMarketAsset(e){e&&this._onUpdateDescription("market",e.get("symbol"))}_onFlagChange(e){let t=this.state.flagBooleans;t[e]=!t[e],this.setState({flagBooleans:t}),this._validateEditFields({})}_getCurrentSupply(){const{asset:e,getDynamicObject:t}=this.props;return t&&t(e.get("dynamic_asset_data_id")).get("current_supply")}_onPermissionChange(e){const{isBitAsset:t,permissionBooleans:s}=this.state,a=!L.Z.getFlagBooleans(this.props.asset.getIn(["options","issuer_permissions"]),t)[e];if(this._getCurrentSupply()>0&&a)return void O.Notification.error({message:M().translate("account.user_issued_assets.invalid_permissions_change")});let n=s;n[e]=!n[e],this.setState({permissionBooleans:n})}_onClaimInput(e){this.setState({claimFeesAmount:e.amount})}onChangeList(e,t="add",s){let a=this.state[e];void 0===a&&(a=new(h().List)([])),"add"!==t||a.includes(s)?"remove"===t&&a.includes(s)&&(a=a.remove(a.indexOf(s))):a=a.push(s),this.setState({[e]:a})}onChangeFeedProducerList(e="add",t){let s=this.state.feedProducers;"add"!==e||s.includes(t)?"remove"===e&&s.includes(t)&&(s=s.remove(s.indexOf(t))):s=s.push(t),this.setState({feedProducers:s}),this._validateEditFields({feedProducers:s})}render(){let{asset:e}=this.props,{errors:t,isValid:s,update:n,core_exchange_rate:i,flagBooleans:o,permissionBooleans:r,claimFeesAmount:l,isBitAsset:c,bitasset_opts:d}=this.state,p=e.get("symbol"),m="N/A";m=a.createElement(se,{opType:"asset_update"});let u=K.ChainStore.getAsset(i.quote.asset_id),g=S.Z.get_asset_precision(u.get("precision")),_=K.ChainStore.getAsset(i.base.asset_id),b=S.Z.get_asset_precision(_.get("precision")),E=parseFloat(i.quote.amount)*g,v=parseFloat(i.base.amount)*b,y=L.Z.getFlagBooleans(e.getIn(["options","issuer_permissions"]),void 0!==e.get("bitasset")),f=[],k=(e,t,s)=>a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(w(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none",textAlign:"right"}},a.createElement(O.Switch,{checked:s,onChange:t})))));for(let e in y)y[e]&&"charge_market_fee"!==e&&f.push(k(e,this._onFlagChange.bind(this,e),o[e]));f.push(k("visible",this._onUpdateDescription.bind(this,"visible"),!n.description.visible&&!1===n.description.visible));let C=[];for(let e in y)C.push(a.createElement("table",{key:"table_"+e,className:"table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{style:{border:"none",width:"80%"}},a.createElement(w(),{content:`account.user_issued_assets.${e}`}),":"),a.createElement("td",{style:{border:"none"}},a.createElement(O.Switch,{checked:r[e],onChange:this._onPermissionChange.bind(this,e)}))))));let x=0;this.tabsChanged().forEach((function(){x++}));let A=a.createElement("div",null,a.createElement("button",{className:W()("button",{disabled:!s||!this.pageChanged()}),style:{width:"9rem"},onClick:x>1?this._openConfirm.bind(this):this._updateAsset.bind(this)},x>1?a.createElement(w(),{content:"account.perm.save_all"}):a.createElement(w(),{content:"account.perm.save"})),a.createElement("button",{className:W()("button primary hollow",{disabled:!this.pageChanged()}),onClick:this._reset.bind(this)},a.createElement(w(),{content:"account.perm.reset"}))),N=!1;"1.3.0"!==u.get("id")&&"1.3.0"!==_.get("id")||u.get("id")!==e.get("id")&&_.get("id")!==e.get("id")||(N=!0);let I=e.getIn(["bitasset","is_prediction_market"]),Z=L.Z.parseDescription(this.props.asset.toJS().options.description);return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement("div",{className:"tabs-header"},a.createElement("h3",null,a.createElement(w(),{content:"header.update_asset"}),":"," ",p)),a.createElement(F.m,{setting:"updateAssetTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"grid-block padding-top shrink small-vertical medium-horizontal",segmented:!1,actionButtons:A,onChangeTab:e=>{this.setState({activeTab:e})}},a.createElement(F.O,{title:"account.user_issued_assets.primary",updatedTab:this.tabChanged(0)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.precision"}),a.createElement("span",null,": ",e.get("precision"))),a.createElement("br",null),a.createElement("label",null,a.createElement(P.Z,{label:"account.user_issued_assets.max_supply",amount:n.max_supply,onChange:this._onUpdateInput.bind(this,"max_supply"),asset:e.get("id"),assets:[e.get("id")],placeholder:"0.0",tabIndex:1})),t.max_supply?a.createElement("p",{className:"grid-content has-error"},t.max_supply):null,a.createElement(w(),{component:"h3",content:"account.user_issued_assets.core_exchange_rate"}),a.createElement("label",null,a.createElement("div",{className:"grid-block no-margin"},N?null:a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(J.Z,{label:"account.user_issued_assets.quote_name",onChange:this._onInputCoreAsset.bind(this,"quote"),asset:this.state.quoteAssetInput,assetInput:this.state.quoteAssetInput,tabIndex:1,style:{width:"100%",paddingRight:"10px"},onFound:this._onFoundCoreAsset.bind(this,"quote")})),N?null:a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(J.Z,{label:"account.user_issued_assets.base_name",onChange:this._onInputCoreAsset.bind(this,"base"),asset:this.state.baseAssetInput,assetInput:this.state.baseAssetInput,tabIndex:1,style:{width:"100%",paddingLeft:"10px"},onFound:this._onFoundCoreAsset.bind(this,"base")})),t.quote_asset?a.createElement("p",{className:"grid-content has-error"},t.quote_asset):null,t.base_asset?a.createElement("p",{className:"grid-content has-error"},t.base_asset):null,a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(P.Z,{label:"account.user_issued_assets.quote",amount:i.quote.amount,onChange:this._onCoreRateChange.bind(this,"quote"),asset:i.quote.asset_id,assets:[i.quote.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingRight:"10px"}})),a.createElement("div",{className:"grid-block no-margin small-12 medium-6"},a.createElement(P.Z,{label:"account.user_issued_assets.base",amount:i.base.amount,onChange:this._onCoreRateChange.bind(this,"base"),asset:i.base.asset_id,assets:[i.base.asset_id],placeholder:"0.0",tabIndex:1,style:{width:"100%",paddingLeft:"10px"}}))),a.createElement("div",null,a.createElement("h5",null,a.createElement(w(),{content:"exchange.price"}),":"," ",a.createElement(ae.Z,{style:{fontWeight:"bold"},quote_amount:E,quote_asset:i.quote.asset_id,base_asset:i.base.asset_id,base_amount:v})))),a.createElement("div",null,a.createElement(w(),{content:"account.user_issued_assets.cer_warning_1",component:"label",className:"has-error"}),a.createElement(w(),{content:"account.user_issued_assets.cer_warning_2",component:"p"})),a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),a.createElement(F.O,{title:"account.whitelist.title",updatedTab:this.tabChanged(1)},a.createElement(le,{whiteListEnabled:o.white_list,marketFeeEnabled:o.charge_market_fee,whitelist_authorities:this.state.whitelist_authorities,blacklist_authorities:this.state.blacklist_authorities,whitelist_markets:this.state.whitelist_markets,whitelist_market_fee_sharing:void 0===this.state.whitelist_market_fee_sharing?new(h().List)([]):this.state.whitelist_market_fee_sharing,blacklist_markets:this.state.blacklist_markets,new_authority_id:this.state.new_authority_id,authority_name:this.state.authority_name,onAccountNameChanged:this.onAccountNameChanged.bind(this),onAccountChanged:this.onAccountChanged.bind(this),onChangeList:this.onChangeList.bind(this)},a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),a.createElement(F.O,{title:"account.user_issued_assets.description",updatedTab:this.tabChanged(2)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement("label",null,a.createElement("textarea",{style:{height:"7rem"},rows:"1",value:n.description.main||"",onChange:this._onUpdateDescription.bind(this,"main")})),a.createElement(w(),{component:"h3",content:"account.user_issued_assets.short"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:n.description.short_name||"",onChange:this._onUpdateDescription.bind(this,"short_name")})),a.createElement(w(),{component:"h3",content:"account.user_issued_assets.market"}),a.createElement(J.Z,{label:"account.user_issued_assets.name",onChange:this._onInputMarket.bind(this),placeholder:Z.market,asset:this.state.marketInput,assetInput:this.state.marketInput,style:{width:"100%",paddingRight:"10px",paddingBottom:"20px"},onFound:this._onFoundMarketAsset.bind(this)}),t.invalid_market_pair?a.createElement("p",{className:"grid-content has-error"},t.invalid_market_pair):null,I?a.createElement("div",null,a.createElement(w(),{component:"h3",content:"account.user_issued_assets.condition"}),a.createElement("label",null,a.createElement("input",{type:"text",rows:"1",value:n.description.condition,onChange:this._onUpdateDescription.bind(this,"condition")})),a.createElement(w(),{component:"h3",content:"account.user_issued_assets.expiry"}),a.createElement("label",null,a.createElement("input",{type:"date",value:n.description.expiry,onChange:this._onUpdateDescription.bind(this,"expiry")}))):null,a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),c?a.createElement(F.O,{title:"account.user_issued_assets.bitasset_opts",updatedTab:this.tabChanged(3)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement($,{bitasset_opts:d,onUpdate:this.onChangeBitAssetOpts.bind(this),backingAsset:d.short_backing_asset,assetPrecision:e.get("precision"),assetSymbol:e.get("symbol"),disableBackingAssetChange:this._getCurrentSupply()>0,disabledBackingAssetChangeCallback:me}),a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",m))):null,a.createElement(F.O,{title:"account.permissions",updatedTab:this.tabChanged(4)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement(z.Z,{path:"components/AccountAssetCreate",section:"permissions"}),a.createElement("p",{className:"grid-content has-error"},a.createElement(w(),{content:"account.user_issued_assets.perm_warning"})),C,a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",m))),a.createElement(F.O,{title:"account.user_issued_assets.flags",updatedTab:this.tabChanged(5)},a.createElement("div",{className:"small-12 large-8 large-offset-2 grid-content"},a.createElement(z.Z,{path:"components/AccountAssetCreate",section:"flags"}),y.charge_market_fee?a.createElement("div",null,a.createElement("h3",null,a.createElement(w(),{component:"span",content:"account.user_issued_assets.market_fee",style:{paddingRight:"20px"}}),a.createElement(O.Switch,{checked:o.charge_market_fee,onChange:this._onFlagChange.bind(this,"charge_market_fee")})),a.createElement("div",{className:W()({disabled:!o.charge_market_fee}),style:{marginTop:"10px",marginLeft:"30px"}},a.createElement("label",null,a.createElement(w(),{content:"account.user_issued_assets.market_fee"})," ","(%)",a.createElement("input",{type:"number",value:n.market_fee_percent,onChange:this._onUpdateInput.bind(this,"market_fee_percent")})),a.createElement("label",null,a.createElement(P.Z,{label:"account.user_issued_assets.max_market_fee",amount:n.max_market_fee,onChange:this._onUpdateInput.bind(this,"max_market_fee"),asset:e.get("id"),assets:[e.get("id")],placeholder:"0.0",tabIndex:1})),a.createElement("div",null,a.createElement("label",null,a.createElement(O.Tooltip,{title:M().translate("account.user_issued_assets.reward_percent_tooltip")},a.createElement(w(),{content:"account.user_issued_assets.reward_percent"})," ","(%)"),a.createElement("input",{type:"number",value:n.reward_percent,onChange:this._onUpdateInput.bind(this,"reward_percent")}))),t.max_market_fee?a.createElement("p",{className:"grid-content has-error"},t.max_market_fee):null)):null,a.createElement("h3",null,a.createElement(w(),{content:"account.user_issued_assets.flags"})),f,a.createElement("p",null,a.createElement(w(),{content:"account.user_issued_assets.approx_fee"}),": ",m),t.conflict_producer?a.createElement("p",{className:"grid-content has-error"},t.conflict_producer):null)),c?a.createElement(F.O,{title:"account.user_issued_assets.feed_producers",updatedTab:this.tabChanged(6)},a.createElement(ce,{asset:this.props.asset,account:this.props.account,witnessFed:o.witness_fed_asset,committeeFed:o.committee_fed_asset,producers:this.state.feedProducers,onChangeList:this.onChangeFeedProducerList.bind(this)}),t.max_feed_producer?a.createElement("p",{className:"grid-content has-error large-8 large-offset-2",style:{marginTop:"20px"}},t.max_feed_producer):null):null))),a.createElement(ue,de({visible:this.state.isAssetUpdateConfirmationModalVisible,hideModal:this.hideAssetUpdateConfirmationModal,showModal:this.showAssetUpdateConfirmationModal,tabsChanged:this.tabsChanged(),_cancelConfirm:this._cancelConfirm.bind(this),_updateAsset:this._updateAsset.bind(this)},this.props)))}}he=(0,c.Z)(he),he=(0,D.Z)(he,{propNames:["asset","core"],defaultProps:{core:"1.3.0"},withDynamic:!0});class ue extends a.Component{constructor(){super()}render(){let{tabsChanged:e}=this.props;const t=[a.createElement(O.Button,{type:"primary",key:"submit",onClick:this.props._updateAsset},M().translate("global.confirm")),a.createElement(O.Button,{key:"cancel",onClick:this.props.hideModal},M().translate("global.cancel"))];return a.createElement(O.Modal,{visible:this.props.visible,footer:t,onCancel:this.props.hideModal,title:M().translate("account.confirm_asset_modal.header")},a.createElement(w(),{content:"account.confirm_asset_modal.are_you_sure",component:"div",style:{paddingBottom:"1rem"}}),a.createElement("div",null,a.createElement("ul",null,e[0]?a.createElement("li",null,a.createElement(w(),{content:"account.user_issued_assets.primary"})):null,e[1]?a.createElement("li",null,a.createElement(w(),{content:"account.whitelist.title"})):null,e[2]?a.createElement("li",null,a.createElement(w(),{content:"account.user_issued_assets.description"})):null,e[3]?a.createElement("li",null,a.createElement(w(),{content:"account.user_issued_assets.bitasset_opts"})):null,e[4]?a.createElement("li",null,a.createElement(w(),{content:"account.permissions"})):null,e[5]?a.createElement("li",null,a.createElement(w(),{content:"account.user_issued_assets.flags"})):null,e[6]?a.createElement("li",null,a.createElement(w(),{content:"account.user_issued_assets.feed_producers"})):null)))}}class ge extends a.Component{render(){let e=this.props.match.params.asset.toUpperCase();return a.createElement(he,de({asset:e},this.props))}}const _e=(0,g.EN)(ge);class be extends a.Component{static propTypes={stat_object:l.Z.ChainObject.isRequired};render(){let e=this.props.stat_object.toJS();return this.props.plainText?a.createElement(x.Z,{amount:parseFloat(e.lifetime_fees_paid),asset:"1.3.0"}):a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,a.createElement(w(),{content:"account.member.fees_paid"})," "),a.createElement("td",null,a.createElement(x.Z,{amount:parseFloat(e.lifetime_fees_paid),asset:"1.3.0"}))))}}const Ee=(0,c.Z)(be);var ve=s(80314),ye=s(60567),fe=s(21712);class we extends a.Component{constructor(e){super(e),this.state={referralsIndex:[],referralsCount:null,errorLoading:null}}static propTypes={account:l.Z.ChainAccount.isRequired,gprops:l.Z.ChainObject.isRequired,dprops:l.Z.ChainObject.isRequired,core_asset:l.Z.ChainAsset.isRequired};static defaultProps={gprops:"2.0.0",dprops:"2.1.0",core_asset:"1.3.0"};componentDidMount(){this._getReferrals(0,!0)}componentDidUpdate(e,t){e.account!==this.props.account&&this._getReferrals(0,!0)}async _getReferrals(e=0,t=!1){let{myHiddenAccounts:s,myActiveAccounts:a}=this.props,{referralsIndex:n,referralsCount:i}=this.state;if(0==fe.MU.ES_WRAPPER_LIST.length)return;const o=fe.MU.ES_WRAPPER_LIST[0].url;t&&(i=null,n=[]);try{if(!i){let e=await fetch(o+"/referrer_count?account_id="+this.props.account.get("id"));if(!e.ok)throw new Error("Could not reach referrer_count endpoint on ES wrapper"+o);let t=await e.json();this.setState({referralsCount:t.value})}let t=await fetch(o+"/all_referrers?account_id="+this.props.account.get("id")+"&page="+e);if(!t.ok)throw new Error("Could not reach all_referrers endpoint on ES wrapper"+o);let s=await t.json(),a=[];s.map((e=>{a.push(e.account_id)})),a.forEach((e=>{(0,K.FetchChain)("getAccount",e).then((e=>{let t=(e=e.toJS()).network_fee_percentage/100,s=e.lifetime_referrer_fee_percentage/100,a=(100-t-s)*e.referrer_rewards_percentage/1e4,i=100-a-s-t;n.push({id:e.id,name:e.name,lifetime_ref:{name:e.lifetime_referrer_name,value:s},registrar_ref:{name:e.registrar_name,value:i},affiliate_ref:{name:e.referrer_name,value:a},network:t,statistics:e.statistics,membership_expiration:null}),this.setState({referralsIndex:n})}))}))}catch(e){console.error(e),this.setState({errorLoading:!0})}}onPaginationChange(e){this._getReferrals(e-1)}render(){if(0==fe.MU.ES_WRAPPER_LIST.length)return null;let e=this.props.account.toJS(),t=K.ChainStore.getAccount(e.lifetime_referrer,!1);t&&(e.lifetime_referrer_name=t.get("name"));let s=K.ChainStore.getAccount(e.referrer,!1);s&&(e.referrer_name=s.get("name"));let n=K.ChainStore.getAccount(e.registrar,!1);n&&(e.registrar_name=n.get("name"));let i=this.state.referralsIndex,o=[{key:"name",title:"Name",render:e=>a.createElement("span",null,a.createElement(y.rU,{to:`/account/${e.name}`},e.name))},{key:"statistics",title:a.createElement(w(),{content:"account.member.fees_paid"}),render:e=>a.createElement(Ee,{plainText:!0,stat_object:e.statistics})},{key:"network",title:a.createElement(w(),{content:"account.member.network_percentage"}),render:e=>a.createElement("span",null,e.network,"%")},{key:"lifetime_ref",title:a.createElement(w(),{content:"account.member.lifetime_referrer"}),render:e=>a.createElement("span",null,e.lifetime_ref.value,"% (",a.createElement(y.rU,{to:`/account/${e.lifetime_ref.name}`},e.lifetime_ref.name),")")},{key:"registrar_ref",title:a.createElement(w(),{content:"account.member.registrar"}),render:e=>a.createElement("span",null,e.registrar_ref.value,"% (",a.createElement(y.rU,{to:`/account/${e.registrar_ref.name}`},e.registrar_ref.name),")")},{key:"affiliate_ref",title:a.createElement(w(),{content:"account.member.referrer"}),render:e=>a.createElement("span",null,e.affiliate_ref.value,"% (",a.createElement(y.rU,{to:`/account/${e.affiliate_ref.name}`},e.affiliate_ref.name),")")}];return this.state.errorLoading?a.createElement(w(),{content:"errors.loading_from_es"}):a.createElement(O.Table,{rowKey:"accountReferrals",columns:o,dataSource:i,pagination:{pageSize:Number(20),total:this.state.referralsCount<=this.state.referralsIndex.length?this.state.referralsIndex.length:this.state.referralsIndex.length+20,onChange:this.onPaginationChange.bind(this),showTotal:()=>a.createElement(w(),{content:"account.member.total_ref",total:this.state.referralsCount})}})}}we=(0,c.Z)(we);const ke=we=(0,d.$)(we,{listenTo:()=>[i.Z],getProps:()=>({myActiveAccounts:i.Z.getState().myActiveAccounts,myHiddenAccounts:i.Z.getState().myHiddenAccounts})});class Ce extends a.Component{constructor(e){super(e)}static propTypes={account:l.Z.ChainAccount.isRequired,gprops:l.Z.ChainObject.isRequired,dprops:l.Z.ChainObject.isRequired,core_asset:l.Z.ChainAsset.isRequired};static defaultProps={gprops:"2.0.0",dprops:"2.1.0",core_asset:"1.3.0"};upgradeAccount(e,t,s){s.preventDefault(),n.Z.upgradeAccount(e,t)}UNSAFE_componentWillMount(){p.Z.getFinalFeeAsset(this.props.account,"account_upgrade")}UNSAFE_componentWillReceiveProps(e){e.account!==this.props.account&&this.setState({referralsIndex:[]})}render(){let{gprops:e,dprops:t,core_asset:s}=this.props,n=this.props.account.toJS(),i=K.ChainStore.getAccount(n.lifetime_referrer,!1);i&&(n.lifetime_referrer_name=i.get("name"));let o=K.ChainStore.getAccount(n.referrer,!1);o&&(n.referrer_name=o.get("name"));let r=K.ChainStore.getAccount(n.registrar,!1);r&&(n.registrar_name=r.get("name"));let l=n.name,c=n.network_fee_percentage/100,d=n.lifetime_referrer_fee_percentage/100,p=(100-c-d)*n.referrer_rewards_percentage/1e4,m=100-p-d-c,h=e.getIn(["parameters","current_fees","parameters",8,1,"membership_lifetime_fee"])*e.getIn(["parameters","current_fees","scale"])/1e4,u=K.ChainStore.getAccountMemberStatus(this.props.account),g="account.member."+u,_=null;"annual"===u&&(_=a.createElement("span",null,"(",a.createElement(w(),{content:"account.member.expires"})," ",a.createElement(ve.Z,{time:n.membership_expiration_date}),")"));let b=n.membership_expiration_date;return"1969-12-31T23:59:59"===b?b="Never":"1970-01-01T00:00:00"===b&&(b="N/A"),a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(F.m,{segmented:!1,setting:"membershipTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding"},a.createElement(F.O,{title:"account.member.membership"},a.createElement("h3",null,a.createElement(w(),{content:g})," ",_),a.createElement("div",{className:"content-block no-margin"},a.createElement("div",{className:"no-margin grid-block vertical large-horizontal"},a.createElement("div",{className:"grid-block large-12"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-block"},"lifetime"===u?a.createElement("div",{className:"small-12 large-6",style:{paddingRight:10}},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.lifetime_title"})),a.createElement(w(),{component:"p",content:"account.member.referral_info",feesCashback:100-c}),a.createElement(w(),{component:"h4",content:"account.member.referral_link"}),a.createElement(w(),{component:"p",content:"account.member.referral_text",wallet_name:(0,ye.w)()}),a.createElement("h5",null,(0,ye.dP)()+`/?r=${n.name}`))):a.createElement("div",{className:"small-12 large-6",style:{paddingRight:"10px !important"}},a.createElement(z.Z,{path:"components/AccountMembership",section:"lifetime",feesCashback:100-c,price:{amount:h,asset:s}}),a.createElement("br",null),a.createElement(O.Button,{type:"primary",onClick:this.upgradeAccount.bind(this,n.id,!0)},a.createElement(w(),{content:"account.member.upgrade_lifetime"}))," "," ",null),a.createElement("div",{className:"small-12 large-6"},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.fee_allocation"})),a.createElement("table",{className:"table key-value-table"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",null,a.createElement(w(),{content:"account.member.network_percentage"})),a.createElement("td",null,c,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(w(),{content:"account.member.lifetime_referrer"})," "," (",a.createElement(y.rU,{to:`/account/${n.lifetime_referrer_name}`},n.lifetime_referrer_name),")"),a.createElement("td",null,d,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(w(),{content:"account.member.registrar"})," "," (",a.createElement(y.rU,{to:`/account/${n.registrar_name}`},n.registrar_name),")"),a.createElement("td",null,m,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(w(),{content:"account.member.referrer"})," "," (",a.createElement(y.rU,{to:`/account/${n.referrer_name}`},n.referrer_name),")"),a.createElement("td",null,p,"%")),a.createElement("tr",null,a.createElement("td",null,a.createElement(w(),{content:"account.member.membership_expiration"})," "),a.createElement("td",null,b))))),a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.fees_cashback"})),a.createElement("table",{className:"table key-value-table"},a.createElement(Ee,{stat_object:n.statistics})))))))),a.createElement("div",{className:"grid-block large-12"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-content"},a.createElement("div",{className:"grid-block"},a.createElement("div",{className:"small-12 large-6"},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.fee_pending"})),a.createElement(w(),{component:"p",content:"account.member.fee_pending_text",account:l,maintenanceInterval:e.getIn(["parameters","maintenance_interval"]),nextMaintenanceTime:t.get("next_maintenance_time")})),a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.fee_vesting"})),a.createElement(w(),{component:"p",content:"account.member.fee_vesting_text",account:l,vestingThresholdAmount:e.getIn(["parameters","cashback_vesting_threshold"])/Math.pow(10,s.get("precision")),vestingThresholdAsset:s.get("symbol"),vestingPeriod:e.getIn(["parameters","cashback_vesting_period_seconds"])/60/60/24}))),a.createElement("div",{className:"small-12 large-6"},a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.fee_division"})),a.createElement(w(),{component:"p",content:"account.member.fee_division_text.paragraph_1",account:l,fee_share_network:c,fee_share_ltm:d,fee_share_affiliate:p,fee_share_registrar:m}),a.createElement(w(),{component:"p",content:"account.member.fee_division_text.paragraph_2",account:l,fee_share_network:c,fee_share_ltm:d,fee_share_affiliate:p,fee_share_registrar:m}),a.createElement(y.rU,{to:`/account/${l}/vesting`},a.createElement(w(),{component:"p",content:"account.member.fee_division_text.paragraph_3"})))))))))),"lifetime"==u&&fe.MU.ES_WRAPPER_LIST.length>0?a.createElement("div",{className:"asset-card"},a.createElement("div",{className:"card-divider"},a.createElement(w(),{content:"account.member.ref_distribution"})),a.createElement(ke,{account:l})):null)))))}}const xe=Ce=(0,c.Z)(Ce);var Ae=s(28969),Se=s(55420),Ne=s(99869),Me=s(70981);class Ie extends a.Component{constructor(e){super(e),this.state={vesting_balances:[],searchTerm:"",loading:!1,error:!1},this.onSearch=this.onSearch.bind(this),this.retrieveVestingBalances=this.retrieveVestingBalances.bind(this)}UNSAFE_componentWillMount(){this.retrieveVestingBalances.call(this,this.props.account.get("id"))}componentDidUpdate(e){let t=e.account.get("id"),s=this.props.account.get("id");s!==t&&this.retrieveVestingBalances.call(this,s)}retrieveVestingBalances(e){this.setState({loading:!0}),e=e||this.props.account.get("id"),Se.Apis.instance().db_api().exec("get_vesting_balances",[e]).then((e=>{this.mapVestingBalances(e),this.setState({loading:!1})})).catch((e=>{console.log("error:",e),this.setState({loading:!1,error:!0})}))}mapVestingBalances(e){if(!e)return null;let t=e.filter((e=>e.balance.amount&&e.balance.asset_id));t=t.map((e=>{let t,s,a=0,n=0,i=0,o=0,r=!0,l=!0;if(e)if(s=e.balance.amount,t=K.ChainStore.getAsset(e.balance.asset_id),e.policy&&2!==e.policy[0]){let c=Math.floor(new Date(e.policy[1].start_claim+"Z").getTime()/1e3),d=Math.floor((new Date).getTime()/1e3);if(c>0){r=!1;let t=d-c,s=e.policy[1].vesting_seconds;t<s?(l=!1,n=parseFloat(t/86400).toFixed(2),i=parseFloat(s/86400).toFixed(2),o=(i-n).toFixed(2),a=0):a=1}else{let r=Math.floor(new Date(e.policy[1].coin_seconds_earned_last_update+"Z").getTime()/1e3),l=parseFloat(e.policy[1].coin_seconds_earned)+s*(d-r),c=e.policy[1].vesting_seconds;a=0===c?1:l/(c*s),a=a>1?1:a,n=S.Z.format_number(S.Z.get_asset_amount(l/86400,t),0),i=S.Z.format_number(S.Z.get_asset_amount(e.balance.amount*c/86400,t),0),o=S.Z.format_number(c*(1-a)/86400||0,2)}}else l&&(a=1);return{key:e.id,vestingId:e.id,vestingType:e.balance_type,vestingBalance:{amount:e.balance.amount,asset:e.balance.asset_id},coinDaysRequired:{days_required:i,isCoinDays:r},coinDaysEarned:{days_earned:n,isCoinDays:r},coinDaysRemaining:{days_remaining:o,isCoinDays:r},availablePercent:a,canClaim:l,vb:e}})),this.setState({vesting_balances:t})}getHeader(){return[{title:"#",dataIndex:"vestingId",align:"left",defaultSortOrder:"ascend",sorter:(e,t)=>e.vestingId>t.vestingId?1:e.vestingId<t.vestingId?-1:0},{title:a.createElement(w(),{content:"account.member.balance_type"}),dataIndex:"vestingType",align:"left",sorter:(e,t)=>e.vestingType>t.vestingType?1:e.vestingType<t.vestingType?-1:0,render:e=>a.createElement("span",null,a.createElement(w(),{content:"account.vesting.type."+e}))},{title:a.createElement(w(),{content:"account.member.cashback"}),dataIndex:"vestingBalance",align:"left",render:e=>a.createElement(x.Z,{amount:e.amount,asset:e.asset})},{title:a.createElement(w(),{content:"account.member.required"}),dataIndex:"coinDaysRequired",align:"left",render:e=>e.days_required?a.createElement("span",null,e.days_required," ",a.createElement(w(),{content:e.isCoinDays?"account.member.coindays":"account.member.days"})):null},{title:a.createElement(w(),{content:"account.member.earned"}),dataIndex:"coinDaysEarned",align:"left",render:e=>e.days_earned?a.createElement("span",null,e.days_earned," ",a.createElement(w(),{content:e.isCoinDays?"account.member.coindays":"account.member.days"})):null},{title:a.createElement(w(),{content:"account.member.remaining"}),dataIndex:"coinDaysRemaining",align:"left",render:e=>e.days_remaining?a.createElement("span",null,e.days_remaining," ",a.createElement(w(),{content:"account.member.days"})):null},{title:a.createElement(w(),{content:"account.member.available"}),dataIndex:"availablePercent",align:"left",render:e=>e?a.createElement("span",null,(100*e).toFixed(2),"%"):null},{title:a.createElement(w(),{content:"account.member.action"}),align:"center",render:e=>e.canClaim?a.createElement(O.Button,{onClick:()=>this.onClaim(e),type:"secondary"},a.createElement(w(),{content:"account.member.claim"})):null}]}onClaim({vb:e}){const t=this.props.account.get("id");Ae.Z.claimVestingBalance(t,e,!1).then((()=>{this.retrieveVestingBalances()}))}onSearch(e){this.setState({searchTerm:e.target.value||""})}render(){const e=this.getHeader();let t=this.state.vesting_balances.filter((e=>-1!==`${e.vestingId}\0${e.vestingType}`.toUpperCase().indexOf(this.state.searchTerm.toUpperCase())));return a.createElement("div",{className:"grid-content vertical"},a.createElement(w(),{component:"h1",content:"account.vesting.title"}),a.createElement(w(),{content:"account.vesting.explain",component:"p"}),a.createElement(y.rU,{to:`/account/${this.props.account.get("name")}/member-stats`},a.createElement(w(),{content:"icons.text.membership_stats"})),a.createElement("div",{className:"header-selector padding"},a.createElement(Me.Z,{onChange:this.onSearch.bind(this),value:this.state.searchTerm,autoComplete:"off",placeholder:M().translate("exchange.filter")}),this.state.error&&a.createElement(w(),{className:"header-selector--error",content:"errors.loading_from_blockchain"})),a.createElement("div",null,a.createElement(Ne.Z,{loading:this.state.loading,rows:t,header:e,pageSize:10})))}}const Ze=Ie;var Pe=s(98817),Oe=s(50379),Be=s(56934),Te=s(41075),Re=s(79618),Le=s(79361),De=s.n(Le);class Fe extends a.Component{constructor(e){super(e),this.state=this._getInitialState(),this.onPasswordEnter=this.onPasswordEnter.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onCancel=this.onCancel.bind(this),this.onClose=this.onClose.bind(this)}_getInitialState(){return{isShowQrcode:!1,keyString:null}}onCancel(){this.props.hideModal(),this.onClose()}onClose(){this.refs.password_input&&(this.refs.password_input.value=""),this.setState(this._getInitialState())}onPasswordEnter(e){e.preventDefault();let t=this.refs.password_input.value,s=this.props.keyValue;if(null!=t&&""!=t){if(void 0!==s&&null!=s&&""!=s){let e=K.Aes.fromSeed(t).encryptToHex(s);this.setState({isShowQrcode:!0,keyString:e})}}else this.setState({isShowQrcode:!0,keyString:s})}onKeyDown(e){13===e.keyCode&&this.onPasswordEnter(e)}render(){let e=null;this.state.isShowQrcode&&(e={textAlign:"center"});const t=[];return this.state.isShowQrcode||t.push(a.createElement(O.Button,{type:"primary",key:"submit",onClick:this.onPasswordEnter},M().translate("modal.ok"))),t.push(a.createElement(O.Button,{key:"cancel",onClick:this.onCancel},M().translate("cancel"))),a.createElement(O.Modal,{visible:this.props.visible,onCancel:this.onCancel,footer:t},a.createElement("div",{className:"text-center"},a.createElement("div",{style:{margin:"1.5rem 0"}},a.createElement(w(),{component:"h4",content:"modal.qrcode.title"})),a.createElement("form",{className:"full-width",style:{margin:"0 3.5rem"},onSubmit:this.onPasswordEnter,noValidate:!0},a.createElement("div",{className:"form-group"},this.state.isShowQrcode?a.createElement("section",{style:e},a.createElement("span",{style:{background:"#fff",padding:".75rem",display:"inline-block"}},a.createElement(De(),{size:256,value:this.state.keyString}))):a.createElement("section",null,a.createElement("label",{className:"left-label"},a.createElement(w(),{unsafe:!0,content:"modal.qrcode.input_message"})),a.createElement("input",{name:"password",type:"text",onFocus:()=>{this.refs.password_input.setAttribute("type","password")},ref:"password_input",autoComplete:"off",onKeyDown:this.onKeyDown}))))))}}Fe.propTypes={modalId:v().string.isRequired,keyValue:v().string},Fe.defaultProps={modalId:"qr_code_password_modal"};const Ve=Fe;class qe extends a.Component{static propTypes={pubkey:v().string.isRequired};constructor(){super(),this.state=this._getInitialState(),this.showModal=this.showModal.bind(this),this.hideModal=this.hideModal.bind(this),this.showQrModal=this.showQrModal.bind(this),this.hideQrModal=this.hideQrModal.bind(this),this.onClose=this.onClose.bind(this)}_getInitialState(){return{isModalVisible:!1,isQrModalVisible:!1,wif:null}}reset(){this.setState(this._getInitialState())}hideModal(){this.setState({isModalVisible:!1})}showModal(){this.setState({isModalVisible:!0})}hideQrModal(){this.setState({isQrModalVisible:!1})}showQrModal(){this.setState({isQrModalVisible:!0})}render(){var e="key_view_modal"+this.props.pubkey,t=Re.Z.getState().keys;if(!t.has(this.props.pubkey))return a.createElement("span",null,this.props.children);var s=t.get(this.props.pubkey);const n=[a.createElement(O.Button,{key:"cancel",onClick:this.onClose},M().translate("transfer.close"))];return a.createElement("span",null,a.createElement("a",{onClick:this.onOpen.bind(this)},this.props.children),a.createElement(O.Modal,{visible:this.state.isModalVisible,title:M().translate("account.perm.key_viewer"),ref:e,id:e,onCancel:this.onClose,footer:n},a.createElement("div",{className:"grid-block vertical"},a.createElement("div",{className:"content-block"},a.createElement("div",{className:"grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.perm.public"})),this.props.pubkey),a.createElement("br",null),a.createElement("div",{className:"grid-block grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.perm.private"})),a.createElement("div",null,this.state.wif?a.createElement("span",null,a.createElement("p",{style:{fontWeight:600}},this.state.wif),a.createElement("div",{className:"button-group"},a.createElement("div",{className:"button",onClick:this.onHide.bind(this)},"hide"),a.createElement("div",{className:"clickable",onClick:this.showQrModal},a.createElement("img",{style:{height:50},src:"data:image/png;base64,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"})))):a.createElement("span",null,a.createElement("div",{className:"button",onClick:this.onShow.bind(this)},a.createElement(w(),{content:"account.perm.show"}))))),a.createElement("br",null),a.createElement("div",{className:"grid-block grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.perm.brain"})),null==s.brainkey_sequence?"Non-deterministic":s.brainkey_sequence),a.createElement("br",null),s.import_account_names&&s.import_account_names.length?a.createElement("div",{className:"grid-block grid-content"},a.createElement("label",null,a.createElement(w(),{content:"account.perm.from"})),s.import_account_names.join(", "),a.createElement("br",null)):null))),a.createElement(Ve,{showModal:this.showQrModal,hideModal:this.hideQrModal,visible:this.state.isQrModalVisible,keyValue:this.state.wif}))}onOpen(){this.showModal()}onClose(){this.reset(),this.hideModal()}onShow(){Be.Z.unlock().then((()=>{var e=Te.Z.getPrivateKey(this.props.pubkey);this.setState({wif:e.toWif()})})).catch((()=>{}))}onHide(){this.setState({wif:null})}}var Ue=s(71452);class je extends a.Component{static propTypes={account:v().object,pubkey:v().string,address:v().string,onRemoveItem:v().func.isRequired,weights:v().object};shouldComponentUpdate(e){return!S.Z.are_equal_shallow(e,this.props)}_lookUpPubKeyForAddress(e){return Ue.Z.getState().addresses.get(e)}render(){let e,t,s,n="_accounts",i=this.props.pubkey;const o=Re.Z.getState().keys;let r=!1;return this.props.account?(e=this.props.account.get("name"),t=this.props.account.get("id"),s=a.createElement(y.rU,{to:`/account/${e}/permissions`},e)):i?(e=t=i,s=a.createElement(qe,{pubkey:i},i),n="_keys",r=o.has(i)):this.props.address&&(i=this._lookUpPubKeyForAddress(this.props.address),t=this.props.address,s=i?a.createElement(qe,{pubkey:i},i):this.props.address,n="_addresses",r=o.has(i)),a.createElement("tr",{key:e},a.createElement("td",null,this.props.account?a.createElement(Oe.Z,{size:{height:30,width:30},account:e}):i?a.createElement("div",{className:"account-image"},a.createElement(qe,{pubkey:i},a.createElement(V.Z,{name:"key",title:"icons.key",size:"4x"}))):null),a.createElement("td",{className:(r?"my-key":"")+" pub-key"},s),a.createElement("td",null,this.props.weights[t]),a.createElement("td",null,a.createElement("button",{className:"button",onClick:this.props.onRemoveItem.bind(this,t,n)},a.createElement(w(),{content:"account.votes.remove_witness"}))))}}class We extends a.Component{static propTypes={accounts:l.Z.ChainObjectsList,onAddItem:v().func.isRequired,onRemoveItem:v().func.isRequired,validateAccount:v().func,label:v().string.isRequired,placeholder:v().string,tabIndex:v().number,weights:v().object};constructor(e){super(e),this.state={selected_item:null,item_name_input:"",weight_input:"",error:null},this.onItemChange=this.onItemChange.bind(this),this.onItemAccountChange=this.onItemAccountChange.bind(this),this.onAddItem=this.onAddItem.bind(this)}onItemChange(e){this.setState({item_name_input:e})}onItemAccountChange(e){if(this.setState({selected_item:e,error:null}),e&&this.props.validateAccount){let t=this.props.validateAccount(e);if(null===t)return;"string"==typeof t?this.setState({error:t}):t.then((e=>this.setState({error:e})))}}onWeightChanged(e){let t=e.target.value.trim();this.setState({weight_input:parseInt(t)})}onAddItem(e){if(!e)return;this.setState({selected_item:null,item_name_input:"",weight_input:"",error:null});let t="string"==typeof e?e:e.get("id");this.props.onAddItem(t,this.state.weight_input)}onWeightKeyDown(e){13===e.keyCode&&this.state.weight_input&&this.state.selected_item&&this.onAddItem(this.state.selected_item)}render(){var e=0;let t=this.props.accounts.filter((e=>!!e)).sort(((e,t)=>e.get("name")>t.get("name")?1:e.get("name")<t.get("name")?-1:0)).map((t=>a.createElement(je,{key:e++,account:t,weights:this.props.weights,onRemoveItem:this.props.onRemoveItem}))),s=this.props.keys.map((t=>a.createElement(je,{key:e++,pubkey:t,weights:this.props.weights,onRemoveItem:this.props.onRemoveItem}))),n=this.props.addresses.map((t=>a.createElement(je,{key:e++,address:t,weights:this.props.weights,onRemoveItem:this.props.onRemoveItem}))),i=this.state.error;!i&&this.state.selected_item&&-1!==this.props.accounts.indexOf(this.state.selected_item)&&(i=M().translate("account.perm.warning3")),!i&&this.state.item_name_input&&-1!==this.props.keys.indexOf(this.state.item_name_input)&&(i=M().translate("account.perm.warning4"));let o=["10%","70%","30%","10%"];return a.createElement("div",null,a.createElement(Z.Z,{label:this.props.label,error:i,placeholder:this.props.placeholder,account:this.state.item_name_input,accountName:this.state.item_name_input,onChange:this.onItemChange,onAccountChanged:this.onItemAccountChange,onAction:this.onAddItem,action_label:"account.votes.add_witness",tabIndex:this.props.tabIndex,allowPubKey:!0,disableActionButton:!this.state.weight_input,allowUppercase:!0},a.createElement("input",{value:this.state.weight_input,onChange:this.onWeightChanged.bind(this),className:"weight-input",type:"number",autoComplete:"off",placeholder:M().translate("account.perm.weight"),onKeyDown:this.onWeightKeyDown.bind(this),tabIndex:this.props.tabIndex+1})),a.createElement("div",{style:{paddingTop:"2rem"}},a.createElement("table",{className:"table"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:{width:o[0]}}),a.createElement("th",{style:{width:o[1]}},a.createElement(w(),{content:"account.perm.acct_or_key"})),a.createElement("th",{style:{width:o[2]}},a.createElement(w(),{content:"account.perm.weight"})),a.createElement("th",{style:{width:o[3]}},a.createElement(w(),{content:"account.perm.action"})))),a.createElement("tbody",null,t,s,n))))}}const ze=(0,c.Z)(We,{autosubscribe:!1});var Ke=s(81082);class Je extends a.Component{constructor(){super(),this.state={validPassword:!1,pass:null,generatedPassword:"P"+K.key.get_random_key().toWif().toString()}}onSubmit(){}onPasswordChange(e){let{valid:t}=e,s=this.props.account.get("name");const a=t?Te.Z.generateKeyFromPassword(s,"active",e.value).pubKey:null,n=t?Te.Z.generateKeyFromPassword(s,"owner",e.value).pubKey:null,i=t?Te.Z.generateKeyFromPassword(s,"memo",e.value).pubKey:null;this.setState({validPassword:e.valid,pass:e.value}),this.props.onSetPasswordKeys({active:a,owner:n,memo:i})}checkKeyUse(e,t){return!!e&&("memo"===t?e===this.props.memoKey:this.props[`${t}Keys`].reduce(((t,s)=>s===e||t),!1))}_onUseKey(e,t=!1){if(t)this.props["active"===e?"onRemoveActive":"onRemoveOwner"](this.props[e],"_keys");else if(this.props[e]){const t={active:this.props.account.getIn(["active","weight_threshold"]),owner:this.props.account.getIn(["owner","weight_threshold"])};console.log("key",this.props[e],"weights",t,"weight of role:",t[e]),this.props["active"===e?"onAddActive":"owner"===e?"onAddOwner":"onSetMemo"](this.props[e],t[e])}}render(){let e=this.checkKeyUse(this.props.active&&this.props.active,"active"),t=this.checkKeyUse(this.props.owner&&this.props.owner,"owner"),s=this.checkKeyUse(this.props.memo&&this.props.memo,"memo"),n=M().translate("account.perm.use_text"),i=M().translate("account.perm.remove_text");return a.createElement("div",null,a.createElement("p",{style:{maxWidth:"800px"}},a.createElement(w(),{content:"account.perm.password_model_1"})),a.createElement("p",{style:{maxWidth:"800px"}},a.createElement(w(),{content:"wallet.password_model_1"})),a.createElement("p",{style:{maxWidth:"800px"}},a.createElement(w(),{unsafe:!0,content:"wallet.password_model_2"})),a.createElement("div",{className:"divider"}),a.createElement("form",{style:{maxWidth:"40rem"},onSubmit:this.onSubmit.bind(this),noValidate:!0},a.createElement("label",{className:"left-label"},a.createElement(w(),{content:"wallet.generated"})),a.createElement("p",null,this.state.generatedPassword),a.createElement("p",{style:{fontWeight:"bold"}},a.createElement(w(),{content:"account.perm.password_model_2"})),a.createElement(Ke.Z,{ref:"password",confirmation:!0,onChange:this.onPasswordChange.bind(this),noLabel:!0,passwordLength:12,checkStrength:!0})),a.createElement("table",{className:"table"},a.createElement("tbody",null,a.createElement("tr",{className:e?"in-use":""},a.createElement("td",null,a.createElement(w(),{content:"account.perm.new_active"}),":"),a.createElement("td",null,this.props.active),a.createElement("td",{className:"text-right"},a.createElement("div",{className:"button",onClick:this._onUseKey.bind(this,"active",e)},e?i:n))),a.createElement("tr",{className:t?"in-use":""},a.createElement("td",null,a.createElement(w(),{content:"account.perm.new_owner"}),":"),a.createElement("td",null,this.props.owner),a.createElement("td",{className:"text-right"},a.createElement("div",{className:"button",onClick:this._onUseKey.bind(this,"owner",t)},t?i:n))),a.createElement("tr",{className:s?"in-use":""},a.createElement("td",null,a.createElement(w(),{content:"account.perm.new_memo"}),":"),a.createElement("td",null,this.props.memo),a.createElement("td",{className:"text-right"},a.createElement("div",{className:"button",style:{visibility:s?"hidden":""},onClick:this._onUseKey.bind(this,"memo",s)},n))))),s?a.createElement("p",{style:{maxWidth:"800px",paddingTop:10},className:"has-error"},a.createElement(w(),{content:"account.perm.memo_warning"})):null)}}class Ge extends a.Component{static propTypes={label:v().string.isRequired,value:v().string,error:v().string,placeholder:v().string,onChange:v().func,onAction:v().func,tabIndex:v().number,disableActionButton:v().bool};constructor(e){super(e)}isValidPubKey(e){return!!K.PublicKey.fromPublicKeyString(e)}onInputChanged(e){let t=e.target.value.trim();this.props.onChange(t)}onKeyDown(e){13===e.keyCode&&this.onAction(e)}onAction(e){e.preventDefault(),this.props.onAction&&this.state.valid&&!this.props.disableActionButton&&this.props.onAction(e)}render(){let e=this.props.error;e||!this.props.value||this.isValidPubKey(this.props.value)||(e="Not a valid public key");let t=W()("button",{disabled:e||this.props.disableActionButton});const s=Re.Z.getState().keys,n=this.isValidPubKey(this.props.value)&&s.has(this.props.value);return a.createElement("div",{className:"pubkey-input no-overflow"},a.createElement("div",{className:"content-area"},a.createElement("div",{className:"header-area"},!e&&this.props.value&&this.isValidPubKey(this.props.value)?a.createElement("label",{className:"right-label"},a.createElement(w(),{content:"account.perm.valid_pub"})):null,a.createElement(w(),{className:"left-label",component:"label",content:this.props.label})),a.createElement("div",{className:"input-area"},a.createElement("span",{className:"inline-label"},a.createElement("div",{className:"account-image"},a.createElement(qe,{pubkey:this.props.value},a.createElement(V.Z,{name:"key",title:"icons.key",size:"4x"}))),a.createElement("input",{type:"text",className:n?"my-key":"",value:this.props.value,placeholder:this.props.placeholder||counterpart.translate("account.public_key"),ref:"user_input",onChange:this.onInputChanged.bind(this),onKeyDown:this.onKeyDown.bind(this),tabIndex:this.props.tabIndex}),this.props.onAction?a.createElement("button",{className:t,onClick:this.onAction.bind(this)},a.createElement(w(),{content:this.props.action_label})):null)),a.createElement("div",{className:"error-area has-error"},a.createElement("span",null,e))))}}const He=Ge;var Qe=s(32049);class Xe extends a.Component{constructor(e){super(e),this.state={},this.onPublish=this.onPublish.bind(this),this.onReset=this.onReset.bind(this)}UNSAFE_componentWillMount(){this.updateAccountData(this.props.account),p.Z.getFinalFeeAsset(this.props.account,"account_update")}UNSAFE_componentWillReceiveProps(e){e.account!==this.props.account&&this.updateAccountData(e.account)}permissionsFromImmutableObj(e){let t=e.get("weight_threshold"),s=e.get("account_auths"),a=e.get("key_auths"),n=e.get("address_auths"),i=s.map((e=>e.get(0))),o=a.map((e=>e.get(0))),r=n.map((e=>e.get(0))),l=s.reduce(((e,t)=>(e[t.get(0)]=t.get(1),e)),{});return l=a.reduce(((e,t)=>(e[t.get(0)]=t.get(1),e)),l),l=n.reduce(((e,t)=>(e[t.get(0)]=t.get(1),e)),l),{threshold:t,accounts:i,keys:o,addresses:r,weights:l}}permissionsToJson(e,t,s,a,n){let i={weight_threshold:e};return i.account_auths=t.sort(S.Z.sortID).map((e=>[e,n[e]])).toJS(),i.key_auths=s.sort(S.Z.sortID).map((e=>[e,n[e]])).toJS(),i.address_auths=a.sort(S.Z.sortID).map((e=>[e,n[e]])).toJS(),i}updateAccountData(e){let t=this.permissionsFromImmutableObj(e.get("active")),s=this.permissionsFromImmutableObj(e.get("owner")),a=e.get("options").get("memo_key"),n={active_accounts:t.accounts,active_keys:t.keys,active_addresses:t.addresses,owner_accounts:s.accounts,owner_keys:s.keys,owner_addresses:s.addresses,active_weights:t.weights,owner_weights:s.weights,active_threshold:t.threshold,owner_threshold:s.threshold,memo_key:a,prev_active_accounts:t.accounts,prev_active_keys:t.keys,prev_active_addresses:t.addresses,prev_owner_accounts:s.accounts,prev_owner_keys:s.keys,prev_owner_addresses:s.addresses,prev_active_weights:t.weights,prev_owner_weights:s.weights,prev_active_threshold:t.threshold,prev_owner_threshold:s.threshold,prev_memo_key:a};this.setState(n)}isChanged(){let e=this.state;return e.active_accounts!==e.prev_active_accounts||e.active_keys!==e.prev_active_keys||e.active_addresses!==e.prev_active_addresses||e.owner_accounts!==e.prev_owner_accounts||e.owner_keys!==e.prev_owner_keys||e.owner_addresses!==e.prev_owner_addresses||e.active_threshold!==e.prev_active_threshold||e.owner_threshold!==e.prev_owner_threshold||e.memo_key!==e.prev_memo_key}didChange(e,t=this.state){if("memo"===e)return t.memo_key!==t.prev_memo_key;let s=!1;return["_keys","_active_addresses","_accounts","_threshold"].forEach((a=>{let n=e+a;t[n]!==t["prev_"+n]&&(s=!0)})),s}onPublish(){let e=this.state,t=this.props.account.toJS();t.fee={amount:0,asset_id:p.Z.getFinalFeeAsset(t.id,"account_update")};let s={account:t.id};if(this.didChange("active")&&(s.active=this.permissionsToJson(e.active_threshold,e.active_accounts,e.active_keys,e.active_addresses,e.active_weights)),this.didChange("owner")&&(s.owner=this.permissionsToJson(e.owner_threshold,e.owner_accounts,e.owner_keys,e.owner_addresses,e.owner_weights)),this.didChange("owner")&&0===e.owner_keys.size&&0===e.owner_addresses.size&&1===e.owner_accounts.size&&e.owner_accounts.first()===t.id)return O.Notification.warning({message:M().translate("notifications.account_permissions_update_warning")});e.memo_key&&this.didChange("memo")&&this.isValidPubKey(e.memo_key)&&(s.new_options=this.props.account.get("options").toJS(),s.new_options.memo_key=e.memo_key),I.Z.updateAccount(s)}isValidPubKey(e){return!!K.PublicKey.fromPublicKeyString(e)}onReset(){let e=this.state;this.setState({active_accounts:e.prev_active_accounts,active_keys:e.prev_active_keys,active_addresses:e.prev_active_addresses,owner_accounts:e.prev_owner_accounts,owner_keys:e.prev_owner_keys,owner_addresses:e.prev_owner_addresses,active_weights:e.prev_active_weights,owner_weights:e.prev_owner_weights,active_threshold:e.prev_active_threshold,owner_threshold:e.prev_owner_threshold,memo_key:e.prev_memo_key})}onAddItem(e,t,s){let a={},n=e+(S.Z.is_object_id(t)?"_accounts":"_keys");a[n]=this.state[n].push(t),this.state[e+"_weights"][t]=s,this.setState(a)}onRemoveItem(e,t,s){console.log("onRemoveItem",e,t,s);let a={},n=e+s;a[n]=this.state[n].filter((e=>e!==t)),this.setState(a)}onThresholdChanged(e,t){let s=parseInt(t.target.value.trim()),a={};a[e]=s,this.setState(a)}validateAccount(e,t){return null}sumUpWeights(e,t,s,a){let n=e.reduce(((e,t)=>e+a[t]),0);return n=t.reduce(((e,t)=>e+a[t]),n),s.reduce(((e,t)=>e+a[t]),n)}onMemoKeyChanged(e){this.setState({memo_key:e})}onSetPasswordKeys(e,t=["active","owner","memo"]){let s={};t.forEach((t=>{s[`password_${t}`]=e[t]})),this.setState(s)}onPdfCreate(){(0,Pe.$)(this.props.account)}render(){let e,t,{active_accounts:s,active_keys:n,active_addresses:i,active_weights:o}=this.state,{owner_accounts:r,owner_keys:l,owner_addresses:c,owner_weights:d}=this.state,p=this.state.active_threshold>0?this.state.active_threshold:0,m=this.sumUpWeights(s,n,i,o);this.didChange("active")&&m<p&&(e=M().translate("account.perm.warning1",{weights_total:m,threshold:p})),p=this.state.owner_threshold>0?this.state.owner_threshold:0,m=this.sumUpWeights(r,l,c,d),this.didChange("owner")&&m<p&&(t=M().translate("account.perm.warning2",{weights_total:m,threshold:p}));let u="button"+(!e&&!t&&this.isChanged()&&this.isValidPubKey(this.state.memo_key)?"":" disabled"),g="button"+(this.isChanged()?"":" disabled"),_=h().Set();return _=_.add(this.props.account.get("id")),a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(F.m,{defaultActiveTab:1,segmented:!1,setting:"permissionsTab",className:"account-tabs",tabsClass:"account-overview bordered-header content-block",contentClass:"padding",actionButtons:a.createElement("div",{className:"action-buttons"},a.createElement("button",{className:g,onClick:this.onReset,tabIndex:8},a.createElement(w(),{content:"account.perm.reset"})),a.createElement("button",{className:u,onClick:this.onPublish,tabIndex:9},a.createElement(w(),{content:"account.perm.publish"})),a.createElement("button",{className:"button",style:{marginLeft:10},"data-tip":M().translate("account.perm.create_paperwallet_private_hint"),onClick:()=>{this.onPdfCreate()},tabIndex:10},a.createElement(w(),{content:"account.perm.create_paperwallet"})))},a.createElement(F.O,{title:"account.perm.active"},a.createElement(z.Z,{path:"components/AccountPermActive"}),a.createElement("form",{className:"threshold"},a.createElement("label",{className:"horizontal"},a.createElement(w(),{content:"account.perm.threshold"})," "," ",a.createElement("input",{type:"number",placeholder:"0",size:"5",value:this.state.active_threshold,onChange:this.onThresholdChanged.bind(this,"active_threshold"),autoComplete:"off",tabIndex:1}))),a.createElement(ze,{label:"account.perm.add_permission_label",accounts:s,keys:n,weights:o,addresses:i,validateAccount:this.validateAccount.bind(this,"active"),onAddItem:this.onAddItem.bind(this,"active"),onRemoveItem:this.onRemoveItem.bind(this,"active"),placeholder:M().translate("account.perm.account_name_or_key"),tabIndex:2}),a.createElement("br",null),e?a.createElement("div",{className:"content-block has-error"},e):null),a.createElement(F.O,{title:"account.perm.owner"},a.createElement(z.Z,{path:"components/AccountPermOwner"}),a.createElement("form",{className:"threshold"},a.createElement("label",{className:"horizontal"},a.createElement(w(),{content:"account.perm.threshold"})," "," ",a.createElement("input",{type:"number",placeholder:"0",size:"5",value:this.state.owner_threshold,onChange:this.onThresholdChanged.bind(this,"owner_threshold"),autoComplete:"off",tabIndex:4}))),a.createElement(ze,{label:"account.perm.add_permission_label",accounts:r,keys:l,weights:d,addresses:c,validateAccount:this.validateAccount.bind(this,"owner"),onAddItem:this.onAddItem.bind(this,"owner"),onRemoveItem:this.onRemoveItem.bind(this,"owner"),placeholder:M().translate("account.perm.account_name_or_key"),tabIndex:5}),a.createElement("br",null),t?a.createElement("div",{className:"content-block has-error"},t):null),a.createElement(F.O,{title:"account.perm.memo_key"},a.createElement(z.Z,{style:{maxWidth:"800px"},path:"components/AccountPermMemo"}),a.createElement(He,{ref:"memo_key",value:this.state.memo_key,label:"account.perm.memo_public_key",placeholder:"Public Key",onChange:this.onMemoKeyChanged.bind(this),tabIndex:7})),a.createElement(F.O,{title:"account.perm.password_model"},a.createElement(Je,{active:this.state.password_active,owner:this.state.password_owner,memo:this.state.password_memo,onSetPasswordKeys:this.onSetPasswordKeys.bind(this),account:this.props.account,activeKeys:this.state.active_keys,ownerKeys:this.state.owner_keys,memoKey:this.state.memo_key,onAddActive:this.onAddItem.bind(this,"active"),onRemoveActive:this.onRemoveItem.bind(this,"active"),onAddOwner:this.onAddItem.bind(this,"owner"),onRemoveOwner:this.onRemoveItem.bind(this,"owner"),onSetMemo:this.onMemoKeyChanged.bind(this)}))),a.createElement("div",{className:"tab-content",style:{padding:10}},a.createElement("div",{className:"divider"}),a.createElement(Qe.t,{accountsList:_,limit:25,compactView:!1,filter:"account_update",style:{paddingBottom:"2rem"}})))))}}const Ye=Xe;var $e=s(57296);const et="-----BEGIN BITSHARES SIGNED MESSAGE-----",tt="-----BEGIN META-----",st="-----BEGIN SIGNATURE-----",at="-----END BITSHARES SIGNED MESSAGE-----",nt=$e.Z.createActions(class{parseMessage(e){let t,s,a,n,i,o,r,l;try{t=e.split(et)[1],s=t.split(tt),t=s[0].replace(/^\n|\n$/g,""),a=s[1].split(st),s=a[0].trim(),a=a[1].split(at)[0].trim(),n=t+"\n"+s}catch(e){throw new Error(M().translate("account.signedmessages.invalidformat"))}if(s)try{i=s.split("account="),i=i[1].split("\n")[0].trim(),o=s.split("memokey="),o=o[1].split("\n")[0].trim(),r=s.split("block="),r=r[1].split("\n")[0].trim(),l=s.split("timestamp="),l=l[1].split("\n")[0].trim()}catch(e){throw new Error(M().translate("account.signedmessages.invalidformat"))}return{content:t,meta:{account:i,key:o,block:r,timestamp:l},signed:n,signature:a}}verifyMemo(e){let t;if(t="string"==typeof e||e instanceof String?this.parseMessage(e):e,null==K.ChainStore.getAccount(t.meta.account))throw new Error(M().translate("account.signedmessages.invaliduser"));let s=!1;try{s=K.Signature.fromHex(t.signature).verifyBuffer(t.signed,K.PublicKey.fromPublicKeyString(t.meta.key))}catch(e){throw new Error(M().translate("account.signedmessages.errorverifying"))}if(!s)throw new Error(M().translate("account.signedmessages.invalidsignature"));return t}signMessage(e,t){return new Promise(((s,a)=>{Be.Z.unlock().then((()=>{try{let n,i=e.get("options").get("memo_key");if(/111111111111111111111/.test(i)&&(i=null),t&&i&&(n=Te.Z.getPrivateKey(i),!n))throw new Error(M().translate("account.signedmessages.invalidkey"));let o=K.ChainStore.getObject("2.1.0").get("last_irreversible_block_num"),r=new Date,l="account="+e.get("name")+"\nmemokey="+i+"\nblock="+o+"\ntimestamp="+r.toUTCString(),c=t+"\n"+l;setTimeout((()=>{try{let e=K.Signature.signBuffer(c,n,i),a=et+"\n"+t+"\n"+tt+"\n"+l+"\n"+st+"\n"+e.toHex()+"\n"+at;s(a)}catch(e){a(e)}}),0)}catch(e){a(e)}})).catch((e=>{a(e)}))}))}});class it extends a.Component{static defaultProps={noVerification:!1};constructor(e){super(e),this.state={message:this.props.message,messageParsed:null,showRawMessage:!1,noVerification:this.props.noVerification,verified:null,notification:null}}_verifyMessage(e){this.setState({message:e,messageParsed:null,verified:null});let t=null;try{t=nt.parseMessage(e),this.setState({verified:null,messageParsed:t}),this.state.noVerification||(this.setState({verified:null,notification:M().translate("account.signedmessages.verifying")}),setTimeout((()=>{try{nt.verifyMemo(t),this.setState({verified:!0,notification:""})}catch(e){this._warning(e.message),this.setState({verified:!1})}}),0))}catch(e){this._warning(e.message)}}UNSAFE_componentWillMount(){this._verifyMessage(this.state.message)}UNSAFE_componentWillReceiveProps(e){let t=e.message;null!=t&&null!=t&&t==this.state.message||this._verifyMessage(t)}_warning(e){this.setState({notification:e})}_toggleRawMessage(){this.setState({showRawMessage:!this.state.showRawMessage})}render(){let e,t;null!=this.state.messageParsed&&(null==this.state.verified?(t="#FFF",e="Unverified message from "+this.state.messageParsed.meta.account):this.state.verified?(t="#FFF",e="Verified message from "+this.state.messageParsed.meta.account):(t="#F00",e="Refuted message, indicated sender "+this.state.messageParsed.meta.account));let s=null!=this.props.message&&""!=this.props.message,n=this.state.notification&&""!=this.state.notification;return a.createElement("div",{style:{color:"gray",margin:"10px 10px"}},null!=this.state.messageParsed&&a.createElement("fieldset",{style:{borderColor:t}},a.createElement("legend",{style:{color:"white",weight:"bold"}},e),a.createElement("pre",{style:{position:"relative",width:"100%",display:"table"}},this.state.messageParsed.content,n&&a.createElement("div",{style:{textAlign:"center",display:"table-cell",verticalAlign:"middle",position:"absolute",width:"calc(100% - 30px)",height:"calc(100% + 15px)",top:"0px",right:"30px",backgroundColor:"rgba(50,50,50,0.5)"},id:"overlay"},this.state.notification)),a.createElement("span",{style:{fontSize:"small",float:"right"}},"Signed on ",this.state.messageParsed.meta.timestamp," "," ",a.createElement("button",{className:"button",type:"button",style:{fontSize:"small",float:"right",padding:"0px 0px",background:"#777"},onClick:this._toggleRawMessage.bind(this)},"🔍")),this.state.showRawMessage&&a.createElement("br",null),this.state.showRawMessage&&a.createElement("br",null),this.state.showRawMessage&&a.createElement("div",{style:{overflow:"auto",width:"calc(100%)",maxWidth:"1000px"}},a.createElement("pre",null,this.state.message))),s&&null==this.state.messageParsed&&a.createElement("fieldset",{style:{borderColor:"#F00"}},a.createElement("legend",{style:{color:"red",weight:"bold"},className:"error"},"Error while parsing message, please check syntax from message below"),a.createElement("pre",null,this.props.message)))}}const ot=it;class rt extends a.Component{static propTypes={account:l.Z.ChainAccount.isRequired};constructor(e){super(e),this.state={tabsm_memo_key:this.props.account.get("options").get("memo_key"),tabsm_popup:"",tabsm_message_text:"",tabsm_message_signed:"",tabvm_popup:"",tabvm_message_signed:"",tabvm_verified:null,tabvm_message_signed_and_verified:null,tabvm_flag_verifyonchange:!1}}_tabSMSignAction(e){e.preventDefault();try{let e=this.props.account.get("options").get("memo_key");if(this.state.tabsm_memo_key!==e)throw Error(M().translate("account.signedmessages.keymismatch"));this.state.tabsm_message_text&&(this._tabSMPopMessage(M().translate("account.signedmessages.signing"),0),nt.signMessage(this.props.account,this.state.tabsm_message_text).then((e=>{this.setState({tabsm_message_signed:e,tabsm_popup:""})})).catch((e=>{this._tabSMPopMessage(e.message),this.setState({tabsm_message_signed:null})})))}catch(e){this._tabSMPopMessage(e.message),this.setState({tabsm_message_signed:null})}}_tabSMHandleChange(e){this.setState({tabsm_message_text:e.target.value})}_tabSMHandleChangeKey(e){this.setState({tabsm_memo_key:e})}_tabSMCopyToClipBoard(e){if(""!==e.target.value){e.target.focus(),e.target.select();try{var t=document.execCommand("copy");this._tabSMPopMessage(t?M().translate("account.signedmessages.copysuccessful"):M().translate("account.signedmessages.copyunsuccessful"))}catch(e){this._tabSMPopMessage(M().translate("account.signedmessages.copyunsuccessful"))}}}_tabSMPopMessage(e,t=3e3){this.setState({tabsm_popup:e}),""!==e&&t>0&&setTimeout((()=>{this.setState({tabsm_popup:""})}),t)}_tabVMAction(e){e.preventDefault(),this.setState({tabvm_message_signed_and_verified:null,tabvm_verified:!1}),this.state.tabvm_message_signed&&(this._tabVMPopMessage(M().translate("account.signedmessages.verifying"),0),setTimeout((()=>{try{let e=nt.verifyMemo(this.state.tabvm_message_signed);this.setState({tabvm_message_signed_and_verified:e,tabvm_verified:!0,tabvm_popup:""})}catch(e){this._tabVMPopMessage(e.message),this.setState({tabvm_message_signed_and_verified:null,tabvm_verified:!1})}}),0))}_tabVMHandleChange(e){this.setState({tabvm_message_signed:e.target.value,tabvm_verified:!1,tabvm_message_signed_and_verified:null}),this.state.tabvm_flag_verifyonchange&&this._tabVMAction(e)}_tabVMPopMessage(e,t=3e3){this.setState({tabvm_popup:e}),""!==e&&t>0&&setTimeout((()=>{this.setState({tabvm_popup:""})}),t)}_tabVMToggleVerifyOnChange(){this.setState({tabvm_flag_verifyonchange:!this.state.tabvm_flag_verifyonchange})}render(){return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(F.m,{className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block",setting:"accountSignedMessagesTab",contentClass:"grid-content shrink small-vertical medium-horizontal padding",segmented:!1},a.createElement(F.O,{title:"account.signedmessages.signmessage"},a.createElement("div",{className:"grid-content",style:{overflowX:"hidden"}},a.createElement("div",{className:"content-block no-margin"},a.createElement("h3",null,a.createElement(w(),{content:"account.signedmessages.signmessage"}))),a.createElement(He,{ref:"memo_key",value:this.state.tabsm_memo_key,label:"account.perm.memo_public_key",placeholder:"Public Key",tabIndex:7,onChange:this._tabSMHandleChangeKey.bind(this),disableActionButton:!0}),a.createElement("br",null),a.createElement("textarea",{rows:"10",value:this.state.tabsm_message_text,onChange:this._tabSMHandleChange.bind(this),placeholder:M().translate("account.signedmessages.entermessage")}),a.createElement("span",null,a.createElement("button",{className:"button",onClick:this._tabSMSignAction.bind(this)},a.createElement(w(),{content:"account.signedmessages.sign"})),a.createElement("div",{style:{color:"gray"}},this.state.tabsm_popup)),a.createElement("br",null),a.createElement("br",null),a.createElement("textarea",{rows:"14",value:this.state.tabsm_message_signed,style:{editable:!1},placeholder:M().translate("account.signedmessages.automaticcreation"),onClick:this._tabSMCopyToClipBoard.bind(this)}))),a.createElement(F.O,{title:"account.signedmessages.verifymessage"},a.createElement("div",{className:"grid-content",style:{overflowX:"hidden"}},a.createElement("div",{className:"content-block no-margin"},a.createElement("h3",null,a.createElement(w(),{content:"account.signedmessages.verifymessage"})),a.createElement("div",{style:{float:"right",marginTop:"0.1em",marginBottom:"0.5em"}},a.createElement("table",null,a.createElement("tr",null,a.createElement("td",null,a.createElement("label",{style:{marginBottom:0,marginRight:"0.5rem"}},a.createElement(w(),{content:"account.signedmessages.verifyonchange"}))),a.createElement("td",null,a.createElement(O.Switch,{checked:this.state.tabvm_flag_verifyonchange,onChange:this._tabVMToggleVerifyOnChange.bind(this)})))))),a.createElement("textarea",{rows:"10",value:this.state.tabvm_message_signed,onChange:this._tabVMHandleChange.bind(this),placeholder:M().translate("account.signedmessages.entermessage")}),a.createElement("span",null,a.createElement("button",{className:"button",onClick:this._tabVMAction.bind(this)},a.createElement(w(),{content:"account.signedmessages.verify"})),a.createElement("text",{style:{color:"gray"}},this.state.tabvm_popup),null!==this.state.tabvm_verified&&a.createElement("div",{style:{float:"right"}},"Message is:",a.createElement("div",{style:{backgroundColor:this.state.tabvm_verified?"green":"red"}},a.createElement("label",null,this.state.tabvm_verified?"verified":"not verified"))),(this.state.tabvm_verified&&null!==this.state.tabvm_message_signed_and_verified||this.state.tabvm_flag_verifyonchange)&&a.createElement("div",null,a.createElement("br",null),a.createElement(ot,{message:this.state.tabvm_message_signed})))))))))}}const lt=rt=(0,c.Z)(rt);var ct=s(17315),dt=s.n(ct),pt=s(55894);class mt extends a.Component{static propTypes={account:l.Z.ChainAccount.isRequired};static defaultProps={tempComponent:"tr"};render(){let{account:e,onRemove:t}=this.props;return a.createElement("tr",null,a.createElement("td",null,this.props.index),a.createElement("td",null,e.get("id")),a.createElement("td",null,a.createElement(ne.Z,{account:e.get("id")})),t?a.createElement("td",null,a.createElement("button",{onClick:t.bind(this,e.get("id")),className:"button outline"},"Remove")):null)}}mt=(0,c.Z)(mt);class ht extends a.Component{_onRemove(e,t,s){if(t){let s=this.props.getCurrentState(t),a=pt.Z.new_transaction();a.add_type_operation("account_whitelist",{fee:{amount:0,asset_id:K.ChainStore.assets_by_symbol.get(this.props.settings.get("fee_asset"))||"1.3.0"},authorizing_account:this.props.account.get("id"),account_to_list:t,new_listing:s-dt().account_listing[e]}),Te.Z.process_transaction(a,null,!0)}}render(){let{removeButton:e,white:t,list:s}=this.props,n=s.map(((s,n)=>a.createElement(mt,{key:s,onRemove:e?this._onRemove.bind(this,t?"white_listed":"black_listed"):null,account:s,index:n+1}))).toArray(),i=!0;return n.length||(i=!1,n.push(a.createElement("tr",{key:"empty"},a.createElement("td",{style:{padding:"1rem 0"},colSpan:e?4:3},a.createElement(w(),{content:this.props.emptyText,account:this.props.account.get("name")}))))),a.createElement("table",{className:"table compact dashboard-table"},i?a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"#"),a.createElement("th",null,a.createElement(w(),{content:"account.id"})),a.createElement("th",null,a.createElement(w(),{content:"account.name"})),e?a.createElement("th",null):null)):null,a.createElement("tbody",null,n))}}ht=(0,d.$)(ht,{listenTo:()=>[o.Z],getProps:()=>({settings:o.Z.getState().settings})});class ut extends a.Component{constructor(e){super(e),this.state={accountName:"",accountToList:null}}_getCurrentState(e){let{account:t}=this.props,s=t.get("whitelisted_accounts")||h().List(),a=t.get("blacklisted_accounts")||h().List(),n=dt().account_listing.no_listing;return s.includes(e)&&(n+=dt().account_listing.white_listed),a.includes(e)&&(n+=dt().account_listing.black_listed),n}_onAdd(e,t){let{accountToList:s}=this.state,{account:a}=this.props,n=this._getCurrentState(s);if(s){let t=pt.Z.new_transaction();t.add_type_operation("account_whitelist",{fee:{amount:0,asset_id:"1.3.0"},authorizing_account:a.get("id"),account_to_list:s,new_listing:n+dt().account_listing[e]}),Te.Z.process_transaction(t,null,!0)}}_onAccountFound(e){console.log("accountFound:",e),this.setState({accountName:e?e.get("name"):null,accountToList:e?e.get("id"):null})}_onAccountChanged(e){console.log("account changed:",e),this.setState({accountName:e,accountToList:null})}render(){let{account:e}=this.props,{accountName:t}=this.state;return a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(F.m,{className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block",setting:"whitelistTab",contentClass:"grid-content shrink small-vertical medium-horizontal no-padding",segmented:!1},a.createElement(F.O,{title:"account.whitelist.title"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(ht,{emptyText:"account.whitelist.empty",account:e,getCurrentState:this._getCurrentState.bind(this),list:e.get("whitelisted_accounts")||h().List(),removeButton:!0,white:!0})),e.get("whitelisted_accounts")?null:a.createElement("p",{className:"has-error"},"Please note, whitelisting is not working yet due to unresolved backend issue."),a.createElement("div",{style:{padding:"2rem 0"}},a.createElement(Z.Z,{label:"account.whitelist.add",accountName:t,onAccountChanged:this._onAccountFound.bind(this),onChange:this._onAccountChanged.bind(this),account:t,tabIndex:2,onAction:this._onAdd.bind(this,"white_listed"),action_label:"account.perm.confirm_add",white:!1,typeahead:!0})))),a.createElement(F.O,{title:"account.whitelist.black"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(ht,{emptyText:"account.whitelist.empty_black",account:e,getCurrentState:this._getCurrentState.bind(this),list:e.get("blacklisted_accounts"),removeButton:!0})),a.createElement("div",{style:{padding:"2rem 1rem"}},a.createElement(Z.Z,{label:"account.whitelist.add_black",accountName:t,onAccountChanged:this._onAccountFound.bind(this),onChange:this._onAccountChanged.bind(this),account:t,tabIndex:2,onAction:this._onAdd.bind(this,"black_listed"),action_label:"account.perm.confirm_add",typeahead:!0})))),a.createElement(F.O,{title:"account.whitelist.white_by"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(ht,{emptyText:"account.whitelist.empty_white_by",account:e,list:e.get("whitelisting_accounts")})))),a.createElement(F.O,{title:"account.whitelist.black_by"},a.createElement("div",{style:{paddingBottom:"1rem"},className:"small-12"},a.createElement("div",null,a.createElement(ht,{emptyText:"account.whitelist.empty_black_by",account:e,list:e.get("blacklisting_accounts")}))))))))}}const gt=ut;function _t(e,t){let s,a="",n=0;return"witness"===e?s=K.ChainStore.getWitnessById(t.get("id")):"committee"===e&&(s=K.ChainStore.getCommitteeMemberById(t.get("id"))),a=s?s.get("url"):a,a=S.Z.sanitize(a),n=s?s.get("total_votes"):n,{url:a,votes:n,id:s.get("id")}}class bt extends a.Component{static propTypes={items:l.Z.ChainObjectsList,onAddItem:v().func.isRequired,onRemoveItem:v().func.isRequired,validateAccount:v().func,label:v().string.isRequired,placeholder:v().string,tabIndex:v().number,action:v().string,filterSearch:v().string};static defaultProps={action:"remove",filterSearch:null};constructor(e){super(e),this.state={selected_item:null,item_name_input:"",error:null},this.onItemChange=this.onItemChange.bind(this),this.onItemAccountChange=this.onItemAccountChange.bind(this),this.onAddItem=this.onAddItem.bind(this)}onItemChange(e){this.setState({item_name_input:e})}onItemAccountChange(e){if(this.setState({selected_item:e,error:null}),e&&this.props.validateAccount){let t=this.props.validateAccount(e);if(null===t)return;"string"==typeof t?this.setState({error:t}):t.then((e=>this.setState({error:e})))}}onAddItem(e){e&&(this.setState({selected_item:null,item_name_input:"",error:null}),this.props.onAddItem(e.get("id")))}getHeader(){let e=["10%","20%","40%","20%","10%"];return[{title:"#",dataIndex:"num",align:"right",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:a.createElement(w(),{content:"account.votes.name"}),dataIndex:"name",align:"left",sorter:(e,t)=>e.key>t.key?1:e.key<t.key?-1:0,render:t=>a.createElement("span",{style:{maxWidth:e[1],whiteSpace:"nowrap"}},a.createElement(ne.Z,{account:t}))},{title:a.createElement(w(),{content:"account.votes.about"}),dataIndex:"about",render:t=>a.createElement("span",{style:{maxWidth:e[2],whiteSpace:"nowrap"}},a.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer"},a.createElement(V.Z,{name:"share",title:"icons.share"})))},{title:a.createElement(w(),{content:"account.votes.votes"}),dataIndex:"votes",sorter:(e,t)=>e.votes-t.votes,render:t=>a.createElement("span",{style:{maxWidth:e[3],whiteSpace:"nowrap"}},a.createElement(x.Z,{amount:t,asset:"1.3.0",decimalOffset:5,hide_asset:!0}))},{title:a.createElement(w(),{content:"account.votes.status.title"}),dataIndex:"title",sorter:(e,t)=>e.title>t.title?1:e.title<t.title?-1:0,render:t=>a.createElement("span",{style:{maxWidth:e[4],whiteSpace:"nowrap"}},a.createElement(w(),{content:t}))},{title:a.createElement(w(),{content:"account.votes.supported"}),dataIndex:"supported",align:"center",sorter:(e,t)=>e.supported.translate>t.supported.translate?1:e.supported.translate<t.supported.translate?-1:0,render:t=>a.createElement("span",{style:{maxWidth:e[0],whiteSpace:"nowrap"},className:t.proxy?"":"clickable",onClick:t.proxy?()=>{}:t.onAction.bind(this,t.item_id)},a.createElement(w(),{content:t.translate}))},{title:a.createElement(w(),{content:"account.votes.toggle"}),dataIndex:"toggle",render:t=>a.createElement("span",{style:{maxWidth:e[5],whiteSpace:"nowrap"},className:t.proxy?"":"clickable",onClick:t.proxy?()=>{}:t.onAction.bind(this,t.item_id)},t.proxy?a.createElement(V.Z,{name:"locked",title:"icons.locked.action"}):a.createElement(V.Z,{name:t.isSupported?"checkmark-circle":"minus-circle",title:t.isSupported?"icons.checkmark_circle.yes":"icons.minus_circle.no"}))}]}_decideRowClassName(e,t){return e.toggle.isSupported?"":"unsupported"}render(){if(!this.props.items)return null;const e=this.getHeader();let t=this.props.items.filter((e=>!(!e||this.props.filterSearch&&-1===e.get("name").indexOf(this.props.filterSearch)&&-1===e.get("id").indexOf(this.props.filterSearch)))).sort(((e,t)=>{let{votes:s}=_t(this.props.type,e),{votes:a}=_t(this.props.type,t);return s!==a?parseInt(a,10)-parseInt(s,10):e.get("name")>t.get("name")?1:e.get("name")<t.get("name")?-1:0})).map(((e,t)=>{let s=this.props.supported&&this.props.supported.includes(e.get("id"))?"remove":"add",a=this.props.active.includes(_t(this.props.type,e).id);return(e=>{let{account:t,type:s,action:a,isActive:n,idx:i,proxy:o,onAction:r,key:l}=e,c=t.get("id"),{url:d,votes:p}=_t(s,t),m=d&&d.length>0&&-1===d.indexOf("http")?"http://"+d:d;const h="remove"===a;return{key:l,num:i+1,name:t.get("id"),about:m&&-1!==m.indexOf(".")?m:null,votes:p,title:"account.votes."+(n?"active_short":"inactive"),supported:{translate:"settings."+(h?"yes":"no"),proxy:o,item_id:c,onAction:r},toggle:{proxy:o,isSupported:h,item_id:c,onAction:r}}})({idx:t,key:e.get("name"),account:e,type:this.props.type,onAction:"add"===s?this.props.onAddItem:this.props.onRemoveItem,isSelected:-1!==this.props.items.indexOf(e),action:s,isActive:a,proxy:this.props.proxy})})),s=this.state.error;return!s&&this.state.selected_item&&-1!==this.props.items.indexOf(this.state.selected_item)&&(s=M().translate("account.votes.already")),a.createElement("div",null,t.length?a.createElement(Ne.Z,{className:"table dashboard-table table-hover",rowClassName:this._decideRowClassName.bind(this),rows:t,header:e,pageSize:20,label:"utility.total_x_assets",leftPadding:"1.5rem"}):null)}}const Et=(0,c.Z)(bt);class vt extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e)}getInitialState(e){return{witnessAccount:e.account,signingKey:"",url:""}}shouldComponentUpdate(e,t){return this.state.url!==t.visible||this.props.visible!==e.visible||this.state.signingKey!==t.signingKey||this.state.witnessAccount!==t.witnessAccount}onAddWitness(){const{witnessAccount:e,signingKey:t,url:s}=this.state;e&&t&&n.Z.createWitness({account:e,url:s,signingKey:t}),this.props.hideModal()}onChangeCommittee(e){this.setState({witnessAccount:e})}onMemoKeyChanged(e){this.setState({signingKey:e.target.value})}onUrlChanged(e){this.setState({url:S.Z.sanitize(e.target.value.toLowerCase())})}isValidPubKey=e=>!K.PublicKey.fromPublicKeyString(e);render(){const{witnessAccount:e,signingKey:t,url:s}=this.state;return a.createElement(O.Modal,{title:M().translate("modal.witness.create_witness"),onCancel:this.props.hideModal,visible:this.props.visible,footer:[a.createElement(O.Button,{key:"submit",type:"primary",onClick:this.onAddWitness.bind(this)},M().translate("modal.witness.confirm")),a.createElement(O.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.props.hideModal},M().translate("modal.cancel"))]},a.createElement(O.Form,{className:"full-width",layout:"vertical"},a.createElement(Z.Z,{label:"modal.witness.witness_account",accountName:e&&e.get("name")||account.get("name"),account:e,onAccountChanged:this.onChangeCommittee.bind(this),size:35,typeahead:!0}),a.createElement(w(),{content:"modal.witness.text",unsafe:!0,component:"p"}),a.createElement(O.Form.Item,{label:M().translate("modal.witness.url")},a.createElement(O.Input,{value:s,onChange:this.onUrlChanged.bind(this),placeholder:M().translate("modal.witness.web_example")})),a.createElement(O.Form.Item,{label:M().translate("modal.witness.public_signing_key")},this.isValidPubKey(t)?a.createElement("label",{className:"right-label",style:{marginTop:"-30px",position:"static"}},a.createElement(w(),{content:"modal.witness.invalid_key"})):null,a.createElement(O.Input,{addonBefore:a.createElement(V.Z,{name:"key",title:"icons.key",size:"1x"}),value:t,onChange:this.onMemoKeyChanged.bind(this),placeholder:M().translate("modal.witness.enter_public_signing_key")}))))}}const yt=vt;class ft extends a.Component{constructor(e){super(e),this.state={showCreateWitnessModal:!1}}render(){const e=()=>{this.setState({showCreateWitnessModal:!this.state.showCreateWitnessModal})},t=this.props.onFilterChange,s=this.props.validateAccountHandler,n=this.props.addWitnessHandler,i=this.props.removeWitnessHandler,{showCreateWitnessModal:o}=this.state,{all_witnesses:r,proxy_witnesses:l,witnesses:c,proxy_account_id:d,hasProxy:p,globalObject:m,filterSearch:h,account:u}=this.props;return a.createElement("div",null,a.createElement("div",{className:W()("content-block")},a.createElement("div",{className:"header-selector"},a.createElement("div",{style:{float:"right"}},a.createElement(O.Button,{onClick:e},a.createElement(w(),{content:"account.votes.join_witnesses"}))),a.createElement("div",{className:"selector inline-block"},a.createElement(Me.Z,{placeholder:M().translate("explorer.witnesses.filter_by_name"),value:h,onChange:t}))),a.createElement(Et,{type:"witness",label:"account.votes.add_witness_label",items:r,validateAccount:s,onAddItem:n,onRemoveItem:i,tabIndex:p?-1:2,supported:p?l:c,active:m.get("active_witnesses"),proxy:d,filterSearch:h})),a.createElement(yt,{visible:o,account:u,hideModal:e}))}}class wt extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e)}getInitialState(){return{committeeAccount:this.props.account,url:""}}shouldComponentUpdate(e,t){return this.props.visible!==e.visible||this.state.url!==t.url||this.state.committeeAccount!==t.committeeAccount}onAddComittee(){const{committeeAccount:e,url:t}=this.state;e&&t&&n.Z.createCommittee({account:e,url:t}),this.props.hideModal()}onChangeCommittee(e){this.setState({committeeAccount:e})}onUrlChanged(e){this.setState({url:S.Z.sanitize(e.target.value.toLowerCase())})}onClose(){this.props.hideModal(),this.setState(this.getInitialState(this.props))}render(){const{url:e,committeeAccount:t}=this.state;return a.createElement(O.Modal,{title:M().translate("modal.committee.create_committee"),visible:this.props.visible,onCancel:this.props.hideModal,footer:[a.createElement(O.Button,{key:"submit",type:"primary",onClick:this.onAddComittee.bind(this)},M().translate("modal.committee.confirm")),a.createElement(O.Button,{key:"cancel",style:{marginLeft:"8px"},onClick:this.onClose.bind(this)},M().translate("modal.cancel"))]},a.createElement(O.Form,{className:"full-width",layout:"vertical"},a.createElement(Z.Z,{label:"modal.committee.from",accountName:t&&t.get("name")||account.get("name"),account:t||account,onAccountChanged:this.onChangeCommittee.bind(this),size:35,typeahead:!0}),a.createElement(w(),{content:"modal.committee.text",unsafe:!0,component:"p"}),a.createElement(O.Form.Item,{label:M().translate("modal.committee.url")},a.createElement(O.Input,{value:e,onChange:this.onUrlChanged.bind(this),placeholder:M().translate("modal.committee.web_example")}))))}}const kt=wt;class Ct extends a.Component{constructor(e){super(e),this.state={showCreateCommitteeModal:!1}}render(){const e=()=>{console.log("show committee modal"),this.setState({showCreateCommitteeModal:!this.state.showCreateCommitteeModal})},t=this.props.onFilterChange,s=this.props.validateAccountHandler,n=this.props.addCommitteeHandler,i=this.props.removeCommitteeHandler,{showCreateCommitteeModal:o}=this.state,{all_committee:r,proxy_committee:l,committee:c,proxy_account_id:d,hasProxy:p,globalObject:m,filterSearch:h,account:u}=this.props;return a.createElement("div",null,a.createElement("div",{className:"header-selector"},a.createElement("div",{style:{float:"right"}},a.createElement(O.Button,{onClick:e},a.createElement(w(),{content:"account.votes.join_committee"}))),a.createElement("div",{className:"selector inline-block"},a.createElement(Me.Z,{placeholder:M().translate("explorer.witnesses.filter_by_name"),value:h,onChange:t}))),a.createElement("div",{className:W()("content-block")},a.createElement(Et,{type:"committee",label:"account.votes.add_committee_label",items:r,validateAccount:s,onAddItem:n,onRemoveItem:i,tabIndex:p?-1:3,supported:p?l:c,active:m.get("active_committee_members"),proxy:d,filterSearch:h})),a.createElement(kt,{visible:o,account:u,hideModal:e}))}}var xt=s(41220),At=s(99349),St=s(95806),Nt=s.n(St);const Mt=["1.14.114","1.14.107"];class It extends a.Component{constructor(e){super(e)}onApprove(e){let t=[],s=[];e.vote_ids.has(e.worker.get("vote_against"))&&s.push(e.worker.get("vote_against")),e.vote_ids.has(e.worker.get("vote_for"))||t.push(e.worker.get("vote_for")),this.props.onChangeVotes(t,s)}onReject(e){let t=[];e.vote_ids.has(e.worker.get("vote_against"))&&t.push(e.worker.get("vote_against")),e.vote_ids.has(e.worker.get("vote_for"))&&t.push(e.worker.get("vote_for")),this.props.onChangeVotes([],t)}getHeader(e,t){return[2===e?null:{title:a.createElement(w(),{component:"span",content:"account.votes.line",style:{whiteSpace:"nowrap"}}),dataIndex:"line",align:"right",render:e=>a.createElement("span",{style:{textAlign:"right",paddingRight:10,paddingLeft:0,whiteSpace:"nowrap"}},e||M().translate("account.votes.expired"))},{title:a.createElement(w(),{content:"account.user_issued_assets.id",style:{whiteSpace:"nowrap"}}),dataIndex:"assets_id",align:"center",sorter:(e,t)=>e.assets_id>t.assets_id?1:e.assets_id<t.assets_id?-1:0,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:a.createElement(w(),{content:"account.user_issued_assets.description",style:{whiteSpace:"nowrap"}}),dataIndex:"description",align:"left",sorter:(e,t)=>e.description.name>t.description.name?1:e.description.name<t.description.name?-1:0,render:e=>a.createElement("span",null,a.createElement("div",{className:"inline-block",style:{paddingRight:5,position:"relative",top:-1,whiteSpace:"nowrap"}},a.createElement("a",{style:{visibility:e.url&&-1!==e.url.indexOf(".")?"visible":"hidden"},href:S.Z.sanitize(e.url),target:"_blank",rel:"noopener noreferrer"},a.createElement(V.Z,{name:"share",size:"2x",title:"icons.share"}))),a.createElement("div",{className:"inline-block"},e.name,a.createElement("br",null),a.createElement(ne.Z,{account:e.worker_account,maxDisplayAccountNameLength:null})))},{className:"column-hide-small",title:a.createElement(w(),{content:"account.votes.total_votes",style:{whiteSpace:"nowrap"}}),dataIndex:"total_votes",align:"right",sorter:(e,t)=>e.total_votes-t.total_votes,render:e=>a.createElement(x.Z,{amount:e,asset:"1.3.0",decimalOffset:5,hide_asset:!0,style:{whiteSpace:"nowrap"}})},0===e?{title:a.createElement(w(),{content:"account.votes.missing",style:{whiteSpace:"nowrap"}}),dataIndex:"missing",align:"right",sorter:(e,t)=>e.missing-t.missing,render:e=>a.createElement("span",{style:{textAlign:"right",whiteSpace:"nowrap"}},a.createElement(x.Z,{amount:Math.max(0,e),asset:"1.3.0",hide_asset:!0,decimalOffset:5}))}:null,{title:a.createElement(w(),{content:"explorer.workers.period",style:{whiteSpace:"nowrap"}}),dataIndex:"period",align:"right",sorter:(e,t)=>new Date(e.period.startDate)-new Date(t.period.startDate),render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e.startDate," - ",e.endDate)},2===e||0===e?null:{title:a.createElement(w(),{content:"account.votes.funding",style:{whiteSpace:"nowrap"}}),dataIndex:"funding",align:"right",render:e=>a.createElement("span",{style:{textAlign:"right",whiteSpace:"nowrap"},className:"hide-column-small"},e.isExpired?"-":S.Z.format_number(e.fundedPercent,2)+"%")},2===e||0===e?null:{title:a.createElement("span",null,a.createElement(w(),{content:"explorer.witnesses.budget",style:{whiteSpace:"nowrap"}}),a.createElement("div",{style:{paddingTop:5,fontSize:"0.8rem"}},"(",a.createElement(At.Z,{name:t}),")")),dataIndex:"budget",align:"right",render:e=>a.createElement("span",{style:{textAlign:"right",whiteSpace:"nowrap"}},e.rest<=0?e.isExpired?"-":"0.00":a.createElement(xt.il,{hide_asset:!0,fromAsset:"1.3.0",toAsset:e.preferredUnit,amount:e.rest}))},{className:"column-hide-small",title:a.createElement("span",null,a.createElement(w(),{content:"account.votes.daily_pay",style:{whiteSpace:"nowrap"}}),a.createElement("div",{style:{paddingTop:5,fontSize:"0.8rem"}},"(",a.createElement(At.Z,{name:t}),")")),dataIndex:"daily_pay",align:"right",sorter:(e,t)=>e.daily_pay.daily_pay-t.daily_pay.daily_pay,render:e=>a.createElement("span",{className:e.proxy?"":"clickable",style:{whiteSpace:"nowrap"},onClick:e.proxy?()=>{}:this[e.approvalState?"onReject":"onApprove"].bind(this,e)},a.createElement(xt.il,{hide_asset:!0,fromAsset:"1.3.0",toAsset:e.preferredUnit,amount:e.daily_pay,style:{whiteSpace:"nowrap"}}))},{className:"column-hide-small",title:a.createElement(w(),{content:"account.votes.toggle",style:{whiteSpace:"nowrap"}}),dataIndex:"toggle",align:"right",render:e=>a.createElement("span",{className:e.proxy?"":"clickable",style:{whiteSpace:"nowrap"},onClick:e.proxy?()=>{}:this[e.approvalState?"onReject":"onApprove"].bind(this,e)},e.proxy?a.createElement(V.Z,{name:"locked",title:"icons.locked.action"}):a.createElement(V.Z,{name:e.approvalState?"checkmark-circle":"minus-circle",title:e.approvalState?"icons.checkmark_circle.approved":"icons.minus_circle.disapproved"}))}].filter((e=>e))}getData(e,t=0){let{hasProxy:s,proxy_vote_ids:a,vote_ids:n}=this.props;return n=s?a:n,t=t||0,e.map(((e,a)=>{let i=e.worker.toJS();const o=a+1;let r=i.total_votes_for-i.total_votes_against,l=!!n.has(i.vote_for)||!n.has(i.vote_against)&&null,c=0;i.daily_pay<e.rest?c=100:e.rest>0&&(c=e.rest/i.daily_pay*100);let d=M().localize(new Date(i.work_begin_date+"Z"),{type:"date",format:"short_custom"}),p=M().localize(new Date(i.work_end_date+"Z"),{type:"date",format:"short_custom"}),m=new Date,h=new Date(i.work_end_date+"Z")<=m,u=new Date(i.work_begin_date+"Z")<=m,g=!h&&r<t||!u,_=!!e.poll;return{key:i.id,line:!_&&h||h?null:o,assets_id:i.id,description:i,total_votes:r,missing:t-r,period:{startDate:d,endDate:p},funding:_||!h&&!g?{isExpired:h,fundedPercent:c}:null,daily_pay:{preferredUnit:e.preferredUnit,daily_pay:i.daily_pay,proxy:s,approvalState:l,worker:e.worker,vote_ids:n},budget:_||!h&&!g?{rest:e.rest,isExpired:h,preferredUnit:e.preferredUnit,rest:e.rest}:null,toggle:{proxy:s,approvalState:l,worker:e.worker,vote_ids:n}}}))}_getMappedWorkers(e,t,s){let a,n=new Date,i=t;return{mappedWorkers:e.sort(((e,t)=>this._getTotalVotes(t)-this._getTotalVotes(e))).map((e=>{e.isOngoing=new Date(e.get("work_end_date")+"Z")>n&&new Date(e.get("work_begin_date")+"Z")<=n,e.isUpcoming=new Date(e.get("work_begin_date")+"Z")>n,e.isExpired=new Date(e.get("work_end_date")+"Z")<=n;let t=parseInt(e.get("daily_pay"),10);return e.votes=e.get("total_votes_for")-e.get("total_votes_against"),i>0&&e.isOngoing?(e.active=!0,i-=t,i<=0&&!a&&(a=e.votes),e.remainingPayout=i+t):(e.active=!1,e.remainingPayout=0),e})).filter((e=>{const t=e.get("name").toLowerCase();return e&&-1!==t.indexOf(s)})).sort(((e,t)=>e.isExpired!==t.isExpired?e.isExpired?1:-1:this._getTotalVotes(t)-this._getTotalVotes(e))),voteThreshold:a}}_getTotalVotes(e){return parseInt(e.get("total_votes_for"),10)-parseInt(e.get("total_votes_against"),10)}_decideRowClassName(e,t){return e.toggle.approvalState?"":"unsupported"}render(){let{workerTableIndex:e,preferredUnit:t,setWorkersLength:s,workerBudget:n,hideLegacyProposals:i,getWorkerArray:o,filterSearch:r}=this.props;const l=this.getHeader(e,t);let c=o(),{mappedWorkers:d,voteThreshold:p}=this._getMappedWorkers(c,n,r),m=d.filter((e=>{let t=e.get("name").toLowerCase();return t.includes("bsip")||t.includes("poll")})).map((e=>({preferredUnit:t,rest:e.remainingPayout,poll:!0,worker:e}))).filter((e=>!!e));d=d.filter((e=>{let t=e.get("name").toLowerCase();return!t.includes("bsip")&&!t.includes("poll")}));let h=d.filter((e=>e.isOngoing)),u=d.filter((e=>e.active&&e.isOngoing)).map((e=>({preferredUnit:t,rest:e.remainingPayout,worker:e}))).filter((e=>!!e)),g=d.filter((e=>!e.active&&!e.isExpired&&((e,t)=>{if(!i)return!0;let s=t.some((t=>{const s=Nt().compareTwoStrings(e.get("name"),t.get("name"))>.8,a=t.get("id")===e.get("id"),n=t.get("id").substr(5,t.get("id").length)>e.get("id").substr(5,t.get("id").length);return s&&!a&&n}));const a=new Date,n=e.get("total_votes_for")-e.get("total_votes_against")<2e12,o=new Date(e.get("work_begin_date")+"Z")<=new Date(a.setMonth(a.getMonth()-2)),r=Mt.includes(e.get("id"));return!((s||o)&&n||r)})(e,h))).map((e=>({preferredUnit:t,rest:0,worker:e}))),_=c.filter((e=>e.isExpired)).map((e=>({preferredUnit:t,rest:0,worker:e})));setTimeout((()=>{s(g.length,u.length,m.length,_.length,p)}),250);const b=0===e?g:1===e?u:2===e?_:m;return a.createElement(Ne.Z,{className:"table dashboard-table table-hover",rowClassName:this._decideRowClassName.bind(this),rows:this.getData(b,p),header:l,pageSize:50,label:"utility.total_x_assets",leftPadding:"1.5rem"})}}const Zt=(0,c.Z)(It);class Pt extends a.Component{constructor(e){super(e),this.state={newWorkersLength:null,activeWorkersLength:null,pollsLength:null,expiredWorkersLength:null,voteThreshold:null,workerTableIndex:e.viewSettings.get("workerTableIndex",1)}}shouldComponentUpdate(e,t){return t.newWorkersLength!==this.state.newWorkersLength||t.activeWorkersLength!==this.state.activeWorkersLength||t.pollsLength!==this.state.pollsLength||t.expiredWorkersLength!==this.state.expiredWorkersLength||t.voteThreshold!==this.state.voteThreshold||e.workerTableIndex!==this.state.workerTableIndex}render(){const{vote_ids:e,proxy_vote_ids:t,hideLegacy:s,preferredUnit:n,globalObject:i,totalBudget:o,workerBudget:r,hideLegacyProposals:l,hasProxy:c,filterSearch:d,onFilterChange:p,onChangeVotes:m,getWorkerArray:h}=this.props,{workerTableIndex:u,newWorkersLength:g,activeWorkersLength:_,pollsLength:b,expiredWorkersLength:E,voteThreshold:v}=this.state;return a.createElement("div",null,a.createElement("div",{className:"header-selector"},a.createElement("div",{style:{float:"right"}},a.createElement(O.Button,null,a.createElement(y.rU,{to:"/create-worker"},a.createElement(w(),{content:"account.votes.create_worker"})))),a.createElement("div",{className:"selector inline-block"},a.createElement(Me.Z,{placeholder:M().translate("explorer.witnesses.filter_by_name"),value:d,onChange:p}),a.createElement(O.Radio.Group,{defaultValue:1,onChange:e=>{this.setState({workerTableIndex:e.target.value})}},a.createElement(O.Radio,{value:0},M().translate("account.votes.new",{count:g})),a.createElement(O.Radio,{value:1},M().translate("account.votes.active",{count:_})),b?a.createElement(O.Radio,{value:3},M().translate("account.votes.polls",{count:b})):null,E?a.createElement(O.Radio,{value:2},a.createElement(w(),{content:"account.votes.expired"})):null)),s,a.createElement("br",null),a.createElement("br",null),a.createElement(O.Row,null,a.createElement(O.Col,{span:3},a.createElement(w(),{content:"account.votes.threshold"})," (",a.createElement(At.Z,{name:n}),")"),a.createElement(O.Col,{span:3,style:{marginLeft:"10px"}},a.createElement(x.Z,{decimalOffset:4,hide_asset:!0,amount:v,asset:"1.3.0"}))),a.createElement(O.Row,null,a.createElement(O.Col,{span:3},a.createElement(w(),{content:"account.votes.total_budget"})," (",a.createElement(At.Z,{name:n}),")"),a.createElement(O.Col,{span:3,style:{marginLeft:"10px"}},i?a.createElement(xt.il,{hide_asset:!0,fromAsset:"1.3.0",toAsset:n,amount:o}):null))),a.createElement(Zt,{workerTableIndex:u,preferredUnit:n,setWorkersLength:(e,t,s,a,n)=>{e===this.state.newWorkersLength&&t===this.state.activeWorkersLength&&s===this.state.pollsLength&&a===this.state.expiredWorkersLength&&n===this.state.voteThreshold||this.setState({newWorkersLength:e,activeWorkersLength:t,pollsLength:s,expiredWorkersLength:a,voteThreshold:n})},workerBudget:r,hideLegacyProposals:l,hasProxy:c,proxy_vote_ids:t,vote_ids:e,onChangeVotes:m,getWorkerArray:h,filterSearch:d}))}}function Ot(){return Ot=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},Ot.apply(this,arguments)}const Bt="witnesses",Tt="committee";class Rt extends a.Component{static propTypes={initialBudget:l.Z.ChainObject.isRequired,globalObject:l.Z.ChainObject.isRequired,proxy:l.Z.ChainAccount.isRequired};static defaultProps={globalObject:"2.0.0"};constructor(e){super(e);const t=e.proxy.get("id"),s=e.proxy.get("name"),a="string"==typeof e.account?e.account:e.account.get("name");this.state={proxy_account_id:"1.2.5"===t?"":t,prev_proxy_account_id:"1.2.5"===t?"":t,current_proxy_input:"1.2.5"===t?"":s,witnesses:null,committee:null,vote_ids:h().Set(),proxy_vote_ids:h().Set(),lastBudgetObject:e.initialBudget.get("id"),all_witnesses:h().List(),all_committee:h().List(),hideLegacyProposals:!0,filterSearch:"",tabs:[{name:"witnesses",link:"/account/"+a+"/voting/witnesses",translate:"explorer.witnesses.title",content:ft},{name:"committee",link:"/account/"+a+"/voting/committee",translate:"explorer.committee_members.title",content:Ct},{name:"workers",link:"/account/"+a+"/voting/workers",translate:"account.votes.workers_short",content:Pt}]},this.onProxyAccountFound=this.onProxyAccountFound.bind(this),this.onPublish=this.onPublish.bind(this),this.onReset=this.onReset.bind(this),this._getVoteObjects=this._getVoteObjects.bind(this)}UNSAFE_componentWillMount(){p.Z.getFinalFeeAsset(this.props.account,"account_update"),K.ChainStore.fetchAllWorkers(),this.getBudgetObject()}componentDidMount(){this.updateAccountData(this.props),this._getVoteObjects(),this._getVoteObjects("committee")}shouldComponentUpdate(e,t){return e.location.pathname!==this.props.location.pathname||t.prev_proxy_account_id!==this.state.prev_proxy_account_id||t.hideLegacyProposals!==this.state.hideLegacyProposals||t.vote_ids.size!==this.state.vote_ids.size||t.current_proxy_input!==this.state.current_proxy_input||t.filterSearch!==this.state.filterSearch||t.witnesses!==this.state.witnesses||t.committee!==this.state.committee}UNSAFE_componentWillReceiveProps(e){if(e.account!==this.props.account){const t=e.proxy.get("id");let s={proxy_account_id:"1.2.5"===t?"":t};this.setState({prev_proxy_account_id:s.proxy_account_id}),this.updateAccountData(e,s)}this.getBudgetObject()}updateAccountData({account:e},t=this.state){let{proxy_account_id:s}=t;const a=K.ChainStore.getAccount(s);let n=e.get("options"),i=a?a.get("options"):null,o=a?a.get("name"):"";"1.2.5"===s&&(s="",o="");let r=n.get("votes").toArray(),l=h().Set(r);K.ChainStore.getObjectsByVoteIds(r);let c=null,d=h().Set([]);if("1.2.5"!==s&&i){let e=i.get("votes").toArray();d=h().Set(e),K.ChainStore.getObjectsByVoteIds(e),c=(0,K.FetchChainObjects)(K.ChainStore.getObjectByVoteID,e,1e4)}Promise.all([(0,K.FetchChainObjects)(K.ChainStore.getObjectByVoteID,r,1e4),c]).then((e=>{const[t,a]=e;function n(e){let t=new(h().List),s=new(h().List),a=new(h().Set);return e.forEach((e=>{let a=e.get("committee_member_account");a?s=s.push(a):(a=e.get("worker_account"))||(a=e.get("witness_account"))&&(t=t.push(a))})),{witnesses:t,committee:s,workers:a}}let{witnesses:i,committee:r,workers:c}=n(t),{witnesses:p,committee:m,workers:u}=n(a||[]),g={proxy_account_id:s,current_proxy_input:o,witnesses:i,committee:r,workers:c,proxy_witnesses:p,proxy_committee:m,proxy_workers:u,vote_ids:l,proxy_vote_ids:d,prev_witnesses:i,prev_committee:r,prev_workers:c,prev_vote_ids:l};this.setState(g)}))}isChanged(e=this.state){return e.proxy_account_id!==e.prev_proxy_account_id||e.witnesses!==e.prev_witnesses||e.committee!==e.prev_committee||!h().is(e.vote_ids,e.prev_vote_ids)}_getVoteObjects(e="witnesses",t){let s=this.state[`all_${e}`];const a=e===Bt;let n;if(t)n=parseInt(t[t.length-1].split(".")[2],10);else{t=[];const e=this.props.globalObject.get(a?"active_witnesses":"active_committee_members").sort(((e,t)=>parseInt(e.split(".")[2],10)-parseInt(t.split(".")[2],10))).last()||`1.${a?"6":"5"}.1`;n=parseInt(e.split(".")[2],10);for(var i=1;i<=n+10;i++)t.push(`1.${a?"6":"5"}.${i}`)}(0,K.FetchChainObjects)(K.ChainStore.getObject,t,5e3,{}).then((i=>{if(this.state[`all_${e}`]=s.concat(h().List(i.filter((e=>!!e)).map((e=>e.get(a?"witness_account":"committee_member_account"))))),i[i.length-1]){t=[];for(var o=n+11;o<=n+20;o++)t.push(`1.${a?"6":"5"}.${o}`);return this._getVoteObjects(e,t)}this.forceUpdate()}))}onRemoveProxy=()=>{this.publish(null)};onPublish(){this.publish(this.state.proxy_account_id)}publish(e){let t=this.props.account.toJS(),s={account:t.id},a={memo_key:t.options.memo_key};a.voting_account=e||"1.2.5",a.num_witness=this.state.witnesses.size,a.num_committee=this.state.committee.size,s.new_options=a,s.fee={amount:0,asset_id:p.Z.getFinalFeeAsset(t.id,"account_update")};let{vote_ids:n}=this.state,i=this._getWorkerArray(),o=new Date;function r(e,t){return e.includes(t)&&(e=e.delete(t)),e}i.forEach((e=>{e&&(new Date(e.get("work_end_date"))<=o&&(n=r(n,e.get("vote_for"))),n=r(n,e.get("vote_against")))})),(0,K.FetchChainObjects)(K.ChainStore.getWitnessById,this.state.witnesses.toArray(),4e3).then((e=>{let t=e.map((e=>e.get("vote_id")));return Promise.all([Promise.resolve(t),(0,K.FetchChainObjects)(K.ChainStore.getCommitteeMemberById,this.state.committee.toArray(),4e3)])})).then((e=>{s.new_options.votes=e[0].concat(e[1].map((e=>e.get("vote_id")))).concat(n.filter((e=>"2"===e.split(":")[0])).toArray()).sort(((e,t)=>{let s=e.split(":"),a=t.split(":");return parseInt(s[1],10)-parseInt(a[1],10)})),I.Z.updateAccount(s)}))}_getWorkerArray(){let e=[];return K.ChainStore.workers.forEach((t=>{let s=K.ChainStore.getObject(t,!1,!1);s&&e.push(s)})),e}onReset(){let e=this.state;this.refs.voting_proxy&&this.refs.voting_proxy.refs.bound_component&&this.refs.voting_proxy.refs.bound_component.onResetProxy(),this.setState({proxy_account_id:e.prev_proxy_account_id,current_proxy_input:e.prev_proxy_input,witnesses:e.prev_witnesses,committee:e.prev_committee,workers:e.prev_workers,vote_ids:e.prev_vote_ids},(()=>{this.updateAccountData(this.props)}))}onAddItem(e,t){let s={};s[e]=this.state[e].push(t),this.setState(s)}onRemoveItem(e,t){let s={};s[e]=this.state[e].filter((e=>e!==t)),this.setState(s)}onChangeVotes(e,t){let s={};s.vote_ids=this.state.vote_ids,e.length&&e.forEach((e=>{s.vote_ids=s.vote_ids.add(e)})),t&&t.forEach((e=>{s.vote_ids=s.vote_ids.delete(e)})),this.setState(s)}validateAccount(e,t){return t?e===Bt?(0,K.FetchChainObjects)(K.ChainStore.getWitnessById,[t.get("id")],3e3).then((e=>e[0]?null:"Not a witness")):"committee"===e?(0,K.FetchChainObjects)(K.ChainStore.getCommitteeMemberById,[t.get("id")],3e3).then((e=>e[0]?null:"Not a committee member")):null:null}onProxyChange(e){let t=K.ChainStore.getAccount(e);(!t||t&&t.get("id")!==this.state.proxy_account_id)&&this.setState({proxy_account_id:t?t.get("id"):"",proxy_witnesses:h().Set(),proxy_committee:h().Set(),proxy_workers:h().Set()}),this.setState({current_proxy_input:e})}onProxyAccountFound(e){const t=e?e.get("id"):"";this.state.proxy_account_id!==t&&this.setState({proxy_account_id:t},(()=>{this.updateAccountData(this.props)}))}onClearProxy(){this.setState({proxy_account_id:""})}getBudgetObject(){let e,{lastBudgetObject:t}=this.state;e=K.ChainStore.getObject(t);let s=parseInt(t.split(".")[2],10);if(e){let a=e.get("time");/Z$/.test(a)||(a+="Z");let n=new Date,i=s+Math.floor((n-new Date(a).getTime())/1e3/60/60)-1;if(s>=i)return;let r="2.13."+Math.max(s,i),l=parseInt(r.split(".")[2],10);(0,K.FetchChainObjects)(K.ChainStore.getObject,[r],void 0,{}).then((e=>{let[s]=e;null===s?"2.13."+(l-1)!=t&&this.setState({lastBudgetObject:"2.13."+(l-1)},this.getBudgetObject):(o.Z.setLastBudgetObject(r),this.setState({lastBudgetObject:r}))}))}else{let e="2.13."+(s-1);(0,K.FetchChainObjects)(K.ChainStore.getObject,[e],void 0,{}).then((t=>{let[a]=t;null===a?this.setState({lastBudgetObject:"2.13."+(s-2)},this.getBudgetObject):(o.Z.setLastBudgetObject(e),this.setState({lastBudgetObject:e}))}))}}handleFilterChange(e){this.setState({filterSearch:e.target.value||""})}render(){const{prev_proxy_account_id:e,hideLegacyProposals:t,filterSearch:s,all_witnesses:n,proxy_witnesses:i,witnesses:o,all_committee:r,proxy_committee:l,committee:c,vote_ids:d,proxy_vote_ids:p,proxy_account_id:m}=this.state,h=!!e,u=this.props.settings.get("unit")||"1.3.0",g=!!m,{globalObject:_,account:b}=this.props,{totalBudget:E,workerBudget:v}=this._getBudgets(_),y=this._getActionButtons(),f=this._getProxyInput(h),k=this._getHideLegacyOptions(),C=this.handleFilterChange.bind(this),x=this.validateAccount.bind(this,Bt),A=this.onAddItem.bind(this,Bt),S=this.onRemoveItem.bind(this,Bt),N=this.onChangeVotes.bind(this),I=this._getWorkerArray.bind(this),Z=this.onAddItem.bind(this,Tt),P=this.onRemoveItem.bind(this,Tt);return a.createElement("div",{className:"main-content grid-content"},a.createElement("div",{className:"voting"},a.createElement("div",{className:"padding"},a.createElement("div",null,a.createElement(w(),{content:"voting.title",component:"h1"}),a.createElement(w(),{content:"voting.description",component:"p"})),a.createElement("div",{className:"proxy-row"},f,y)),a.createElement(O.Tabs,{activeKey:this.props.location.pathname,animated:!1,style:{display:"table",height:"100%",width:"100%"},onChange:e=>{this.props.history.push(e)}},this.state.tabs.map((e=>{const h=e.content;return a.createElement(O.Tabs.TabPane,{key:e.link,tab:M().translate(e.translate)},a.createElement(h,{all_witnesses:n,proxy_witnesses:i,witnesses:o,proxy_account_id:m,onFilterChange:C,validateAccountHandler:x,addWitnessHandler:A,removeWitnessHandler:S,hasProxy:g,globalObject:_,filterSearch:s,account:b,all_committee:r,proxy_committee:l,committee:c,addCommitteeHandler:Z,removeCommitteeHandler:P,vote_ids:d,proxy_vote_ids:p,hideLegacy:k,preferredUnit:u,totalBudget:E,workerBudget:v,hideLegacyProposals:t,onChangeVotes:N,getWorkerArray:I,viewSettings:this.props.viewSettings}))})))))}_getBudgets(e){let t;this.state.lastBudgetObject&&(t=K.ChainStore.getObject(this.state.lastBudgetObject));let s=0,a=e?parseInt(e.getIn(["parameters","worker_budget_per_day"]),10):0;return t&&(a=Math.min(24*t.getIn(["record","worker_budget"]),a),s=Math.min(24*t.getIn(["record","worker_budget"]),a)),{totalBudget:s,workerBudget:a}}_getProxyInput(e){return a.createElement(a.Fragment,null,a.createElement(Z.Z,{label:"account.votes.proxy_short",style:{width:"50%",maxWidth:250,display:"inline-block"},account:this.state.current_proxy_input,accountName:this.state.current_proxy_input,onChange:this.onProxyChange.bind(this),onAccountChanged:this.onProxyAccountFound,tabIndex:1,placeholder:M().translate("account.votes.set_proxy"),tooltip:M().translate(this.state.proxy_account_id?"tooltip.proxy_remove":"tooltip.proxy_search"),hideImage:!0},a.createElement("span",{style:{paddingLeft:5,position:"relative",top:9}},a.createElement(y.rU,{to:"/help/voting"},a.createElement(V.Z,{name:"question-circle",title:"icons.question_circle",size:"1x"})))),e&&a.createElement(O.Button,{style:{marginLeft:"1rem"},onClick:this.onRemoveProxy,tabIndex:9},a.createElement(w(),{content:"account.perm.remove_proxy"})))}_getHideLegacyOptions(){return a.createElement("div",{className:"inline-block",style:{marginLeft:"0.5em"},onClick:()=>{this.setState({hideLegacyProposals:!this.state.hideLegacyProposals})}},a.createElement(O.Tooltip,{title:M().translate("tooltip.legacy_explanation")},a.createElement(O.Switch,{style:{marginRight:6,marginTop:-3},checked:this.state.hideLegacyProposals}),a.createElement(w(),{content:"account.votes.hide_legacy_proposals"})))}_getActionButtons(){return a.createElement(O.Tooltip,{title:M().translate("account.votes.cast_votes_through_one_operation"),mouseEnterDelay:.5},a.createElement("div",{style:{float:"right"}},a.createElement(O.Button,{type:"primary",onClick:this.onPublish,tabIndex:4,disabled:!this.isChanged()||void 0},a.createElement(w(),{content:"account.votes.publish"})),a.createElement(O.Button,{style:{marginLeft:"8px"},onClick:this.onReset,tabIndex:8},a.createElement(w(),{content:"account.perm.reset"}))))}}Rt=(0,c.Z)(Rt);const Lt=(0,g.EN)((e=>{let t={};if(e.initialBudget||(t.initialBudget=o.Z.getLastBudgetObject()),!e.account){let e=i.Z.getState().currentAccount||i.Z.getState().passwordAccount;e=e&&"null"!==e?e:"committee-account",t.account=e}if(!e.proxy){const s=K.ChainStore.getAccount(e.account);let a=null;if(!s)throw"Account must be loaded";a=s.getIn(["options","voting_account"]),t.proxy=a}return a.createElement(Rt,Ot({},e,t))}));var Dt=s(68555),Ft=s(3894),Vt=s(276);const qt={textAlign:"right"},Ut={textAlign:"left"};class jt extends a.Component{static propTypes={object:l.Z.ChainObject,debtAsset:l.Z.ChainAsset.isRequired,collateralAsset:l.Z.ChainAsset.isRequired};static defaultProps={tempComponent:"tr"};constructor(e){super(e);let t=null!=e.object;this.state={isBorrowModalVisible:!1,modalRef:"cp_modal_"+(t?this.props.object.getIn(["call_price","quote","asset_id"]):this.props.debtAsset.get("id")),hasOrder:t}}showBorrowModal(){this.setState({isBorrowModalVisible:!0})}hideBorrowModal(){this.setState({isBorrowModalVisible:!1})}_onUpdatePosition(e){e.preventDefault(),this.refs[this.state.modalRef].show()}_getFeedPrice(){return this.props?1/S.Z.get_asset_price(L.Z.extractRawFeedPrice(this.props.debtAsset).getIn(["quote","amount"]),this.props.collateralAsset,L.Z.extractRawFeedPrice(this.props.debtAsset).getIn(["base","amount"]),this.props.debtAsset):1}_onClosePosition(e){e.preventDefault();let t=pt.Z.new_transaction();t.add_type_operation("call_order_update",{fee:{amount:0,asset_id:0},funding_account:this.props.object.get("borrower"),delta_collateral:{amount:-this.props.object.get("collateral"),asset_id:this.props.object.getIn(["call_price","base","asset_id"])},delta_debt:{amount:-this.props.object.get("debt"),asset_id:this.props.object.getIn(["call_price","quote","asset_id"])}}),Te.Z.process_transaction(t,null,!0)}_getBalance(){let e=this.props.account,t=null;t=null!=this.props.object?this.props.object.getIn(["call_price","quote","asset_id"]):this.props.debtAsset.get("id");let s=e.get("balances"),a=0;return s&&s.forEach(((e,s)=>{if(s==t){let t=K.ChainStore.getObject(e);a=t.get("balance")}})),a}_getCollateralRatio(){const e=this.props.object.toJS();return S.Z.get_asset_amount(e.collateral,this.props.collateralAsset)/(S.Z.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?M().translate("tooltip.cr_danger",{mr:t}):"warning"===e?M().translate("tooltip.cr_warning",{mr:t}):null:null}_getTargetCollateralRatio(){const e=this.props.object&&this.props.object.toJS();return e&&!isNaN(e.target_collateral_ratio)?e.target_collateral_ratio/1e3:0}render(){let{debtAsset:e,collateralAsset:t,object:s}=this.props,n=null!=s;const i=this._getBalance();let o=n?s.toJS():null,{isBitAsset:r}=S.Z.replaceName(this.props.debtAsset),l=e.get("bitasset")&&e.getIn(["bitasset","is_prediction_market"]),c=this.props.debtAsset.getIn(["bitasset","settlement_fund"]),d=this.props.debtAsset.getIn(["bitasset","current_feed","maintenance_collateral_ratio"]),p=c>0;const h=n?o.call_price.quote.asset_id:e.get("id"),u=n?o.debt:0,g=n?o.collateral:0,_=n?o.call_price.base.asset_id:t.get("id"),b=this._getTargetCollateralRatio();return a.createElement("tr",{className:"margin-row"},a.createElement("td",{style:Ut},a.createElement(y.rU,{to:`/asset/${e.get("symbol")}`},a.createElement(Ft.Z,{replaceNoneToBts:!1,maxWidth:30,name:e.get("symbol")}),a.createElement(At.Z,{noTip:!0,name:e.get("symbol")}))),a.createElement("td",{style:qt},a.createElement(x.Z,{amount:i,asset:h,hide_asset:!0})),a.createElement("td",{style:qt},a.createElement(x.Z,{amount:u,asset:h,hide_asset:!0})),a.createElement("td",{style:qt,className:"column-hide-medium"},a.createElement(x.Z,{decimalOffset:3,amount:g,asset:_})),n?a.createElement("td",{"data-place":"bottom","data-tip":this._getCRTip(),className:"center-content "+this._getStatusClass()},l?"1:1":S.Z.format_number(this._getCollateralRatio(),2)):a.createElement("td",null),a.createElement("td",null,b&&!l?S.Z.format_number(b,2):null),a.createElement("td",{style:qt},n?a.createElement(Dt.Z,{noTip:!0,balances:(0,m.List)(),debt:{[e.get("id")]:o.debt},collateral:{[t.get("id")]:parseInt(o.collateral,10)},hide_asset:!0}):null),a.createElement("td",{style:qt,className:"column-hide-small"},n?l?"-":a.createElement(ae.Z,{base_amount:g,base_asset:t.get("id"),quote_amount:u*(d/1e3),quote_asset:e.get("id"),hide_symbols:!0}):null),a.createElement("td",{style:qt,className:"column-hide-small"},n?l?"1":a.createElement(ae.Z,{base_amount:L.Z.extractRawFeedPrice(e).getIn(["base","amount"]),base_asset:o.call_price.quote.asset_id,quote_amount:L.Z.extractRawFeedPrice(e).getIn(["quote","amount"]),quote_asset:o.call_price.base.asset_id,hide_symbols:!0}):null),a.createElement("td",{className:"center-content column-hide-small",style:Ut},n?a.createElement(ae.Z,{base_amount:o.call_price.base.amount,base_asset:o.call_price.base.asset_id,quote_amount:o.call_price.quote.amount,quote_asset:o.call_price.quote.asset_id,hide_value:!0}):null),a.createElement("td",{style:{textAlign:"center"}},a.createElement(y.rU,{to:`/market/${e.get("symbol")}_${t.get("symbol")}`},a.createElement(V.Z,{name:"trade",title:"icons.trade.trade",className:"icon-14px",style:{marginRight:5}}))),a.createElement("td",null,p?a.createElement(O.Tooltip,{placement:"left",title:M().translate("tooltip.borrow_disabled",{asset:r?`gp${e.get("symbol")}`:`${e.get("symbol")}`})},a.createElement("div",{style:{paddingBottom:5}},a.createElement(O.Icon,{type:"question-circle"}))):a.createElement(O.Tooltip,{placement:"left",title:M().translate("tooltip.update_position")},a.createElement("div",{style:{paddingBottom:5}},a.createElement("a",{onClick:this._onUpdatePosition.bind(this)},a.createElement(V.Z,{name:"adjust",title:"icons.adjust",className:"icon-14px rotate90"}))))),a.createElement("td",null,n?a.createElement("div",{"data-place":"left","data-tip":M().translate("tooltip.close_position",{amount:S.Z.get_asset_amount(o.debt,this.props.debtAsset),asset:e.get("symbol")}),style:{paddingBottom:5}},a.createElement("a",{onClick:this._onClosePosition.bind(this)},a.createElement(V.Z,{name:"cross-circle",title:"icons.cross_circle.close_position",className:"icon-14px"}))):null,e?a.createElement(Vt.Z,{visible:this.state.isBorrowModalVisible,showModal:this.showBorrowModal.bind(this),hideModal:this.hideBorrowModal.bind(this),ref:this.state.modalRef,modalId:this.state.modalRef,quoteAssetObj:h,backingAssetObj:e.getIn(["bitasset","options","short_backing_asset"]),accountObj:this.props.account}):null))}}const Wt=jt=(0,c.Z)(jt);var zt=s(58466);function Kt(){return Kt=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},Kt.apply(this,arguments)}const Jt={textAlign:"right"},Gt={textAlign:"left"};class Ht extends a.Component{static propTypes={callOrders:l.Z.ChainObjectsList};constructor(e){super(e),this.state={assetsPropsCount:0,ordersJson:""}}static getDerivedStateFromProps(e,t){const s=JSON.stringify(e.callOrders);if(null==t||t.assetsPropsCount!=e.bitAssets.length||t.ordersJson!=s){let t=new Array,a={},n=0;return e.bitAssets.forEach((e=>{a[e.get("id")]=n++,t.push({asset:e,has_margin_order:!1})})),e.callOrders.length>0&&e.callOrders.forEach((e=>{if(e){let s=e.getIn(["call_price","quote","asset_id"]);if(null==a[s]){let i=K.ChainStore.getObject(s);void 0!==i&&(a[s]=n++,t.push({asset:i,has_margin_order:!0,order:e}))}else t[a[s]].has_margin_order=!0,t[a[s]].order=e}})),{assetsPropsCount:e.bitAssets.length,assets:t,ordersJson:s}}return t}render(){let{account:e}=this.props,t=this.state.assets.sort(((e,t)=>{if(e.has_margin_order&&t.has_margin_order)return t.order.get("debt")-e.order.get("debt");if(e.has_margin_order||t.has_margin_order)return e.has_margin_order?-1:1;{let s=1*e.asset.get("id").replace("1.3.",""),a=1*t.asset.get("id").replace("1.3.","");if(-1!==(0,ye.P_)().rudex.indexOf(e.asset.get("symbol"))&&-1!==(0,ye.P_)().rudex.indexOf(t.asset.get("symbol")))return s-a;if(-1!==(0,ye.P_)().rudex.indexOf(e.asset.get("symbol"))||-1!==(0,ye.P_)().rudex.indexOf(t.asset.get("symbol")))return-1!==(0,ye.P_)().rudex.indexOf(e.asset.get("symbol"))?-1:1;if(-1!==(0,ye.P_)().listed.indexOf(e.asset.get("symbol"))||-1!==(0,ye.P_)().listed.indexOf(t.asset.get("symbol")))return-1!==(0,ye.P_)().listed.indexOf(e.asset.get("symbol"))?-1:1;let n=S.Z.replaceName(e.asset),i=S.Z.replaceName(t.asset);return null!=n.prefix&&n.prefix,n.name,null!=i.prefix&&i.prefix,i.name,!1}})).map((t=>{let s,n,i=null;if(t.has_margin_order){let e=t.order;s=e.getIn(["call_price","quote","asset_id"]),n=e.getIn(["call_price","base","asset_id"]),i=e.get("id")}else s=t.asset.get("id"),n=t.asset.getIn(["bitasset","options","short_backing_asset"]);return a.createElement(Wt,Kt({key:t.asset.get("id"),object:i,account:e,debtAsset:s,collateralAsset:n},this.props))}));return a.createElement("tbody",null,t)}}Ht=(0,c.Z)(Ht),Ht=(0,D.Z)(Ht,{propNames:["bitAssets"],defaultProps:{bitAssets:["1.3.27","1.3.36","1.3.37","1.3.38","1.3.35","1.3.34"]},asList:!0});const Qt=({callOrders:e,account:t,className:s,children:n,preferredUnit:i})=>a.createElement("table",{className:"table table-hover "+s},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",{style:Gt},a.createElement(w(),{content:"explorer.asset.title"})),a.createElement("th",{style:Jt},a.createElement(w(),{content:"exchange.balance"})),a.createElement("th",{style:Jt},a.createElement(w(),{content:"transaction.borrow_amount"})),a.createElement("th",{style:Jt,className:"column-hide-medium"},a.createElement(w(),{content:"transaction.collateral"})),a.createElement("th",null,a.createElement(O.Popover,{placement:"top",title:M().translate("header.collateral_ratio"),content:M().translate("tooltip.coll_ratio")},a.createElement(w(),{content:"borrow.coll_ratio"}))),a.createElement("th",null,a.createElement(O.Popover,{placement:"top",content:a.createElement("div",{style:{width:"600px"}},M().translate("borrow.target_collateral_ratio_explanation")),title:M().translate("borrow.target_collateral_ratio")},a.createElement(w(),{content:"borrow.target_collateral_ratio_short"}))),a.createElement("th",{style:Jt},a.createElement(zt.Z,{noLink:!0,string:"account.total",keys:[{type:"asset",value:i,arg:"asset"}]})),a.createElement("th",{style:Jt,className:"column-hide-small"},a.createElement(O.Popover,{placement:"top",content:M().translate("tooltip.call_price")},a.createElement(w(),{content:"exchange.call"}))),a.createElement("th",{style:Jt,className:"column-hide-small"},a.createElement(O.Popover,{placement:"top",content:M().translate("tooltip.feed_price")},a.createElement(w(),{content:"exchange.feed_price"}))),a.createElement("th",{className:"column-hide-small",style:Gt},a.createElement(w(),{content:"explorer.assets.units"})),a.createElement("th",{style:{textAlign:"center"}},a.createElement(w(),{content:"exchange.market"})),a.createElement("th",null,a.createElement(w(),{content:"borrow.adjust_short"})),a.createElement("th",null,a.createElement(w(),{content:"transfer.close"})))),a.createElement(Ht,{account:t,callOrders:h().List(e)}),a.createElement("tbody",null,n));var Xt=s(53528),Yt=s(47449),$t=s(68652);let es=function(e){this.id=e.toJS?e.get(0):e[0],this.weight=e.toJS?e.get(1):e[1],this.isAvailable=e=>e.includes?e.includes(this.id):-1!==e.indexOf(this)};const ts={AccountPermission:function(e,t,s){this.id=e.get("id"),this.weight=t,this.threshold=e.getIn([s,"weight_threshold"]),this.accounts=[],this.keys=e.getIn([s,"key_auths"]).map((e=>new es(e))).toArray(),this.isAvailable=e=>e.includes?e.includes(this.id):-1!==e.indexOf(this),this._sumWeights=e=>{if(this.isNested()||this.isMultiSig()){let t=this.accounts.reduce(((t,s)=>t+(s._sumWeights(e)?s.weight:0)),0);return Math.floor(t/this.threshold)}return this.isAvailable(e)?this.weight:0},this.getStatus=(e,t)=>{if(this.isNested()){let s=this.accounts.reduce(((t,s)=>t+s._sumWeights(e)),0);return this.keys.length&&(s+=this.sumKeys(t)),s}{let s=this._sumWeights(e);return this.isMultiSig()&&(s+=this.sumKeys(t)),s}},this.sumKeys=e=>this.keys.reduce(((t,s)=>t+(s.isAvailable(e)?s.weight:0)),0),this.isNested=()=>this.accounts.length>0,this.isMultiSig=()=>this.keys.reduce(((e,t)=>e||t.weight<this.threshold),!1),this.getMissingSigs=e=>{let t=[],s=[];return this.isNested()?s=this.accounts.reduce(((t,s)=>t.concat(s.getMissingSigs(e))),[]):this.isAvailable(e)||t.push(this.id),t.concat(s)},this.getMissingKeys=e=>{let t=[],s=[];return this.keys.length&&(this.isNested()||this.isMultiSig())&&this.keys.forEach((s=>{s.isAvailable(e)||t.push(s.id)})),this.isNested()&&(s=this.accounts.reduce(((t,s)=>t.concat(s.getMissingKeys(e))),[])),t.concat(s)}},listToIDs:function(e){let t=[];return e.forEach((e=>{e&&t.push(e.get?e.get("id"):e)})),t},unravel:function(e,t,s=0){if(s<3){let a=K.ChainStore.getAccount(e.id);a&&a.getIn([t,"account_auths"]).size&&a.getIn([t,"account_auths"]).forEach((a=>{let n=K.ChainStore.getAccount(a.get(0));n&&e.accounts.push(this.unravel(new this.AccountPermission(n,a.get(1),t),t,s+1))}))}return e},unnest:function(e,t){let s=[];return e.forEach((e=>{let a=K.ChainStore.getAccount(e);if(!a)return;let n=this.unravel(new this.AccountPermission(a,null,t),t);s.push(n)})),s},flatten_auths:(e,t=h().List())=>e.size?(e.forEach((e=>{t.includes(e.get(0))||(t=t.push(e.get(0)))})),t):t};class ss extends a.Component{render(){const{className:e,children:t,dataTip:s,content:n}=this.props;return a.createElement(O.Tooltip,{title:s&&s.trim()||M().translate(n)},a.createElement("span",{className:"tooltip "+e},t))}}const as=()=>a.createElement(ss,{className:"error appended",content:"explorer.proposals.authority_depth_warning"},"/!\\"),ns=()=>a.createElement(ss,{className:"error appended",content:"explorer.proposals.children_authority_depth_warning"},"/!\\"),is=()=>a.createElement(ss,{className:"warning",content:"explorer.proposals.pending_approval"},a.createElement(w(),{content:"explorer.proposals.pending"})),os=()=>a.createElement(ss,{className:"warning",content:"explorer.proposals.pending_review"},a.createElement(w(),{content:"explorer.proposals.review"})),rs=({reason:e})=>a.createElement(ss,{className:"error",dataTip:e,content:"explorer.proposals.no_reason_available_switch_node"},a.createElement(w(),{content:"explorer.proposals.failed"})),ls=({onToggle:e,expanded:t})=>a.createElement("a",{className:"expand-button",onClick:e},"[",t?"-":"+","]"),cs=({approved:e})=>e?a.createElement(V.Z,{name:"checkmark-circle",size:"1x",className:"success",title:"icons.checkmark_circle.operation_succeed"}):a.createElement(V.Z,{name:"cross-circle",size:"1x",className:"error",title:"icons.cross_circle.operation_failed"}),ds=({available:e,permission:t,weight:s,level:n})=>a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{colSpan:"2"},a.createElement(cs,{approved:t.isAvailable(e)}),t.id.substr(0,20-4*n),"..."),a.createElement("td",null,s))),ps=(e,t,s=0)=>s>e||!(!t.isNested()&&!t.isMultiSig())&&t.accounts.some((t=>ps(e,t,s+1))),ms=(e,t,s)=>e.isNested()||e.isMultiSig()?((e,t,s)=>e.accounts.reduce(((e,a)=>e+(ms(a,t,s)?a.weight:0)),0)+e.keys.reduce(((e,t)=>e+(t.isAvailable(s)?t.weight:0)),0))(e,t,s)>=e.threshold:e.isAvailable(t),hs=(e,t,s)=>e&&e.threshold>10?`${S.Z.get_percentage(e.getStatus(t,s),e.threshold)} / 100%`:`${e.getStatus(t,s)} / ${e.threshold}`,us=(e,t)=>t&&t>10?S.Z.get_percentage(e,t):e;function gs(){return gs=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},gs.apply(this,arguments)}class _s extends a.Component{constructor(e){super(e),this.state={expanded:!!e.expanded}}static propTypes={account:l.Z.ChainAccount.isRequired,accounts:l.Z.ChainAccountsList,level:v().number.isRequired};static defaultProps={level:0};handleExpandToggle=()=>{this.setState({expanded:!this.state.expanded})};render(){const{account:e,available:t,availableKeys:s,permission:n,threshold:i,level:o,maxAuthorityDepth:r,hideRoot:l}=this.props,{expanded:c}=this.state,d=ms(n,t,s),p=n.isNested(),m=n.isMultiSig(),h=us(n.weight,i)||1,u=hs(n,t,s),g=o>=r,_=p||m?a.createElement("tr",null,a.createElement("td",{colSpan:"2"},a.createElement(cs,{approved:d}),a.createElement(ne.Z,{subpage:"permissions",account:e.get("id")})),a.createElement("td",null,c?a.createElement("span",{className:d?"success-text":""},h):h&&`${h&&2===h.length?" ":""}${h} `,a.createElement(ls,{onToggle:this.handleExpandToggle,expanded:c}),c&&a.createElement("span",{className:"appended"},"(",u,")"),g?a.createElement(as,null):ps(r,n,o)&&!c&&a.createElement(ns,null))):a.createElement("tr",null,a.createElement("td",{colSpan:"2"},a.createElement(cs,{approved:d}),a.createElement(ne.Z,{subpage:"permissions",account:e.get("id")})),a.createElement("td",null,!p&&h?`${h&&2===h.length?" ":""}${h} `:null)),b=[];return(p||m)&&c&&(n.accounts.forEach((e=>{b.push(a.createElement(bs,{key:e.id,account:e.id,accounts:e.accounts,permission:e,available:t,availableKeys:s,threshold:n.threshold,level:o+1,maxAuthorityDepth:r}))})),n.keys.length&&n.keys.forEach((e=>b.push(a.createElement(ds,{key:e.id,permission:e,available:s,level:o+(l?0:1),weight:us(e.weight,i)}))))),b.length>0?a.createElement("tbody",null,l||_,a.createElement("tr",null,a.createElement("td",{colSpan:"3",className:"heading-perm"},a.createElement("div",{className:l?"":"table-container"},a.createElement("table",null,b)),c&&0===o&&a.createElement("div",{className:"spacer"})))):a.createElement("tbody",null,_)}}const bs=(0,c.Z)(_s);class Es extends a.Component{static propTypes={required:l.Z.ChainAccountsList,available:l.Z.ChainAccountsList};static defaultProps={type:"active",added:null,removed:null};constructor(e){super(e),this.state={requiredPermissions:[],expanded:e.expanded},this._updateState=this._updateState.bind(this)}UNSAFE_componentWillMount(){this._updateState(),K.ChainStore.subscribe(this._updateState)}componentWillUnmount(){K.ChainStore.unsubscribe(this._updateState)}_updateState(){let e=ts.listToIDs(this.props.required),t=ts.listToIDs(this.props.available);this.setState({requiredPermissions:ts.unnest(e,this.props.type),required:e,available:t})}handleExpandToggle=()=>this.setState({expanded:!this.state.expanded});render(){let{type:e,added:t,removed:s,availableKeys:n,globalObject:i,reviewPeriodTime:o,noFail:r,failReason:l}=this.props,{requiredPermissions:c,required:d,available:p,expanded:m}=this.state;p=(0,$t.Z)(p),n=n.toJS(),t&&(p.push(t),n.push(t)),s&&(-1!==p.indexOf(s)&&p.splice(p.indexOf(s),1),-1!==n.indexOf(s)&&n.splice(n.indexOf(s),1));const h=c.reduce(((e,t)=>e+(ms(t,p,n)?1:0)),0),u=c.length,g=h===u,_=g&&!o&&!r,b=g&&o,E=i.get("parameters").get("max_authority_depth"),v=1===c.length,y=v?c[0]:null,f=!v&&`${h} / ${u}`,w=c.map((e=>a.createElement(bs,{key:e.id,account:e.id,accounts:e.accounts,permission:e,available:p,availableKeys:n,expanded:this.props.expanded||v,level:0,maxAuthorityDepth:E,hideRoot:v})));return a.createElement("div",{className:"nested-approval-state"},a.createElement("div",{className:"root-status"},_?a.createElement(rs,{reason:l}):b?a.createElement(os,null):a.createElement(is,null)," ",y?y.threshold>1&&hs(y,p,n):a.createElement("span",null,"(",f,")"),(!y||y.isMultiSig()||y.isNested())&&a.createElement(ls,{onToggle:this.handleExpandToggle,expanded:m}),!m&&c.some((e=>ps(E,e,0)))&&a.createElement(ns,null)),m&&a.createElement("table",null,w))}}Es=(0,c.Z)(Es);class vs extends a.Component{static propTypes={proposal:l.Z.ChainObject.isRequired,type:v().string.isRequired,globalObject:l.Z.ChainObject.isRequired};static defaultProps={type:"active",added:null,globalObject:"2.0.0"};render(){let{proposal:e,type:t}=this.props,s=e.get(`available_${t}_approvals`),n=e.get("available_key_approvals"),i=e.get(`required_${t}_approvals`),o=e.get("fail_reason")||" ";return a.createElement(Es,gs({},this.props,{required:i,available:s,availableKeys:n,reviewPeriodTime:e.get("review_period_time"),failReason:o}))}}const ys=(0,c.Z)(vs);function fs(){return fs=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},fs.apply(this,arguments)}const ws=(e,t,s)=>{let a=[];e.forEach((e=>{a=a.concat(e.getMissingSigs(t))}));let n=[];return e.forEach((e=>{n=n.concat(e.getMissingKeys(s))})),[a,n]};class ks extends a.Component{static propTypes={accounts:l.Z.ChainAccountsList};constructor(e){super(),this.state={active:null,key:null,owner:null,payee:null}}onActiveAccount(e,t,s,a){let n={};t[a]?(n.key=a,n[s]=null):a?(n[s]=e[a],n.key=null):(n[s]=null,n.key=null),this.setState(n)}_onProposalAction(e){let t=e.toJS(),{active:s,key:a,owner:n,payee:i}=this.state;const o=i||s;if("delete"===this.props.action){const e=pt.Z.new_transaction();e.add_type_operation("proposal_delete",{fee_paying_account:o||this.props.account.get("id"),proposal:t.id,using_owner_authority:!1}),Te.Z.process_transaction(e,null,!0)}else{let e={fee_paying_account:o,proposal:t.id,active_approvals_to_add:[],active_approvals_to_remove:[],owner_approvals_to_add:[],owner_approvals_to_remove:[],key_approvals_to_add:[],key_approvals_to_remove:[]},s="approve"===this.props.action,a=[];["active","owner","key"].forEach((n=>{let i=this.state[n];if(i){let o=-1!==t[`available_${n}_approvals`].indexOf(i);(s&&!o||!s&&o)&&("approve"===this.props.action?(e[`${n}_approvals_to_add`]=[i],"key"===n&&a.push(i)):"reject"===this.props.action&&(e[`${n}_approvals_to_remove`]=[i],"key"===n&&a.push(i)))}}));var r=pt.Z.new_transaction();r.add_type_operation("proposal_update",e),Te.Z.process_transaction(r,null,!0,a)}this.props.hideModal()}onChangePayee(e){let t=K.ChainStore.getAccount(e);t&&this.setState({payee:t.get("id")})}onCancel(){this.props.hideModal()}render(){let{proposal:e,type:t}=this.props,s=[],n={},o="approve"===this.props.action;this.props.accounts.length&&this.props.accounts.forEach((a=>{(o?a&&!e.get(`available_${t}_approvals`).includes(a.get("id")):a&&e.get(`available_${t}_approvals`).includes(a.get("id")))&&(n[a.get("name")]=a.get("id"),s.push(a.get("name")))}));let r=[],l={};this.props.keys.length&&this.props.keys.forEach((t=>{let s=i.Z.isMyKey(t),a=e.get("available_key_approvals").includes(t);(s&&o&&!a||s&&!o&&a)&&(l[t]=!0,r.push(t))}));let c=i.Z.getMyAccounts(),d=[a.createElement(O.Button,{key:"submit",type:"primary",onClick:this._onProposalAction.bind(this,e)},M().translate(`proposal.${this.props.action}`)),a.createElement(O.Button,{key:"cancel",onClick:this.onCancel.bind(this)},M().translate("account.perm.cancel"))];return a.createElement(O.Modal,{visible:this.props.visible,title:M().translate(`modal.proposals.actions.${this.props.action}`),footer:d,onCancel:this.props.hideModal},a.createElement("div",{className:"grid-block vertical"},a.createElement("form",{className:"grid-block vertical full-width-content",style:{paddingTop:0}},a.createElement("div",{className:"grid-container"},a.createElement("div",{className:"content-block",style:{paddingRight:"20%"}},a.createElement(ys,{expanded:!0,proposal:e.get("id"),type:t,added:o?this.state.key?this.state.key:this.state[t]||null:null,removed:o?null:this.state.key?this.state.key:this.state[t]||null,noFail:!0})),a.createElement("div",{className:"content-block full-width-content"},a.createElement("div",{className:"full-width-content form-group"},a.createElement(w(),{content:"modal.proposals.pay_with",component:"label"}),a.createElement(Yt.Z,{account_names:c,onChange:this.onChangePayee.bind(this),selected:1===c.length?c:null})),"delete"!==this.props.action&&(s.length||r.length)?a.createElement("div",{className:"full-width-content form-group"},a.createElement(w(),{content:"modal.proposals.approval_"+(o?"add":"remove"),component:"label"}),a.createElement(Yt.Z,{account_names:s.concat(r),onChange:this.onActiveAccount.bind(this,n,l,t)})):null,null)))))}}ks=(0,c.Z)(ks);class Cs extends a.Component{static propTypes={account:l.Z.ChainAccount.isRequired,proposal:l.Z.ChainObject.isRequired};constructor(){super(),this._updateState=this._updateState.bind(this)}UNSAFE_componentWillMount(){this._updateState(),K.ChainStore.subscribe(this._updateState)}componentWillUnmount(){K.ChainStore.unsubscribe(this._updateState)}_updateState(){let{proposal:e,account:t}=this.props,s=e.get("required_active_approvals").size?"active":"owner",a=ts.listToIDs(e.get(`required_${s}_approvals`)),n=ts.listToIDs(e.get(`available_${s}_approvals`)),i=ts.listToIDs(e.get("available_key_approvals"));this.setState({requiredPermissions:ts.unnest(a,s),available:n,availableKeys:i,type:s})}render(){let{action:e}=this.props,{requiredPermissions:t,available:s,availableKeys:n,type:i}=this.state;const[o,r]=ws(t,s,n);return a.createElement(ks,fs({},this.props,{type:i,accounts:"approve"===e?o:s,keys:"approve"===e?r:n}))}}Cs=(0,c.Z)(Cs);class xs extends a.Component{render(){return this.props.account&&this.props.proposal&&this.props.action?a.createElement(Cs,this.props):null}}var As=s(91410);const{operations:Ss}=K.ChainTypes,Ns=Object.keys(Ss);class Ms extends a.Component{static propTypes={account:l.Z.ChainAccount.isRequired};constructor(){super(),this.state={isModalVisible:!1,modal:{action:null,proposalId:null,accountId:null},visibleId:""},this._proposals=[],this._loading=!1,this.forceUpdate=this.forceUpdate.bind(this),this._isScam=this._isScam.bind(this),this._isUnknown=this._isUnknown.bind(this),this.showModal=this.showModal.bind(this),this.hideModal=this.hideModal.bind(this)}componentDidMount(){K.ChainStore.subscribe(this.forceUpdate)}_setProposals(){this._loading=!0;let e=this.props.account;if(e.get("proposals").size){let t=[];e.get("proposals").forEach((s=>{let a=K.ChainStore.getObject(s);if(a){let s=a.get("proposed_transaction").get("operations");t.push({operations:s,account:e,proposal:a})}})),t=t.sort(((e,t)=>S.Z.sortID(e.proposal.get("id"),t.proposal.get("id"),!0))),t.forEach((e=>{let t=e.proposal.get("required_active_approvals").size?"active":"owner";const s=ts.listToIDs(e.proposal.get(`required_${t}_approvals`));e.requiredPermissions=ts.unnest(s,t)})),this._proposals=t,this._loading=!1}}componentWillUnmount(){K.ChainStore.unsubscribe(this.forceUpdate)}showModal({action:e,proposalId:t,accountId:s}){this.setState({isModalVisible:!0,modal:{action:e,proposalId:t,accountId:s}})}hideModal(){this.setState({isModalVisible:!1,modal:{action:null,proposalId:null,accountId:null}})}_onApproveModal(e,t,s){this.showModal({action:s,proposalId:e,accountId:t})}_canReject(e){return e.available_active_approvals.length||e.available_owner_approvals.length||e.available_key_approvals.length}_isScam(e){let t=!1,s=[];e.operations.forEach((e=>{6==e.get(0)?(s.push(e.getIn([1,"active","account_auths",0,0])),s.push(e.getIn([1,"owner","account_auths",0,0]))):s.push(e.getIn([1,"to"]))}));let a=e.proposal.get("proposer");return s.push(a),s.forEach((e=>{p.Z.isKnownScammer(e)&&(t=!0),this.props.account.get("blacklisted_accounts").some((t=>t===e))&&(t=!0)})),t}_isUnknown(e){let t=!0,s=[];e.operations.forEach((e=>{6==e.get(0)?(s.push(e.getIn([1,"active","account_auths",0,0])),s.push(e.getIn([1,"owner","account_auths",0,0]))):s.push(e.getIn([1,"to"]))}));let a=e.proposal.get("proposer");return s.push(a),s.forEach((e=>{this.props.account.get("whitelisted_accounts").some((t=>t===e))&&(t=!1),i.Z.getState().starredAccounts.some((t=>{let s=K.ChainStore.getAccount(t,!1);return!!s&&s.get("id")==e}))&&(t=!1),i.Z.getState().accountContacts.some((t=>{let s=K.ChainStore.getAccount(t,!1);return!!s&&s.get("id")==e}))&&(t=!1)})),t}openJSONModal(e){this.setState({visibleId:e})}closeJSONModal=()=>{this.setState({visibleId:""})};render(){let{account:e}=this.props;if(!e)return null;(e.get("proposals").size>0&&0==this._proposals.length||this._proposals.length>0&&e!==this._proposals[0].account&&!this._loading)&&this._setProposals();let t=this._proposals.reduce(((e,t,s)=>{const n=t.proposal.get("id"),o=t.proposal.get("proposer"),r=t.proposal.get("expiration_time"),l=M().translate("transaction.trxTypes"),c=t.operations&&t.operations.toJS(),d=c.length>1?M().translate("transaction.operations"):l[Ns[c[0]&&c[0][0]]];let p=t.operations.map(((e,s)=>a.createElement(Xt.Z,{key:t.proposal.get("id")+"_operation_"+s,expiration:r,index:s,op:e.toJS(),inverted:!1,hideFee:!0,hideOpLabel:!0,hideExpiration:!0,hideDate:!0,proposal:!0,id:n,proposer:o,collapsed:!1}))).toArray(),m=this._canReject(t.proposal.toJS()),h=t.proposal.get("id"),u=t.proposal.get("required_active_approvals").size?"active":"owner";e.push(a.createElement("tr",{key:`${h}_id`},a.createElement("td",{colSpan:"4",className:"proposal"+(0===s?" first":"")},a.createElement(Xt.h,{id:n,expiration:r,openJSONModal:()=>this.openJSONModal(n)}),a.createElement(As.Z,{visible:this.state.visibleId===n,operation:c.length>1?c:c[0]&&c[0][1],title:d||"",hideModal:this.closeJSONModal}))));const g=ts.listToIDs(t.proposal.get(`available_${u}_approvals`)),_=ts.listToIDs(t.proposal.get("available_key_approvals"));let b=t.requiredPermissions;const[E,v]=ws(b,g,_),y=[];E.length&&E.forEach((e=>{e&&!t.proposal.get(`available_${u}_approvals`).includes(e)&&y.push(e)}));const f=[];v.length&&v.forEach((e=>{i.Z.isMyKey(e)&&!t.proposal.get("available_key_approvals").includes(e)&&f.push(e)}));const k=y.length+f.length>0;let C=this._isScam(t),x=this._isUnknown(t);return e.push(a.createElement("tr",{className:"top-left-align",key:`${h}_content`},a.createElement("td",null,p),a.createElement("td",null,b.map(((e,t)=>a.createElement("div",{className:"list-item",key:`${h}_approver_${t}`},a.createElement(ne.Z,{subpage:"permissions",account:e.id}))))),a.createElement("td",null,a.createElement(ys,{proposal:t.proposal.get("id"),type:u})),a.createElement("td",{className:"approval-buttons"},C&&a.createElement(O.Tooltip,{title:M().translate("tooltip.propose_scam")},a.createElement("div",{className:"tooltip has-error scam-error"},"SCAM ATTEMPT")),this.props.hideFishingProposals&&!C&&x&&a.createElement(O.Tooltip,{title:M().translate("tooltip.propose_unknown")},a.createElement("div",{className:"tooltip has-error scam-error"},"UNKNOWN SOURCE")),!C&&(!x||!this.props.hideFishingProposals)&&a.createElement("button",{onClick:k?this._onApproveModal.bind(this,h,t.account.get("id"),"approve"):()=>{},className:"button primary hollow"+(k?"":" hidden")},a.createElement("span",null,a.createElement(w(),{content:"proposal.approve"}))),m?a.createElement("button",{onClick:this._onApproveModal.bind(this,h,t.account.get("id"),"reject"),className:"button primary hollow"},a.createElement(w(),{content:"proposal.reject"})):null,a.createElement("button",{onClick:this._onApproveModal.bind(this,h,t.account.get("id"),"delete"),className:"button primary hollow"},a.createElement(w(),{content:"proposal.delete"}))))),e.push(a.createElement("tr",{key:`${h}_separator`},a.createElement("td",{colSpan:"4"},a.createElement("hr",null)))),e}),[]);return a.createElement("div",null,a.createElement("table",{className:"table proposals compact "+this.props.className},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,a.createElement(w(),{content:"proposal.proposals"})),a.createElement("th",null,a.createElement(w(),{content:"proposal.approvers"})),a.createElement("th",null,a.createElement(w(),{content:"proposal.status"})),a.createElement("th",null,a.createElement(w(),{content:"proposal.action"})))),a.createElement("tbody",null,t)),a.createElement(xs,{ref:"modal",visible:this.state.isModalVisible,hideModal:this.hideModal,showModal:this.showModal,account:this.state&&this.state.modal.accountId,proposal:this.state&&this.state.modal.proposalId,action:this.state&&this.state.modal.action}))}}const Is=(0,c.Z)(Ms);var Zs=s(61324);const Ps=function(e,t){for(var s,a=-1,n=e.length;++a<n;){var i=t(e[a]);void 0!==i&&(s=void 0===s?i:s+i)}return s},Os=function(e,t){return function(e,t){var s=null==e?0:e.length;return s?Ps(e,t)/s:NaN}(e,(0,Zs.Z)(t,2))},Bs=function(e,t){return e&&e.length?Ps(e,(0,Zs.Z)(t,2)):0};var Ts=s(74752);const Rs=function(e,t,s,a){for(var n=-1,i=null==e?0:e.length;++n<i;){var o=e[n];t(a,o,s(o),e)}return a};var Ls=s(54356);const Ds=function(e,t,s,a){return(0,Ls.Z)(e,(function(e,n,i){t(a,e,s(e),i)})),a};var Fs=s(19475);var Vs=Object.prototype.hasOwnProperty;const qs=(Us=function(e,t,s){Vs.call(e,s)?e[s].push(t):(0,Ts.Z)(e,s,[t])},function(e,t){var s=(0,Fs.Z)(e)?Rs:Ds,a=js?js():{};return s(e,Us,(0,Zs.Z)(t,2),a)});var Us,js,Ws=s(22463),zs=s(74366),Ks=s(5833);class Js extends a.Component{render(){let{base:e,quote:t,order:s}=this.props;const n=s.isBid();let i=n?"value positive":"value negative",o=n?"value negative":"value positive";return a.createElement(w(),{content:n?"exchange.buy_description":"exchange.sell_description",baseAsset:S.Z.format_number(s[n?"amountToReceive":"amountForSale"]().getAmount({real:!0}),e.get("precision"),!1),quoteAsset:S.Z.format_number(s[n?"amountForSale":"amountToReceive"]().getAmount({real:!0}),t.get("precision"),!1),baseName:a.createElement(At.Z,{noTip:!0,customClass:i,name:t.get("symbol")}),quoteName:a.createElement(At.Z,{noTip:!0,customClass:o,name:e.get("symbol")})})}}const Gs=Js;var Hs=s(73935);function Qs(){return Qs=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},Qs.apply(this,arguments)}class Xs extends a.Component{constructor(e){super(e),this.state={isCollapsed:e.isCollapsed||!1,isCollapseAnimationCompleted:e.isCollapsed||!1}}componentDidMount(){let e=Hs.findDOMNode(this).querySelector(".ant-table-tbody"),t=()=>{this.setState({isCollapseAnimationCompleted:this.state.isCollapsed})};e.addEventListener("animationend",t),e.addEventListener("webkitAnimationEnd",t),e.addEventListener("oAnimationEnd",t),e.addEventListener("MSAnimationEnd",t)}render(){return a.createElement(O.Table,Qs({},this.props,{onHeaderRow:(e,t)=>{let s={},a=this.props.onHeaderRow;return a&&(s=a(e,t)),s.onClick=s=>{let n=s.target.getAttribute("class");if((!n||!n.includes("ant-checkbox-input"))&&(this.setState({isCollapsed:!this.state.isCollapsed}),this.setState({isCollapseAnimationCompleted:!1}),a)){let n=a(e,t);n.onClick&&n.onClick(s)}},s},className:`collapsible-table ${this.state.isCollapsed?"collapsible-table-collapsed":"collapsible-table-uncollapsed"}\n ${this.state.isCollapseAnimationCompleted?"collapsible-table-collapsed-animation-completed":null}`}))}}const Ys=Xs;var $s=s(62254),ea=s(12326);class ta extends a.Component{constructor(e){super(),this.statsInterval=null;const{marketName:t}=Ks.Z.getMarketName(e.base,e.quote);this.state={marketName:t}}_checkStats(e={close:{}},t={close:{}}){return e.volumeBase!==t.volumeBase||!S.Z.are_equal_shallow(e.close&&e.close.base,t.close&&t.close.base)||!S.Z.are_equal_shallow(e.close&&e.close.quote,t.close&&t.close.quote)}shouldComponentUpdate(e){return this._checkStats(e.allMarketStats.get(this.state.marketName),this.props.allMarketStats.get(this.state.marketName))||e.base.get("id")!==this.props.base.get("id")||e.quote.get("id")!==this.props.quote.get("id")}componentWillUnmount(){this.statsInterval&&this.statsInterval()}}class sa extends ta{constructor(e){super(e)}shouldComponentUpdate(e){return super.shouldComponentUpdate(e)}render(){let{allMarketStats:e}=this.props;const{marketName:t}=this.state,s=e.get(t);let n=s&&s.price?s.price:null;return a.createElement("span",{className:W()("",this.props.className)},n?a.createElement(ae.Z,{base_amount:n.base.amount,base_asset:n.base.asset_id,quote_amount:n.quote.amount,quote_asset:n.quote.asset_id,force_direction:this.props.force_direction,hide_symbols:this.props.hide_symbols}):"n/a")}}sa=(0,D.Z)(sa,{propNames:["quote","base"]});class aa extends a.Component{render(){return a.createElement(sa,this.props)}}aa=(0,d.$)(aa,{listenTo:()=>[ea.Z],getProps:()=>({allMarketStats:ea.Z.getState().allMarketStats})});class na extends a.Component{constructor(e){super(e),this.state={selectedOrders:[],filterValue:"",areAssetsGrouped:e.viewSettings.get("accountOrdersGrouppedByAsset")}}_getFilteredOrders(e){let{filterValue:t}=this.state;return(("settle"!==e?this.props.account.get("orders"):this.props.settleOrders)||[]).filter((e=>{let s=K.ChainStore.getObject(e).toJS(),a=K.ChainStore.getAsset(s.sell_price.base.asset_id),n=K.ChainStore.getAsset(s.sell_price.quote.asset_id),i=a.get("symbol").toLowerCase(),o=n.get("symbol").toLowerCase();return i.indexOf(t)>-1||o.indexOf(t)>-1}))}_getDataSource(e,t){let s=[];const a="settle"===t;return e.forEach((e=>{let t=null,n=null,i=null,o=null,r=null,l=null;if(a?(t=K.ChainStore.getObject(e).toJS(),n=K.ChainStore.getAsset(t.balance.asset_id),i=K.ChainStore.getAsset(n.getIn(["bitasset","options","short_backing_asset"]))):(t=K.ChainStore.getObject(e).toJS(),n=K.ChainStore.getAsset(t.sell_price.base.asset_id),i=K.ChainStore.getAsset(t.sell_price.quote.asset_id)),n&&i){let e={[n.get("id")]:{precision:n.get("precision")},[i.get("id")]:{precision:i.get("precision")}};const{marketName:c}=Ks.Z.getMarketName(n,i),d=this.props.marketDirections.get(c);let p=d?i.get("id"):n.get("id"),m=d?n.get("id"):i.get("id");if(a){const t=L.Z.extractRawFeedPrice(n);o=n.getIn(["bitasset","current_feed","maximum_short_squeeze_ratio"]),r=new zs.ad({priceObject:t,market_base:m,sqr:o,assets:e}),l=n.getIn(["bitasset","options"])}let h=a?new zs.l4(t,e,m,r,l):new zs.eN(t,e,p),u=K.ChainStore.getAsset(m),g=K.ChainStore.getAsset(p),_=h.isBid(),b={key:t.id,order:h,isBid:_,quote:g,base:u,marketName:c,marketDirection:d,preferredUnit:this.props.settings?this.props.settings.get("unit"):"1.3.0",quoteColor:_?"value positive":"value negative",baseColor:_?"value negative":"value positive"};a&&(b={...b,settlement_date:t.settlement_date,feed_price:r}),s.push(b)}})),s.sort(((e,t)=>e.order.getPrice()-t.order.getPrice())),s.sort(((e,t)=>e.marketName>t.marketName?1:e.marketName<t.marketName?-1:e.marketDirection?1:-1)),s}_getColumns(e,t,s){let n,i,o,r,l,c,d,p,m,h,u=(e,t)=>({onClick:this.onFlip.bind(this,e.marketName)});const g="settle"===s;let _=e=>e.order[e.isBid?"amountToReceive":"amountForSale"]().getAmount({real:!0}),b=e=>S.Z.format_number(e,n.base.get("precision"),!1),E=e=>e.order[e.isBid?"amountForSale":"amountToReceive"]().getAmount({real:!0}),v=e=>S.Z.format_number(e,n.quote.get("precision"),!1),f=e=>a.createElement(aa,{base:e.base.get("id"),quote:e.quote.get("id"),force_direction:e.base.get("symbol"),hide_symbols:!0,hide_asset:!0});if(e){n=t[0],i=M().translate("exchange."+(g?"settlement_of":n.isBid?"buy":"sell")),o=M().translate("transaction.for"),r=b(Bs(t,_)),l=v(Bs(t,E));let e=n.isBid?"value positive":"value negative",s=n.isBid?"value negative":"value positive";c=a.createElement(At.Z,{noTip:!0,customClass:e,name:n.quote.get("symbol")}),d=a.createElement(At.Z,{noTip:!0,customClass:s,name:n.base.get("symbol")}),p=Os(t,(e=>{let t=e.order.sellPrice().toReal(!0);return e.marketDirection?1/t:t}));let u=Math.min(8,n.order.sellPrice()[n.isBid?"base":"quote"].precision);p=a.createElement($s.BK,{value:p,minimumFractionDigits:Math.max(2,u),maximumFractionDigits:Math.max(2,u)}),m=f(n);let y=Bs(t,(e=>e.order.amountForSale().getAmount()));h=a.createElement("div",null,a.createElement(xt.il,{hide_asset:!0,amount:y,fromAsset:n.order.amountForSale().asset_id,noDecimals:!0,toAsset:n.preferredUnit})," ",a.createElement(At.Z,{name:n.preferredUnit}))}return[{key:"trade",title:M().translate("account.trade"),align:"center",render:e=>a.createElement(y.rU,{to:`/market/${e.quote.get("symbol")}_${e.base.get("symbol")}`,onClick:()=>Ws.Z.switchMarket()},a.createElement(O.Icon,{type:"bar-chart"}))},{key:"orderID",title:M().translate("transaction.order_id"),render:e=>"#"+e.order.id.substring(4)},...e?[{key:"operation",title:i,render:e=>i,onCell:u,className:"clickable groupColumn"},...g?[{key:"quoteAsset",title:l,render:e=>v(E(e)),className:"clickable groupColumn"},{key:"baseName",title:c,render:e=>c,className:"clickable groupColumn"}]:[{key:"baseAsset",title:r,render:e=>b(_(e)),onCell:u,className:"clickable groupColumn"},{key:"baseName",title:c,render:e=>c,onCell:u,className:"clickable groupColumn"},{key:"for",title:o,render:e=>o,onCell:u,className:"clickable groupColumn"},{key:"quoteAsset",title:l,render:e=>v(E(e)),onCell:u,className:"clickable groupColumn"},{key:"quoteName",title:d,render:e=>d,onCell:u,className:"clickable groupColumn"}]]:[{key:"description",title:M().translate("exchange.description"),render:e=>g?a.createElement(w(),{content:"exchange.settlement_description",quoteAsset:S.Z.format_number(e.order.for_sale.getAmount({real:!0}),e.quote.get("precision"),!1),quoteName:a.createElement(At.Z,{noTip:!0,customClass:e.quoteColor,name:e.quote.get("symbol")})}):a.createElement(Gs,e),onCell:u,className:"clickable"}],{key:"price",title:e?a.createElement("div",null,a.createElement(w(),{content:"account.average_price"}),a.createElement("br",null),p):M().translate("exchange.price"),align:e?"right":"left",render:e=>a.createElement(ae.Z,{base_amount:e.order.sellPrice().base.amount,base_asset:e.order.sellPrice().base.asset_id,quote_amount:e.order.sellPrice().quote.amount,quote_asset:e.order.sellPrice().quote.asset_id,force_direction:e.base.get("symbol"),hide_symbols:!0}),onCell:u,className:"clickable"},{key:"marketPrice",title:e?a.createElement("div",null,a.createElement(w(),{content:"exchange.price_market"}),a.createElement("br",null),m):M().translate("exchange.price_market"),align:e?"right":"left",render:f,onCell:u,className:"clickable"},g&&!e?{key:"settlement_date",title:e?a.createElement("div",null,a.createElement(w(),{content:"exchange.settlement_date"}),a.createElement("br",null),m):M().translate("exchange.settlement_date"),align:e?"right":"left",render:e=>a.createElement("span",null,e.settlement_date),onCell:u,className:"clickable"}:{},{key:"value",title:e?a.createElement("div",null,a.createElement(w(),{content:"exchange.value"}),a.createElement("br",null),h):M().translate("exchange.value"),align:"right",render:e=>a.createElement("div",null,a.createElement(xt.il,{hide_asset:!0,amount:e.order.amountForSale().getAmount(),fromAsset:e.order.amountForSale().asset_id,noDecimals:!0,toAsset:e.preferredUnit})," ",a.createElement(At.Z,{name:e.preferredUnit})),onCell:u,className:"clickable"}]}_renderSettleOrdersTable(){const{account:e}=this.props,{filterValue:t}=this.state;let s=e.get("settle_orders");t&&(s=this._getFilteredOrders.call(this,"settle"));let n=this._getDataSource(s,"settle"),i={hideOnSinglePage:!0,pageSize:20,showTotal:(e,t)=>M().translate("utility.total_x_items",{count:e})},o=this._getColumns(!1,n,"settle");return a.createElement(O.Table,{columns:o,dataSource:n,pagination:i,footer:()=>a.createElement("span",null," ")})}_renderOrdersTable(){const{account:e}=this.props,{filterValue:t,areAssetsGrouped:s}=this.state;let n=e.get("orders");t&&(n=this._getFilteredOrders.call(this));const i=this._getDataSource(n);let o={hideOnSinglePage:!0,pageSize:20,showTotal:(e,t)=>M().translate("utility.total_x_items",{count:e})},r=()=>this.props.children,l=this.props.isMyAccount?{onChange:(e,t)=>{this.setState({selectedOrders:e})},selectedRowKeys:this.state.selectedOrders}:null,c=[];if(s){let e=qs(i,(e=>e.marketName+"_"+(e.marketDirection?e.base.get("id"):e.quote.get("id"))));for(let[t,n]of Object.entries(e)){let e;n[0].settlement_date&&(e="settle");let i=this._getColumns(s,n,e);c.push(a.createElement("div",{className:"grid-wrapper",key:t},a.createElement(Ys,{columns:i,dataSource:n,rowSelection:l,pagination:o,isCollapsed:!0})))}}else{let e=this._getColumns(s,i);c.push(a.createElement("div",{className:"grid-wrapper",key:"ungroupedTable"},a.createElement(O.Table,{columns:e,dataSource:i,rowSelection:l,pagination:o,footer:r})))}return c}_getSelectedOrders(e){let t=this.props.account.get("orders").toArray().filter((t=>-1!=e.indexOf(t)));return(0,K.FetchChain)("getObject",t)}_cancelLimitOrders(){this._getSelectedOrders(this.state.selectedOrders).then((e=>{let t=e.toJS().map((e=>e.sell_price.base.asset_id));Ws.Z.cancelLimitOrders(this.props.account.get("id"),this.state.selectedOrders,t).then((()=>{this.resetSelected()})).catch((e=>{console.log("cancel orders error:",e)}))}))}onFlip(e){let t={};t[e]=!this.props.marketDirections.get(e),oe.Z.changeMarketDirection(t)}setFilterValue(e){this.setState({filterValue:e.target.value.toLowerCase()})}resetSelected(){this.setState({selectedOrders:[]})}cancelSelected(){this._cancelLimitOrders.call(this)}render(){const{account:e}=this.props,{selectedOrders:t}=this.state,s=this._renderOrdersTable(),n=this._renderSettleOrdersTable(),i=[s];let o=e.get("settle_orders").size;return a.createElement("div",{className:"grid-content no-overflow no-padding",style:{paddingBottom:15}},a.createElement("div",{className:"header-selector",style:{display:"inline-block",width:"100%"}},a.createElement("div",{className:"filter-block"},a.createElement("div",{className:"filter"},a.createElement(O.Input,{type:"text",placeholder:M().translate("account.filter_orders"),onChange:this.setFilterValue.bind(this),addonAfter:a.createElement(O.Icon,{type:"search"})})),a.createElement("div",{className:"group-by"},a.createElement(O.Switch,{onChange:(e,t)=>{oe.Z.changeViewSetting({accountOrdersGrouppedByAsset:e}),this.setState({areAssetsGrouped:e})},checked:this.state.areAssetsGrouped})," ",a.createElement(w(),{content:"account.group_by_asset"}))),t.length?a.createElement("span",{className:"action-buttons"},a.createElement(O.Button,{key:"submit",type:"primary",onClick:this.cancelSelected.bind(this)},a.createElement(w(),{content:"account.cancel_orders"}))," ",a.createElement(O.Button,{key:"cancel",type:"secondary",onClick:this.resetSelected.bind(this)},a.createElement(w(),{content:"account.reset_orders"}))):null),a.createElement("div",null,o>0&&a.createElement("div",{className:"header-selector"},a.createElement(w(),{content:"account.market_orders"})),i),o>0&&a.createElement("div",{className:"grid-wrapper",key:"settleGroupedTable"},a.createElement("div",{className:"header-selector"},a.createElement(w(),{content:"account.settle_orders"})),n))}}const ia=na=(0,d.$)(na,{listenTo:()=>[o.Z],getProps:()=>({marketDirections:o.Z.getState().marketDirections,viewSettings:o.Z.getState().viewSettings})});let oa={};var ra=s(98107),la=s(10920),ca=s.n(la),da=s(57473),pa=s.n(da),ma=s(1033),ha=s.n(ma),ua=s(59851);function ga(){return ga=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},ga.apply(this,arguments)}pa()(ca().Highcharts),ha()(ca().Highcharts);class _a extends a.Component{static propTypes={assets:l.Z.ChainAssetsList,preferredAsset:l.Z.ChainAsset.isRequired};static defaultProps={assets:[],preferredAsset:"1.3.0"};render(){let{balanceObjects:e,core_asset:t,marketStats:s,preferredAsset:n,history:i}=this.props,o=null;if(e&&e.length>0){let a=0;o=e.forEach((e=>{if(!e)return;let i="string"==typeof e?K.ChainStore.getObject(e):e,o=i.get("asset_type"),r=K.ChainStore.getAsset(o);if(!r||!n)return;let l=Number(i.get("balance"));const c=Ks.Z.convertValue(l,n,r,s,t);if(!c)return;const d=S.Z.get_asset_precision(n.get("precision"));a+=c/d})),o=e.map(((e,i)=>{if(!e)return null;let o="string"==typeof e?K.ChainStore.getObject(e):e,r=o.get("asset_type"),l=K.ChainStore.getAsset(r);if(!l)return null;let c=Number(o.get("balance"));const d=Ks.Z.convertValue(c,n,l,s,t);if(!d)return null;const p=d/S.Z.get_asset_precision(n.get("precision")),m=p/a*100;if(m<.5)return null;if(p<1)return null;const h=l.get("symbol");return{symbol:h,name:`${h} (${0===a?0:m.toFixed(2)}%)`,value:p,color:ca().Highcharts.getOptions().colors[i]}})).filter((e=>!!e))}o&&1===o.length&&0===o[0].value&&(o=null);let r={chart:{backgroundColor:"rgba(255, 0, 0, 0)",height:250,spacingLeft:0,spacingRight:0,spacingBottom:0},credits:{enabled:!1},legend:{enabled:!1},plotOptions:{treemap:{animation:!1,tooltip:{pointFormatter:function(){return`<b>${this.name}</b>: ${ca().Highcharts.numberFormat(this.value,0)} ${n.get("symbol")}`}}},series:{cursor:"pointer",point:{events:{click:function(){const e=`/asset/${this.symbol}`;i.push(e)}}}}},series:[{type:"treemap",levels:[{level:1,layoutAlgorithm:"sliceAndDice",dataLabels:{enabled:!0,align:"center",verticalAlign:"middle"}}],data:o}],title:{text:null}};return a.createElement(ba,{accountBalances:o,config:r})}}function ba({accountBalances:e,config:t}){return a.createElement("div",{className:"account-treemap"},a.createElement("div",{className:"account-treemap--legend"},e&&e.map((({name:e,symbol:t,color:s},n)=>a.createElement(y.rU,{key:n,to:`/asset/${t}`},a.createElement("div",{className:"legend-item"},a.createElement("div",{className:"legend-square",style:{backgroundColor:s}}),e))))),a.createElement(ca(),{config:t}))}_a=(0,c.Z)(_a);class Ea extends a.Component{static propTypes={balanceObjects:l.Z.ChainObjectsList,core_asset:l.Z.ChainAsset.isRequired};static defaultProps={balanceObjects:[],core_asset:"1.3.0"};render(){let e=this.props.balanceObjects.filter((e=>!!e)).map((e=>e.get("asset_type")));return a.createElement(_a,ga({preferredAsset:this.props.settings.get("unit","1.3.0"),assets:e},this.props))}}Ea=(0,c.Z)(Ea);class va extends a.Component{render(){return a.createElement(ua.Z,{stores:[o.Z,ea.Z],inject:{marketStats:()=>ea.Z.getState().allMarketStats,settings:()=>o.Z.getState().settings}},a.createElement(Ea,ga({},this.props,{ref:this.props.refCallback})))}}const ya=(0,g.EN)(va);var fa=s(80563),wa=s(44015);function ka(){return ka=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},ka.apply(this,arguments)}class Ca extends ta{static defaultProps={fullPrecision:!1,noDecimals:!1,hide_asset:!1};constructor(e){super(e)}shouldComponentUpdate(e){return super.shouldComponentUpdate(e)||e.base!==this.props.base}getValue(){let{marketStats:e}=this.props;return e&&e.change?e.change:0}render(){let e=this.getValue(),t=0===parseFloat(e)?"":parseFloat(e)<0?"change-down":"change-up",s=a.createElement($s.BK,{style:"decimal",value:e,minimumFractionDigits:2,maximumFractionDigits:2});return isNaN(parseFloat(e))?a.createElement("span",{className:"value "+t},"-"):a.createElement("span",{className:"value "+t},s,"%")}}Ca=(0,D.Z)(Ca,{propNames:["quote","base"],defaultProps:{quote:"1.3.0"}});class xa extends a.Component{render(){let{refCallback:e,...t}=this.props;return a.createElement(Ca,ka({},t,{ref:e}))}}xa=(0,d.$)(xa,{listenTo:()=>[ea.Z],getProps:e=>({marketStats:ea.Z.getState().allMarketStats.get(e.marketId),allMarketStats:ea.Z.getState().allMarketStats})});var Aa=s(24265);function Sa(){return Sa=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},Sa.apply(this,arguments)}const Na=function(e,t,s=null,a=null,n=!1){try{return Ks.Z.getFinalPrice(s||K.ChainStore.getAsset("1.3.0"),e,t||K.ChainStore.getAsset("1.3.0"),a||ea.Z.getState().allMarketStats,n)}catch(e){console.log(e)}};class Ma extends Aa.Z{static defaultProps={forceDirection:!0};shouldComponentUpdate(e,t){return super.shouldComponentUpdate(e)||e.base_amount!==this.props.base_amount||e.quote_amount!==this.props.quote_amount||e.decimals!==this.props.decimals||!S.Z.are_equal_shallow(e.pulsate,this.props.pulsate)||!S.Z.are_equal_shallow(t,this.state)}render(){const{coreAsset:e,fromAsset:t,toAsset:s,allMarketStats:n,forceDirection:i,...o}=this.props,r=Na(s,t,e,n);return 1===r?a.createElement("span",null,"1.00"):r?a.createElement(ae.Z,Sa({force_direction:!!i&&s.get("symbol"),base_amount:r.base.amount,base_asset:r.base.asset_id,quote_amount:r.quote.amount,quote_asset:r.quote.asset_id},o)):a.createElement("span",null,"--")}}Ma=(0,D.Z)(Ma,{propNames:["toAsset","fromAsset","coreAsset"],defaultProps:{toAsset:"1.3.0",coreAsset:"1.3.0"}});class Ia extends a.Component{render(){return a.createElement(ua.Z,{stores:[o.Z,ea.Z],inject:{toAsset:()=>this.props.toAsset||o.Z.getState().settings.get("unit","1.3.0"),allMarketStats:()=>ea.Z.getState().allMarketStats}},a.createElement(Ma,Sa({},this.props,{ref:this.props.refCallback})))}}var Za=s(87913),Pa=s(7437);function Oa(){return Oa=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},Oa.apply(this,arguments)}class Ba extends a.Component{static propTypes={duration:v().number.isRequired,offIcon:v().string.isRequired,onIcon:v().string.isRequired,title:v().string.isRequired};componentDidMount(){const{duration:e}=this.props;this.interval=setInterval(this.tick,e)}componentWillUnmount(){this.interval&&clearInterval(this.interval)}tick=()=>{const{onIcon:e,offIcon:t}=this.props,{name:s=e}=this.state||{};this.setState({name:s===e?t:e})};render(){const{onIcon:e,rest:t}=this.props,{name:s=e}=this.state||{},{title:n}=this.props;return a.createElement(V.Z,Oa({name:s,title:n},t))}}var Ta=s(42329),Ra=s(23951),La=s(45096),Da=s(70637),Fa=s(64046),Va=s(88209),qa=s.n(Va),Ua=s(98485);class ja extends a.Component{constructor(e){super(e),this.state=this.getInitialState(e),this.onSubmit=this.onSubmit.bind(this)}UNSAFE_componentWillReceiveProps(e){e.asset&&this.props.asset&&e.asset.get("id")!==this.props.asset.get("id")&&this.setState(this.getInitialState(e))}getInitialState(e){return{amount:0,amountAsset:new zs.xR({amount:0,asset_id:e.asset.get("id"),precision:e.asset.get("precision")})}}onAmountChanged({amount:e,asset:t}){this.state.amountAsset.setAmount({real:e}),this.setState({amount:e,asset:t})}onSubmit(){k.Z.reserveAsset(this.state.amountAsset.getAmount(),this.props.asset.get("id"),this.props.account.get("id")).then((()=>{this.state.amountAsset.setAmount({sats:0}),this.setState({amount:0})})),this.props.hideModal()}render(){let e=this.props.asset.get("id"),t=this.props.account&&this.props.account.get("balances",[]).size&&this.props.account.getIn(["balances",e])?K.ChainStore.getObject(this.props.account.getIn(["balances",e])):null;return t?a.createElement(O.Modal,{visible:this.props.visible,onCancel:this.props.hideModal,title:M().translate("modal.reserve.title"),footer:[a.createElement(O.Button,{type:"primary",key:"submit",onClick:this.onSubmit},M().translate("modal.reserve.submit")),a.createElement(O.Button,{onClick:this.props.hideModal,key:"cancel"},M().translate("cancel"))]},a.createElement(O.Alert,{message:M().translate("modal.reserve.warning_message"),type:"warning",showIcon:!0,style:{marginBottom:"2em"}}),a.createElement(O.Form,{layout:"vertical"},a.createElement(Ua.Z,{label:"modal.reserve.amount",amount:this.state.amount,onChange:this.onAmountChanged.bind(this),asset:e,assets:[e],display_balance:a.createElement("div",{onClick:()=>{this.state.amountAsset.setAmount({sats:t.get("balance")}),this.setState({amount:this.state.amountAsset.getAmount({real:!0})})}},a.createElement(wa.Z,{balance:this.props.account.getIn(["balances",e])})),tabIndex:1}))):null}}const Wa=ja=(0,D.Z)(ja,{propNames:["asset"]});function za(){return za=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},za.apply(this,arguments)}const{Option:Ka}=O.Select;class Ja extends a.Component{static propTypes={viewSettingsKey:v().string,viewSettings:v().object,allowCustomization:v().bool};static defaultProps={viewSettingsKey:null,viewSettings:null,allowCustomization:!1};constructor(e){super(e),this.state={columnSelector:"default",isDropDownOpen:!1},this._columnSelectorChange=this._columnSelectorChange.bind(this),this.isColumnChecked=this.isColumnChecked.bind(this)}_getViewSettingsKey(){return"columns_"+this.props.viewSettingsKey}_getEnabledColumns(){return this.props.viewSettings.get(this._getViewSettingsKey())||{}}_getCustomizableColumns(e){return e.filter((e=>this._isColumnCustomizable(e).customizable))}modHeader(e){return this.props.allowCustomization?e.filter((e=>!this._isColumnCustomizable(e)||this.isColumnChecked(e))):e}_columnCheckboxChange(e){let t=this._getEnabledColumns();t[e]=!this.isColumnChecked(e),oe.Z.changeViewSetting({[this._getViewSettingsKey()]:t})}_isColumnCustomizable(e){return e.dataIndex?{customizable:null==e.customizable||e.customizable,default:null==e.customizable||"boolean"==typeof e.customizable||e.customizable.default}:{customizable:!1,default:!1}}isColumnChecked(e){return"string"==typeof e&&(e={dataIndex:e,customizable:!0}),null==this._getEnabledColumns()[e.dataIndex]?this._isColumnCustomizable(e).default:this._getEnabledColumns()[e.dataIndex]}_renderEnabledColumnsSelector(){let{header:e}=this.props;return a.createElement("div",{className:"customizable-column--selector"},a.createElement(O.Select,{defaultValue:this.state.columnSelector,value:this.state.columnSelector,onChange:this._columnSelectorChange,dropdownClassName:"customizable-column--selector--dropdown",onDropdownVisibleChange:e=>{this.setState({isDropDownOpen:e})}},a.createElement(Ka,{className:"customizable-column--selector--option",value:"default"},!this.state.isDropDownOpen&&a.createElement(O.Icon,{type:"setting"}),this.state.isDropDownOpen&&M().translate("customizable_table.customize_the_columns")),this._getCustomizableColumns(e).map(((e,t)=>a.createElement(Ka,{key:t,className:"customizable-column--selector--option",value:e.dataIndex,disabled:!0},a.createElement(O.Checkbox,{checked:this.isColumnChecked(e),onChange:this._columnCheckboxChange.bind(this,e.dataIndex)},e.title))))))}_columnSelectorChange(){this.setState({columnSelector:"default"})}render(){let{header:e,...t}=this.props;return e=this.modHeader(e),a.createElement("div",null,this.props.allowCustomization&&a.createElement("div",{style:{position:"relative"}},this._renderEnabledColumnsSelector()),a.createElement(Ne.Z,za({},t,{header:e})),this.props.children)}}const Ga=Ja=(0,d.$)(Ja,{listenTo:()=>[o.Z],getProps:e=>e.viewSettings?{}:{viewSettings:o.Z.getState().viewSettings}});class Ha extends a.Component{constructor(e){super(e),this.state={isBridgeModalVisible:!1,isSettleModalVisible:!1,isBorrowModalVisible:!1,isDepositModalVisible:!1,isWithdrawModalVisible:!1,isBurnModalVisible:!1,isBridgeModalVisibleBefore:!1,isSettleModalVisibleBefore:!1,isBorrowModalVisibleBefore:!1,isDepositModalVisibleBefore:!1,isWithdrawModalVisibleBefore:!1,isBurnModalVisibleBefore:!1,borrow:null,settleAsset:"1.3.0",depositAsset:null,withdrawAsset:null,bridgeAsset:null,allRefsAssigned:!1,portfolioSort:e.viewSettings.get("portfolioSort","value"),portfolioSortDirection:e.viewSettings.get("portfolioSortDirection","descend")},this.changeRefs={};for(let e in this.sortFunctions)this.sortFunctions[e]=this.sortFunctions[e].bind(this);this._checkRefAssignments=this._checkRefAssignments.bind(this),this.showSettleModal=this.showSettleModal.bind(this),this.hideSettleModal=this.hideSettleModal.bind(this),this.showDepositModal=this.showDepositModal.bind(this),this.hideDepositModal=this.hideDepositModal.bind(this),this.showWithdrawModal=this.showWithdrawModal.bind(this),this.hideWithdrawModal=this.hideWithdrawModal.bind(this),this.showBorrowModal=this.showBorrowModal.bind(this),this.hideBorrowModal=this.hideBorrowModal.bind(this),this.showBurnModal=this.showBurnModal.bind(this),this.hideBurnModal=this.hideBurnModal.bind(this),this.showBridgeModal=this.showBridgeModal.bind(this),this.hideBridgeModal=this.hideBridgeModal.bind(this),this.toggleSortOrder=this.toggleSortOrder.bind(this)}UNSAFE_componentWillMount(){this.refCheckInterval=setInterval(this._checkRefAssignments)}componentWillUnmount(){clearInterval(this.refCheckInterval)}_checkRefAssignments(){if(!this.state.allRefsAssigned){const e=["changeRefs"].reduce(((e,t)=>void 0===e?!!Object.keys(this[t]).length:!!Object.keys(this[t]).length&&e),void 0);e&&(clearInterval(this.refCheckInterval),this.setState({allRefsAssigned:e}))}}shouldComponentUpdate(e,t){return!S.Z.are_equal_shallow(t,this.state)||!S.Z.are_equal_shallow(e.backedCoins,this.props.backedCoins)||!S.Z.are_equal_shallow(e.balances,this.props.balances)||!S.Z.are_equal_shallow(e.balanceList,this.props.balanceList)||!S.Z.are_equal_shallow(e.optionalAssets,this.props.optionalAssets)||e.account!==this.props.account||e.visible!==this.props.visible||e.settings!==this.props.settings||e.hiddenAssets!==this.props.hiddenAssets||e.allMarketStats.reduce(((e,t,s)=>S.Z.check_market_stats(t,this.props.allMarketStats.get(s))||e),!1)}showBridgeModal(){this.setState({isBridgeModalVisible:!0,isBridgeModalVisibleBefore:!0})}hideBridgeModal(){this.setState({isBridgeModalVisible:!1})}showWithdrawModal(){this.setState({isWithdrawModalVisible:!0,isWithdrawModalVisibleBefore:!0})}hideWithdrawModal(){this.setState({isWithdrawModalVisible:!1})}showBurnModal(){this.setState({isBurnModalVisible:!0,isBurnModalVisibleBefore:!0})}hideBurnModal(){this.setState({isBurnModalVisible:!1})}showSettleModal(){this.setState({isSettleModalVisible:!0,isSettleModalVisibleBefore:!0})}hideSettleModal(){this.setState({isSettleModalVisible:!1})}showDepositModal(){this.setState({isDepositModalVisible:!0,isDepositModalVisibleBefore:!0})}hideDepositModal(){this.setState({isDepositModalVisible:!1})}showBorrowModal(e,t,s){this.setState({isBorrowModalVisible:!0,isBorrowModalVisibleBefore:!0,borrow:{quoteAsset:e,backingAsset:t,account:s}})}hideBorrowModal(){this.setState({borrow:null,isBorrowModalVisible:!1})}sortFunctions={byKey:function(e,t){return e.key>t.key},byInCollateral:function(e,t){return this.sortFunctions.byTypedValue(e,t,this._sumCollateralBalances(e.inCollateral),this._sumCollateralBalances(t.inCollateral))},byBalance:function(e,t){return this.sortFunctions.byTypedValue(e,t,(0,xt.iX)(e.balance).amount,(0,xt.iX)(t.balance).amount)},byVestingBalance:function(e,t){return this.sortFunctions.byTypedValue(e,t,this._sumVestingBalances(e.inVesting),this._sumVestingBalances(t.inVesting))},byInOrders:function(e,t){return this.sortFunctions.byTypedValue(e,t,e.inOrders,t.inOrders)},byTypedValue(e,t,s,a){return s=S.Z.convert_satoshi_to_typed(s,e.asset),a=S.Z.convert_satoshi_to_typed(a,t.asset),s&&a?s-a:!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)},byEquivalentPrice:function(e,t){let s=Na(e.asset,e.adds.preferredAsset,this.props.coreAsset,null,!0),a=Na(t.asset,t.adds.preferredAsset,this.props.coreAsset,null,!0);return s&&a?s-a:!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)},totalValue:function(e,t){let s=(0,xt.HZ)(e.value,e.adds.preferredAsset,e.adds.asset,!1),a=(0,xt.HZ)(t.value,t.adds.preferredAsset,t.adds.asset,!1);return s&&a?s-a:!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)},changeValue:function(e,t){let s=this.changeRefs[e.key],a=this.changeRefs[t.key];return s&&a?("NaN"!=parseFloat(s)?parseFloat(s):s)-("NaN"!=parseFloat(a)?parseFloat(a):a):!s&&a?-1:s&&!a?1:this.sortFunctions.byKey(e,t)}};triggerSend(e){this.setState({send_asset:e},(()=>{this.send_modal&&this.send_modal.show()}))}triggerSendDEXBOT(e){this.setState({send_asset:e},(()=>{this.send_modal_dexbot&&this.send_modal_dexbot.show()}))}_onSettleAsset(e,t){t.preventDefault(),this.setState({settleAsset:e}),this.showSettleModal()}_hideAsset(e,t){oe.Z.hideAsset(e,t)}_burnAsset(e,t){t.preventDefault(),this.setState({reserve:e}),this.showBurnModal()}_showDepositModal(e,t){t.preventDefault(),this.setState({depositAsset:e},(()=>{this.showDepositModal()}))}_showDepositWithdraw(e,t,s,a){a.preventDefault(),this.setState({["bridge_modal"===e?"bridgeAsset":"deposit_modal"===e?"depositAsset":"withdrawAsset"]:t,fiatModal:s},(()=>"bridge_modal"===e?(this.showBridgeModal(),!0):"deposit_modal"===e?(this.showDepositModal(),!0):void this.showWithdrawModal()))}_getSeparator(e){return e?a.createElement("span",null," | "):null}_renderBuy=(e,t,s,n,i)=>{if("GPH"===e&&i<=1e6)return a.createElement("span",null,a.createElement("a",{onClick:this._showDepositWithdraw.bind(this,"bridge_modal",s,!1)},a.createElement(Ba,{onIcon:"dollar",offIcon:"dollar-green",title:"icons.dollar.buy",duration:1e3,className:"icon-14px"})));{let e=this._showDepositWithdraw.bind(this,"bridge_modal",s,!1),i=a.createElement("span",null,a.createElement(V.Z,{style:{cursor:this.props.isMyAccount?"pointer":"help"},name:"dollar",title:"icons.dollar.buy",className:"icon-14px",onClick:this.props.isMyAccount?e:null}));return t&&this.props.isMyAccount?i:t&&!this.props.isMyAccount?a.createElement(O.Tooltip,{title:M().translate("tooltip.login_required")},i):n}};_renderGatewayAction=(e,t,s,n)=>{let i="deposit"==e?this._showDepositModal.bind(this,s):this._showDepositWithdraw.bind(this,"withdraw_modal_new",s,!1),o="deposit"==e?`icons.${e}.${e}`:`icons.${e}`,r=a.createElement("span",null,a.createElement(V.Z,{style:{cursor:this.props.isMyAccount?"pointer":"help"},name:e,title:o,className:"icon-14x",onClick:this.props.isMyAccount?i:null}));return t&&this.props.isMyAccount?r:t&&!this.props.isMyAccount?a.createElement(O.Tooltip,{title:M().translate("tooltip.login_required")},r):n};toggleSortOrder(e,t,s){oe.Z.changeViewSetting({portfolioSortDirection:s.order,portfolioSort:s.columnKey})}getHeader(e){let{settings:t}=this.props,{shownAssets:s}=this.props;const n=t.get("unit")||this.props.core_asset.get("symbol"),i=t.get("showAssetPercent",!1);let o=[{title:a.createElement(w(),{content:"account.asset"}),dataIndex:"asset",align:"left",customizable:!1,sorter:this.sortFunctions.byKey,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},"unknown"===(0,ye.sA)(e.get("symbol"))?"":a.createElement("img",{ref:e.get("symbol").toLowerCase(),className:"column-hide-small",style:{maxWidth:35,marginRight:10},src:`asset-symbols/${(0,ye.sA)(e.get("symbol")).toLowerCase()}.png`}),a.createElement(ie.Z,{asset:e.get("id")}))},{title:a.createElement(w(),{content:"account.qty"}),dataIndex:"balance",align:"right",customizable:!1,sorter:this.sortFunctions.byBalance,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(wa.Z,{balance:e.get("id"),hide_asset:!0}))},{className:"column-hide-small",title:a.createElement(w(),{content:"account.inOrders"}),dataIndex:"inOrders",align:"right",sorter:this.sortFunctions.byInOrders,render:(e,t)=>e?a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(x.Z,{amount:e,asset:t.asset.get("id"),hide_asset:!0})):"--"},{className:"column-hide-small",title:a.createElement(w(),{content:"account.inVestingBalances"}),dataIndex:"inVesting",align:"right",sorter:this.sortFunctions.byVestingBalance,render:(e,t)=>e&&0!=e.length?a.createElement("span",{style:{whiteSpace:"noWrap"}},a.createElement(x.Z,{amount:this._sumVestingBalances(e),asset:t.asset.get("id"),hide_asset:!0})):"--"},{className:"column-hide-small",title:a.createElement(w(),{content:"account.inCollateral"}),dataIndex:"inCollateral",align:"right",sorter:this.sortFunctions.byInCollateral,render:(e,t)=>e&&0!=e.length?a.createElement("span",{style:{whiteSpace:"noWrap"}},a.createElement(x.Z,{amount:this._sumCollateralBalances(e),asset:t.asset.get("id"),hide_asset:!0})):"--"},{className:"column-hide-small",title:a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(w(),{content:"exchange.price"})," (",a.createElement(At.Z,{name:n,noTip:!0}),")"),dataIndex:"price",align:"right",sorter:this.sortFunctions.byEquivalentPrice,render:(e,t)=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(Ia,{fromAsset:t.asset.get("id"),pulsate:{reverse:!0,fill:"forwards"},hide_symbols:!0}))},{className:"column-hide-small",title:a.createElement(w(),{content:"account.hour_24_short"}),dataIndex:"hour24",align:"right",sorter:this.sortFunctions.changeValue,render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-small",title:a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(zt.Z,{noLink:!0,string:"account.eq_value_header",keys:[{type:"asset",value:n,arg:"asset"}],noTip:!0})),dataIndex:"value",align:"right",customizable:!1,sorter:this.sortFunctions.totalValue,defaultSortOrder:"descend",render:(e,t)=>a.createElement("span",{style:{whiteSpace:"nowrap"}},a.createElement(xt.GH,{balance:t.adds.balanceObject.get("id"),satoshis:e,toAsset:n,hide_asset:!0}))},{title:a.createElement(w(),{content:"account.percent"}),dataIndex:"percent",align:"right",customizable:{default:i},render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{title:a.createElement(w(),{content:"header.payments"}),dataIndex:"payments",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"exchange.buy"}),customizable:e.buy?void 0:{default:!1},dataIndex:"buy",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:e.depositOnlyBTS?a.createElement(a.Fragment,null,a.createElement(O.Tooltip,{title:M().translate("external_service_provider.expect_more")},a.createElement(w(),{content:"modal.deposit.submit"})," ",a.createElement(O.Icon,{type:"question-circle"}))):a.createElement(w(),{content:"modal.deposit.submit"}),customizable:{default:!1},dataIndex:"deposit",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"modal.withdraw.submit"}),customizable:{default:!1},dataIndex:"withdraw",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"account.trade"}),dataIndex:"trade",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"exchange.borrow_short"}),dataIndex:"borrow",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"account.settle"}),dataIndex:"settle",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"modal.reserve.submit"}),dataIndex:"burn",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)},{className:"column-hide-medium",title:a.createElement(w(),{content:"active"==s?"exchange.hide":"account.perm.show"}),dataIndex:"hide",align:"center",render:e=>a.createElement("span",{style:{whiteSpace:"nowrap"}},e)}];return o.forEach((e=>{e.dataIndex==this.state.portfolioSort&&(e.defaultSortOrder=this.state.portfolioSortDirection)})),o}_sumCollateralBalances(e){if(!e||0==e.length)return 0;let t=0;return e.forEach((e=>{t+=+e.get("collateral")})),t}_sumVestingBalances(e){if(!e||0==e.length)return 0;let t=0;return e.forEach((e=>{t+=(0,xt.iX)(e).amount})),t}_renderBalances(e,t,s){const{coreSymbol:n,preferredUnit:i,settings:o,hiddenAssets:r,orders:l}=this.props,c=(e,t)=>{let s=e&&e.has("bitasset_data_id"),n=!!(s&&e.getIn(["bitasset","settlement_fund"])>0);return{isBitAsset:s,borrowLink:!s||n?null:a.createElement("a",{onClick:()=>{Za.Z.hide(),this.showBorrowModal(e.get("id"),e.getIn(["bitasset","options","short_backing_asset"]),t)}},a.createElement(V.Z,{name:"dollar",title:"icons.dollar.borrow",className:"icon-14px"}))}};let d=[];const p="-";return(e||[]).forEach((e=>{let t=K.ChainStore.getObject(e);if(!t)return;let s,o,m,h=t.get("asset_type"),u=K.ChainStore.getObject(h);if(!u)return;let g="";const b=u.get("symbol"),E="1.3.0"!==u.get("id"),v=i!==n;let{market:f}=L.Z.parseDescription(u.getIn(["options","description"]));g=u.get("symbol");let w=f||"GPH";E&&w===g&&(w=n),s=E?a.createElement(y.rU,{to:`/market/${u.get("symbol")}_${w}`,onClick:()=>Ws.Z.switchMarket()},a.createElement(V.Z,{name:"trade",title:"icons.trade.trade",className:"icon-14px"})):v?a.createElement(y.rU,{to:`/market/${u.get("symbol")}_${i}`,onClick:()=>Ws.Z.switchMarket()},a.createElement(V.Z,{name:"trade",title:"icons.trade.trade",className:"icon-14px"})):p,m=a.createElement("a",{onClick:this.triggerSend.bind(this,u.get("id"))},a.createElement(V.Z,{name:"transfer",title:"icons.transfer",className:"icon-14px"}));let{isBitAsset:k,borrowLink:C}=c(u,this.props.account);const x=!r.includes(h),A=!!t.get("balance");let N=[];this.props.account.get("vesting_balances").forEach((e=>{let t=K.ChainStore.getObject(e);t.getIn(["balance","asset_id"])===u.get("id")&&+t.getIn(["balance","amount"])>0&&N.push(t)}));let I=[];(this.props.callOrders||[]).forEach((e=>{let t=K.ChainStore.getObject(e);t.getIn(["call_price","base","asset_id"])===u.get("id")&&+t.get("collateral")>0&&I.push(t)}));const Z=(0,_.E0)(u.get("symbol"),this.props.backedCoins),P=Z&&Z.depositAllowed||"GPH"==u.get("symbol"),B=Z&&Z.withdrawalAllowed&&A&&0!=t.get("balance"),T=!!this.props.bridgeCoins.get(g);let R,D=u&&u.getIn(["bitasset","options"])?u.getIn(["bitasset","options"]).toJS():null,F=D&&D.short_backing_asset?K.ChainStore.getAsset(D.short_backing_asset):null,{isBitAsset:q}=S.Z.replaceName(u),{isBitAsset:U}=S.Z.replaceName(F);if(k){const e=u.get("bitasset").get("settlement_fund")>0,t=u.getIn(["bitasset","is_prediction_market"]);R=e?"tooltip.global_settle":t?"tooltip.settle_market_prediction":"tooltip.settle",o=t&&!e?a.createElement(O.Icon,{type:"question-circle"}):a.createElement("a",{onClick:this._onSettleAsset.bind(this,u.get("id"))},a.createElement(V.Z,{name:"settle",title:"icons.settle",className:"icon-14px"}))}"DEXBOT"==u.get("symbol")&&(o=a.createElement("a",{onClick:this.triggerSendDEXBOT.bind(this,u.get("id"))},a.createElement(V.Z,{name:"settle",title:"icons.settle",className:"icon-14px"})));let j=K.ChainStore.getAsset(i),W=u.get("symbol")+"_"+i,z=this.props.allMarketStats.get(W);this.changeRefs[u.get("symbol")]=z&&z.change?z.change:0;const J=(0,xt.iX)(t).amount+(l[u.get("id")]?l[u.get("id")]:0)+this._sumVestingBalances(N)+this._sumCollateralBalances(I);d.push({key:u.get("symbol"),adds:{balanceObject:t,preferredAsset:j,asset:u},asset:u,balance:t,price:"dummy",inOrders:l[u.get("id")],inVesting:N,inCollateral:I,hour24:a.createElement(xa,{base:u.get("id"),quote:i,marketId:W,hide_symbols:!0}),value:J,percent:A?a.createElement(wa.Z,{balance:e,asPercentage:!0}):null,payments:m,buy:this._renderBuy(u.get("symbol"),T,b,p,t.get("balance")),deposit:this._renderGatewayAction("deposit",P,b,p),withdraw:this._renderGatewayAction("withdraw",B,b,p),trade:s,borrow:k&&C?a.createElement(O.Tooltip,{title:M().translate("tooltip.borrow",{asset:q?"gp"+g:g})},C):k&&!C?a.createElement(O.Tooltip,{title:M().translate("tooltip.borrow_disabled",{asset:q?"gp"+g:g})},a.createElement(O.Icon,{type:"question-circle"})):p,settle:k&&F?a.createElement(O.Tooltip,{placement:"bottom",title:M().translate(R,{asset:q?"gp"+g:g,backingAsset:U?"gp"+F.get("symbol"):F.get("symbol"),settleDelay:D.force_settlement_delay_sec/3600})},a.createElement("div",{className:"inline-block"},o)):"DEXBOT"==u.get("symbol")?a.createElement(O.Tooltip,{placement:"bottom",title:M().translate("dexbot.settle")},a.createElement("div",{className:"inline-block"},o)):p,burn:k?null:a.createElement("a",{style:{marginRight:0},onClick:this._burnAsset.bind(this,u.get("id"))},a.createElement(V.Z,{name:"fire",className:"icon-14px"})),hide:a.createElement(O.Tooltip,{placement:"bottom",title:M().translate("tooltip."+(x?"hide_asset":"show_asset"))},a.createElement("a",{style:{marginRight:0},className:x?"order-cancel":"action-plus",onClick:this._hideAsset.bind(this,h,x)},a.createElement(V.Z,{name:x?"cross-circle":"plus-circle",title:x?"icons.cross_circle.hide_asset":"icons.plus_circle.show_asset",className:"icon-14px"})))})})),t&&t.filter((e=>{let t=!1;this.props.backedCoins.get("OPEN",[]).forEach((s=>{s&&s.symbol===e&&(t=!0)})),this.props.bridgeCoins.get(e)&&(t=!0);let s=!0;return d.forEach((t=>{t.key===e&&(s=!1)})),s&&t})).forEach((e=>{let t=K.ChainStore.getAsset(e);if(t&&this.props.isMyAccount){const i=!r.includes(t.get("id")),o=t.get("symbol").split("."),l=!!this.props.backedCoins.get("OPEN",[]).find((e=>e.backingCoinType===o[1]))||!!this.props.backedCoins.get("RUDEX",[]).find((e=>e.backingCoin===o[1]))||"GPH"==t.get("symbol"),m=!!this.props.bridgeCoins.get(t.get("symbol")),h="1.3.0"!==t.get("id");let{market:u}=L.Z.parseDescription(t.getIn(["options","description"])),g=u||n,_=h?a.createElement(y.rU,{to:`/market/${t.get("symbol")}_${g}`,onClick:()=>Ws.Z.switchMarket()},a.createElement(V.Z,{name:"trade",title:"icons.trade.trade",className:"icon-14px"})):p,{isBitAsset:b,borrowLink:E}=c(t,this.props.account);(i&&s||!i&&!s)&&d.push({key:t.get("symbol"),asset:t,balance:p,price:p,hour24:p,value:p,percent:p,payments:p,buy:m&&this.props.isMyAccount?a.createElement("span",null,a.createElement("a",{onClick:this._showDepositWithdraw.bind(this,"bridge_modal",e,!1)},a.createElement(V.Z,{name:"dollar",title:"icons.dollar.buy",className:"icon-14px"}))):p,deposit:l&&this.props.isMyAccount?a.createElement("span",null,a.createElement(V.Z,{style:{cursor:"pointer"},name:"deposit",title:"icons.deposit.deposit",className:"icon-14x",onClick:this._showDepositModal.bind(this,t.get("symbol"))})):p,withdraw:p,trade:_,borrow:b?a.createElement(O.Tooltip,{placement:"bottom",title:M().translate("tooltip.borrow",{asset:t.get("symbol")})},a.createElement("div",{className:"inline-block"},E)):p,settle:p,burn:p,hide:a.createElement(O.Tooltip,{placement:"bottom",title:M().translate("tooltip."+(i?"hide_asset":"show_asset"))},a.createElement("a",{style:{marginRight:0},className:i?"order-cancel":"action-plus",onClick:this._hideAsset.bind(this,t.get("id"),i)},a.createElement(V.Z,{name:i?"cross-circle":"plus-circle",title:i?"icons.cross_circle.hide_asset":"icons.plus_circle.show_asset",className:"icon-14px"})))})}})),d}_renderSendModal(){return a.createElement(Ta.Z,{id:"send_modal_portfolio",refCallback:e=>{e&&(this.send_modal=e)},from_name:this.props.account.get("name"),asset_id:this.state.send_asset||"1.3.0"})}_renderSendModalDEXBOT(){return a.createElement(Ra.Z,{id:"send_modal_dexbot",refCallback:e=>{e&&(this.send_modal_dexbot=e)},from_name:this.props.account.get("name"),to_name:"dexbot",asset_id:this.state.send_asset||"1.3.0",ticker:"DEXBOT",header:"dexbot.modal.header"})}_renderBorrowModal(){return this.state.borrow&&this.state.borrow.quoteAsset&&this.state.borrow.backingAsset&&this.state.borrow.account&&this.state.isBorrowModalVisibleBefore?a.createElement(Vt.Z,{visible:this.state.isBorrowModalVisible,showModal:this.showBorrowModal,hideModal:this.hideBorrowModal,accountObj:this.state.borrow&&this.state.borrow.account,quoteAssetObj:this.state.borrow&&this.state.borrow.quoteAsset,backingAssetObj:this.state.borrow&&this.state.borrow.backingAsset}):null}_renderSettleModal(){return a.createElement(La.Z,{visible:this.state.isSettleModalVisible,hideModal:this.hideSettleModal,showModal:this.showSettleModal,asset:this.state.settleAsset,account:this.props.account})}render(){this.props.bridgeCoins.get(this.state.bridgeAsset);const e=this._renderBalances(this.props.balanceList,this.props.optionalAssets,this.props.visible),t={};return e.forEach((e=>{e.buy&&"-"!==e.buy&&(t.buy=!0),e.deposit&&"-"!==e.deposit&&"GPH"==e.key&&Pa.Z.anyAllowed()&&(t.depositOnlyBTS="GPH"==e.key&&!t.deposit,t.deposit=!0),e.withdraw&&"-"!==e.withdraw&&(t.withdraw=!0)})),a.createElement("div",null,a.createElement(Ga,{className:"table dashboard-table table-hover",rows:e,header:this.getHeader(t),label:"utility.total_x_assets",extraRow:this.props.extraRow,viewSettingsKey:"portfolioColumns",allowCustomization:!0,toggleSortOrder:this.toggleSortOrder},this._renderSendModal(),this._renderSendModalDEXBOT(),(this.state.isSettleModalVisible||this.state.isSettleModalVisibleBefore)&&this._renderSettleModal(),this._renderBorrowModal(),(this.state.isWithdrawModalVisible||this.state.isWithdrawModalVisibleBefore)&&a.createElement(Fa.Z,{hideModal:this.hideWithdrawModal,visible:this.state.isWithdrawModalVisible,backedCoins:this.props.backedCoins,initialSymbol:this.state.withdrawAsset}),(this.state.isDepositModalVisible||this.state.isDepositModalVisibleBefore)&&a.createElement(Da.Z,{visible:this.state.isDepositModalVisible,showModal:this.showDepositModal,hideModal:this.hideDepositModal,asset:this.state.depositAsset,account:this.props.account.get("name"),backedCoins:this.props.backedCoins}),(this.state.isBurnModalVisible||this.state.isBurnModalVisibleBefore)&&a.createElement(Wa,{visible:this.state.isBurnModalVisible,hideModal:this.hideBurnModal,asset:this.state.reserve,account:this.props.account,onClose:()=>{qa().publish("reserve_asset","close")}})))}}Ha=(0,d.$)(Ha,{listenTo:()=>[o.Z,Pa.Z,ea.Z],getProps:()=>({settings:o.Z.getState().settings,viewSettings:o.Z.getState().viewSettings,backedCoins:Pa.Z.getState().backedCoins,bridgeCoins:Pa.Z.getState().bridgeCoins,gatewayDown:Pa.Z.getState().down,allMarketStats:ea.Z.getState().allMarketStats})});const Qa=Ha=(0,fa.ZP)(Ha,50,{leading:!1});function Xa(){return Xa=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},Xa.apply(this,arguments)}class Ya extends a.Component{constructor(e){super(e),this.state={shownAssets:e.viewSettings.get("shownAssets","active"),alwaysShowAssets:(0,ye.sY)(!0),hideFishingProposals:!0,question1:!1,question2:!1,question3:!1},this._handleFilterInput=this._handleFilterInput.bind(this)}_handleFilterInput(e){this.setState({filterValue:e.target.value})}UNSAFE_componentWillMount(){this._checkMarginStatus()}_checkMarginStatus(e=this.props){(function(e){if(!e||e&&!e.get("call_orders",[]).size)return Promise.resolve(null);const t=e.get("name")+JSON.stringify(e.get("call_orders"));return oa[t]?oa[t].result?Promise.resolve(oa[t].result):new Promise(((e,s)=>{oa[t].queue.push({res:e,rej:s})})):new Promise(((s,a)=>{oa[t]={queue:[{res:s,rej:a}],result:null},(0,K.FetchChain)("getObject",e.get("call_orders").toArray()).then((e=>{let s=[];e.forEach((e=>{let t=e.getIn(["call_price","base","asset_id"]),a=e.getIn(["call_price","quote","asset_id"]);-1===s.indexOf(t)&&s.push(t),-1===s.indexOf(a)&&s.push(a)})),(0,K.FetchChain)("getAsset",s,6e3).then((s=>{let a={};s.forEach((e=>{a[e.get("id")]=e.toJS()}));let n={};e.forEach((e=>{let t=a[e.getIn(["call_price","quote","asset_id"])],s=a[e.getIn(["call_price","base","asset_id"])],i=L.Z.extractRawFeedPrice(t);if(i.base.asset_id===i.quote.asset_id)n[t.id]={ratio:null};else{let i=new zs.xR({amount:e.get("collateral"),asset_id:s.id,precision:s.precision}),o=new zs.xR({amount:e.get("debt"),asset_id:t.id,precision:t.precision}),r=t.bitasset.current_feed.maintenance_collateral_ratio/1e3,l=new zs.ad({priceObject:L.Z.extractRawFeedPrice(t),market_base:L.Z.extractRawFeedPrice(t).quote.asset_id,sqr:t.bitasset.current_feed.maximum_short_squeeze_ratio,assets:a}),c={ratio:i.getAmount({real:!0})/(o.getAmount({real:!0})/l.toReal())};if(isNaN(c.ratio))return null;c.ratio<r?c.statusClass="danger":c.ratio<r+.5?c.statusClass="warning":c.statusClass=null,n[t.id]=c}})),oa[t].queue.forEach((e=>{e.res(n)})),oa[t]={result:n},setTimeout((()=>{delete oa[t]}),6e4)}))})).catch((()=>{oa[t].queue.forEach((e=>{e.rej()}))}))}))})(e.account).then((e=>{let t=null;for(let s in e)t=e[s].statusClass||t;this.setState({globalMarginStatus:t})}))}UNSAFE_componentWillReceiveProps(e){e.account!==this.props.account&&this._checkMarginStatus(e)}shouldComponentUpdate(e,t){return!S.Z.are_equal_shallow(e.balances,this.props.balances)||e.account!==this.props.account||e.isMyAccount!==this.props.isMyAccount||e.settings!==this.props.settings||e.hiddenAssets!==this.props.hiddenAssets||!S.Z.are_equal_shallow(t,this.state)||this.state.filterValue!==t.filterValue||this.state.enabledColumns!==t.enabledColumns}_changeShownAssets(e="active"){this.setState({shownAssets:e}),oe.Z.changeViewSetting({shownAssets:e})}_toggleHideProposal(){this.setState({hideFishingProposals:!this.state.hideFishingProposals})}_toggleQ1(){this.setState({question1:!this.state.question1})}_toggleQ2(){this.setState({question2:!this.state.question2})}_toggleQ3(){this.setState({question3:!this.state.question3})}_showProposals(){oe.Z.changeSetting({setting:"showProposedTx",value:!0})}render(){let{account:e,hiddenAssets:t,settings:s,orders:n}=this.props,{shownAssets:i}=this.state;if(!e)return null;const o=s.get("unit")?s.get("unit"):this.props.core_asset.get("symbol");let r,l,c=[],d={},p={};K.ChainStore.requestAllDataForAccount(e.toJS().id,"balance"),e.toJS&&e.has("call_orders")&&(c=e.get("call_orders").toJS());let m=e.get("balances"),u=h().List(),g=h().List();c.forEach((e=>{let t=K.ChainStore.getObject(e);if(t){let e=t.getIn(["call_price","base","asset_id"]);d[e]?d[e]+=parseInt(t.get("collateral"),10):d[e]=parseInt(t.get("collateral"),10);let s=t.getIn(["call_price","quote","asset_id"]);p[s]?p[s]+=parseInt(t.get("debt"),10):p[s]=parseInt(t.get("debt"),10)}})),m&&(m=m.filter(((e,t)=>{let s=K.ChainStore.getObject(e);return!(s&&!s.get("balance")&&!n[t])})),m.forEach(((e,s)=>{const a=K.ChainStore.getAsset(s);let n="",i="";if(this.state.filterValue){i=this.state.filterValue?String(this.state.filterValue).toLowerCase():"",n=a.get("symbol").toLowerCase();let{isBitAsset:e}=S.Z.replaceName(a);e&&(n="gp"+n)}t.includes(s)&&n.includes(i)?g=g.push(e):n.includes(i)&&(u=u.push(e))})));let _=a.createElement(Dt.Z,{noTip:!0,balances:g,hide_asset:!0}),b=a.createElement(Dt.Z,{noTip:!0,balances:u,hide_asset:!0}),E=a.createElement(Dt.Z,{noTip:!0,balances:h().List(),openOrders:n,hide_asset:!0}),v=a.createElement(Dt.Z,{noTip:!0,balances:h().List(),debt:p,collateral:d,hide_asset:!0}),y=a.createElement(Dt.Z,{noTip:!0,balances:h().List(),debt:p,hide_asset:!0}),f=a.createElement(Dt.Z,{noTip:!0,balances:h().List(),collateral:d,hide_asset:!0});const k=a.createElement(zt.Z,{noLink:!0,string:"account.total",keys:[{type:"asset",value:o,arg:"asset"}]}),C=a.createElement("span",{key:"portfolio",className:"total-value"},k,": ",b),x=a.createElement("span",{key:"portfolio",className:"total-value"},k,": ",_);return r=a.createElement(Qa,{balanceList:u,optionalAssets:this.state.filterValue?null:this.state.alwaysShowAssets,visible:!0,preferredUnit:o,coreAsset:this.props.core_asset,coreSymbol:this.props.core_asset.get("symbol"),hiddenAssets:t,shownAssets:i,orders:n,account:this.props.account,isMyAccount:this.props.isMyAccount,balances:this.props.balances,extraRow:C,viewSettings:this.props.viewSettings,callOrders:c}),l=a.createElement(Qa,{balanceList:g,optionalAssets:this.state.filterValue?null:this.state.alwaysShowAsset,visible:!1,preferredUnit:o,coreSymbol:this.props.core_asset.get("symbol"),settings:s,hiddenAssets:t,shownAssets:i,orders:n,account:this.props.account,isMyAccount:this.props.isMyAccount,balances:this.props.balances,extraRow:x,viewSettings:this.props.viewSettings,enabledColumns:this.state.enabledColumns}),a.createElement("div",{className:"grid-content app-tables no-padding",ref:"appTables"},a.createElement("div",{className:"content-block small-12"},a.createElement("div",{className:"tabs-container generic-bordered-box"},a.createElement(F.m,{defaultActiveTab:0,segmented:!1,setting:"overviewTab",className:"account-tabs",tabsClass:"account-overview no-padding bordered-header content-block"},a.createElement(F.O,{title:"account.portfolio",subText:b},a.createElement("div",{className:"header-selector"},a.createElement("div",{className:"filter inline-block"},a.createElement(Me.Z,{value:this.state.filterValue,onChange:this._handleFilterInput})),a.createElement("div",{className:"selector inline-block",style:{position:"relative",top:"8px"}},a.createElement("div",{className:W()("inline-block",{inactive:"active"!=i}),onClick:"active"!=i?this._changeShownAssets.bind(this,"active"):()=>{}},a.createElement(w(),{content:"account.hide_hidden"})),g.size?a.createElement("div",{className:W()("inline-block",{inactive:"hidden"!=i}),onClick:"hidden"!=i?this._changeShownAssets.bind(this,"hidden"):()=>{}},a.createElement(w(),{content:"account.show_hidden"})):null,a.createElement("div",{className:W()("inline-block",{inactive:"visual"!=i}),onClick:"visual"!=i?this._changeShownAssets.bind(this,"visual"):()=>{}},a.createElement(w(),{content:"account.show_visual"})))),"visual"!=i?"hidden"===i&&g.size?l:r:a.createElement(ya,{balanceObjects:u})),a.createElement(F.O,{title:"account.open_orders",subText:E},a.createElement(ia,this.props,a.createElement("div",{className:"total-value"},a.createElement("span",{className:"text"},k),a.createElement("span",{className:"value"},E)))),a.createElement(F.O,{title:"account.collaterals",subText:a.createElement("span",{className:this.state.globalMarginStatus},v)},a.createElement("div",{className:"content-block"},a.createElement("div",{className:"generic-bordered-box"},a.createElement(Qt,{preferredUnit:o,className:"dashboard-table",callOrders:c,account:e},a.createElement("tr",{className:"total-value"},a.createElement("td",null,k),a.createElement("td",null),a.createElement("td",null,y),a.createElement("td",{className:"column-hide-medium"},f),a.createElement("td",null),a.createElement("td",null,v),a.createElement("td",{className:"column-hide-small"}),a.createElement("td",{className:"column-hide-small"}),a.createElement("td",{colSpan:"5"})))))),a.createElement(F.O,{title:"account.activity",subText:" "},a.createElement(Qe.t,{accountsList:h().fromJS([e.get("id")]),compactView:!1,showMore:!0,fullHeight:!0,limit:100,showFilters:!0,dashboard:!0})),e.get("proposals")&&e.get("proposals").size&&a.createElement(F.O,{title:"explorer.proposals.title",subText:String(e.get("proposals")?e.get("proposals").size:0)},this.props.settings.get("showProposedTx")&&a.createElement("div",{onClick:this._toggleHideProposal.bind(this),style:{cursor:"pointer"}},a.createElement(O.Tooltip,{title:M().translate("tooltip.propose_unhide"),placement:"bottom"},a.createElement(O.Switch,{style:{margin:16},checked:this.state.hideFishingProposals,onChange:this._toggleHideProposal.bind(this)}),a.createElement(w(),{content:"account.deactivate_suspicious_proposals"}))),this.props.settings.get("showProposedTx")&&a.createElement(Is,{className:"dashboard-table",account:e,hideFishingProposals:this.state.hideFishingProposals}),!this.props.settings.get("showProposedTx")&&a.createElement("div",{className:"padding"},a.createElement("div",null,a.createElement(w(),{content:"account.proposed_transactions.advanced_feature"}),":"),a.createElement("br",null),a.createElement("br",null),a.createElement("div",null,a.createElement(w(),{content:"account.proposed_transactions.question1"}),a.createElement(O.Switch,{style:{margin:16},checked:this.state.question1,onChange:this._toggleQ1.bind(this),checkedChildren:"Yes",unCheckedChildren:"No"})),this.state.question1&&a.createElement("div",null,a.createElement(w(),{content:"account.proposed_transactions.question2"}),a.createElement(O.Switch,{style:{margin:16},checked:this.state.question2,onChange:this._toggleQ2.bind(this),checkedChildren:"Yes",unCheckedChildren:"No"})),this.state.question2&&a.createElement("div",null,a.createElement(w(),{content:"account.proposed_transactions.question3"}),a.createElement(O.Switch,{style:{margin:16},checked:this.state.question3,onChange:this._toggleQ3.bind(this),checkedChildren:"Yes",unCheckedChildren:"No"})),a.createElement("br",null),this.state.question3&&a.createElement("div",{style:{marginTop:16,marginBottom:16}},a.createElement(w(),{content:"account.proposed_transactions.answered_no"}),a.createElement(O.Button,{style:{marginLeft:16},onClick:this._showProposals.bind(this)},a.createElement(w(),{content:"account.proposed_transactions.show_me_proposals"})))))))))}}Ya=(0,D.Z)(Ya,{propNames:["core_asset"]});class $a extends a.Component{render(){return a.createElement(ra.Z,Xa({},this.props,{wrap:Ya}))}}function en(){return en=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},en.apply(this,arguments)}class tn extends a.Component{static propTypes={account:l.Z.ChainAccount.isRequired};constructor(e){super(e)}componentDidMount(){this.props.account&&(n.Z.setCurrentAccount.defer(this.props.account.get("name")),p.Z.getPossibleFees(this.props.account,"transfer"),(0,_.xA)())}UNSAFE_componentWillReceiveProps(e){if(e.account){const t=e.account.get("name"),s=this.props.account&&this.props.account.get("name");this.props.account&&t===s||(n.Z.setCurrentAccount.defer(t),p.Z.getPossibleFees(e.account,"transfer"))}}componentDidUpdate(e){const{currentAccount:t,history:s,location:a}=this.props;if(e.currentAccount!==t&&t){let e=a.pathname.split("/");e[2]=t,s.push(e.join("/"))}}render(){let{myActiveAccounts:e,searchAccounts:t,settings:s,wallet_locked:n,account:o,hiddenAssets:r}=this.props;if(!o)return a.createElement(u.Z,null);let l=this.props.account.get("name"),c={account_name:l,myActiveAccounts:e,searchAccounts:t,settings:s,wallet_locked:n,account:o,isMyAccount:i.Z.isMyAccount(o),hiddenAssets:r,contained:!0,balances:o.get("balances",(0,m.List)()).toList(),orders:o.get("orders",(0,m.List)()).toList(),viewSettings:this.props.viewSettings,proxy:o.getIn(["options","voting_account"]),history:this.props.history};return a.createElement(g.rs,null,a.createElement(g.AW,{path:`/account/${l}`,exact:!0,render:()=>a.createElement($a,c)}),a.createElement(g.l_,{from:`/account/${l}/overview`,to:`/account/${l}`}),a.createElement(g.AW,{path:`/account/${l}/assets`,exact:!0,render:()=>a.createElement(U,c)}),a.createElement(g.AW,{path:`/account/${l}/create-asset`,exact:!0,render:()=>a.createElement(ee,c)}),a.createElement(g.AW,{path:`/account/${l}/update-asset/:asset`,exact:!0,render:()=>a.createElement(_e,c)}),a.createElement(g.AW,{path:`/account/${l}/member-stats`,exact:!0,render:()=>a.createElement(xe,c)}),a.createElement(g.AW,{path:`/account/${l}/vesting`,exact:!0,render:()=>a.createElement(Ze,c)}),a.createElement(g.AW,{path:`/account/${l}/permissions`,exact:!0,render:()=>a.createElement(Ye,c)}),a.createElement(g.AW,{path:`/account/${l}/voting/:tab`,render:()=>a.createElement(Lt,c)}),a.createElement(g.l_,{from:`/account/${l}/voting`,to:`/account/${l}/voting/witnesses`}),a.createElement(g.AW,{path:`/account/${l}/whitelist`,exact:!0,render:()=>a.createElement(gt,c)}),a.createElement(g.AW,{path:`/account/${l}/signedmessages`,exact:!0,render:()=>a.createElement(lt,c)}))}}tn=(0,c.Z)(tn,{show_loader:!0});class sn extends a.Component{render(){let e=this.props.match.params.account_name;return a.createElement(tn,en({},this.props,{account:e}))}}const an=(0,d.$)(sn,{listenTo:()=>[i.Z,o.Z,r.Z],getProps:()=>({myActiveAccounts:i.Z.getState().myActiveAccounts,searchAccounts:i.Z.getState().searchAccounts,currentAccount:i.Z.getState().currentAccount||i.Z.getState().passwordAccount,settings:o.Z.getState().settings,hiddenAssets:o.Z.getState().hiddenAssets,wallet_locked:r.Z.getState().locked,viewSettings:o.Z.getState().viewSettings})})},45096:(e,t,s)=>{"use strict";s.d(t,{Z:()=>B});var a=s(67294),n=s(43393),i=s.n(n),o=s(45697),r=s.n(o),l=s(58074),c=s.n(l),d=s(99349),p=s(73727),m=(s(23037),s(52521)),h=s(22463);class u extends a.Component{render(){let{base:e,quote:t}=this.props;if(e.get("id")===t.get("id"))return null;let s=t.get("symbol")+"_"+e.get("symbol"),n=a.createElement("span",null,a.createElement(d.Z,{name:t.get("symbol")})," /"," ",a.createElement(d.Z,{name:e.get("symbol")}));return a.createElement(p.rU,{to:`/market/${s}`,onClick:()=>h.Z.switchMarket()},n)}}const g=u=(0,m.Z)(u,{propNames:["quote","base"],defaultProps:{base:"1.3.0"}});var _=s(44015),b=s(55894),E=s(41075),v=s(112),y=s.n(v),f=s(30806),w=s(98485),k=s(55420),C=s(74366),x=s(7581);function A(){return A=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},A.apply(this,arguments)}var S=s(58466),N=s(76660),M=s(13973);const I=(Z=({worthLessSettlement:e,asset:t,shortBackingAsset:s,marketPrice:n,settlementPrice:i})=>{switch(n=M.Z.format_number(n,t.get("precision")),i=M.Z.format_number(i,t.get("precision")),e){case!0:return a.createElement("div",null,a.createElement(c(),{component:"h2",content:"exchange.settle_better_marketprice"}),a.createElement("span",null,a.createElement(S.Z,{string:"exchange.worth_less_settlement_warning",keys:[{value:a.createElement(g,{base:t.get("id"),quote:s.get("id")}),arg:"market_link"}]}),a.createElement("br",null)," ",a.createElement(c(),{content:"exchange.price_market"}),": ",n,a.createElement("br",null)," ",a.createElement(c(),{content:"exchange.settle"}),": ",i));case void 0:return a.createElement(c(),{content:"exchange.checking_for_worth_less_settlement"});default:return a.createElement("div",null,a.createElement(c(),{component:"h2",content:"exchange.settle_better_settleprice"}),a.createElement("span",null,a.createElement(S.Z,{string:"exchange.settlement_hint",keys:[{value:a.createElement(g,{base:t.get("id"),quote:s.get("id")}),arg:"market_link"},{value:a.createElement(d.Z,{name:t.get("symbol")}),arg:"long"}]}),a.createElement("br",null)," ",a.createElement(c(),{content:"exchange.price_market"}),": ",n,a.createElement("br",null)," ",a.createElement(c(),{content:"exchange.settle"}),": ",i))}},(e=>{const t=(0,m.Z)(e,{propNames:["shortBackingAsset"]});return(0,m.Z)((e=>a.createElement(t,A({},e,{shortBackingAsset:e.asset.getIn(["bitasset","options","short_backing_asset"])}))))})(class extends a.PureComponent{state={worthLessSettlement:void 0};updateFlag(){const{asset:e,shortBackingAsset:t}=this.props,s=e.get("id"),a=t.get("id"),n=k.Apis.instance().db_api().exec("get_order_book",[a,s,1]).then((e=>0===e.bids.length?0:Number(e.bids[0].price)));let i=null,o=1,r=0;e.get("bitasset")&&e.get("bitasset").get("settlement_fund")>0?i=e.get("bitasset").get("settlement_price"):(i=x.Z.extractRawFeedPrice(e),r=e.get("bitasset").get("options").get("force_settlement_offset_percent"),o=1-r/1e4);const l=new C.tA({base:new C.xR({asset_id:a,amount:i.getIn(["quote","amount"]),preicision:t.get("precision")}),quote:new C.xR({asset_id:s,amount:i.getIn(["base","amount"]),precision:e.get("precision")})}).toReal()*o;n.then((e=>this.setState({worthLessSettlement:e>l,marketPrice:e,settlementPrice:l})))}UNSAFE_componentWillMount(){this.updateFlag()}componentDidUpdate(){this.updateFlag()}render(){const{props:e,state:{worthLessSettlement:t,marketPrice:s,settlementPrice:n}}=this;return a.createElement(Z,A({},e,{worthLessSettlement:t,marketPrice:s,settlementPrice:n}))}}));var Z;class P extends a.Component{static propTypes={asset:r().instanceOf(i().Map),core:r().instanceOf(i().Map),account:r().instanceOf(i().Map)};static defaultProps={asset:i().Map(),core:i().Map(),account:i().Map()};constructor(){super(),this.state={amount:0},this.onSubmit=this.onSubmit.bind(this)}UNSAFE_componentWillReceiveProps(e){e.asset&&this.props.asset&&e.asset.get("id")!==this.props.asset.get("id")&&this.setState({amount:0})}getSettlementInfo(){const{getDynamicObject:e,asset:t,core:s}=this.props,a=e(t.get("dynamic_asset_data_id")),n=a&&a.size?a.get("current_supply"):0,i=s&&s.size?s.getIn(["parameters","maintenance_interval"]):0,o=t.get("bitasset").toJS(),r=o.force_settled_volume,l=n*(o.options.maximum_force_settlement_volume/1e4);return{maxSettlementVolume:l,remainingVolume:r?l-r:l,maintenanceInterval:i,settlementDelay:o.options.force_settlement_delay_sec}}onAmountChanged({amount:e,asset:t}){this.setState({amount:e})}onSubmit(e){let{amount:t}=this.state;e.preventDefault(),this.props.hideModal(),t=parseInt(t*Math.pow(10,this.props.asset.get("precision")));var s=b.Z.new_transaction();return s.add_type_operation("asset_settle",{fee:{amount:0,asset_id:0},account:this.props.account.get("id"),amount:{amount:t,asset_id:this.props.asset.get("id")}}),E.Z.process_transaction(s,null,!0).then((e=>!0)).catch((e=>(console.error("asset settle error: ",e),!1)))}_useMaxValue(e){this.setState({amount:e/Math.pow(10,this.props.asset.get("precision"))})}render(){let{asset:e,account:t}=this.props,{amount:s}=this.state;if(!e)return null;let n=e&&e.getIn(["bitasset","options"])?e.getIn(["bitasset","options"]).toJS():null,i=e.get("bitasset").get("settlement_fund")>0,o=0;i||(o=e.get("bitasset").get("options").get("force_settlement_offset_percent")/100);let r=e.get("id"),l=t.get("balances");const{name:d,prefix:p}=M.Z.replaceName(e),m=(p||"")+d;let h=null,u=0;l&&l.forEach((e=>{let t=f.ChainStore.getObject(e);if(!t.get("balance"))return null;t.get("asset_type")===r&&(h=e,u=t.get("balance"))}));let g=a.createElement("span",null,a.createElement(c(),{content:"exchange.balance"}),": ",h?a.createElement("span",{className:"underline",onClick:this._useMaxValue.bind(this,u)},a.createElement(_.Z,{balance:h})):"0 "+e.get("symbol")),b=!1;s>u/Math.pow(10,this.props.asset.get("precision"))&&(b=!0);const E=[a.createElement(N.Tooltip,{title:b?y().translate("tooltip.lack_funds"):null},a.createElement(N.Button,{key:"submit",type:"primary",onClick:this.onSubmit,disabled:b},y().translate("modal.settle.submit"))),a.createElement(N.Button,{key:"close",onClick:this.props.hideModal},y().translate("modal.close"))],{maxSettlementVolume:v,remainingVolume:k,settlementDelay:C,maintenanceInterval:x}=this.getSettlementInfo(),A=i?0:(C+Math.floor(s/v)*x)/3600,S=e.getIn(["bitasset","is_prediction_market"]);let Z=S?a.createElement(N.Alert,{message:y().translate("tooltip.settle_market_prediction"),type:"info",showIcon:!0}):a.createElement(a.Fragment,null,i?a.createElement(N.Alert,{message:y().translate("exchange.settle_delay_globally_settled"),type:"warning",showIcon:!0}):a.createElement(N.Alert,{message:y().translate("exchange.settle_delay",{hours:n.force_settlement_delay_sec/3600}),description:A?y().translate("modal.settle.delay",{amount:A}):null,type:"info",showIcon:!0}),a.createElement(I,{asset:r}),a.createElement("br",null),i?null:a.createElement(c(),{component:"div",content:"exchange.settle_offset",offset:o}),a.createElement("br",null),a.createElement(N.Form,{className:"full-width",layout:"vertical"},a.createElement(w.Z,{label:"modal.settle.amount",amount:s,onChange:this.onAmountChanged.bind(this),display_balance:g,asset:r,assets:[r],tabIndex:1,style:s>k?{"margin-bottom":"0"}:{}}),s>k?a.createElement(a.Fragment,null,a.createElement(c(),{className:"facolor-info",content:"modal.settle.max_volume",amount:v,asset:m}),a.createElement("br",null),a.createElement(c(),{className:"facolor-info",content:"modal.settle.remaining_volume",amount:k,asset:m})):null));return a.createElement(N.Modal,{title:y().translate("modal.settle.title",{asset:m}),visible:this.props.visible,id:this.props.modalId,footer:S?null:E,onCancel:this.props.hideModal,overlay:!0,ref:"settlement_modal"},Z)}}P=(0,m.Z)(P,{propNames:["asset","core"],withDynamic:!0,defaultProps:{core:"2.0.0"}});class O extends a.Component{render(){return a.createElement(P,this.props)}}const B=O},57351:(e,t,s)=>{"use strict";s.d(t,{Z:()=>v});var a=s(67294),n=s(58074),i=s.n(n),o=s(21019),r=s(57906),l=s(43393),c=s.n(l),d=s(112),p=s.n(d),m=s(52521),h=s(13973),u=s(45697),g=s.n(u),_=s(34961);class b extends a.Component{static propTypes={value:g().string,onChange:g().func,scroll_length:g().number};shouldComponentUpdate(e){return!h.Z.are_equal_shallow(e.assets,this.props.assets)||e.value!==this.props.value||e.scroll_length!==this.props.scroll_length}render(){return this.props.assets.length?a.createElement(r.Z,{entries:this.props.assets.map((e=>e&&e.get("symbol"))).filter((e=>!!e)),values:this.props.assets.reduce(((e,t)=>(t&&t.get("symbol")&&(e[t.get("symbol")]=t),e)),{}),singleEntry:this.props.assets[0]?a.createElement(o.Z,{asset:this.props.assets[0].get("id"),amount:0,hide_amount:!0}):null,value:this.props.value,onChange:this.props.onChange,scroll_length:this.props.scroll_length}):null}}b=(0,m.Z)(b,{asList:!0});class E extends _.C{static propTypes={label:g().string,assets:g().array,amount:g().any,placeholder:g().string,onChange:g().func,tabIndex:g().number,error:g().string,scroll_length:g().number};static defaultProps={disabled:!1,tabIndex:0};componentDidMount(){this.onAssetChange(this.props.asset)}formatAmount(e){return e||(e=""),"number"==typeof e&&(e=e.toString()),e.trim().replace(/,/g,"")}_onChange(e){this.props.onChange&&this.props.onChange({amount:this.getNumericEventValue(e),asset:this.props.asset})}onAssetChange(e){this.props.onChange&&this.props.onChange({amount:this.props.amount,asset:e})}render(){let e=this.props.error?p().translate(this.props.error):this.formatAmount(this.props.amount);return a.createElement("div",{className:"amount-selector",style:this.props.style},a.createElement("label",{className:"right-label"},this.props.display_balance),a.createElement(i(),{className:"left-label",component:"label",content:this.props.label}),a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("input",{disabled:this.props.disabled,type:"text",value:e||"",placeholder:this.props.placeholder,onChange:this._onChange.bind(this),tabIndex:this.props.tabIndex,onPaste:this.props.onPaste||this.onPaste.bind(this),onKeyPress:this.onKeyPress.bind(this)}),a.createElement("div",{className:"form-label select floating-dropdown"},this.props.isPrice?a.createElement("div",{className:"dropdown-wrapper inactive"},a.createElement("div",null,this.props.asset.get("symbol"),"/",this.props.base)):a.createElement(b,{ref:this.props.refCallback,value:this.props.asset.get("symbol"),assets:c().List(this.props.assets),onChange:this.onAssetChange.bind(this),scroll_length:this.props.scroll_length}))))}}const v=E=(0,m.Z)(E)},94939:(e,t,s)=>{"use strict";s.d(t,{Z:()=>w});var a=s(67294),n=s(58074),i=s.n(n),o=s(30806),r=s(23037),l=s(82267),c=s(112),d=s.n(c),p=s(57906),m=s(21019),h=s(43393),u=s.n(h),g=s(94184),_=s.n(g),b=s(52521),E=s(45697),v=s.n(E);class y extends a.Component{static propTypes={value:v().string,onChange:v().func};render(){return 0!==this.props.assets.length&&this.props.value?a.createElement(p.Z,{entries:this.props.assets.map((e=>e&&e.get("symbol"))).filter((e=>!!e)),values:this.props.assets.reduce(((e,t)=>(t&&t.get("symbol")&&(e[t.get("symbol")]=t),e)),{}),singleEntry:this.props.assets[0]?a.createElement(m.Z,{asset:this.props.assets[0].get("id"),amount:0,hide_amount:!0}):null,value:"",onChange:this.props.onChange}):null}}y=(0,b.Z)(y,{asList:!0});class f extends a.Component{static propTypes={label:v().string,error:v().string,placeholder:v().string,onChange:v().func,onFound:v().func,assetInput:v().string,asset:r.Z.ChainAsset,tabIndex:v().number,disableActionButton:v().bool};static defaultProps={disabled:!1};getAsset(){return this.props.asset}getError(e=this.props.assetInput){let t=this.props.error;return t||!e||this.getNameType(e)||(t=d().translate("explorer.asset.invalid",{name:e})),t}getNameType(e){return e?o.ChainValidation.is_valid_symbol_error(e,!0)?null:"symbol":null}onInputChanged(e){let t=e.target.value.trim().substr(0,16).toUpperCase();this.props.onChange&&t!==this.props.assetInput&&this.props.onChange(t)}onKeyDown(e){13===e.keyCode&&(this.onFound(e),this.onAction(e))}componentDidMount(){this.props.onFound&&this.props.asset&&this.props.onFound(this.props.asset)}UNSAFE_componentWillReceiveProps(e){this.props.onFound&&e.asset!==this.props.asset&&this.props.onFound(e.asset)}onFound(e){e.preventDefault(),!this.props.onFound||this.getError()||this.props.disableActionButton||this.props.asset&&this.props.onFound(this.props.asset)}onAssetSelect(e){e&&(this.props.onFound(e),this.props.onChange(e.get("symbol")))}onAction(e){e.preventDefault(),!this.props.onAction||this.getError()||this.props.disableActionButton||this.props.asset&&this.props.onAction(this.props.asset)}render(){let e,{disabled:t,noLabel:s}=this.props,n=this.getError();t||(this.props.asset?e=this.props.asset.get("symbol"):!n&&this.props.assetInput&&(n=d().translate("explorer.asset.not_found",{name:this.props.assetInput})));let o=_()("button",{disabled:!this.props.asset||n||this.props.disableActionButton});return a.createElement("div",{className:"asset-selector",style:this.props.style},a.createElement("div",null,a.createElement("div",{className:"header-area"},n||s?null:a.createElement("label",{className:"right-label"}," ",a.createElement("span",null,e)),a.createElement(i(),{component:"label",content:this.props.label})),a.createElement("div",{className:"input-area"},a.createElement("div",{className:"inline-label input-wrapper"},a.createElement("input",{style:this.props.inputStyle,disabled:this.props.disabled,type:"text",value:this.props.assetInput||"",placeholder:this.props.placeholder||d().translate("explorer.assets.symbol"),ref:"user_input",onChange:this.onInputChanged.bind(this),onKeyDown:this.onKeyDown.bind(this),tabIndex:this.props.tabIndex}),a.createElement("div",{className:"form-label select floating-dropdown"},this.props.asset?a.createElement(y,{ref:this.props.refCallback,value:this.props.asset.get("symbol"),assets:u().List(this.props.assets),onChange:this.onAssetSelect.bind(this)}):null),this.props.children,this.props.onAction?a.createElement("button",{className:o,onClick:this.onAction.bind(this)},a.createElement(i(),{content:this.props.action_label})):null)),a.createElement("div",{className:"error-area",style:{paddingBottom:"10px"}},a.createElement("span",{style:{wordBreak:"break-all"}},n))))}}const w=(0,l.Z)(f)},41220:(e,t,s)=>{"use strict";s.d(t,{il:()=>C,GH:()=>A,iX:()=>x,HZ:()=>w});var a=s(67294),n=s(21019),i=s(23037),o=s(82267),r=s(52521),l=s(13973),c=s(89449),d=s(12326),p=s(58074),m=s.n(p),h=s(112),u=s.n(h),g=s(24265),_=s(5833),b=s(76660),E=s(45697),v=s.n(E),y=s(30806);function f(){return f=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},f.apply(this,arguments)}const w=function(e,t,s,a=null,n=null,i=null){try{return _.Z.convertValue(e,t,s,i||d.Z.getState().allMarketStats,n||y.ChainStore.getAsset("1.3.0"),a||!0)}catch(e){console.log(e)}};class k extends g.Z{static defaultProps={fullPrecision:!0,noDecimals:!1,fullDecimals:!1,hide_asset:!1};constructor(e){super(e)}shouldComponentUpdate(e){return super.shouldComponentUpdate(e)||!l.Z.are_equal_shallow(e.pulsate,this.props.pulsate)||e.toAsset!==this.props.toAsset||e.fromAsset!==this.props.fromAsset||e.amount!==this.props.amount}render(){let{amount:e,toAsset:t,fromAsset:s,fullPrecision:i,coreAsset:o,...r}=this.props,l=t.get("id"),c=t.get("symbol"),d=w(e,t,s,i,o);return d||0===d?a.createElement(n.Z,f({noPrefix:!0,amount:d,asset:l,decimalOffset:-1!==c.indexOf("BTC")?4:this.props.fullDecimals?0:this.props.noDecimals?t.get("precision"):t.get("precision")-2},r)):a.createElement(b.Tooltip,{placement:"bottom",title:u().translate("tooltip.no_price")},a.createElement("div",{className:"tooltip inline-block",style:{fontSize:"0.9rem"}},a.createElement(m(),{content:"account.no_price"})))}}k=(0,r.Z)(k,{propNames:["toAsset","fromAsset","coreAsset"],defaultProps:{toAsset:"1.3.0",coreAsset:"1.3.0"}});class C extends a.Component{render(){let{refCallback:e,...t}=this.props;return a.createElement(k,f({},t,{ref:e}))}}C=(0,c.$)(C,{listenTo:()=>[d.Z],getProps:()=>({allMarketStats:d.Z.getState().allMarketStats})});const x=function(e){const t=e.getIn(["balance","amount"]);return t||0===t?{asset_id:e.getIn(["balance","asset_id"]),amount:Number(e.getIn(["balance","amount"]))}:{asset_id:e.get("asset_type"),amount:Number(e.get("balance"))}};class A extends a.Component{static propTypes={balance:i.Z.ChainObject.isRequired,satoshis:v().number};static defaultProps={satoshis:null};render(){const{balance:e,...t}=this.props,s=x(e);let n=s.amount;this.props.satoshis&&(n=this.props.satoshis);let i=s.asset_id;return isNaN(n)?a.createElement("span",null,"--"):a.createElement(C,f({amount:n,fromAsset:i,noDecimals:!0,fullPrecision:!this.props.satoshis&&this.props.fullPrecision},t))}}A=(0,o.Z)(A,{keep_updating:!0})},70981:(e,t,s)=>{"use strict";s.d(t,{Z:()=>p});var a=s(67294),n=s(45697),i=s.n(n),o=s(76660),r=s(112),l=s.n(r);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 p({onChange:e,value:t,placeholder:s,maxLength:n,style:i,className:r,name:l,autoComplete:p,onClear:m,type:h,...u}){return null==m&&(m=()=>{e({target:{value:""}}),d.current.focus()}),a.createElement(o.Input,c({ref:d,autoComplete:p,style:i,type:h,className:r+" search-input",placeholder:s,maxLength:n,name:l,value:t,onChange:e,addonAfter:a.createElement(o.Icon,{type:"search"}),suffix:m?a.createElement(o.Icon,{onClick:m,type:"close",className:t?"cursor-pointer":"hide"}):a.createElement("span",null)},u))}p.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},p.defaultProps={placeholder:l().translate("exchange.filter"),style:{width:"200px"},className:"",type:"text",name:"focus",autoComplete:"off",maxLength:16,onClear:void 0}},1033:(e,t,s)=>{var a,n;n=function(e){!function(e){var t,s=e.addEvent,a=e.Axis,n=e.Chart,i=e.color,o=e.each,r=e.extend,l=e.isNumber,c=e.Legend,d=e.LegendSymbolMixin,p=e.noop,m=e.merge,h=e.pick;e.ColorAxis||(t=e.ColorAxis=function(){this.init.apply(this,arguments)},r(t.prototype,a.prototype),r(t.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},width:.01,color:"#999999"},labels:{overflow:"justify",rotation:0},minColor:"#e6ebf5",maxColor:"#003399",tickLength:5,showInLegend:!0},keepProps:["legendGroup","legendItemHeight","legendItemWidth","legendItem","legendSymbol"].concat(a.prototype.keepProps),init:function(e,t){var s,n="vertical"!==e.options.legend.layout;this.coll="colorAxis",s=m(this.defaultColorAxisOptions,{side:n?2:1,reversed:!n},t,{opposite:!n,showEmpty:!1,title:null,visible:e.options.legend.enabled}),a.prototype.init.call(this,e,s),t.dataClasses&&this.initDataClasses(t),this.initStops(),this.horiz=n,this.zoomEnabled=!1,this.defaultLegendLength=200},initDataClasses:function(e){var t,s=this.chart,a=0,n=s.options.chart.colorCount,r=this.options,l=e.dataClasses.length;this.dataClasses=t=[],this.legendItems=[],o(e.dataClasses,(function(e,o){e=m(e),t.push(e),e.color||("category"===r.dataClassColor?(o=s.options.colors,n=o.length,e.color=o[a],e.colorIndex=a,++a===n&&(a=0)):e.color=i(r.minColor).tweenTo(i(r.maxColor),2>l?.5:o/(l-1)))}))},setTickPositions:function(){if(!this.dataClasses)return a.prototype.setTickPositions.call(this)},initStops:function(){this.stops=this.options.stops||[[0,this.options.minColor],[1,this.options.maxColor]],o(this.stops,(function(e){e.color=i(e[1])}))},setOptions:function(e){a.prototype.setOptions.call(this,e),this.options.crosshair=this.options.marker},setAxisSize:function(){var e,t,s=this.legendSymbol,a=this.chart,n=a.options.legend||{};s?(this.left=n=s.attr("x"),this.top=e=s.attr("y"),this.width=t=s.attr("width"),this.height=s=s.attr("height"),this.right=a.chartWidth-n-t,this.bottom=a.chartHeight-e-s,this.len=this.horiz?t:s,this.pos=this.horiz?n:e):this.len=(this.horiz?n.symbolWidth:n.symbolHeight)||this.defaultLegendLength},normalizedValue:function(e){return this.isLog&&(e=this.val2lin(e)),1-(this.max-e)/(this.max-this.min||1)},toColor:function(e,t){var s,a,n,i,o=this.stops,r=this.dataClasses;if(r){for(i=r.length;i--;)if(s=(n=r[i]).from,o=n.to,(void 0===s||e>=s)&&(void 0===o||e<=o)){a=n.color,t&&(t.dataClass=i,t.colorIndex=n.colorIndex);break}}else{for(e=this.normalizedValue(e),i=o.length;i--&&!(e>o[i][0]););s=o[i]||o[i+1],e=1-((o=o[i+1]||s)[0]-e)/(o[0]-s[0]||1),a=s.color.tweenTo(o.color,e)}return a},getOffset:function(){var e=this.legendGroup,t=this.chart.axisOffset[this.side];e&&(this.axisParent=e,a.prototype.getOffset.call(this),this.added||(this.added=!0,this.labelLeft=0,this.labelRight=this.width),this.chart.axisOffset[this.side]=t)},setLegendColor:function(){var e,t=this.reversed;e=t?1:0,t=t?0:1,e=this.horiz?[e,0,t,0]:[0,t,0,e],this.legendColor={linearGradient:{x1:e[0],y1:e[1],x2:e[2],y2:e[3]},stops:this.stops}},drawLegendSymbol:function(e,t){var s=e.padding,a=e.options,n=this.horiz,i=h(a.symbolWidth,n?this.defaultLegendLength:12),o=h(a.symbolHeight,n?12:this.defaultLegendLength),r=h(a.labelPadding,n?16:30);a=h(a.itemDistance,10),this.setLegendColor(),t.legendSymbol=this.chart.renderer.rect(0,e.baseline-11,i,o).attr({zIndex:1}).add(t.legendGroup),this.legendItemWidth=i+s+(n?a:r),this.legendItemHeight=o+s+(n?r:0)},setState:function(e){o(this.series,(function(t){t.setState(e)}))},visible:!0,setVisible:p,getSeriesExtremes:function(){var e=this.series,t=e.length;for(this.dataMin=1/0,this.dataMax=-1/0;t--;)e[t].getExtremes(),void 0!==e[t].valueMin&&(this.dataMin=Math.min(this.dataMin,e[t].valueMin),this.dataMax=Math.max(this.dataMax,e[t].valueMax))},drawCrosshair:function(e,t){var s,n=t&&t.plotX,i=t&&t.plotY,o=this.pos,r=this.len;t&&((s=this.toPixels(t[t.series.colorKey]))<o?s=o-2:s>o+r&&(s=o+r+2),t.plotX=s,t.plotY=this.len-s,a.prototype.drawCrosshair.call(this,e,t),t.plotX=n,t.plotY=i,this.cross&&!this.cross.addedToColorAxis&&this.legendGroup&&(this.cross.addClass("highcharts-coloraxis-marker").add(this.legendGroup),this.cross.addedToColorAxis=!0,this.cross.attr({fill:this.crosshair.color})))},getPlotLinePath:function(e,t,s,n,i){return l(i)?this.horiz?["M",i-4,this.top-6,"L",i+4,this.top-6,i,this.top,"Z"]:["M",this.left,i,"L",this.left-6,i+6,this.left-6,i-6,"Z"]:a.prototype.getPlotLinePath.call(this,e,t,s,n)},update:function(e,t){var s=this.chart,n=s.legend;o(this.series,(function(e){e.isDirtyData=!0})),e.dataClasses&&n.allItems&&(o(n.allItems,(function(e){e.isDataClass&&e.legendGroup&&e.legendGroup.destroy()})),s.isDirtyLegend=!0),s.options[this.coll]=m(this.userOptions,e),a.prototype.update.call(this,e,t),this.legendItem&&(this.setLegendColor(),n.colorizeItem(this,!0))},remove:function(){this.legendItem&&this.chart.legend.destroyItem(this),a.prototype.remove.call(this)},getDataClassLegendSymbols:function(){var t,s=this,a=this.chart,n=this.legendItems,i=a.options.legend,l=i.valueDecimals,c=i.valueSuffix||"";return n.length||o(this.dataClasses,(function(i,m){var h=!0,u=i.from,g=i.to;t="",void 0===u?t="< ":void 0===g&&(t="> "),void 0!==u&&(t+=e.numberFormat(u,l)+c),void 0!==u&&void 0!==g&&(t+=" - "),void 0!==g&&(t+=e.numberFormat(g,l)+c),n.push(r({chart:a,name:t,options:{},drawLegendSymbol:d.drawRectangle,visible:!0,setState:p,isDataClass:!0,setVisible:function(){h=this.visible=!h,o(s.series,(function(e){o(e.points,(function(e){e.dataClass===m&&e.setVisible(h)}))})),a.legend.colorizeItem(this,h)}},i))})),n},name:""}),o(["fill","stroke"],(function(t){e.Fx.prototype[t+"Setter"]=function(){this.elem.attr(t,i(this.start).tweenTo(i(this.end),this.pos),null,!0)}})),s(n,"afterGetAxes",(function(){var e=this.options.colorAxis;this.colorAxis=[],e&&new t(this,e)})),s(c,"afterGetAllItems",(function(t){var s=[],a=this.chart.colorAxis[0];for(a&&a.options&&a.options.showInLegend&&(a.options.dataClasses?s=a.getDataClassLegendSymbols():s.push(a),o(a.series,(function(s){e.erase(t.allItems,s)}))),a=s.length;a--;)t.allItems.unshift(s[a])})),s(c,"afterColorizeItem",(function(e){e.visible&&e.item.legendColor&&e.item.legendSymbol.attr({fill:e.item.legendColor})})),s(c,"afterUpdate",(function(e,t,s){this.chart.colorAxis[0]&&this.chart.colorAxis[0].update({},s)})))}(e),function(e){var t=e.defined,s=e.each,a=e.noop,n=e.seriesTypes;e.colorPointMixin={isValid:function(){return null!==this.value&&1/0!==this.value&&-1/0!==this.value},setVisible:function(e){var t=this,a=e?"show":"hide";t.visible=!!e,s(["graphic","dataLabel"],(function(e){t[e]&&t[e][a]()}))},setState:function(t){e.Point.prototype.setState.call(this,t),this.graphic&&this.graphic.attr({zIndex:"hover"===t?1:0})}},e.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:a,parallelArrays:["x","y","value"],colorKey:"value",pointAttribs:n.column.prototype.pointAttribs,translateColors:function(){var e=this,t=this.options.nullColor,a=this.colorAxis,n=this.colorKey;s(this.data,(function(s){var i=s[n];(i=s.options.color||(s.isNull?t:a&&void 0!==i?a.toColor(i,s):s.color||e.color))&&(s.color=i)}))},colorAttribs:function(e){var s={};return t(e.color)&&(s[this.colorProp||"fill"]=e.color),s}}}(e),function(e){var t=e.colorPointMixin,s=e.each,a=e.merge,n=e.noop,i=e.pick,o=e.Series,r=e.seriesType,l=e.seriesTypes;r("heatmap","scatter",{animation:!1,borderWidth:0,nullColor:"#f7f7f7",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{hover:{halo:!1,brightness:.2}}},a(e.colorSeriesMixin,{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var e;l.scatter.prototype.init.apply(this,arguments),(e=this.options).pointRange=i(e.pointRange,e.colsize||1),this.yAxis.axisPointRange=e.rowsize||1},translate:function(){var e=this.options,t=this.xAxis,a=this.yAxis,n=e.pointPadding||0,o=function(e,t,s){return Math.min(Math.max(t,e),s)};this.generatePoints(),s(this.points,(function(s){var r=(e.colsize||1)/2,l=(e.rowsize||1)/2,c=o(Math.round(t.len-t.translate(s.x-r,0,1,0,1)),-t.len,2*t.len),d=(r=o(Math.round(t.len-t.translate(s.x+r,0,1,0,1)),-t.len,2*t.len),o(Math.round(a.translate(s.y-l,0,1,0,1)),-a.len,2*a.len)),p=(l=o(Math.round(a.translate(s.y+l,0,1,0,1)),-a.len,2*a.len),i(s.pointPadding,n));s.plotX=s.clientX=(c+r)/2,s.plotY=(d+l)/2,s.shapeType="rect",s.shapeArgs={x:Math.min(c,r)+p,y:Math.min(d,l)+p,width:Math.abs(r-c)-2*p,height:Math.abs(l-d)-2*p}})),this.translateColors()},drawPoints:function(){l.column.prototype.drawPoints.call(this),s(this.points,(function(e){e.graphic.attr(this.colorAttribs(e))}),this)},animate:n,getBox:n,drawLegendSymbol:e.LegendSymbolMixin.drawRectangle,alignDataLabel:l.column.prototype.alignDataLabel,getExtremes:function(){o.prototype.getExtremes.call(this,this.valueData),this.valueMin=this.dataMin,this.valueMax=this.dataMax,o.prototype.getExtremes.call(this)}}),e.extend({haloPath:function(e){if(!e)return[];var t=this.shapeArgs;return["M",t.x-e,t.y-e,"L",t.x-e,t.y+t.height+e,t.x+t.width+e,t.y+t.height+e,t.x+t.width+e,t.y-e,"Z"]}},t))}(e)},e.exports?e.exports=n:void 0===(a=function(){return n}.call(t,s,t,e))||(e.exports=a)},57473:(e,t,s)=>{var a,n;n=function(e){var t=function(e){var t=e.each,s=e.extend,a=e.isArray,n=e.isObject,i=e.isNumber,o=e.merge,r=e.pick,l=e.reduce;return{getColor:function(t,s){var a,n,i,o,l=s.index,c=s.mapOptionsToLevel,d=s.parentColor,p=s.parentColorIndex,m=s.series,h=s.colors,u=s.siblings,g=m.points;return t&&(g=g[t.i],t=c[t.level]||{},(a=g&&t.colorByPoint)&&(i=g.index%(h?h.length:m.chart.options.chart.colorCount),n=h&&h[i]),h=g&&g.options.color,a=t&&t.color,(c=d)&&(c=(c=t&&t.colorVariation)&&"brightness"===c.key?e.color(d).brighten(l/u*c.to).get():d),a=r(h,a,n,c,m.color),o=r(g&&g.options.colorIndex,t&&t.colorIndex,i,p,s.colorIndex)),{color:a,colorIndex:o}},getLevelOptions:function(e){var t,r,c,d,p=null;if(n(e))for(p={},c=i(e.from)?e.from:1,d=e.levels,r={},t=n(e.defaults)?e.defaults:{},a(d)&&(r=l(d,(function(e,a){var r,l;return n(a)&&i(a.level)&&(r="boolean"==typeof(l=o({},a)).levelIsConstant?l.levelIsConstant:t.levelIsConstant,delete l.levelIsConstant,delete l.level,a=a.level+(r?0:c-1),n(e[a])?s(e[a],l):e[a]=l),e}),{})),d=i(e.to)?e.to:1,e=0;e<=d;e++)p[e]=o({},t,n(r[e])?r[e]:{});return p},setTreeValues:function e(a,n){var i=n.before,o=n.idRoot,l=n.mapIdToNode[o],c=n.points[a.i],d=c&&c.options||{},p=0,m=[];return s(a,{levelDynamic:a.level-("boolean"!=typeof n.levelIsConstant||n.levelIsConstant?0:l.level),name:r(c&&c.name,""),visible:o===a.id||"boolean"==typeof n.visible&&n.visible}),"function"==typeof i&&(a=i(a,n)),t(a.children,(function(t,i){var o=s({},n);s(o,{index:i,siblings:a.children.length,visible:a.visible}),t=e(t,o),m.push(t),t.visible&&(p+=t.val)})),a.visible=0<p||a.visible,i=r(d.value,p),s(a,{children:m,childrenTotal:p,isLeaf:a.visible&&!p,val:i}),a},updateRootId:function(e){var t;return n(e)&&(t=n(e.options)?e.options:{},t=r(e.rootNode,t.rootId,""),n(e.userOptions)&&(e.userOptions.rootId=t),e.rootNode=t),t}}}(e);!function(e,t){var s=e.seriesType,a=e.seriesTypes,n=e.map,i=e.merge,o=e.extend,r=e.noop,l=e.each,c=t.getColor,d=t.getLevelOptions,p=e.grep,m=e.isArray,h=e.isNumber,u=e.isObject,g=e.isString,_=e.pick,b=e.Series,E=e.stableSort,v=e.Color,y=e.reduce,f=function(e,t,s){s=s||this,!1!==(e=t.call(s,e))&&f(e,t,s)},w=t.updateRootId;s("treemap","scatter",{showInLegend:!1,marker:!1,colorByPoint:!1,dataLabels:{enabled:!0,defer:!1,verticalAlign:"middle",formatter:function(){return this.point.name||this.point.id},inside:!0},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}<br/>"},ignoreHiddenPoint:!0,layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,opacity:.15,states:{hover:{borderColor:"#999999",brightness:a.heatmap?0:.1,halo:!1,opacity:.75,shadow:!1}}},{pointArrayMap:["value"],directTouch:!0,optionalAxis:"colorAxis",getSymbol:r,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(t,s){t=m(t)?t:[];var a=m(s)?s:[];return s=y(t,(function(e,t,s){return void 0===e[t=_(t.parent,"")]&&(e[t]=[]),e[t].push(s),e}),{"":[]}),function(t,s,a){a=a||this,e.objectEach(t,(function(e,n){s.call(a,e,n,t)}))}(s,(function(t,s,n){""!==s&&-1===e.inArray(s,a)&&(l(t,(function(e){n[""].push(e)})),delete n[s])})),s},getTree:function(){var e=n(this.data,(function(e){return e.id}));return e=this.getListOfParents(this.data,e),this.nodeMap=[],this.buildNode("",-1,0,e,null)},init:function(t,s){var a=e.colorSeriesMixin;e.colorSeriesMixin&&(this.translateColors=a.translateColors,this.colorAttribs=a.colorAttribs,this.axisTypes=a.axisTypes),b.prototype.init.call(this,t,s),this.options.allowDrillToNode&&e.addEvent(this,"click",this.onClickDrillToNode)},buildNode:function(e,t,s,a,n){var i,o=this,r=[],c=o.points[t],d=0;return l(a[e]||[],(function(t){i=o.buildNode(o.points[t].id,t,s+1,a,e),d=Math.max(i.height+1,d),r.push(i)})),t={id:e,i:t,children:r,height:d,level:s,parent:n,visible:!1},o.nodeMap[t.id]=t,c&&(c.node=t),t},setTreeValues:function(e){var t,s=this,a=s.options,n=s.nodeMap[s.rootNode],i=(a="boolean"!=typeof a.levelIsConstant||a.levelIsConstant,0),r=[],c=s.points[e.i];return l(e.children,(function(e){e=s.setTreeValues(e),r.push(e),e.ignore||(i+=e.val)})),E(r,(function(e,t){return e.sortIndex-t.sortIndex})),t=_(c&&c.options.value,i),c&&(c.value=t),o(e,{children:r,childrenTotal:i,ignore:!(_(c&&c.visible,!0)&&0<t),isLeaf:e.visible&&!i,levelDynamic:e.level-(a?0:n.level),name:_(c&&c.name,""),sortIndex:_(c&&c.sortIndex,-t),val:t}),e},calculateChildrenAreas:function(e,t){var s,a=this,n=a.options,o=a.mapOptionsToLevel[e.level+1],r=_(a[o&&o.layoutAlgorithm]&&o.layoutAlgorithm,n.layoutAlgorithm),c=n.alternateStartingDirection;e=p(e.children,(function(e){return!e.ignore})),o&&o.layoutStartingDirection&&(t.direction="vertical"===o.layoutStartingDirection?0:1),s=a[r](t,e),l(e,(function(e,n){n=s[n],e.values=i(n,{val:e.childrenTotal,direction:c?1-t.direction:t.direction}),e.pointValues=i(n,{x:n.x/a.axisRatio,width:n.width/a.axisRatio}),e.children.length&&a.calculateChildrenAreas(e,e.values)}))},setPointValues:function(){var e=this,t=e.xAxis,s=e.yAxis;l(e.points,(function(a){var n,i,o,r=a.node,l=r.pointValues;o=(e.pointAttribs(a)["stroke-width"]||0)%2/2,l&&r.visible?(r=Math.round(t.translate(l.x,0,0,0,1))-o,n=Math.round(t.translate(l.x+l.width,0,0,0,1))-o,i=Math.round(s.translate(l.y,0,0,0,1))-o,l=Math.round(s.translate(l.y+l.height,0,0,0,1))-o,a.shapeType="rect",a.shapeArgs={x:Math.min(r,n),y:Math.min(i,l),width:Math.abs(n-r),height:Math.abs(l-i)},a.plotX=a.shapeArgs.x+a.shapeArgs.width/2,a.plotY=a.shapeArgs.y+a.shapeArgs.height/2):(delete a.plotX,delete a.plotY)}))},setColorRecursive:function(e,t,s,a,n){var i,o=this,r=(r=o&&o.chart)&&r.options&&r.options.colors;e&&(i=c(e,{colors:r,index:a,mapOptionsToLevel:o.mapOptionsToLevel,parentColor:t,parentColorIndex:s,series:o,siblings:n}),(t=o.points[e.i])&&(t.color=i.color,t.colorIndex=i.colorIndex),l(e.children||[],(function(t,s){o.setColorRecursive(t,i.color,i.colorIndex,s,e.children.length)})))},algorithmGroup:function(e,t,s,a){this.height=e,this.width=t,this.plot=a,this.startDirection=this.direction=s,this.lH=this.nH=this.lW=this.nW=this.total=0,this.elArr=[],this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(e,t){return Math.max(e/t,t/e)}},this.addElement=function(e){this.lP.total=this.elArr[this.elArr.length-1],this.total+=e,0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH)),this.elArr.push(e)},this.reset=function(){this.lW=this.nW=0,this.elArr=[],this.total=0}},algorithmCalcPoints:function(e,t,s,a){var n,i,o,r,c,d=s.lW,p=s.lH,m=s.plot,h=0,u=s.elArr.length-1;t?(d=s.nW,p=s.nH):c=s.elArr[s.elArr.length-1],l(s.elArr,(function(e){(t||h<u)&&(0===s.direction?(n=m.x,i=m.y,r=e/(o=d)):(n=m.x,i=m.y,o=e/(r=p)),a.push({x:n,y:i,width:o,height:r}),0===s.direction?m.y+=r:m.x+=o),h+=1})),s.reset(),0===s.direction?s.width-=d:s.height-=p,m.y=m.parent.y+(m.parent.height-s.height),m.x=m.parent.x+(m.parent.width-s.width),e&&(s.direction=1-s.direction),t||s.addElement(c)},algorithmLowAspectRatio:function(e,t,s){var a,n=[],i=this,o={x:t.x,y:t.y,parent:t},r=0,c=s.length-1,d=new this.algorithmGroup(t.height,t.width,t.direction,o);return l(s,(function(s){a=s.val/t.val*t.height*t.width,d.addElement(a),d.lP.nR>d.lP.lR&&i.algorithmCalcPoints(e,!1,d,n,o),r===c&&i.algorithmCalcPoints(e,!0,d,n,o),r+=1})),n},algorithmFill:function(e,t,s){var a,n,i,o,r,c=[],d=t.direction,p=t.x,m=t.y,h=t.width,u=t.height;return l(s,(function(s){a=s.val/t.val*t.height*t.width,n=p,i=m,0===d?(h-=o=a/(r=u),p+=o):(u-=r=a/(o=h),m+=r),c.push({x:n,y:i,width:o,height:r}),e&&(d=1-d)})),c},strip:function(e,t){return this.algorithmLowAspectRatio(!1,e,t)},squarified:function(e,t){return this.algorithmLowAspectRatio(!0,e,t)},sliceAndDice:function(e,t){return this.algorithmFill(!0,e,t)},stripes:function(e,t){return this.algorithmFill(!1,e,t)},translate:function(){var e,t,s=this,a=s.options,n=w(s);b.prototype.translate.call(s),t=s.tree=s.getTree(),e=s.nodeMap[n],s.mapOptionsToLevel=d({from:e.level+1,levels:a.levels,to:t.height,defaults:{levelIsConstant:s.options.levelIsConstant,colorByPoint:a.colorByPoint}}),""===n||e&&e.children.length||(s.drillToNode("",!1),n=s.rootNode,e=s.nodeMap[n]),f(s.nodeMap[s.rootNode],(function(e){var t=!1,a=e.parent;return e.visible=!0,(a||""===a)&&(t=s.nodeMap[a]),t})),f(s.nodeMap[s.rootNode].children,(function(e){var t=!1;return l(e,(function(e){e.visible=!0,e.children.length&&(t=(t||[]).concat(e.children))})),t})),s.setTreeValues(t),s.axisRatio=s.xAxis.len/s.yAxis.len,s.nodeMap[""].pointValues=n={x:0,y:0,width:100,height:100},s.nodeMap[""].values=n=i(n,{width:n.width*s.axisRatio,direction:"vertical"===a.layoutStartingDirection?0:1,val:t.val}),s.calculateChildrenAreas(t,n),s.colorAxis?s.translateColors():a.colorByPoint||s.setColorRecursive(s.tree),a.allowDrillToNode&&(a=e.pointValues,s.xAxis.setExtremes(a.x,a.x+a.width,!1),s.yAxis.setExtremes(a.y,a.y+a.height,!1),s.xAxis.setScale(),s.yAxis.setScale()),s.setPointValues()},drawDataLabels:function(){var e,t,s=this,a=s.mapOptionsToLevel,n=p(s.points,(function(e){return e.node.visible}));l(n,(function(n){t=a[n.node.level],e={style:{}},n.node.isLeaf||(e.enabled=!1),t&&t.dataLabels&&(e=i(e,t.dataLabels),s._hasPointLabels=!0),n.shapeArgs&&(e.style.width=n.shapeArgs.width,n.dataLabel&&n.dataLabel.css({width:n.shapeArgs.width+"px"})),n.dlOptions=i(e,n.options.dataLabels)})),b.prototype.drawDataLabels.call(this)},alignDataLabel:function(e){a.column.prototype.alignDataLabel.apply(this,arguments),e.dataLabel&&e.dataLabel.attr({zIndex:(e.node.zIndex||0)+1})},pointAttribs:function(e,t){var s=u(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},a=e&&s[e.node.level]||{},n=(s=this.options,t&&s.states[t]||{}),i=e&&e.getClassName()||"";return e={stroke:e&&e.borderColor||a.borderColor||n.borderColor||s.borderColor,"stroke-width":_(e&&e.borderWidth,a.borderWidth,n.borderWidth,s.borderWidth),dashstyle:e&&e.borderDashStyle||a.borderDashStyle||n.borderDashStyle||s.borderDashStyle,fill:e&&e.color||this.color},-1!==i.indexOf("highcharts-above-level")?(e.fill="none",e["stroke-width"]=0):-1!==i.indexOf("highcharts-internal-node-interactive")?(t=_(n.opacity,s.opacity),e.fill=v(e.fill).setOpacity(t).get(),e.cursor="pointer"):-1!==i.indexOf("highcharts-internal-node")?e.fill="none":t&&(e.fill=v(e.fill).brighten(n.brightness).get()),e},drawPoints:function(){var e=this,t=p(e.points,(function(e){return e.node.visible}));l(t,(function(t){var s="level-group-"+t.node.levelDynamic;e[s]||(e[s]=e.chart.renderer.g(s).attr({zIndex:1e3-t.node.levelDynamic}).add(e.group)),t.group=e[s]})),a.column.prototype.drawPoints.call(this),e.options.allowDrillToNode&&l(t,(function(t){t.graphic&&(t.drillId=e.options.interactByLeaf?e.drillToByLeaf(t):e.drillToByGroup(t))}))},onClickDrillToNode:function(e){var t=(e=e.point)&&e.drillId;g(t)&&(e.setState(""),this.drillToNode(t))},drillToByGroup:function(e){var t=!1;return 1!=e.node.level-this.nodeMap[this.rootNode].level||e.node.isLeaf||(t=e.id),t},drillToByLeaf:function(e){var t=!1;if(e.node.parent!==this.rootNode&&e.node.isLeaf)for(e=e.node;!t;)(e=this.nodeMap[e.parent]).parent===this.rootNode&&(t=e.id);return t},drillUp:function(){var e=this.nodeMap[this.rootNode];e&&g(e.parent)&&this.drillToNode(e.parent)},drillToNode:function(e,t){var s=this.nodeMap[e];this.idPreviousRoot=this.rootNode,this.rootNode=e,""===e?this.drillUpButton=this.drillUpButton.destroy():this.showDrillUpButton(s&&s.name||e),this.isDirty=!0,_(t,!0)&&this.chart.redraw()},showDrillUpButton:function(e){var t=this;e=e||"< Back";var s,a,n=t.options.drillUpButton;n.text&&(e=n.text),this.drillUpButton?(this.drillUpButton.placed=!1,this.drillUpButton.attr({text:e}).align()):(a=(s=n.theme)&&s.states,this.drillUpButton=this.chart.renderer.button(e,null,null,(function(){t.drillUp()}),s,a&&a.hover,a&&a.select).addClass("highcharts-drillup-button").attr({align:n.position.align,zIndex:7}).add().align(n.position,!1,n.relativeTo||"plotBox"))},buildKDTree:r,drawLegendSymbol:e.LegendSymbolMixin.drawRectangle,getExtremes:function(){b.prototype.getExtremes.call(this,this.colorValueData),this.valueMin=this.dataMin,this.valueMax=this.dataMax,b.prototype.getExtremes.call(this)},getExtremesFromAll:!0,bindAxes:function(){var t={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};b.prototype.bindAxes.call(this),e.extend(this.yAxis.options,t),e.extend(this.xAxis.options,t)},utils:{recursive:f,reduce:y}},{getClassName:function(){var t=e.Point.prototype.getClassName.call(this),s=this.series,a=s.options;return this.node.level<=s.nodeMap[s.rootNode].level?t+=" highcharts-above-level":this.node.isLeaf||_(a.interactByLeaf,!a.allowDrillToNode)?this.node.isLeaf||(t+=" highcharts-internal-node"):t+=" highcharts-internal-node-interactive",t},isValid:function(){return this.id||h(this.value)},setState:function(t){e.Point.prototype.setState.call(this,t),this.graphic&&this.graphic.attr({zIndex:"hover"===t?1:0})},setVisible:a.pie.prototype.pointClass.prototype.setVisible})}(e,t)},e.exports?e.exports=n:void 0===(a=function(){return n}.call(t,s,t,e))||(e.exports=a)},95806:e=>{function t(e,t){if(!e.length&&!t.length)return 1;if(!e.length||!t.length)return 0;if(e.toUpperCase()===t.toUpperCase())return 1;if(1===e.length&&1===t.length)return 0;const s=n(e),a=n(t),i=s.length+a.length;let o=0;return s.forEach((e=>{for(let t,s=0;t=a[s];s++)if(e===t){o++,a.splice(s,1);break}})),2*o/i}function s(e){return Array.isArray(e)?e.reduce(((e,t)=>e.concat(s(t))),[]):[e]}function a(e){const t=[];for(let s=0,a=e.length-1;s<a;s++)t[s]=e.substring(s,s+2);return t}function n(e){return s(e.toUpperCase().split(" ").map(a))}e.exports={compareTwoStrings:t,findBestMatch:function(e,s){if(!function(e,t){return"string"==typeof e&&!!Array.isArray(t)&&!!t.length&&!t.find((e=>"string"!=typeof e))}(e,s))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const a=s.map((s=>({target:s,rating:t(e,s)})));return{ratings:a,bestMatch:Array.from(a).sort(((e,t)=>t.rating-e.rating))[0]}}}}}]);