"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2419],{92419:function(e,r,n){var t=n(85893),s=n(87903),a=n(83269),i=n(35005);r.Z=class{static sortBondList(e,r){switch(e){case"recentlyAddedId":this.sortOnRecentlyAdded(r);break;case"alphabeticalId":this.sortOnIssuerName(r);break;case"alphabeticalIdDesc":this.sortOnIssuerNameDesc(r);break;case"maturityId":this.sortOnMaturity(r);break;case"maturityIdAesc":this.sortOnMaturityDesc(r);break;case"priceChangeId":this.sortOnPriceChange(r);break;case"priceChangeIdDesc":this.sortOnPriceChangeDesc(r);break;case"riskId":this.sortOnRisk(r);break;case"riskIdAesc":this.sortOnRiskAesc(r);break;case"amountInvestedId":this.sortOnAmountInvested(r);break;case"amountInvestedIdAesc":this.sortOnAmountInvestedAesc(r)}}static sortOnRecentlyAdded(e){e.sort((e,r)=>{if(e.recentlyAddedId){if(r.recentlyAddedId<e.recentlyAddedId)return 1;if(r.recentlyAddedId>e.recentlyAddedId)return -1}else if(e.createdOn){if(r.createdOn<e.createdOn)return -1;if(r.createdOn>e.createdOn)return 1}else if(e.portfolioISINId)try{let n=a.Z.convertToNumber(e.portfolioISINId),t=a.Z.convertToNumber(r.portfolioISINId);if(n<t)return 1;if(n>t)return -1}catch(e){}return 0})}static sortOnIssuerName(e){e.sort((e,r)=>r.issuerNameInBoldLetters>e.issuerNameInBoldLetters?-1:r.issuerNameInBoldLetters<e.issuerNameInBoldLetters?1:0)}static sortOnIssuerNameDesc(e){e.sort((e,r)=>r.issuerNameInBoldLetters<e.issuerNameInBoldLetters?-1:r.issuerNameInBoldLetters>e.issuerNameInBoldLetters?1:0)}static sortOnMaturity(e){e.sort((e,r)=>{let n=a.Z.convertToNumber(e.maturityYrs),t=a.Z.convertToNumber(r.maturityYrs);return n>t?-1:n<t?1:0})}static sortOnMaturityDesc(e){e.sort((e,r)=>{let n=a.Z.convertToNumber(e.maturityYrs),t=a.Z.convertToNumber(r.maturityYrs);return n>t?1:n<t?-1:0})}static sortOnPriceChange(e){e.sort((e,r)=>{let n=a.Z.convertToNumber(e.priceChange),t=a.Z.convertToNumber(r.priceChange);return n>t?-1:n<t?1:0})}static sortOnPriceChangeDesc(e){e.sort((e,r)=>{let n=a.Z.convertToNumber(e.priceChange),t=a.Z.convertToNumber(r.priceChange);return n>t?1:n<t?-1:0})}static sortOnRisk(e){e.sort((e,r)=>{let n=a.Z.getRiskType(e.bondRating),t=a.Z.getRiskType(r.bondRating);return n.sortOrder>t.sortOrder?-1:n.sortOrder<t.sortOrder?1:0})}static sortOnRiskAesc(e){e.sort((e,r)=>{let n=a.Z.getRiskType(e.bondRating),t=a.Z.getRiskType(r.bondRating);return n.sortOrder>t.sortOrder?1:n.sortOrder<t.sortOrder?-1:0})}static sortOnAmountInvested(e){e.sort((e,r)=>{let n=a.Z.convertToNumber(e.totalBondPriceNum),t=a.Z.convertToNumber(r.totalBondPriceNum);return n>t?-1:n<t?1:0})}static sortOnAmountInvestedAesc(e){e.sort((e,r)=>{let n=a.Z.convertToNumber(e.totalBondPriceNum),t=a.Z.convertToNumber(r.totalBondPriceNum);return n>t?1:n<t?-1:0})}static processBond(e,r,n,t,i,o,c){r.yeildClass="zero-background",r.dataTarget=t?"bond-details-modal":"registered-users-only-modal",r.chartDivId=e+"-5-day-chart-"+(n+i);let l=""+r.issuerISINId,d="/api/bond-details?bondISINId="+l+"&purchasedDate="+r.purchasedDate+"&portfolioISINId=&watchListISINId=";"portfolio"==e?d="/api/bond-details?bondISINId="+l+"&purchasedDate="+r.purchasedDate+"&portfolioISINId="+r.portfolioISINId+"&screenSource=P&watchListISINId=":"watch-list"==e&&(d="/api/bond-details?bondISINId="+l+"&purchasedDate=&portfolioISINId=&screenSource=W&watchListISINId="+r.watchListISINId),r.detailsUrl=d;let u=""+r.issuerNameInBoldLetters,h=a.Z.truncate(u,18);r.bolLetterNameTruncated=h,r.issuerNameInNormalLettersTruncated=a.Z.truncate(r.issuerNameInNormalLetters,18);let g=""+r.totalPriceChange;r.hashBond=null!=g&&void 0!=g&&""!=g&&"#NA"==g,"#NA"==g&&(r.currencyCode=" - ",r.bondPrice=" - ",r.bondYield=" - "),r.esgIconURL=a.Z.getEsgIconUrl(r.esgCategory),r.bondIndustryTruncated=a.Z.truncate(r.bondIndustry,10);try{if(r.priceChange&&!isNaN(r.priceChange)){let e=a.Z.getDoubleStr(r.priceChange,10);e>0?r.bondPriceChange="+".concat(e):r.bondPriceChange="".concat(e)}else r.priceChange=0,r.bondPriceChange="-";this.processEachBond(r);let n="";if("watch-list"==e?r.yeildClass=0==r.priceChange?"zero-background":r.priceChange<0?"loss-background":"gain-background":"portfolio"==e?r.yeildClass=0==r.priceChange?"zero-background":r.priceChange<0?"loss-background":"gain-background":"new-issues"==e?r.yeildClass=0==r.priceChange?"zero-background":r.priceChange<0?"loss-background":"gain-background":r.yeildClass=r.priceChange<0?"loss-background":"gain-background",r.hasOwnProperty("bondRecentDatePrices")){let e=r.bondRecentDatePrices;try{e&&e.constructor==Array&&e.forEach(e=>{n=e.date})}catch(e){}if(r.hasOwnProperty("priceChange")&&r.hasOwnProperty("YieldChangeInBpUnit")){let e=a.Z.getDateInDDMMMYYYY(new Date);e==o.lastRefreshedDate?0==r.priceChange&&0!=r.YieldChangeInBpUnit&&n==e?r.yeildClass="zero-background":0==r.priceChange&&0==r.YieldChangeInBpUnit&&n==e?r.yeildClass="zero-background":0==r.priceChange&&0==r.YieldChangeInBpUnit&&n!=e?(r.bondPriceChange="-",r.YieldChangeInBpUnit=" - ",r.yeildClass="zero-background"):"#NA"==r.priceChange?r.yeildClass="zero-background":n!=e?(r.bondPriceChange="-",r.YieldChangeInBpUnit=" - ",r.yeildClass="zero-background"):r.yeildClass=r.priceChange<0?"loss-background":"gain-background":0==r.priceChange&&0!=r.YieldChangeInBpUnit&&n==o.lastRefreshedDate?r.yeildClass="zero-background":0==r.priceChange&&0==r.YieldChangeInBpUnit&&n==o.lastRefreshedDate?r.yeildClass="zero-background":0==r.priceChange&&0==r.YieldChangeInBpUnit&&n!=o.lastRefreshedDate?(r.bondPriceChange="-",r.YieldChangeInBpUnit=" - ",r.yeildClass="zero-background"):"#NA"==r.priceChange?r.yeildClass="zero-background":n!=o.lastRefreshedDate?(r.bondPriceChange="-",r.YieldChangeInBpUnit=" - ",r.yeildClass="zero-background"):r.yeildClass=r.priceChange<0?"loss-background":"gain-background"}}}catch(n){("new-issues"==e||"portfolio"==e==e=="watch-list")&&(r.bondPriceChange="-",r.YieldChangeInBpUnit=" - ",r.yeildClass="zero-background")}this.process5DayGraphData(r),s.Z.isUserActive()?(r.bondYieldTrunc=r.bondYield,r.bondYieldTooltip=r.bondYield+"%",r.bondYieldCss={fontSize:"0.875rem"},r.bondYield&&(r.bondYield.length>7?r.bondYieldTrunc=r.bondYield.substring(0,5)+"..":r.bondYield.length>5&&(r.bondYieldCss={fontSize:"0.75rem"})),r.YieldChangeInBpUnitTrunc=r.YieldChangeInBpUnit,r.YieldChangeInBpUnitTooltip=r.YieldChangeInBpUnit+"bp",r.YieldChangeInBpUnitCss={fontSize:"0.875rem"},r.YieldChangeInBpUnit?"#NA"==r.YieldChangeInBpUnit?r.YieldChangeInBpUnitTrunc="-":r.YieldChangeInBpUnit.length>7?r.YieldChangeInBpUnitTrunc=r.YieldChangeInBpUnit.substring(0,5)+"..":r.YieldChangeInBpUnit.length>5&&(r.YieldChangeInBpUnitCss={fontSize:"0.75rem"}):r.YieldChangeInBpUnitTrunc="-"):(r.currency="",r.totalBondPrice="#NA",r.bondPercent=null,r.bondPercent1d=null,r.graphData=[],r.currencyCode=null,r.bondYield="",r.weeklyPriceChange="",r.dayPriceChange="",r.bondPriceChange="",r.YieldChangeInBpUnit="#NA",r.flagLink=null,r.bondIndustry=null,r.bondIndustryTruncated="",r.maturityYrs="",r.riskImage=null,r.bondRating=null,r.bondPrice=null)}static processEachBond(e){let r=e.countryOfRiskCode;if(r){let n=a.Z.getFlagUrl(r.toLowerCase());e.flagLink=n}if(e.hasOwnProperty("bondRecentDatePrices")){let r=e.bondRecentDatePrices;try{r&&r.constructor==Array&&r.forEach(e=>{e.date})}catch(e){}}let n=e.bondRating,t=a.Z.getRiskType(n);e.bondRating=t.name,t&&(e.riskImage=t.image)}static process5DayGraphData(e){let r=[];if(e.hasOwnProperty("bondRecentDatePricesDict")&&(r=e.bondRecentDatePricesDict),r&&r.constructor==Array&&0==r.length&&(r=e.bondRecentDatePrices),r||(r=[]),r.constructor==Array&&r.length>0){let n=e.bondIssuedPrice;(null==n||""==n||void 0==n)&&(n="100");let t=a.Z.convertToNumber(n),s=[],i=[];r.forEach(e=>{let r=a.Z.convertToNumber(e.bondPriceMid);r||(r=0),s.push(r);let n="yellow";r>t?n="green":r<t&&(n="red"),i.push(n),t=r}),s.length>5&&(s.shift(),i.shift());let o={};o.role="style";let c=[],l=["Element","Density",o];c.push(l);for(let e=0;e<s.length;e++)(l=[]).push(""),l.push(s[e]),l.push(i[e]),c.push(l);e.graphData=c}else e.graphData=[]}static showSubscriptionPlanLevelMessage(){return{title:"Subscribe",content:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:"Please subscribe to an existing plan to enjoy this feature."}),(0,t.jsxs)("div",{className:"".concat(style.reverseFlex),children:[(0,t.jsx)(i.Z,{className:style.orangeButton,onClick:()=>props.sideBarClickListener?props.sideBarClickListener("subscriptions"):()=>{},children:"Subscribe"}),(0,t.jsx)(i.Z,{onClick:saveNewsAlert,variant:"secondary",children:"Cancel"})]})]}),type:"orange",closeIcon:!0,closeIconClass:"fa fa-close",icon:"fa-user"}}static showSubscriptionMessage(){return{title:"For Subscribers Only",content:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:"The Excel download feature is available to subscribers only. Please subscribe to access this feature."}),(0,t.jsxs)("div",{className:"".concat(style.reverseFlex),children:[(0,t.jsx)(i.Z,{className:style.orangeButton,onClick:saveNewsAlert,children:"Subscribe Now"}),(0,t.jsx)(i.Z,{onClick:()=>props.sideBarClickListener?props.sideBarClickListener("subscriptions"):()=>{},variant:"secondary",children:"Cancel"})]})]}),type:"orange",closeIcon:!0,closeIconClass:"fa fa-close",icon:"fa-user"}}static showProUpgradeMessage(e,r,n){let s=(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{children:"The Excel download feature is only available to Pro subscribers. Please upgrade your subscription plan to enjoy this feature."})}),fun=()=>{};return r.sideBarClickListener&&(fun=()=>{r.sideBarClickListener("subscriptions")}),{title:"Pro users only",content:s,type:"orange",closeIcon:!0,closeIconClass:"fa fa-close",icon:"fa-user",buttons:[{label:"Cancel",variant:"secondary",onClick:n},{label:"Upgrade To Pro",variant:"primary",onClick:fun}]}}static showExpiredUserMessage(e,r,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return{title:"For Subscribers Only",content:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{children:s||"The feature is only available to subscribers only. Please subscribe for full access."})}),type:"orange",closeIcon:!0,closeIconClass:"fa fa-close",icon:"fa-user",buttons:[{label:"Subscribe now",variant:"primary",onClick:()=>r.sideBarClickListener?r.sideBarClickListener("subscriptions"):()=>{}},{label:"Cancel",variant:"secondary",onClick:n}]}}static showSuccessMessage(e,r){return{title:"Success",content:e,type:"green",icon:"fa-check",closeIcon:!0,closeIconClass:"fa fa-close",buttons:[]}}static showErrorMessage(e,r){return{title:"Error",content:e,type:"red",icon:"fa-warning",closeIcon:!0,closeIconClass:"fa fa-close",buttons:[]}}static showSubscriptionAlertForNewsAlert(e,r,n){return{title:"For Subscribers Only",content:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:"Setting news alert feature is available to subscribers only. Please subscribe to access this feature"}),(0,t.jsxs)("div",{className:"".concat(e.reverseFlex),children:[(0,t.jsx)(i.Z,{onClick:n,variant:"secondary",children:"Cancel"}),(0,t.jsx)(i.Z,{className:e.orangeButton,onClick:()=>r.sideBarClickListener?r.sideBarClickListener("subscriptions"):()=>{},children:"Subscribe now"})]})]}),type:"orange",closeIcon:!0,closeIconClass:"fa fa-close",icon:"fa-user"}}}}}]);