@hebcal/leyning 9.2.7 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1,314 +1,17 @@
1
- /*! @hebcal/leyning v9.2.7 */
1
+ /*! @hebcal/leyning v9.4.0 */
2
2
  var hebcal__leyning = (function (exports, locale, event, holidays, sedra, ParshaEvent) {
3
3
  'use strict';
4
4
 
5
- var poHe$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he_IL" }, "contexts": { "": { "Shabbat Machar Chodesh": ["שַׁבָּת מָחָר חוֹדֶשׁ"], "Shabbat Rosh Chodesh": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ"], "Pesach I (on Shabbat)": ["פֶּסַח יוֹם א׳ (בְּשַׁבָּת)"], "Pesach Chol ha-Moed Day 1": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם א׳"], "Pesach Chol ha-Moed Day 2": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳"], "Pesach Chol ha-Moed Day 2 on Sunday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳ (בְּיוֹם רִאשׁוֹן)"], "Pesach Chol ha-Moed Day 3": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳"], "Pesach Chol ha-Moed Day 3 on Monday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳ (בְּיוֹם שָׁנִי)"], "Pesach Chol ha-Moed Day 4": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ד׳"], "Pesach Chol ha-Moed Day 5": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ה׳"], "Pesach Shabbat Chol ha-Moed": ["פֶּסַח שַׁבָּת חוֹל הַמּוֹעֵד"], "Pesach VII (on Shabbat)": ["פֶּסַח ז׳ (בְּשַׁבָּת)"], "Pesach VIII (on Shabbat)": ["פֶּסַח ח׳ (בְּשַׁבָּת)"], "Shavuot II (on Shabbat)": ["שָׁבוּעוֹת יוֹם ב׳ (בְּשַׁבָּת)"], "Rosh Hashana I (on Shabbat)": ["רֹאשׁ הַשָּׁנָה יוֹם א׳ (בְּשַׁבָּת)"], "Yom Kippur (on Shabbat)": ["יוֹם כִּפּוּר (בְּשַׁבָּת)"], "Yom Kippur (Mincha, Traditional)": ["יוֹם כִּפּוּר מִנחָה"], "Yom Kippur (Mincha, Alternate)": ["יוֹם כִּפּוּר מִנחָה"], "Sukkot I (on Shabbat)": ["סוּכּוֹת יוֹם א׳ (בְּשַׁבָּת)"], "Sukkot Chol ha-Moed Day 1": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם א׳"], "Sukkot Chol ha-Moed Day 2": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ב׳"], "Sukkot Chol ha-Moed Day 3": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ג׳"], "Sukkot Chol ha-Moed Day 4": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ד׳"], "Sukkot Chol ha-Moed Day 5": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ה׳"], "Sukkot Shabbat Chol ha-Moed": ["סוּכּוֹת שַׁבָּת חוֹל הַמּוֹעֵד"], "Sukkot Final Day (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Shmini Atzeret (on Shabbat)": ["שְׁמִינִי עֲצֶרֶת (בְּשַׁבָּת)"], "Chanukah Day 1": ["חֲנוּכָּה יוֹם א׳"], "Chanukah Day 2": ["חֲנוּכָּה יוֹם ב׳"], "Chanukah Day 3": ["חֲנוּכָּה יוֹם ג׳"], "Chanukah Day 4": ["חֲנוּכָּה יוֹם ד׳"], "Chanukah Day 5": ["חֲנוּכָּה יוֹם ה׳"], "Chanukah Day 6": ["חֲנוּכָּה יוֹם ו׳"], "Chanukah Day 7": ["חֲנוּכָּה יוֹם ז׳"], "Chanukah Day 7 (on Rosh Chodesh)": ["חֲנוּכָּה יוֹם ז׳ (רֹאשׁ חוֹדֶשׁ)"], "Chanukah Day 8": ["חֲנוּכָּה יוֹם ח׳"], "Chanukah Day 1 (on Shabbat)": ["חֲנוּכָּה יוֹם א׳ (בְּשַׁבָּת)"], "Chanukah Day 2 (on Shabbat)": ["חֲנוּכָּה יוֹם ב׳ (בְּשַׁבָּת)"], "Chanukah Day 3 (on Shabbat)": ["חֲנוּכָּה יוֹם ג׳ (בְּשַׁבָּת)"], "Chanukah Day 4 (on Shabbat)": ["חֲנוּכָּה יוֹם ד׳ (בְּשַׁבָּת)"], "Chanukah Day 5 (on Shabbat)": ["חֲנוּכָּה יוֹם ה׳ (בְּשַׁבָּת)"], "Chanukah Day 7 (on Shabbat)": ["חֲנוּכָּה יוֹם ז׳ (בְּשַׁבָּת)"], "Chanukah Day 8 (on Shabbat)": ["חֲנוּכָּה יוֹם ח׳ (בְּשַׁבָּת)"], "Shabbat Rosh Chodesh Chanukah": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ חֲנוּכָּה"], "Yom Kippur (Mincha)": ["יוֹם כִּפּוּר מִנחָה"], "Tish'a B'Av (Mincha)": ["תִּשְׁעָה בְּאָב מִנחָה"], "Asara B'Tevet (Mincha)": ["עֲשָׂרָה בְּטֵבֵת מִנחָה"], "Ta'anit Bechorot (Mincha)": ["תַּעֲנִית בְּכוֹרוֹת מִנחָה"], "Ta'anit Esther (Mincha)": ["תַּעֲנִית אֶסְתֵּר מִנחָה"], "Tzom Gedaliah (Mincha)": ["צוֹם גְּדַלְיָה מִנחָה"], "Tzom Tammuz (Mincha)": ["צוֹם י״ז בְּתַמּוּז מִנחָה"] } } };
5
+ var poHe$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he_IL" }, "contexts": { "": { "Shabbat Machar Chodesh": ["שַׁבָּת מָחָר חוֹדֶשׁ"], "Shabbat Rosh Chodesh": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ"], "Pesach I (on Shabbat)": ["פֶּסַח יוֹם א׳ (בְּשַׁבָּת)"], "Pesach Chol ha-Moed Day 1": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם א׳"], "Pesach Chol ha-Moed Day 2": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳"], "Pesach Chol ha-Moed Day 2 on Sunday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ב׳ (בְּיוֹם רִאשׁוֹן)"], "Pesach Chol ha-Moed Day 3": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳"], "Pesach Chol ha-Moed Day 3 on Monday": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ג׳ (בְּיוֹם שָׁנִי)"], "Pesach Chol ha-Moed Day 4": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ד׳"], "Pesach Chol ha-Moed Day 5": ["פֶּסַח חוֹל הַמּוֹעֵד יוֹם ה׳"], "Pesach VII (on Shabbat)": ["פֶּסַח ז׳ (בְּשַׁבָּת)"], "Pesach VIII (on Shabbat)": ["פֶּסַח ח׳ (בְּשַׁבָּת)"], "Shavuot II (on Shabbat)": ["שָׁבוּעוֹת יוֹם ב׳ (בְּשַׁבָּת)"], "Fast Day (Morning)": ["תַּעֲנִית (שַׁחֲרִית)"], "Fast Day (Afternoon)": ["תַּעֲנִית (מִנְחָה)"], "Rosh Hashana I (on Shabbat)": ["רֹאשׁ הַשָּׁנָה א׳ (בְּשַׁבָּת)"], "Yom Kippur (on Shabbat)": ["יוֹם כִּפּוּר (בְּשַׁבָּת)"], "Yom Kippur (Mincha, Traditional)": ["יוֹם כִּפּוּר מִנְחָה"], "Yom Kippur (Mincha, Alternate)": ["יוֹם כִּפּוּר מִנְחָה"], "Sukkot I (on Shabbat)": ["סוּכּוֹת יוֹם א׳ (בְּשַׁבָּת)"], "Sukkot Chol ha-Moed Day 1": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם א׳"], "Sukkot Chol ha-Moed Day 2": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ב׳"], "Sukkot Chol ha-Moed Day 3": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ג׳"], "Sukkot Chol ha-Moed Day 4": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ד׳"], "Sukkot Chol ha-Moed Day 5": ["סוּכּוֹת חוֹל הַמּוֹעֵד יוֹם ה׳"], "Sukkot Final Day (Hoshana Raba)": ["סוּכּוֹת ז׳ (הוֹשַׁעְנָא רַבָּה)"], "Shmini Atzeret (on Shabbat)": ["שְׁמִינִי עֲצֶרֶת (בְּשַׁבָּת)"], "Simchat Torah (on Shabbat)": ["שִׂמְחַת תּוֹרָה (בְּשַׁבָּת)"], "Chanukah Day 1": ["חֲנוּכָּה יוֹם א׳"], "Chanukah Day 2": ["חֲנוּכָּה יוֹם ב׳"], "Chanukah Day 3": ["חֲנוּכָּה יוֹם ג׳"], "Chanukah Day 4": ["חֲנוּכָּה יוֹם ד׳"], "Chanukah Day 5": ["חֲנוּכָּה יוֹם ה׳"], "Chanukah Day 6": ["חֲנוּכָּה יוֹם ו׳"], "Chanukah Day 7": ["חֲנוּכָּה יוֹם ז׳"], "Chanukah Day 7 (on Rosh Chodesh)": ["חֲנוּכָּה יוֹם ז׳ (רֹאשׁ חוֹדֶשׁ)"], "Chanukah Day 8": ["חֲנוּכָּה יוֹם ח׳"], "Chanukah Day 1 (on Shabbat)": ["חֲנוּכָּה יוֹם א׳ (בְּשַׁבָּת)"], "Chanukah Day 2 (on Shabbat)": ["חֲנוּכָּה יוֹם ב׳ (בְּשַׁבָּת)"], "Chanukah Day 3 (on Shabbat)": ["חֲנוּכָּה יוֹם ג׳ (בְּשַׁבָּת)"], "Chanukah Day 4 (on Shabbat)": ["חֲנוּכָּה יוֹם ד׳ (בְּשַׁבָּת)"], "Chanukah Day 5 (on Shabbat)": ["חֲנוּכָּה יוֹם ה׳ (בְּשַׁבָּת)"], "Chanukah Day 7 (on Shabbat)": ["חֲנוּכָּה יוֹם ז׳ (בְּשַׁבָּת)"], "Chanukah Day 8 (on Shabbat)": ["חֲנוּכָּה יוֹם ח׳ (בְּשַׁבָּת)"], "Shabbat Rosh Chodesh Chanukah": ["שַׁבָּת רֹאשׁ חוֹדֶשׁ חֲנוּכָּה"], "Shushan Purim (on Shabbat)": ["שׁוּשַׁן פּוּרִים (בְּשַׁבָּת)"], "Yom Kippur (Mincha)": ["יוֹם כִּפּוּר (מִנְחָה)"], "Tish'a B'Av (Mincha)": ["תִּשְׁעָה בְּאָב (מִנְחָה)"], "Asara B'Tevet (Mincha)": ["עֲשָׂרָה בְּטֵבֵת (מִנְחָה)"], "Ta'anit Bechorot (Mincha)": ["תַּעֲנִית בְּכוֹרוֹת (מִנְחָה)"], "Ta'anit Esther (Mincha)": ["תַּעֲנִית אֶסְתֵּר (מִנְחָה)"], "Tzom Gedaliah (Mincha)": ["צוֹם גְּדַלְיָה (מִנְחָה)"], "Tzom Tammuz (Mincha)": ["צוֹם י״ז בְּתַמּוּז (מִנְחָה)"], "Genesis": ["בְּרֵאשִׁית"], "Exodus": ["שְׁמוֹת"], "Leviticus": ["וַיִּקְרָא"], "Numbers": ["בְּמִדְבַּר"], "Deuteronomy": ["דְּבָרִים"], "Joshua": ["יְהוֹשֻׁעַ"], "Judges": ["שׁוֹפְטִים"], "I Samuel": ["שְׁמוּאֵל א"], "II Samuel": ["שְׁמוּאֵל ב"], "I Kings": ["מְלָכִים א"], "II Kings": ["מְלָכִים ב"], "Isaiah": ["יְשַׁעְיָהוּ"], "Jeremiah": ["יִרְמְיָהוּ"], "Ezekiel": ["יְחֶזְקֵאל"], "Hosea": ["הוֹשֵׁעַ"], "Joel": ["יוֹאֵל"], "Amos": ["עָמוֹס"], "Obadiah": ["עוֹבַדְיָה"], "Jonah": ["יוֹנָה"], "Micah": ["מִיכָה"], "Nachum": ["נַחוּם"], "Habakkuk": ["חֲבַקּוּק"], "Zephaniah": ["צְפַנְיָה"], "Haggai": ["חַגַּי"], "Zechariah": ["זְכַרְיָה"], "Malachi": ["מַלְאָכִי"], "Song of Songs": ["שִׁיר הַשִּׁירִים"], "Ruth": ["רוּת"], "Lamentations": ["אֵיכָה"], "Ecclesiastes": ["קֹהֶלֶת"], "Esther": ["אֶסְתֵּר"], "Pinchas occurring after 17 Tammuz": ["פִּינְחָס מתרחש לאחר יז׳ בְּתַמּוּז"], "Kedoshim following Special Shabbat": ["קְדֹשִׁים לאחר שַׁבָּת מיוחדת"], "Masei on Shabbat Rosh Chodesh": ["מַסְעֵי בְּשַׁבָּת רֹאשׁ חוֹדֶשׁ"], "Matot-Masei on Shabbat Rosh Chodesh": ["מַטּוֹת־מַסְעֵי בְּשַׁבָּת רֹאשׁ חוֹדֶשׁ"], "Ki Teitzei with 3rd Haftarah of Consolation": ["כִּי־תֵצֵא עם הַפְטָרָה שְׁלִישִׁית שֶׁל נֶחָמָה"], "Shabbat HaChodesh (on Rosh Chodesh)": ["שַׁבָּת הַחוֹדֶשׁ (בְּרֹאשׁ חוֹדֶשׁ)"], "Shabbat Shekalim (on Rosh Chodesh)": ["שַׁבָּת שְׁקָלִים (רֹאשׁ חוֹדֶשׁ)"], "Shabbat Shuva (with Vayeilech)": ["שַׁבַּת שׁוּבָה (עם וַיֵּלֶךְ)"], "Shabbat Shuva (with Ha'azinu)": ["שַׁבַּת שׁוּבָה (עם הַאֲזִינוּ)"] } } };
6
6
 
7
7
  var poAshkenazi$1 = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "en_CA@ashkenazi" }, "contexts": { "": { "Shabbat Machar Chodesh": ["Shabbos Machar Chodesh"], "Shabbat Rosh Chodesh": ["Shabbos Rosh Chodesh"], "Pesach I (on Shabbat)": ["Pesach I (on Shabbos)"], "Pesach Shabbat Chol ha-Moed": ["Pesach Shabbos Chol ha-Moed"], "Pesach VII (on Shabbat)": ["Pesach VII (on Shabbos)"], "Pesach VIII (on Shabbat)": ["Pesach VIII (on Shabbos)"], "Shavuot II (on Shabbat)": ["Shavuos II (on Shabbos)"], "Rosh Hashana I (on Shabbat)": ["Rosh Hashana I (on Shabbos)"], "Yom Kippur (on Shabbat)": ["Yom Kippur (on Shabbos)"], "Sukkot I (on Shabbat)": ["Sukkos I (on Shabbos)"], "Sukkot Chol ha-Moed Day 1": ["Sukkos Chol ha-Moed Day 1"], "Sukkot Chol ha-Moed Day 2": ["Sukkos Chol ha-Moed Day 2"], "Sukkot Chol ha-Moed Day 3": ["Sukkos Chol ha-Moed Day 3"], "Sukkot Chol ha-Moed Day 4": ["Sukkos Chol ha-Moed Day 4"], "Sukkot Chol ha-Moed Day 5": ["Sukkos Chol ha-Moed Day 5"], "Sukkot Shabbat Chol ha-Moed": ["Sukkos Shabbos Chol ha-Moed"], "Sukkot Final Day (Hoshana Raba)": ["Sukkos Final Day (Hoshana Raba)"], "Shmini Atzeret (on Shabbat)": ["Shmini Atzeres (on Shabbos)"], "Chanukah Day 1 (on Shabbat)": ["Chanukah Day 1 (on Shabbos)"], "Chanukah Day 2 (on Shabbat)": ["Chanukah Day 2 (on Shabbos)"], "Chanukah Day 3 (on Shabbat)": ["Chanukah Day 3 (on Shabbos)"], "Chanukah Day 4 (on Shabbat)": ["Chanukah Day 4 (on Shabbos)"], "Chanukah Day 5 (on Shabbat)": ["Chanukah Day 5 (on Shabbos)"], "Chanukah Day 7 (on Shabbat)": ["Chanukah Day 7 (on Shabbos)"], "Chanukah Day 8 (on Shabbat)": ["Chanukah Day 8 (on Shabbos)"], "Shabbat Rosh Chodesh Chanukah": ["Shabbos Rosh Chodesh Chanukah"], "Asara B'Tevet (Mincha)": ["Asara B’Teves (Mincha)"], "Ta'anit Bechorot (Mincha)": ["Ta’anis Bechorot (Mincha)"], "Ta'anit Esther (Mincha)": ["Ta’anis Esther (Mincha)"] } } };
8
8
 
9
9
  locale.Locale.addTranslations('ashkenazi', poAshkenazi$1);
10
10
  locale.Locale.addTranslations('he', poHe$1);
11
- locale.Locale.addTranslations('h', poHe$1);
12
- const heStrs = poHe$1.contexts[''];
13
- const heNoNikud = {};
14
- for (const [key, val] of Object.entries(heStrs)) {
15
- heNoNikud[key] = [locale.Locale.hebrewStripNikkud(val[0])];
16
- }
17
- const poHeNoNikud$1 = {
18
- headers: poHe$1.headers,
19
- contexts: { '': heNoNikud },
20
- };
11
+ const poHeNoNikud$1 = locale.Locale.copyLocaleNoNikud(poHe$1);
21
12
  locale.Locale.addTranslations('he-x-NoNikud', poHeNoNikud$1);
22
13
 
23
- const Genesis=[0,31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,54,33,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26];const Exodus=[0,22,25,22,31,23,30,29,28,35,29,10,51,22,31,27,36,16,27,25,23,37,30,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38];const Leviticus=[0,17,16,17,35,26,23,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34];const Numbers=[0,54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,35,28,32,22,29,35,41,30,25,19,65,23,31,39,17,54,42,56,29,34,13];const Deuteronomy=[0,46,37,29,49,30,25,26,20,29,22,32,31,19,29,23,22,20,22,21,20,23,29,26,22,19,19,26,69,28,20,30,52,29,12];const Joshua=[0,18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33];const Judges=[0,36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25];const Ruth=[0,22,23,18,22];const Isaiah=[0,31,22,26,6,30,13,25,23,20,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,11,25,24];const Jeremiah=[0,19,37,25,31,31,30,34,23,25,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34];const Lamentations=[0,22,22,66,22,22];const Esther=[0,22,23,15,17,14,14,10,17,32,3];const Ecclesiastes=[0,18,26,22,17,19,12,29,17,18,20,10,14];const Ezekiel=[0,28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,44,37,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35];const Daniel=[0,21,49,100,34,30,29,28,27,27,21,45,13,64,42];const Hosea=[0,9,25,5,19,15,11,16,14,17,15,11,15,15,10];const Joel=[0,20,27,5,21];const Amos=[0,15,16,15,13,27,14,17,14,15];const Obadiah=[0,21];const Jonah=[0,16,11,10,11];const Micah=[0,16,13,12,14,14,16,20];const Nachum=[0,14,14,19];const Habakkuk=[0,17,20,19];const Zephaniah=[0,18,15,20];const Haggai=[0,15,23];const Zechariah=[0,17,17,10,14,11,15,14,23,17,12,17,14,9,21];const Malachi=[0,14,17,24];var numverses = {Genesis:Genesis,Exodus:Exodus,Leviticus:Leviticus,Numbers:Numbers,Deuteronomy:Deuteronomy,Joshua:Joshua,Judges:Judges,Ruth:Ruth,"I Samuel":[0,28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,16,23,28,23,43,25,12,25,11,31,13],"II Samuel":[0,27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,32,44,26,22,51,39,25],"I Kings":[0,53,46,28,20,32,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"II Kings":[0,18,25,27,44,27,33,20,29,37,36,20,22,25,29,38,20,41,37,37,21,26,20,37,20,30],Isaiah:Isaiah,Jeremiah:Jeremiah,Lamentations:Lamentations,Esther:Esther,Ecclesiastes:Ecclesiastes,"Song of Songs":[0,17,17,11,16,16,12,14,14],Ezekiel:Ezekiel,Daniel:Daniel,Hosea:Hosea,Joel:Joel,Amos:Amos,Obadiah:Obadiah,Jonah:Jonah,Micah:Micah,Nachum:Nachum,Habakkuk:Habakkuk,Zephaniah:Zephaniah,Haggai:Haggai,Zechariah:Zechariah,Malachi:Malachi};
24
-
25
- /**
26
- * Names of the books of the Torah.
27
- *
28
- * `BOOK[1] === 'Genesis'`
29
- * @readonly
30
- */
31
- const BOOK = [
32
- '',
33
- 'Genesis',
34
- 'Exodus',
35
- 'Leviticus',
36
- 'Numbers',
37
- 'Deuteronomy',
38
- ];
39
- /**
40
- * The number of verses in each book of the Tanakh.
41
- * Indexed by English transliterated name of book,
42
- * and arrays are 1-based.
43
- *
44
- * There are 51 chapters in Genesis, so
45
- * `NUM_VERSES['Genesis'].length === 51`.
46
- *
47
- * There are 26 verses in Genesis chapter 4,
48
- * so `NUM_VERSES['Genesis'][4] === 26`.
49
- * @readonly
50
- */
51
- const NUM_VERSES = numverses;
52
- /**
53
- * Formats parsha as a string
54
- * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
55
- */
56
- function parshaToString(parsha) {
57
- if (typeof parsha === 'string') {
58
- return parsha;
59
- }
60
- else if (!Array.isArray(parsha) ||
61
- parsha.length === 0 ||
62
- parsha.length > 2) {
63
- throw new TypeError(`Bad parsha argument: ${parsha}`);
64
- }
65
- let s = parsha[0];
66
- if (parsha.length === 2) {
67
- s += '-' + parsha[1];
68
- }
69
- return s;
70
- }
71
- /**
72
- * Calculates the number of verses in an aliyah or haftara based on
73
- * the `b` (begin verse), `e` (end verse) and `k` (book).
74
- * Modifies `aliyah` by setting the `v` field.
75
- */
76
- function calculateNumVerses(aliyah) {
77
- if (aliyah.v) {
78
- return aliyah.v;
79
- }
80
- aliyah.v = subtractVerses(aliyah.k, aliyah.b, aliyah.e) + 1;
81
- return aliyah.v;
82
- }
83
- /**
84
- * Finds the number of verses between two locations in the same book.
85
- * @param book The English name of the book (e.g. "Numbers")
86
- * @param from The starting verse (e.g. "28:9")
87
- * @param to The ending verse (e.g. "28:15")
88
- * @returns The number of verses between the two locations, excluding the `to` verse.
89
- */
90
- function subtractVerses(book, from, to) {
91
- const chapVerseBegin = from.split(':');
92
- const chapVerseEnd = to.split(':');
93
- const c1 = parseInt(chapVerseBegin[0], 10);
94
- const c2 = parseInt(chapVerseEnd[0], 10);
95
- const v1 = parseInt(chapVerseBegin[1], 10);
96
- const v2 = parseInt(chapVerseEnd[1], 10);
97
- let result = 0;
98
- if (c1 === c2) {
99
- return v2 - v1;
100
- }
101
- const numv = NUM_VERSES[book];
102
- if (typeof numv !== 'object' || !numv.length) {
103
- throw new ReferenceError(`Can't find numverses for ${book}`);
104
- }
105
- let total = numv[c1] - v1;
106
- for (let chap = c1 + 1; chap < c2; chap++) {
107
- total += numv[chap];
108
- }
109
- total += v2;
110
- result = total;
111
- return result;
112
- }
113
- /**
114
- * Calculates the next verse after adding a number of verses to a given location.
115
- * @param book The English name of the book (e.g. "Numbers")
116
- * @param from The starting verse (e.g. "28:9")
117
- * @param numVerses The number of verses to add; must be nonnegative.
118
- * @returns The next verse after adding the specified number of verses,
119
- * or null if the resulting verse exceeds the number of verses
120
- * in the book.
121
- */
122
- function addVerses(book, from, numVerses) {
123
- const chapVerseBegin = from.split(':');
124
- const c1 = parseInt(chapVerseBegin[0], 10);
125
- const v1 = parseInt(chapVerseBegin[1], 10);
126
- const numv = NUM_VERSES[book];
127
- if (typeof numv !== 'object' || !numv.length) {
128
- throw new ReferenceError(`Can't find numverses for ${book}`);
129
- }
130
- let total = v1 + numVerses;
131
- let c2 = c1;
132
- while (total > numv[c2]) {
133
- total -= numv[c2];
134
- c2++;
135
- if (!numv[c2])
136
- return null;
137
- }
138
- return `${c2}:${total}`;
139
- }
140
- /**
141
- * Formats an aliyah object like "Numbers 28:9-28:15"
142
- */
143
- function formatAliyahWithBook(a) {
144
- return `${a.k} ${a.b}-${a.e}`;
145
- }
146
- /**
147
- * Formats an aliyah object like "Numbers 28:9-15"
148
- */
149
- function formatAliyahShort(aliyah, showBook) {
150
- const begin = aliyah.b;
151
- const end0 = aliyah.e;
152
- const prefix = showBook ? aliyah.k + ' ' : '';
153
- if (begin === end0) {
154
- return `${prefix}${begin}`;
155
- }
156
- const cv1 = begin.split(':');
157
- const cv2 = end0.split(':');
158
- const end = cv1[0] === cv2[0] ? cv2[1] : end0;
159
- return `${prefix}${begin}-${end}`;
160
- }
161
-
162
- /**
163
- * @private
164
- */
165
- function isChapVerseBefore(a, b) {
166
- const cv1 = a.split(':').map(x => +x);
167
- const cv2 = b.split(':').map(x => +x);
168
- return cv1[0] * 100 + cv1[1] < cv2[0] * 100 + cv2[1];
169
- }
170
- /**
171
- * Summarizes an `AliyotMap` by collapsing all adjacent aliyot.
172
- * Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
173
- */
174
- function makeLeyningParts(aliyot) {
175
- const nums = Object.keys(aliyot).filter(x => {
176
- if (x.length === 1) {
177
- return true;
178
- }
179
- const code = x.charCodeAt(0);
180
- return code >= 48 && code <= 57;
181
- });
182
- let start = aliyot[nums[0]];
183
- let end = start;
184
- const parts = [];
185
- for (let i = 0; i < nums.length; i++) {
186
- const num = nums[i];
187
- const aliyah = aliyot[num];
188
- if (i === nums.length - 1 && aliyah.k === end.k && aliyah.e === end.e) {
189
- // short-circuit when final aliyah is within the previous (e.g. M inside of 7)
190
- continue;
191
- }
192
- const prevEndChap = +end.e.split(':')[0];
193
- const curStartChap = +aliyah.b.split(':')[0];
194
- const sameOrNextChap = curStartChap === prevEndChap || curStartChap === prevEndChap + 1;
195
- if (i !== 0 &&
196
- (aliyah.k !== start.k ||
197
- isChapVerseBefore(aliyah.b, start.e) ||
198
- !sameOrNextChap)) {
199
- parts.push({ k: start.k, b: start.b, e: end.e });
200
- start = aliyah;
201
- }
202
- end = aliyah;
203
- }
204
- parts.push({ k: start.k, b: start.b, e: end.e });
205
- return parts;
206
- }
207
- /**
208
- * Returns a string representation of the leyning parts.
209
- * Separate verse ranges read from the same book are separated
210
- * by commas, e.g. `Isaiah 6:1-7:6, 9:5-6`.
211
- * Verse ranges from different books are separated by semicolons,
212
- * e.g. `Genesis 21:1-34; Numbers 29:1-6`.
213
- */
214
- function makeSummaryFromParts(parts) {
215
- if (!Array.isArray(parts)) {
216
- parts = [parts];
217
- }
218
- let prev = parts[0];
219
- let summary = formatAliyahShort(prev, true);
220
- for (let i = 1; i < parts.length; i++) {
221
- const part = parts[i];
222
- if (part.k === prev.k) {
223
- summary += ', ';
224
- }
225
- else {
226
- summary += `; ${part.k} `;
227
- }
228
- summary += formatAliyahShort(part, false);
229
- prev = part;
230
- }
231
- return summary;
232
- }
233
- /**
234
- * Makes a summary of the leyning, like "Genesis 6:9-11:32"
235
- */
236
- function makeLeyningSummary(aliyot) {
237
- const parts = makeLeyningParts(aliyot);
238
- return makeSummaryFromParts(parts);
239
- }
240
-
241
- /**
242
- * Makes a deep copy of the src object using JSON stringify and parse
243
- */
244
- function clone(src) {
245
- return JSON.parse(JSON.stringify(src));
246
- }
247
- function cloneHaftara(haft) {
248
- if (!haft) {
249
- return haft;
250
- }
251
- const dest = clone(haft);
252
- if (Array.isArray(dest)) {
253
- dest.forEach(calculateNumVerses);
254
- }
255
- else {
256
- calculateNumVerses(dest);
257
- }
258
- return dest;
259
- }
260
- /**
261
- * Returns the total number of verses in an array of Aliyah (or haftarah) objects
262
- */
263
- function sumVerses(aliyot) {
264
- return Array.isArray(aliyot)
265
- ? aliyot.reduce((prev, cur) => prev + cur.v, 0)
266
- : aliyot.v;
267
- }
268
-
269
- const Shavuot={note:"Israel only",il:true,megillah:"Ruth",haft:[{k:"Ezekiel",b:"1:1",e:"1:28"},{k:"Ezekiel",b:"3:12",e:"3:12"}],fullkriyah:{"1":{p:17,k:2,b:"19:1",e:"19:6"},"2":{p:17,k:2,b:"19:7",e:"19:13"},"3":{p:17,k:2,b:"19:14",e:"19:19"},"4":{p:17,k:2,b:"19:20",e:"20:14"},"5":{p:17,k:2,b:"20:15",e:"20:23"},M:{p:41,k:4,b:"28:26",e:"28:31"}}};const Purim={megillah:"Esther",fullkriyah:{"1":{p:16,k:2,b:"17:8",e:"17:10"},"2":{p:16,k:2,b:"17:11",e:"17:13"},"3":{p:16,k:2,b:"17:14",e:"17:16"}}};var festivals0 = {"Pesach I":{haft:[{k:"Joshua",b:"3:5",e:"3:7"},{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],seph:[{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],fullkriyah:{"1":{p:15,k:2,b:"12:21",e:"12:24"},"2":{p:15,k:2,b:"12:25",e:"12:28"},"3":{p:15,k:2,b:"12:29",e:"12:36"},"4":{p:15,k:2,b:"12:37",e:"12:42"},"5":{p:15,k:2,b:"12:43",e:"12:51"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach I (on Shabbat)":{haft:[{k:"Joshua",b:"3:5",e:"3:7"},{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],seph:[{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],fullkriyah:{"1":{p:15,k:2,b:"12:21",e:"12:24"},"2":{p:15,k:2,b:"12:25",e:"12:28"},"3":{p:15,k:2,b:"12:29",e:"12:32"},"4":{p:15,k:2,b:"12:33",e:"12:36"},"5":{p:15,k:2,b:"12:37",e:"12:42"},"6":{p:15,k:2,b:"12:43",e:"12:47"},"7":{p:15,k:2,b:"12:48",e:"12:51"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach II":{haft:[{k:"II Kings",b:"23:1",e:"23:9"},{k:"II Kings",b:"23:21",e:"23:25"}],fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach II (CH''M)":{note:"Israel only - according to Vaani T'fillati Siddur Yisraeli",il:true,fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:8"},"2":{p:31,k:3,b:"23:9",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:44"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 1":{fullkriyah:{"1":{p:15,k:2,b:"13:1",e:"13:4"},"2":{p:15,k:2,b:"13:5",e:"13:10"},"3":{p:15,k:2,b:"13:11",e:"13:16"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 2":{fullkriyah:{"1":{p:18,k:2,b:"22:24",e:"22:26"},"2":{p:18,k:2,b:"22:27",e:"23:5"},"3":{p:18,k:2,b:"23:6",e:"23:19"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 3":{fullkriyah:{"1":{p:21,k:2,b:"34:1",e:"34:10"},"2":{p:21,k:2,b:"34:11",e:"34:17"},"3":{p:21,k:2,b:"34:18",e:"34:26"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 4":{fullkriyah:{"1":{p:36,k:4,b:"9:1",e:"9:5"},"2":{p:36,k:4,b:"9:6",e:"9:8"},"3":{p:36,k:4,b:"9:9",e:"9:14"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Shabbat Chol ha-Moed":{megillah:"Song of Songs",haft:{k:"Ezekiel",b:"37:1",e:"37:14"},fullkriyah:{"1":{p:21,k:2,b:"33:12",e:"33:16"},"2":{p:21,k:2,b:"33:17",e:"33:19"},"3":{p:21,k:2,b:"33:20",e:"33:23"},"4":{p:21,k:2,b:"34:1",e:"34:3"},"5":{p:21,k:2,b:"34:4",e:"34:10"},"6":{p:21,k:2,b:"34:11",e:"34:17"},"7":{p:21,k:2,b:"34:18",e:"34:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VII":{haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":{p:16,k:2,b:"13:17",e:"13:22"},"2":{p:16,k:2,b:"14:1",e:"14:8"},"3":{p:16,k:2,b:"14:9",e:"14:14"},"4":{p:16,k:2,b:"14:15",e:"14:25"},"5":{p:16,k:2,b:"14:26",e:"15:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VII (on Shabbat)":{megillah:"Song of Songs",haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":{p:16,k:2,b:"13:17",e:"13:19"},"2":{p:16,k:2,b:"13:20",e:"13:22"},"3":{p:16,k:2,b:"14:1",e:"14:4"},"4":{p:16,k:2,b:"14:5",e:"14:8"},"5":{p:16,k:2,b:"14:9",e:"14:14"},"6":{p:16,k:2,b:"14:15",e:"14:25"},"7":{p:16,k:2,b:"14:26",e:"15:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VIII":{haft:{k:"Isaiah",b:"10:32",e:"12:6"},fullkriyah:{"1":{p:47,k:5,b:"15:19",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VIII (on Shabbat)":{megillah:"Song of Songs",haft:{k:"Isaiah",b:"10:32",e:"12:6"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach III (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 1"},"Pesach IV (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 2"},"Pesach V (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 3"},"Pesach VI (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 4"},"Pesach Chol ha-Moed Day 2 on Sunday":{alias:true,il:false,key:"Pesach Chol ha-Moed Day 1"},"Pesach Chol ha-Moed Day 3 on Monday":{alias:true,il:false,key:"Pesach Chol ha-Moed Day 2"},Shavuot:Shavuot,"Shavuot I":{haft:[{k:"Ezekiel",b:"1:1",e:"1:28"},{k:"Ezekiel",b:"3:12",e:"3:12"}],fullkriyah:{"1":{p:17,k:2,b:"19:1",e:"19:6"},"2":{p:17,k:2,b:"19:7",e:"19:13"},"3":{p:17,k:2,b:"19:14",e:"19:19"},"4":{p:17,k:2,b:"19:20",e:"20:14"},"5":{p:17,k:2,b:"20:15",e:"20:23"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Shavuot II":{megillah:"Ruth",haft:{k:"Habakkuk",b:"3:1",e:"3:19"},seph:{k:"Habakkuk",b:"2:20",e:"3:19"},fullkriyah:{"1":{p:47,k:5,b:"15:19",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Shavuot II (on Shabbat)":{megillah:"Ruth",haft:{k:"Habakkuk",b:"3:1",e:"3:19"},seph:{k:"Habakkuk",b:"2:20",e:"3:19"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Fast Day (Morning)":{fullkriyah:{"1":{p:21,k:2,b:"32:11",e:"32:14"},"2":{p:21,k:2,b:"34:1",e:"34:3"},"3":{p:21,k:2,b:"34:4",e:"34:10"}}},"Fast Day (Afternoon)":{haft:{k:"Isaiah",b:"55:6",e:"56:8"},fullkriyah:{"1":{p:21,k:2,b:"32:11",e:"32:14"},"2":{p:21,k:2,b:"34:1",e:"34:3"},M:{p:21,k:2,b:"34:4",e:"34:10"}}},"Asara B'Tevet":{alias:true,key:"Fast Day (Morning)"},"Ta'anit Esther":{alias:true,key:"Fast Day (Morning)"},"Tzom Gedaliah":{alias:true,key:"Fast Day (Morning)"},"Tzom Tammuz":{alias:true,key:"Fast Day (Morning)"},"Asara B'Tevet (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Ta'anit Esther (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Tzom Gedaliah (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Tzom Tammuz (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Erev Tish'a B'Av":{megillah:"Lamentations"},"Tish'a B'Av":{haft:{k:"Jeremiah",b:"8:13",e:"9:23"},fullkriyah:{"1":{p:45,k:5,b:"4:25",e:"4:29"},"2":{p:45,k:5,b:"4:30",e:"4:35"},"3":{p:45,k:5,b:"4:36",e:"4:40"}},megillah:"Lamentations"},"Tish'a B'Av (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Rosh Hashana I":{haft:{k:"I Samuel",b:"1:1",e:"2:10"},fullkriyah:{"1":{p:4,k:1,b:"21:1",e:"21:4"},"2":{p:4,k:1,b:"21:5",e:"21:12"},"3":{p:4,k:1,b:"21:13",e:"21:21"},"4":{p:4,k:1,b:"21:22",e:"21:27"},"5":{p:4,k:1,b:"21:28",e:"21:34"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Rosh Hashana I (on Shabbat)":{haft:{k:"I Samuel",b:"1:1",e:"2:10"},fullkriyah:{"1":{p:4,k:1,b:"21:1",e:"21:4"},"2":{p:4,k:1,b:"21:5",e:"21:8"},"3":{p:4,k:1,b:"21:9",e:"21:12"},"4":{p:4,k:1,b:"21:13",e:"21:17"},"5":{p:4,k:1,b:"21:18",e:"21:21"},"6":{p:4,k:1,b:"21:22",e:"21:27"},"7":{p:4,k:1,b:"21:28",e:"21:34"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Rosh Hashana II":{haft:{k:"Jeremiah",b:"31:2",e:"31:20",note:"labeled 31:1–19 in some books"},fullkriyah:{"1":{p:4,k:1,b:"22:1",e:"22:3"},"2":{p:4,k:1,b:"22:4",e:"22:8"},"3":{p:4,k:1,b:"22:9",e:"22:14"},"4":{p:4,k:1,b:"22:15",e:"22:19"},"5":{p:4,k:1,b:"22:20",e:"22:24"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Yom Kippur":{haft:{k:"Isaiah",b:"57:14",e:"58:14"},fullkriyah:{"1":{p:29,k:3,b:"16:1",e:"16:6"},"2":{p:29,k:3,b:"16:7",e:"16:11"},"3":{p:29,k:3,b:"16:12",e:"16:17"},"4":{p:29,k:3,b:"16:18",e:"16:24"},"5":{p:29,k:3,b:"16:25",e:"16:30"},"6":{p:29,k:3,b:"16:31",e:"16:34"},M:{p:41,k:4,b:"29:7",e:"29:11"}}},"Yom Kippur (on Shabbat)":{haft:{k:"Isaiah",b:"57:14",e:"58:14"},fullkriyah:{"1":{p:29,k:3,b:"16:1",e:"16:3"},"2":{p:29,k:3,b:"16:4",e:"16:6"},"3":{p:29,k:3,b:"16:7",e:"16:11"},"4":{p:29,k:3,b:"16:12",e:"16:17"},"5":{p:29,k:3,b:"16:18",e:"16:24"},"6":{p:29,k:3,b:"16:25",e:"16:30"},"7":{p:29,k:3,b:"16:31",e:"16:34"},M:{p:41,k:4,b:"29:7",e:"29:11"}}},"Yom Kippur (Mincha)":{alias:true,key:"Yom Kippur (Mincha, Traditional)"},"Yom Kippur (Mincha, Traditional)":{haft:[{k:"Jonah",b:"1:1",e:"4:11"},{k:"Micah",b:"7:18",e:"7:20"}],fullkriyah:{"1":{p:29,k:3,b:"18:1",e:"18:5"},"2":{p:29,k:3,b:"18:6",e:"18:21"},M:{p:29,k:3,b:"18:22",e:"18:30"}}},"Yom Kippur (Mincha, Alternate)":{haft:[{k:"Jonah",b:"1:1",e:"4:11"},{k:"Micah",b:"7:18",e:"7:20"}],fullkriyah:{"1":{p:30,k:3,b:"19:1",e:"19:4"},"2":{p:30,k:3,b:"19:5",e:"19:10"},M:{p:30,k:3,b:"19:11",e:"19:18"}}},"Sukkot I":{haft:{k:"Zechariah",b:"14:1",e:"14:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot I (on Shabbat)":{haft:{k:"Zechariah",b:"14:1",e:"14:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"22:33"},"2":{p:31,k:3,b:"23:1",e:"23:3"},"3":{p:31,k:3,b:"23:4",e:"23:8"},"4":{p:31,k:3,b:"23:9",e:"23:14"},"5":{p:31,k:3,b:"23:15",e:"23:22"},"6":{p:31,k:3,b:"23:23",e:"23:32"},"7":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot II":{haft:{k:"I Kings",b:"8:2",e:"8:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot Chol ha-Moed Day 1":{fullkriyah:{"1":{p:41,k:4,b:"29:17",e:"29:19"},"2":{p:41,k:4,b:"29:20",e:"29:22"},"3":{p:41,k:4,b:"29:23",e:"29:25"},"4":{p:41,k:4,b:"29:17",e:"29:22"}}},"Sukkot Chol ha-Moed Day 2":{fullkriyah:{"1":{p:41,k:4,b:"29:20",e:"29:22"},"2":{p:41,k:4,b:"29:23",e:"29:25"},"3":{p:41,k:4,b:"29:26",e:"29:28"},"4":{p:41,k:4,b:"29:20",e:"29:25"}}},"Sukkot Chol ha-Moed Day 3":{fullkriyah:{"1":{p:41,k:4,b:"29:23",e:"29:25"},"2":{p:41,k:4,b:"29:26",e:"29:28"},"3":{p:41,k:4,b:"29:29",e:"29:31"},"4":{p:41,k:4,b:"29:23",e:"29:28"}}},"Sukkot Chol ha-Moed Day 4":{fullkriyah:{"1":{p:41,k:4,b:"29:26",e:"29:28"},"2":{p:41,k:4,b:"29:29",e:"29:31"},"3":{p:41,k:4,b:"29:32",e:"29:34"},"4":{p:41,k:4,b:"29:26",e:"29:31"}}},"Sukkot Chol ha-Moed Day 5":{fullkriyah:{"1":{p:41,k:4,b:"29:29",e:"29:31"},"2":{p:41,k:4,b:"29:32",e:"29:34"},"3":{p:41,k:4,b:"29:35",e:"29:37"},"4":{p:41,k:4,b:"29:29",e:"29:34"}}},"Sukkot Shabbat Chol ha-Moed":{megillah:"Ecclesiastes",haft:{k:"Ezekiel",b:"38:18",e:"39:16"},fullkriyah:{"1":{p:21,k:2,b:"33:12",e:"33:16"},"2":{p:21,k:2,b:"33:17",e:"33:19"},"3":{p:21,k:2,b:"33:20",e:"33:23"},"4":{p:21,k:2,b:"34:1",e:"34:3"},"5":{p:21,k:2,b:"34:4",e:"34:10"},"6":{p:21,k:2,b:"34:11",e:"34:17"},"7":{p:21,k:2,b:"34:18",e:"34:26"},"M-day1":{p:41,k:4,b:"29:17",e:"29:22"},"M-day2":{p:41,k:4,b:"29:20",e:"29:25"},"M-day3":{p:41,k:4,b:"29:23",e:"29:28"},"M-day4":{p:41,k:4,b:"29:26",e:"29:31"},"M-day5":{p:41,k:4,b:"29:29",e:"29:34"}}},"Sukkot Final Day (Hoshana Raba)":{fullkriyah:{"1":{p:41,k:4,b:"29:26",e:"29:28"},"2":{p:41,k:4,b:"29:29",e:"29:31"},"3":{p:41,k:4,b:"29:32",e:"29:34"},"4":{p:41,k:4,b:"29:29",e:"29:34"}}},"Shmini Atzeret":{haft:{k:"I Kings",b:"8:54",e:"8:66"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"16:3"},"4":{p:47,k:5,b:"16:4",e:"16:8"},"5":{p:47,k:5,b:"16:9",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}},alt:{"1":{p:47,k:5,b:"14:22",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Shmini Atzeret (on Shabbat)":{megillah:"Ecclesiastes",haft:{k:"I Kings",b:"8:54",e:"8:66"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Erev Simchat Torah":{fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"}}},"Simchat Torah":{haft:{k:"Joshua",b:"1:1",e:"1:18"},fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"},"4":{p:54,k:5,b:"33:18",e:"33:21"},"5":{p:54,k:5,b:"33:22",e:"33:26"},"6":{p:54,k:5,b:"33:27",e:"34:12"},"7":{p:1,k:1,b:"1:1",e:"2:3"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Simchat Torah (on Shabbat)":{megillah:"Ecclesiastes",haft:{k:"Joshua",b:"1:1",e:"1:18"},fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"},"4":{p:54,k:5,b:"33:18",e:"33:21"},"5":{p:54,k:5,b:"33:22",e:"33:26"},"6":{p:54,k:5,b:"33:27",e:"33:29"},"7":{p:54,k:5,b:"34:1",e:"34:12"},"8":{p:1,k:1,b:"1:1",e:"2:3"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Shabbat Rosh Chodesh Chanukah":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:35,k:4,b:"7:42",e:"7:47"}}},"Chanukah Day 1":{fullkriyah:{"1":{p:35,k:4,b:"7:1",e:"7:11"},"2":{p:35,k:4,b:"7:12",e:"7:14"},"3":{p:35,k:4,b:"7:15",e:"7:17"}},alt:{"1":{p:35,k:4,b:"7:1",e:"7:3"},"2":{p:35,k:4,b:"7:4",e:"7:11"},"3":{p:35,k:4,b:"7:12",e:"7:17"}}},"Chanukah Day 1 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:1",e:"7:17"}}},"Chanukah Day 2":{fullkriyah:{"1":{p:35,k:4,b:"7:18",e:"7:20"},"2":{p:35,k:4,b:"7:21",e:"7:23"},"3":{p:35,k:4,b:"7:24",e:"7:29"}},alt:{"1":{p:35,k:4,b:"7:18",e:"7:20"},"2":{p:35,k:4,b:"7:21",e:"7:23"},"3":{p:35,k:4,b:"7:18",e:"7:23"}}},"Chanukah Day 2 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:18",e:"7:23"}}},"Chanukah Day 3":{fullkriyah:{"1":{p:35,k:4,b:"7:24",e:"7:26"},"2":{p:35,k:4,b:"7:27",e:"7:29"},"3":{p:35,k:4,b:"7:30",e:"7:35"}},alt:{"1":{p:35,k:4,b:"7:24",e:"7:26"},"2":{p:35,k:4,b:"7:27",e:"7:29"},"3":{p:35,k:4,b:"7:24",e:"7:29"}}},"Chanukah Day 3 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:24",e:"7:29"}}},"Chanukah Day 4":{fullkriyah:{"1":{p:35,k:4,b:"7:30",e:"7:32"},"2":{p:35,k:4,b:"7:33",e:"7:35"},"3":{p:35,k:4,b:"7:36",e:"7:41"}},alt:{"1":{p:35,k:4,b:"7:30",e:"7:32"},"2":{p:35,k:4,b:"7:33",e:"7:35"},"3":{p:35,k:4,b:"7:30",e:"7:35"}}},"Chanukah Day 4 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:30",e:"7:35"}}},"Chanukah Day 5":{fullkriyah:{"1":{p:35,k:4,b:"7:36",e:"7:38"},"2":{p:35,k:4,b:"7:39",e:"7:41"},"3":{p:35,k:4,b:"7:42",e:"7:47"}},alt:{"1":{p:35,k:4,b:"7:36",e:"7:38"},"2":{p:35,k:4,b:"7:39",e:"7:41"},"3":{p:35,k:4,b:"7:36",e:"7:41"}}},"Chanukah Day 5 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:36",e:"7:41"}}},"Chanukah Day 6":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:5"},"2":{p:41,k:4,b:"28:6",e:"28:10"},"3":{p:41,k:4,b:"28:11",e:"28:15"},"4":{p:35,k:4,b:"7:42",e:"7:47"}}},"Chanukah Day 7":{fullkriyah:{"1":{p:35,k:4,b:"7:48",e:"7:50"},"2":{p:35,k:4,b:"7:51",e:"7:53"},"3":{p:35,k:4,b:"7:54",e:"7:59"}},alt:{"1":{p:35,k:4,b:"7:48",e:"7:50"},"2":{p:35,k:4,b:"7:51",e:"7:53"},"3":{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 7 (on Rosh Chodesh)":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:5"},"2":{p:41,k:4,b:"28:6",e:"28:10"},"3":{p:41,k:4,b:"28:11",e:"28:15"},"4":{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 7 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 8":{fullkriyah:{"1":{p:35,k:4,b:"7:54",e:"7:56"},"2":{p:35,k:4,b:"7:57",e:"7:59"},"3":{p:35,k:4,b:"7:60",e:"8:4"}}},"Chanukah Day 8 (on Shabbat)":{haft:{k:"I Kings",b:"7:40",e:"7:50"},fullkriyah:{M:{p:35,k:4,b:"7:54",e:"8:4"}}},"Erev Purim":{megillah:"Esther"},Purim:Purim,"Shushan Purim":{note:"Jerusalem & walled cities only",il:true,megillah:"Esther",fullkriyah:{"1":{p:16,k:2,b:"17:8",e:"17:10"},"2":{p:16,k:2,b:"17:11",e:"17:13"},"3":{p:16,k:2,b:"17:14",e:"17:16"}}},"Shushan Purim (on Shabbat)":{il:true,note:"Jerusalem & walled cities only: special maftir Exodus 17:8-16, same Haftara as Shabbat Zachor"},"Shabbat HaChodesh":{haft:{k:"Ezekiel",b:"45:16",e:"46:18"},seph:{k:"Ezekiel",b:"45:18",e:"46:15"},fullkriyah:{M:{p:15,k:2,b:"12:1",e:"12:20"}}},"Shabbat HaChodesh (on Rosh Chodesh)":{haft:{k:"Ezekiel",b:"45:16",e:"46:18"},seph:{k:"Ezekiel",b:"45:18",e:"46:15"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:15,k:2,b:"12:1",e:"12:20"}}},"Shabbat HaGadol":{haft:{k:"Malachi",b:"3:4",e:"3:24"}},"Shabbat Parah":{haft:{k:"Ezekiel",b:"36:16",e:"36:38"},seph:{k:"Ezekiel",b:"36:16",e:"36:36"},fullkriyah:{M:{p:39,k:4,b:"19:1",e:"19:22"}}},"Shabbat Shekalim":{haft:{k:"II Kings",b:"12:1",e:"12:17"},seph:{k:"II Kings",b:"11:17",e:"12:17"},fullkriyah:{M:{p:21,k:2,b:"30:11",e:"30:16"}}},"Shabbat Shekalim (on Rosh Chodesh)":{haft:{k:"II Kings",b:"12:1",e:"12:17"},seph:{k:"II Kings",b:"11:17",e:"12:17"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:21,k:2,b:"30:11",e:"30:16"}}},"Shabbat Shuva (with Vayeilech)":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"}]},"Shabbat Shuva (with Ha'azinu)":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Joel",b:"2:15",e:"2:27"}],seph:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"}]},"Shabbat Shuva":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"},{k:"Joel",b:"2:15",e:"2:27"}]},"Shabbat Zachor":{haft:{k:"I Samuel",b:"15:2",e:"15:34"},seph:{k:"I Samuel",b:"15:1",e:"15:34"},fullkriyah:{M:{p:49,k:5,b:"25:17",e:"25:19"}}},"Pinchas occurring after 17 Tammuz":{haft:{k:"Jeremiah",b:"1:1",e:"2:3"}},"Kedoshim following Special Shabbat":{haft:{k:"Amos",b:"9:7",e:"9:15"},seph:{k:"Ezekiel",b:"20:2",e:"20:20"}},"Masei on Shabbat Rosh Chodesh":{haft:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"3:4",e:"3:4"}],seph:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"4:1",e:"4:2"},{k:"Isaiah",b:"66:1",e:"66:1"},{k:"Isaiah",b:"66:23",e:"66:23"}],fullkriyah:{M:{p:41,k:4,b:"28:9",e:"28:15"}}},"Matot-Masei on Shabbat Rosh Chodesh":{alias:true,key:"Masei on Shabbat Rosh Chodesh"},"Ki Teitzei with 3rd Haftarah of Consolation":{haft:[{k:"Isaiah",b:"54:1",e:"54:10"},{k:"Isaiah",b:"54:11",e:"55:5"}]},"Rosh Chodesh":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:3"},"2":{p:41,k:4,b:"28:3",e:"28:5"},"3":{p:41,k:4,b:"28:6",e:"28:10"},"4":{p:41,k:4,b:"28:11",e:"28:15"}}},"Rosh Chodesh Nisan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Iyyar":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Sivan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Tamuz":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Av":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Elul":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Tishrei":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Cheshvan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Kislev":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Sh'vat":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar I":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar II":{alias:true,key:"Rosh Chodesh"},"Shabbat Rosh Chodesh":{haft:{k:"Isaiah",b:"66:1",e:"66:24"},fullkriyah:{M:{p:41,k:4,b:"28:9",e:"28:15"}}},"Shabbat Machar Chodesh":{haft:{k:"I Samuel",b:"20:18",e:"20:42"}}};
270
-
271
- const festivals = festivals0;
272
- /**
273
- * Is there a special festival Torah Reading for `holiday`?
274
- */
275
- function hasFestival(holiday) {
276
- return typeof festivals[holiday] === 'object';
277
- }
278
- function aliyotBookNumToStr(aliyot) {
279
- if (aliyot) {
280
- for (const aliyah of Object.values(aliyot)) {
281
- if (typeof aliyah.k === 'number') {
282
- aliyah.k = BOOK[aliyah.k];
283
- }
284
- }
285
- }
286
- }
287
- /**
288
- * Returns the raw metadata for festival reading for `holiday`
289
- */
290
- function lookupFestival(holiday) {
291
- let src = festivals[holiday];
292
- if (typeof src === 'undefined') {
293
- return undefined;
294
- }
295
- if (src.alias) {
296
- const tmp = festivals[src.key];
297
- if (typeof tmp === 'undefined') {
298
- throw new Error(`Leyning alias ${holiday} => ${src.key} not found`);
299
- }
300
- src = tmp;
301
- }
302
- const result = src.fullkriyah ? clone(src) : src;
303
- aliyotBookNumToStr(result.fullkriyah);
304
- aliyotBookNumToStr(result.alt);
305
- if (src.note) {
306
- result.note = src.note;
307
- }
308
- return result;
309
- }
310
-
311
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
14
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
312
15
  /* eslint-disable @typescript-eslint/no-namespace, no-inner-declarations */
313
16
  /** @private */
314
17
  const lengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
@@ -449,7 +152,7 @@ function abs2greg(abs) {
449
152
  return dt;
450
153
  }
451
154
 
452
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
155
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
453
156
 
454
157
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
455
158
  /**
@@ -464,7 +167,7 @@ greg.greg2abs = greg2abs;
464
167
  greg.isDate = isDate;
465
168
  greg.isLeapYear = isGregLeapYear;
466
169
 
467
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
170
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
468
171
  /**
469
172
  * Removes niqqud from Hebrew string
470
173
  */
@@ -474,7 +177,7 @@ function hebrewStripNikkud(str) {
474
177
  return a.replace(/[\u0590-\u05bd]/g, '').replace(/[\u05bf-\u05c7]/g, '');
475
178
  }
476
179
 
477
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
180
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
478
181
 
479
182
  /*
480
183
  * More minimal HDate
@@ -843,7 +546,7 @@ function monthFromName(monthName) {
843
546
  throw new RangeError(`bad monthName: ${monthName}`);
844
547
  }
845
548
 
846
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
549
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
847
550
  const GERESH = '׳';
848
551
  const GERSHAYIM = '״';
849
552
  const heb2num = {
@@ -956,13 +659,13 @@ function gematriyaStrToNum(str) {
956
659
  return num;
957
660
  }
958
661
 
959
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
662
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
960
663
  var poAshkenazi = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "en_CA@ashkenazi" }, "contexts": { "": { "Tevet": ["Teves"] } } };
961
664
 
962
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
665
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
963
666
  var poHe = { "headers": { "plural-forms": "nplurals=2; plural=(n > 1);", "language": "he" }, "contexts": { "": { "Adar": ["אֲדָר"], "Adar I": ["אֲדָר א׳"], "Adar II": ["אֲדָר ב׳"], "Av": ["אָב"], "Cheshvan": ["חֶשְׁוָן"], "Elul": ["אֱלוּל"], "Iyyar": ["אִיָּיר"], "Kislev": ["כִּסְלֵו"], "Nisan": ["נִיסָן"], "Sh'vat": ["שְׁבָט"], "Sivan": ["סִיוָן"], "Tamuz": ["תַּמּוּז"], "Tevet": ["טֵבֵת"], "Tishrei": ["תִּשְׁרֵי"] } } };
964
667
 
965
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
668
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
966
669
 
967
670
  const noopLocale = {
968
671
  headers: { 'plural-forms': 'nplurals=2; plural=(n!=1);' },
@@ -977,10 +680,6 @@ const alias = {
977
680
  /** @private */
978
681
  const locales = new Map();
979
682
  /** @private */
980
- let activeLocale;
981
- /** @private */
982
- let activeName;
983
- /** @private */
984
683
  function getEnOrdinal(n) {
985
684
  const s = ['th', 'st', 'nd', 'rd'];
986
685
  const v = n % 100;
@@ -991,6 +690,7 @@ function checkLocale(locale) {
991
690
  if (typeof locale !== 'string') {
992
691
  throw new TypeError(`Invalid locale name: ${locale}`);
993
692
  }
693
+ locale = alias[locale] || locale;
994
694
  return locale.toLowerCase();
995
695
  }
996
696
  /** @private */
@@ -1015,11 +715,11 @@ class Locale {
1015
715
  * Returns translation only if `locale` offers a non-empty translation for `id`.
1016
716
  * Otherwise, returns `undefined`.
1017
717
  * @param id Message ID to translate
1018
- * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
718
+ * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale.
1019
719
  */
1020
720
  static lookupTranslation(id, locale) {
1021
- const loc = (typeof locale === 'string' && locales.get(locale.toLowerCase())) ||
1022
- activeLocale;
721
+ const loc = (typeof locale === 'string' && locales.get(checkLocale(locale))) ||
722
+ noopLocale.contexts[''];
1023
723
  const array = loc[id];
1024
724
  if ((array === null || array === void 0 ? void 0 : array.length) && array[0].length) {
1025
725
  return array[0];
@@ -1029,7 +729,7 @@ class Locale {
1029
729
  /**
1030
730
  * By default, if no translation was found, returns `id`.
1031
731
  * @param id Message ID to translate
1032
- * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
732
+ * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale.
1033
733
  */
1034
734
  static gettext(id, locale) {
1035
735
  const text = this.lookupTranslation(id, locale);
@@ -1045,11 +745,11 @@ class Locale {
1045
745
  */
1046
746
  static addLocale(locale, data) {
1047
747
  locale = checkLocale(locale);
1048
- if (typeof data.contexts !== 'object' ||
1049
- typeof data.contexts[''] !== 'object') {
748
+ const ctx = data.contexts;
749
+ if (typeof ctx !== 'object' || typeof ctx[''] !== 'object') {
1050
750
  throw new TypeError(`Locale '${locale}' invalid compact format`);
1051
751
  }
1052
- locales.set(locale, data.contexts['']);
752
+ locales.set(locale, ctx['']);
1053
753
  }
1054
754
  /**
1055
755
  * Adds a translation to `locale`, replacing any previous translation.
@@ -1081,33 +781,11 @@ class Locale {
1081
781
  */
1082
782
  static addTranslations(locale, data) {
1083
783
  const loc = getExistingLocale(locale);
1084
- if (typeof data.contexts !== 'object' ||
1085
- typeof data.contexts[''] !== 'object') {
784
+ const ctx = data.contexts;
785
+ if (typeof ctx !== 'object' || typeof ctx[''] !== 'object') {
1086
786
  throw new TypeError(`Locale '${locale}' invalid compact format`);
1087
787
  }
1088
- const ctx = data.contexts[''];
1089
- Object.assign(loc, ctx);
1090
- }
1091
- /**
1092
- * Activates a locale. Throws an error if the locale has not been previously added.
1093
- * After setting the locale to be used, all strings marked for translations
1094
- * will be represented by the corresponding translation in the specified locale.
1095
- * @param locale Locale name (i.e: `'he'`, `'fr'`)
1096
- * @deprecated
1097
- */
1098
- static useLocale(locale) {
1099
- const locale0 = checkLocale(locale);
1100
- const obj = getExistingLocale(locale0);
1101
- activeName = alias[locale0] || locale0;
1102
- activeLocale = obj;
1103
- return activeLocale;
1104
- }
1105
- /**
1106
- * Returns the name of the active locale (i.e. 'he', 'ashkenazi', 'fr')
1107
- * @deprecated
1108
- */
1109
- static getLocaleName() {
1110
- return activeName;
788
+ Object.assign(loc, ctx['']);
1111
789
  }
1112
790
  /**
1113
791
  * Returns the names of registered locales
@@ -1116,24 +794,30 @@ class Locale {
1116
794
  const keys = Array.from(locales.keys());
1117
795
  return keys.sort((a, b) => a.localeCompare(b));
1118
796
  }
797
+ /**
798
+ * Checks whether a locale has been registered
799
+ * @param locale Locale name (i.e: `'he'`, `'fr'`).
800
+ */
801
+ static hasLocale(locale) {
802
+ const locale1 = checkLocale(locale);
803
+ return locales.has(locale1);
804
+ }
1119
805
  /**
1120
806
  * Renders a number in ordinal, such as 1st, 2nd or 3rd
1121
- * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to active locale.
807
+ * @param [locale] Optional locale name (i.e: `'he'`, `'fr'`). Defaults to no-op locale.
1122
808
  */
1123
809
  static ordinal(n, locale) {
1124
- const locale1 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
1125
- const locale0 = locale1 || activeName;
810
+ let locale0 = locale === null || locale === void 0 ? void 0 : locale.toLowerCase();
1126
811
  if (!locale0) {
1127
812
  return getEnOrdinal(n);
1128
813
  }
814
+ locale0 = alias[locale0] || locale0;
1129
815
  switch (locale0) {
1130
816
  case 'en':
1131
- case 's':
1132
- case 'a':
817
+ case 'ashkenazi':
1133
818
  return getEnOrdinal(n);
1134
819
  case 'es':
1135
820
  return n + 'º';
1136
- case 'h':
1137
821
  case 'he':
1138
822
  case 'he-x-nonikud':
1139
823
  return String(n);
@@ -1156,7 +840,7 @@ class Locale {
1156
840
  const strs = data.contexts[''];
1157
841
  const m = {};
1158
842
  for (const [key, val] of Object.entries(strs)) {
1159
- m[key] = [Locale.hebrewStripNikkud(val[0])];
843
+ m[key] = [hebrewStripNikkud(val[0])];
1160
844
  }
1161
845
  return {
1162
846
  headers: data.headers,
@@ -1165,20 +849,15 @@ class Locale {
1165
849
  }
1166
850
  }
1167
851
  Locale.addLocale('en', noopLocale);
1168
- Locale.addLocale('s', noopLocale);
1169
- Locale.addLocale('', noopLocale);
1170
- Locale.useLocale('en');
1171
852
  /* Ashkenazic transliterations */
1172
853
  Locale.addLocale('ashkenazi', poAshkenazi);
1173
- Locale.addLocale('a', poAshkenazi);
1174
854
  /* Hebrew with nikkud */
1175
855
  Locale.addLocale('he', poHe);
1176
- Locale.addLocale('h', poHe);
1177
856
  /* Hebrew without nikkud */
1178
857
  const poHeNoNikud = Locale.copyLocaleNoNikud(poHe);
1179
858
  Locale.addLocale('he-x-NoNikud', poHeNoNikud);
1180
859
 
1181
- /*! @hebcal/hdate v0.14.5, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
860
+ /*! @hebcal/hdate v0.21.1, distributed under GPLv2 https://www.gnu.org/licenses/gpl-2.0.txt */
1182
861
 
1183
862
  /*
1184
863
  Hebcal - A Jewish Calendar Generator
@@ -1451,7 +1130,7 @@ class HDate {
1451
1130
  * @see {@link Locale}
1452
1131
  */
1453
1132
  render(locale, showYear = true) {
1454
- const locale0 = locale || Locale.getLocaleName();
1133
+ const locale0 = locale || 'en';
1455
1134
  const day = this.getDate();
1456
1135
  const monthName0 = Locale.gettext(this.getMonthName(), locale0);
1457
1136
  const monthName = monthName0.replace(/'/g, '’');
@@ -1468,18 +1147,25 @@ class HDate {
1468
1147
  }
1469
1148
  /**
1470
1149
  * Renders this Hebrew date in Hebrew gematriya, regardless of locale.
1150
+ * @param suppressNikud - suppress nekudot (default false)
1151
+ * @param suppressYear - suppress Hebrew year (default false)
1471
1152
  * @example
1472
1153
  * import {HDate, months} from '@hebcal/hdate';
1473
1154
  * const hd = new HDate(15, months.CHESHVAN, 5769);
1474
1155
  * hd.renderGematriya(); // 'ט״ו חֶשְׁוָן תשס״ט'
1475
1156
  * hd.renderGematriya(true); // 'ט״ו חשון תשס״ט'
1157
+ * hd.renderGematriya(false, true); // 'ט״ו חֶשְׁוָן'
1476
1158
  */
1477
- renderGematriya(suppressNikud = false) {
1159
+ renderGematriya(suppressNikud = false, suppressYear = false) {
1478
1160
  const d = this.getDate();
1479
1161
  const locale = suppressNikud ? 'he-x-NoNikud' : 'he';
1480
1162
  const m = Locale.gettext(this.getMonthName(), locale);
1163
+ const prefix = gematriya(d) + ' ' + m;
1164
+ if (suppressYear) {
1165
+ return prefix;
1166
+ }
1481
1167
  const y = this.getFullYear();
1482
- return gematriya(d) + ' ' + m + ' ' + gematriya(y);
1168
+ return prefix + ' ' + gematriya(y);
1483
1169
  }
1484
1170
  /**
1485
1171
  * Returns an `HDate` corresponding to the specified day of week
@@ -1820,109 +1506,390 @@ class HDate {
1820
1506
  }
1821
1507
  return new HDate(day, month, year);
1822
1508
  }
1823
- }
1824
- function standardizeUnits(units) {
1825
- switch (units) {
1826
- case 'd':
1827
- return UNITS_DAY;
1828
- case 'w':
1829
- return UNITS_WEEK;
1830
- case 'M':
1831
- return UNITS_MONTH;
1832
- case 'y':
1833
- return UNITS_YEAR;
1509
+ }
1510
+ function standardizeUnits(units) {
1511
+ switch (units) {
1512
+ case 'd':
1513
+ return UNITS_DAY;
1514
+ case 'w':
1515
+ return UNITS_WEEK;
1516
+ case 'M':
1517
+ return UNITS_MONTH;
1518
+ case 'y':
1519
+ return UNITS_YEAR;
1520
+ }
1521
+ const str = String(units || '')
1522
+ .toLowerCase()
1523
+ .replace(/s$/, '');
1524
+ switch (str) {
1525
+ case UNITS_DAY:
1526
+ case UNITS_WEEK:
1527
+ case UNITS_MONTH:
1528
+ case UNITS_YEAR:
1529
+ return str;
1530
+ }
1531
+ throw new TypeError(`Invalid units '${units}'`);
1532
+ }
1533
+ function getDayOfTranslation(locale) {
1534
+ switch (locale) {
1535
+ case 'en':
1536
+ case 's':
1537
+ case 'a':
1538
+ case 'ashkenazi':
1539
+ return ' of';
1540
+ }
1541
+ const ofStr = Locale.lookupTranslation('of', locale);
1542
+ if (ofStr) {
1543
+ return ' ' + ofStr;
1544
+ }
1545
+ if (locale.startsWith('ashkenazi')) {
1546
+ return ' of';
1547
+ }
1548
+ return '';
1549
+ }
1550
+ /**
1551
+ * Sets the day of the month of the date. Returns the object it was called upon
1552
+ * @private
1553
+ * @param month A number, or Hebrew month name string
1554
+ */
1555
+ function setMonth(hd, month) {
1556
+ hd.mm = HDate.monthNum(month);
1557
+ fix(hd);
1558
+ return hd;
1559
+ }
1560
+ function setDate(hd, date) {
1561
+ hd.dd = date;
1562
+ fix(hd);
1563
+ return hd;
1564
+ }
1565
+ function fix(hd) {
1566
+ fixMonth(hd);
1567
+ fixDate(hd);
1568
+ }
1569
+ function fixDate(hd) {
1570
+ if (hd.dd < 1) {
1571
+ if (hd.mm === months.TISHREI) {
1572
+ hd.yy -= 1;
1573
+ }
1574
+ hd.dd += daysInMonth(hd.mm, hd.yy);
1575
+ hd.mm -= 1;
1576
+ fix(hd);
1577
+ }
1578
+ if (hd.dd > daysInMonth(hd.mm, hd.yy)) {
1579
+ if (hd.mm === months.ELUL) {
1580
+ hd.yy += 1;
1581
+ }
1582
+ hd.dd -= daysInMonth(hd.mm, hd.yy);
1583
+ if (hd.mm === monthsInYear(hd.yy)) {
1584
+ hd.mm = 1; // rollover to NISAN
1585
+ }
1586
+ else {
1587
+ hd.mm += 1;
1588
+ }
1589
+ fix(hd);
1590
+ }
1591
+ fixMonth(hd);
1592
+ }
1593
+ function fixMonth(hd) {
1594
+ if (hd.mm === months.ADAR_II && !hd.isLeapYear()) {
1595
+ hd.mm -= 1; // to Adar I
1596
+ fix(hd);
1597
+ }
1598
+ else if (hd.mm < 1) {
1599
+ hd.mm += monthsInYear(hd.yy);
1600
+ hd.yy -= 1;
1601
+ fix(hd);
1602
+ }
1603
+ else if (hd.mm > monthsInYear(hd.yy)) {
1604
+ hd.mm -= monthsInYear(hd.yy);
1605
+ hd.yy += 1;
1606
+ fix(hd);
1607
+ }
1608
+ delete hd.rd;
1609
+ }
1610
+ function onOrBefore(day, t, offset) {
1611
+ return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1612
+ }
1613
+
1614
+ function gematriya2(num) {
1615
+ const str = gematriya(num);
1616
+ return str.replaceAll(/[׳״]/g, '');
1617
+ }
1618
+ function formatVerseToHebrew(chapVerse) {
1619
+ if (chapVerse === undefined || chapVerse === null) {
1620
+ return '';
1621
+ }
1622
+ const cv = chapVerse.split(':');
1623
+ const chapter = parseInt(cv[0], 10);
1624
+ const verse = parseInt(cv[1], 10);
1625
+ // if not number return empty string
1626
+ if (isNaN(chapter) || isNaN(verse)) {
1627
+ return chapVerse;
1628
+ }
1629
+ return `${gematriya2(chapter)}:${gematriya2(verse)}`;
1630
+ }
1631
+ /**
1632
+ * Formats an aliyah object like "Numbers 28:9-15"
1633
+ */
1634
+ function formatAliyahShort(aliyah, showBook, language = 'en') {
1635
+ const isEnglish = language === 'en';
1636
+ const begin = isEnglish ? aliyah.b : formatVerseToHebrew(aliyah.b);
1637
+ const end0 = isEnglish ? aliyah.e : formatVerseToHebrew(aliyah.e);
1638
+ const prefix = showBook ? locale.Locale.gettext(aliyah.k, language) + ' ' : '';
1639
+ if (begin === end0) {
1640
+ return `${prefix}${begin}`;
1641
+ }
1642
+ const cv1 = begin.split(':');
1643
+ const cv2 = end0.split(':');
1644
+ const end = cv1[0] === cv2[0] ? cv2[1] : end0;
1645
+ return `${prefix}${begin}-${end}`;
1646
+ }
1647
+
1648
+ const Genesis=[0,31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,54,33,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26];const Exodus=[0,22,25,22,31,23,30,29,28,35,29,10,51,22,31,27,36,16,27,25,23,37,30,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38];const Leviticus=[0,17,16,17,35,26,23,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34];const Numbers=[0,54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,35,28,32,22,29,35,41,30,25,19,65,23,31,39,17,54,42,56,29,34,13];const Deuteronomy=[0,46,37,29,49,30,25,26,20,29,22,32,31,19,29,23,22,20,22,21,20,23,29,26,22,19,19,26,69,28,20,30,52,29,12];const Joshua=[0,18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33];const Judges=[0,36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25];const Ruth=[0,22,23,18,22];const Isaiah=[0,31,22,26,6,30,13,25,23,20,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,11,25,24];const Jeremiah=[0,19,37,25,31,31,30,34,23,25,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34];const Lamentations=[0,22,22,66,22,22];const Esther=[0,22,23,15,17,14,14,10,17,32,3];const Ecclesiastes=[0,18,26,22,17,19,12,29,17,18,20,10,14];const Ezekiel=[0,28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,44,37,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35];const Daniel=[0,21,49,100,34,30,29,28,27,27,21,45,13,64,42];const Hosea=[0,9,25,5,19,15,11,16,14,17,15,11,15,15,10];const Joel=[0,20,27,5,21];const Amos=[0,15,16,15,13,27,14,17,14,15];const Obadiah=[0,21];const Jonah=[0,16,11,10,11];const Micah=[0,16,13,12,14,14,16,20];const Nachum=[0,14,14,19];const Habakkuk=[0,17,20,19];const Zephaniah=[0,18,15,20];const Haggai=[0,15,23];const Zechariah=[0,17,17,10,14,11,15,14,23,17,12,17,14,9,21];const Malachi=[0,14,17,24];var numverses = {Genesis:Genesis,Exodus:Exodus,Leviticus:Leviticus,Numbers:Numbers,Deuteronomy:Deuteronomy,Joshua:Joshua,Judges:Judges,Ruth:Ruth,"I Samuel":[0,28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,16,23,28,23,43,25,12,25,11,31,13],"II Samuel":[0,27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,32,44,26,22,51,39,25],"I Kings":[0,53,46,28,20,32,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,54],"II Kings":[0,18,25,27,44,27,33,20,29,37,36,20,22,25,29,38,20,41,37,37,21,26,20,37,20,30],Isaiah:Isaiah,Jeremiah:Jeremiah,Lamentations:Lamentations,Esther:Esther,Ecclesiastes:Ecclesiastes,"Song of Songs":[0,17,17,11,16,16,12,14,14],Ezekiel:Ezekiel,Daniel:Daniel,Hosea:Hosea,Joel:Joel,Amos:Amos,Obadiah:Obadiah,Jonah:Jonah,Micah:Micah,Nachum:Nachum,Habakkuk:Habakkuk,Zephaniah:Zephaniah,Haggai:Haggai,Zechariah:Zechariah,Malachi:Malachi};
1649
+
1650
+ /**
1651
+ * Names of the books of the Torah.
1652
+ *
1653
+ * `BOOK[1] === 'Genesis'`
1654
+ * @readonly
1655
+ */
1656
+ const BOOK = [
1657
+ '',
1658
+ 'Genesis',
1659
+ 'Exodus',
1660
+ 'Leviticus',
1661
+ 'Numbers',
1662
+ 'Deuteronomy',
1663
+ ];
1664
+ /**
1665
+ * The number of verses in each book of the Tanakh.
1666
+ * Indexed by English transliterated name of book,
1667
+ * and arrays are 1-based.
1668
+ *
1669
+ * There are 51 chapters in Genesis, so
1670
+ * `NUM_VERSES['Genesis'].length === 51`.
1671
+ *
1672
+ * There are 26 verses in Genesis chapter 4,
1673
+ * so `NUM_VERSES['Genesis'][4] === 26`.
1674
+ * @readonly
1675
+ */
1676
+ const NUM_VERSES = numverses;
1677
+ /**
1678
+ * Formats parsha as a string
1679
+ * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
1680
+ */
1681
+ function parshaToString(parsha) {
1682
+ if (typeof parsha === 'string') {
1683
+ return parsha;
1684
+ }
1685
+ else if (!Array.isArray(parsha) ||
1686
+ parsha.length === 0 ||
1687
+ parsha.length > 2) {
1688
+ throw new TypeError(`Bad parsha argument: ${parsha}`);
1689
+ }
1690
+ let s = parsha[0];
1691
+ if (parsha.length === 2) {
1692
+ s += '-' + parsha[1];
1693
+ }
1694
+ return s;
1695
+ }
1696
+ /**
1697
+ * Calculates the number of verses in an aliyah or haftara based on
1698
+ * the `b` (begin verse), `e` (end verse) and `k` (book).
1699
+ * Modifies `aliyah` by setting the `v` field.
1700
+ */
1701
+ function calculateNumVerses(aliyah) {
1702
+ if (aliyah.v) {
1703
+ return aliyah.v;
1704
+ }
1705
+ aliyah.v = subtractVerses(aliyah.k, aliyah.b, aliyah.e) + 1;
1706
+ return aliyah.v;
1707
+ }
1708
+ /**
1709
+ * Finds the number of verses between two locations in the same book.
1710
+ * @param book The English name of the book (e.g. "Numbers")
1711
+ * @param from The starting verse (e.g. "28:9")
1712
+ * @param to The ending verse (e.g. "28:15")
1713
+ * @returns The number of verses between the two locations, excluding the `to` verse.
1714
+ */
1715
+ function subtractVerses(book, from, to) {
1716
+ const chapVerseBegin = from.split(':');
1717
+ const chapVerseEnd = to.split(':');
1718
+ const c1 = parseInt(chapVerseBegin[0], 10);
1719
+ const c2 = parseInt(chapVerseEnd[0], 10);
1720
+ const v1 = parseInt(chapVerseBegin[1], 10);
1721
+ const v2 = parseInt(chapVerseEnd[1], 10);
1722
+ let result = 0;
1723
+ if (c1 === c2) {
1724
+ return v2 - v1;
1725
+ }
1726
+ const numv = NUM_VERSES[book];
1727
+ if (typeof numv !== 'object' || !numv.length) {
1728
+ throw new ReferenceError(`Can't find numverses for ${book}`);
1729
+ }
1730
+ let total = numv[c1] - v1;
1731
+ for (let chap = c1 + 1; chap < c2; chap++) {
1732
+ total += numv[chap];
1733
+ }
1734
+ total += v2;
1735
+ result = total;
1736
+ return result;
1737
+ }
1738
+ /**
1739
+ * Calculates the next verse after adding a number of verses to a given location.
1740
+ * @param book The English name of the book (e.g. "Numbers")
1741
+ * @param from The starting verse (e.g. "28:9")
1742
+ * @param numVerses The number of verses to add; must be nonnegative.
1743
+ * @returns The next verse after adding the specified number of verses,
1744
+ * or null if the resulting verse exceeds the number of verses
1745
+ * in the book.
1746
+ */
1747
+ function addVerses(book, from, numVerses) {
1748
+ const chapVerseBegin = from.split(':');
1749
+ const c1 = parseInt(chapVerseBegin[0], 10);
1750
+ const v1 = parseInt(chapVerseBegin[1], 10);
1751
+ const numv = NUM_VERSES[book];
1752
+ if (typeof numv !== 'object' || !numv.length) {
1753
+ throw new ReferenceError(`Can't find numverses for ${book}`);
1754
+ }
1755
+ let total = v1 + numVerses;
1756
+ let c2 = c1;
1757
+ while (total > numv[c2]) {
1758
+ total -= numv[c2];
1759
+ c2++;
1760
+ if (!numv[c2])
1761
+ return null;
1834
1762
  }
1835
- const str = String(units || '')
1836
- .toLowerCase()
1837
- .replace(/s$/, '');
1838
- switch (str) {
1839
- case UNITS_DAY:
1840
- case UNITS_WEEK:
1841
- case UNITS_MONTH:
1842
- case UNITS_YEAR:
1843
- return str;
1763
+ return `${c2}:${total}`;
1764
+ }
1765
+ /**
1766
+ * Formats an aliyah object like "Numbers 28:9-28:15"
1767
+ */
1768
+ function formatAliyahWithBook(a) {
1769
+ return `${a.k} ${a.b}-${a.e}`;
1770
+ }
1771
+
1772
+ const Shavuot={note:"Israel only",il:true,megillah:"Ruth",haft:[{k:"Ezekiel",b:"1:1",e:"1:28"},{k:"Ezekiel",b:"3:12",e:"3:12"}],fullkriyah:{"1":{p:17,k:2,b:"19:1",e:"19:6"},"2":{p:17,k:2,b:"19:7",e:"19:13"},"3":{p:17,k:2,b:"19:14",e:"19:19"},"4":{p:17,k:2,b:"19:20",e:"20:14"},"5":{p:17,k:2,b:"20:15",e:"20:23"},M:{p:41,k:4,b:"28:26",e:"28:31"}}};const Purim={megillah:"Esther",fullkriyah:{"1":{p:16,k:2,b:"17:8",e:"17:10"},"2":{p:16,k:2,b:"17:11",e:"17:13"},"3":{p:16,k:2,b:"17:14",e:"17:16"}}};var festivals0 = {"Pesach I":{haft:[{k:"Joshua",b:"3:5",e:"3:7"},{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],seph:[{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],fullkriyah:{"1":{p:15,k:2,b:"12:21",e:"12:24"},"2":{p:15,k:2,b:"12:25",e:"12:28"},"3":{p:15,k:2,b:"12:29",e:"12:36"},"4":{p:15,k:2,b:"12:37",e:"12:42"},"5":{p:15,k:2,b:"12:43",e:"12:51"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach I (on Shabbat)":{haft:[{k:"Joshua",b:"3:5",e:"3:7"},{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],seph:[{k:"Joshua",b:"5:2",e:"6:1"},{k:"Joshua",b:"6:27",e:"6:27"}],fullkriyah:{"1":{p:15,k:2,b:"12:21",e:"12:24"},"2":{p:15,k:2,b:"12:25",e:"12:28"},"3":{p:15,k:2,b:"12:29",e:"12:32"},"4":{p:15,k:2,b:"12:33",e:"12:36"},"5":{p:15,k:2,b:"12:37",e:"12:42"},"6":{p:15,k:2,b:"12:43",e:"12:47"},"7":{p:15,k:2,b:"12:48",e:"12:51"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach II":{haft:[{k:"II Kings",b:"23:1",e:"23:9"},{k:"II Kings",b:"23:21",e:"23:25"}],fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"28:16",e:"28:25"}}},"Pesach II (CH''M)":{note:"Israel only - according to Vaani T'fillati Siddur Yisraeli",il:true,fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:8"},"2":{p:31,k:3,b:"23:9",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:44"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 1":{fullkriyah:{"1":{p:15,k:2,b:"13:1",e:"13:4"},"2":{p:15,k:2,b:"13:5",e:"13:10"},"3":{p:15,k:2,b:"13:11",e:"13:16"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 2":{fullkriyah:{"1":{p:18,k:2,b:"22:24",e:"22:26"},"2":{p:18,k:2,b:"22:27",e:"23:5"},"3":{p:18,k:2,b:"23:6",e:"23:19"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 3":{fullkriyah:{"1":{p:21,k:2,b:"34:1",e:"34:10"},"2":{p:21,k:2,b:"34:11",e:"34:17"},"3":{p:21,k:2,b:"34:18",e:"34:26"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Chol ha-Moed Day 4":{fullkriyah:{"1":{p:36,k:4,b:"9:1",e:"9:5"},"2":{p:36,k:4,b:"9:6",e:"9:8"},"3":{p:36,k:4,b:"9:9",e:"9:14"},"4":{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach Shabbat Chol ha-Moed":{megillah:"Song of Songs",haft:{k:"Ezekiel",b:"37:1",e:"37:14"},fullkriyah:{"1":{p:21,k:2,b:"33:12",e:"33:16"},"2":{p:21,k:2,b:"33:17",e:"33:19"},"3":{p:21,k:2,b:"33:20",e:"33:23"},"4":{p:21,k:2,b:"34:1",e:"34:3"},"5":{p:21,k:2,b:"34:4",e:"34:10"},"6":{p:21,k:2,b:"34:11",e:"34:17"},"7":{p:21,k:2,b:"34:18",e:"34:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VII":{haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":{p:16,k:2,b:"13:17",e:"13:22"},"2":{p:16,k:2,b:"14:1",e:"14:8"},"3":{p:16,k:2,b:"14:9",e:"14:14"},"4":{p:16,k:2,b:"14:15",e:"14:25"},"5":{p:16,k:2,b:"14:26",e:"15:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VII (on Shabbat)":{megillah:"Song of Songs",haft:{k:"II Samuel",b:"22:1",e:"22:51"},fullkriyah:{"1":{p:16,k:2,b:"13:17",e:"13:19"},"2":{p:16,k:2,b:"13:20",e:"13:22"},"3":{p:16,k:2,b:"14:1",e:"14:4"},"4":{p:16,k:2,b:"14:5",e:"14:8"},"5":{p:16,k:2,b:"14:9",e:"14:14"},"6":{p:16,k:2,b:"14:15",e:"14:25"},"7":{p:16,k:2,b:"14:26",e:"15:26"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VIII":{haft:{k:"Isaiah",b:"10:32",e:"12:6"},fullkriyah:{"1":{p:47,k:5,b:"15:19",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach VIII (on Shabbat)":{megillah:"Song of Songs",haft:{k:"Isaiah",b:"10:32",e:"12:6"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:19",e:"28:25"}}},"Pesach III (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 1"},"Pesach IV (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 2"},"Pesach V (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 3"},"Pesach VI (CH''M)":{alias:true,il:true,key:"Pesach Chol ha-Moed Day 4"},"Pesach Chol ha-Moed Day 2 on Sunday":{alias:true,il:false,key:"Pesach Chol ha-Moed Day 1"},"Pesach Chol ha-Moed Day 3 on Monday":{alias:true,il:false,key:"Pesach Chol ha-Moed Day 2"},Shavuot:Shavuot,"Shavuot I":{haft:[{k:"Ezekiel",b:"1:1",e:"1:28"},{k:"Ezekiel",b:"3:12",e:"3:12"}],fullkriyah:{"1":{p:17,k:2,b:"19:1",e:"19:6"},"2":{p:17,k:2,b:"19:7",e:"19:13"},"3":{p:17,k:2,b:"19:14",e:"19:19"},"4":{p:17,k:2,b:"19:20",e:"20:14"},"5":{p:17,k:2,b:"20:15",e:"20:23"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Shavuot II":{megillah:"Ruth",haft:{k:"Habakkuk",b:"3:1",e:"3:19"},seph:{k:"Habakkuk",b:"2:20",e:"3:19"},fullkriyah:{"1":{p:47,k:5,b:"15:19",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Shavuot II (on Shabbat)":{megillah:"Ruth",haft:{k:"Habakkuk",b:"3:1",e:"3:19"},seph:{k:"Habakkuk",b:"2:20",e:"3:19"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"28:26",e:"28:31"}}},"Fast Day (Morning)":{fullkriyah:{"1":{p:21,k:2,b:"32:11",e:"32:14"},"2":{p:21,k:2,b:"34:1",e:"34:3"},"3":{p:21,k:2,b:"34:4",e:"34:10"}}},"Fast Day (Afternoon)":{haft:{k:"Isaiah",b:"55:6",e:"56:8"},fullkriyah:{"1":{p:21,k:2,b:"32:11",e:"32:14"},"2":{p:21,k:2,b:"34:1",e:"34:3"},M:{p:21,k:2,b:"34:4",e:"34:10"}}},"Asara B'Tevet":{alias:true,key:"Fast Day (Morning)"},"Ta'anit Esther":{alias:true,key:"Fast Day (Morning)"},"Tzom Gedaliah":{alias:true,key:"Fast Day (Morning)"},"Tzom Tammuz":{alias:true,key:"Fast Day (Morning)"},"Asara B'Tevet (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Ta'anit Esther (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Tzom Gedaliah (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Tzom Tammuz (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Erev Tish'a B'Av":{megillah:"Lamentations"},"Tish'a B'Av":{haft:{k:"Jeremiah",b:"8:13",e:"9:23"},fullkriyah:{"1":{p:45,k:5,b:"4:25",e:"4:29"},"2":{p:45,k:5,b:"4:30",e:"4:35"},"3":{p:45,k:5,b:"4:36",e:"4:40"}},megillah:"Lamentations"},"Tish'a B'Av (Mincha)":{alias:true,key:"Fast Day (Afternoon)"},"Rosh Hashana I":{haft:{k:"I Samuel",b:"1:1",e:"2:10"},fullkriyah:{"1":{p:4,k:1,b:"21:1",e:"21:4"},"2":{p:4,k:1,b:"21:5",e:"21:12"},"3":{p:4,k:1,b:"21:13",e:"21:21"},"4":{p:4,k:1,b:"21:22",e:"21:27"},"5":{p:4,k:1,b:"21:28",e:"21:34"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Rosh Hashana I (on Shabbat)":{haft:{k:"I Samuel",b:"1:1",e:"2:10"},fullkriyah:{"1":{p:4,k:1,b:"21:1",e:"21:4"},"2":{p:4,k:1,b:"21:5",e:"21:8"},"3":{p:4,k:1,b:"21:9",e:"21:12"},"4":{p:4,k:1,b:"21:13",e:"21:17"},"5":{p:4,k:1,b:"21:18",e:"21:21"},"6":{p:4,k:1,b:"21:22",e:"21:27"},"7":{p:4,k:1,b:"21:28",e:"21:34"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Rosh Hashana II":{haft:{k:"Jeremiah",b:"31:2",e:"31:20",note:"labeled 31:1–19 in some books"},fullkriyah:{"1":{p:4,k:1,b:"22:1",e:"22:3"},"2":{p:4,k:1,b:"22:4",e:"22:8"},"3":{p:4,k:1,b:"22:9",e:"22:14"},"4":{p:4,k:1,b:"22:15",e:"22:19"},"5":{p:4,k:1,b:"22:20",e:"22:24"},M:{p:41,k:4,b:"29:1",e:"29:6"}}},"Yom Kippur":{haft:{k:"Isaiah",b:"57:14",e:"58:14"},fullkriyah:{"1":{p:29,k:3,b:"16:1",e:"16:6"},"2":{p:29,k:3,b:"16:7",e:"16:11"},"3":{p:29,k:3,b:"16:12",e:"16:17"},"4":{p:29,k:3,b:"16:18",e:"16:24"},"5":{p:29,k:3,b:"16:25",e:"16:30"},"6":{p:29,k:3,b:"16:31",e:"16:34"},M:{p:41,k:4,b:"29:7",e:"29:11"}}},"Yom Kippur (on Shabbat)":{haft:{k:"Isaiah",b:"57:14",e:"58:14"},fullkriyah:{"1":{p:29,k:3,b:"16:1",e:"16:3"},"2":{p:29,k:3,b:"16:4",e:"16:6"},"3":{p:29,k:3,b:"16:7",e:"16:11"},"4":{p:29,k:3,b:"16:12",e:"16:17"},"5":{p:29,k:3,b:"16:18",e:"16:24"},"6":{p:29,k:3,b:"16:25",e:"16:30"},"7":{p:29,k:3,b:"16:31",e:"16:34"},M:{p:41,k:4,b:"29:7",e:"29:11"}}},"Yom Kippur (Mincha)":{alias:true,key:"Yom Kippur (Mincha, Traditional)"},"Yom Kippur (Mincha, Traditional)":{haft:[{k:"Jonah",b:"1:1",e:"4:11"},{k:"Micah",b:"7:18",e:"7:20"}],fullkriyah:{"1":{p:29,k:3,b:"18:1",e:"18:5"},"2":{p:29,k:3,b:"18:6",e:"18:21"},M:{p:29,k:3,b:"18:22",e:"18:30"}}},"Yom Kippur (Mincha, Alternate)":{haft:[{k:"Jonah",b:"1:1",e:"4:11"},{k:"Micah",b:"7:18",e:"7:20"}],fullkriyah:{"1":{p:30,k:3,b:"19:1",e:"19:4"},"2":{p:30,k:3,b:"19:5",e:"19:10"},M:{p:30,k:3,b:"19:11",e:"19:18"}}},"Sukkot I":{haft:{k:"Zechariah",b:"14:1",e:"14:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot I (on Shabbat)":{haft:{k:"Zechariah",b:"14:1",e:"14:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"22:33"},"2":{p:31,k:3,b:"23:1",e:"23:3"},"3":{p:31,k:3,b:"23:4",e:"23:8"},"4":{p:31,k:3,b:"23:9",e:"23:14"},"5":{p:31,k:3,b:"23:15",e:"23:22"},"6":{p:31,k:3,b:"23:23",e:"23:32"},"7":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot II":{haft:{k:"I Kings",b:"8:2",e:"8:21"},fullkriyah:{"1":{p:31,k:3,b:"22:26",e:"23:3"},"2":{p:31,k:3,b:"23:4",e:"23:14"},"3":{p:31,k:3,b:"23:15",e:"23:22"},"4":{p:31,k:3,b:"23:23",e:"23:32"},"5":{p:31,k:3,b:"23:33",e:"23:44"},M:{p:41,k:4,b:"29:12",e:"29:16"}}},"Sukkot Chol ha-Moed Day 1":{fullkriyah:{"1":{p:41,k:4,b:"29:17",e:"29:19"},"2":{p:41,k:4,b:"29:20",e:"29:22"},"3":{p:41,k:4,b:"29:23",e:"29:25"},"4":{p:41,k:4,b:"29:17",e:"29:22"}}},"Sukkot Chol ha-Moed Day 2":{fullkriyah:{"1":{p:41,k:4,b:"29:20",e:"29:22"},"2":{p:41,k:4,b:"29:23",e:"29:25"},"3":{p:41,k:4,b:"29:26",e:"29:28"},"4":{p:41,k:4,b:"29:20",e:"29:25"}}},"Sukkot Chol ha-Moed Day 3":{fullkriyah:{"1":{p:41,k:4,b:"29:23",e:"29:25"},"2":{p:41,k:4,b:"29:26",e:"29:28"},"3":{p:41,k:4,b:"29:29",e:"29:31"},"4":{p:41,k:4,b:"29:23",e:"29:28"}}},"Sukkot Chol ha-Moed Day 4":{fullkriyah:{"1":{p:41,k:4,b:"29:26",e:"29:28"},"2":{p:41,k:4,b:"29:29",e:"29:31"},"3":{p:41,k:4,b:"29:32",e:"29:34"},"4":{p:41,k:4,b:"29:26",e:"29:31"}}},"Sukkot Chol ha-Moed Day 5":{fullkriyah:{"1":{p:41,k:4,b:"29:29",e:"29:31"},"2":{p:41,k:4,b:"29:32",e:"29:34"},"3":{p:41,k:4,b:"29:35",e:"29:37"},"4":{p:41,k:4,b:"29:29",e:"29:34"}}},"Sukkot Shabbat Chol ha-Moed":{megillah:"Ecclesiastes",haft:{k:"Ezekiel",b:"38:18",e:"39:16"},fullkriyah:{"1":{p:21,k:2,b:"33:12",e:"33:16"},"2":{p:21,k:2,b:"33:17",e:"33:19"},"3":{p:21,k:2,b:"33:20",e:"33:23"},"4":{p:21,k:2,b:"34:1",e:"34:3"},"5":{p:21,k:2,b:"34:4",e:"34:10"},"6":{p:21,k:2,b:"34:11",e:"34:17"},"7":{p:21,k:2,b:"34:18",e:"34:26"},"M-day1":{p:41,k:4,b:"29:17",e:"29:22"},"M-day2":{p:41,k:4,b:"29:20",e:"29:25"},"M-day3":{p:41,k:4,b:"29:23",e:"29:28"},"M-day4":{p:41,k:4,b:"29:26",e:"29:31"},"M-day5":{p:41,k:4,b:"29:29",e:"29:34"}}},"Sukkot Final Day (Hoshana Raba)":{fullkriyah:{"1":{p:41,k:4,b:"29:26",e:"29:28"},"2":{p:41,k:4,b:"29:29",e:"29:31"},"3":{p:41,k:4,b:"29:32",e:"29:34"},"4":{p:41,k:4,b:"29:29",e:"29:34"}}},"Shmini Atzeret":{haft:{k:"I Kings",b:"8:54",e:"8:66"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"16:3"},"4":{p:47,k:5,b:"16:4",e:"16:8"},"5":{p:47,k:5,b:"16:9",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}},alt:{"1":{p:47,k:5,b:"14:22",e:"15:23"},"2":{p:47,k:5,b:"16:1",e:"16:3"},"3":{p:47,k:5,b:"16:4",e:"16:8"},"4":{p:47,k:5,b:"16:9",e:"16:12"},"5":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Shmini Atzeret (on Shabbat)":{megillah:"Ecclesiastes",haft:{k:"I Kings",b:"8:54",e:"8:66"},fullkriyah:{"1":{p:47,k:5,b:"14:22",e:"14:29"},"2":{p:47,k:5,b:"15:1",e:"15:18"},"3":{p:47,k:5,b:"15:19",e:"15:23"},"4":{p:47,k:5,b:"16:1",e:"16:3"},"5":{p:47,k:5,b:"16:4",e:"16:8"},"6":{p:47,k:5,b:"16:9",e:"16:12"},"7":{p:47,k:5,b:"16:13",e:"16:17"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Erev Simchat Torah":{fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"}}},"Simchat Torah":{haft:{k:"Joshua",b:"1:1",e:"1:18"},fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"},"4":{p:54,k:5,b:"33:18",e:"33:21"},"5":{p:54,k:5,b:"33:22",e:"33:26"},"6":{p:54,k:5,b:"33:27",e:"34:12"},"7":{p:1,k:1,b:"1:1",e:"2:3"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Simchat Torah (on Shabbat)":{megillah:"Ecclesiastes",haft:{k:"Joshua",b:"1:1",e:"1:18"},fullkriyah:{"1":{p:54,k:5,b:"33:1",e:"33:7"},"2":{p:54,k:5,b:"33:8",e:"33:12"},"3":{p:54,k:5,b:"33:13",e:"33:17"},"4":{p:54,k:5,b:"33:18",e:"33:21"},"5":{p:54,k:5,b:"33:22",e:"33:26"},"6":{p:54,k:5,b:"33:27",e:"33:29"},"7":{p:54,k:5,b:"34:1",e:"34:12"},"8":{p:1,k:1,b:"1:1",e:"2:3"},M:{p:41,k:4,b:"29:35",e:"30:1"}}},"Shabbat Rosh Chodesh Chanukah":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:35,k:4,b:"7:42",e:"7:47"}}},"Chanukah Day 1":{fullkriyah:{"1":{p:35,k:4,b:"7:1",e:"7:11"},"2":{p:35,k:4,b:"7:12",e:"7:14"},"3":{p:35,k:4,b:"7:15",e:"7:17"}},alt:{"1":{p:35,k:4,b:"7:1",e:"7:3"},"2":{p:35,k:4,b:"7:4",e:"7:11"},"3":{p:35,k:4,b:"7:12",e:"7:17"}}},"Chanukah Day 1 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:1",e:"7:17"}}},"Chanukah Day 2":{fullkriyah:{"1":{p:35,k:4,b:"7:18",e:"7:20"},"2":{p:35,k:4,b:"7:21",e:"7:23"},"3":{p:35,k:4,b:"7:24",e:"7:29"}},alt:{"1":{p:35,k:4,b:"7:18",e:"7:20"},"2":{p:35,k:4,b:"7:21",e:"7:23"},"3":{p:35,k:4,b:"7:18",e:"7:23"}}},"Chanukah Day 2 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:18",e:"7:23"}}},"Chanukah Day 3":{fullkriyah:{"1":{p:35,k:4,b:"7:24",e:"7:26"},"2":{p:35,k:4,b:"7:27",e:"7:29"},"3":{p:35,k:4,b:"7:30",e:"7:35"}},alt:{"1":{p:35,k:4,b:"7:24",e:"7:26"},"2":{p:35,k:4,b:"7:27",e:"7:29"},"3":{p:35,k:4,b:"7:24",e:"7:29"}}},"Chanukah Day 3 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:24",e:"7:29"}}},"Chanukah Day 4":{fullkriyah:{"1":{p:35,k:4,b:"7:30",e:"7:32"},"2":{p:35,k:4,b:"7:33",e:"7:35"},"3":{p:35,k:4,b:"7:36",e:"7:41"}},alt:{"1":{p:35,k:4,b:"7:30",e:"7:32"},"2":{p:35,k:4,b:"7:33",e:"7:35"},"3":{p:35,k:4,b:"7:30",e:"7:35"}}},"Chanukah Day 4 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:30",e:"7:35"}}},"Chanukah Day 5":{fullkriyah:{"1":{p:35,k:4,b:"7:36",e:"7:38"},"2":{p:35,k:4,b:"7:39",e:"7:41"},"3":{p:35,k:4,b:"7:42",e:"7:47"}},alt:{"1":{p:35,k:4,b:"7:36",e:"7:38"},"2":{p:35,k:4,b:"7:39",e:"7:41"},"3":{p:35,k:4,b:"7:36",e:"7:41"}}},"Chanukah Day 5 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:36",e:"7:41"}}},"Chanukah Day 6":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:5"},"2":{p:41,k:4,b:"28:6",e:"28:10"},"3":{p:41,k:4,b:"28:11",e:"28:15"},"4":{p:35,k:4,b:"7:42",e:"7:47"}}},"Chanukah Day 7":{fullkriyah:{"1":{p:35,k:4,b:"7:48",e:"7:50"},"2":{p:35,k:4,b:"7:51",e:"7:53"},"3":{p:35,k:4,b:"7:54",e:"7:59"}},alt:{"1":{p:35,k:4,b:"7:48",e:"7:50"},"2":{p:35,k:4,b:"7:51",e:"7:53"},"3":{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 7 (on Rosh Chodesh)":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:5"},"2":{p:41,k:4,b:"28:6",e:"28:10"},"3":{p:41,k:4,b:"28:11",e:"28:15"},"4":{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 7 (on Shabbat)":{haft:{k:"Zechariah",b:"2:14",e:"4:7"},fullkriyah:{M:{p:35,k:4,b:"7:48",e:"7:53"}}},"Chanukah Day 8":{fullkriyah:{"1":{p:35,k:4,b:"7:54",e:"7:56"},"2":{p:35,k:4,b:"7:57",e:"7:59"},"3":{p:35,k:4,b:"7:60",e:"8:4"}}},"Chanukah Day 8 (on Shabbat)":{haft:{k:"I Kings",b:"7:40",e:"7:50"},fullkriyah:{M:{p:35,k:4,b:"7:54",e:"8:4"}}},"Erev Purim":{megillah:"Esther"},Purim:Purim,"Shushan Purim":{note:"Jerusalem & walled cities only",il:true,megillah:"Esther",fullkriyah:{"1":{p:16,k:2,b:"17:8",e:"17:10"},"2":{p:16,k:2,b:"17:11",e:"17:13"},"3":{p:16,k:2,b:"17:14",e:"17:16"}}},"Shushan Purim (on Shabbat)":{il:true,note:"Jerusalem & walled cities only: special maftir Exodus 17:8-16, same Haftara as Shabbat Zachor"},"Shabbat HaChodesh":{haft:{k:"Ezekiel",b:"45:16",e:"46:18"},seph:{k:"Ezekiel",b:"45:18",e:"46:15"},fullkriyah:{M:{p:15,k:2,b:"12:1",e:"12:20"}}},"Shabbat HaChodesh (on Rosh Chodesh)":{haft:{k:"Ezekiel",b:"45:16",e:"46:18"},seph:{k:"Ezekiel",b:"45:18",e:"46:15"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:15,k:2,b:"12:1",e:"12:20"}}},"Shabbat HaGadol":{haft:{k:"Malachi",b:"3:4",e:"3:24"}},"Shabbat Parah":{haft:{k:"Ezekiel",b:"36:16",e:"36:38"},seph:{k:"Ezekiel",b:"36:16",e:"36:36"},fullkriyah:{M:{p:39,k:4,b:"19:1",e:"19:22"}}},"Shabbat Shekalim":{haft:{k:"II Kings",b:"12:1",e:"12:17"},seph:{k:"II Kings",b:"11:17",e:"12:17"},fullkriyah:{M:{p:21,k:2,b:"30:11",e:"30:16"}}},"Shabbat Shekalim (on Rosh Chodesh)":{haft:{k:"II Kings",b:"12:1",e:"12:17"},seph:{k:"II Kings",b:"11:17",e:"12:17"},fullkriyah:{"7":{p:41,k:4,b:"28:9",e:"28:15"},M:{p:21,k:2,b:"30:11",e:"30:16"}}},"Shabbat Shuva (with Vayeilech)":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"}]},"Shabbat Shuva (with Ha'azinu)":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Joel",b:"2:15",e:"2:27"}],seph:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"}]},"Shabbat Shuva":{haft:[{k:"Hosea",b:"14:2",e:"14:10"},{k:"Micah",b:"7:18",e:"7:20"},{k:"Joel",b:"2:15",e:"2:27"}]},"Shabbat Zachor":{haft:{k:"I Samuel",b:"15:2",e:"15:34"},seph:{k:"I Samuel",b:"15:1",e:"15:34"},fullkriyah:{M:{p:49,k:5,b:"25:17",e:"25:19"}}},"Pinchas occurring after 17 Tammuz":{haft:{k:"Jeremiah",b:"1:1",e:"2:3"}},"Kedoshim following Special Shabbat":{haft:{k:"Amos",b:"9:7",e:"9:15"},seph:{k:"Ezekiel",b:"20:2",e:"20:20"}},"Masei on Shabbat Rosh Chodesh":{haft:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"3:4",e:"3:4"}],seph:[{k:"Jeremiah",b:"2:4",e:"2:28"},{k:"Jeremiah",b:"4:1",e:"4:2"},{k:"Isaiah",b:"66:1",e:"66:1"},{k:"Isaiah",b:"66:23",e:"66:23"}],fullkriyah:{M:{p:41,k:4,b:"28:9",e:"28:15"}}},"Matot-Masei on Shabbat Rosh Chodesh":{alias:true,key:"Masei on Shabbat Rosh Chodesh"},"Ki Teitzei with 3rd Haftarah of Consolation":{haft:[{k:"Isaiah",b:"54:1",e:"54:10"},{k:"Isaiah",b:"54:11",e:"55:5"}]},"Rosh Chodesh":{fullkriyah:{"1":{p:41,k:4,b:"28:1",e:"28:3"},"2":{p:41,k:4,b:"28:3",e:"28:5"},"3":{p:41,k:4,b:"28:6",e:"28:10"},"4":{p:41,k:4,b:"28:11",e:"28:15"}}},"Rosh Chodesh Nisan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Iyyar":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Sivan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Tamuz":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Av":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Elul":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Tishrei":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Cheshvan":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Kislev":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Sh'vat":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar I":{alias:true,key:"Rosh Chodesh"},"Rosh Chodesh Adar II":{alias:true,key:"Rosh Chodesh"},"Shabbat Rosh Chodesh":{haft:{k:"Isaiah",b:"66:1",e:"66:24"},fullkriyah:{M:{p:41,k:4,b:"28:9",e:"28:15"}}},"Shabbat Machar Chodesh":{haft:{k:"I Samuel",b:"20:18",e:"20:42"}}};
1773
+
1774
+ const festivals = festivals0;
1775
+ /**
1776
+ * Is there a special festival Torah Reading for `holiday`?
1777
+ */
1778
+ function hasFestival(holiday) {
1779
+ return typeof festivals[holiday] === 'object';
1780
+ }
1781
+ function aliyotBookNumToStr(aliyot) {
1782
+ if (aliyot) {
1783
+ for (const aliyah of Object.values(aliyot)) {
1784
+ if (typeof aliyah.k === 'number') {
1785
+ aliyah.k = BOOK[aliyah.k];
1786
+ }
1787
+ }
1844
1788
  }
1845
- throw new TypeError(`Invalid units '${units}'`);
1846
1789
  }
1847
- function getDayOfTranslation(locale) {
1848
- switch (locale) {
1849
- case 'en':
1850
- case 's':
1851
- case 'a':
1852
- case 'ashkenazi':
1853
- return ' of';
1790
+ /**
1791
+ * Returns the raw metadata for festival reading for `holiday`
1792
+ */
1793
+ function lookupFestival(holiday) {
1794
+ let src = festivals[holiday];
1795
+ if (!src) {
1796
+ return undefined;
1854
1797
  }
1855
- const ofStr = Locale.lookupTranslation('of', locale);
1856
- if (ofStr) {
1857
- return ' ' + ofStr;
1798
+ if (src.alias) {
1799
+ const tmp = festivals[src.key];
1800
+ if (!tmp) {
1801
+ throw new Error(`Leyning alias ${holiday} => ${src.key} not found`);
1802
+ }
1803
+ src = tmp;
1858
1804
  }
1859
- if (locale.startsWith('ashkenazi')) {
1860
- return ' of';
1805
+ const result = src.fullkriyah
1806
+ ? structuredClone(src)
1807
+ : src;
1808
+ aliyotBookNumToStr(result.fullkriyah);
1809
+ aliyotBookNumToStr(result.alt);
1810
+ if (src.note) {
1811
+ result.note = src.note;
1861
1812
  }
1862
- return '';
1813
+ return result;
1863
1814
  }
1815
+
1864
1816
  /**
1865
- * Sets the day of the month of the date. Returns the object it was called upon
1866
1817
  * @private
1867
- * @param month A number, or Hebrew month name string
1868
1818
  */
1869
- function setMonth(hd, month) {
1870
- hd.mm = HDate.monthNum(month);
1871
- fix(hd);
1872
- return hd;
1873
- }
1874
- function setDate(hd, date) {
1875
- hd.dd = date;
1876
- fix(hd);
1877
- return hd;
1878
- }
1879
- function fix(hd) {
1880
- fixMonth(hd);
1881
- fixDate(hd);
1819
+ function isChapVerseBefore(a, b) {
1820
+ const cv1 = a.split(':').map(x => +x);
1821
+ const cv2 = b.split(':').map(x => +x);
1822
+ return cv1[0] * 100 + cv1[1] < cv2[0] * 100 + cv2[1];
1882
1823
  }
1883
- function fixDate(hd) {
1884
- if (hd.dd < 1) {
1885
- if (hd.mm === months.TISHREI) {
1886
- hd.yy -= 1;
1887
- }
1888
- hd.dd += daysInMonth(hd.mm, hd.yy);
1889
- hd.mm -= 1;
1890
- fix(hd);
1824
+ /**
1825
+ * Returns a string representation of the leyning parts.
1826
+ * Separate verse ranges read from the same book are separated
1827
+ * by commas, e.g. `Isaiah 6:1-7:6, 9:5-6`.
1828
+ * Verse ranges from different books are separated by semicolons,
1829
+ * e.g. `Genesis 21:1-34; Numbers 29:1-6`.
1830
+ */
1831
+ function makeSummaryFromParts(parts, language = 'en') {
1832
+ if (!Array.isArray(parts)) {
1833
+ parts = [parts];
1891
1834
  }
1892
- if (hd.dd > daysInMonth(hd.mm, hd.yy)) {
1893
- if (hd.mm === months.ELUL) {
1894
- hd.yy += 1;
1895
- }
1896
- hd.dd -= daysInMonth(hd.mm, hd.yy);
1897
- if (hd.mm === monthsInYear(hd.yy)) {
1898
- hd.mm = 1; // rollover to NISAN
1835
+ let prev = parts[0];
1836
+ let summary = formatAliyahShort(prev, true, language);
1837
+ for (let i = 1; i < parts.length; i++) {
1838
+ const part = parts[i];
1839
+ if (part.k === prev.k) {
1840
+ summary += ', ';
1899
1841
  }
1900
1842
  else {
1901
- hd.mm += 1;
1843
+ summary += `; ${locale.Locale.gettext(part.k, language)} `;
1902
1844
  }
1903
- fix(hd);
1845
+ summary += formatAliyahShort(part, false, language);
1846
+ prev = part;
1904
1847
  }
1905
- fixMonth(hd);
1848
+ return summary;
1906
1849
  }
1907
- function fixMonth(hd) {
1908
- if (hd.mm === months.ADAR_II && !hd.isLeapYear()) {
1909
- hd.mm -= 1; // to Adar I
1910
- fix(hd);
1911
- }
1912
- else if (hd.mm < 1) {
1913
- hd.mm += monthsInYear(hd.yy);
1914
- hd.yy -= 1;
1915
- fix(hd);
1916
- }
1917
- else if (hd.mm > monthsInYear(hd.yy)) {
1918
- hd.mm -= monthsInYear(hd.yy);
1919
- hd.yy += 1;
1920
- fix(hd);
1850
+ /**
1851
+ * Summarizes an `AliyotMap` by collapsing all adjacent aliyot.
1852
+ * Finds any non-overlapping parts (e.g. special 7th aliyah or maftir)
1853
+ */
1854
+ function makeLeyningParts(aliyot) {
1855
+ const nums = Object.keys(aliyot).filter(x => {
1856
+ if (x.length === 1) {
1857
+ return true;
1858
+ }
1859
+ const code = x.charCodeAt(0);
1860
+ return code >= 48 && code <= 57;
1861
+ });
1862
+ let start = aliyot[nums[0]];
1863
+ let end = start;
1864
+ const parts = [];
1865
+ for (let i = 0; i < nums.length; i++) {
1866
+ const num = nums[i];
1867
+ const aliyah = aliyot[num];
1868
+ if (i === nums.length - 1 && aliyah.k === end.k && aliyah.e === end.e) {
1869
+ // short-circuit when final aliyah is within the previous (e.g. M inside of 7)
1870
+ continue;
1871
+ }
1872
+ const prevEndChap = +end.e.split(':')[0];
1873
+ const curStartChap = +aliyah.b.split(':')[0];
1874
+ const sameOrNextChap = curStartChap === prevEndChap || curStartChap === prevEndChap + 1;
1875
+ if (i !== 0 &&
1876
+ (aliyah.k !== start.k ||
1877
+ isChapVerseBefore(aliyah.b, start.e) ||
1878
+ !sameOrNextChap)) {
1879
+ parts.push({ k: start.k, b: start.b, e: end.e });
1880
+ start = aliyah;
1881
+ }
1882
+ end = aliyah;
1921
1883
  }
1922
- delete hd.rd;
1884
+ parts.push({ k: start.k, b: start.b, e: end.e });
1885
+ return parts;
1923
1886
  }
1924
- function onOrBefore(day, t, offset) {
1925
- return new HDate(HDate.dayOnOrBefore(day, t.abs() + offset));
1887
+ /**
1888
+ * Makes a summary of the leyning, like "Genesis 6:9-11:32"
1889
+ */
1890
+ function makeLeyningSummary(aliyot) {
1891
+ const parts = makeLeyningParts(aliyot);
1892
+ return makeSummaryFromParts(parts);
1926
1893
  }
1927
1894
 
1928
1895
  const HOLIDAY_IGNORE_MASK = event.flags.DAF_YOMI |
@@ -1941,7 +1908,8 @@ const HOLIDAY_IGNORE_MASK = event.flags.DAF_YOMI |
1941
1908
  * @returns key to look up in holiday-reading.json
1942
1909
  */
1943
1910
  function getLeyningKeyForEvent(ev, il = false) {
1944
- if (typeof ev.eventTime !== 'undefined') {
1911
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1912
+ if (ev.eventTime !== undefined) {
1945
1913
  return undefined;
1946
1914
  }
1947
1915
  const mask = ev.getFlags();
@@ -1972,6 +1940,7 @@ function getLeyningKeyForEvent(ev, il = false) {
1972
1940
  if (day === 1 && month === months.TISHREI) {
1973
1941
  return isShabbat ? 'Rosh Hashana I (on Shabbat)' : 'Rosh Hashana I';
1974
1942
  }
1943
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1975
1944
  const cholHaMoedDay = ev.cholHaMoedDay;
1976
1945
  if (typeof cholHaMoedDay === 'number') {
1977
1946
  // Sukkot or Pesach
@@ -1991,6 +1960,7 @@ function getLeyningKeyForEvent(ev, il = false) {
1991
1960
  }
1992
1961
  return `${holiday} Chol ha-Moed Day ${cholHaMoedDay}`;
1993
1962
  }
1963
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1994
1964
  const chanukahDay = ev.chanukahDay;
1995
1965
  if (typeof chanukahDay === 'number') {
1996
1966
  if (isShabbat && isRoshChodesh) {
@@ -2060,8 +2030,37 @@ function getLeyningKeyForEvent(ev, il = false) {
2060
2030
  return undefined;
2061
2031
  }
2062
2032
 
2033
+ /**
2034
+ * Makes a deep copy of the src object using JSON stringify and parse
2035
+ * @deprecated Use structuredClone instead
2036
+ */
2037
+ function clone(src) {
2038
+ return structuredClone(src);
2039
+ }
2040
+ function cloneHaftara(haft) {
2041
+ if (!haft) {
2042
+ return haft;
2043
+ }
2044
+ const dest = structuredClone(haft);
2045
+ if (Array.isArray(dest)) {
2046
+ dest.forEach(calculateNumVerses);
2047
+ }
2048
+ else {
2049
+ calculateNumVerses(dest);
2050
+ }
2051
+ return dest;
2052
+ }
2053
+ /**
2054
+ * Returns the total number of verses in an array of Aliyah (or haftarah) objects
2055
+ */
2056
+ function sumVerses(aliyot) {
2057
+ return Array.isArray(aliyot)
2058
+ ? aliyot.reduce((prev, cur) => prev + cur.v, 0)
2059
+ : aliyot.v;
2060
+ }
2061
+
2063
2062
  function aliyotCombine67(aliyot) {
2064
- const a6 = clone(aliyot['6']);
2063
+ const a6 = structuredClone(aliyot['6']);
2065
2064
  const a7 = aliyot['7'];
2066
2065
  if (a6.k !== a7.k) {
2067
2066
  throw new Error('Impossible to combine aliyot 6 & 7: ' + JSON.stringify(aliyot));
@@ -2079,11 +2078,11 @@ function aliyotCombine67(aliyot) {
2079
2078
  function mergeAliyotWithSpecial(aliyot, special) {
2080
2079
  if (special['7']) {
2081
2080
  aliyotCombine67(aliyot);
2082
- aliyot['7'] = clone(special['7']);
2081
+ aliyot['7'] = structuredClone(special['7']);
2083
2082
  calculateNumVerses(aliyot['7']);
2084
2083
  }
2085
2084
  if (special['M']) {
2086
- aliyot['M'] = clone(special['M']);
2085
+ aliyot['M'] = structuredClone(special['M']);
2087
2086
  calculateNumVerses(aliyot['M']);
2088
2087
  }
2089
2088
  }
@@ -2122,7 +2121,7 @@ function specialReadings2(parsha, hd, il, aliyot) {
2122
2121
  }
2123
2122
  }
2124
2123
  if (special.fullkriyah) {
2125
- const aliyotMap = clone(aliyot);
2124
+ const aliyotMap = structuredClone(aliyot);
2126
2125
  mergeAliyotWithSpecial(aliyotMap, special.fullkriyah);
2127
2126
  for (const num of Object.keys(special.fullkriyah)) {
2128
2127
  reason[num] = key;
@@ -2192,18 +2191,120 @@ function specialReadings2(parsha, hd, il, aliyot) {
2192
2191
  return { aliyot, reason, haft, seph };
2193
2192
  }
2194
2193
 
2194
+ /**
2195
+ * Translates an aliyah's book name and verse numbers to the target language.
2196
+ * Modifies the aliyah object in place.
2197
+ * @param aliyah - The aliyah object to translate
2198
+ * @param language - The target language code (e.g., 'he' for Hebrew)
2199
+ * @param translateBook - Whether to translate the book name (default true)
2200
+ */
2201
+ function translateAliyah(aliyah, language) {
2202
+ if (language === 'he') {
2203
+ aliyah.k = locale.Locale.gettext(aliyah.k, language);
2204
+ aliyah.b = formatVerseToHebrew(aliyah.b);
2205
+ aliyah.e = formatVerseToHebrew(aliyah.e);
2206
+ }
2207
+ return aliyah;
2208
+ }
2209
+ /**
2210
+ * Translates aliyah(s) - handles single Aliyah, arrays, and AliyotMap.
2211
+ * For non-English languages, translates book names and converts verse numbers to Hebrew numerals.
2212
+ * Returns a new translated copy, leaving the original unchanged.
2213
+ * @param aliyahOrArray - Single Aliyah, array of Aliyah objects, AliyotMap, or undefined
2214
+ * @param language - The target language code (e.g., 'he' for Hebrew)
2215
+ * @param translateBook - Whether to translate the book name (default true)
2216
+ * @returns Translated copy of the input, or undefined if input was undefined
2217
+ */
2218
+ function translateAliyahOrArray(aliyahOrArray, language = 'en') {
2219
+ // Handle array of Aliyah objects
2220
+ if (Array.isArray(aliyahOrArray)) {
2221
+ const result = aliyahOrArray.map(aliyah => {
2222
+ const copy = Object.assign({}, aliyah);
2223
+ return translateAliyah(copy, language);
2224
+ });
2225
+ return result;
2226
+ }
2227
+ // Handle single Aliyah object (has 'k' or 'b' property)
2228
+ if ('k' in aliyahOrArray || 'b' in aliyahOrArray) {
2229
+ const copy = Object.assign({}, aliyahOrArray);
2230
+ return translateAliyah(copy, language);
2231
+ }
2232
+ // Handle AliyotMap (Record<string, Aliyah>)
2233
+ const result = {};
2234
+ for (const [key, aliyah] of Object.entries(aliyahOrArray)) {
2235
+ const copy = Object.assign({}, aliyah);
2236
+ result[key] = translateAliyah(copy, language);
2237
+ }
2238
+ return result;
2239
+ }
2240
+ /**
2241
+ * Translates a Leyning object to the target language.
2242
+ * @param leyning - The Leyning object to translate
2243
+ * @param language - The target language code (e.g., 'he' for Hebrew)
2244
+ * @returns The translated Leyning object
2245
+ * @example
2246
+ * const leyning: Leyning = {
2247
+ * seph: [{k: 'Genesis', b: '1:1', e: '1:5'}],
2248
+ * haft: [{k: 'Genesis', b: '1:6', e: '1:10'}],
2249
+ * megillah: [{k: 'Genesis', b: '1:11', e: '1:15'}],
2250
+ * fullkriyah: [{k: 'Genesis', b: '1:16', e: '1:20'}],
2251
+ * };
2252
+ * const translatedLeyning = translateLeyning(leyning, 'he');
2253
+ * @todo add reason translation
2254
+ */
2255
+ function translateLeyning(leyning, language) {
2256
+ if (language === 'en') {
2257
+ return leyning;
2258
+ }
2259
+ if (leyning.seph) {
2260
+ leyning.sephardic = makeSummaryFromParts(leyning.seph, language);
2261
+ leyning.seph = translateAliyahOrArray(leyning.seph, language);
2262
+ }
2263
+ if (leyning.haft) {
2264
+ leyning.haftara = makeSummaryFromParts(leyning.haft, language);
2265
+ leyning.haft = translateAliyahOrArray(leyning.haft, language);
2266
+ }
2267
+ if (leyning.megillah) {
2268
+ const parts = makeLeyningParts(leyning.megillah);
2269
+ const megillahSummary = makeSummaryFromParts(parts, language);
2270
+ leyning.megillah = translateAliyahOrArray(leyning.megillah, language);
2271
+ leyning.summary = megillahSummary;
2272
+ }
2273
+ if (leyning.fullkriyah) {
2274
+ const parts = makeLeyningParts(leyning.fullkriyah);
2275
+ // TODO: add check for summary in those cases getLeyningForHolidayKey
2276
+ if (typeof leyning.fullkriyah['1'] === 'object') {
2277
+ leyning.summary = makeSummaryFromParts(parts, language);
2278
+ }
2279
+ leyning.fullkriyah = translateAliyahOrArray(leyning.fullkriyah, language);
2280
+ if (leyning.summaryParts) {
2281
+ leyning.summaryParts = translateAliyahOrArray(leyning.summaryParts, language);
2282
+ leyning.summary = makeSummaryFromParts(leyning.summaryParts, language);
2283
+ }
2284
+ }
2285
+ if (leyning.weekday) {
2286
+ const parts = makeLeyningParts(leyning.weekday);
2287
+ leyning.weekday = translateAliyahOrArray(leyning.weekday, language);
2288
+ leyning.summary = makeSummaryFromParts(parts, language);
2289
+ }
2290
+ return leyning;
2291
+ }
2292
+
2195
2293
  /**
2196
2294
  * Looks up leyning for a given holiday key. Key should be an
2197
2295
  * (untranslated) string used in holiday-readings.json. Returns some
2198
2296
  * of full kriyah aliyot, special Maftir, special Haftarah
2199
2297
  * @param key name from `holiday-readings.json` to find
2298
+ * @param cholHaMoedDay
2299
+ * @param il true if Israel holiday scheme
2300
+ * @param language language for summary (default 'en')
2200
2301
  */
2201
- function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
2302
+ function getLeyningForHolidayKey(key, cholHaMoedDay, il, language = 'en') {
2202
2303
  if (typeof key !== 'string') {
2203
2304
  return undefined;
2204
2305
  }
2205
2306
  const src = lookupFestival(key);
2206
- if (typeof src === 'undefined') {
2307
+ if (!src) {
2207
2308
  return undefined;
2208
2309
  }
2209
2310
  const israelOnly = src.il;
@@ -2220,7 +2321,7 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
2220
2321
  type: 'holiday',
2221
2322
  };
2222
2323
  if (src.fullkriyah) {
2223
- leyning.fullkriyah = clone(src.fullkriyah);
2324
+ leyning.fullkriyah = structuredClone(src.fullkriyah);
2224
2325
  if (key === 'Sukkot Shabbat Chol ha-Moed' && cholHaMoedDay) {
2225
2326
  leyning.fullkriyah['M'] = leyning.fullkriyah[`M-day${cholHaMoedDay}`];
2226
2327
  for (let day = 1; day <= 5; day++) {
@@ -2234,7 +2335,7 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
2234
2335
  }
2235
2336
  Object.values(leyning.fullkriyah).forEach(aliyah => calculateNumVerses(aliyah));
2236
2337
  if (src.alt) {
2237
- leyning.alt = clone(src.alt);
2338
+ leyning.alt = structuredClone(src.alt);
2238
2339
  for (const aliyah of Object.values(leyning.alt)) {
2239
2340
  calculateNumVerses(aliyah);
2240
2341
  }
@@ -2273,20 +2374,23 @@ function getLeyningForHolidayKey(key, cholHaMoedDay, il) {
2273
2374
  if (src.note) {
2274
2375
  leyning.note = src.note;
2275
2376
  }
2276
- return leyning;
2377
+ return translateLeyning(leyning, language);
2277
2378
  }
2278
2379
  /**
2279
2380
  * Looks up leyning for a given holiday. Returns some
2280
2381
  * of full kriyah aliyot, special Maftir, special Haftarah
2281
2382
  * @param ev the Hebcal event associated with this leyning
2282
2383
  * @param [il] true if Israel holiday scheme
2384
+ * @param [language] language for summary (default 'en')
2283
2385
  * @returns map of aliyot
2284
2386
  */
2285
- function getLeyningForHoliday(ev, il = false) {
2387
+ function getLeyningForHoliday(ev, il = false, language = 'en') {
2286
2388
  if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
2287
2389
  throw new TypeError(`Bad event argument: ${JSON.stringify(ev)}`);
2390
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2288
2391
  }
2289
- else if (typeof ev.eventTime !== 'undefined') {
2392
+ else if (ev.eventTime !== undefined) {
2393
+ // Events with eventTime are not supported for leyning lookup
2290
2394
  return undefined;
2291
2395
  }
2292
2396
  else if (ev.getFlags() & event.flags.PARSHA_HASHAVUA) {
@@ -2296,7 +2400,8 @@ function getLeyningForHoliday(ev, il = false) {
2296
2400
  return undefined;
2297
2401
  }
2298
2402
  const key = getLeyningKeyForEvent(ev, il);
2299
- const leyning = getLeyningForHolidayKey(key, ev.cholHaMoedDay, il);
2403
+ const leyning = getLeyningForHolidayKey(key, ev.cholHaMoedDay, // eslint-disable-line @typescript-eslint/no-explicit-any
2404
+ il, language);
2300
2405
  return leyning;
2301
2406
  }
2302
2407
 
@@ -2337,7 +2442,7 @@ function makeLeyningNames(parsha) {
2337
2442
  * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
2338
2443
  * @returns map of aliyot
2339
2444
  */
2340
- function getLeyningForParshaShabbatOnly(parsha) {
2445
+ function getLeyningForParshaShabbatOnly(parsha, language = 'en') {
2341
2446
  const raw = lookupParsha(parsha);
2342
2447
  const fullkriyah = {};
2343
2448
  const book = BOOK[raw.book];
@@ -2379,13 +2484,13 @@ function getLeyningForParshaShabbatOnly(parsha) {
2379
2484
  result.sephardic = makeSummaryFromParts(seph);
2380
2485
  result.sephardicNumV = sumVerses(seph);
2381
2486
  }
2382
- return result;
2487
+ return translateLeyning(result, language);
2383
2488
  }
2384
2489
  /**
2385
2490
  * Looks up Monday/Thursday aliyot for a regular parsha
2386
2491
  * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
2387
2492
  */
2388
- function getWeekdayReading(parsha) {
2493
+ function getWeekdayReading(parsha, language = 'en') {
2389
2494
  const raw = lookupParsha(parsha);
2390
2495
  const parshaMeta = raw.combined ? lookupParsha(raw.p1) : raw;
2391
2496
  const aliyot = parshaMeta.weekday;
@@ -2401,14 +2506,14 @@ function getWeekdayReading(parsha) {
2401
2506
  calculateNumVerses(aliyah);
2402
2507
  weekday[num] = aliyah;
2403
2508
  }
2404
- return weekday;
2509
+ return translateAliyahOrArray(weekday, language);
2405
2510
  }
2406
2511
  /**
2407
2512
  * Looks up regular leyning for a weekly parsha with no special readings
2408
2513
  * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
2409
2514
  */
2410
- function getLeyningForParsha(parsha) {
2411
- const result = getLeyningForParshaShabbatOnly(parsha);
2515
+ function getLeyningForParsha(parsha, language = 'en') {
2516
+ const result = getLeyningForParshaShabbatOnly(parsha, language);
2412
2517
  result.weekday = getWeekdayReading(parsha);
2413
2518
  return result;
2414
2519
  }
@@ -2419,7 +2524,7 @@ function getLeyningForParsha(parsha) {
2419
2524
  * @param [il] in Israel
2420
2525
  * @returns map of aliyot
2421
2526
  */
2422
- function getLeyningForParshaHaShavua(ev, il = false) {
2527
+ function getLeyningForParshaHaShavua(ev, il = false, language = 'en') {
2423
2528
  if (typeof ev !== 'object' || typeof ev.getFlags !== 'function') {
2424
2529
  throw new TypeError(`Bad event argument: ${ev}`);
2425
2530
  }
@@ -2427,7 +2532,7 @@ function getLeyningForParshaHaShavua(ev, il = false) {
2427
2532
  throw new TypeError(`Event must be parsha hashavua: ${ev.getDesc()}`);
2428
2533
  }
2429
2534
  // first, collect the default aliyot and haftara
2430
- const parsha = ev.parsha;
2535
+ const parsha = ev.p.parsha;
2431
2536
  const result = getLeyningForParshaShabbatOnly(parsha);
2432
2537
  const hd = ev.getDate();
2433
2538
  // Now, check for special maftir or haftara on same date
@@ -2456,30 +2561,35 @@ function getLeyningForParshaHaShavua(ev, il = false) {
2456
2561
  }
2457
2562
  const reasons = Object.keys(reason);
2458
2563
  if (reasons.length !== 0) {
2459
- result.reason = reason;
2564
+ // Translate reason strings to target language if not English
2565
+ const translatedReason = {};
2566
+ for (const [key, val] of Object.entries(reason)) {
2567
+ translatedReason[key] = locale.Locale.gettext(val, language);
2568
+ }
2569
+ result.reason = translatedReason;
2460
2570
  for (const num of reasons) {
2461
2571
  if (num === 'haftara' || num === 'sephardic') {
2462
2572
  const haftObj = result[num === 'haftara' ? 'haft' : 'seph'];
2463
2573
  const hafts = Array.isArray(haftObj) ? haftObj : [haftObj];
2464
2574
  for (const haft of hafts) {
2465
- haft.reason = reason[num];
2575
+ haft.reason = translatedReason[num];
2466
2576
  }
2467
2577
  }
2468
2578
  else {
2469
2579
  const aliyah = result.fullkriyah[num];
2470
2580
  if (typeof aliyah === 'object') {
2471
- aliyah.reason = reason[num];
2581
+ aliyah.reason = translatedReason[num];
2472
2582
  }
2473
2583
  }
2474
2584
  }
2475
2585
  }
2476
- return result;
2586
+ return translateLeyning(result, language);
2477
2587
  }
2478
2588
  /**
2479
2589
  * Returns the parsha metadata
2480
2590
  * @param parsha untranslated name like 'Pinchas' or ['Pinchas'] or ['Matot','Masei']
2481
2591
  */
2482
- function lookupParsha(parsha) {
2592
+ function lookupParsha(parsha, language = 'en') {
2483
2593
  const name = parshaToString(parsha);
2484
2594
  const raw = parshiyotObj[name];
2485
2595
  if (typeof raw !== 'object') {
@@ -2492,12 +2602,16 @@ function lookupParsha(parsha) {
2492
2602
  }
2493
2603
  if (!raw.haft) {
2494
2604
  const haftKey = p1 === 'Nitzavim' ? p1 : p2;
2495
- raw.haft = lookupParsha(haftKey).haft;
2605
+ raw.haft = lookupParsha(haftKey, language).haft;
2496
2606
  }
2497
2607
  }
2498
2608
  else {
2499
2609
  raw.hebrew = locale.Locale.gettext(name, 'he');
2500
2610
  }
2611
+ raw.haft = translateAliyahOrArray(raw.haft, language);
2612
+ if (raw.seph) {
2613
+ raw.seph = translateAliyahOrArray(raw.seph, language);
2614
+ }
2501
2615
  return raw;
2502
2616
  }
2503
2617
 
@@ -2521,6 +2635,7 @@ function findParshaHaShavua(saturday, il) {
2521
2635
  chag: false,
2522
2636
  num: 54,
2523
2637
  hdate: saturday,
2638
+ il,
2524
2639
  };
2525
2640
  }
2526
2641
  }
@@ -2537,7 +2652,7 @@ function findParshaHaShavua(saturday, il) {
2537
2652
  /* NOTREACHED */
2538
2653
  throw new Error(`can't findParshaHaShavua for ${saturday}/${il}`);
2539
2654
  }
2540
- function getLeyningOnDate(hdate, il, wantarray = false) {
2655
+ function getLeyningOnDate(hdate, il, wantarray = false, language = 'en') {
2541
2656
  const dow = hdate.getDay();
2542
2657
  const arr = [];
2543
2658
  let hasParshaHaShavua = false;
@@ -2546,8 +2661,8 @@ function getLeyningOnDate(hdate, il, wantarray = false) {
2546
2661
  const sedra$1 = sedra.getSedra(hyear, il);
2547
2662
  const parsha = sedra$1.lookup(hdate);
2548
2663
  if (!parsha.chag) {
2549
- const parshaEvent = new ParshaEvent.ParshaEvent(hdate, parsha.parsha, il);
2550
- const reading = getLeyningForParshaHaShavua(parshaEvent, il);
2664
+ const parshaEvent = new ParshaEvent.ParshaEvent(parsha);
2665
+ const reading = getLeyningForParshaHaShavua(parshaEvent, il, language);
2551
2666
  if (wantarray) {
2552
2667
  hasParshaHaShavua = true;
2553
2668
  arr.push(reading);
@@ -2605,7 +2720,14 @@ function getLeyningOnDate(hdate, il, wantarray = false) {
2605
2720
  };
2606
2721
  arr.unshift(reading);
2607
2722
  }
2608
- return wantarray ? arr : arr[0];
2723
+ // call translateLeyning on arr or arr[0]
2724
+ if (arr.length === 0) {
2725
+ return wantarray ? arr : arr[0];
2726
+ }
2727
+ if (wantarray) {
2728
+ return arr.map(reading => translateLeyning(reading, language));
2729
+ }
2730
+ return translateLeyning(arr[0], language);
2609
2731
  }
2610
2732
  const minchaSuffix = ' (Mincha)';
2611
2733
  function getMincha(ev, il) {