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C,MAAM,GAAGlC,KAA4B,IAAtBA,EAAImC,QAAQ,KAAc,IAAM,gBAAgBP,OAAOQ,sBAAsBR,OAAOS,WAAWV,KAGpI,OAF+B1B,QAAegC,EAAQK,OAASL,C,CAG/D,MAAOM,GAOP,MANEpB,QAAQqB,IAAI,yCAAyCxC,KAE9B,mBAAhB,GAA8BT,GACnC,gBAAK/G,UAAU,wBAAuB,kDAGpC,IAAIiK,MAAMF,E,CAEpB,CAtCAX,OAAOQ,UAAYxC,SAASC,qBAAqB,eAAe,IAAIC,UACpE8B,OAAOS,SAAWzC,SAASC,qBAAqB,cAAc,IAAIC,UAClE8B,OAAOC,iBAAmBjC,SAASC,qBAAqB,uBAAuB,IAAIC,UACnF8B,OAAOE,0BAA4BlC,SAASC,qBAAqB,gCAAgC,IAAIC,UACrG8B,OAAOG,aAAenC,SAASC,qBAAqB,qBAAqB,IAAIC,UAC7E8B,OAAOI,YAAcpC,SAASC,qBAAqB,mBAAmB,IAAIC,S","sources":["webpack://vaneckreact/./FundPagesEU/Components/PerformanceScenarioHistoryBlock/PerformanceScenarioHistoryInnerBlock.tsx","webpack://vaneckreact/./FundPagesEU/Components/PerformanceScenarioHistoryBlock/PerformanceScenarioHistoryBlock.tsx","webpack://vaneckreact/./FundPagesEU/Components/PerformanceScenarioHistoryBlock/usePerformanceScenarioHistoryBlock.tsx","webpack://vaneckreact/./FundPages/services/fetchDataService.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\r\nimport {HeaderProperties, TableProperties, FundTableTitle, TableColumn, FundTableBody, FundTableWithoutTitle, FundTableFooter } from \"../../../FundPages/Components/CommonBlocks/FundTable\"\r\nimport parse from \"html-react-parser\";\r\n\r\ninterface IPerformanceScenarioHistoryTableProperties {\r\n    header: HeaderProperties | null,\r\n    tableData:TableProperties | any,\r\n    cssClass?: string,\r\n}\r\ntype referenceMonth = {\r\n    colOneVal:string,\r\n    colOnePercent:string,\r\n    colTwoVal:string,\r\n    colTwoPercent:string,\r\n    colThreeVal:string,\r\n    colThreePercent:string,\r\n    colFourVal: string,\r\n    colFourPercent: string,\r\n    refColumnItem:string,\r\n}\r\ntype tableBodyContent = {\r\n    ReferencedMonthsText: string,\r\n    MinimumText:string,\r\n    MinimumGuaranteeReturnText: string,\r\n    WhatYouMightGetBackAfterCostsText:string,\r\n    AverageAnnualReturnText:string,\r\n    colOneTitle:string,\r\n    colTwoTitle:string,\r\n    colThreeTitle:string,\r\n    colFourTitle:string,\r\n    referenceMonths: referenceMonth[],\r\n    minColValueTitle:string,\r\n    minColPercentTitle:string,\r\n    CurrencyText?: string | null\r\n}\r\nconst PerformanceScenarioHistoryInnerBlock = (props:IPerformanceScenarioHistoryTableProperties) => {\r\n    const {cssClass, tableData, header} = props;\r\n    return (\r\n        <div>\r\n            <DrawTitleWithTopContent headerData={header} tableData={tableData}/>\r\n        </div>\r\n    );\r\n};\r\n\r\nexport default PerformanceScenarioHistoryInnerBlock;\r\n\r\nconst DrawTitleWithTopContent = ({tableData, headerData}:{tableData: any, headerData:HeaderProperties| null}) => {\r\n    return(tableData &&\r\n        <div className=\"performance-scenario-history-block\">\r\n            <FundTableTitle headerData={headerData}/>\r\n            <div className=\"\">{tableData && parse(tableData.disclaimerText)}</div>\r\n            <DrawTableWithTabs tableData={tableData}/>\r\n            <FundTableFooter footer={tableData.footerText}/>\r\n        </div>\r\n    )\r\n}\r\n\r\nconst DrawTableWithTabs = ({tableData}:{tableData: any}) =>{\r\n    const [selectedItem, setSelectedItem] = useState(tableData && tableData.rhp[0])\r\n    const [tableBodyData, setTableBodyData] = useState<tableBodyContent>()\r\n    const [dropdownValue, setDropdownValue]= useState(\"\")\r\n    const [dropdownTitle, setDropdownTitle]= useState(\"\")\r\n\r\n    useEffect(() => {\r\n      if(tableData.dropdownTitles){\r\n        setDropdownValue(\r\n          tableData.dropdownTitles.includes(\"last-month\")\r\n            ? \"last-month\"\r\n            : tableData.dropdownTitles.includes(\"this-quarter\")\r\n            ? \"this-quarter\"\r\n            : tableData.dropdownTitles.includes(\"this-half-year\")\r\n            ? \"this-half-year\"\r\n            : tableData.dropdownTitles.includes(\"this-year\")\r\n            ? \"this-year\"\r\n            : tableData.dropdownTitles.includes(\"last-year\")\r\n            ? \"last-year\"\r\n            : \"\"\r\n        );\r\n        setDropdownTitle(\r\n          tableData.dropdownTitles.includes(\"last-month\")\r\n            ? tableData?.labels?.LastMonthText\r\n            : tableData.dropdownTitles.includes(\"this-quarter\")\r\n            ? tableData?.labels?.ThisQuarterText\r\n            : tableData.dropdownTitles.includes(\"this-half-year\")\r\n            ? tableData?.labels?.ThisHalfYearText\r\n            : tableData.dropdownTitles.includes(\"this-year\")\r\n            ? tableData?.labels?.ThisYearText\r\n            : tableData.dropdownTitles.includes(\"last-year\")\r\n            ? tableData?.labels?.LastYearText\r\n            : \"\"\r\n        );\r\n      }\r\n    }, [tableData]);\r\n\r\n    useEffect(()=>{\r\n        if (tableData) {\r\n            const currentObj = tableData && tableData.dataTableData[selectedItem];\r\n            let keyValues = Object.keys(tableData.dropdownItems).filter(key => tableData.dropdownItems[key].includes(dropdownValue))\r\n            const refMonths = keyValues.map((item ,key) => {\r\n              const currentItem = currentObj[item];\r\n              return {\r\n                colOneVal: currentItem.StressAmount,\r\n                colOnePercent: currentItem.StressPercent,\r\n                colTwoVal: currentItem.UnfavourableAmount,\r\n                colTwoPercent: currentItem.UnfavourablePercent,\r\n                colThreeVal: currentItem.ModerateAmount,\r\n                colThreePercent: currentItem.ModeratePercent,\r\n                colFourVal: currentItem.FavourableAmount,\r\n                colFourPercent: currentItem.FavourablePercent,\r\n                refColumnItem: item,\r\n              };\r\n            });\r\n          setTableBodyData({\r\n            ReferencedMonthsText: tableData.labels.ReferencedMonthsText,\r\n            MinimumText:tableData.labels.MinimumText,\r\n            MinimumGuaranteeReturnText: tableData.labels.MinimumGuaranteeReturnText,\r\n            colOneTitle:tableData.dataTableTitles.StressText,\r\n            colTwoTitle:tableData.dataTableTitles.UnfavourableText,\r\n            colThreeTitle:tableData.dataTableTitles.ModerateText,\r\n            colFourTitle:tableData.dataTableTitles.FavourableText,\r\n            minColValueTitle:tableData.labels.WhatYouMightGetBackAfterCostsText,\r\n            minColPercentTitle:tableData.labels.AverageAnnualReturnText,\r\n            WhatYouMightGetBackAfterCostsText: tableData.labels.WhatYouMightGetBackAfterCostsText,\r\n            AverageAnnualReturnText:tableData.labels.AverageAnnualReturnText,\r\n            referenceMonths: refMonths, \r\n            CurrencyText: tableData.labels.CurrencyText ?? null\r\n          });\r\n        }\r\n    },[selectedItem, dropdownValue])\r\n\r\n    const handleDropdownClick = (dropdownTitle: string, dropdownValue: string) =>{\r\n      setDropdownValue(dropdownValue);\r\n      setDropdownTitle(dropdownTitle)\r\n    }\r\n\r\n    return (\r\n      tableData && (\r\n        <>\r\n          <nav className=\"tab-nav\">\r\n            <ul className=\"nav nav-pills\">\r\n              {tableData.rhp &&\r\n                tableData.rhp.map((item: any, key: number) => {\r\n                  const tabTitle = item === 1 ? tableData.firstTabTitle : tableData.tabTitles[item];\r\n                  return (\r\n                    <li key={key} className=\"tab-nav__list-item nav-item\">\r\n                      <div\r\n                        className={`tab-nav__link nav-link ${\r\n                          item === selectedItem ? \"active\" : \"\"\r\n                        }`}\r\n                        onClick={() => setSelectedItem(item)}\r\n                      >\r\n                        {parse(tabTitle)}\r\n                      </div>\r\n                    </li>\r\n                  );\r\n                })}\r\n            </ul>\r\n          </nav>\r\n          <div className=\"fund-explorer-table m-3\">\r\n            {tableData.labels.ShowingPeriodText}:\r\n            {dropdownValue == \"\" && tableData.labels.NoPeriodsToShowText ? (\r\n              <span>{tableData.labels.NoPeriodsToShowText}</span>\r\n            ) : (\r\n              <div className=\"fund-explorer-table__view--dropdown premium-discount-chart-dropdowns d-inline-block mx-3\">\r\n                <div className=\"dropdown\">\r\n                  <div\r\n                    className=\"dropdown-menu dropdown__menu text-util-sm nav nav-tabs\"\r\n                    role=\"menu\"\r\n                  >\r\n                    {tableData.dropdownTitles &&\r\n                      tableData.dropdownTitles.map((item: string, key:number) => {\r\n                        let RealTitle = \"\";\r\n                        switch (item) {\r\n                          case \"last-year\":\r\n                            RealTitle = tableData?.labels?.LastYearText;\r\n                            break;\r\n                          case \"this-quarter\":\r\n                            RealTitle = tableData?.labels?.ThisQuarterText;\r\n                            break;\r\n                          case \"this-half-year\":\r\n                            RealTitle = tableData?.labels?.ThisHalfYearText;\r\n                            break;\r\n                          case \"this-year\":\r\n                            RealTitle = tableData?.labels?.ThisYearText;\r\n                            break;\r\n                          case \"last-month\":\r\n                            RealTitle = tableData?.labels?.LastMonthText;\r\n                            break;\r\n                        }\r\n                        return (\r\n                          <button key={key}\r\n                            className=\"dropdown-item dropdown__item text-util-sm\"\r\n                            role=\"menuitem\"\r\n                            type=\"button\"\r\n                            value={item}\r\n                            onClick={() => handleDropdownClick(RealTitle, item)}\r\n                          >\r\n                            {RealTitle}\r\n                          </button>\r\n                        );\r\n                      })}\r\n                  </div>\r\n                  <button\r\n                    aria-haspopup=\"true\"\r\n                    aria-expanded=\"false\"\r\n                    className=\"dropdown__button text-util-sm dropdown__button-default\"\r\n                    data-toggle=\"dropdown\"\r\n                  >\r\n                    <span className=\"dropdown__label\">{dropdownTitle}</span>\r\n                    <svg\r\n                      aria-hidden=\"true\"\r\n                      focusable=\"false\"\r\n                      data-prefix=\"far\"\r\n                      data-icon=\"chevron-down\"\r\n                      className=\"svg-inline--fa fa-chevron-down fa-w-16 fa-2x dropdown__icon dropdown__icon-default\"\r\n                      role=\"img\"\r\n                      xmlns=\"http://www.w3.org/2000/svg\"\r\n                      viewBox=\"0 0 18 18\"\r\n                    >\r\n                      <path\r\n                        fill=\"currentColor\"\r\n                        d=\"M2.26 4.88a.75.75 0 00-.54.21.75.75 0 000 1.07l6.75 6.75a.75.75 0 001.06 0l6.75-6.75a.75.75 0 000-1.07.75.75 0 00-1.06 0L9 11.31 2.78 5.1a.75.75 0 00-.52-.21z\"\r\n                      ></path>\r\n                    </svg>\r\n                  </button>\r\n                </div>\r\n              </div>\r\n            )}\r\n          </div>\r\n          <DrawTableBody data={tableBodyData} />\r\n        </>\r\n      )\r\n    );\r\n}\r\n\r\nconst DrawTableBody = ({data}:{data: any}) =>{\r\n    const [tableData, setTableData] = useState<TableProperties | null>();\r\n    const [renderedTimes, setRenderedTimes] = useState(1)\r\n    const [isFirstRender, setIsFirstRender] = useState(true)\r\n\r\n    const tableRows:any = [];\r\n    useEffect(()=>{\r\n        if(data){\r\n            const tableHeaderRows = [\r\n                [\r\n                    {value:data.ReferencedMonthsText, rowSpan:2},\r\n                    {value:data.MinimumText, css:\"text-left\"},\r\n                    {value:data.MinimumGuaranteeReturnText, colSpan:4}\r\n                ],\r\n                [\r\n                    {value:\"\"},\r\n                    {value: data.colOneTitle},\r\n                    {value: data.colTwoTitle},\r\n                    {value: data.colThreeTitle},\r\n                    {value: data.colFourTitle}\r\n                ]\r\n            ]\r\n            \r\n            const tableColumns: TableColumn[] = [{value:\"\", multipleRows:tableHeaderRows}]\r\n            data.referenceMonths.map((item: referenceMonth)=>{\r\n              const rowOne = [\r\n                {value: item.refColumnItem, rowSpan: 2},\r\n                {value: `${data.WhatYouMightGetBackAfterCostsText} ${data.CurrencyText ? `(${data.CurrencyText})`: \"\"}`, css:\"text-left\"},\r\n                {value: item.colOneVal},\r\n                {value: item.colTwoVal},\r\n                {value: item.colThreeVal},\r\n                {value: item.colFourVal}\r\n              ]\r\n              const rowTwo = [\r\n                {value: data.AverageAnnualReturnText, css:\"text-left\"},\r\n                {value: item.colOnePercent},\r\n                {value: item.colTwoPercent},\r\n                {value: item.colThreePercent},\r\n                {value: item.colFourPercent}\r\n              ]\r\n              tableRows.push(rowOne, rowTwo)\r\n            })\r\n            setTableData({\r\n                tableColumns: tableColumns,\r\n                tableRows:tableRows\r\n            })\r\n        }\r\n    },[data])\r\n\r\n    useEffect(()=>{\r\n      if (data) {\r\n        setRenderedTimes(renderedTimes + 1);\r\n        if (renderedTimes == 3) {\r\n          setIsFirstRender(false);\r\n        }\r\n      }\r\n    },[data])\r\n\r\n    return(\r\n        <>\r\n            <FundTableWithoutTitle tableData={tableData} isFirstRender={isFirstRender}/>\r\n        </>\r\n    )\r\n}","import \"./PerformanceScenarioHistoryBlock.scss\"\r\nimport React, { useEffect, useState } from 'react';\r\nimport useAutoScrollUp from '../../../FundPages/core/customHooks/useAutoScollUp';\r\nimport PerformanceScenarioHistoryInnerBlock from './PerformanceScenarioHistoryInnerBlock';\r\nimport usePerformanceScenarioHistoryBlock from './usePerformanceScenarioHistoryBlock';\r\n\r\nexport interface PerformanceScenarioHistoryBlockInterface extends ComponentInterface {};\r\nconst PerformanceScenarioHistoryBlock = (props:PerformanceScenarioHistoryBlockInterface) => {\r\n    const element = props.rootElement;\r\n    const blockID = element.dataset.blockid as unknown as number;\r\n    const pageID = element.dataset.pageid as unknown as number;\r\n\r\n    const [markup, setMarkup] = useState(<div className=\"component-loading\">Loading Data...</div>);\r\n    // useAutoScrollUp(element);\r\n    const [header, tableData, cssClass] = usePerformanceScenarioHistoryBlock({\r\n        blockID: blockID,\r\n        pageID: pageID,\r\n        setMarkup: setMarkup\r\n      });\r\n    if (isNaN(blockID)) return <p>Error: BlockID not found.</p>;\r\n    useEffect(()=>{\r\n        if(!tableData){\r\n            if(element.parentElement){\r\n                element.parentElement.style.display = \"none\";\r\n            }\r\n        }\r\n        else{\r\n            if(element.parentElement){\r\n                element.parentElement.style.display = \"block\";\r\n            }\r\n        }\r\n    }, [tableData])\r\n    return (\r\n        <div>\r\n            {markup}\r\n            <PerformanceScenarioHistoryInnerBlock header={header} tableData={tableData} cssClass={cssClass}/>\r\n        </div>\r\n    );\r\n};\r\n\r\nexport default PerformanceScenarioHistoryBlock;","import React, { useEffect, useMemo, useState } from 'react';\r\nimport {FundTableBlockDataProperties, HeaderProperties, TableColumn } from \"../../../FundPages/Components/CommonBlocks/FundTable\"\r\nimport { fetchBlockData } from '../../../FundPages/services/fetchDataService';\r\n\r\nconst usePerformanceScenarioHistoryBlock = (props:FundTableBlockDataProperties): ([header: HeaderProperties | null, tableData:{} | null, cssClass: string]) => {\r\n    const { blockID, pageID, setMarkup } = props;\r\n    const [header, setHeader] = useState<HeaderProperties|null>(null);\r\n    const [tableData, setTableData] = useState<any|null>(null);\r\n    const [cssClass, setCssClass] = useState<string>(\"\");\r\n    const ticker = useMemo(() => document.getElementsByTagName(\"ve-fundticker\")[0]?.innerHTML, []);\r\n    useEffect(()=>{\r\n        (async () => {\r\n            const response = await fetchBlockData({\r\n              url: `/Main/PerformanceScenarioHistoryBlock/GetContent/?blockid=${blockID}&pageid=${pageID}${ticker ? \"&ticker=\" + ticker : \"\"}`,\r\n              isJson: true,\r\n              setMarkup: setMarkup\r\n            });\r\n          \r\n            setHeader({\r\n                title: response.data.Title,\r\n            })\r\n            if(response.data){\r\n              setTableData({\r\n                disclaimerText: response.data.DisclaimerText,\r\n                footerText: response.data.FooterText,\r\n                rhp: response.data.RHP,\r\n                data: response.data.Data,\r\n                tabTitles: response.data.IfYouExitAfterXYearsText,\r\n                firstTabTitle: response.data.IfYouExitAfterOneYearText ?? \"\",\r\n                dataTableTitles: {\r\n                  StressText: response.data.StressText,\r\n                  UnfavourableText: response.data.UnfavourableText,\r\n                  ModerateText: response.data.ModerateText,\r\n                  FavourableText: response.data.FavourableText,\r\n                },\r\n                dataTableData: response.data.Data,\r\n                dropdownTitles: [...new Set(Object.values(response.data.RowMonthCssClasses).reverse().join(\" \").split(\" \"))], //remove duplicates, convert back to array.\r\n                dropdownItems: response.data.RowMonthCssClasses,\r\n                labels: {\r\n                  ShowingPeriodText: response.data.ShowingPeriodText,\r\n                  LastMonthText: response.data.LastMonthText,\r\n                  ThisQuarterText: response.data.ThisQuarterText,\r\n                  ThisHalfYearText: response.data.ThisHalfYearText,\r\n                  ThisYearText: response.data.ThisYearText,\r\n                  LastYearText: response.data.LastYearText,\r\n                  NoPeriodsToShowText: response.data.NoPeriodsToShowText,\r\n                  ReferencedMonthsText: response.data.ReferencedMonthsText,\r\n                  MinimumText: response.data.MinimumText,\r\n                  StressText: response.data.StressText,\r\n                  UnfavourableText: response.data.UnfavourableText,\r\n                  ModerateText: response.data.ModerateText,\r\n                  FavourableText: response.data.FavourableText,\r\n                  WhatYouMightGetBackAfterCostsText:\r\n                    response.data.WhatYouMightGetBackAfterCostsText,\r\n                  AverageAnnualReturnText: response.data.AverageAnnualReturnText,\r\n                  MinimumGuaranteeReturnText: response.data.MinimumGuaranteeReturnText,\r\n                  CurrencyText: response.data.Currency\r\n                },\r\n              });\r\n            }else{\r\n              setTableData(null)\r\n          }\r\n          /* @ts-ignore */\r\n            setCssClass(response.data.CssClass)\r\n            setMarkup(false)\r\n          })().catch(() => console.error(`An error occured while loading block: ${blockID}`));\r\n    },[blockID])\r\n    return (\r\n        [header, tableData, cssClass]\r\n    );\r\n};\r\n\r\nexport default usePerformanceScenarioHistoryBlock;","import React from \"react\";\r\n\r\nexport interface FetchBlockDataInterface {\r\n  url: string,\r\n  isJson?: Boolean,\r\n  setMarkup?: Function | null\r\n}\r\n\r\ndeclare global {\r\n  interface Window {\r\n      reactlang: string | null | undefined;\r\n      reactctr: string | null | undefined;\r\n      isapiepieditmode: string | null | undefined;\r\n      isapilatestversionpreview: string | null | undefined;\r\n      epiprojectid: string | null | undefined;\r\n      contextmode: string | null | undefined;\r\n  }\r\n}\r\n\r\nwindow.reactlang = document.getElementsByTagName(\"ve-language\")[0]?.innerHTML;\r\nwindow.reactctr = document.getElementsByTagName(\"ve-country\")[0]?.innerHTML;\r\nwindow.isapiepieditmode = document.getElementsByTagName(\"ve-is-epi-edit-mode\")[0]?.innerHTML;\r\nwindow.isapilatestversionpreview = document.getElementsByTagName(\"ve-is-latest-version-preview\")[0]?.innerHTML;\r\nwindow.epiprojectid = document.getElementsByTagName(\"ve-epi-project-id\")[0]?.innerHTML;\r\nwindow.contextmode = document.getElementsByTagName(\"ve-context-mode\")[0]?.innerHTML;\r\n\r\n/**\r\n * Fetches data for a given API endpoint. Expects any get parameters to be encoded in the url.\r\n * If JSON is expected, returns the JSON object. If not returns the result object.\r\n * @param {FetchBlockDataInterface} options\r\n * @returns {any|Response}\r\n */\r\nexport async function fetchBlockData({ url, isJson = true, setMarkup = null }: FetchBlockDataInterface): Promise<any | Response> {\r\n\r\n  try {\r\n    let additionalParams = window.isapiepieditmode || window.isapilatestversionpreview\r\n      ? `&epieditmode=${window.isapiepieditmode}&latest=${window.isapilatestversionpreview}`\r\n      : '';\r\n    if(window.epiprojectid){\r\n        additionalParams += `&epiprojects=${window.epiprojectid}`;\r\n    }\r\n    if(window.contextmode){\r\n        additionalParams += `&contextmode=${window.contextmode}`;\r\n    }\r\n    const request = await fetch(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}reactlang=${window.reactlang}&reactctr=${window.reactctr}${additionalParams}`);\r\n    const response: Response|any = isJson ? await request.json() : request;\r\n    \r\n    return response;\r\n  } catch (err) {\r\n      console.log(`Error while fetching block data! URL: ${url}`);\r\n\r\n      typeof (setMarkup) === \"function\" && setMarkup(\r\n        <div className=\"component-load-failed\">An error occured when loading data.</div>\r\n      );\r\n\r\n    throw new Error(err as string);\r\n  }\r\n}"],"names":["props","cssClass","tableData","header","DrawTitleWithTopContent","headerData","className","FundTable","disclaimerText","DrawTableWithTabs","footer","footerText","selectedItem","setSelectedItem","useState","rhp","tableBodyData","setTableBodyData","dropdownValue","setDropdownValue","dropdownTitle","setDropdownTitle","useEffect","dropdownTitles","includes","labels","LastMonthText","ThisQuarterText","ThisHalfYearText","ThisYearText","LastYearText","currentObj","dataTableData","refMonths","Object","keys","dropdownItems","filter","key","map","item","currentItem","colOneVal","StressAmount","colOnePercent","StressPercent","colTwoVal","UnfavourableAmount","colTwoPercent","UnfavourablePercent","colThreeVal","ModerateAmount","colThreePercent","ModeratePercent","colFourVal","FavourableAmount","colFourPercent","FavourablePercent","refColumnItem","ReferencedMonthsText","MinimumText","MinimumGuaranteeReturnText","colOneTitle","dataTableTitles","StressText","colTwoTitle","UnfavourableText","colThreeTitle","ModerateText","colFourTitle","FavourableText","minColValueTitle","WhatYouMightGetBackAfterCostsText","minColPercentTitle","AverageAnnualReturnText","referenceMonths","CurrencyText","tabTitle","firstTabTitle","tabTitles","onClick","ShowingPeriodText","NoPeriodsToShowText","role","RealTitle","type","value","handleDropdownClick","focusable","xmlns","viewBox","fill","d","DrawTableBody","data","setTableData","renderedTimes","setRenderedTimes","isFirstRender","setIsFirstRender","tableRows","tableColumns","multipleRows","rowSpan","css","colSpan","rowOne","rowTwo","push","element","rootElement","blockID","dataset","blockid","pageID","pageid","markup","setMarkup","setHeader","setCssClass","ticker","useMemo","document","getElementsByTagName","innerHTML","response","url","isJson","title","Title","DisclaimerText","FooterText","RHP","Data","IfYouExitAfterXYearsText","IfYouExitAfterOneYearText","Set","values","RowMonthCssClasses","reverse","join","split","Currency","CssClass","catch","console","error","isNaN","parentElement","style","display","async","fetchBlockData","additionalParams","window","isapiepieditmode","isapilatestversionpreview","epiprojectid","contextmode","request","fetch","indexOf","reactlang","reactctr","json","err","log","Error"],"sourceRoot":""}