{"version":3,"file":"stock-BYjbHu_l.js","sources":["../../../app/javascript/entrypoints/utils/stock.ts"],"sourcesContent":["import { FinancialInformationDisclosureTypeEnum } from '../output/models/FinancialInformationDisclosure';\nimport type {\n FinancialInformationDisclosure,\n HighestForecast,\n Reaction,\n ResultsForecastDisclosure,\n ResultsForecastShort,\n Stock,\n SummaryDisclosure,\n SummaryForecast,\n SummaryShort,\n} from '../output/models';\n\nimport { fixed, fixed2, percent, percent2 } from './number';\n\nexport const accountingPeriodFull = (\n financial: ResultsForecastShort | SummaryForecast | SummaryShort,\n): string => {\n return `${financial.accounting_period} ${financial.quarter}Q`;\n};\n\nexport const changeRate = (financial: Stock | undefined): string => {\n const value = financial?.change_rate;\n\n if (value === 0 || value) {\n return `${percent(value)}%`;\n } else {\n return '- %';\n }\n};\n\nexport const dividendYield = (financial: Stock | undefined): string => {\n const value = financial?.dividend_yield;\n\n if (value === 0 || value) {\n return `${percent2(value)} %`;\n } else {\n return '-';\n }\n};\n\nexport const fcfRatio = (financial: Stock | undefined): string => {\n const value = financial?.fcf_ratio;\n\n if (value === 0 || value) {\n return `${fixed(value)} 倍`;\n } else {\n return '- 倍';\n }\n};\n\nexport const operatingIncomeRatio = (financial: Stock | undefined): string => {\n const value = financial?.operating_income_ratio;\n\n if (value === 0 || value) {\n return `${fixed(value)} 倍`;\n } else {\n return '- 倍';\n }\n};\n\nexport const per = (\n financial:\n | SummaryDisclosure\n | ResultsForecastDisclosure\n | Stock\n | HighestForecast\n | Reaction\n | undefined,\n truncate?: boolean,\n): string => {\n const value = financial?.per;\n\n if (value === 0 || value) {\n return `${fixed(value, truncate && value >= 1000)} 倍`;\n } else {\n return '- 倍';\n }\n};\n\nexport const pbr = (\n financial: SummaryDisclosure | ResultsForecastDisclosure | Stock | undefined,\n): string => {\n const value = financial?.pbr;\n\n if (value === 0 || value) {\n return `${fixed2(value)} 倍`;\n } else {\n return '- 倍';\n }\n};\n\nexport const typeText = (financial: FinancialInformationDisclosure): string => {\n if (financial.type === FinancialInformationDisclosureTypeEnum.Summary) {\n return '短信';\n } else if (financial.type === FinancialInformationDisclosureTypeEnum.ResultsForecast) {\n return '業予';\n } else {\n return '';\n }\n};\n\nexport const ytd = (financial: Stock | HighestForecast | Reaction | undefined): string => {\n const value = financial?.ytd;\n\n if (value === 0 || value) {\n return `${percent(value)}%`;\n } else {\n return '- %';\n }\n};\n"],"names":["accountingPeriodFull","financial","changeRate","value","percent","dividendYield","percent2","operatingIncomeRatio","fixed","per","truncate","pbr","fixed2","typeText","FinancialInformationDisclosureTypeEnum","ytd"],"mappings":"qZAea,MAAAA,EACXC,GAEO,GAAGA,EAAU,iBAAiB,IAAIA,EAAU,OAAO,IAG/CC,EAAcD,GAAyC,CAClE,MAAME,EAAQF,GAAA,YAAAA,EAAW,YAErB,OAAAE,IAAU,GAAKA,EACV,GAAGC,EAAQD,CAAK,CAAC,IAEjB,KAEX,EAEaE,EAAiBJ,GAAyC,CACrE,MAAME,EAAQF,GAAA,YAAAA,EAAW,eAErB,OAAAE,IAAU,GAAKA,EACV,GAAGG,EAASH,CAAK,CAAC,KAElB,GAEX,EAYaI,EAAwBN,GAAyC,CAC5E,MAAME,EAAQF,GAAA,YAAAA,EAAW,uBAErB,OAAAE,IAAU,GAAKA,EACV,GAAGK,EAAML,CAAK,CAAC,KAEf,KAEX,EAEaM,EAAM,CACjBR,EAOAS,IACW,CACX,MAAMP,EAAQF,GAAA,YAAAA,EAAW,IAErB,OAAAE,IAAU,GAAKA,EACV,GAAGK,EAAML,EAAOO,GAAYP,GAAS,GAAI,CAAC,KAE1C,KAEX,EAEaQ,EACXV,GACW,CACX,MAAME,EAAQF,GAAA,YAAAA,EAAW,IAErB,OAAAE,IAAU,GAAKA,EACV,GAAGS,EAAOT,CAAK,CAAC,KAEhB,KAEX,EAEaU,EAAYZ,GACnBA,EAAU,OAASa,EAAuC,QACrD,KACEb,EAAU,OAASa,EAAuC,gBAC5D,KAEA,GAIEC,EAAOd,GAAsE,CACxF,MAAME,EAAQF,GAAA,YAAAA,EAAW,IAErB,OAAAE,IAAU,GAAKA,EACV,GAAGC,EAAQD,CAAK,CAAC,IAEjB,KAEX"}