(self.webpackChunkwebmft=self.webpackChunkwebmft||[]).push([[179],{47:(e,t,n)=>{var i={"./strings.en.js":[4670,12],"./strings.ru.js":[3399,285]};function s(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],s=t[0];return n.e(t[1]).then((()=>n.t(s,7)))}s.keys=()=>Object.keys(i),s.id=47,e.exports=s},5620:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("appName",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_about_version",e,t,0))),i.b(" "),i.b(i.v(i.f("version",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' '),i.b(i.v(i.f("linkText",e,t,0))),i.b("\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
\r\n
{{appName}}
\r\n
{{R.SR_about_version}} {{version}}
\r\n \r\n {{linkText}}\r\n
\r\n
\r\n
\r\n
',i)},1865:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.s(i.f("depositEnabled",e,t,1),e,t,0,572,704,"{{ }}")&&(i.rs(e,t,(function(e,t,i){i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n)})),e.pop()),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n {{#depositEnabled}}\r\n
\r\n \r\n {{/depositEnabled}}\r\n
',i)},2304:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_root_market_value",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("value",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_root_cash_retention",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("reserve",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_root_pnl",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("pnl",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
{{R.SR_root_market_value}}
\r\n
{{value}}
\r\n
\r\n
\r\n
\r\n
{{R.SR_root_cash_retention}}
\r\n
{{reserve}}
\r\n
\r\n
\r\n
\r\n
{{R.SR_root_pnl}}
\r\n
{{pnl}}
\r\n
',i)},876:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.s(i.f("languages",e,t,1),e,t,0,85,297,"{{ }}")&&(i.rs(e,t,(function(e,t,i){i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("name",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b("
\r"),i.b("\n"+n)})),e.pop()),i.b("
\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
\r\n {{#languages}}\r\n
\r\n
{{name}}
\r\n
\r\n
\r\n {{/languages}}\r\n
\r\n \r\n \r\n
',i)},594:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n \r\n
',i)},2184:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_root_reconnect_message",e,t,0))),i.b(" ...
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' ‹ '),i.b(i.v(i.d("R.SR_root_reconnect_back_to_login",e,t,0))),i.b("\r"),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
{{R.SR_root_reconnect_message}} ...
\r\n
\r\n ‹ {{R.SR_root_reconnect_back_to_login}}\r\n
',i)},5247:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b(" \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
',i)},6336:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b(' \x3c!--
--\x3e\r'),i.b("\n"+n),i.b('

'),i.b(i.v(i.d("R.SR_invest_demo_thanks",e,t,0))),i.b("

\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n \x3c!--
--\x3e\r\n

{{R.SR_invest_demo_thanks}}

\r\n \r\n \r\n
',i)},8090:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('

'),i.b(i.v(i.d("R.SR_invest_demo_message",e,t,0))),i.b("

\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n

{{R.SR_invest_demo_message}}

\r\n \r\n \r\n
',i)},5656:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('"),i.fl()},partials:{},subs:{}},'',i)},8430:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('"),i.fl()},partials:{},subs:{}},'',i)},5673:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('"),i.fl()},partials:{},subs:{}},'',i)},3007:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('

'),i.b(i.v(i.d("R.SR_invest_high_risk",e,t,0))),i.b("

\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
\r\n

{{R.SR_invest_high_risk}}

\r\n
\r\n
\r\n \r\n \r\n
\r\n
',i)},8998:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("fundName",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_invest_indicative_price",e,t,0))),i.b(":
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("price",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_invest_position_value",e,t,0))),i.b(":
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("positionValue",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_invest_min_invest",e,t,0))),i.b(': '),i.b(i.v(i.d("R.SR_info_min_invest",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("invest.minStr",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_invest_max_invest",e,t,0))),i.b(': '),i.b(i.v(i.d("R.SR_info_max_invest",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("invest.maxStr",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("invest.multiplierStr",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("invest.approxUnitsStr",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
*'),i.b(i.v(i.d("R.SR_disclaimer_invest",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_position_subscription_fee",e,t,0))),i.b(': '),i.b(i.v(i.d("R.SR_info_subscription_fee",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("commission",e,t,0))),i.b("*
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_position_cash_retention",e,t,0))),i.b(': '),i.b(i.v(i.d("R.SR_info_cash_retention",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("reserve",e,t,0))),i.b("*
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.d("R.SR_invest_expected_confirmation_date",e,t,0))),i.b(":
\r"),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("confirmationDate",e,t,0))),i.b("
\r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r'),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
{{fundName}}
\r\n
\r\n
\r\n
{{R.SR_invest_indicative_price}}:
\r\n
{{price}}
\r\n
\r\n
\r\n
{{R.SR_invest_position_value}}:
\r\n
{{positionValue}}
\r\n
\r\n
\r\n
{{R.SR_invest_min_invest}}: {{R.SR_info_min_invest}}
\r\n
{{invest.minStr}}
\r\n
\r\n
\r\n
{{R.SR_invest_max_invest}}: {{R.SR_info_max_invest}}
\r\n
{{invest.maxStr}}
\r\n
\r\n
{{invest.multiplierStr}}
\r\n \r\n
\r\n
{{invest.approxUnitsStr}}
\r\n
*{{R.SR_disclaimer_invest}}
\r\n
\r\n
{{R.SR_position_subscription_fee}}: {{R.SR_info_subscription_fee}}
\r\n
{{commission}}*
\r\n
\r\n
\r\n
{{R.SR_position_cash_retention}}: {{R.SR_info_cash_retention}}
\r\n
{{reserve}}*
\r\n
\r\n
\r\n
{{R.SR_invest_expected_confirmation_date}}:
\r\n
{{confirmationDate}}
\r\n
\r\n \r\n \r\n
',i)},1388:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b("

"),i.b(i.v(i.f("message",e,t,0))),i.b("

\r"),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n

{{message}}

\r\n
\r\n \r\n
',i)},7287:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('

'),i.b(i.v(i.f("message",e,t,0))),i.b("

\r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n

{{message}}

\r\n \r\n
',i)},532:(e,t,n)=>{var i=n(5485);e.exports=new i.Template({code:function(e,t,n){var i=this;return i.b(n=n||""),i.b('
\r'),i.b("\n"+n),i.b('
'),i.b(i.v(i.f("message",e,t,0))),i.b("
\r"),i.b("\n"+n),i.s(i.f("buttonsOk",e,t,1),e,t,0,108,292,"{{ }}")&&(i.rs(e,t,(function(e,t,i){i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n)})),e.pop()),i.s(i.f("buttonsOkCancel",e,t,1),e,t,0,332,666,"{{ }}")&&(i.rs(e,t,(function(e,t,i){i.b('
\r'),i.b("\n"+n),i.b('
\r'),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b(' \r"),i.b("\n"+n),i.b("
\r"),i.b("\n"+n)})),e.pop()),i.b("
"),i.fl()},partials:{},subs:{}},'
\r\n
{{message}}
\r\n {{#buttonsOk}}\r\n
\r\n \r\n {{/buttonsOk}}\r\n {{#buttonsOkCancel}}\r\n
\r\n
\r\n \r\n \r\n
\r\n {{/buttonsOkCancel}}\r\n
',i)},7987:(e,t,n)=>{"use strict";var i=n(8422),s=n(1832),o=(n(5421),n(3147)),r=n(7041),a=n(9755);class l{constructor(e){this.address=e,this.shouldBeConnected=!1,this.platformBidAskUpdatedEvt=new o.XF,this.positionOpenedEvt=new o.XF,this.positionUpdatedEvt=new o.XF,this.positionClosedEvt=new o.XF,this.addInstrumentEvt=new o.XF,this.removeInstrumentEvt=new o.XF,this.updateAccountBalanceEvt=new o.XF,this.newInstrumentSubscriptionEvt=new o.XF,this.newHistoryTransactionEvt=new o.XF,this.logoutEvt=new o.XF,this.reconnectedEvt=new o.XF,this.stateChangeEvt=new o.XF;let t=a.hubConnection(this.address);t.error((e=>{console.error("[SignalR] connection error: "+e.message)})),t.stateChanged((e=>{const t=`[SignalR] connection change '${u(e.oldState)}' -> '${u(e.newState)}'`;(4===e.newState?console.warn:console.log)(t),4!==e.newState||1!==e.oldState&&2!==e.oldState||!this.shouldBeConnected||this.stateChange.fire("disconnected"),1===e.newState&&this.stateChange.fire("connected")})),t.disconnected((()=>{this.shouldBeConnected?(console.log("document hidden ",document.hidden),console.log("[SignalR] restarting in 3 sec ..."),(0,o.gw)(3e3).then((async()=>{await this.connection.start(),this.reconnectedEvt.fire()}))):console.warn("[SignalR] Disconnected")}));let n=t.createHubProxy("TraderHub");n.on("PlatfromBidAskUpdated",(e=>{console.log(`[SignalR] PlatfromBidAskUpdated (${e.Time} iid=${e.InstrumentID} bid=${e.Bid}, ask=${e.Ask})`),this.platformBidAskUpdatedEvt.fire(e)})),n.on("OpenPosition",(e=>{console.log(`[SignalR] OpenPosition (tid=${e.TicketID})`),this.positionOpenedEvt.fire(e)})),n.on("UpdatePosition",(e=>{console.log(`[SignalR] UpdatePosition (tid=${e.TicketID})`),this.positionUpdatedEvt.fire(e)})),n.on("ClosePosition",(e=>{console.log(`[SignalR] ClosePosition (tid=${e.TicketID})`),this.positionClosedEvt.fire(e)})),n.on("UpdateAccountBalance",(e=>{console.log(`[SignalR] UpdateAccountBalance (aid=${e.AccountId} balance=${e.NewBalance})`),this.updateAccountBalanceEvt.fire(e)})),n.on("NewInstrumentSubscribe",(e=>{console.log(`[SignalR] NewInstrumentSubscribe (iid=${e.InstrumentID} name=${e.InstrumentFullName})`),this.newInstrumentSubscriptionEvt.fire(e)})),n.on("AddUserInstrumentNotification",(e=>{console.log("[SignalR] AddUserInstrumentNotification "+e.FundPlatformId),this.addInstrumentEvt.fire(e)})),n.on("RemoveUserInstrumentNotification",(e=>{console.log("[SignalR] RemoveUserInstrumentNotification "+e),this.removeInstrumentEvt.fire(e)})),n.on("NewHistoryTransaction",(e=>{console.log("[SignalR] NewHistoryTransaction ",e.TicketId,e.ConfirmationDate),this.newHistoryTransactionEvt.fire(e)})),n.on("Logout",(()=>{console.log("[SignalR] Logout"),this.logoutEvt.fire()})),n.on("UserCanceled",(()=>{console.log("[SignalR] UserCanceled"),this.logoutEvt.fire()})),t.logging=!0,this.connection=t,this.proxy=n}get platformBidAskUpdated(){return this.platformBidAskUpdatedEvt}get positionOpened(){return this.positionOpenedEvt}get positionUpdated(){return this.positionUpdatedEvt}get positionClosed(){return this.positionClosedEvt}get addInstrument(){return this.addInstrumentEvt}get removeInstrument(){return this.removeInstrumentEvt}get updateAccountBalance(){return this.updateAccountBalanceEvt}get newInstrumentSubscription(){return this.newInstrumentSubscriptionEvt}get newHistoryTransaction(){return this.newHistoryTransactionEvt}get logout(){return this.logoutEvt}get reconnected(){return this.reconnectedEvt}get stateChange(){return this.stateChangeEvt}async start(){this.shouldBeConnected=!0,await this.connection.start()}stop(){this.shouldBeConnected=!1,this.connection&&this.connection.stop()}async loginWithSmsCode(e,t,n,i){return await this.checkStarted(),new Promise(((s,o)=>{console.log(`[SignalR] CheckLoginSMSCode(phone=${e},code=${t},companyId=${n},language=${i})`),this.proxy.invoke("CheckLoginSMSCode",e,t,n,i,"",2).done(d(s,o)).fail(c(o))}))}async loginWithPassword(e,t,n,i){return await this.checkStarted(),new Promise(((s,o)=>{console.log(`[SignalR] ClientPlatformLogin(login=${e},password=,companyId=${n},language=${i})`),this.proxy.invoke("ClientPlatformLogin",e,t,i,"",null,n).done(d(s,o)).fail(c(o))}))}async loginWithRefreshKey(e,t,n,i){return await this.checkStarted(),console.log(`[SignalR] LoginWithRefreshKey(refreshKey=${e}, language=${t}, deviceType=${n}, version=${i})`),new Promise(((s,o)=>{this.proxy.invoke("LoginWithRefreshKey",e,null,null,t,n,i).done(d(s,o)).fail(c(o))}))}async changeLanguage(e){if(4!==this.connection.state)return console.log(`[SignalR] ChangeLanguage(language=${e})`),new Promise(((t,n)=>{this.proxy.invoke("ChangeLanguage",e).done(d(t,n)).fail(c(n))}))}async checkStarted(){4===this.connection.state&&await this.start()}}function c(e){return()=>{e((0,r.qF)("ConnectionError"))}}function d(e,t){return n=>{console.log(n);const i=(0,r.$b)(n);(0,r.Bw)(i)?t(i):e(i)}}function u(e){switch(e){case 1:return"connected";case 0:return"connecting";case 4:return"disconnected";case 2:return"reconnecting"}return"unknown state"}class h{constructor(){this.popEvt=new o.XF,window.addEventListener("popstate",(()=>{console.debug(`History: pop state (${window.location})`),this.popEvt.fire({location:window.location})})),this._initial=window.location}get initial(){return this._initial}get pop(){return this.popEvt}push(e,t){"push"===t?(console.log(`History: push ${e}`),window.history.pushState(null,"",e)):"replace"===t?(console.log(`History: replace ${e}`),window.history.replaceState(null,"",e)):console.log("History: none")}back(){window.history.back()}}class v{constructor(e,t,n){this.renderer=t,this.history=n,this.currentUri=null,this.currentRoute=null,this.routes=[],this._noroute=new o.XF,this._beforeNodeActivation=new o.XF,this._afterNavigate=new o.XF,this.addRoutes(e)}get current(){return this.currentUri}get noroute(){return this._noroute}get afterNavigate(){return this._afterNavigate}get beforeNodeActivation(){return this._beforeNodeActivation}start(){if(this.history.pop.sub((e=>{this.navigate(e.location.pathname+e.location.search,void 0,"none")})),this.history.initial){const e=this.history.initial;this.navigate(e.pathname+e.search,void 0,"none")}else console.error("Initial route?")}getParam(e){if(this.currentRoute)return this.currentRoute.query[e]}setParam(e,t){if(this.currentRoute&&e&&""!==e){t&&""!==t?this.currentRoute.query[e]=t:delete this.currentRoute.query[e];const n=this.currentRoute.pathname+function(e){const t=Object.keys(e);return(t.length>0?"?":"")+t.map((t=>{var n;return`${t}=${encodeURIComponent(null!==(n=e[t])&&void 0!==n?n:"")}`})).sort().join("&")}(this.currentRoute.query);this.currentUri=n,this.history.push(n,"replace")}}async navigate(e,t,n="push"){if(this.currentUri===e)return console.log("Already at requested uri"),Promise.resolve();await this.internalNavigate(e,n,t)}back(){this.history.back()}reload(){this.currentUri&&(this.renderer.clearNodes(),this.internalNavigate(this.currentUri,"none"))}async internalNavigate(e,t,n,i={value:0}){if(i.value>=5)throw"Max redirects";const s=e.split("?",2),o=s[0],r=s.length>1?s[1]:null;for(let s of this.routes){let a=s.regex.exec(o);if(!a)continue;a.shift();let l=[];a.length>0&&(l=a.map((function(e){let t=Number(e);return isNaN(t)?e:t})));let c={};if(r){const t=/(?:\&?(\w+)\=([^&=/]+))/gi;let n=null;for(;n=t.exec(e);)3==n.length?c[n[1]]=decodeURIComponent(n[2]):console.error("Match query string: Invalid group length")}let d=[];for(let e=0;ethis._beforeNodeActivation.fire({uri:o,node:r.name,last:e==s.nodes.length-1});if(r.canActivate){const e=r.canActivate.canActivate();let s;if(e instanceof Promise){const t=this.renderer.nodes ${n})`):this.currentUri===n?(console.log(`Redirect to ${this.currentUri}: already there`),Promise.resolve()):(console.log(`Redirect to: ${n}`),i.value++,this.internalNavigate(n,"none"===t?"replace":t,void 0,i))}addRoutes(e){for(let[t,n]of Object.entries(e)){const e=m(t,n);for(let t=0;t0){let e=[];for(let[r,a]of Object.entries(t.childRoutes)){const t=m(r,a);for(let r=0;r{this.loginWithRefreshKey()})),e.logout.sub((()=>{this.logout()})),e.updateAccountBalance.sub((e=>{this._accountData&&(this._accountData.AccountBalance=e.NewBalance,this._balanceUpdated.fire(e.NewBalance))}))}get balanceUpdated(){return this._balanceUpdated}get onlogin(){return this._login}get onlogout(){return this._logout}get account(){return this._accountData}get connectionChanged(){return this.pushEvents.stateChange}isLogged(){return this._accountData?Promise.resolve(!0):new Promise((e=>{this.loginWithRefreshKey().then((()=>e(!0))).catch((()=>e(!1)))}))}sendCode(e){return(0,i.il)(e,this.languageSvc.locale,9,2)}makeCall(e){return(0,i.IC)(e,this.languageSvc.locale,9)}async loginWithCode(e,t){const n=await this.pushEvents.loginWithSmsCode(e,t,9,this.languageSvc.locale);this.setAccount(n,!0)}async loginWithPassword(e,t,n){const i=await this.pushEvents.loginWithPassword(e,t,9,this.languageSvc.locale);this.setAccount(i,n)}async loginWithRefreshKey(){const e=this.getRefreshKey();if(e)try{const t=await this.pushEvents.loginWithRefreshKey(e,this.languageSvc.locale,2,"WebTrader 1.0");return void this.setAccount(t,!0)}catch(e){console.error(e),this.logout((0,r.l4)(e,await this.languageSvc.getTranslation()))}return Promise.reject()}logout(e){this.clearLogin(),this._logout.fire({reason:e})}clearLogin(){localStorage.removeItem(i.Mk),localStorage.removeItem(i.on),this._accountData=null}setAccount(e,t){localStorage.setItem(i.on,e.LoginedKey),localStorage.setItem(i.Mk,e.RefreshKey),this._accountData=e,this._login.fire(e)}getRefreshKey(){return localStorage.getItem(i.Mk)}}class f{constructor(e,t,n){this.accountSvc=e,this.condition=t,this.redirectTo=n}async canActivate(){return await this.accountSvc.isLogged()!==this.condition||this.redirectTo}}class w{constructor(e){this.accountSvc=e}run(){this.accountSvc.logout()}}class _{canActivate(){return"/Home"}}_.instance=new _;class y{constructor(e,t){this._positions=[],this._opened=new o.XF,this._updated=new o.XF,this._closed=new o.XF,e.account&&(this._positions=e.account.OpenPositionDataCollection),e.onlogin.sub(this.onLogin.bind(this)),e.onlogout.sub(this.onLogout.bind(this)),t.positionOpened.sub(this.onPositionOpen.bind(this)),t.positionUpdated.sub(this.onPositionUpdate.bind(this)),t.positionClosed.sub(this.onPositionClose.bind(this))}get positions(){return this._positions}get opened(){return this._opened}get updated(){return this._updated}get closed(){return this._closed}onLogin(e){this._positions=e.OpenPositionDataCollection.map((e=>(e.OpenTime=new Date(e.OpenTime),e.CloseTime=new Date(e.CloseTime),e.ConfirmationTime=new Date(e.ConfirmationTime),e)))}onLogout(){this._positions=[]}onPositionOpen(e){e.OpenTime=new Date(e.OpenTime),e.CloseTime=new Date(e.CloseTime),e.ConfirmationTime=new Date(e.ConfirmationTime),this._positions.push(e),this._opened.fire(e)}onPositionUpdate(e){e.OpenTime=new Date(e.OpenTime),e.CloseTime=new Date(e.CloseTime),e.ConfirmationTime=new Date(e.ConfirmationTime),this._positions.replaceBy((t=>t.TicketID===e.TicketID),e)?this._updated.fire(e):console.error(`[PositionService] Update -- position #${e.TicketID} not found`)}onPositionClose(e){this._positions.removeBy((t=>t.TicketID===e.TicketID))?this._closed.fire(e):console.error(`[PositionService] Close -- position #${e.TicketID} not found`)}}class S{constructor(e,t){this._instruments=[],this._newInstrument=new o.XF,this._priceChange=new o.XF,e.account&&(this._instruments=e.account.InstrumentDataCollection),e.onlogin.sub(this.onLogin.bind(this)),e.onlogout.sub(this.onLogout.bind(this)),t.newInstrumentSubscription.sub(this.onNewInstrument.bind(this)),t.platformBidAskUpdated.sub(this.onPriceChange.bind(this))}get instruments(){return this._instruments}get priceChange(){return this._priceChange}get newInstrument(){return this._newInstrument}getById(e){return this._instruments.find((t=>t.InstrumentID==e))}onLogin(e){this._instruments=e.InstrumentDataCollection}onLogout(){this._instruments=[]}onNewInstrument(e){this._instruments.push(e),this._newInstrument.fire(e)}onPriceChange(e){for(let t of this._instruments)t.InstrumentID===e.InstrumentID&&(t.Ask=e.Ask,t.Bid=e.Bid,this._priceChange.fire(t))}}class R{constructor(e,t){this.historyFn=e,this.newTransactionEvt=new o.XF,t.newHistoryTransaction.sub((e=>{this.newTransactionEvt.fire(I(e))}))}get newTransaction(){return this.newTransactionEvt}async get(e,t,n,i,s){const o=36e5*(22+i.getTimezoneOffset()/-60),r=new Date(i.getTime()-864e5+o),a=new Date(s.getTime()+o),l=await this.historyFn(e,"ConfirmationDate","desc",t,n,r,a);let c=l.ResultCollection.map(I);return{Count:l.Count,PageNumber:l.PageNumber,ResultCollection:c}}}function I(e){return e.ConfirmationDate=new Date(e.ConfirmationDate),e}var k=n(2870);class x{constructor(e,t){this.positionSvc=e,this.instrumentSvc=t,this.updateEvt=new o.hx(this.mapvalues.bind(this),e.opened,e.closed,e.updated,t.newInstrument,t.priceChange)}mapvalues(){return(0,k.E9)(this.positionSvc,this.instrumentSvc)}get update(){return this.updateEvt}}class C{constructor(e,t){this.accountSvc=e,this.sendDemoRequestEmailFn=t}get isDemoPlatform(){var e;return(null===(e=this.accountSvc.account)||void 0===e?void 0:e.UserCompanyPlatformType)===r.jB.Demo}get demoEmail(){var e,t;return null!==(t=null===(e=this.accountSvc.account)||void 0===e?void 0:e.DemoEmail)&&void 0!==t?t:""}sendDemoRequestEmail(){return this.sendDemoRequestEmailFn()}}class A{constructor(){this.router=null}}const E="en",L=[{locale:"en",name:"English",firstDayOfWeek:0},{locale:"ru",name:"Русский",firstDayOfWeek:1}];class T{constructor(e){this.pushEvents=e,this.dirty=!1}async getResourceFn(){return(await this.getTranslation()).get}async getString(e){return(await this.getResourceFn())(e)}async getTranslation(){const e=this.locale;if(!this.resources||this.dirty){if(this.fetchPromise)return this.fetchPromise;this.fetchPromise=async function(e){return e.locale!=E&&L.some((t=>t.locale==e.locale))?P(await n(47)(`./strings.${e.locale}.js`),e):P(await n(47)("./strings.en.js"),e)}(L.find((t=>t.locale==e))),this.resources=await this.fetchPromise,this.fetchPromise=void 0,this.dirty=!1}return this.resources}getCountryMap(){return fetch(`/l10n/countries/countries.${this.locale}.json`).then((e=>e.json()))}get locale(){var e;if(!this.dirty&&this._locale)return this._locale;const t=function(){if(!navigator.language)return E;const e=L.find((e=>navigator.language.startsWith(e.locale)));return e?e.locale:E}();let n=null!==(e=localStorage.getItem("locale"))&&void 0!==e?e:t;return L.some((e=>e.locale==n))||(n=t),this._locale=n,n}async setLocale(e){e&&this.locale!=e&&(L.some((t=>t.locale==e))?(await this.pushEvents.changeLanguage(e),localStorage.setItem("locale",e),this.dirty=!0):console.warn("[language.service] can't set unknown locale"))}}function P(e,t){const n=function(e){switch(e){case"en":return{plural:function(e){let t=Math.floor(Math.abs(e)),n=e.toString().replace(/^[^.]*\.?/,"").length;return 1===t&&0===n?1:5}};case"ru":return{plural:function(e){let t=Math.floor(Math.abs(e)),n=e.toString().replace(/^[^.]*\.?/,"").length,i=t%10,s=t%100;return 1===i&&11!==s&&0===n?1:i>=2&&i<=4&&(s<12||s>14)&&0===n?3:(0===i||i>=5&&i<=9||s>=11&&s<=14)&&0===n?4:5}}}return{plural:function(e){return 5}}}(t.locale);return{info:t,strings:e.strings,get:function(t){return t in e.strings?e.strings[t]:`%${t}%`},getTemplate:function(t){return t in e.templates?i=>e.templates[t](n,i):()=>`%${t}%`},render:function(e,t){return this.getTemplate(e)(t)}}}class D{constructor(e){this.screenerSvc=e,this.instruments=[],this.dirty=!0,this._addInstrument=new o.XF,this._removeInstrument=new o.XF,e.addInstrument.sub(this.onAddInstrument.bind(this)),e.removeInstrument.sub(this.onRemoveInstrument.bind(this))}get addInstrument(){return this._addInstrument}get removeInstrument(){return this._removeInstrument}async get(){return this.dirty&&(this.instruments=await this.screenerSvc.get(),this.dirty=!1),this.instruments}async follow(e){await this.screenerSvc.follow(e)}async unfollow(e){await this.screenerSvc.unfollow(e),this.instruments.removeBy((t=>t.FundPlatformId==e))}onAddInstrument(e){this.instruments.push(e),this._addInstrument.fire(e)}onRemoveInstrument(e){this.instruments.removeBy((t=>t.FundPlatformId==e)),this._removeInstrument.fire(e)}}class M{constructor(e){if(this.containerElid=e,this.elements=[],!e)throw new Error("Container id ?")}notify(e,t){let n=document.getElementById(this.containerElid);if(!n)throw new Error("[NotificationService] container element is missing");let[i,s]=function(e,t){let n=document.createElement("div");n.classList.add("notification");let i=document.createElement("span");i.classList.add("notif-close");let s=document.createElement("span");if(s.innerText=e,n.appendChild(i),n.appendChild(s),t){let e=document.createElement("div");e.classList.add("notif-action"),e.innerText=t,n.appendChild(e)}return[n,i]}(e,null==t?void 0:t.action),r=e=>{e.style.right=-(e.clientWidth+10)+"px",(0,o.iV)(e,"transitionend",200).then((()=>{e.remove(),this.elements.removeBy((t=>t==e)),this.updateElementsTop()}))};if(s.addEventListener("click",(e=>{r(i),e.stopPropagation()})),i.addEventListener("click",(()=>{r(i),(null==t?void 0:t.onclick)&&t.onclick()})),(0,o.gw)(1e4).then((()=>{r(i)})),this.elements.unshift(i),n.appendChild(i),i.style.right=-(i.clientWidth+10)+"px",this.elements.length>10)for(let e=10;ei.style.right="10px")),this.updateElementsTop()}updateElementsTop(){let e=20;for(let t of this.elements)t.style.top=e+"px",e+=t.clientHeight+15}}var F=n(8892),B=n(6662),V=n(2184);class N extends B.s{onRender(e,t){e.innerHTML=V.render({R:null==t?void 0:t.strings}),this.select("#reconnect-logout",(e=>{e.addEventListener("click",(()=>{this.close()}))}))}}var O=n(876);class H extends B.s{constructor(e,t){super(),this.languageSvc=e,this.routerSvc=t,this.selectedLocale=e.locale}onRender(e,t){e.innerHTML=O.render({R:null==t?void 0:t.strings,languages:L.map((e=>({selected:e.locale==this.selectedLocale?"selected":"",name:e.name,locale:e.locale})))});const n=e.querySelector(".language-items");n.addEventListener("click",(e=>{const t=e.target.parentElement;for(let e=0;e{this.languageSvc.locale==this.selectedLocale?this.close():this.executeAction((async()=>{var e;await this.languageSvc.setLocale(this.selectedLocale),null===(e=this.routerSvc.router)||void 0===e||e.reload()}))}))}}var U=n(5247),$=n(2304),z=n(1865);class G extends B.s{constructor(e,t,n,i){super(),this.totals=e,this.depositSvc=t,this.accountSvc=n,this.demoPlatformSvc=i}onRender(e,t){e.innerHTML=z.render({R:null==t?void 0:t.strings,balance:(0,k.xG)(this.accountSvc.account.AccountBalance,this.accountSvc.account.AccountCurrency),marketValue:(0,k.xG)(this.totals.marketValue,this.accountSvc.account.AccountCurrency),pnl:(0,k.xG)(this.totals.pnl,this.accountSvc.account.AccountCurrency,2,!0),pnlClass:(0,k.D$)(this.totals.pnl),depositEnabled:!this.demoPlatformSvc.isDemoPlatform}),this.demoPlatformSvc.isDemoPlatform||this.prefetchOnclick("#btn-deposit",(()=>this.depositSvc.getPaymentProviders()),(()=>{(0,k.gu)(this.svc,this.depositSvc,this.accountSvc),this.close()}))}}var q=n(5620);class W extends B.s{constructor(e){super(),this.languageSvc=e}async onInitAsync(){try{this.termsHtml=(await n(6730)(`./terms.${this.languageSvc.locale}.html`)).default}catch(e){this.termsHtml=(await n(6730)("./terms.en.html")).default}}onRender(e,t){e.innerHTML=q.render({R:t.strings,appName:"Vietnam Mutual Funds Exchange",version:"1.0.0.11",copyright:"© Boston Unisoft Technologies, Inc. 2021",linkHref:"https://dev.vmfex.com",linkText:"dev.vmfex.com"}),this.select("#about-terms",(e=>{this.termsHtml&&(e.innerHTML=this.termsHtml)}))}}class K extends F._H{constructor(e,t,n,i,s,o,r,a,l,c){super(),this.accountSvc=e,this.accountValuesSvc=t,this.positionSvc=n,this.instrumentSvc=i,this.depositSvc=s,this.viewportDialogSvc=o,this.dialogSvc=r,this.routerSvc=a,this.languageSvc=l,this.demoPlatformSvc=c,this.account=null,this.menuObserver=new MutationObserver((e=>{this.disconnect();let t=this.getActiveMenuItem();t?this.applyMenuStyles(t):this.clearStyles(),this.elem&&this.observe(this.elem)}))}onInit(){this.subscribe(this.accountSvc.onlogin,this.onLogin.bind(this)),this.subscribe(this.accountSvc.onlogout,this.onLogout.bind(this)),this.subscribe(this.accountSvc.connectionChanged,this.onConnectionChanged.bind(this)),this.subscribe(this.accountSvc.balanceUpdated,this.renderBalance.bind(this)),this.subscribe(this.accountValuesSvc.update,this.renderAccountValues.bind(this)),window.addEventListener("resize",this.resizeSub=this.setShadows.bind(this))}onDestroy(){window.removeEventListener("resize",this.resizeSub)}onRender(e,t){e.innerHTML=U.render({R:t.strings,shadows:!1}),this.sidebar=e.querySelector("#sidebar"),this.topElem=this.sidebar.querySelector("#topitem"),this.menuFiller=this.sidebar.querySelector("#menufiller"),this.onclick("#menuItemAccount",(()=>{this.account?this.dialogSvc.showView(new G((0,k.E9)(this.positionSvc,this.instrumentSvc),this.depositSvc,this.accountSvc,this.demoPlatformSvc),{title:`Account #${this.account.AccountID}`,type:"account"}):this.dialogSvc.showMessage("Error","Error")})),this.onclick("#menuItemLogout",(()=>{const e=t.get("SR_dialog_btn_yes"),n=t.get("SR_dialog_btn_no");this.viewportDialogSvc.showMessage("",t.get("SR_root_logout_message"),{buttons:"ok-cancel",buttonOkText:e,buttonCancelText:n,template:"empty"}).then((e=>{"ok"==e&&this.accountSvc.logout()}))})),this.onclick("#menuItemLanguage",(()=>{this.dialogSvc.showView(new H(this.languageSvc,this.routerSvc),{title:t.get("SR_language_dialog_header"),type:"language"})})),this.onclick("#menuItemAbout",(()=>{this.dialogSvc.showView(new W(this.languageSvc),{title:t.get("SR_about_title"),type:"about",template:"secondary",width:600,height:450})})),this.observe(e),this.accountSvc.account?this.onLogin(this.accountSvc.account):this.onLogout()}onLogin(e){this.account=e,this.show("#menuItemAccount"),this.show("#menuItemLogout"),this.hide("#menuItemLogin"),this.enableMenu(),this.renderAccount(),this.renderBalance(),this.renderAccountValues((0,k.E9)(this.positionSvc,this.instrumentSvc)),this.show("#accountTopInfo")}onLogout(){this.account=null,this.show("#menuItemLogin"),this.hide("#menuItemLogout"),this.hide("#menuItemAccount"),this.disableMenu(),this.hide("#accountTopInfo"),this.renderAccount(),this.renderBalance()}onConnectionChanged(e){console.warn("[root] connection change ",e),"disconnected"!=e||this.reconnectDialog?"connected"==e&&this.closeReconnectDialog():(this.closeReconnectDialog(),this.reconnectDialog=new N,this.viewportDialogSvc.showView(this.reconnectDialog,{width:416,height:124,template:"empty",noCloseBindings:!0,background:!1,type:"reconnect"}))}closeReconnectDialog(){this.reconnectDialog&&(this.reconnectDialog.close(),this.reconnectDialog=void 0)}renderAccount(){var e,t;this.setHtml("#account-id",null!==(t=null===(e=this.account)||void 0===e?void 0:e.AccountID.toString())&&void 0!==t?t:"")}renderBalance(){this.setHtml("#account-balance",this.account?(0,k.xG)(this.account.AccountBalance,this.account.AccountCurrency):"")}renderAccountValues(e){var t;this.account?this.setHtml("#tmv",$.render({R:null===(t=this.resources)||void 0===t?void 0:t.strings,pnl:(0,k.xG)(e.pnl,this.account.AccountCurrency,2,!0),pnlClass:(0,k.D$)(e.pnl),value:(0,k.xG)(e.marketValue,this.account.AccountCurrency),reserve:(0,k.xG)(e.reserve,this.account.AccountCurrency)})):this.onLogout()}observe(e){this.menuObserver.disconnect(),this.menuObserver.observe(e.querySelector("#mainMenu"),{attributes:!0,attributeFilter:["class"],subtree:!0})}disconnect(){this.menuObserver.disconnect()}applyMenuStyles(e){var t,n;this.activeItem=e,this.clearStyles();const i=null!==(t=e.previousElementSibling)&&void 0!==t?t:this.topElem,s=null!==(n=e.nextElementSibling)&&void 0!==n?n:this.menuFiller;i.classList.add("menu-item-prev-to-active"),s.classList.add("menu-item-next-to-active"),this.oldPrevElem=i,this.oldNextElem=s,this.setShadows()}clearStyles(){this.shadowTop&&this.shadowBottom&&(this.oldPrevElem&&this.oldPrevElem.classList.remove("menu-item-prev-to-active"),this.oldNextElem&&this.oldNextElem.classList.remove("menu-item-next-to-active"),this.shadowTop.style.bottom="0",this.shadowBottom.style.top="unset")}setShadows(){if(!this.activeItem||!this.shadowTop||!this.shadowBottom)return;const e=this.sidebar.offsetHeight,t=this.activeItem.offsetTop,n=t+this.activeItem.offsetHeight;this.shadowTop.style.bottom=e-t+"px",this.shadowBottom.style.top=`${n}px`}enableMenu(){this.select("#mainMenu",(e=>e.classList.remove("disabled-menu")))}disableMenu(){this.select("#mainMenu",(e=>e.classList.add("disabled-menu")))}getActiveMenuItem(){if(!this.elem)return null;let e=this.elem.querySelector("#mainMenu");if(!e)return null;for(let t=0;ti.Pi(e,c.account.AccountID,t)},O={dataFn:i.bM,closePositionFn:(e,t)=>i.R5(e,c.account.AccountID,t)},H={filtersFn:()=>i.EM(a.locale),searchFn:(e,t,n,s,o,r)=>i.zU(e,t,n,s,o,r,a.locale),adsFn:()=>i.CK(a.locale)},U=new R(((e,t,n,s,o,r,a)=>i.s1(e,t,n,c.account.AccountID,s,o,r,a)),t),$={getPaymentProviders:i.uS,getBankDetailedInfo:i.G5,sendPaymentDetails:i.GP};let z=new F.an((async(t,s,o)=>{switch(t){case"root":return new K(c,P,L,E,$,I,_,e,a,d);case"login":{let e=await n.e(535).then(n.bind(n,3542));const t=new e.CountryServiceImpl(a,i.Xd,(()=>i.a(9)));return new e.SignInView(c,_,G,await t.getCountryInfo(),(e=>i.gF(e,9)),o)}case"home":{let[e,t]=await Promise.all([Promise.all([n.e(736),n.e(571),n.e(177)]).then(n.bind(n,3791)),V.get()]);return new e.HomeView(c,V,t,i.Zf)}case"allfunds":{let e=await n.e(295).then(n.bind(n,4085));return new e.AllFundsView(new e.AllFundsVm(H,N,c,V,G),H,_,$,c,d)}case"screener":{let e=await n.e(742).then(n.bind(n,9527));return new e.ScreenerView(new e.ScreenerVm(await V.get(),V,N,c),_,$,c,d)}case"myinvestments":{let e=await n.e(492).then(n.bind(n,2289));return new e.MyInvestmentsView(new e.MyInvestmentsVm(L,E,O,c.account.AccountCurrency),_,P)}case"history":{let e=await n.e(908).then(n.bind(n,6955));return new e.HistoryView(new e.HistoryVm(U,c,G),_)}case"fullinfo":{const e=s[0],t={summaryFn:()=>i.qn(e,a.locale,c.account.AccountCurrency),overviewFn:()=>i._K(e,a.locale,c.account.AccountCurrency),qtyFn:()=>i.gI(e,a.locale,c.account.AccountCurrency),holdingsFn:()=>i.aI(e,a.locale,c.account.AccountCurrency),priceFn:()=>i.M2(e,a.locale,c.account.AccountCurrency),historyFn:t=>i.Zf(e,t)};let[o,r]=await Promise.all([Promise.all([n.e(571),n.e(752)]).then(n.bind(n,8373)),t.summaryFn()]);return new o.FullInfoView(new o.FullInfoVm(e,r,t,V,N,c),_,$,c,d)}case"debug":return Promise.resolve(new F.Ee("debug"))}}),a);z.options.loadingHtml=X.render(),z.viewUpdated.sub((async e=>{(0,o.BG)(G,e),(0,o.nA)(e,await a.getResourceFn())})),z.afterRender.sub((async e=>{(0,o.BG)(G,e.elem),(0,o.nA)(e.elem,await a.getResourceFn())}));let G=function(e,t,n){return new v(e,t,new h)}({"/":{name:"root",childRoutes:{Home:{name:"home",canActivate:u},AllFunds:{name:"allfunds",canActivate:u},Screener:{name:"screener",canActivate:u},MyInvestments:{name:"myinvestments",canActivate:u},History:{name:"history",canActivate:u},"FullInfo/:id":{name:"fullinfo",canActivate:u},Debug:{name:"debug"},Login:{name:"login",canActivate:m},Logout:{action:b,redirectTo:"/Login"},"/":{redirectTo:"Home"}}},"*":{redirectTo:"/"}},z);e.router=G,G.beforeNodeActivation.sub((async e=>{const t=await a.getResourceFn(),n=function(e,t){switch(e){case"root":return t("SR_view_name_home");case"login":return t("SR_view_name_login");case"home":return t("SR_view_name_home");case"allfunds":return t("SR_view_name_allfunds");case"screener":return t("SR_view_name_screener");case"myinvestments":return t("SR_view_name_myinvst");case"history":return t("SR_view_name_history");case"fullinfo":return t("SR_view_name_fullinfo");case"debug":return"Debug"}}(e.node,t),i=document.getElementById("title");i&&(i.innerHTML=n),e.last&&(document.title=`${n} - ${t("SR_page_title")}`)})),G.afterNavigate.sub((e=>{(0,o.OV)(document.body,e)})),c.onlogin.sub((async e=>{if(!e.NeedChangePassword)return;let t=await n.e(535).then(n.bind(n,7470));I.showView(new t.CreatePasswordView(e.AccountID,i.fM),{template:"empty",noCloseBindings:!0,width:392,height:500})})),c.onlogout.sub((e=>{G.navigate("/Login",e.reason)}));const q=async(e,t,n)=>{const i=await a.getTranslation(),s=i.render(e,t);n&&n.action&&(n.action=i.get(n.action)),g.notify(s,n)};t.addInstrument.sub((e=>{q("SR_notification_screener_add_f1",{name:e.FundFullName},{onclick:()=>G.navigate("/Screener"),action:"SR_view_name_screener"})})),t.positionOpened.sub((e=>{q("SR_notification_position_open_f1",{tid:e.TicketID},{onclick:()=>G.navigate("/MyInvestments"),action:"SR_view_name_myinvst"})})),U.newTransaction.sub((e=>{const t=function(e,t){var n,i,s,a,l;const c=null!==(n=(0,o.lG)(new Date))&&void 0!==n?n:"";function d(e){return`/History?search=${encodeURIComponent(e)}&from=${c}&to=${c}`}switch(e.HistoryType){case r.Z3.Deposit:return{formatKey:"SR_notification_deposit_f2",formatArgs:{amount:(0,k.xG)(e.Value,e.Currency),balance:(0,k.xG)(e.Balance,e.Currency)},target:d(e.TicketId),actionKey:"SR_view_name_history"};case r.Z3.Withdrawal:return{formatKey:"SR_notification_withdrawal_f2",formatArgs:{amount:(0,k.xG)(e.Value,e.Currency),balance:(0,k.xG)(e.Balance,e.Currency)},target:d(e.TicketId),actionKey:"SR_view_name_history"};case r.Z3.Dividends:return{formatKey:"SR_notification_dividends_f2",formatArgs:{amount:(0,k.xG)(e.Value,e.Currency),balance:(0,k.xG)(e.Balance,e.Currency)},target:d(e.TicketId),actionKey:"SR_view_name_history"};case r.Z3.OpenPositionConfirm:return e.HistoryState==r.rW.Canceled?{formatKey:"SR_notification_open_position_cancel_f3",formatArgs:{amount:(0,k.xG)(e.Value,null===(i=t.account)||void 0===i?void 0:i.AccountCurrency),tid:e.TicketId,name:e.InstrumentName},target:d(e.TicketId),actionKey:"SR_view_name_history"}:{formatKey:"SR_notification_open_position_confirm_f5",formatArgs:{amount:(0,k.xG)(e.Value,null===(s=t.account)||void 0===s?void 0:s.AccountCurrency),name:e.InstrumentName,qty:e.Volume,price:(0,k.xG)(e.OpenPrice,e.Currency),commission:(0,k.xG)(e.Commission,e.Currency)},target:"/MyInvestments",actionKey:"SR_view_name_myinvst"};case r.Z3.ClosePositionConfirm:return e.HistoryState==r.rW.Canceled?{formatKey:"SR_notification_close_position_cancel_f3",formatArgs:{tid:e.TicketId,qty:e.Volume,name:e.InstrumentName},target:d(e.TicketId),actionKey:"SR_view_name_history"}:{formatKey:"SR_notification_close_position_confirm_f5",formatArgs:{amount:(0,k.xG)(e.Value,null===(a=t.account)||void 0===a?void 0:a.AccountCurrency),name:e.InstrumentName,tid:e.TicketId,qty:e.Volume,price:(0,k.xG)(e.ClosePrice,e.Currency)},target:d(e.TicketId),actionKey:"SR_view_name_history"};case r.Z3.CommissionNews:return{formatKey:"SR_notification_commission_f2",formatArgs:{amount:(0,k.xG)(e.Value,null===(l=t.account)||void 0===l?void 0:l.AccountCurrency),tid:e.TicketId},target:d(e.TicketId),actionKey:"SR_view_name_history"};case r.Z3.DividendsReinvestment:return{formatKey:"SR_notification_reinvestment_f3",formatArgs:{amount:e.Value,tid:e.TicketId,name:e.InstrumentName},target:d(e.TicketId),actionKey:"SR_view_name_history"}}}(e,c);t&&q(t.formatKey,t.formatArgs,{action:t.actionKey,onclick:()=>{t.target&&G.navigate(t.target)}})})),window.onunhandledrejection=async e=>{(0,r.Bw)(e.reason)&&function(e,t,n,i){var s;return"LoginRequired"==e.type||"Blacklist"==e.type?(t.logout((0,r.l4)(e,i)),!0):("ConnectionError"==e.type||"UnknownError"==e.type)&&(n.showMessage(null!==(s=null==i?void 0:i.get("SR_dialog_error_header"))&&void 0!==s?s:"%",(0,r.l4)(e,i)),!0)}(e.reason,c,_,await a.getTranslation())?e.preventDefault():console.error("[unhandled rejection] ",e.reason)},s.S1(),G.start()}"interactive"===document.readyState?j():window.addEventListener("DOMContentLoaded",(()=>j()))},7041:(e,t,n)=>{"use strict";function i(e){return"object"==typeof e&&"type"in e&&"kind"in e&&"APIError"===e.kind}var s,o,r,a,l,c,d,u,h,v,m,b;function g(e){return e==v.Deposit||e==v.Dividends||e==v.ClosePositionConfirm}function p(e){return e==v.Withdrawal||e==v.OpenPositionConfirm||e==v.DividendsReinvestment}function f(e,t){var n;if(!t)return"%resource%";if(!i(e))return t.get("SR_api_error_connection");switch(e.type){case"ConnectionError":return t.get("SR_api_error_connection");case"LoginRequired":return"";case"Blacklist":return t.get("SR_api_error_blocklist");case"UserDisabled":return t.get("SR_api_error_user_disabled");case"AccountDisabled":return t.get("SR_api_error_account_disabled");case"WrongRegistrationCode":return t.get("SR_api_error_wrong_code");case"WrongCredentials":return t.get("SR_api_error_wrong_credentials");case"NotAbleToSendSMS":return t.get("SR_api_error_failed_sms")}return null!==(n=e.message)&&void 0!==n?n:"Unknown error"}function w(e,t,n){return{type:e,message:t,params:n,kind:"APIError"}}function _(e){if(0===e.State)return e.Data;let t,n;switch(e.State){case 2:t="LoginRequired";break;case 5:t="Blacklist";break;default:switch(n=e.Message,e.Message){case"AccountDisabled":t="AccountDisabled";break;case"UserDisabled":t="UserDisabled";break;case"WrongRefreshKey":t="ConnectionError";break;case"WrongRegistrationCode":t="WrongRegistrationCode";break;case"WrongCredentials":case"WrongData":t="WrongCredentials";break;case"NotAbleToSendSMS":t="NotAbleToSendSMS";break;case"UserWithPhoneNumberDoesNotExist":t="UserWithPhoneNumberDoesNotExist";break;case"TransactionLowerThanLimit":t="TransactionLowerThanLimit";break;default:console.error(`API error ${e.State} '${e.Message}'`),t="UnknownError"}}return w(t,n,e.Params)}n.d(t,{Bw:()=>i,Zu:()=>s,RZ:()=>o,jB:()=>r,tg:()=>a,Ct:()=>l,m6:()=>c,Ng:()=>u,Z3:()=>v,rW:()=>m,Hi:()=>g,MG:()=>p,k$:()=>b,l4:()=>f,qF:()=>w,$b:()=>_}),function(e){e[e.PendingOpen=0]="PendingOpen",e[e.Open=1]="Open",e[e.PendingClose=2]="PendingClose",e[e.PendingPartialClose=3]="PendingPartialClose"}(s||(s={})),function(e){e[e.InvestmentPositionInitiated=0]="InvestmentPositionInitiated",e[e.FundInReceiptOFATransaction=1]="FundInReceiptOFATransaction",e[e.SettlementInitiated=2]="SettlementInitiated",e[e.TradeSettled=3]="TradeSettled",e[e.RedemptionInitiated=4]="RedemptionInitiated",e[e.RedemptionApproved=5]="RedemptionApproved",e[e.RedemptionIsBeingSettled=6]="RedemptionIsBeingSettled",e[e.PositionIsClosed=7]="PositionIsClosed"}(o||(o={})),function(e){e[e.Standard=0]="Standard",e[e.WL=1]="WL",e[e.Demo=2]="Demo"}(r||(r={})),function(e){e[e.Percentage=0]="Percentage",e[e.Value=1]="Value"}(a||(a={})),function(e){e[e.InvestRedeem=0]="InvestRedeem",e[e.Invest=1]="Invest",e[e.Redeem=2]="Redeem"}(l||(l={})),function(e){e[e.Greater=0]="Greater",e[e.Equals=1]="Equals",e[e.Lesser=2]="Lesser",e[e.In=3]="In",e[e.Like=4]="Like",e[e.NotNull=5]="NotNull",e[e.GreaterOrEquals=6]="GreaterOrEquals",e[e.LesserOrEquals=7]="LesserOrEquals"}(c||(c={})),function(e){e[e.OrOpenGroup=2]="OrOpenGroup",e[e.OrCloseGroup=3]="OrCloseGroup"}(d||(d={})),function(e){e[e.YTD=0]="YTD",e[e.M1=1]="M1",e[e.M2=2]="M2",e[e.M3=3]="M3",e[e.M6=4]="M6",e[e.Y1=5]="Y1",e[e.Y3=6]="Y3",e[e.Y5=7]="Y5"}(u||(u={})),function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Remove=2]="Remove"}(h||(h={})),function(e){e[e.Deposit=0]="Deposit",e[e.Withdrawal=1]="Withdrawal",e[e.Dividends=2]="Dividends",e[e.OpenPositionConfirm=3]="OpenPositionConfirm",e[e.ClosePositionConfirm=4]="ClosePositionConfirm",e[e.InfoNews=5]="InfoNews",e[e.MobileInfoNews=6]="MobileInfoNews",e[e.CommissionNews=7]="CommissionNews",e[e.DividendsReinvestment=8]="DividendsReinvestment"}(v||(v={})),function(e){e[e.Confirmed=0]="Confirmed",e[e.Updated=1]="Updated",e[e.Canceled=2]="Canceled"}(m||(m={})),function(e){e[e.Sms=0]="Sms",e[e.Email=1]="Email"}(b||(b={}))},6662:(e,t,n)=>{"use strict";n.d(t,{s:()=>u,c:()=>v});var i=n(8892),s=n(3147),o=n(7041),r=n(5656),a=n(8430),l=n(5673),c=n(532),d=n(594);class u extends i._H{constructor(){super(...arguments),this.closedEvt=new s.X8,this.resizedEvt=new s.X8}get closed(){return this.closedEvt}get resized(){return this.resizedEvt}close(e){this.closedEvt.fire(e)}resize(e){this.resizedEvt.fire(e)}setEnabledDlg(e,t="#dialogBtn"){this.setEnabled(t,e)}executeAction(e){this.hideError(),this.setEnabledDlg(!1),e().then((e=>{this.close(e)})).catch((e=>{this.setEnabledDlg(!0),this.showError((0,o.l4)(e,this.resources))}))}}const h="modal-root-open";class v{constructor(e,t,n,i){this.containerElid=e,this.routerSvc=t,this.languageSvc=n,this.subsvc=i,this.entries=[],this.lastid=0,this.viewInitInProgress=!1,this.hidden=!1}showAll(){if(this.hidden=!1,this.entries.length>0||this.viewInitInProgress){const e=document.getElementById(this.containerElid);if(!e)return;this.showContainerElem(e)}}hideAll(){if(this.hidden=!0,this.entries.length>0||this.viewInitInProgress){const e=document.getElementById(this.containerElid);if(!e)return;this.hideContainerElem(e)}}showMessage(e,t,n){return this.showView(new m(t,n),{title:e,width:482,height:220,template:null==n?void 0:n.template,type:"message"})}async showView(e,t){var n;if(null==t?void 0:t.type)for(let e of this.entries)if(e.type&&e.type==t.type)throw`[DialogService] '${e.type}' already opened`;const i=document.getElementById(this.containerElid);if(!i)throw"[DialogService] container element missing";this.showContainerElem(i),this.viewInitInProgress=!0,this.afterNavigateSub||(this.routerSvc.router||console.log("[DialogService] can't get router"),this.afterNavigateSub=null===(n=this.routerSvc.router)||void 0===n?void 0:n.afterNavigate.sub((()=>{this.closeAll()})));const o=function(e){let t=document.createElement("div");return t.classList.add("modal"),e.appendChild(t),t}(i),c=null==t?void 0:t.template,u=c&&"primary"!==c?"secondary"===c?a:l:r;o.innerHTML=u.render({header:null==t?void 0:t.title});const h=o.querySelector(".dialog-content");if(!h)throw"[DialogService] content element missing";const v=o.querySelector(".dialog-root");(null==t?void 0:t.width)&&(null==t?void 0:t.height)&&(v.style.width=t.width+"px",v.style.height=t.height+"px"),o.style.display="flex",(0,s.gw)(0).then((()=>{o.classList.add("modal-open"),v.classList.add("modal-content-open")})),this.entries.length>0&&this.entries[this.entries.length-1].dialogElement.classList.remove("modal-open");const m=this.lastid++;let b,g,p,f=!1;(0,s.gw)(300).then((()=>{f||(b=function(e){let t=document.createElement("div");return t.style.position="absolute",t.style.opacity="0",t.style.left="0",t.style.top="0",t.style.right="0",t.style.bottom="0",t.innerHTML=d.render(),e.appendChild(t),requestAnimationFrame((()=>{t.style.opacity="1",t.style.transition="opacity 1500ms ease-out"})),t}(o))}));try{[g,p]=await Promise.all([e instanceof Promise?await e:e,this.languageSvc.getTranslation()]),g.svc=this,await g.initAsync(),f=!0,b&&(w=b)&&w.remove()}catch(e){throw this.viewInitInProgress=!1,f=!0,o.remove(),0==this.entries.length&&this.hideContainerElem(i),e}var w;return await new Promise((e=>{var n;g.render(h,p);const i=h.firstElementChild;i&&(v.style.minHeight=i.offsetHeight+"px",v.style.height="auto");const r=g.closed.sub((t=>{this.close(m),e(t)})),a=g.resized.sub((e=>{v.style.width=e+"px"}));let l,c=()=>{this.close(m),e(null)};if(!(null==t?void 0:t.noCloseBindings)){let e=e=>{27===e.keyCode&&c()};l=e,v.addEventListener("keyup",e,!0);const t=o.querySelector(".dialog-close");t&&t.addEventListener("click",c)}const d={id:m,view:g,type:null==t?void 0:t.type,dialogElement:o,rootElement:v,closeSub:r,resizeSub:a,loaderOverlay:b,keyboardHandlerRef:l};this.entries.push(d),this.viewInitInProgress=!1,(0,s.V$)(h,150),null===(n=null==o?void 0:o.querySelector("[autofocus]"))||void 0===n||n.focus()}))}close(e,t=!1){var n,i;if(0==this.entries.length)return void console.warn("[DialogService] close - no views");if(this.entries[this.entries.length-1].id!=e)return void console.error("[DialogService] incorrect close order ",e);const o=this.entries.pop();o.keyboardHandlerRef&&o.rootElement.removeEventListener("keyup",o.keyboardHandlerRef,!0),null===(n=o.closeSub)||void 0===n||n.unsub(),null===(i=o.resizeSub)||void 0===i||i.unsub();const r=document.getElementById(this.containerElid);if(!r)return void console.error("[DialogService] close: container element missing");const a=()=>{o.dialogElement.remove(),0!=this.entries.length||this.viewInitInProgress||this.hideContainerElem(r),this.entries.length>0&&!this.viewInitInProgress&&this.entries[this.entries.length-1].dialogElement.classList.add("modal-open")};t||(0,s.iV)(o.rootElement,"transitionend",200).then((()=>{a()})),o.rootElement.classList.remove("modal-content-open"),o.rootElement.classList.add("modal-content-close"),t&&a(),o.view&&o.view.active&&o.view.destroy()}closeAll(){for(;this.entries.length>0;)this.close(this.entries[this.entries.length-1].id,!0)}showContainerElem(e){var t;this.hidden||(e.classList.add(h),null===(t=this.subsvc)||void 0===t||t.hideAll())}hideContainerElem(e){var t;e.classList.remove(h),null===(t=this.subsvc)||void 0===t||t.showAll()}}class m extends u{constructor(e,t){var n,i;super(),this.message=e,this.options={template:null!==(n=null==t?void 0:t.template)&&void 0!==n?n:"primary",buttons:null!==(i=null==t?void 0:t.buttons)&&void 0!==i?i:"ok",buttonOkText:null==t?void 0:t.buttonOkText,buttonCancelText:null==t?void 0:t.buttonCancelText}}onRender(e,t){var n,i;e.innerHTML=c.render({message:this.message,messageClass:"empty"==this.options.template?"message-text-big":"message-text",buttonsOk:"ok"==this.options.buttons,buttonsOkCancel:"ok-cancel"==this.options.buttons,buttonOkText:null!==(n=this.options.buttonOkText)&&void 0!==n?n:null==t?void 0:t.get("SR_dialog_btn_ok"),buttonCancelText:null!==(i=this.options.buttonCancelText)&&void 0!==i?i:null==t?void 0:t.get("SR_dialog_btn_cancel")}),this.onclick("#btn-ok",(()=>this.close("ok"))),"ok-cancel"==this.options.buttons&&this.onclick("#btn-cancel",(()=>this.close("cancel")))}}},2870:(e,t,n)=>{"use strict";n.d(t,{FZ:()=>a,KR:()=>l,Zg:()=>c,Pz:()=>d,Xg:()=>u,aN:()=>v,Ck:()=>b,E9:()=>g,xG:()=>p,VG:()=>f,p6:()=>w,o0:()=>_,D$:()=>y,IS:()=>R,SM:()=>I,gu:()=>k,r3:()=>x});var i=n(7041),s=n(1769),o=n(3302),r=n.n(o);function a(e){var t;return null!==(t=null==e?void 0:e.Ask)&&void 0!==t?t:1}function l(e){var t;return null!==(t=null==e?void 0:e.Bid)&&void 0!==t?t:1}function c(e,t){return 0===t?e:e.div(t)}function d(e){var t;return e.PositionState==i.Zu.PendingOpen&&0!=e.Invested?r()(e.Invested).round(2,3):r()(e.OpenPrice).mul(e.Volume).mul(null!==(t=e.OpenPositionCross)&&void 0!==t?t:1).round(2,3)}function u(e,t){const n=l(t.CrossInstrumentData);return r()(e.Volume).mul(t.Bid).mul(n).round(2,3)}function h(e,t){return e.PositionState==i.Zu.PendingOpen?r()(e.Invested).round(2,3):u(e,t)}function v(e,t){const n=function(e,t){if(e&&0!=e.length)for(let n of e)if(void 0!==n.From&&void 0!==n.To&&t>=n.From&&te.InstrumentID===o.InstrumentId));if(!e)return console.error(`Instrument #${o.InstrumentId} is not found`),{investment:n,marketValue:n,pnl:n,pnlPercentage:n,reserve:n};const a=d(o);s.investment=s.investment.plus(a);const l=h(o,e);if(s.marketValue=s.marketValue.plus(l),o.PositionState!==i.Zu.PendingOpen){let e=l.minus(a);e.gt(0)&&(e=e.minus(e.mul(r()(o.TaxPercentage).mul(.01)).round(2,3))),s.pnl=s.pnl.plus(e)}s.reserve=s.reserve.plus(o.Reserve)}return s.investment.eq(0)||(s.pnlPercentage=s.pnl.div(s.investment).mul(100).round(2,3)),s}function p(e,t,n=2,i=!1){if(null==e)return"n/a";const s=f(e,i,n,n);return t?`${t.toUpperCase()} ${s}`:s}function f(e,t=!1,n=2,i){if(null==e)return"n/a";const s=new Intl.NumberFormat("en-US",{style:"decimal",minimumFractionDigits:n,maximumFractionDigits:null!=i?i:n});return"number"!=typeof e?((e=e.round(n,0)).eq(0)&&(e=e.abs()),e=e.toNumber()):e=Math.trunc(e*Math.pow(10,n))/Math.pow(10,n),(t&&e>0?"+":"")+s.format(e)}function w(e,t="default"){return new Intl.DateTimeFormat(t,{year:"numeric",month:"numeric",day:"numeric"}).format(e)}function _(e,t="default"){return new Intl.DateTimeFormat(t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).format(e)}function y(e,t="goodText",n="badText"){return null==e?"":"number"!=typeof e?function(e,t,n){return null==e?"":e.gt(0)?t:e.lt(0)?n:""}(e,t,n):e>0?t:e<0?n:""}function S(e){return e&&0!==e.length&&"#"===e[0]?e.substr(0,7):"none"}function R(e){return e&&0!==e.length?e.map((e=>({text:e.Text,background:S(e.BackgroundColor),color:S(e.TextColor)}))):[]}function I(e){return e&&0!==e.length?e.map((e=>({text:e.Text,background:S(e.HeaderBackgroundColor),color:S(e.HeaderTextColor)}))):[]}async function k(e,t,i){let[s,o]=await Promise.all([n.e(984).then(n.bind(n,7740)),t.getPaymentProviders()]);const r=await e.showView(new s.DepositView(i,o,t),{title:"Deposit",width:392,height:407,template:"empty",type:"deposit"});"sms"==r?e.showMessage("WIRE TRANSFER DETAILS","Wire Transfer Details has been sent to your mobile phone via sms.",{buttons:"ok",template:"secondary"}):"email"==r&&e.showMessage("WIRE TRANSFER DETAILS","Wire Transfer Details has been sent to your email address.",{buttons:"ok",template:"secondary"})}function x(e,t,n,i,o){t.showView(e.then((e=>new s.VC(e,n,i,o))),{title:"Investment Order",width:s.AA,height:s.Wy,type:"invest"})}},8422:(e,t,n)=>{"use strict";n.d(t,{Mk:()=>s,on:()=>o,Xd:()=>d,a:()=>u,fM:()=>h,gF:()=>v,E9:()=>m,il:()=>b,IC:()=>g,XH:()=>p,ET:()=>f,dC:()=>w,Zf:()=>_,qn:()=>y,_K:()=>S,gI:()=>R,aI:()=>I,M2:()=>k,SQ:()=>x,bM:()=>C,Pi:()=>A,R5:()=>E,EM:()=>L,CK:()=>T,zU:()=>P,s1:()=>D,uS:()=>M,G5:()=>F,GP:()=>B});var i=n(7041);const s="xpr",o="xpt",r=5e3,a=6e4;function l(e,t){return t?`${e}?${function(e){return Object.entries(e).map((([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&")}(t)}`:e}function c(e,t,n){var s;const r=(null==n?void 0:n.useBody)?e:l(e,t);let a=c;if(null==n?void 0:n.cacheMs){const e=null===(s=a.cache)||void 0===s?void 0:s.get(r);if(e)return console.log(`apicall cached [${r}]`),(null==n?void 0:n.clearCacheTimer)&&e.cacheTimer&&(clearTimeout(e.cacheTimer),e.cacheTimer=setTimeout((()=>{var t;null===(t=a.cache)||void 0===t||t.delete(r),e.cacheTimer=void 0}),n.cacheMs)),e.promise}console.log(`apicall [${r}]`),console.log(`https://funds.bostonunisoft.com:443/${r}`);const d=localStorage.getItem(o);let u={};d&&(u.Authorization=`AuthorizationToken ${d}`),(null==n?void 0:n.useBody)&&(u["Content-Type"]="application/json");const h={credentials:"omit",headers:u,method:(null==n?void 0:n.useBody)?"POST":"GET",body:(null==n?void 0:n.useBody)?JSON.stringify(t):void 0},v=fetch(function(e,t){return l(`https://funds.bostonunisoft.com:443/${e}`,t)}(e,(null==n?void 0:n.useBody)?void 0:t),h).then((async e=>{if(!e.ok)throw i.qF("ConnectionError",e.statusText);const t=i.$b(await e.json());if(i.Bw(t))throw t;return t}));if(null==n?void 0:n.cacheMs){a.cache||(a.cache=new Map);let e=setTimeout((()=>{var e,t;let n=null===(e=a.cache)||void 0===e?void 0:e.get(r);n&&(null===(t=a.cache)||void 0===t||t.delete(r),n.cacheTimer=void 0)}),n.cacheMs);a.cache.set(r,{cacheTimer:e,promise:v})}return v}function d(){return c("API/Registration/GetClientCountryCode")}function u(e){return c("API/Registration/GetCountryDataCollectionForClient",{companyId:e})}function h(e){return c("API/User/SetAccountPassword",{newPassword:e},{useBody:!0})}function v(e,t){return c("API/Client/ForgotClientPlatformPassword",{phoneNumber:e,companyId:t})}function m(){return c("API/User/SendDemoRequestEmail")}function b(e,t,n,i){return c("API/Registration/SendPlatformLoginSMSMessage",{phoneNumber:e,language:t,companyId:n,deviceType:i})}function g(e,t,n){return c("API/Registration/MakePlatformLoginCall",{phoneNumber:e,language:t,companyId:n})}function p(){return c("API/Funds/GetFundScreenerInsrtumentCollection",void 0,{cacheMs:2e3})}function f(e){return c("API/User/SaveUserInstrumentData",{fundId:e})}function w(e){return c("API/User/RemoveUserInstrumentData",{fundId:e})}function _(e,t){return c("API/Funds/GetMutualFundPriceHistoryPeriodDataCollection",{fundId:e,chartPeriodType:t},{cacheMs:a})}function y(e,t,n){return c("API/Funds/GetFundSummaryInfo",{fundId:e,language:t,currencyCode:n},{cacheMs:a})}function S(e,t,n){return c("API/Funds/GetFundOwervievInfo",{fundId:e,language:t,currencyCode:n},{cacheMs:a})}function R(e,t,n){return c("API/Funds/GetFundQuantitiveAnalysis",{fundId:e,language:t,currencyCode:n},{cacheMs:a})}function I(e,t,n){return c("API/Funds/GetFundHoldings",{fundId:e,language:t,currencyCode:n},{cacheMs:a})}function k(e,t,n){return c("API/Funds/GetFundPriceInfoData",{fundId:e,language:t,currencyCode:n},{cacheMs:a})}async function x(e){return c("API/Funds/GetMutualFundInvestInfo",{fundId:e},{cacheMs:r,clearCacheTimer:!0}).then((e=>(e.ExpectedConfirmationDate=new Date(e.ExpectedConfirmationDate),e)))}function C(e,t){return c("API/Funds/GetMutualFundRedeemInfo",{fundId:e,ticketId:t},{cacheMs:r,clearCacheTimer:!0}).then((e=>(e.ExpectedConfirmationDate=new Date(e.ExpectedConfirmationDate),e)))}function A(e,t,n){return c("API/Trading/OpenInvestOrder",{instrumentId:e,accountId:t,investValue:n})}function E(e,t,n){return c("API/Trading/ClosePosition",{ticketId:e,accountId:t,volume:n})}function L(e){return c("API/Funds/GetMutualFundSearchUtilitiesData",{language:e},{cacheMs:a})}function T(e){return c("API/Funds/GetFundSearchAdvertisingDataCollection",{language:e},{cacheMs:3e5})}function P(e,t,n,i,s,o,r){return c("API/Funds/GetFundSearchDataCollection",{fundsRequestId:e,fundsRequestParams:JSON.stringify(t),pageNumber:n,count:i,orderBy:s,orderDataType:"asc"===o?"0":"1",language:r},{cacheMs:a})}function D(e,t,n,i,s,o,r,a){return c("API/Trading/GetPositionHistoryRawDataCollection",{positionHistoryRequestParams:JSON.stringify(e),orderBy:t,orderDataType:"asc"===n?"0":"1",accountId:i,from:r.toISOString(),to:a.toISOString(),pageNumber:s,count:o,timeDiff:0})}function M(){return c("API/User/GetClientPaymentProviderDetails",void 0,{cacheMs:r,clearCacheTimer:!0}).then((e=>e[0]))}function F(e,t,n){return c("API/User/GetBankDetailedData",{paymentProviderId:e,currency:t,amount:n})}function B(e,t,n,i,s){return c("API/User/SendBankDetailedInfoForClient",{paymentProviderId:e,notificationType:t,language:n,accountNumber:i,currency:s})}},3147:(e,t,n)=>{"use strict";n.d(t,{gw:()=>r,rs:()=>a,iV:()=>l,Ds:()=>c,XF:()=>d,X8:()=>u,hx:()=>h,Ty:()=>v,OV:()=>b,BG:()=>g,nA:()=>p,V$:()=>f,Bu:()=>w,lG:()=>_,XI:()=>y,iG:()=>S,N3:()=>R,$e:()=>I,Ir:()=>k,dQ:()=>x,yp:()=>C,Tm:()=>A});var i=n(2870),s=n(3302),o=n.n(s);function r(e){return new Promise((t=>setTimeout(t,e)))}function a(){return new Promise((e=>setTimeout(e,0)))}function l(e,t,n=1800){return new Promise((i=>{let s;e.addEventListener(t,(()=>{clearTimeout(s),i(e)}),{once:!0}),s=setTimeout((()=>i(e)),n)}))}function c(e,t,n=!1){let i,s=(...s)=>{let o=!1;n&&!i&&(e(...s),o=!0),clearTimeout(i),i=setTimeout(((...t)=>{i=void 0,o||e(...t)}),t,...s)};return s.cancel=()=>{clearTimeout(i)},s}class d{constructor(){this.handlers=new Set}sub(e){return this.handlers.add(e),{unsub:()=>this.unsub(e)}}once(e){const t=n=>{e(n),this.unsub(t)};this.sub(t)}unsub(e){this.handlers.delete(e)||console.error(`Handler not found ${e.name}, # of handlers: ${this.handlers.size}`)}fire(e){for(let t of this.handlers)t(e)}}class u extends d{constructor(){super(...arguments),this.hasState=!1}sub(e){return this.hasState&&setTimeout((()=>e(this.state))),super.sub(e)}fire(e){this.state=e,this.hasState=!0,super.fire(e)}}class h extends d{constructor(e,...t){super(),this.mapfn=e,this.events=[],this.subscriptions=[],this.events=t}sub(e){if(0==this.subscriptions.length)for(const e of this.events)this.subscriptions.push(e.sub((e=>this.fire(this.mapfn(e)))));return super.sub(e)}unsub(e){if(super.unsub(e),0==this.handlers.size&&this.subscriptions.length>0){for(let e of this.subscriptions)e.unsub();this.subscriptions=[]}}}function v(e){let t=[];for(let[n,i]of Object.entries(e))t.push({Name:n,Data:i});return t}function m(e,t,n=2){let i=e.parentElement,s=0;for(;i&&se.hasAttribute("routerLinkActive")));if(!e)continue;const i=e.getAttribute("routerLinkActive");if(!i)continue;e.classList.remove(i),s===n[0]&&e.classList.add(i)}}}function g(e,t){const n=t.getElementsByTagName("a");for(let t=0;t{t.preventDefault(),i.hasAttribute("noroute")||t.target&&t.target.hasAttribute("noroute")||e.navigate(s)})))}e.current&&b(t,e.current)}function p(e,t){const n=e.getElementsByTagName("span");for(let e=0;e{if(0==i.children.length){let e=document.createElement("span");e.innerText=t(s),e.classList.add("tooltip-text-fixed"),e.style.width="350px",i.appendChild(e);const n=document.documentElement.clientWidth,o=document.documentElement.clientHeight,r=i.getBoundingClientRect();let a=r.x+e.clientWidth+6-n,l=r.y+i.clientHeight+e.clientHeight+6-o;a<0&&(a=0),e.style.top=l>0?r.y-e.clientHeight-6+"px":r.y+i.clientHeight+6+"px",e.style.left=r.x-a+"px",e.style.visibility="visible"}})),i.addEventListener("mouseleave",(e=>{for(;i.firstChild;)i.firstChild.remove()})))}}function f(e,t){!function(e){e.style.opacity="0"}(e),r(0).then((()=>function(e,t){e.style.opacity="1",e.style.transition=`opacity ${t}ms ease-out`}(e,t)))}function w(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function _(e){if(e)return`${e.getFullYear()}-${w(e.getMonth()+1+"",2)}-${w(e.getDate()+"",2)}`}function y(e){let t=new Date(e);if(!isNaN(t))return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function S(e){if(0==e.length)return;const t=Number.parseFloat(e.replace(/,/g,""));return Number.isNaN(t)?void 0:o()(t)}function R(e){return Math.floor(e)===e?0:e.toString().split(".")[1].length||0}function I(e,t){return o()(e).div(t).round(0,0).mul(t)}function k(e,t){return o()(e).div(t).round(0,3).mul(t)}function x(e,t,n,s=1,r){const a=R(s),l=(t,n)=>{if(!t){if(0==e.value.length)return;if(!(t=S(e.value)))return}n&&(t=t.round(a,0)),e.value=(0,i.VG)(t,!1,null!=r?r:a,null!=r?r:a),e.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0}))},c=i=>{if(!i&&0==e.value.length)return;const r=S(e.value);if(!r)return void(i&&l(o()(t)));const a=r.minus(t).div(s),c=void 0===i?0:Number.isInteger(a.toNumber())?1:0,d=(i?a.round(0,3).plus(c):a.round(0,0).minus(c)).mul(s).plus(t);(i&&(!n||d.lte(n))||!i&&d.gte(t))&&l(d,!0)};l(void 0,!1),e.addEventListener("beforeinput",(e=>{e.data&&(","!=e.data&&(Number.isInteger(Number.parseInt(e.data))||"."==e.data)||e.preventDefault())})),e.addEventListener("keydown",(e=>{"ArrowUp"==e.key&&(c(!0),e.preventDefault()),"ArrowDown"==e.key&&(c(!1),e.preventDefault())})),e.addEventListener("wheel",(e=>{c(e.deltaY<0)})),e.addEventListener("blur",(()=>{l(void 0,!1)}))}function C(e){if(!e)return;const t=e.querySelectorAll(".input-box");for(let e=0;en(s))),o.addEventListener("mouseup",(()=>i(s))),o.addEventListener("mouseleave",(()=>i(s))))}function n(e){0!==e.value.length&&(e.type="text")}function i(e){e.value.length>0&&(e.type="password"),e.focus()}}function A(e,t){if(e===t)return!0;const n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(n.length!=i.length)return!1;for(let s=0;s{"use strict";n.d(t,{_H:()=>r,Ee:()=>a,jc:()=>l,m0:()=>c,an:()=>d});var i=n(3147);let s,o=0;class r{constructor(e){this.model=e,this._children=[],this._subscriptions=[],this.active=!1,this.id=++o}async initAsync(){if(this.active)console.error(`[init] view is already active (id=${this.id}, ${Object.getPrototypeOf(this).constructor.name})`);else{this.active=!0,this.model&&(await this.model.initAsync(),this.subscribe(this.model.propertyChanged,this.onModelPropertyChanged.bind(this)),this.subscribe(this.model.interaction,this.onInteraction.bind(this))),this.onInit(),await this.onInitAsync();for(let e of this._children)await e.initAsync()}}render(e,t){this.elem=e,this.resources=t,this.onRender(e,t)}destroy(){if(this.active){this.active=!1;for(let e of this._children)e.destroy();this.onDestroy();for(let e of this._subscriptions)e.unsub();this._subscriptions=[],this.model&&this.model.destroy()}else console.error(`[destroy] view is not active (id=${this.id}, ${Object.getPrototypeOf(this).constructor.name})`)}addChild(e){this.active?console.error("[ViewBase] can't add child to an active view"):this._children.push(e)}removeChild(e){if(this.active)return void console.error("[ViewBase] can't remove child from an active view");let t=this._children.findIndex((t=>t===e));~t&&(e.destroy(),this._children.splice(t,1))}subscribe(e,t){this._subscriptions.push(e.sub(t))}addSubscription(e){this._subscriptions.push(e)}refresh(){this.active&&this.elem&&this.onRender(this.elem,this.resources)}onInit(){}async onInitAsync(){}onRender(e,t){}onDestroy(){}onModelPropertyChanged(e){}onInteraction(e){}on(e,t,n){e&&e.addEventListener(t,(e=>{e.preventDefault(),n(e.target)}))}onall(e,t,n){e.forEach((e=>this.on(e,t,n)))}onclick(e,t){this.onevt(e,"click",t)}onmouseover(e,t){this.onevt(e,"mouseover",t)}prefetchOnclick(e,t,n){this.select(e,(e=>{e&&(e.addEventListener("mouseenter",(()=>{e.addEventListener("mouseleave",(()=>{s&&(clearTimeout(s),s=void 0)})),s=setTimeout((()=>{t().catch((e=>console.error("[prefetch] ",e))),s=void 0}),65)})),e.addEventListener("click",(e=>{e.preventDefault(),n(e.target)})))}))}oninput(e,t){this.onevt(e,"input",t)}onsubmit(e,t){this.onevt(e,"submit",t)}onevt(e,t,n){this.select(e,(e=>this.on(e,t,n)))}focusInput(e){this.select(e,(e=>{(0,i.gw)(0).then((()=>{e.focus(),e.select()}))}))}setHtml(e,t){this.select(e,(e=>e.innerHTML=t))}setText(e,t){this.select(e,(e=>e.textContent=t))}clearText(e){this.select(e,(e=>e.textContent=""))}setAttr(e,t,n){this.select(e,(e=>e.setAttribute(t,n)))}removeAttr(e,t){this.select(e,(e=>e.removeAttribute(t)))}checkInputValidity(e){this.select(e,(e=>e.checkValidity()))}reportInputValidity(e){this.select(e,(e=>e.reportValidity()))}checkFormValidity(e){this.select(e,(e=>e.checkValidity()))}reportFormValidity(e){this.select(e,(e=>e.reportValidity()))}showError(e,t="#errortext"){this.setText(t,e),this.show(t)}hideError(e="#errortext"){this.clearText(e),this.hide(e)}show(e){this.select(e,(e=>e.classList.remove("hidden")))}hide(e){this.select(e,(e=>e.classList.add("hidden")))}enable(e){this.select(e,(e=>e.classList.remove("disabled")))}disable(e){this.select(e,(e=>e.classList.add("disabled")))}setEnabled(e,t){t?this.enable(e):this.disable(e)}select(e,t){const n=this.elem;if(n){let i=n.querySelector(e);i&&t(i)}}}class a extends r{constructor(e){super(),this.value=e}onRender(e){e.innerHTML=this.value}}class l extends r{constructor(e){super(),this.loadingHtml=e,this.renderer=new u,this.currentView=null,this._transitionInitClass="view-trans-in__init",this._transitionInClass="view-trans-in",this._transitionOutClass="view-trans-out",this._initial=!0,this.isLoading=!1}get transitionInitClass(){return this._transitionInitClass}set transitionInitClass(e){this.elem&&""!==this._transitionInitClass&&this.elem.classList.remove(this._transitionInitClass),this._transitionInitClass=e}get transitionInClass(){return this._transitionInClass}set transitionInClass(e){this.elem&&this.elem.classList.remove(this._transitionInClass),this._transitionInClass=e}get transitionOutClass(){return this._transitionOutClass}set transitionOutClass(e){this.elem&&this.elem.classList.remove(this._transitionOutClass),this._transitionOutClass=e}onDestroy(){let e=this.currentView;!e||e instanceof Promise||e.destroy(),this._initial=!0}onRender(e,t){this.loadingHtml&&this.isLoading?e.innerHTML=this.loadingHtml:this.currentView&&(this._initial?(this.renderWTransition(e,t),this._initial=!1):(e.classList.add(this._transitionOutClass),e.classList.remove(this._transitionInClass),e.addEventListener("transitionend",(()=>{e.classList.remove(this._transitionOutClass),this.renderWTransition(e,t)}),{once:!0})))}async renderWTransition(e,t){""!==this._transitionInitClass&&e.classList.add(this._transitionInitClass);let n=this.currentView instanceof Promise?await this.currentView:this.currentView;try{await this.renderer.render(e,n,t)}finally{await(0,i.gw)(0),""!==this._transitionInitClass&&e.classList.remove(this._transitionInitClass),e.classList.add(this._transitionInClass)}}renderView(e){this.currentView=e,this.refresh()}loading(e){this.isLoading=e,this.refresh()}}class c extends r{constructor(e,t,n){super(),this.source=e,this.viewFactory=t,this.emptyTemplate=n,this._views=[],this._scrollTriggerOffset=0,this._scrollAtTheBottom=!1,this._scrolledToBottom=new i.XF}get comparer(){return this._comparer}set comparer(e){this._comparer=e,this.sort(),this.refresh()}get scrolledToBottom(){return this._scrolledToBottom}get scrollTriggerOffset(){return this._scrollTriggerOffset}set scrollTriggerOffset(e){this._scrollTriggerOffset=e}async onInitAsync(){this.subscribe(this.source.changed,this.onCollectionChanged.bind(this)),await this.addViews()}onDestroy(){this.removeViews(),this._scrollListener=void 0}onRender(e,t){if(this.emptyTemplate&&0==this._views.length)return void(e.innerHTML=this.emptyTemplate.render({R:null==t?void 0:t.strings}));e.textContent="";let n=new DocumentFragment;for(let e of this._views){const i=document.createElement("div");e.render(i,t),n.appendChild(i)}e.appendChild(n),this._scrollListener&&e.removeEventListener("scroll",this._scrollListener),e.addEventListener("scroll",this._scrollListener=()=>this.onScroll.call(this,e))}async addViews(){this._views.length&&(this._views=[]);for(let e of this.source)await this.addView(e);this.sort()}removeViews(){for(let e of this._views)e.destroy();this._views=[]}async addView(e){const t=this.viewFactory(e);await t.initAsync(),this._views.push(t)}async addMultipleViews(e){for(let t of e)await this.addView(t);this.sort(),this.refresh()}async addSingleView(e){await this.addView(e),this.sort(),this.refresh()}removeView(e){const t=this._views.findIndex((t=>t.model===e));t<0?console.error("[ViewList] removeView -- view not found"):(this._views.splice(t,1)[0].destroy(),this.removeViewFromDOM(t),this.refresh())}sort(){this._comparer&&this._views.sort(this._comparer)}async onCollectionChanged(e){switch(e.type){case"added":if(e.value instanceof Array)return void await this.addMultipleViews(e.value);if(e.value)return void await this.addSingleView(e.value);case"removed":if(e.value&&!(e.value instanceof Array))return void this.removeView(e.value);case"reset":this.removeViews(),this.refresh()}}removeViewFromDOM(e){var t;const n=null===(t=this.elem)||void 0===t?void 0:t.children.item(e);if(!n)return console.error("[ViewList] removeViewFromDOM -- element not found"),void this.refresh();n.remove()}onScroll(e){e.scrollTop+e.offsetHeight+this._scrollTriggerOffset>=e.scrollHeight?(this._scrollAtTheBottom||this._scrolledToBottom.fire(),this._scrollAtTheBottom=!0):this._scrollAtTheBottom&&(this._scrollAtTheBottom=!1)}}class d{constructor(e,t){this.viewLoader=e,this.languageSvc=t,this.options={},this.awaiting=!1,this.renderid=0,this.nodeStack=[],this.beforeRenderEvt=new i.XF,this.afterRenderEvt=new i.XF,this.viewUpdatedEvt=new i.XF,this.transitionInitClass="view-app-trans-in__init",this.transitionInClass="view-app-trans-in",this.transitionOutClass="view-app-trans-out",this.observer=new MutationObserver((e=>{for(let t of e)if(t.addedNodes.length>0){let e=t.addedNodes[0].parentElement;e&&this.viewUpdatedEvt.fire(e)}}))}get beforeRender(){return this.beforeRenderEvt}get afterRender(){return this.afterRenderEvt}get viewUpdated(){return this.viewUpdatedEvt}get rendering(){return this.awaiting}get nodes(){return this.nodeStack.length}async render(e){if(console.warn("RENDER: ",e.pathname,e.nodes.join(",")),0===e.nodes.length)return Promise.resolve();for(this.observer.disconnect();this.nodeStack.length>e.nodes.length;)this.popNode();console.info("Nodestack: ",this.nodeStack.map((e=>e.name)).join(","));let t=0,n=0;for(let i=0;i0;)s.shift();if(n>0){const e=this.getPlaceholder();e&&(e.classList.remove(this.transitionInClass),e.classList.add(this.transitionOutClass),e.addEventListener("transitionend",(()=>{e.classList.remove(this.transitionOutClass)}),{once:!0}))}if(s.length>0){const t=++this.renderid,n=await this.languageSvc.getTranslation();if(t!=this.renderid)throw"[Render] new render during wait for locale data";for(let i=0;i0;)this.popNode()}peekNode(){return 0===this.nodeStack.length?null:this.nodeStack[this.nodeStack.length-1]}popNode(){const e=this.nodeStack.pop();e?(console.warn("popNode - ",e.name),e.view.destroy()):console.log("popNode - stack is empty")}async pushNode(e,t,n,s,o){console.warn("PUSH NODE ",t),this.awaiting=!0,this.beforeRenderEvt.fire({name:t});const r=this.getPlaceholder();if(!r)throw"Failed to find target element";this.clearPartialLoader(),this.renderLoader(r);try{r.classList.add(this.transitionInitClass);let a=await this.viewLoader(t,n,s);if(e!==this.renderid)throw`${t}: view changed during viewload, skipping rest`;if(r.classList.contains(this.transitionOutClass)&&await(0,i.iV)(r,"transitionend").then((()=>{})),e!==this.renderid)throw`${t}: view changed during transition out animation, skipping rest`;try{await a.initAsync()}catch(e){throw a.destroy(),e}if(e!==this.renderid)throw a.destroy(),`${t}: view changed during initAsync, skipping rest`;try{if(this.awaiting=!1,this.clearLoader(),a.render(r,o),await(0,i.gw)(0),r.classList.remove(this.transitionInitClass),r.classList.add(this.transitionInClass),r.addEventListener("transitionend",(()=>{r.classList.remove(this.transitionInClass)}),{once:!0}),e!==this.renderid)throw`${t}: view changed during transition in animation, skipping rest`}catch(e){throw e}this.nodeStack.push({elem:r,name:t,view:a}),this.afterRenderEvt.fire({name:t,view:a,elem:r})}catch(e){return this.clearLoader(),Promise.reject(e)}finally{this.awaiting=!1}}renderPartialLoader(){if(!this.options.loadingHtml)return;const e=this.getPlaceholder();e&&(this.partialLoader=document.createElement("div"),this.partialLoader.style.position="absolute",this.partialLoader.style.left="0",this.partialLoader.style.top="0",this.partialLoader.style.right="0",this.partialLoader.style.bottom="0",this.partialLoader.innerHTML=this.options.loadingHtml,e.insertAdjacentElement("afterend",this.partialLoader))}async renderLoader(e){if(this.options.loadingHtml){if(this.loader&&this.clearLoader(),this.loader=document.createElement("div"),await(0,i.gw)(300),!this.loader)return;if(this.loader.style.position="absolute",this.loader.style.opacity="0",this.loader.style.left="0",this.loader.style.top="0",this.loader.style.right="0",this.loader.style.bottom="0",this.loader.innerHTML=this.options.loadingHtml,e.insertAdjacentElement("afterend",this.loader),await(0,i.gw)(10),!this.loader)return;this.loader.style.opacity="1",this.loader.style.transition="opacity 1500ms ease-out"}}clearLoader(){this.loader&&(this.loader.remove(),this.loader=void 0)}clearPartialLoader(){this.partialLoader&&(this.partialLoader.remove(),this.partialLoader=void 0)}getPlaceholder(){var e;const t=`route-level-${this.nodeStack.length}`;let n=document.getElementById(t);if(n)return n;const i=((null===(e=this.peekNode())||void 0===e?void 0:e.elem)||document).getElementsByTagName("router-outlet");if(0===i.length)return console.error("Failed to find a router-outlet element"),null;i.length>1&&console.log(`router-outlet count > 1 ${i.length}`);const s=i[0];return n=document.createElement("div"),n.setAttribute("id",t),n.classList.add("view-trans"),n.style.position="relative",n.style.height="100%",s.insertAdjacentElement("afterend",n),s.remove(),n}}class u{constructor(){this.current=null,this.afterRenderEvt=new i.XF}get afterRender(){return this.afterRenderEvt}async render(e,t,n){this.current&&t!==this.current&&(this.current.destroy(),this.current=null),t.active||await t.initAsync(),this.current=t,t.render(e,n),this.afterRenderEvt.fire({view:t,elem:e})}}},2050:(e,t,n)=>{"use strict";n.d(t,{J:()=>s});var i=n(3147);class s{constructor(){this._propertyChanged=new i.XF,this._interaction=new i.XF,this._subscriptions=[]}get propertyChanged(){return this._propertyChanged}get interaction(){return this._interaction}initAsync(){return this.onInit(),this.onInitAsync()}destroy(){for(let e of this._subscriptions)e.unsub();this._subscriptions=[],this.onDestroy()}onInit(){}async onInitAsync(){}onDestroy(){}subscribe(e,t){this._subscriptions.push(e.sub(t))}onPropertyChanged(e){this._propertyChanged.fire({propertyName:e})}notify(e,t){this._interaction.fire({type:e,data:t})}}},1809:(e,t,n)=>{"use strict";n.d(t,{z:()=>s});var i=n(2892);class s extends i.R{constructor(){super(),super.setHtml('
'),this.shadow.querySelector("#root").addEventListener("click",this.toggle.bind(this))}get checked(){return this.hasAttribute("checked")}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}toggle(){this.checked=!this.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}}},2892:(e,t,n)=>{"use strict";n.d(t,{R:()=>s});var i=n(3147);class s extends HTMLElement{constructor(){super(),this.trackWindowResize=!1,this.shadow=this.attachShadow({mode:"open"}),this.shadow.innerHTML=""}connectedCallback(){if(this.trackWindowResize){let e=(0,i.Ds)(this.windowResize.bind(this),100,!0);window.addEventListener("resize",this.resizeCallback=()=>e.call(this))}}disconnectedCallback(){this.trackWindowResize&&this.resizeCallback&&(window.removeEventListener("resize",this.resizeCallback),this.resizeCallback=void 0)}windowResize(){console.warn("XControl - windowResize callback")}setHtml(e){for(;this.shadow.children.length>1;)this.shadow.removeChild(this.shadow.children[1]);let t=document.createElement("div");for(t.innerHTML=e;t.children.length;)t.firstChild&&this.shadow.appendChild(t.firstChild)}}},1832:(e,t,n)=>{"use strict";n.d(t,{Su:()=>d,qo:()=>v,EP:()=>h,J6:()=>u,S1:()=>m,Aq:()=>b});var i=n(2892);class s extends i.R{constructor(){super(),this._selectedItem=null,this.setHtml('
'),this.box=this.shadow.querySelector("#select-box"),this.menu=this.shadow.querySelector("#menu"),this.root=this.shadow.querySelector("#select-root"),this.header=this.shadow.querySelector("#header"),this.box.addEventListener("click",(e=>{this.open=!0,e.stopPropagation()})),this.menu.addEventListener("click",(e=>{e.target instanceof o&&(this.selectedItem=e.target,this.open=!1,this.root.focus())})),this.shadow.addEventListener("keydown",(e=>{27===e.keyCode&&(this.open=!1),this.open||(38===e.keyCode&&(this.selectAdjacentItem(!1),e.preventDefault()),40===e.keyCode&&(this.selectAdjacentItem(!0),e.preventDefault()))}))}connectedCallback(){document.addEventListener("click",this._documentOnClickListener=this.documentOnClick.bind(this))}disconnectedCallback(){this._documentOnClickListener&&(document.removeEventListener("click",this._documentOnClickListener),this._documentOnClickListener=void 0)}documentOnClick(e){var t;this.open&&!(null===(t=e.target)||void 0===t?void 0:t.closest("x-select-item"))&&(this.open=!1)}get selectedValue(){var e,t;return null!==(t=null===(e=this._selectedItem)||void 0===e?void 0:e.value)&&void 0!==t?t:null}set selectedValue(e){e&&this.querySelectorAll("x-select-item").forEach((t=>{t.value===e&&(this.selectedItem=t)}))}set selectedItem(e){var t;const n=null===(t=this._selectedItem)||void 0===t?void 0:t.value;this._selectedItem=e,e&&(this.header.innerText=e.innerText,e.value&&n!==e.value&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}selectAdjacentItem(e){var t;let n=null!==(t=this._selectedItem)&&void 0!==t?t:this.querySelector("x-select-item");if(n){if(e)for(;(null==n?void 0:n.nextElementSibling)&&!((n=n.nextElementSibling)instanceof o););else for(;(null==n?void 0:n.previousElementSibling)&&!((n=n.previousElementSibling)instanceof o););this.selectedItem=n}}get open(){return this.hasAttribute("open")}set open(e){e?(this.menu.style.width=`${this.box.offsetWidth}px`,this.setAttribute("open","")):this.removeAttribute("open")}}class o extends HTMLElement{connectedCallback(){this.attachShadow({mode:"open"}).innerHTML='
'}get value(){return this.getAttribute("value")}set value(e){e?this.setAttribute("value",e):this.removeAttribute("value")}}class r extends HTMLElement{constructor(){super();let e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.style.margin="7px 14px",t.style.backgroundColor="#ffffff",t.style.opacity="0.08",t.style.height="1px",e.appendChild(t)}}var a=n(1809);class l extends i.R{constructor(){super(),this.trackWindowResize=!0,this.setHtml('
'),this.border=this.shadow.querySelector("#border");const e=this.getFirstChildHtmlElement();e&&this.setActiveButton(e),this.addEventListener("click",(e=>{c(e.target)&&this.setActiveButton(e.target)}))}windowResize(){this.prevTab&&this.setActiveButton(this.prevTab)}setActiveButton(e){var t;const n=e.offsetLeft,i=e.offsetWidth;null===(t=this.prevTab)||void 0===t||t.removeAttribute("active"),e.setAttribute("active",""),this.border.style.borderTopLeftRadius=e.previousElementSibling?"2px":"0",this.border.style.borderTopRightRadius=e.nextElementSibling?"2px":"0",this.border.style.width=i+"px",this.border.style.transform=`translateX(${n}px)`,this.prevTab=e}getFirstChildHtmlElement(){for(let e=0;e{"use strict";n.d(t,{AA:()=>g,Wy:()=>p,C2:()=>f,VC:()=>w});var i=n(2050),s=n(6662),o=n(7041),r=n(2870),a=n(3147),l=n(3302),c=n.n(l),d=n(3007),u=n(1388),h=n(8090),v=n(6336),m=n(7287),b=n(8998);const g=420,p=630;class f extends i.J{constructor(e,t,n,i){super(),this.fundId=e,this.investInfo=t,this.account=n,this.openOrderFn=i,this._investAmount=c()(0),this.userAcknowledgedRisk=!1,this.positionValue=c()(0),this.commission=c()(0),this.reserve=c()(0),this.approxUnits=c()(0);const s=c()(0===t.MinimalInvest?t.NAV:t.MinimalInvest);let o=c()(t.MaximumInvest?t.MaximumInvest:0);this.fundMaxInvest=t.MaximumInvest?o:void 0;const a=c()(t.ReservePercentage).mul(.01);this.minInvestTotal=s.plus((0,r.aN)(t.ClientCommissionSettingsCollection,s)||c()(0)).plus(s.mul(a));const l=c()(this.account.AccountBalance),d=(0,r.Ck)(l,t.ClientCommissionSettingsCollection,a)||c()(0),u=((0,r.aN)(t.ClientCommissionSettingsCollection,d)||c()(0)).round(2,3),h=l.minus(u).minus(d.mul(a).round(2,3));t.MaximumInvest&&!o.gt(h)||(o=h),this.minInvestInAccountCurrency=s,this.maxInvestInAccountCurrency=o.round(2,0),this.minInvestStr=(0,r.xG)(this.minInvestInAccountCurrency,n.AccountCurrency),this.maxInvestStr=(0,r.xG)(this.maxInvestInAccountCurrency,n.AccountCurrency),this.currentNAV=(0,r.xG)(c()(t.NAV),t.Currency,t.Digits),this._investAmount=this.maxInvestInAccountCurrency,this.calculateValues()}get investAmount(){return this._investAmount}set investAmount(e){this._investAmount=e,this.calculateValues()}openOrder(){return this.totalInvest>this.account.AccountBalance?Promise.reject("Invest amount is greater than account balance"):this._investAmount.lt(this.minInvestInAccountCurrency)?Promise.reject("Invest amount is less than minimum"):this.maxInvestInAccountCurrency.gt(0)&&this._investAmount.gt(this.maxInvestInAccountCurrency)?Promise.reject("Invest amount is greater than maximum"):this.openOrderFn(this.fundId,this.investAmount.toNumber())}get cross(){return(0,r.FZ)(this.investInfo.CrossInstrumentData)}calculateValues(){const e=(0,r.Zg)(this._investAmount,this.cross);this.positionValue=e.round(2,3),this.commission=((0,r.aN)(this.investInfo.ClientCommissionSettingsCollection,this._investAmount)||c()(0)).round(2,3),this.reserve=this._investAmount.mul(this.investInfo.ReservePercentage).mul(.01).round(2,3);const t=c()(this.investInfo.NAV).round(this.investInfo.Digits,0);this.approxUnits=e.div(t)}get balance(){return(0,r.xG)(this.account.AccountBalance,this.account.AccountCurrency)}get enoughBalance(){return c()(this.account.AccountBalance).gte(this.minInvestTotal)}get isHighRiskFundForUser(){return!this.userAcknowledgedRisk&&this.investInfo.MutualFundRiskType>this.account.UserRiskType}get minInvestTotalStr(){return(0,r.xG)(this.minInvestTotal,this.account.AccountCurrency)}get requiredDeposit(){return(0,r.xG)(this.minInvestTotal.minus(this.account.AccountBalance),this.account.AccountCurrency)}get totalInvest(){return this._investAmount.plus(this.commission).plus(this.reserve).round(2,0).toNumber()}}class w extends s.s{constructor(e,t,n,i){super(e),this.model=e,this.depositSvc=t,this.accountSvc=n,this.demoPlatformSvc=i}onRender(e,t){if(!this.model.enoughBalance&&this.demoPlatformSvc.isDemoPlatform)return e.innerHTML=h.render({R:t.strings}),this.onclick("#okBtn",(()=>this.executeAction((async()=>{await this.demoPlatformSvc.sendDemoRequestEmail(),this.svc.showView(new _(this.demoPlatformSvc.demoEmail),{template:"empty",width:480,height:250})})))),void this.resize(520);if(this.model.investInfo.TradingCondition===o.Ct.Redeem)return e.innerHTML=m.render({R:t.strings,message:t.render("SR_invest_redeem_only",{name:this.model.investInfo.FundFullName})}),this.onclick("#okBtn",(()=>this.close())),void this.resize(520);if(this.model.isHighRiskFundForUser)return e.innerHTML=d.render({R:null==t?void 0:t.strings}),this.onclick("#okBtn",(()=>{this.model.userAcknowledgedRisk=!0,this.refresh()})),this.onclick("#cancelBtn",(()=>this.close())),void this.resize(520);if(!this.model.enoughBalance)return e.innerHTML=u.render({R:null==t?void 0:t.strings,message:t.render("SR_invest_make_deposit_f3",{name:this.model.investInfo.FundFullName,mininvest:this.model.minInvestTotalStr,deposit:this.model.requiredDeposit})}),this.prefetchOnclick("#okBtn",(()=>this.depositSvc.getPaymentProviders()),(()=>{this.close(),(0,r.gu)(this.svc,this.depositSvc,this.accountSvc)})),void this.resize(520);function n(e,n){const i=(0,a.N3)(n);return t.render("SR_invest_approx_units",{units:(0,r.VG)((0,a.$e)(e,n),!1,i,i)})}e.innerHTML=b.render({R:null==t?void 0:t.strings,fundName:this.model.investInfo.FundFullName,price:this.model.currentNAV,positionValue:(0,r.xG)(this.model.positionValue,this.model.investInfo.Currency),commission:(0,r.xG)(this.model.commission,this.model.account.AccountCurrency),reserve:(0,r.xG)(this.model.reserve,this.model.account.AccountCurrency),invest:{amount:this.model.investAmount,min:this.model.minInvestInAccountCurrency,max:this.model.maxInvestInAccountCurrency,minStr:this.model.minInvestStr,maxStr:this.model.maxInvestStr,multiplierStr:t.render("SR_invest_amount",{multiplier:(0,r.xG)(this.model.investInfo.InvestMultiplier,this.model.account.AccountCurrency)}),approxUnitsStr:n(this.model.approxUnits,this.model.investInfo.ApproxUnitMultiplier)},balance:this.model.balance,accountCurrency:this.model.account.AccountCurrency,confirmationDate:(0,r.p6)(this.model.investInfo.ExpectedConfirmationDate,null==t?void 0:t.info.locale)}),this.amountInput=e.querySelector("#investAmountFld"),(0,a.dQ)(this.amountInput,0,void 0,this.model.investInfo.InvestMultiplier,2),this.oninput("#investAmountFld",(e=>{const t=this.validate();t&&(this.model.investAmount=t,this.setText("#positionValue",(0,r.xG)(this.model.positionValue,this.model.investInfo.Currency)),this.setText("#commission",(0,r.xG)(this.model.commission,this.model.account.AccountCurrency)),this.setText("#reserve",(0,r.xG)(this.model.reserve,this.model.account.AccountCurrency)),this.setText("#approxUnits",n(this.model.approxUnits,this.model.investInfo.ApproxUnitMultiplier)))})),this.onsubmit("#invest",(()=>{var e;if(!this.validate())return;const n=(0,r.xG)(this.model.investAmount,this.model.account.AccountCurrency);this.svc.showMessage("Confirm Investment",null!==(e=null==t?void 0:t.render("SR_invest_confirmation_f2",{amount:n,name:this.model.investInfo.FundFullName}))&&void 0!==e?e:"%",{buttons:"ok-cancel",template:"empty"}).then((e=>{"ok"==e?this.executeAction(this.model.openOrder.bind(this.model)):this.focusInput("#investAmountFld")}))})),this.validate(),this.focusInput("#investAmountFld")}validate(){var e,t,n,i,s,o,l,d;let u=!0;if(this.clearValidationError(),0==this.amountInput.value.length)return void this.setEnabledDlg(!1);const h=Number.parseFloat(this.amountInput.value.replace(/,/g,""));if(Number.isNaN(h))return void this.setEnabledDlg(!1);const v=c()(h);return v.lt(this.model.minInvestInAccountCurrency)&&(this.setValidationError(null!==(t=null===(e=this.resources)||void 0===e?void 0:e.get("SR_invest_validation_min_invest"))&&void 0!==t?t:"%"),u=!1),v.gt(this.model.maxInvestInAccountCurrency)&&(this.setValidationError(null!==(i=null===(n=this.resources)||void 0===n?void 0:n.get("SR_invest_validation_balance"))&&void 0!==i?i:"%"),u=!1),this.model.fundMaxInvest&&v.gt(this.model.fundMaxInvest)&&(this.setValidationError(null!==(o=null===(s=this.resources)||void 0===s?void 0:s.get("SR_invest_validation_max_invest"))&&void 0!==o?o:"%"),u=!1),Number.isInteger(v.div(this.model.investInfo.InvestMultiplier).toNumber())||(this.setValidationError(null!==(d=null===(l=this.resources)||void 0===l?void 0:l.render("SR_invest_snap_error",{step:(0,r.xG)(this.model.investInfo.InvestMultiplier,this.accountSvc.account.AccountCurrency),nearestDown:(0,r.VG)((0,a.$e)(v,this.model.investInfo.InvestMultiplier),!1,2),nearestUp:(0,r.VG)((0,a.Ir)(v,this.model.investInfo.InvestMultiplier),!1,2)}))&&void 0!==d?d:"%"),u=!1),this.setEnabledDlg(u),u?v:void 0}setValidationError(e){this.amountInput.classList.add("invalid"),this.showError(e,".validation-error-message")}clearValidationError(){this.amountInput.classList.remove("invalid"),this.hideError(".validation-error-message")}}class _ extends s.s{constructor(e){super(),this.demoEmail=e}onRender(e,t){e.innerHTML=v.render({R:t.strings,email:this.demoEmail}),this.onclick("#okBtn",(()=>this.close()))}}},6730:(e,t,n)=>{var i={"./terms.en.html":[9918,641]};function s(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],s=t[0];return n.e(t[1]).then((()=>n(s)))}s.keys=()=>Object.keys(i),s.id=6730,e.exports=s}},e=>{"use strict";e.O(0,[179],(()=>[736,571,177,295,742,492].map(e.E)),5),e.O(0,[736],(()=>(7987,e(e.s=7987)))),e.O()}]);