UNPKG

jcal-zmanim

Version:

A very complete JavaScript library for the Jewish Calendar, Zmanim, Holidays, and daily Shul notes.

3,030 lines 341 kB
// src/JCal/Sedra.ts function _array_like_to_array(arr, len) { if (len == null || len > arr.length) len = arr.length; for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; return arr2; } function _array_without_holes(arr) { if (Array.isArray(arr)) return _array_like_to_array(arr); } function _class_call_check(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for(var i = 0; i < props.length; i++){ var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _create_class(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _define_property(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _iterable_to_array(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _non_iterable_spread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _object_spread(target) { for(var i = 1; i < arguments.length; i++){ var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { _define_property(target, key, source[key]); }); } return target; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _object_spread_props(target, source) { source = source != null ? source : {}; if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _to_consumable_array(arr) { return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread(); } function _type_of(obj) { "@swc/helpers - typeof"; return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } function _unsupported_iterable_to_array(o, minLen) { if (!o) return; if (typeof o === "string") return _array_like_to_array(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); } var _Sedra = /*#__PURE__*/ function() { "use strict"; function _Sedra(jd, israel2) { _class_call_check(this, _Sedra); if (jd.Month === 7 && jd.Day >= 15 && jd.Day < (israel2 ? 23 : 24)) { this.sedras = [ _Sedra.sedraList[53] ]; return; } var sedraArray = [], sedraOrder = _Sedra.getSedraOrder(jd.Year, israel2), absDate = jd.Abs, index, weekNum; absDate = _Sedra.getDayOnOrBefore(6, absDate + 6); weekNum = (absDate - sedraOrder.firstSatInYear) / 7; if (sedraOrder.sedraArray && weekNum >= sedraOrder.sedraArray.length) { var indexLast = sedraOrder.sedraArray[sedraOrder.sedraArray.length - 1]; if (indexLast < 0) { index = -indexLast + 2; } else { index = indexLast + 1; } } else { index = sedraOrder.sedraArray ? sedraOrder.sedraArray[weekNum] : -1; } if (index >= 0) { sedraArray = [ _Sedra.sedraList[index] ]; } else { var i = -index; sedraArray = [ _Sedra.sedraList[i], _Sedra.sedraList[i + 1] ]; } this.sedras = sedraArray; } _create_class(_Sedra, [ { /** * Gets the sedra/s as a string. If there are two, they are seperated by a " - " */ key: "toString", value: function toString() { return this.sedras.length > 0 && this.sedras.map(function(s) { return s.eng; }).join(" - "); } }, { /** * Gets the sedra/s as a string. If there are two, they are seperated by a " - " */ key: "toStringHeb", value: function toStringHeb() { return this.sedras.length > 0 && this.sedras.map(function(s) { return s.heb; }).join(" - "); } } ], [ { key: "getDayOnOrBefore", value: function getDayOnOrBefore(day_of_week, date) { return date - (date - day_of_week) % 7; } }, { key: "getSedraOrder", value: function getSedraOrder(year, israel2) { if (_Sedra.lastCalculatedYear != null && _Sedra.lastCalculatedYear.year === year && _Sedra.lastCalculatedYear.israel === israel2) { return _Sedra.lastCalculatedYear; } var longCheshvon = jDate.isLongCheshvan(year), shortKislev = jDate.isShortKislev(year), roshHashana = jDate.absJd(year, 7, 1), roshHashanaDOW = Math.abs(roshHashana % 7), firstSatInYear = _Sedra.getDayOnOrBefore(6, roshHashana + 6); var yearType, sArray; if (longCheshvon && !shortKislev) yearType = "complete"; else if (!longCheshvon && shortKislev) yearType = "incomplete"; else yearType = "regular"; if (!jDate.isJdLeapY(year)) { switch(roshHashanaDOW){ case 6: if (yearType === "incomplete") { sArray = _Sedra.shabbos_short; } else if (yearType === "complete") { sArray = _Sedra.shabbos_long; } break; case 1: if (yearType === "incomplete") { sArray = _Sedra.mon_short; } else if (yearType === "complete") { sArray = israel2 ? _Sedra.mon_short : _Sedra.mon_long; } break; case 2: if (yearType === "regular") { sArray = israel2 ? _Sedra.mon_short : _Sedra.mon_long; } break; case 4: if (yearType === "regular") { sArray = israel2 ? _Sedra.thu_normal_Israel : _Sedra.thu_normal; } else if (yearType === "complete") { sArray = _Sedra.thu_long; } break; default: throw "improper sedra year type calculated."; } } else { switch(roshHashanaDOW){ case 6: if (yearType === "incomplete") { sArray = _Sedra.shabbos_short_leap; } else if (yearType === "complete") { sArray = israel2 ? _Sedra.shabbos_short_leap : _Sedra.shabbos_long_leap; } break; case 1: if (yearType === "incomplete") { sArray = israel2 ? _Sedra.mon_short_leap_Israel : _Sedra.mon_short_leap; } else if (yearType === "complete") { sArray = israel2 ? _Sedra.mon_long_leap_Israel : _Sedra.mon_long_leap; } break; case 2: if (yearType === "regular") { sArray = israel2 ? _Sedra.mon_long_leap_Israel : _Sedra.mon_long_leap; } break; case 4: if (yearType === "incomplete") { sArray = _Sedra.thu_short_leap; } else if (yearType === "complete") { sArray = _Sedra.thu_long_leap; } break; default: throw "improper sedra year type calculated."; } } var retobj = { firstSatInYear: firstSatInYear, sedraArray: sArray, year: year, israel: israel2 }; _Sedra.lastCalculatedYear = retobj; return retobj; } } ]); return _Sedra; }(); _Sedra.lastCalculatedYear = null; _Sedra.sedraList = [ { eng: "Bereshis", heb: "\u05D1\u05E8\u05D0\u05E9\u05D9\u05EA" }, { eng: "Noach", heb: "\u05E0\u05D7" }, { eng: "Lech-Lecha", heb: "\u05DC\u05DA \u05DC\u05DA" }, { eng: "Vayera", heb: "\u05D5\u05D9\u05E8\u05D0" }, { eng: "Chayei Sara", heb: "\u05D7\u05D9\u05D9 \u05E9\u05E8\u05D4" }, { eng: "Toldos", heb: "\u05EA\u05D5\u05DC\u05D3\u05D5\u05EA" }, { eng: "Vayetzei", heb: "\u05D5\u05D9\u05E6\u05D0" }, { eng: "Vayishlach", heb: "\u05D5\u05D9\u05E9\u05DC\u05D7" }, { eng: "Vayeishev", heb: "\u05D5\u05D9\u05E9\u05D1" }, { eng: "Mikeitz", heb: "\u05DE\u05E7\u05E5" }, { eng: "Vayigash", heb: "\u05D5\u05D9\u05D2\u05E9" }, { eng: "Vayechi", heb: "\u05D5\u05D9\u05D7\u05D9" }, { eng: "Shemos", heb: "\u05E9\u05DE\u05D5\u05EA" }, { eng: "Va'era", heb: "\u05D5\u05D0\u05E8\u05D0" }, { eng: "Bo", heb: "\u05D1\u05D0" }, { eng: "Beshalach", heb: "\u05D1\u05E9\u05DC\u05D7" }, { eng: "Yisro", heb: "\u05D9\u05EA\u05E8\u05D5" }, { eng: "Mishpatim", heb: "\u05DE\u05E9\u05E4\u05D8\u05D9\u05DD" }, { eng: "Terumah", heb: "\u05EA\u05E8\u05D5\u05DE\u05D4" }, { eng: "Tetzaveh", heb: "\u05EA\u05E6\u05D5\u05D4" }, { eng: "Ki Sisa", heb: "\u05DB\u05D9 \u05EA\u05E9\u05D0" }, { eng: "Vayakhel", heb: "\u05D5\u05D9\u05E7\u05D4\u05DC" }, { eng: "Pekudei", heb: "\u05E4\u05E7\u05D5\u05D3\u05D9" }, { eng: "Vayikra", heb: "\u05D5\u05D9\u05E7\u05E8\u05D0" }, { eng: "Tzav", heb: "\u05E6\u05D5" }, { eng: "Shmini", heb: "\u05E9\u05DE\u05D9\u05E0\u05D9" }, { eng: "Tazria", heb: "\u05EA\u05D6\u05E8\u05D9\u05E2" }, { eng: "Metzora", heb: "\u05DE\u05E6\u05D5\u05E8\u05E2" }, { eng: "Achrei Mos", heb: "\u05D0\u05D7\u05E8\u05D9 \u05DE\u05D5\u05EA" }, { eng: "Kedoshim", heb: "\u05E7\u05D3\u05D5\u05E9\u05D9\u05DD" }, { eng: "Emor", heb: "\u05D0\u05DE\u05D5\u05E8" }, { eng: "Behar", heb: "\u05D1\u05D4\u05E8" }, { eng: "Bechukosai", heb: "\u05D1\u05D7\u05E7\u05D5\u05EA\u05D9" }, { eng: "Bamidbar", heb: "\u05D1\u05DE\u05D3\u05D1\u05E8" }, { eng: "Nasso", heb: "\u05E0\u05E9\u05D0" }, { eng: "Beha'aloscha", heb: "\u05D1\u05D4\u05E2\u05DC\u05EA\u05DA" }, { eng: "Sh'lach", heb: "\u05E9\u05DC\u05D7" }, { eng: "Korach", heb: "\u05E7\u05E8\u05D7" }, { eng: "Chukas", heb: "\u05D7\u05E7\u05EA" }, { eng: "Balak", heb: "\u05D1\u05DC\u05E7" }, { eng: "Pinchas", heb: "\u05E4\u05D9\u05E0\u05D7\u05E1" }, { eng: "Matos", heb: "\u05DE\u05D8\u05D5\u05EA" }, { eng: "Masei", heb: "\u05DE\u05E1\u05E2\u05D9" }, { eng: "Devarim", heb: "\u05D3\u05D1\u05E8\u05D9\u05DD" }, { eng: "Va'eschanan", heb: "\u05D5\u05D0\u05EA\u05D7\u05E0\u05DF" }, { eng: "Eikev", heb: "\u05E2\u05E7\u05D1" }, { eng: "Re'eh", heb: "\u05E8\u05D0\u05D4" }, { eng: "Shoftim", heb: "\u05E9\u05D5\u05E4\u05D8\u05D9\u05DD" }, { eng: "Ki Seitzei", heb: "\u05DB\u05D9 \u05EA\u05E6\u05D0" }, { eng: "Ki Savo", heb: "\u05DB\u05D9 \u05EA\u05D1\u05D0" }, { eng: "Nitzavim", heb: "\u05E0\u05E6\u05D1\u05D9\u05DD" }, { eng: "Vayeilech", heb: "\u05D5\u05D9\u05DC\u05DA" }, { eng: "Ha'Azinu", heb: "\u05D4\u05D0\u05D6\u05D9\u05E0\u05D5" }, { eng: "Vezos Habracha", heb: "\u05D5\u05D6\u05D0\u05EA \u05D4\u05D1\u05E8\u05DB\u05D4" } ]; _Sedra.shabbos_short = [ 52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.shabbos_long = [ 52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.mon_short = [ 51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.mon_long = [ 51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.thu_normal = [ 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.thu_normal_Israel = [ 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -21, 23, 24, 25, 25, -26, -28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.thu_long = [ 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, -26, -28, 30, -31, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.shabbos_short_leap = [ 52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.shabbos_long_leap = [ 52, 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.mon_short_leap = [ 51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, -38, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.mon_short_leap_Israel = [ 51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, -50 ]; _Sedra.mon_long_leap = [ 51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, -41, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.mon_long_leap_Israel = [ 51, 52, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.thu_short_leap = [ 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 ]; _Sedra.thu_long_leap = [ 52, 53, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, -50 ]; var Sedra = _Sedra; // src/JCal/PirkeiAvos.ts var _PirkeiAvos = /*#__PURE__*/ function() { "use strict"; function _PirkeiAvos() { _class_call_check(this, _PirkeiAvos); } _create_class(_PirkeiAvos, null, [ { key: "getPrakim", value: function getPrakim(jd, israel2) { if (jd.getDayOfWeek() !== 6) { return []; } var jMonth = jd.Month, jDay = jd.Day; if (jMonth === 1 && jDay > (israel2 ? 21 : 22) || //All Shabbosim through Iyar, Sivan, Tamuz, Av - besides for the day/s of Shavuos and Tisha B'Av jMonth > 1 && jMonth < 6 && !(jMonth === 3 && jDay === 6 || !israel2 && jMonth === 3 && jDay === 7) && !(jMonth === 5 && jDay === 9)) { return [ _PirkeiAvos._get1stPerek(jd, israel2) ]; } else if (jMonth === 6) { return _PirkeiAvos._ellul(jd, israel2); } else { return []; } } } ]); return _PirkeiAvos; }(); _PirkeiAvos._get1stPerek = function(jd, israel2) { var jYear = jd.Year, jMonth = jd.Month, jDay = jd.Day, pes1 = new jDate(jYear, 1, 15), shb1 = (israel2 ? 7 : 8) + (6 - pes1.getDayOfWeek()), cShb = jMonth === 1 && jDay === shb1 + 15 ? 1 : Utils.toInt((jd.Abs - (pes1.Abs + shb1)) / 7) + 1; var prk = cShb % 6; if (prk === 0) prk = 6; if (!israel2 && pes1.getDayOfWeek() === 4 && (jMonth > 3 || jMonth === 3 && jDay > 6)) { prk = prk === 1 ? 6 : prk - 1; } if (pes1.getDayOfWeek() === 6 && (jMonth > 5 || jMonth === 5 && jDay > 9)) { prk = prk === 1 ? 6 : prk - 1; } return prk; }; _PirkeiAvos._ellul = function(jd, israel2) { var prakim; var jYear = jd.Year, jDay = jd.Day, day1 = new jDate(jYear, 6, 1, jd.Abs - jd.Day + 1), day1DOW = day1.getDayOfWeek(), shabbos1Day = day1DOW === 6 ? 1 : 6 - (day1DOW + 6) % 6 + 1, shabbos1Date = new jDate(jYear, 6, shabbos1Day, day1.Abs + shabbos1Day - 1), cShb = jDay === shabbos1Day ? 1 : Utils.toInt((jDay - shabbos1Day) / 7) + 1; switch(_PirkeiAvos._get1stPerek(shabbos1Date, israel2)){ case 1: switch(cShb){ case 1: prakim = [ 1 ]; break; case 2: prakim = [ 2 ]; break; case 3: prakim = [ 3, 4 ]; break; case 4: prakim = [ 5, 6 ]; break; } break; case 2: switch(cShb){ case 1: prakim = [ 2 ]; break; case 2: prakim = [ 3 ]; break; case 3: prakim = [ 4 ]; break; case 4: prakim = [ 5, 6 ]; break; } break; case 3: switch(cShb){ case 1: prakim = [ 3 ]; break; case 2: prakim = [ 4 ]; break; case 3: prakim = [ 5 ]; break; case 4: prakim = [ 6 ]; break; } break; case 4: switch(cShb){ case 1: prakim = [ 4, 5 ]; break; case 2: prakim = [ 6, 1 ]; break; case 3: prakim = [ 2, 3 ]; break; case 4: prakim = [ 4, 5, 6 ]; break; } break; case 5: switch(cShb){ case 1: prakim = [ 5, 6 ]; break; case 2: prakim = [ 1, 2 ]; break; case 3: prakim = [ 3, 4 ]; break; case 4: prakim = [ 5, 6 ]; break; } break; case 6: switch(cShb){ case 1: prakim = [ 6 ]; break; case 2: prakim = [ 1, 2 ]; break; case 3: prakim = [ 3, 4 ]; break; case 4: prakim = [ 5, 6 ]; break; } break; } return prakim || []; }; var PirkeiAvos = _PirkeiAvos; // src/JCal/Dafyomi.ts var _Dafyomi = /*#__PURE__*/ function() { "use strict"; function _Dafyomi() { _class_call_check(this, _Dafyomi); } _create_class(_Dafyomi, null, [ { key: "getDaf", value: function getDaf(jdate) { var absoluteDate = jdate.Abs; var dafcnt = 40, cno, dno, osday, nsday, total, count, j, blatt; osday = jDate.absSd(new Date(1923, 8, 11)); nsday = jDate.absSd(new Date(1975, 5, 24)); if (absoluteDate < osday) return null; if (absoluteDate >= nsday) { cno = 8 + Utils.toInt((absoluteDate - nsday) / 2711); dno = (absoluteDate - nsday) % 2711; } else { cno = 1 + Utils.toInt((absoluteDate - osday) / 2702); dno = Utils.toInt((absoluteDate - osday) / 2702); } total = blatt = 0; count = -1; if (cno <= 7) _Dafyomi.masechtaList[4].daf = 13; else _Dafyomi.masechtaList[4].daf = 22; j = 0; while(j < dafcnt){ count++; total = total + _Dafyomi.masechtaList[j].daf - 1; if (dno < total) { blatt = _Dafyomi.masechtaList[j].daf + 1 - (total - dno); switch(count){ case 36: blatt = blatt + 21; break; case 37: blatt = blatt + 24; break; case 38: blatt = blatt + 33; break; default: break; } j = 1 + dafcnt; } j++; } return { masechet: _Dafyomi.masechtaList[count], daf: blatt }; } }, { key: "toString", value: // Returns the name of the Masechta and daf number in English, For example: Sukkah, Daf 3 function toString(jd) { var d = _Dafyomi.getDaf(jd); if (d !== null) { return d.masechet.eng + ", Daf " + d.daf.toString(); } } }, { key: "toStringHeb", value: //Returns the name of the Masechta and daf number in Hebrew. For example: 'סוכה דף כ. function toStringHeb(jd) { var d = _Dafyomi.getDaf(jd); if (d !== null) { return d.masechet.heb + " \u05D3\u05E3 " + Utils.toJewishNumber(d.daf); } } } ]); return _Dafyomi; }(); _Dafyomi.masechtaList = [ { eng: "Berachos", heb: "\u05D1\u05E8\u05DB\u05D5\u05EA", daf: 64 }, { eng: "Shabbos", heb: "\u05E9\u05D1\u05EA", daf: 157 }, { eng: "Eruvin", heb: "\u05E2\u05E8\u05D5\u05D1\u05D9\u05DF", daf: 105 }, { eng: "Pesachim", heb: "\u05E4\u05E1\u05D7\u05D9\u05DD", daf: 121 }, { eng: "Shekalim", heb: "\u05E9\u05E7\u05DC\u05D9\u05DD", daf: 22 }, { eng: "Yoma", heb: "\u05D9\u05D5\u05DE\u05D0", daf: 88 }, { eng: "Sukkah", heb: "\u05E1\u05D5\u05DB\u05D4", daf: 56 }, { eng: "Beitzah", heb: "\u05D1\u05D9\u05E6\u05D4", daf: 40 }, { eng: "Rosh Hashana", heb: "\u05E8\u05D0\u05E9 \u05D4\u05E9\u05E0\u05D4", daf: 35 }, { eng: "Taanis", heb: "\u05EA\u05E2\u05E0\u05D9\u05EA", daf: 31 }, { eng: "Megillah", heb: "\u05DE\u05D2\u05D9\u05DC\u05D4", daf: 32 }, { eng: "Moed Katan", heb: "\u05DE\u05D5\u05E2\u05D3 \u05E7\u05D8\u05DF", daf: 29 }, { eng: "Chagigah", heb: "\u05D7\u05D2\u05D9\u05D2\u05D4", daf: 27 }, { eng: "Yevamos", heb: "\u05D9\u05D1\u05DE\u05D5\u05EA", daf: 122 }, { eng: "Kesubos", heb: "\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA", daf: 112 }, { eng: "Nedarim", heb: "\u05E0\u05D3\u05E8\u05D9\u05DD", daf: 91 }, { eng: "Nazir", heb: "\u05E0\u05D6\u05D9\u05E8", daf: 66 }, { eng: "Sotah", heb: "\u05E1\u05D5\u05D8\u05D4", daf: 49 }, { eng: "Gitin", heb: "\u05D2\u05D9\u05D8\u05D9\u05DF", daf: 90 }, { eng: "Kiddushin", heb: "\u05E7\u05D3\u05D5\u05E9\u05D9\u05DF", daf: 82 }, { eng: "Baba Kamma", heb: "\u05D1\u05D1\u05D0 \u05E7\u05DE\u05D0", daf: 119 }, { eng: "Baba Metzia", heb: "\u05D1\u05D1\u05D0 \u05DE\u05E6\u05D9\u05E2\u05D0", daf: 119 }, { eng: "Baba Basra", heb: "\u05D1\u05D1\u05D0 \u05D1\u05EA\u05E8\u05D0", daf: 176 }, { eng: "Sanhedrin", heb: "\u05E1\u05E0\u05D4\u05D3\u05E8\u05D9\u05DF", daf: 113 }, { eng: "Makkot", heb: "\u05DE\u05DB\u05D5\u05EA", daf: 24 }, { eng: "Shevuot", heb: "\u05E9\u05D1\u05D5\u05E2\u05D5\u05EA", daf: 49 }, { eng: "Avodah Zarah", heb: "\u05E2\u05D1\u05D5\u05D3\u05D4 \u05D6\u05E8\u05D4", daf: 76 }, { eng: "Horayot", heb: "\u05D4\u05D5\u05E8\u05D9\u05D5\u05EA", daf: 14 }, { eng: "Zevachim", heb: "\u05D6\u05D1\u05D7\u05D9\u05DD", daf: 120 }, { eng: "Menachos", heb: "\u05DE\u05E0\u05D7\u05D5\u05EA", daf: 110 }, { eng: "Chullin", heb: "\u05D7\u05D5\u05DC\u05D9\u05DF", daf: 142 }, { eng: "Bechoros", heb: "\u05D1\u05DB\u05D5\u05E8\u05D5\u05EA", daf: 61 }, { eng: "Arachin", heb: "\u05E2\u05E8\u05DB\u05D9\u05DF", daf: 34 }, { eng: "Temurah", heb: "\u05EA\u05DE\u05D5\u05E8\u05D4", daf: 34 }, { eng: "Kerisos", heb: "\u05DB\u05E8\u05D9\u05EA\u05D5\u05EA", daf: 28 }, { eng: "Meilah", heb: "\u05DE\u05E2\u05D9\u05DC\u05D4", daf: 22 }, { eng: "Kinnim", heb: "\u05E7\u05E0\u05D9\u05DD", daf: 4 }, { eng: "Tamid", heb: "\u05EA\u05DE\u05D9\u05D3", daf: 10 }, { eng: "Midos", heb: "\u05DE\u05D3\u05D5\u05EA", daf: 4 }, { eng: "Niddah", heb: "\u05E0\u05D3\u05D4", daf: 73 } ]; var Dafyomi = _Dafyomi; // src/JCal/jDate.ts var JS_START_DATE_ABS = 719163; var MS_PER_DAY = 864e5; var JS_START_OFFSET = /* @__PURE__ */ new Date(0).getTimezoneOffset(); var yearTypes = [ { isLeapYear: false, dow: 5, isLongCheshvan: false, isLongKislev: true, daysInYear: 354 }, { isLeapYear: false, dow: 7, isLongCheshvan: true, isLongKislev: true, daysInYear: 355 }, { isLeapYear: false, dow: 2, isLongCheshvan: true, isLongKislev: true, daysInYear: 355 }, { isLeapYear: false, dow: 3, isLongCheshvan: false, isLongKislev: true, daysInYear: 354 }, { isLeapYear: false, dow: 7, isLongCheshvan: false, isLongKislev: false, daysInYear: 353 }, { isLeapYear: false, dow: 2, isLongCheshvan: false, isLongKislev: false, daysInYear: 353 }, { isLeapYear: false, dow: 5, isLongCheshvan: true, isLongKislev: true, daysInYear: 355 }, { isLeapYear: true, dow: 5, isLongCheshvan: true, isLongKislev: true, daysInYear: 385 }, { isLeapYear: true, dow: 2, isLongCheshvan: false, isLongKislev: false, daysInYear: 383 }, { isLeapYear: true, dow: 5, isLongCheshvan: false, isLongKislev: false, daysInYear: 383 }, { isLeapYear: true, dow: 7, isLongCheshvan: false, isLongKislev: false, daysInYear: 383 }, { isLeapYear: true, dow: 2, isLongCheshvan: true, isLongKislev: true, daysInYear: 385 }, { isLeapYear: true, dow: 7, isLongCheshvan: true, isLongKislev: true, daysInYear: 385 }, { isLeapYear: true, dow: 3, isLongCheshvan: false, isLongKislev: true, daysInYear: 384 } ]; var yearTypeList = [ 8, 0, 1, 7, 0, 8, 1, 0, 8, 1, 0, 7, 4, 1, 13, 1, 8, 0, 1, 7, 4, 0, 7, 1, 8, 0, 1, 7, 0, 4, 7, 0, 1, 8, 0, 7, 4, 0, 7, 1, 4, 13, 1, 8, 1, 0, 7, 1, 0, 8, 1, 0, 8, 1, 7, 0, 4, 7, 0, 1, 8, 0, 7, 4, 1, 13, 1, 4, 13, 1, 1, 8, 0, 7, 1, 0, 8, 1, 0, 8, 1, 7, 0, 4, 7, 0, 1, 8, 0, 1, 7, 4, 13, 1, 1, 8, 0, 1, 8, 0, 7, 1, 0, 8, 1, 0, 7, 4, 0, 7, 1, 8, 0, 1, 8, 0, 1, 7, 4, 13, 1, 1, 8, 0, 1, 7, 0, 4, 7, 0, 8, 1, 0, 7, 4, 1, 13, 1, 8, 0, 1, 8, 1, 0, 7, 1, 0, 8, 1, 8, 0, 1, 7, 0, 4, 7, 0, 8, 1, 0, 7, 4, 1, 13, 1, 4, 13, 1, 7, 4, 0, 7, 1, 0, 8, 1, 8, 0, 1, 7, 0, 4, 7, 0, 1, 8, 0, 7, 1, 4, 13, 1, 1, 8, 0, 7, 4, 0, 7, 1, 0, 8, 1, 0, 7, 4, 7, 0, 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 0, 1, 7, 0, 4, 7, 0, 8, 1, 0, 7, 4, 1, 13, 1, 4, 13, 1, 8, 1, 0, 7, 1, 0, 8, 1, 8, 0, 1, 7, 0, 4, 7, 0, 1, 8, 0, 7, 4, 1, 13, 1, 4, 13, 1, 7, 4, 0, 7, 1, 0, 8, 1, 0, 7, 4, 7, 0, 1, 8, 0, 1, 8, 0, 7, 1, 4, 13, 1, 1, 8, 0, 1, 7, 0, 8, 1, 0, 8, 1, 0, 7, 4, 7, 0, 1, 8, 0, 1, 8, 1, 0, 7, 4, 13, 1, 1, 8, 0, 1, 7, 0, 8, 1, 0, 8, 1, 0, 7 ]; var getElapsedDays = function(year) { var daysCounter = 0; var months = Utils.toInt(235 * Utils.toInt((year - 1) / 19) + // Leap months this cycle 12 * ((year - 1) % 19) + // Regular months in this cycle. (7 * ((year - 1) % 19) + 1) / 19), parts = 204 + 793 * (months % 1080), hours = 5 + 12 * months + 793 * Utils.toInt(months / 1080) + Utils.toInt(parts / 1080), conjDay = Utils.toInt(1 + 29 * months + hours / 24), conjParts = 1080 * (hours % 24) + parts % 1080; if (conjParts >= 19440 || conjDay % 7 === 2 && conjParts >= 9924 && !jDate.isJdLeapY(year) || conjDay % 7 === 1 && conjParts >= 16789 && jDate.isJdLeapY(year - 1)) { daysCounter = conjDay + 1; } else { daysCounter = conjDay; } if (Utils.has(daysCounter % 7, 0, 3, 5)) { daysCounter += 1; } return daysCounter; }; var _jDate = /*#__PURE__*/ function() { "use strict"; function _jDate(arg, month, day, abs) { _class_call_check(this, _jDate); this.Day = NaN; this.Month = NaN; this.Year = NaN; this.Abs = NaN; if (arguments.length === 0) { this.fromAbs(_jDate.absSd(/* @__PURE__ */ new Date())); } else if (_instanceof(arg, Date)) { if (Utils.isValidDate(arg)) { this.fromAbs(_jDate.absSd(arg)); } else { throw "jDate constructor: The given Date is not a valid javascript Date"; } } else if (Array.isArray(arg) && arg.length >= 3) { this.Day = arg[0]; this.Month = arg[1]; this.Year = arg[2]; this.Abs = arg.length > 3 && arg[3] || _jDate.absJd(this.Year, this.Month, this.Day); } else if (arg && Utils.isString(arg)) { var d = new Date(arg); if (Utils.isValidDate(d)) { this.fromAbs(_jDate.absSd(d)); } else { throw 'jDate constructor: The given string "' + arg + '" cannot be parsed into a Date'; } } else if (Utils.isNumber(arg)) { if (arguments.length === 1) { this.fromAbs(arg); } else { this.Year = arg; this.Month = month || 7; this.Day = day || 1; this.Abs = abs || _jDate.absJd(this.Year, this.Month, this.Day); } } else if ((typeof arg === "undefined" ? "undefined" : _type_of(arg)) === "object") { var argObj = arg; if (Utils.isNumber(argObj.year)) { this.Day = argObj.day || 1; this.Month = argObj.month || 7; this.Year = argObj.year; this.Abs = argObj.abs || _jDate.absJd(this.Year, this.Month, this.Day); } } } _create_class(_jDate, [ { /**Sets the current Jewish date from the given absolute date*/ key: "fromAbs", value: function fromAbs(absolute) { var ymd = _jDate.fromAbs(absolute); this.Year = ymd.year; this.Month = ymd.month; this.Day = ymd.day; this.Abs = absolute; } }, { /**Returns a valid javascript Date object that represents the Gregorian date that starts at midnight of the current Jewish date.*/ key: "getDate", value: function getDate() { return _jDate.sdFromAbs(this.Abs); } }, { /** * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6. */ key: "getDayOfWeek", value: function getDayOfWeek() { return Math.abs(this.Abs % 7); } }, { key: "DayOfWeek", get: /** * @returns {number} The day of the week for the current Jewish date. Sunday is 0 and Shabbos is 6 */ function get() { return this.getDayOfWeek(); } }, { /**Returns a new Jewish date represented by adding the given number of days to the current Jewish date.*/ key: "addDays", value: function addDays(days) { return new _jDate(this.Abs + days); } }, { /** * Returns a new Jewish date represented by adding the given number of * Jewish Months to the current Jewish date. * If the current Day is 30 and the new month only has 29 days, * the 29th day of the month is returned. * @param {number} months */ key: "addMonths", value: function addMonths(months) { var year = this.Year, month = this.Month, day = this.Day, miy = _jDate.monthsJYear(year); for(var i = 0; i < Math.abs(months); i++){ if (months > 0) { month += 1; if (month > miy) { month = 1; } if (month === 7) { year += 1; miy = _jDate.monthsJYear(year); } } else if (months < 0) { month -= 1; if (month === 0) { month = miy; } if (month === 6) { year -= 1; miy = _jDate.monthsJYear(year); } } }