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F,OAAO;YACL,cAAc;YACd,eAAe;YACf,eAAe;YACf,gBAAgB;QAClB;QAEA;IACF;IAEA,MAAM,eAAe;QACnB,oEAAoE;QACpE,cAAc,gCAAgC,CAAC,IAAC,EAAE,aAAa,CAAC;QAChE,cAAc,gCAAgC,CAAC,IAAC,EAAE,aAAa,CAAC;QAChE,cAAc,sBAAsB,CAAC,IAAC,EAAE,UAAU,CAAC;QACnD,cAAc,uBAAuB,CAAC,IAAC,EAAE,WAAW,CAAC;QACrD,cAAc,sBAAsB,CAAC,EAAE,IAAI,CAAC,CAAC;QAC7C,cAAc,wBAAwB;QACtC,cAAc,yBAAyB;QACvC,cAAc,wBAAwB;QACtC,cAAc,yBAAyB;QACvC,cAAc,+BAA+B,CAAC,0BAA0B,EAAE,SAAS,gBAAgB,CAAC;QACpG,cACE,+BACA,CAAC,wCAAwC,EAAE,aAAa,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1E;IAEA,MAAM,gBAAgB,CAAC;QACrB,OAAO,AAAmB,SAAS,aAAa,CAAC,UAAW,KAAK;IACnE;IAEA,MAAM,gBAAgB,CAAC,UAAkB;QACvC,SAAS,aAAa,CAAC,UAAW,WAAW,GAAG;IAClD;IAEA,MAAM,gBAAgB,CAAC;QACrB,OAAO,MAAM,OAAO,CAAC,GAAG,OAAO,CAAC,yBAAyB;IAC3D;IAEA,aAAa,OAAO,CAAC,CAAC;QACpB,SAAS,aAAa,CAAC,QAAQ,iBAAiB,SAAS;IAC3D;AACF","sources":["src/ts/components/intermediaryBtlCalc.ts"],"sourcesContent":["document.addEventListener('DOMContentLoaded', () => {\n const INPUT_FIELDS = [\n '#btl-loan-amount-input',\n '#btl-property-value-input',\n '#btl-received-input',\n '#btl-initial-rate-input',\n ];\n let rentMinusTen: number;\n let interestOnly: string;\n let stressTested: string;\n let stressrate: number;\n let IRoutput: string;\n let stressoutput: number;\n let ltv: string;\n let higherRate: string;\n let basicRate: string;\n let basicResult: string;\n let basicResult2: string;\n let higherResult: string;\n let higherResult2: string;\n\n const calculate = () => {\n const amountInput = parseFloat(getInputValue('#btl-loan-amount-input'));\n const propertyValue = parseFloat(getInputValue('#btl-property-value-input'));\n const received = parseFloat(getInputValue('#btl-received-input'));\n const initialIR = parseFloat(getInputValue('#btl-initial-rate-input'));\n\n IRoutput = initialIR.toString();\n\n if (initialIR > 3.5) {\n stressrate = initialIR / 100 + 0.02;\n } else if (initialIR < 3.5) {\n stressrate = 0.055;\n }\n\n stressoutput = stressrate * 100;\n\n rentMinusTen = parseFloat((received - (((received * 12) / 365) * 10) / 12).toFixed(2));\n\n interestOnly = readableValue((amountInput * initialIR) / 100 / 12);\n stressTested = readableValue((amountInput * stressrate) / 12);\n\n ltv = ((amountInput / propertyValue) * 100).toFixed(0);\n basicRate = (((amountInput * stressrate) / 12) * 1.25).toFixed(2);\n higherRate = (((amountInput * stressrate) / 12) * 1.48).toFixed(2);\n\n if (rentMinusTen > 0) {\n if (received - (((received * 12) / 365) * 10) / 12 >= ((amountInput * stressrate) / 12) * 1.25) {\n basicResult = 'Pass';\n basicResult2 = '';\n } else {\n basicResult = '';\n basicResult2 = 'The rental income does not appear to meet our current criteria';\n }\n\n if (received - (((received * 12) / 365) * 10) / 12 >= ((amountInput * stressrate) / 12) * 1.48) {\n higherResult = 'Pass';\n higherResult2 = '';\n } else {\n higherResult = '';\n higherResult2 = 'The rental income does not appear to meet our current criteria';\n }\n } else {\n basicResult = ' ';\n higherResult = ' ';\n basicResult2 = ' ';\n higherResult2 = '';\n }\n\n updateOutput();\n };\n\n const updateOutput = () => {\n // setInputValue('#btl-rent-minus-ten-days h4', `£${rentMinusTen}`);\n setInputValue('#btl-result-interest-only h4', `£${interestOnly}`);\n setInputValue('#btl-result-stress-tested h4', `£${stressTested}`);\n setInputValue('#btl-basic-rate h4', `£${basicRate}`);\n setInputValue('#btl-higher-rate h4', `£${higherRate}`);\n setInputValue('#btl-result-ltv h4', `${ltv}%`);\n setInputValue('#btl-basic-result h5', basicResult);\n setInputValue('#btl-higher-result h5', higherResult);\n setInputValue('#btl-basic-result2 p', basicResult2);\n setInputValue('#btl-higher-result2 p', higherResult2);\n setInputValue('#btl-result-interest-only p', `Monthly Mortgage Payment (${IRoutput}%) Interest Only`);\n setInputValue(\n '#btl-result-stress-tested p',\n `Monthly Mortgage Payment (Stress Tested ${stressoutput.toFixed(2)}%)`,\n );\n };\n\n const getInputValue = (selector: string): string => {\n return (document.querySelector(selector)).value;\n };\n\n const setInputValue = (selector: string, value: string): void => {\n document.querySelector(selector)!.textContent = value;\n };\n\n const readableValue = (value: number): string => {\n return value.toFixed(2).replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n };\n\n INPUT_FIELDS.forEach((field) => {\n document.querySelector(field)?.addEventListener('keyup', calculate);\n });\n});\n"],"names":[],"version":3,"file":"index.12ed3bc1.js.map"}