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,IAAG,M,CAFIA,IAAAA,EAAiB,K,SAKjBC,GAAAA,EACK,gBAAG,mBADRA,EAEG,cAAG,iBAFNA,EAGG,cAAG,iBAHNA,EAIC,YAAG,e,CAJJA,IAAAA,EAAS,M,mCCVrB,IAEO,EAIA,EAyDA,E,0FA7DKC,GAAAA,EACL,MAALxD,Q,CADUwD,IAAAA,EAAY,K,SAIZtE,GAAAA,EACN,KAAG,aADGA,EAEL,MAAG,cAFEA,EAGL,MAAG,c,CAHEA,IAAAA,EAAQ,K,SAyDRuE,GAAAA,EACL,MAAG,QADEA,EAEA,WAAG,a,CAFHA,IAAAA,EAAe,M,kBC9D3BC,EAAOC,QAAU,CAAC,UAAY,6BAA6B,OAAS,0BAA0B,QAAU,6B,kBCAxGD,EAAOC,QAAU,CAAC,UAAY,iCAAiC,eAAiB,sCAAsC,kBAAoB,yCAAyC,KAAO,4BAA4B,WAAa,kCAAkC,IAAM,2BAA2B,SAAW,gCAAgC,UAAY,iCAAiC,gBAAkB,uCAAuC,WAAa,kCAAkC,cAAgB,qCAAqC,iBAAmB,wCAAwC,sBAAwB,+C,kBCA9mBD,EAAOC,QAAU,CAAC,aAAe","sources":["webpack://_N_E/./public/icons/check.svg","webpack://_N_E/./src/components/HomePage/QuranGrowthJourneySection/CollapsibleSection/QuranReadingGoals/CurrentWeekProgress.tsx","webpack://_N_E/./src/components/HomePage/QuranGrowthJourneySection/CollapsibleSection/QuranReadingGoals/DayCircle/index.tsx","webpack://_N_E/./src/components/ReadingGoal/ReadingGoalAmount/VerseRangesList.tsx","webpack://_N_E/./src/components/ReadingGoal/ReadingGoalAmount/index.tsx","webpack://_N_E/./types/auth/Streak.ts","webpack://_N_E/./src/hooks/auth/useGetStreakWithMetadata.ts","webpack://_N_E/./types/Range.ts","webpack://_N_E/./types/auth/Goal.ts","webpack://_N_E/./src/components/HomePage/QuranGrowthJourneySection/CollapsibleSection/QuranReadingGoals/DayCircle/DayCircle.module.scss","webpack://_N_E/./src/components/HomePage/QuranGrowthJourneySection/CollapsibleSection/QuranReadingGoals/ReadingStreak.module.scss","webpack://_N_E/./src/components/ReadingGoal/ReadingGoalAmount/VerseRangesList.module.scss"],"sourcesContent":["var _path;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nvar SvgCheck = function SvgCheck(props) {\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 15,\n height: 15,\n viewBox: \"0 0 15 15\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M11.467 3.727c.289.189.37.576.181.865l-4.25 6.5a.625.625 0 0 1-.944.12l-2.75-2.5a.625.625 0 0 1 .841-.925l2.208 2.007 3.849-5.886a.625.625 0 0 1 .865-.181Z\",\n fill: \"currentColor\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n })));\n};\nexport default SvgCheck;","import classNames from 'classnames';\nimport useTranslation from 'next-translate/useTranslation';\n\nimport DayCircle, { DayState } from './DayCircle';\nimport styles from './ReadingStreak.module.scss';\n\nimport { ContentSide } from '@/dls/Popover';\nimport HoverablePopover from '@/dls/Popover/HoverablePopover';\nimport useGetStreakWithMetadata from '@/hooks/auth/useGetStreakWithMetadata';\nimport { dateToReadableFormat } from '@/utils/datetime';\nimport { convertFractionToPercent } from '@/utils/number';\n\ninterface Props {\n weekData: ReturnType<typeof useGetStreakWithMetadata>['weekData'];\n goal?: ReturnType<typeof useGetStreakWithMetadata>['goal'];\n fixedWidth?: boolean;\n}\n\nconst CurrentWeekProgress: React.FC<Props> = ({ weekData, goal, fixedWidth = true }) => {\n const { lang, t } = useTranslation();\n const { days, readingDaysMap } = weekData;\n\n const getDayState = (day: (typeof days)[number]): DayState => {\n const readingDay = readingDaysMap[day.dateString];\n const hasRead = readingDay?.hasRead;\n\n // if the user has a goal, we want to show a checked circle if the user has completed his goal for the day\n // otherwise, we want to show a filled circle if the user has read at all for the day\n const isGoalDone = goal ? convertFractionToPercent(readingDay?.progress || 0) >= 100 : hasRead;\n\n if (isGoalDone) return DayState.Checked;\n if (hasRead) return DayState.Filled;\n\n return day.current ? DayState.Stroked : DayState.None;\n };\n\n return (\n <div>\n <p className={styles.weekProgressLabel}>{t('reading-goal:week-progress')}</p>\n <div\n className={classNames(styles.week, {\n [styles.fixedWidth]: fixedWidth,\n })}\n >\n {days.map((day) => {\n const dayState = getDayState(day);\n\n return (\n <div key={day.info.localizedNumber} className={styles.day}>\n <HoverablePopover\n content={dateToReadableFormat(day.date, lang)}\n contentSide={ContentSide.TOP}\n >\n <span className={styles.fullName}>{day.info.title}</span>\n <span className={styles.shortName}>{day.info.localizedNumber}</span>\n </HoverablePopover>\n\n <div className={styles.circleContainer}>\n <DayCircle state={dayState} />\n\n <div className={styles.dayDivider} />\n </div>\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default CurrentWeekProgress;\n","import classNames from 'classnames';\n\nimport styles from './DayCircle.module.scss';\n\nimport CheckIcon from '@/icons/check.svg';\n\nexport enum DayState {\n None = 'none',\n Stroked = 'stroked',\n Filled = 'filled',\n Checked = 'checked',\n}\n\ninterface DayCircleProps {\n state: DayState;\n}\n\nconst DayCircle: React.FC<DayCircleProps> = ({ state }) => {\n return (\n <div\n className={classNames(styles.dayCircle, {\n [styles.filled]: state === DayState.Filled || state === DayState.Checked,\n [styles.stroked]: state === DayState.Stroked,\n })}\n >\n {state === DayState.Checked ? <CheckIcon /> : null}\n </div>\n );\n};\n\nexport default DayCircle;\n","import { useContext } from 'react';\n\nimport useTranslation from 'next-translate/useTranslation';\n\nimport styles from './VerseRangesList.module.scss';\n\nimport DataContext from '@/contexts/DataContext';\nimport Button, { ButtonShape, ButtonSize, ButtonVariant } from '@/dls/Button/Button';\nimport Link, { LinkVariant } from '@/dls/Link/Link';\nimport CloseIcon from '@/icons/close.svg';\nimport { RangeItemDirection } from '@/types/Range';\nimport { getChapterData } from '@/utils/chapter';\nimport { logButtonClick } from '@/utils/eventLogger';\nimport { toLocalizedNumber } from '@/utils/locale';\nimport { getChapterWithStartingVerseUrl } from '@/utils/navigation';\nimport { parseVerseRange } from '@/utils/verseKeys';\n\ninterface VerseRangesListProps {\n ranges: string[];\n onVerseClick?: (position: RangeItemDirection, verseKey: string) => void;\n allowClearingRanges?: boolean;\n setRanges?: (ranges: string[]) => void;\n}\n\nconst VerseRangesList = ({\n ranges,\n onVerseClick,\n allowClearingRanges,\n setRanges,\n}: VerseRangesListProps) => {\n const { t, lang } = useTranslation('reading-goal');\n const chaptersData = useContext(DataContext);\n\n const handleVerseClick = (position: RangeItemDirection, verseKey: string) => {\n if (!onVerseClick) return;\n\n onVerseClick(position, verseKey);\n };\n\n const handleRangeDeleteClick = (toBeRemovedRange: string) => {\n logButtonClick('add_reading_range_remove', {\n range: toBeRemovedRange,\n });\n const newRanges = ranges.filter((range) => range !== toBeRemovedRange);\n setRanges(newRanges);\n };\n\n const all: React.ReactNode[] = [];\n\n ranges.forEach((range) => {\n const [\n { chapter: fromChapter, verse: fromVerse, verseKey: rangeFrom },\n { chapter: toChapter, verse: toVerse, verseKey: rangeTo },\n ] = parseVerseRange(range);\n\n const from = `${\n getChapterData(chaptersData, fromChapter).transliteratedName\n } ${toLocalizedNumber(Number(fromVerse), lang)}`;\n\n const to = `${getChapterData(chaptersData, toChapter).transliteratedName} ${toLocalizedNumber(\n Number(toVerse),\n lang,\n )}`;\n\n all.push(\n <div className={styles.rowContainer}>\n <div>\n <Link\n href={getChapterWithStartingVerseUrl(rangeFrom)}\n variant={LinkVariant.Blend}\n onClick={() => handleVerseClick(RangeItemDirection.From, rangeFrom)}\n >\n {from}\n </Link>\n {` ${t('common:to')} `}\n <Link\n href={getChapterWithStartingVerseUrl(rangeTo)}\n variant={LinkVariant.Blend}\n onClick={() => handleVerseClick(RangeItemDirection.To, rangeTo)}\n >\n {to}\n </Link>\n </div>\n {allowClearingRanges && (\n <Button\n size={ButtonSize.Small}\n variant={ButtonVariant.Ghost}\n onClick={() => handleRangeDeleteClick(range)}\n shape={ButtonShape.Circle}\n >\n <CloseIcon />\n </Button>\n )}\n </div>,\n );\n });\n\n if (all.length === 0) return null;\n\n return all.length > 1 ? (\n <ul>\n {all.map((range, idx) => (\n // eslint-disable-next-line react/no-array-index-key\n <div key={idx}>{range}</div>\n ))}\n </ul>\n ) : (\n <>{all}</>\n );\n};\n\nexport default VerseRangesList;\n","import useTranslation from 'next-translate/useTranslation';\n\nimport VerseRangesList from './VerseRangesList';\n\nimport { StreakWithMetadata } from '@/hooks/auth/useGetStreakWithMetadata';\nimport { CurrentQuranActivityDay } from '@/types/auth/ActivityDay';\nimport { GoalType } from '@/types/auth/Goal';\nimport { RangeItemDirection } from '@/types/Range';\nimport { secondsToReadableFormat } from '@/utils/datetime';\nimport { logButtonClick } from '@/utils/eventLogger';\nimport { toLocalizedNumber } from '@/utils/locale';\nimport { convertFractionToPercent, convertNumberToDecimal } from '@/utils/number';\n\nexport enum ReadingGoalAmountContext {\n HomePage = 'home_page',\n QuranReader = 'quran_reader',\n ProgressPage = 'progress_page',\n}\n\ninterface ReadingGoalAmountProps {\n goal?: StreakWithMetadata['goal'];\n currentActivityDay?: CurrentQuranActivityDay;\n context: ReadingGoalAmountContext;\n}\n\nconst ReadingGoalAmount: React.FC<ReadingGoalAmountProps> = ({\n goal,\n currentActivityDay,\n context,\n}) => {\n const { t, lang } = useTranslation('reading-goal');\n const percent = convertFractionToPercent(currentActivityDay?.progress || 0);\n\n if (!goal || !goal.progress) return null;\n\n const { progress, type: goalType } = goal;\n const prefix = percent === 0 ? t('todays-goal') : t('remaining');\n\n let action: string | React.ReactNode = '';\n\n const handleVerseClick = (direction: RangeItemDirection, verseKey: string) => {\n return () => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n logButtonClick(`${context}_goal_range_${direction}`, { verse_key: verseKey });\n };\n };\n\n if (goalType === GoalType.TIME) {\n action = t('progress.time-goal', {\n time: secondsToReadableFormat(progress.amountLeft, t, lang),\n });\n }\n\n if (goalType === GoalType.PAGES) {\n action = t('progress.pages-goal', {\n pages: toLocalizedNumber(convertNumberToDecimal(progress.amountLeft, 2), lang),\n });\n }\n\n if (goalType === GoalType.RANGE) {\n action = (\n <VerseRangesList\n ranges={currentActivityDay?.remainingDailyTargetRanges || []}\n onVerseClick={handleVerseClick}\n />\n );\n }\n\n return (\n <>\n {/* eslint-disable-next-line i18next/no-literal-string */}\n {prefix}: {action}\n {typeof goal.progress.daysLeft === 'number' && (\n <>\n <br />\n {t('reading-goal:remaining-days', {\n count: goal.progress.daysLeft,\n days: toLocalizedNumber(goal.progress.daysLeft, lang),\n })}\n </>\n )}\n </>\n );\n};\n\nexport default ReadingGoalAmount;\n","import { Mushaf } from '../QuranReader';\n\nimport { ActivityDay, QuranActivityDay } from './ActivityDay';\nimport { QuranGoalStatus } from './Goal';\n\nexport enum StreakType {\n QURAN = 'QURAN',\n}\n\nexport type StreakWithUserMetadata = {\n streak: number;\n goal?: QuranGoalStatus;\n activityDays: (Omit<ActivityDay<QuranActivityDay>, 'date'> & {\n date: string;\n })[];\n};\n\nexport type StreakWithMetadataParams = {\n from: string;\n to: string;\n mushafId: Mushaf;\n type: StreakType;\n};\n","/* eslint-disable max-lines */\n/* eslint-disable react-func/max-lines-per-function */\nimport { useEffect, useMemo, useState } from 'react';\n\nimport useTranslation from 'next-translate/useTranslation';\nimport { useSelector, shallowEqual } from 'react-redux';\nimport useSWR from 'swr';\n\nimport { selectQuranFont, selectQuranMushafLines } from '@/redux/slices/QuranReader/styles';\nimport { ActivityDay, CurrentQuranActivityDay, QuranActivityDay } from '@/types/auth/ActivityDay';\nimport { StreakType, StreakWithMetadataParams } from '@/types/auth/Streak';\nimport { getMushafId } from '@/utils/api';\nimport { getStreakWithUserMetadata } from '@/utils/auth/api';\nimport { makeStreakUrl } from '@/utils/auth/apiPaths';\nimport { isLoggedIn } from '@/utils/auth/login';\nimport { dateToDateString, getFullDayName } from '@/utils/datetime';\nimport { toLocalizedNumber } from '@/utils/locale';\n\ntype Day = { current: boolean; dateString: string; date: Date };\n\nconst useGetWeekDays = () => {\n return useMemo(() => {\n const days: Day[] = [];\n const today = new Date();\n\n // we want to timeline to start from Sunday\n const sunday = new Date(today);\n if (today.getDay() !== 0) {\n sunday.setDate(today.getDate() - today.getDay());\n }\n\n for (let i = 0; i < 7; i += 1) {\n const day = new Date(sunday);\n day.setDate(sunday.getDate() + i);\n\n days.push({\n current: day.getDate() === today.getDate(),\n date: day,\n dateString: dateToDateString(day),\n });\n }\n\n return days;\n }, []);\n};\n\nconst useGetWeekDayNames = (week: Day[], streak: number, showWeekdayName = false) => {\n const { t, lang } = useTranslation('reading-goal');\n\n return useMemo(() => {\n const names: { localizedNumber: string; title: string }[] = [];\n\n let showIncrement = streak > 1;\n let currentDayIndex = 0;\n if (!showWeekdayName && showIncrement) {\n week.forEach((day, index) => {\n /**\n * we need to make sure that the streak is bigger than\n * the current day's number.\n *\n * Example:\n * Streak: 3\n * Timeline:\n * 1 2 3 4 (5 <- current day) 6 7\n *\n * In this case, we don't want to show the increment and start counting days from 1\n */\n if (day.current) {\n showIncrement = streak > index + 1;\n currentDayIndex = index;\n }\n });\n }\n\n for (let i = 0; i < 7; i += 1) {\n let dayName: { localizedNumber: string; title: string };\n if (showWeekdayName) {\n dayName = {\n localizedNumber: toLocalizedNumber(i + 1, lang),\n title: getFullDayName(week[i].date, lang),\n };\n } else {\n /**\n * If we're showing the increment, we need to subtract all days from the beginning of the week till the current day, and after that increment it based on the day's index.\n *\n * Example:\n * Streak: 10\n * Timeline:\n * 1 (2 <- current day) 3 4 5 6 7\n *\n * We need to render \"1\" as Day 9, and \"2\" as Day 10.\n * \"1\" -> i = 0; currentDayIndex = 1; streak = 10; 10 - 1 + 0 = 9\n * \"2\" -> i = 1; currentDayIndex = 1; streak = 10; 10 - 1 + 1 = 10\n *\n */\n const localizedNumber = toLocalizedNumber(\n showIncrement ? streak - currentDayIndex + i : i + 1,\n lang,\n );\n\n dayName = {\n localizedNumber,\n title: t('day-x', {\n day: localizedNumber,\n }),\n };\n }\n\n names.push(dayName);\n }\n\n return names;\n }, [lang, showWeekdayName, streak, t, week]);\n};\n\nconst useGetStreakWithMetadata = ({\n showDayName,\n disableIfNoGoalExists,\n}: {\n showDayName?: boolean;\n disableIfNoGoalExists?: boolean;\n} = {}) => {\n const week = useGetWeekDays();\n const quranFont = useSelector(selectQuranFont, shallowEqual);\n const mushafLines = useSelector(selectQuranMushafLines, shallowEqual);\n const { mushaf } = getMushafId(quranFont, mushafLines);\n\n const [disabled, setDisabled] = useState<boolean | null>(null);\n\n const params: StreakWithMetadataParams = {\n mushafId: mushaf,\n from: week[0].dateString,\n to: week[week.length - 1].dateString,\n type: StreakType.QURAN,\n };\n\n // we don't pass the params to `makeStreakUrl` in the key so that we can invalidate the cache without getting the other params\n const { data, isValidating, error } = useSWR(\n isLoggedIn() && disabled !== true ? makeStreakUrl() : null,\n () => getStreakWithUserMetadata(params),\n {\n revalidateOnFocus: false,\n },\n );\n\n useEffect(() => {\n if (disabled !== null || !disableIfNoGoalExists || !data) {\n return;\n }\n\n /**\n * We don't want to re-fetch the data if the user has no goal.\n * This is useful for the quran reader widget when we invalidate the cache after the user has read something.\n */\n setDisabled(!data.data.goal);\n }, [disableIfNoGoalExists, disabled, data]);\n\n const isLoading = isValidating && !data;\n\n const { activityDays, goal, streak } = data?.data || {\n activityDays: [],\n goal: undefined,\n streak: 0,\n };\n\n const readingDaysMap = useMemo<\n Record<string, ActivityDay<QuranActivityDay> & { hasRead: boolean }>\n >(() => {\n if (!activityDays) return {};\n\n const result = {};\n\n activityDays.forEach((day) => {\n result[day.date] = {\n ...day,\n hasRead:\n day.pagesRead > 0 ||\n day.secondsRead > 0 ||\n day.ranges.length > 0 ||\n day.manuallyAddedSeconds > 0,\n };\n });\n\n return result;\n }, [activityDays]);\n\n const currentActivityDay: CurrentQuranActivityDay | undefined = useMemo(() => {\n return readingDaysMap[week.find((d) => d.current)?.dateString];\n }, [readingDaysMap, week]);\n\n const weekDayNames = useGetWeekDayNames(week, streak, showDayName);\n const weekData = useMemo(() => {\n return {\n days: week.map((day, idx) => ({\n ...day,\n info: weekDayNames[idx],\n })),\n readingDaysMap,\n };\n }, [week, weekDayNames, readingDaysMap]);\n\n return {\n isLoading,\n error,\n weekData,\n streak,\n goal,\n activityDays,\n currentActivityDay,\n };\n};\n\nexport type StreakWithMetadata = ReturnType<typeof useGetStreakWithMetadata>;\n\nexport default useGetStreakWithMetadata;\n","export enum RangeItemDirection {\n From = 'from',\n To = 'to',\n}\n\nexport enum RangeItemPosition {\n Start = 'start',\n End = 'end',\n}\n\nexport enum RangeItem {\n StartingChapter = 'starting-chapter',\n StartingVerse = 'starting-verse',\n EndingChapter = 'ending-chapter',\n EndingVerse = 'ending-verse',\n}\n","import { Mushaf } from '../QuranReader';\n\nexport enum GoalCategory {\n QURAN = 'QURAN',\n}\n\nexport enum GoalType {\n TIME = 'QURAN_TIME',\n PAGES = 'QURAN_PAGES',\n RANGE = 'QURAN_RANGE',\n}\n\nexport type Goal = {\n id: string;\n type: GoalType;\n targetAmount: string;\n duration?: number;\n isCompleted: boolean;\n createdAt: Date;\n updatedAt: Date;\n};\n\nexport type CreateGoalRequest = {\n type: GoalType;\n amount: string | number;\n duration?: number;\n mushafId: Mushaf;\n category: GoalCategory;\n};\n\nexport type EstimateGoalRequest = Omit<CreateGoalRequest, 'category'>;\n\nexport type UpdateGoalRequest = Partial<CreateGoalRequest>;\n\nexport type QuranGoalStatus = Goal & {\n progress: {\n percent: number;\n\n // this will be either a number of pages (for PAGES and RANGE goals) or a number of seconds (for TIME goals)\n amountLeft: number;\n\n nextVerseToRead?: string;\n daysLeft?: number;\n };\n};\n\nexport interface EstimatedGoalDay {\n date: string;\n amount: number;\n}\n\nexport type RangeEstimatedQuranGoalDay = Omit<EstimatedGoalDay, 'amount'> & {\n amount: string;\n};\n\nexport type EstimatedQuranGoal =\n | {\n week: EstimatedGoalDay[];\n }\n | {\n week: RangeEstimatedQuranGoalDay[];\n };\n\nexport enum QuranGoalPeriod {\n Daily = 'DAILY',\n Continuous = 'CONTINUOUS',\n}\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"dayCircle\":\"DayCircle_dayCircle__phOYM\",\"filled\":\"DayCircle_filled__Tv8LZ\",\"stroked\":\"DayCircle_stroked__kfUm5\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"container\":\"ReadingStreak_container__y8IIg\",\"streakSubtitle\":\"ReadingStreak_streakSubtitle__MhTtV\",\"weekProgressLabel\":\"ReadingStreak_weekProgressLabel__DNR9I\",\"week\":\"ReadingStreak_week__quzpy\",\"fixedWidth\":\"ReadingStreak_fixedWidth__efUoo\",\"day\":\"ReadingStreak_day___jsGZ\",\"fullName\":\"ReadingStreak_fullName__C5OH6\",\"shortName\":\"ReadingStreak_shortName__i2oZO\",\"circleContainer\":\"ReadingStreak_circleContainer__HmNyD\",\"dayDivider\":\"ReadingStreak_dayDivider__i_Pwk\",\"goalContainer\":\"ReadingStreak_goalContainer__p_n3V\",\"actionsContainer\":\"ReadingStreak_actionsContainer__Ma0GW\",\"illustrationContainer\":\"ReadingStreak_illustrationContainer__N8Fy6\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"rowContainer\":\"VerseRangesList_rowContainer__TTjYL\"};"],"names":["_path","_extends","Object","assign","bind","n","e","arguments","length","t","r","hasOwnProperty","call","apply","props","width","height","viewBox","fill","xmlns","d","fillRule","clipRule","weekData","goal","fixedWidth","useTranslation","lang","days","readingDaysMap","div","p","className","styles","classNames","map","day","dayState","readingDay","dateString","hasRead","convertFractionToPercent","progress","DayState","current","getDayState","HoverablePopover","content","dateToReadableFormat","date","contentSide","ContentSide","span","info","title","localizedNumber","DayCircle","state","Filled","Checked","Stroked","CheckIcon","ranges","onVerseClick","allowClearingRanges","setRanges","chaptersData","useContext","DataContext","handleVerseClick","position","verseKey","all","forEach","range","parseVerseRange","chapter","verse","from","toLocalizedNumber","getChapterData","fromChapter","transliteratedName","Number","fromVerse","to","toChapter","toVerse","push","Link","href","getChapterWithStartingVerseUrl","rangeFrom","variant","LinkVariant","onClick","RangeItemDirection","rangeTo","Button","size","ButtonSize","ButtonVariant","toBeRemovedRange","logButtonClick","newRanges","filter","handleRangeDeleteClick","shape","ButtonShape","CloseIcon","ul","idx","ReadingGoalAmountContext","currentActivityDay","context","percent","type","prefix","action","goalType","GoalType","time","secondsToReadableFormat","amountLeft","pages","convertNumberToDecimal","VerseRangesList","remainingDailyTargetRanges","direction","verse_key","daysLeft","br","count","StreakType","QURAN","useGetWeekDays","useMemo","today","Date","sunday","getDay","setDate","getDate","i","dateToDateString","useGetWeekDayNames","week","streak","showWeekdayName","names","showIncrement","currentDayIndex","index","dayName","getFullDayName","showDayName","disableIfNoGoalExists","quranFont","useSelector","selectQuranFont","shallowEqual","mushafLines","selectQuranMushafLines","getMushafId","mushaf","useState","disabled","setDisabled","params","mushafId","useSWR","isLoggedIn","makeStreakUrl","getStreakWithUserMetadata","revalidateOnFocus","data","isValidating","error","useEffect","isLoading","activityDays","undefined","result","pagesRead","secondsRead","manuallyAddedSeconds","find","weekDayNames","RangeItemPosition","RangeItem","GoalCategory","QuranGoalPeriod","module","exports"],"sourceRoot":""}