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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 | 1x 1x 1x 1x 1x 12x 1x 11x 11x 11x 11x 1x 1x 1x 1x 1x 1x 1x 1x 5x 6x 1x 1x 6x 1x 331x 331x 332x 332x 332x 332x 332x 762x 332x 762x 332x 323x 323x 263x 323x 121x 121x 121x 109x 109x 12x 12x 121x 7x 114x 25x 89x 54x 35x 7x 28x 7x 21x 7x 14x 14x 121x 245x 245x 49x 1x 48x 1x 1x 70x 441x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 441x 439x 439x 439x 439x 439x 439x 439x 64x 375x 439x 439x 439x 1x 439x 15x 424x 319x 105x 44x 44x 61x 1x 60x 1x 1x 59x 59x 55x 55x 121x 6x 6x 4x 3x 1x 2x 1x 1x 4x 4x 2x 2x 2x 4x 4x 9021x 9021x 9021x 19x 19x 12x 7x 19x 66x 66x 31x 28x 3x 35x 23x 12x 39x 7x 1x 2x 6x 11x 372x 3x 371x 9x 371x 19x 352x 304x 48x 48x 48x 1145x 1145x 993x 951x 42x 42x 152x 1145x 3x 1x 1x 417x 3x 3x 414x 361x 9x 9x 352x 1x 9x 1x 323x 9x 9x 314x 99x 265x 18x 18x 247x 64x 226x 1x 1x 225x 63x 221x 1x 1x 220x 62x 62x 1x 1x 61x 187x 187x 27x 160x 160x 160x 52x 5x 16x 16x 16x 16x 16x 16x 16x 16x 16x 1x 15x 1x 14x 16x 1x 16x 24x 24x 10x 2x 3x 2x 2x 2x 2x 1x 16x 16x 2x 2x 2x 2x 3x 2x 2x 2x 2x 2x 1x 1x 1x 184x 11x 11x 173x 4x 4x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 11x 11x 1x 10x 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x 2x 2x 2x 2x 1x 1x 1x 9060x 45x 9060x 4x 9056x 42x 9014x 3008x 60x 60x 60x 36x 35x 17x 6x 3x 3x 24x 24x 24x 46x 154x 154x 154x 104x 50x 1x 49x 48x 1x 154x 154x 154x 154x 154x 154x 418x 331x 87x 570x 67x 2x 56x 11x 1x 11x 56x 1x 56x 8x 65x 1x 1x 1x 1x 3x 7x 39x 2x 1x 3x 3x 3x 3x 3x 3x 4x 59x 11x 6x 1x 1x 73x 2x 1x 3x 1x 2x 1x 2x 1x 4x 154x 100x 54x 54x 15x 15x 15x 15x 5x 1x 1x 5x 4x 4x 4x 4x 3x 4x 4x 15x 5x 5x 5x 10x 1x 1x 9x 1x 1x 8x 1x 1x 7x 2x 2x 5x 21x 21x 21x 21x 5x 1x 1x 5x 4x 4x 4x 4x 4x 2x 4x 21x 12x 12x 12x 9x 1x 1x 8x 1x 1x 7x 1x 1x 6x 1x 1x 5x 1x 1x 6x 6x 6x 4x 3x 1x 2x 1x 1x 56x 56x 56x 127x 127x 127x 128x 128x 128x 16x 112x 128x 1x 10x 1x 2x 1x 1x 1x 3x 2x 1x 1x 1x 1x 1x 19x 439x 1x 1x 1x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 1x 39538x 27082x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 5855x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 5532x 5532x 5532x 5532x 5532x 5532x 5532x 5532x 15435x 15435x 15435x 5532x 5532x 393x 393x 393x 393x 393x 393x 393x 393x 393x 393x 393x 393x 393x 393x 393x 1960x 1960x 1960x 1960x 1960x 1960x 1960x 5139x 5139x 1960x 1960x 1960x 435x 65x 202x 202x 202x 202x 202x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 454x 28x 426x 122x 304x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9513x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 9517x 61x 61x 61x 61x 61x 61x 9517x 393x 393x 393x 393x 393x 393x 9517x 9517x 9517x 9517x 169x 169x 169x 151x 169x 169x 169x 135x 169x 134x 169x 136x 169x 71x 169x 323x 323x 323x 323x 323x 323x 323x 323x 323x 323x 19x 19x 19x 19x 19x 19x 19x 7x 19x 4x 19x 4x 19x 19x 304x 303x 304x 302x 304x 304x 304x 178x 304x 161x 304x 158x 304x 42x 304x 1x 1x 14x 439x 1x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 1x 1111251x 83868x 104835x 209670x 209670x 691911x 36923x 19034x 41934x 41934x 41934x 41604x 416040x 416040x 41934x 41934x 41934x 41934x 41934x 41934x 41934x 41934x 41934x 41934x 41934x 41934x 209670x 41934x 41934x 2641842x 2641842x 13209210x 7002978x 2641842x 2641842x 41934x 41934x 41934x 20967x 20967x 20967x 103x 20864x 20864x 20454x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 103x 103x 20864x 20864x 20967x 20967x 20967x 20967x 20967x 20967x 503208x 503208x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 20967x 1x 1x 1x 1x 49x 1x 1x 1x 1x 1x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 1x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 439x 1x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 439x 1x 1x 424x 105x 439x | /*! * * persian-date - 0.3.1b * Reza Babakhani <babakhani.reza@gmail.com> * http://babakhani.github.io/PersianWebToolkit/docs/persian-date/ * Under WTFPL license * * */ (function webpackUniversalModuleDefinition(root, factory) { Eif(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["persianDate"] = factory(); else root["persianDate"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 8); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _createClass = 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; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var durationUnit = __webpack_require__(4).durationUnit; var Helpers = function () { function Helpers() { _classCallCheck(this, Helpers); } _createClass(Helpers, [{ key: 'toPersianDigit', /** * @description return converted string to persian digit * @param digit * @returns {string|*} */ value: function toPersianDigit(digit) { var latinDigit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return digit.toString().replace(/\d+/g, function (digit) { var enDigitArr = [], peDigitArr = [], i = void 0, j = void 0; for (i = 0; i < digit.length; i += 1) { enDigitArr.push(digit.charCodeAt(i)); } for (j = 0; j < enDigitArr.length; j += 1) { peDigitArr.push(String.fromCharCode(enDigitArr[j] + (!!latinDigit && latinDigit === true ? 1584 : 1728))); } return peDigitArr.join(''); }); } /** * @param number * @param targetLength * @returns {string} */ }, { key: 'leftZeroFill', value: function leftZeroFill(number, targetLength) { var output = number + ''; while (output.length < targetLength) { output = '0' + output; } return output; } /** * @description normalize duration params and return valid param * @return {{unit: *, value: *}} */ }, { key: 'normalizeDuration', value: function normalizeDuration() { var unit = void 0, value = void 0; if (typeof arguments[0] === 'string') { unit = arguments[0]; value = arguments[1]; } else { value = arguments[0]; unit = arguments[1]; } if (durationUnit.year.indexOf(unit) > -1) { unit = 'year'; } else if (durationUnit.month.indexOf(unit) > -1) { unit = 'month'; } else if (durationUnit.day.indexOf(unit) > -1) { unit = 'day'; } else if (durationUnit.hour.indexOf(unit) > -1) { unit = 'hour'; } else if (durationUnit.minute.indexOf(unit) > -1) { unit = 'minute'; } else if (durationUnit.second.indexOf(unit) > -1) { unit = 'second'; } else Eif (durationUnit.millisecond.indexOf(unit) > -1) { unit = 'millisecond'; } return { unit: unit, value: value }; } /** * * @param number * @returns {number} */ }, { key: 'absRound', value: function absRound(number) { Iif (number < 0) { return Math.ceil(number); } else { return Math.floor(number); } } }, { key: 'absFloor', value: function absFloor(number) { if (number < 0) { // -0 -> 0 return Math.ceil(number) || 0; } else { return Math.floor(number); } } // absCeil(number) { // if (number < 0) { // return Math.floor(number); // } else { // return Math.ceil(number); // } // } }]); return Helpers; }(); module.exports = Helpers; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _createClass = 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; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Eif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var TypeChecking = __webpack_require__(10); var Algorithms = __webpack_require__(2); var Helpers = __webpack_require__(0); var Duration = __webpack_require__(5); var toPersianDigit = new Helpers().toPersianDigit; var leftZeroFill = new Helpers().leftZeroFill; var normalizeDuration = new Helpers().normalizeDuration; var fa = __webpack_require__(7); var en = __webpack_require__(6); var PersianDateClass = function () { // static calendarType : 'persianAstro'; function PersianDateClass(input) { _classCallCheck(this, PersianDateClass); this.calendarType = PersianDateClass.calendarType; this.localType = PersianDateClass.localType; this.leapYearMode = PersianDateClass.leapYearMode; this.algorithms = new Algorithms(this); this.version = "0.3.1b"; this._utcMode = false; if (this.localType !== 'fa') { this.formatPersian = false; } else { this.formatPersian = '_default'; } this.setup(input); this.ON = this.algorithms.ON; return this; } _createClass(PersianDateClass, [{ key: 'setup', value: function setup(input) { // Convert Any thing to Gregorian Date if (TypeChecking.isDate(input)) { this._gDateToCalculators(input); } else if (TypeChecking.isArray(input)) { this.algorithmsCalc([input[0], input[1] ? input[1] : 1, input[2] ? input[2] : 1, input[3], input[4], input[5], input[6] ? input[6] : 0]); } else if (TypeChecking.isNumber(input)) { var fromUnix = new Date(input); this._gDateToCalculators(fromUnix); } // instance of pDate else if (input instanceof PersianDateClass) { this.algorithmsCalc([input.year(), input.month(), input.date(), input.hour(), input.minute(), input.second(), input.millisecond()]); } // ASP.NET JSON Date else if (input && input.substring(0, 6) === '/Date(') { var fromDotNet = new Date(parseInt(input.substr(6))); this._gDateToCalculators(fromDotNet); } else { var now = new Date(); this._gDateToCalculators(now); } } }, { key: '_getSyncedClass', value: function _getSyncedClass(input) { var syncedCelander = PersianDateClass.toCalendar(this.calendarType).toLocale(this.localType).toLeapYearMode(this.leapYearMode); return new syncedCelander(input); } }, { key: '_gDateToCalculators', value: function _gDateToCalculators(inputgDate) { this.algorithms.calcGregorian([inputgDate.getFullYear(), inputgDate.getMonth(), inputgDate.getDate(), inputgDate.getHours(), inputgDate.getMinutes(), inputgDate.getSeconds(), inputgDate.getMilliseconds()]); } }, { key: 'rangeName', value: function rangeName() { var t = this.calendarType; if (this.localType === 'fa') { if (t === 'persian') { return fa.persian; } else { return fa.gregorian; } } else { if (t === 'persian') { return en.persian; } else { return en.gregorian; } } } }, { key: 'toLeapYearMode', value: function toLeapYearMode(input) { this.leapYearMode = input; if (input === 'astronomical' && this.calendarType == 'persian') { this.leapYearMode = 'astronomical'; } else Eif (input === 'algorithmic' && this.calendarType == 'persian') { this.leapYearMode = 'algorithmic'; } this.algorithms.updateFromGregorian(); return this; } }, { key: 'toCalendar', value: function toCalendar(input) { this.calendarType = input; this.algorithms.updateFromGregorian(); return this; } }, { key: 'toLocale', value: function toLocale(input) { this.localType = input; if (this.localType !== 'fa') { this.formatPersian = false; } else { this.formatPersian = '_default'; } return this; } }, { key: '_locale', value: function _locale() { var t = this.calendarType; if (this.localType === 'fa') { if (t === 'persian') { return fa.persian; } else { return fa.gregorian; } } else { if (t === 'persian') { return en.persian; } else { return en.gregorian; } } } }, { key: '_weekName', value: function _weekName(input) { return this._locale().weekdays[input - 1]; } }, { key: '_weekNameShort', value: function _weekNameShort(input) { return this._locale().weekdaysShort[input - 1]; } }, { key: '_weekNameMin', value: function _weekNameMin(input) { return this._locale().weekdaysMin[input - 1]; } }, { key: '_dayName', value: function _dayName(input) { return this._locale().persianDaysName[input - 1]; } }, { key: '_monthName', value: function _monthName(input) { return this._locale().months[input - 1]; } }, { key: '_monthNameShort', value: function _monthNameShort(input) { return this._locale().monthsShort[input - 1]; } /** * * @param obj * @returns {boolean} */ }, { key: 'isPersianDate', value: function isPersianDate(obj) { return obj instanceof PersianDateClass; } /** * * @returns {PersianDate} */ }, { key: 'clone', value: function clone() { return this._getSyncedClass(this.ON.gDate); } }, { key: 'algorithmsCalc', value: function algorithmsCalc(dateArray) { if (this.isPersianDate(dateArray)) { dateArray = [dateArray.year(), dateArray.month(), dateArray.date(), dateArray.hour(), dateArray.minute(), dateArray.second(), dateArray.millisecond()]; } if (this.calendarType === 'persian' && this.leapYearMode == 'algorithmic') { return this.algorithms.calcPersian(dateArray); } else if (this.calendarType === 'persian' && this.leapYearMode == 'astronomical') { return this.algorithms.calcPersiana(dateArray); } else Eif (this.calendarType === 'gregorian') { dateArray[1] = dateArray[1] - 1; return this.algorithms.calcGregorian(dateArray); } } }, { key: 'calendar', value: function calendar() { var key = void 0; if (this.calendarType == 'persian') { if (this.leapYearMode == 'astronomical') { key = 'persianAstro'; } else Eif (this.leapYearMode == 'algorithmic') { key = 'persianAlgo'; } } else { key = 'gregorian'; } return this.ON[key]; } /** * @description return Duration object * @param input * @param key * @returns {Duration} */ }, { key: 'duration', /** * @description return Duration object * @param input * @param key * @returns {Duration} */ value: function duration(input, key) { return new Duration(input, key); } /** * @description check if passed object is duration * @param obj * @returns {boolean} */ }, { key: 'isDuration', /** * @description check if passed object is duration * @param obj * @returns {boolean} */ value: function isDuration(obj) { return obj instanceof Duration; } /** * * @param input * @returns {*} */ }, { key: 'years', value: function years(input) { return this.year(input); } /** * * @param input * @returns {*} */ }, { key: 'year', value: function year(input) { if (input || input === 0) { this.algorithmsCalc([input, this.month(), this.date(), this.hour(), this.minute(), this.second(), this.millisecond()]); return this; } else { return this.calendar().year; } } /** * * @param input * @returns {*} */ }, { key: 'month', value: function month(input) { if (input || input === 0) { this.algorithmsCalc([this.year(), input, this.date()]); return this; } else { return this.calendar().month + 1; } } /** * Day of week * @returns {Function|Date.toJSON.day|date_json.day|PersianDate.day|day|output.day|*} */ }, { key: 'days', value: function days() { return this.day(); } /** * * @returns {Function|Date.toJSON.day|date_json.day|PersianDate.day|day|output.day|*} */ }, { key: 'day', value: function day() { return this.calendar().weekday; } /** * Day of Months * @param input * @returns {*} */ }, { key: 'dates', value: function dates(input) { return this.date(input); } /** * * @param input * @returns {*} */ }, { key: 'date', value: function date(input) { if (input || input === 0) { this.algorithmsCalc([this.year(), this.month(), input]); return this; } else { return this.calendar().day; } } /** * * @param input * @returns {*} */ }, { key: 'hour', value: function hour(input) { return this.hours(input); } /** * * @param input * @returns {*} */ }, { key: 'hours', value: function hours(input) { if (input || input === 0) { this.algorithmsCalc([this.year(), this.month(), this.date(), input]); return this; } else { return this.ON.gDate.getHours(); } } /** * * @param input * @returns {*} */ }, { key: 'minute', value: function minute(input) { return this.minutes(input); } /** * * @param input * @returns {*} */ }, { key: 'minutes', value: function minutes(input) { if (input || input === 0) { this.algorithmsCalc([this.year(), this.month(), this.date(), this.hour(), input]); return this; } else { return this.ON.gDate.getMinutes(); } } /** * * @param input * @returns {*} */ }, { key: 'second', value: function second(input) { return this.seconds(input); } /** * * @param input * @returns {*} */ }, { key: 'seconds', value: function seconds(input) { if (input || input === 0) { this.algorithmsCalc([this.year(), this.month(), this.date(), this.hour(), this.minute(), input]); return this; } else { return this.ON.gDate.getSeconds(); } } /** * * @param input * @returns {*} * Getter Setter */ }, { key: 'millisecond', value: function millisecond(input) { return this.milliseconds(input); } /** * * @param input * @returns {*} */ }, { key: 'milliseconds', value: function milliseconds(input) { if (input || input === 0) { this.algorithmsCalc([this.year(), this.month(), this.date(), this.hour(), this.minute(), this.second(), input]); return this; } else { return this.ON.gregorian.millisecond; } } /** * Return Milliseconds since the Unix Epoch (1318874398806) * @returns {*} * @private */ // _valueOf () { // return this.ON.gDate.valueOf(); // } }, { key: 'unix', /** * Return Unix Timestamp (1318874398) * @param timestamp * @returns {*} */ value: function unix(timestamp) { var output = void 0; if (timestamp) { return this._getSyncedClass(timestamp * 1000); } else { var str = this.ON.gDate.valueOf().toString(); output = str.substring(0, str.length - 3); } return parseInt(output); } /** * * @returns {*} */ }, { key: 'valueOf', value: function valueOf() { return this.ON.gDate.valueOf(); } /** * * @param year * @param month * @returns {*} */ }, { key: 'getFirstWeekDayOfMonth', /** * * @param year * @param month * @returns {*} */ value: function getFirstWeekDayOfMonth(year, month) { return this._getSyncedClass([year, month, 1]).day(); } /** * * @param input * @param val * @param asFloat * @returns {*} */ }, { key: 'diff', value: function diff(input, val, asFloat) { var self = this, inputMoment = input, zoneDiff = 0, diff = self.ON.gDate - inputMoment.toDate() - zoneDiff, year = self.year() - inputMoment.year(), month = self.month() - inputMoment.month(), date = (self.date() - inputMoment.date()) * -1, output = void 0; if (val === 'months' || val === 'month') { output = year * 12 + month + date / 30; } else if (val === 'years' || val === 'year') { output = year + (month + date / 30) / 12; } else { output = val === 'seconds' || val === 'second' ? diff / 1e3 : // 1000 val === 'minutes' || val === 'minute' ? diff / 6e4 : // 1000 * 60 val === 'hours' || val === 'hour' ? diff / 36e5 : // 1000 * 60 * 60 val === 'days' || val === 'day' ? diff / 864e5 : // 1000 * 60 * 60 * 24 val === 'weeks' || val === 'week' ? diff / 6048e5 : // 1000 * 60 * 60 * 24 * 7 diff; } if (output < 0) { output = output * -1; } return asFloat ? output : Math.round(output); } /** * * @param key * @returns {*} */ }, { key: 'startOf', value: function startOf(key) { var syncedCelander = PersianDateClass.toCalendar(this.calendarType).toLocale(this.localType); // Simplify this\ /* jshint ignore:start */ switch (key) { case 'years': case 'year': return new syncedCelander([this.year(), 1, 1]); case 'months': case 'month': return new syncedCelander([this.year(), this.month(), 1]); case 'days': case 'day': return new syncedCelander([this.year(), this.month(), this.date(), 0, 0, 0]); case 'hours': case 'hour': return new syncedCelander([this.year(), this.month(), this.date(), this.hours(), 0, 0]); case 'minutes': case 'minute': return new syncedCelander([this.year(), this.month(), this.date(), this.hours(), this.minutes(), 0]); case 'seconds': case 'second': return new syncedCelander([this.year(), this.month(), this.date(), this.hours(), this.minutes(), this.seconds()]); case 'weeks': case 'week': return new syncedCelander([this.year(), this.month(), this.date() - (this.calendar().weekday - 1)]); default: return this.clone(); } /* jshint ignore:end */ } /** * * @param key * @returns {*} */ /* eslint-disable no-case-declarations */ }, { key: 'endOf', value: function endOf(key) { var syncedCelander = PersianDateClass.toCalendar(this.calendarType).toLocale(this.localType); // Simplify this switch (key) { case 'years': case 'year': var days = this.isLeapYear() ? 30 : 29; return new syncedCelander([this.year(), 12, days, 23, 59, 59]); case 'months': case 'month': var monthDays = this.daysInMonth(this.year(), this.month()); return new syncedCelander([this.year(), this.month(), monthDays, 23, 59, 59]); case 'days': case 'day': return new syncedCelander([this.year(), this.month(), this.date(), 23, 59, 59]); case 'hours': case 'hour': return new syncedCelander([this.year(), this.month(), this.date(), this.hours(), 59, 59]); case 'minutes': case 'minute': return new syncedCelander([this.year(), this.month(), this.date(), this.hours(), this.minutes(), 59]); case 'seconds': case 'second': return new syncedCelander([this.year(), this.month(), this.date(), this.hours(), this.minutes(), this.seconds()]); case 'weeks': case 'week': var weekDayNumber = this.calendar().weekday; return new syncedCelander([this.year(), this.month(), this.date() + (7 - weekDayNumber)]); default: return this.clone(); } /* eslint-enable no-case-declarations */ } /** * * @returns {*} */ }, { key: 'sod', value: function sod() { return this.startOf('day'); } /** * * @returns {*} */ }, { key: 'eod', value: function eod() { return this.endOf('day'); } /** Get the timezone offset in minutes. * @return {*} */ }, { key: 'zone', value: function zone(input) { if (input || input === 0) { this.ON.zone = input; return this; } else { return this.ON.zone; } } /** * * @returns {PersianDate} */ }, { key: 'local', value: function local() { var utcStamp = void 0; if (this._utcMode) { var ThatDayOffset = new Date(this.toDate()).getTimezoneOffset(); var offsetMils = ThatDayOffset * 60 * 1000; Eif (ThatDayOffset < 0) { utcStamp = this.valueOf() - offsetMils; } else { /* istanbul ignore next */ utcStamp = this.valueOf() + offsetMils; } this.toCalendar(PersianDateClass.calendarType); var utcDate = new Date(utcStamp); this._gDateToCalculators(utcDate); this._utcMode = false; this.zone(ThatDayOffset); return this; } else { return this; } } }, { key: 'utc', /** * Current date/time in UTC mode * @param input * @returns {*} */ value: function utc(input) { var utcStamp = void 0; if (input) { return this._getSyncedClass(input).utc(); } if (this._utcMode) { return this; } else { var offsetMils = this.zone() * 60 * 1000; Eif (this.zone() < 0) { utcStamp = this.valueOf() + offsetMils; } else { /* istanbul ignore next */ utcStamp = this.valueOf() - offsetMils; } var utcDate = new Date(utcStamp), d = this._getSyncedClass(utcDate); this.algorithmsCalc(d); this._utcMode = true; this.zone(0); return this; } } /** * * @returns {boolean} */ }, { key: 'isUtc', value: function isUtc() { return this._utcMode; } /** * * @returns {boolean} * version 0.0.1 */ }, { key: 'isDST', value: function isDST() { var month = this.month(), day = this.date(); if (month < 7) { return false; } else Eif (month === 7 && day >= 2 || month >= 7) { return true; } } /** * * @returns {boolean} */ }, { key: 'isLeapYear', value: function isLeapYear(year) { if (year === undefined) { year = this.year(); } if (this.calendarType == 'persian' && this.leapYearMode === 'algorithmic') { return this.algorithms.leap_persian(year); } if (this.calendarType == 'persian' && this.leapYearMode === 'astronomical') { return this.algorithms.leap_persiana(year); } else if (this.calendarType == 'gregorian') { return this.algorithms.leap_gregorian(year); } } /** * * @param yearInput * @param monthInput * @returns {number} */ }, { key: 'daysInMonth', value: function daysInMonth(yearInput, monthInput) { var year = yearInput ? yearInput : this.year(), month = monthInput ? monthInput : this.month(); if (this.calendarType === 'persian') { if (month < 1 || month > 12) return 0; if (month < 7) return 31; if (month < 12) return 30; if (this.isLeapYear(year)) { return 30; } return 29; } Eif (this.calendarType === 'gregorian') { return new Date(year, month, 0).getDate(); } } /** * Return Native Javascript Date * @returns {*|PersianDate.gDate} */ }, { key: 'toDate', value: function toDate() { return this.ON.gDate; } /** * Returns Array Of Persian Date * @returns {array} */ }, { key: 'toArray', value: function toArray() { return [this.year(), this.month(), this.date(), this.hour(), this.minute(), this.second(), this.millisecond()]; } /** * * @returns {*} */ }, { key: 'formatNumber', value: function formatNumber() { var output = void 0, self = this; // if default conf dosent set follow golbal config if (this.formatPersian === '_default') { Eif (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { /* istanbul ignore next */ if (self.formatPersian === false) { output = false; } else { // Default Conf output = true; } } /* istanbul ignore next */ else { if (window.formatPersian === false) { output = false; } else { // Default Conf output = true; } } } else { if (this.formatPersian === true) { output = true; } else if (this.formatPersian === false) { output = false; } else { Error('Invalid Config "formatPersian" !!'); } } return output; } /** * * @param inputString * @returns {*} */ }, { key: 'format', value: function format(inputString) { var self = this, formattingTokens = /([[^[]*])|(\\)?(Mo|MM?M?M?|Do|DD?D?D?|dddddd?|ddddd?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?|X|LT|ll?l?l?|LL?L?L?)/g, info = { year: self.year(), month: self.month(), hour: self.hours(), minute: self.minutes(), second: self.seconds(), date: self.date(), timezone: self.zone(), unix: self.unix() }, formatToPersian = self.formatNumber(); var checkPersian = function checkPersian(i) { if (formatToPersian) { return toPersianDigit(i); } else { return i; } }; /* jshint ignore:start */ function replaceFunction(input) { switch (input) { // AM/PM case 'a': { if (formatToPersian) return info.hour >= 12 ? 'ب ظ' : 'ق ظ';else return info.hour >= 12 ? 'PM' : 'AM'; } // Hours (Int) case 'H': { return checkPersian(info.hour); } case 'HH': { return checkPersian(leftZeroFill(info.hour, 2)); } case 'h': { return checkPersian(info.hour % 12); } case 'hh': { return checkPersian(leftZeroFill(info.hour % 12, 2)); } // Minutes case 'm': { return checkPersian(leftZeroFill(info.minute, 2)); } // Two Digit Minutes case 'mm': { return checkPersian(leftZeroFill(info.minute, 2)); } // Second case 's': { return checkPersian(info.second); } case 'ss': { return checkPersian(leftZeroFill(info.second, 2)); } // Day (Int) case 'D': { return checkPersian(leftZeroFill(info.date)); } // Return Two Digit case 'DD': { return checkPersian(leftZeroFill(info.date, 2)); } // Return day Of Month case 'DDD': { var t = self.startOf('year'); return checkPersian(leftZeroFill(self.diff(t, 'days'), 3)); } // Return Day of Year case 'DDDD': { var _t = self.startOf('year'); return checkPersian(leftZeroFill(self.diff(_t, 'days'), 3)); } // Return day Of week case 'd': { return checkPersian(self.calendar().weekday); } // Return week day name abbr case 'ddd': { return self._weekNameShort(self.calendar().weekday); } case 'dddd': { return self._weekName(self.calendar().weekday); } // Return Persian Day Name case 'ddddd': { return self._dayName(self.calendar().day); } // Return Persian Day Name case 'dddddd': { return self._weekNameMin(self.calendar().weekday); } // Return Persian Day Name case 'w': { var _t2 = self.startOf('year'), day = parseInt(self.diff(_t2, 'days') / 7) + 1; return checkPersian(day); } // Return Persian Day Name case 'ww': { var _t3 = self.startOf('year'), _day = leftZeroFill(parseInt(self.diff(_t3, 'days') / 7) + 1, 2); return checkPersian(_day); } // Month (Int) case 'M': { return checkPersian(info.month); } // Two Digit Month (Str) case 'MM': { return checkPersian(leftZeroFill(info.month, 2)); } // Abbr String of Month (Str) case 'MMM': { return self._monthNameShort(info.month); } // Full String name of Month (Str) case 'MMMM': { return self._monthName(info.month); } // Year // Two Digit Year (Str) case 'YY': { var yearDigitArray = info.year.toString().split(''); return checkPersian(yearDigitArray[2] + yearDigitArray[3]); } // Full Year (Int) case 'YYYY': { return checkPersian(info.year); } /* istanbul ignore next */ case 'Z': { var flag = '+', hours = Math.round(info.timezone / 60), minutes = info.timezone % 60; if (minutes < 0) { minutes *= -1; } if (hours < 0) { flag = '-'; hours *= -1; } var z = flag + leftZeroFill(hours, 2) + ':' + leftZeroFill(minutes, 2); return checkPersian(z); } /* istanbul ignore next */ case 'ZZ': { var _flag = '+', _hours = Math.round(info.timezone / 60), _minutes = info.timezone % 60; if (_minutes < 0) { _minutes *= -1; } if (_hours < 0) { _flag = '-'; _hours *= -1; } var _z = _flag + leftZeroFill(_hours, 2) + '' + leftZeroFill(_minutes, 2); return checkPersian(_z); } /* istanbul ignore next */ case 'X': { return self.unix(); } // 8:30 PM case 'LT': { return self.format('h:m a'); } // 09/04/1986 case 'L': { return self.format('YYYY/MM/DD'); } // 9/4/1986 case 'l': { return self.format('YYYY/M/D'); } // September 4th 1986 case 'LL': { return self.format('MMMM DD YYYY'); } // Sep 4 1986 case 'll': { return self.format('MMM DD YYYY'); } //September 4th 1986 8:30 PM case 'LLL': { return self.format('MMMM YYYY DD h:m a'); } // Sep 4 1986 8:30 PM case 'lll': { return self.format('MMM YYYY DD h:m a'); } //Thursday, September 4th 1986 8:30 PM case 'LLLL': { return self.format('dddd D MMMM YYYY h:m a'); } // Thu, Sep 4 1986 8:30 PM case 'llll': { return self.format('ddd D MMM YYYY h:m a'); } } } /* jshint ignore:end */ if (inputString) { return inputString.replace(formattingTokens, replaceFunction); } else { var _inputString = 'YYYY-MM-DD HH:mm:ss a'; return _inputString.replace(formattingTokens, replaceFunction); } } /** * * @param key * @param value * @returns {PersianDate} */ }, { key: 'add', value: function add(key, value) { var duration = new Duration(key, value)._data, unit = normalizeDuration(key, value).unit; value = normalizeDuration(key, value).value; if (unit === 'year' || unit === 'month') { if (duration.years > 0) { var newYear = this.year() + duration.years; this.year(newYear); } if (duration.months > 0) { var oldDate = this.date(); var newMonth = this.month() + duration.months; var thisMonthDaysCount = this.daysInMonth(this.year(), newMonth); if (oldDate >= thisMonthDaysCount) { oldDate = thisMonthDaysCount; } this.date(oldDate); this.month(newMonth); } } if (unit === 'day') { var oldHour = this.hour(); var newDate = this.valueOf() + value * 24 * 60 * 60 * 1000; return this.unix(newDate / 1000).hour(oldHour); } if (unit === 'hour') { var _newDate = this.valueOf() + value * 60 * 60 * 1000; return this.unix(_newDate / 1000); } if (unit === 'minute') { var _newDate2 = this.valueOf() + value * 60 * 1000; return this.unix(_newDate2 / 1000); } if (unit === 'second') { var _newDate3 = this.valueOf() + value * 1000; return this.unix(_newDate3 / 1000); } if (unit === 'millisecond') { // log('add millisecond') var newMillisecond = this.valueOf() + value; return this.unix(newMillisecond / 1000); } return this._getSyncedClass(this.valueOf()); } /** * * @param key * @param value * @returns {PersianDate} */ }, { key: 'subtract', value: function subtract(key, value) { var duration = new Duration(key, value)._data; var unit = normalizeDuration(key, value).unit; value = normalizeDuration(key, value).value; if (unit === 'year' || unit === 'month') { if (duration.years > 0) { var newYear = this.year() - duration.years; this.year(newYear); } if (duration.months > 0) { var oldDate = this.date(); var newMonth = this.month() - duration.months; this.month(newMonth); var thisMonthDaysCount = this.daysInMonth(this.year(), this.month()); if (oldDate > thisMonthDaysCount) { oldDate = thisMonthDaysCount; } this.date(oldDate); } } if (unit === 'day') { var oldHour = this.hour(); var newDate = this.valueOf() - value * 24 * 60 * 60 * 1000; return this.unix(newDate / 1000).hour(oldHour); } if (unit === 'hour') { var _newDate4 = this.valueOf() - value * 60 * 60 * 1000; return this.unix(_newDate4 / 1000); } if (unit === 'minute') { var _newDate5 = this.valueOf() - value * 60 * 1000; return this.unix(_newDate5 / 1000); } if (unit === 'second') { var _newDate6 = this.valueOf() - value * 1000; return this.unix(_newDate6 / 1000); } if (unit === 'millisecond') { // log('add millisecond') var newMillisecond = this.valueOf() - value; return this.unix(newMillisecond / 1000); } return this._getSyncedClass(this.valueOf()); } /** * check if a date is same as b * @param dateA * @param dateB * @return {boolean} * @static */ }, { key: 'isSameDay', /** * @param dateB * @return {PersianDateClass|*|boolean} */ value: function isSameDay(dateB) { return this && dateB && this.date() == dateB.date() && this.year() == dateB.year() && this.month() == dateB.month(); } /** * @desc check if a month is same as b * @param {Date} dateA * @param {Date} dateB * @return {boolean} * @static */ }, { key: 'isSameMonth', /** * @desc check two for month similarity * @param dateA * @param dateB * @return {*|boolean} */ value: function isSameMonth(dateB) { return this && dateB && this.year() == this.year() && this.month() == dateB.month(); } }], [{ key: 'rangeName', value: function rangeName() { var p = PersianDateClass, t = p.calendarType; if (p.localType === 'fa') { if (t === 'persian') { return fa.persian; } else { return fa.gregorian; } } else { if (t === 'persian') { return en.persian; } else { return en.gregorian; } } } }, { key: 'toLeapYearMode', value: function toLeapYearMode(input) { var d = PersianDateClass; d.leapYearMode = input; return d; } }, { key: 'toCalendar', value: function toCalendar(input) { var d = PersianDateClass; d.calendarType = input; return d; } }, { key: 'toLocale', value: function toLocale(input) { var d = PersianDateClass; d.localType = input; if (d.localType !== 'fa') { d.formatPersian = false; } else { d.formatPersian = '_default'; } return d; } }, { key: 'isPersianDate', value: function isPersianDate(obj) { return obj instanceof PersianDateClass; } }, { key: 'duration', value: function duration(input, key) { return new Duration(input, key); } }, { key: 'isDuration', value: function isDuration(obj) { return obj instanceof Duration; } }, { key: 'unix', value: function unix(timestamp) { if (timestamp) { return new PersianDateClass(timestamp * 1000).unix(); } else { return new PersianDateClass().unix(); } } }, { key: 'getFirstWeekDayOfMonth', value: function getFirstWeekDayOfMonth(year, month) { return new PersianDateClass([year, month, 1]).day(); } }, { key: 'utc', value: function utc(input) { if (input) { return new PersianDateClass(input).utc(); } else { return new PersianDateClass().utc(); } } }, { key: 'isSameDay', value: function isSameDay(dateA, dateB) { return dateA && dateB && dateA.date() == dateB.date() && dateA.year() == dateB.year() && dateA.month() == dateB.month(); } }, { key: 'isSameMonth', value: function isSameMonth(dateA, dateB) { return dateA && dateB && dateA.year() == dateB.year() && dateA.month() == dateB.month(); } }]); return PersianDateClass; }(); module.exports = PersianDateClass; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _createClass = 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; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Start algorithm class var ASTRO = __webpack_require__(3); var ON = __webpack_require__(9); var Algorithms = function () { function Algorithms(parent) { _classCallCheck(this, Algorithms); this.parent = parent; this.ASTRO = new ASTRO(); this.ON = new ON(); /* You may notice that a variety of array variables logically local to functions are declared globally here. In JavaScript, construction of an array variable from source code occurs as the code is interpreted. Making these variables pseudo-globals permits us to avoid overhead constructing and disposing of them in each call on the function in which whey are used. */ // TODO this block didnt used in main agorithm this.J0000 = 1721424.5; // Julian date of Gregorian epoch: 0000-01-01 this.J1970 = 2440587.5; // Julian date at Unix epoch: 1970-01-01 this.JMJD = 2400000.5; // Epoch of Modified Julian Date system this.NormLeap = [false /*"Normal year"*/, true /*"Leap year"*/]; // TODO END this.GREGORIAN_EPOCH = 1721425.5; this.PERSIAN_EPOCH = 1948320.5; } /** * @desc LEAP_GREGORIAN -- Is a given year in the Gregorian calendar a leap year ? * @param year * @return {boolean} */ _createClass(Algorithms, [{ key: 'leap_gregorian', value: function leap_gregorian(year) { return year % 4 === 0 && !(year % 100 === 0 && year % 400 !== 0); } /** * @desc Determine Julian day number from Gregorian calendar date * @param {*} year * @param {*} month * @param {*} day */ }, { key: 'gregorian_to_jd', value: function gregorian_to_jd(year, month, day) { return this.GREGORIAN_EPOCH - 1 + 365 * (year - 1) + Math.floor((year - 1) / 4) + -Math.floor((year - 1) / 100) + Math.floor((year - 1) / 400) + Math.floor((367 * month - 362) / 12 + (month <= 2 ? 0 : this.leap_gregorian(year) ? -1 : -2) + day); } /** * @desc Calculate Gregorian calendar date from Julian day * @param {*} jd */ }, { key: 'jd_to_gregorian', value: function jd_to_gregorian(jd) { var wjd = void 0, depoch = void 0, quadricent = void 0, dqc = void 0, cent = void 0, dcent = void 0, quad = void 0, dquad = void 0, yindex = void 0, year = void 0, yearday = void 0, leapadj = void 0, month = void 0, day = void 0; wjd = Math.floor(jd - 0.5) + 0.5; depoch = wjd - this.GREGORIAN_EPOCH; quadricent = Math.floor(depoch / 146097); dqc = this.ASTRO.mod(depoch, 146097); cent = Math.floor(dqc / 36524); dcent = this.ASTRO.mod(dqc, 36524); quad = Math.floor(dcent / 1461); dquad = this.ASTRO.mod(dcent, 1461); yindex = Math.floor(dquad / 365); year = quadricent * 400 + cent * 100 + quad * 4 + yindex; Eif (!(cent === 4 || yindex === 4)) { year++; } yearday = wjd - this.gregorian_to_jd(year, 1, 1); leapadj = wjd < this.gregorian_to_jd(year, 3, 1) ? 0 : this.leap_gregorian(year) ? 1 : 2; month = Math.floor(((yearday + leapadj) * 12 + 373) / 367); day = wjd - this.gregorian_to_jd(year, month, 1) + 1; return [year, month, day]; } /** * @param {*} year */ // leap_julian (year) { // return this.ASTRO.mod(year, 4) === ((year > 0) ? 0 : 3); // } /** * @desc Calculate Julian calendar date from Julian day * @param {*} td */ // jd_to_julian (td) { // let z, a, b, c, d, e, year, month, day; // // td += 0.5; // z = Math.floor(td); // // a = z; // b = a + 1524; // c = Math.floor((b - 122.1) / 365.25); // d = Math.floor(365.25 * c); // e = Math.floor((b - d) / 30.6001); // // month = Math.floor((e < 14) ? (e - 1) : (e - 13)); // year = Math.floor((month > 2) ? (c - 4716) : (c - 4715)); // day = b - d - Math.floor(30.6001 * e); // // /* If year is less than 1, subtract one to convert from // a zero based date system to the common era system in // which the year -1 (1 B.C.E) is followed by year 1 (1 C.E.). */ // // if (year < 1) { // year--; // } // // return [year, month, day]; // } /** * @desc TEHRAN_EQUINOX -- Determine Julian day and fraction of the March equinox at the Tehran meridian in a given Gregorian year. * @param {*} year */ }, { key: 'tehran_equinox', value: function tehran_equinox(year) { var equJED = void 0, equJD = void 0, equAPP = void 0, equTehran = void 0, dtTehran = void 0; // March equinox in dynamical time equJED = this.ASTRO.equinox(year, 0); // Correct for delta T to obtain Universal time equJD = equJED - this.ASTRO.deltat(year) / (24 * 60 * 60); // Apply the equation of time to yield the apparent time at Greenwich equAPP = equJD + this.ASTRO.equationOfTime(equJED); /* Finally, we must correct for the constant difference between the Greenwich meridian andthe time zone standard for Iran Standard time, 52°30' to the East. */ dtTehran = (52 + 30 / 60.0 + 0 / (60.0 * 60.0)) / 360; equTehran = equAPP + dtTehran; return equTehran; } /** * @desc TEHRAN_EQUINOX_JD -- Calculate Julian day during which the March equinox, reckoned from the Tehran meridian, occurred for a given Gregorian year. * @param {*} year */ }, { key: 'tehran_equinox_jd', value: function tehran_equinox_jd(year) { var ep = void 0, epg = void 0; ep = this.tehran_equinox(year); epg = Math.floor(ep); return epg; } /** * @desc PERSIANA_YEAR -- Determine the year in the Persian astronomical calendar in which a given Julian day falls. Returns an array of two elements: [0] Persian year [1] Julian day number containing equinox for this year. * @param {*} jd */ }, { key: 'persiana_year', value: function persiana_year(jd) { var guess = this.jd_to_gregorian(jd)[0] - 2, lasteq = void 0, nexteq = void 0, adr = void 0; lasteq = this.tehran_equinox_jd(guess); while (lasteq > jd) { guess--; lasteq = this.tehran_equinox_jd(guess); } nexteq = lasteq - 1; while (!(lasteq <= jd && jd < nexteq)) { lasteq = nexteq; guess++; nexteq = this.tehran_equinox_jd(guess); } adr = Math.round((lasteq - this.PERSIAN_EPOCH) / this.ASTRO.TropicalYear) + 1; return [adr, lasteq]; } /** * @desc Calculate date in the Persian astronomical calendar from Julian day. * @param {*} jd */ }, { key: 'jd_to_persiana', value: function jd_to_persiana(jd) { var year = void 0, month = void 0, day = void 0, adr = void 0, equinox = void 0, yday = void 0; jd = Math.floor(jd) + 0.5; adr = this.persiana_year(jd); year = adr[0]; equinox = adr[1]; day = Math.floor((jd - equinox) / 30) + 1; yday = Math.floor(jd) - this.persiana_to_jd(year, 1, 1) + 1; month = yday <= 186 ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30); day = Math.floor(jd) - this.persiana_to_jd(year, month, 1) + 1; return [year, month, day]; } /** * @desc Obtain Julian day from a given Persian astronomical calendar date. * @param {*} year * @param {*} month * @param {*} day */ }, { key: 'persiana_to_jd', value: function persiana_to_jd(year, month, day) { var adr = void 0, equinox = void 0, guess = void 0, jd = void 0; guess = this.PERSIAN_EPOCH - 1 + this.ASTRO.TropicalYear * (year - 1 - 1); adr = [year - 1, 0]; while (adr[0] < year) { adr = this.persiana_year(guess); guess = adr[1] + (this.ASTRO.TropicalYear + 2); } equinox = adr[1]; jd = equinox + (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) + (day - 1); return jd; } /** * @desc Is a given year a leap year in the Persian astronomical calendar ? * @param {*} year */ }, { key: 'leap_persiana', value: function leap_persiana(year) { return this.persiana_to_jd(year + 1, 1, 1) - this.persiana_to_jd(year, 1, 1) > 365; } /** * @desc Is a given year a leap year in the Persian calendar ? * also nasa use this algorithm https://eclipse.gsfc.nasa.gov/SKYCAL/algorithm.js search for 'getLastDayOfPersianMonth' and you can find it * @param {*} year * */ }, { key: 'leap_persian', value: function leap_persian(year) { return ((year - (year > 0 ? 474 : 473)) % 2820 + 474 + 38) * 682 % 2816 < 682; } /** * @desc Determine Julian day from Persian date * @param {*} year * @param {*} month * @param {*} day */ }, { key: 'persian_to_jd', value: function persian_to_jd(year, month, day) { var epbase = void 0, epyear = void 0; epbase = year - (year >= 0 ? 474 : 473); epyear = 474 + this.ASTRO.mod(epbase, 2820); return day + (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) + Math.floor((epyear * 682 - 110) / 2816) + (epyear - 1) * 365 + Math.floor(epbase / 2820) * 1029983 + (this.PERSIAN_EPOCH - 1); } /** * @desc Calculate Persian date from Julian day * @param {*} jd */ }, { key: 'jd_to_persian', value: function jd_to_persian(jd) { var year = void 0, month = void 0, day = void 0, depoch = void 0, cycle = void 0, cyear = void 0, ycycle = void 0, aux1 = void 0, aux2 = void 0, yday = void 0; jd = Math.floor(jd) + 0.5; depoch = jd - this.persian_to_jd(475, 1, 1); cycle = Math.floor(depoch / 1029983); cyear = this.ASTRO.mod(depoch, 1029983); Iif (cyear === 1029982) { ycycle = 2820; } else { aux1 = Math.floor(cyear / 366); aux2 = this.ASTRO.mod(cyear, 366); ycycle = Math.floor((2134 * aux1 + 2816 * aux2 + 2815) / 1028522) + aux1 + 1; } year = ycycle + 2820 * cycle + 474; Iif (year <= 0) { year--; } yday = jd - this.persian_to_jd(year, 1, 1) + 1; month = yday <= 186 ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30); day = jd - this.persian_to_jd(year, month, 1) + 1; return [year, month, day]; } /** * * @param {*} weekday */ }, { key: 'gWeekDayToPersian', value: function gWeekDayToPersian(weekday) { if (weekday + 2 === 8) { return 1; } else if (weekday + 2 === 7) { return 7; } else { return weekday + 2; } } /** * @desc updateFromGregorian -- Update all calendars from Gregorian. "Why not Julian date?" you ask. Because starting from Gregorian guarantees we're already snapped to an integral second, so we don't get roundoff errors in other calendars. */ }, { key: 'updateFromGregorian', value: function updateFromGregorian() { var j = void 0, year = void 0, mon = void 0, mday = void 0, hour = void 0, min = void 0, sec = void 0, weekday = void 0, utime = void 0, perscal = void 0; year = this.ON.gregorian.year; mon = this.ON.gregorian.month; mday = this.ON.gregorian.day; hour = 0; //this.ON.gregorian.hour; min = 0; //this.ON.gregorian.minute; sec = 0; //this.ON.gregorian.second; this.ON.gDate = new Date(year, mon, mday, this.ON.gregorian.hour, this.ON.gregorian.minute, this.ON.gregorian.second, this.ON.gregorian.millisecond); if (this.parent._utcMode === false) { this.ON.zone = this.ON.gDate.getTimezoneOffset(); } // Added for this algorithms cant parse 2016,13,32 successfully this.ON.gregorian.year = this.ON.gDate.getFullYear(); this.ON.gregorian.month = this.ON.gDate.getMonth(); this.ON.gregorian.day = this.ON.gDate.getDate(); // Update Julian day // --------------------------------------------------------------------------- j = this.gregorian_to_jd(year, mon + 1, mday) + Math.floor(sec + 60 * (min + 60 * hour) + 0.5) / 86400.0; this.ON.julianday = j; this.ON.modifiedjulianday = j - this.JMJD; // Update day of week in Gregorian box // --------------------------------------------------------------------------- weekday = this.ASTRO.jwday(j); // Move to 1 indexed number this.ON.gregorian.weekday = weekday + 1; // Update leap year status in Gregorian box // --------------------------------------------------------------------------- this.ON.gregorian.leap = this.NormLeap[this.leap_gregorian(year) ? 1 : 0]; // Update Julian Calendar // --------------------------------------------------------------------------- // julcal = this.jd_to_julian(j); // // this.ON.juliancalendar.year = julcal[0]; // this.ON.juliancalendar.month = julcal[1] - 1; // this.ON.juliancalendar.day = julcal[2]; // this.ON.juliancalendar.leap = this.NormLeap[this.leap_julian(julcal[0]) ? 1 : 0]; weekday = this.ASTRO.jwday(j); // this.ON.juliancalendar.weekday = weekday; // Update Persian Calendar // --------------------------------------------------------------------------- if (this.parent.calendarType == 'persian' && this.parent.leapYearMode == 'algorithmic') { perscal = this.jd_to_persian(j); this.ON.persian.year = perscal[0]; this.ON.persian.month = perscal[1] - 1; this.ON.persian.day = perscal[2]; this.ON.persian.weekday = this.gWeekDayToPersian(weekday); this.ON.persian.leap = this.NormLeap[this.leap_persian(perscal[0]) ? 1 : 0]; } // Update Persian Astronomical Calendar // --------------------------------------------------------------------------- if (this.parent.calendarType == 'persian' && this.parent.leapYearMode == 'astronomical') { perscal = this.jd_to_persiana(j); this.ON.persianAstro.year = perscal[0]; this.ON.persianAstro.month = perscal[1] - 1; this.ON.persianAstro.day = perscal[2]; this.ON.persianAstro.weekday = this.gWeekDayToPersian(weekday); this.ON.persianAstro.leap = this.NormLeap[this.leap_persiana(perscal[0]) ? 1 : 0]; } // Update Gregorian serial number // --------------------------------------------------------------------------- Eif (this.ON.gregserial.day !== null) { this.ON.gregserial.day = j - this.J0000; } // Update Unix time() // --------------------------------------------------------------------------- utime = (j - this.J1970) * (60 * 60 * 24 * 1000); this.ON.unixtime = Math.round(utime / 1000); } /** * @desc Perform calculation starting with a Gregorian date * @param {*} dateArray */ }, { key: 'calcGregorian', value: function calcGregorian(dateArray) { Eif (dateArray[0]) { this.ON.gregorian.year = dateArray[0]; } if (dateArray[1]) { this.ON.gregorian.month = dateArray[1]; } Eif (dateArray[2]) { this.ON.gregorian.day = dateArray[2]; } if (dateArray[3]) { this.ON.gregorian.hour = dateArray[3]; } if (dateArray[4]) { this.ON.gregorian.minute = dateArray[4]; } if (dateArray[5]) { this.ON.gregorian.second = dateArray[5]; } if (dateArray[6]) { this.ON.gregorian.millisecond = dateArray[6]; } this.updateFromGregorian(); } /** * @desc Perform calculation starting with a Julian date */ }, { key: 'calcJulian', value: function calcJulian() { var j = void 0, date = void 0; j = this.ON.julianday; date = this.jd_to_gregorian(j); this.ON.gregorian.year = date[0]; this.ON.gregorian.month = date[1] - 1; this.ON.gregorian.day = date[2]; // this.ON.gregorian.hour = this.pad(time[0], 2, " "); // this.ON.gregorian.minute = this.pad(time[1], 2, "0"); // this.ON.gregorian.second = this.pad(time[2], 2, "0"); this.updateFromGregorian(); } /** * @desc Set Julian date and update all calendars * @param {*} j */ }, { key: 'setJulian', value: function setJulian(j) { this.ON.julianday = j; this.calcJulian(); } /** * @desc Update from Persian calendar * @param {*} dateArray */ }, { key: 'calcPersian', value: function calcPersian(dateArray) { Eif (dateArray[0]) { this.ON.persian.year = dateArray[0]; } Eif (dateArray[1]) { this.ON.persian.month = dateArray[1]; } Eif (dateArray[2]) { this.ON.persian.day = dateArray[2]; } if (dateArray[3]) { this.ON.gregorian.hour = dateArray[3]; } if (dateArray[4]) { this.ON.gregorian.minute = dateArray[4]; } if (dateArray[5]) { this.ON.gregorian.second = dateArray[5]; } Iif (dateArray[6]) { this.ON.gregorian.millisecond = dateArray[6]; } this.setJulian(this.persian_to_jd(this.ON.persian.year, this.ON.persian.month, this.ON.persian.day)); } /** * @desc Update from Persian astronomical calendar * @param {*} dateArray */ }, { key: 'calcPersiana', value: function calcPersiana(dateArray) { if (dateArray[0]) { this.ON.persianAstro.year = dateArray[0]; } if (dateArray[1]) { this.ON.persianAstro.month = dateArray[1]; } Eif (dateArray[2]) { this.ON.persianAstro.day = dateArray[2]; } if (dateArray[3]) { this.ON.gregorian.hour = dateArray[3]; } if (dateArray[4]) { this.ON.gregorian.minute = dateArray[4]; } if (dateArray[5]) { this.ON.gregorian.second = dateArray[5]; } if (dateArray[6]) { this.ON.gregorian.millisecond = dateArray[6]; } this.setJulian(this.persiana_to_jd(this.ON.persianAstro.year, this.ON.persianAstro.month, this.ON.persianAstro.day + 0.5)); } }]); return Algorithms; }(); module.exports = Algorithms; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _createClass = 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; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /* JavaScript functions for positional astronomy by John Walker -- September, MIM http://www.fourmilab.ch/ This program is in the public domain. */ var ASTRO = function () { function ASTRO() { _classCallCheck(this, ASTRO); // Frequently-used constants this.J2000 = 2451545.0; // Julian day of J2000 epoch this.JulianCentury = 36525.0; // Days in Julian century this.JulianMillennium = this.JulianCentury * 10; // Days in Julian millennium // this.AstronomicalUnit = 149597870.0; // Astronomical unit in kilometres this.TropicalYear = 365.24219878; // Mean solar tropical year /* OBLIQEQ -- Calculate the obliquity of the ecliptic for a given Julian date. This uses Laskar's tenth-degree polynomial fit (J. Laskar, Astronomy and Astrophysics, Vol. 157, page 68 [1986]) which is accurate to within 0.01 arc second between AD 1000 and AD 3000, and within a few seconds of arc for +/-10000 years around AD 2000. If we're outside the range in which this fit is valid (deep time) we simply return the J2000 value of the obliquity, which happens to be almost precisely the mean. */ this.oterms = [-4680.93, -1.55, 1999.25, -51.38, -249.67, -39.05, 7.12, 27.87, 5.79, 2.45]; /* Periodic terms for nutation in longiude (delta \Psi) and obliquity (delta \Epsilon) as given in table 21.A of Meeus, "Astronomical Algorithms", first edition. */ this.nutArgMult = [0, 0, 0, 0, 1, -2, 0, 0, 2, 2, 0, 0, 0, 2, 2, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, -2, 1, 0, 2, 2, 0, 0, 0, 2, 1, 0, 0, 1, 2, 2, -2, -1, 0, 2, 2, -2, 0, 1, 0, 0, -2, 0, 0, 2, 1, 0, 0, -1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, -1, 2, 2, 0, 0, -1, 0, 1, 0, 0, 1, 2, 1, -2, 0, 2, 0, 0, 0, 0, -2, 2, 1, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 0, 0, 2, 0, 0, -2, 0, 1, 2, 2, 0, 0, 0, 2, 0, -2, 0, 0, 2, 0, 0, 0, -1, 2, 1, 0, 2, 0, 0, 0, 2, 0, -1, 0, 1, -2, 2, 0, 2, 2, 0, 1, 0, 0, 1, -2, 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, 0, 2, -2, 0, 2, 0, -1, 2, 1, 2, 0, 1, 2, 2, 0, 1, 0, 2, 2, -2, 1, 1, 0, 0, 0, -1, 0, 2, 2, 2, 0, 0, 2, 1, 2, 0, 1, 0, 0, -2, 0, 2, 2, 2, -2, 0, 1, 2, 1, 2, 0, -2, 0, 1, 2, 0, 0, 0, 1, 0, -1, 1, 0, 0, -2, -1, 0, 2, 1, -2, 0, 0, 0, 1, 0, 0, 2, 2, 1, -2, 0, 2, 0, 1, -2, 1, 0, 2, 1, 0, 0, 1, -2, 0, -1, 0, 1, 0, 0, -2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, -1, -1, 1, 0, 0, 0, 1, 1, 0, 0, 0, -1, 1, 2, 2, 2, -1, -1, 2, 2, 0, 0, -2, 2, 2, 0, 0, 3, 2, 2, 2, -1, 0, 2, 2]; this.nutArgCoeff = [-171996, -1742, 92095, 89, /* 0, 0, 0, 0, 1 */ -13187, -16, 5736, -31, /* -2, 0, 0, 2, 2 */ -2274, -2, 977, -5, /* 0, 0, 0, 2, 2 */ 2062, 2, -895, 5, /* 0, 0, 0, 0, 2 */ 1426, -34, 54, -1, /* 0, 1, 0, 0, 0 */ 712, 1, -7, 0, /* 0, 0, 1, 0, 0 */ -517, 12, 224, -6, /* -2, 1, 0, 2, 2 */ -386, -4, 200, 0, /* 0, 0, 0, 2, 1 */ -301, 0, 129, -1, /* 0, 0, 1, 2, 2 */ 217, -5, -95, 3, /* -2, -1, 0, 2, 2 */ -158, 0, 0, 0, /* -2, 0, 1, 0, 0 */ 129, 1, -70, 0, /* -2, 0, 0, 2, 1 */ 123, 0, -53, 0, /* 0, 0, -1, 2, 2 */ 63, 0, 0, 0, /* 2, 0, 0, 0, 0 */ 63, 1, -33, 0, /* 0, 0, 1, 0, 1 */ -59, 0, 26, 0, /* 2, 0, -1, 2, 2 */ -58, -1, 32, 0, /* 0, 0, -1, 0, 1 */ -51, 0, 27, 0, /* 0, 0, 1, 2, 1 */ 48, 0, 0, 0, /* -2, 0, 2, 0, 0 */ 46, 0, -24, 0, /* 0, 0, -2, 2, 1 */ -38, 0, 16, 0, /* 2, 0, 0, 2, 2 */ -31, 0, 13, 0, /* 0, 0, 2, 2, 2 */ 29, 0, 0, 0, /* 0, 0, 2, 0, 0 */ 29, 0, -12, 0, /* -2, 0, 1, 2, 2 */ 26, 0, 0, 0, /* 0, 0, 0, 2, 0 */ -22, 0, 0, 0, /* -2, 0, 0, 2, 0 */ 21, 0, -10, 0, /* 0, 0, -1, 2, 1 */ 17, -1, 0, 0, /* 0, 2, 0, 0, 0 */ 16, 0, -8, 0, /* 2, 0, -1, 0, 1 */ -16, 1, 7, 0, /* -2, 2, 0, 2, 2 */ -15, 0, 9, 0, /* 0, 1, 0, 0, 1 */ -13, 0, 7, 0, /* -2, 0, 1, 0, 1 */ -12, 0, 6, 0, /* 0, -1, 0, 0, 1 */ 11, 0, 0, 0, /* 0, 0, 2, -2, 0 */ -10, 0, 5, 0, /* 2, 0, -1, 2, 1 */ -8, 0, 3, 0, /* 2, 0, 1, 2, 2 */ 7, 0, -3, 0, /* 0, 1, 0, 2, 2 */ -7, 0, 0, 0, /* -2, 1, 1, 0, 0 */ -7, 0, 3, 0, /* 0, -1, 0, 2, 2 */ -7, 0, 3, 0, /* 2, 0, 0, 2, 1 */ 6, 0, 0, 0, /* 2, 0, 1, 0, 0 */ 6, 0, -3, 0, /* -2, 0, 2, 2, 2 */ 6, 0, -3, 0, /* -2, 0, 1, 2, 1 */ -6, 0, 3, 0, /* 2, 0, -2, 0, 1 */ -6, 0, 3, 0, /* 2, 0, 0, 0, 1 */ 5, 0, 0, 0, /* 0, -1, 1, 0, 0 */ -5, 0, 3, 0, /* -2, -1, 0, 2, 1 */ -5, 0, 3, 0, /* -2, 0, 0, 0, 1 */ -5, 0, 3, 0, /* 0, 0, 2, 2, 1 */ 4, 0, 0, 0, /* -2, 0, 2, 0, 1 */ 4, 0, 0, 0, /* -2, 1, 0, 2, 1 */ 4, 0, 0, 0, /* 0, 0, 1, -2, 0 */ -4, 0, 0, 0, /* -1, 0, 1, 0, 0 */ -4, 0, 0, 0, /* -2, 1, 0, 0, 0 */ -4, 0, 0, 0, /* 1, 0, 0, 0, 0 */ 3, 0, 0, 0, /* 0, 0, 1, 2, 0 */ -3, 0, 0, 0, /* -1, -1, 1, 0, 0 */ -3, 0, 0, 0, /* 0, 1, 1, 0, 0 */ -3, 0, 0, 0, /* 0, -1, 1, 2, 2 */ -3, 0, 0, 0, /* 2, -1, -1, 2, 2 */ -3, 0, 0, 0, /* 0, 0, -2, 2, 2 */ -3, 0, 0, 0, /* 0, 0, 3, 2, 2 */ -3, 0, 0, 0 /* 2, -1, 0, 2, 2 */ ]; /** * @desc Table of observed Delta T values at the beginning of even numbered years from 1620 through 2002. * @type Array */ this.deltaTtab = [121, 112, 103, 95, 88, 82, 77, 72, 68, 63, 60, 56, 53, 51, 48, 46, 44, 42, 40, 38, 35, 33, 31, 29, 26, 24, 22, 20, 18, 16, 14, 12, 11, 10, 9, 8, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 14, 13, 13.1, 12.5, 12.2, 12, 12, 12, 12, 12, 12, 11.9, 11.6, 11, 10.2, 9.2, 8.2, 7.1, 6.2, 5.6, 5.4, 5.3, 5.4, 5.6, 5.9, 6.2, 6.5, 6.8, 7.1, 7.3, 7.5, 7.6, 7.7, 7.3, 6.2, 5.2, 2.7, 1.4, -1.2, -2.8, -3.8, -4.8, -5.5, -5.3, -5.6, -5.7, -5.9, -6, -6.3, -6.5, -6.2, -4.7, -2.8, -0.1, 2.6, 5.3, 7.7, 10.4, 13.3, 16, 18.2, 20.2, 21.1, 22.4, 23.5, 23.8, 24.3, 24, 23.9, 23.9, 23.7, 24, 24.3, 25.3, 26.2, 27.3, 28.2, 29.1, 30, 30.7, 31.4, 32.2, 33.1, 34, 35, 36.5, 38.3, 40.2, 42.2, 44.5, 46.5, 48.5, 50.5, 52.2, 53.8, 54.9, 55.8, 56.9, 58.3, 60, 61.6, 63, 65, 66.6]; /* EQUINOX -- Determine the Julian Ephemeris Day of an equinox or solstice. The "which" argument selects the item to be computed: 0 March equinox 1 June solstice 2 September equinox 3 December solstice */ /** * @desc Periodic terms to obtain true time * @type Array */ this.EquinoxpTerms = [485, 324.96, 1934.136, 203, 337.23, 32964.467, 199, 342.08, 20.186, 182, 27.85, 445267.112, 156, 73.14, 45036.886, 136, 171.52, 22518.443, 77, 222.54, 65928.934, 74, 296.72, 3034.906, 70, 243.58, 9037.513, 58, 119.81, 33718.147, 52, 297.17, 150.678, 50, 21.02, 2281.226, 45, 247.54, 29929.562, 44, 325.15, 31555.956, 29, 60.93, 4443.417, 18, 155.12, 67555.328, 17, 288.79, 4562.452, 16, 198.04, 62894.029, 14, 199.76, 31436.921, 12, 95.39, 14577.848, 12, 287.11, 31931.756, 12, 320.81, 34777.259, 9, 227.73, 1222.114, 8, 15.45, 16859.074]; this.JDE0tab1000 = [new Array(1721139.29189, 365242.13740, 0.06134, 0.00111, -0.00071), new Array(1721233.25401, 365241.72562, -0.05323, 0.00907, 0.00025), new Array(1721325.70455, 365242.49558, -0.11677, -0.00297, 0.00074), new Array(1721414.39987, 365242.88257, -0.00769, -0.00933, -0.00006)]; this.JDE0tab2000 = [new Array(2451623.80984, 365242.37404, 0.05169, -0.00411, -0.00057), new Array(2451716.56767, 365241.62603, 0.00325, 0.00888, -0.00030), new Array(2451810.21715, 365242.01767, -0.11575, 0.00337, 0.00078), new Array(2451900.05952, 365242.74049, -0.06223, -0.00823, 0.00032)]; } /** * * @param Degrees to radians. * @return {number} */ _createClass(ASTRO, [{ key: "dtr", value: function dtr(d) { return d * Math.PI / 180.0; } /** * @desc Radians to degrees. * @param r * @return {number} */ }, { key: "rtd", value: function rtd(r) { return r * 180.0 / Math.PI; } /** * @desc Range reduce angle in degrees. * @param a * @return {number} */ }, { key: "fixangle", value: function fixangle(a) { return a - 360.0 * Math.floor(a / 360.0); } /** * @desc Range reduce angle in radians. * @param a * @return {number} */ }, { key: "fixangr", value: function fixangr(a) { return a - 2 * Math.PI * Math.floor(a / (2 * Math.PI)); } /** * @desc Sine of an angle in degrees * @param d * @return {number} */ }, { key: "dsin", value: function dsin(d) { return Math.sin(this.dtr(d)); } /** * @desc Cosine of an angle in degrees * @param d * @return {number} */ }, { key: "dcos", value: function dcos(d) { return Math.cos(this.dtr(d)); } /** * @desc Modulus function which works for non-integers. * @param a * @param b * @return {number} */ }, { key: "mod", value: function mod(a, b) { return a - b * Math.floor(a / b); } /** * * @param j * @return {number} */ }, { key: "jwday", value: function jwday(j) { return this.mod(Math.floor(j + 1.5), 7); } /** * * @param jd * @return {number|*} */ }, { key: "obliqeq", value: function obliqeq(jd) { var eps, u, v, i; v = u = (jd - this.J2000) / (this.JulianCentury * 100); eps = 23 + 26 / 60.0 + 21.448 / 3600.0; if (Math.abs(u) < 1.0) { for (i = 0; i < 10; i++) { eps += this.oterms[i] / 3600.0 * v; v *= u; } } return eps; } /** * @desc Calculate the nutation in longitude, deltaPsi, and obliquity, deltaEpsilon for a given Julian date jd. Results are returned as a two element Array giving (deltaPsi, deltaEpsilon) in degrees. * @param jd * @return Object */ }, { key: "nutation", value: function nutation(jd) { var deltaPsi, deltaEpsilon, i, j, t = (jd - 2451545.0) / 36525.0, t2, t3, to10, ta = [], dp = 0, de = 0, ang; t3 = t * (t2 = t * t); /* Calculate angles. The correspondence between the elements of our array and the terms cited in Meeus are: ta[0] = D ta[0] = M ta[2] = M' ta[3] = F ta[4] = \Omega */ ta[0] = this.dtr(297.850363 + 445267.11148 * t - 0.0019142 * t2 + t3 / 189474.0); ta[1] = this.dtr(357.52772 + 35999.05034 * t - 0.0001603 * t2 - t3 / 300000.0); ta[2] = this.dtr(134.96298 + 477198.867398 * t + 0.0086972 * t2 + t3 / 56250.0); ta[3] = this.dtr(93.27191 + 483202.017538 * t - 0.0036825 * t2 + t3 / 327270); ta[4] = this.dtr(125.04452 - 1934.136261 * t + 0.0020708 * t2 + t3 / 450000.0); /* Range reduce the angles in case the sine and cosine functions don't do it as accurately or quickly. */ for (i = 0; i < 5; i++) { ta[i] = this.fixangr(ta[i]); } to10 = t / 10.0; for (i = 0; i < 63; i++) { ang = 0; for (j = 0; j < 5; j++) { if (this.nutArgMult[i * 5 + j] !== 0) { ang += this.nutArgMult[i * 5 + j] * ta[j]; } } dp += (this.nutArgCoeff[i * 4 + 0] + this.nutArgCoeff[i * 4 + 1] * to10) * Math.sin(ang); de += (this.nutArgCoeff[i * 4 + 2] + this.nutArgCoeff[i * 4 + 3] * to10) * Math.cos(ang); } /* Return the result, converting from ten thousandths of arc seconds to radians in the process. */ deltaPsi = dp / (3600.0 * 10000.0); deltaEpsilon = de / (3600.0 * 10000.0); return [deltaPsi, deltaEpsilon]; } /** * @desc Determine the difference, in seconds, between Dynamical time and Universal time. * @param year * @return {*} */ }, { key: "deltat", value: function deltat(year) { var dt, f, i, t; Iif (year >= 1620 && year <= 2000) { i = Math.floor((year - 1620) / 2); f = (year - 1620) / 2 - i; /* Fractional part of year */ dt = this.deltaTtab[i] + (this.deltaTtab[i + 1] - this.deltaTtab[i]) * f; } else { t = (year - 2000) / 100; if (year < 948) { dt = 2177 + 497 * t + 44.1 * t * t; } else { dt = 102 + 102 * t + 25.3 * t * t; if (year > 2000 && year < 2100) { dt += 0.37 * (year - 2100); } } } return dt; } /** * * @param year * @param which * @return {*} */ }, { key: "equinox", value: function equinox(year, which) { var deltaL = void 0, i = void 0, j = void 0, JDE0 = void 0, JDE = void 0, JDE0tab = void 0, S = void 0, T = void 0, W = void 0, Y = void 0; /* Initialise terms for mean equinox and solstices. We have two sets: one for years prior to 1000 and a second for subsequent years. */ if (year < 1000) { JDE0tab = this.JDE0tab1000; Y = year / 1000; } else { JDE0tab = this.JDE0tab2000; Y = (year - 2000) / 1000; } JDE0 = JDE0tab[which][0] + JDE0tab[which][1] * Y + JDE0tab[which][2] * Y * Y + JDE0tab[which][3] * Y * Y * Y + JDE0tab[which][4] * Y * Y * Y * Y; T = (JDE0 - 2451545.0) / 36525; W = 35999.373 * T - 2.47; deltaL = 1 + 0.0334 * this.dcos(W) + 0.0007 * this.dcos(2 * W); S = 0; for (i = j = 0; i < 24; i++) { S += this.EquinoxpTerms[j] * this.dcos(this.EquinoxpTerms[j + 1] + this.EquinoxpTerms[j + 2] * T); j += 3; } JDE = JDE0 + S * 0.00001 / deltaL; return JDE; } /** * @desc Position of the Sun. Please see the comments on the return statement at the end of this function which describe the array it returns. We return intermediate values because they are useful in a variety of other contexts. * @param jd * @return Object */ }, { key: "sunpos", value: function sunpos(jd) { var T = void 0, T2 = void 0, L0 = void 0, M = void 0, e = void 0, C = void 0, sunLong = void 0, sunAnomaly = void 0, sunR = void 0, Omega = void 0, Lambda = void 0, epsilon = void 0, epsilon0 = void 0, Alpha = void 0, Delta = void 0, AlphaApp = void 0, DeltaApp = void 0; T = (jd - this.J2000) / this.JulianCentury; T2 = T * T; L0 = 280.46646 + 36000.76983 * T + 0.0003032 * T2; L0 = this.fixangle(L0); M = 357.52911 + 35999.05029 * T + -0.0001537 * T2; M = this.fixangle(M); e = 0.016708634 + -0.000042037 * T + -0.0000001267 * T2; C = (1.914602 + -0.004817 * T + -0.000014 * T2) * this.dsin(M) + (0.019993 - 0.000101 * T) * this.dsin(2 * M) + 0.000289 * this.dsin(3 * M); sunLong = L0 + C; sunAnomaly = M + C; sunR = 1.000001018 * (1 - e * e) / (1 + e * this.dcos(sunAnomaly)); Omega = 125.04 - 1934.136 * T; Lambda = sunLong + -0.00569 + -0.00478 * this.dsin(Omega); epsilon0 = this.obliqeq(jd); epsilon = epsilon0 + 0.00256 * this.dcos(Omega); Alpha = this.rtd(Math.atan2(this.dcos(epsilon0) * this.dsin(sunLong), this.dcos(sunLong))); Alpha = this.fixangle(Alpha); Delta = this.rtd(Math.asin(this.dsin(epsilon0) * this.dsin(sunLong))); AlphaApp = this.rtd(Math.atan2(this.dcos(epsilon) * this.dsin(Lambda), this.dcos(Lambda))); AlphaApp = this.fixangle(AlphaApp); DeltaApp = this.rtd(Math.asin(this.dsin(epsilon) * this.dsin(Lambda))); return [// Angular quantities are expressed in decimal degrees L0, // [0] Geometric mean longitude of the Sun M, // [1] Mean anomaly of the Sun e, // [2] Eccentricity of the Earth's orbit C, // [3] Sun's equation of the Centre sunLong, // [4] Sun's true longitude sunAnomaly, // [5] Sun's true anomaly sunR, // [6] Sun's radius vector in AU Lambda, // [7] Sun's apparent longitude at true equinox of the date Alpha, // [8] Sun's true right ascension Delta, // [9] Sun's true declination AlphaApp, // [10] Sun's apparent right ascension DeltaApp // [11] Sun's apparent declination ]; } /** * @desc Compute equation of time for a given moment. Returns the equation of time as a fraction of a day. * @param jd * @return {number|*} */ }, { key: "equationOfTime", value: function equationOfTime(jd) { var alpha = void 0, deltaPsi = void 0, E = void 0, epsilon = void 0, L0 = void 0, tau = void 0; tau = (jd - this.J2000) / this.JulianMillennium; L0 = 280.4664567 + 360007.6982779 * tau + 0.03032028 * tau * tau + tau * tau * tau / 49931 + -(tau * tau * tau * tau / 15300) + -(tau * tau * tau * tau * tau / 2000000); L0 = this.fixangle(L0); alpha = this.sunpos(jd)[10]; deltaPsi = this.nutation(jd)[0]; epsilon = this.obliqeq(jd) + this.nutation(jd)[1]; E = L0 + -0.0057183 + -alpha + deltaPsi * this.dcos(epsilon); E = E - 20.0 * Math.floor(E / 20.0); E = E / (24 * 60); return E; } }]); return ASTRO; }(); module.exports = ASTRO; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Constants * @module constants */ module.exports = { durationUnit: { year: ['y', 'years', 'year'], month: ['M', 'months', 'month'], day: ['d', 'days', 'day'], hour: ['h', 'hours', 'hour'], minute: ['m', 'minutes', 'minute'], second: ['s', 'second', 'seconds'], millisecond: ['ms', 'milliseconds', 'millisecond'], week: ['w', '', 'weeks', 'week'] } }; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _createClass = 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; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Helpers = __webpack_require__(0); var normalizeDuration = new Helpers().normalizeDuration; var absRound = new Helpers().absRound; var absFloor = new Helpers().absFloor; /** * Duration object constructor * @param duration * @class Duration * @constructor */ var Duration = function () { function Duration(key, value) { _classCallCheck(this, Duration); var duration = {}, data = this._data = {}, milliseconds = 0, normalizedUnit = normalizeDuration(key, value), unit = normalizedUnit.unit; duration[unit] = normalizedUnit.value; milliseconds = duration.milliseconds || duration.millisecond || duration.ms || 0; var years = duration.years || duration.year || duration.y || 0, months = duration.months || duration.month || duration.M || 0, weeks = duration.weeks || duration.w || duration.week || 0, days = duration.days || duration.d || duration.day || 0, hours = duration.hours || duration.hour || duration.h || 0, minutes = duration.minutes || duration.minute || duration.m || 0, seconds = duration.seconds || duration.second || duration.s || 0; // representation for dateAddRemove this._milliseconds = milliseconds + seconds * 1e3 + minutes * 6e4 + hours * 36e5; // Because of dateAddRemove treats 24 hours as different from a // day when working around DST, we need to store them separately this._days = days + weeks * 7; // It is impossible translate months into days without knowing // which months you are are talking about, so we have to store // it separately. this._months = months + years * 12; // The following code bubbles up values, see the tests for // examples of what that means. data.milliseconds = milliseconds % 1000; seconds += absFloor(milliseconds / 1000); data.seconds = seconds % 60; minutes += absRound(seconds / 60); data.minutes = minutes % 60; hours += absRound(minutes / 60); data.hours = hours % 24; days += absRound(hours / 24); days += weeks * 7; data.days = days % 30; months += absRound(days / 30); data.months = months % 12; years += absRound(months / 12); data.years = years; return this; } _createClass(Duration, [{ key: 'valueOf', value: function valueOf() { return this._milliseconds + this._days * 864e5 + this._months * 2592e6; } }]); return Duration; }(); module.exports = Duration; // let Helpers = require('./helpers'); // let normalizeDuration = new Helpers().normalizeDuration; // let absRound = new Helpers().absRound; // /** // * Duration object constructor // * @param duration // * @class Duration // * @constructor // */ // class Duration { // constructor(key, value) { // let duration = {}, // normalizedUnit = normalizeDuration(key, value), // unit = normalizedUnit.unit; // duration[unit] = normalizedUnit.value; // let years = duration.years || duration.year || duration.y || 0, // quarters = duration.quarter || duration.quarter || 0, // months = duration.months || duration.month || duration.M || 0, // weeks = duration.weeks || duration.w || duration.week || 0, // days = duration.days || duration.d || duration.day || 0, // hours = duration.hours || duration.hour || duration.h || 0, // minutes = duration.minutes || duration.minute || duration.m || 0, // seconds = duration.seconds || duration.second || duration.s || 0, // milliseconds = duration.milliseconds || duration.milli || duration.millisecond || duration.ms || 0; // // TODO: must implement // // this._isValid = isDurationValid(normalizedInput); // // representation for dateAddRemove // this._milliseconds = +milliseconds + // seconds * 1e3 + // 1000 // minutes * 6e4 + // 1000 * 60 // hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 // // Because of dateAddRemove treats 24 hours as different from a // // day when working around DST, we need to store them separately // this._days = +days + // weeks * 7; // // It is impossible to translate months into days without knowing // // which months you are are talking about, so we have to store // // it separately. // this._months = +months + // quarters * 3 + // years * 12; // this._data = {}; // this.bubble(); // } // absFloor(number) { // if (number < 0) { // // -0 -> 0 // return Math.ceil(number) || 0; // } else { // return Math.floor(number); // } // } // absCeil(number) { // if (number < 0) { // return Math.floor(number); // } else { // return Math.ceil(number); // } // } // bubble() { // var milliseconds = this._milliseconds; // var days = this._days; // var months = this._months; // var data = this._data; // var seconds, minutes, hours, years, monthsFromDays; // // if we have a mix of positive and negative values, bubble down first // // check: https://github.com/moment/moment/issues/2166 // if (!((milliseconds >= 0 && days >= 0 && months >= 0) || // (milliseconds <= 0 && days <= 0 && months <= 0))) { // milliseconds += this.absCeil(monthsToDays(months) + days) * 864e5; // days = 0; // months = 0; // } // // The following code bubbles up values, see the tests for // // examples of what that means. // data.milliseconds = milliseconds % 1000; // seconds = this.absFloor(milliseconds / 1000); // data.seconds = seconds % 60; // minutes = this.absFloor(seconds / 60); // data.minutes = minutes % 60; // hours = this.absFloor(minutes / 60); // data.hours = hours % 24; // days += this.absFloor(hours / 24); // // convert days to months // // Remember: I change this from absFloor to absCeil // monthsFromDays = this.absFloor(this.daysToMonths(days)); // months += monthsFromDays; // // Remember: I commnet this Line // days -= this.absCeil(this.monthsToDays(monthsFromDays)); // // 12 months -> 1 year // years = this.absFloor(months / 12); // months %= 12; // data.days = days; // data.months = months; // data.years = years; // return this; // } // daysToMonths(days) { // // 400 years have 146097 days (taking into account leap year rules) // // 400 years have 12 months === 4800 // return days * 4800 / 146097; // } // monthsToDays(months) { // // the reverse of daysToMonths // return months * 146097 / 4800; // } // valueOf() { // return this._milliseconds + this._days * (864e5) + this._months * (2592e6); // } // static valueOf() { // return this._milliseconds + this._days * (864e5) + this._months * (2592e6); // } // } // module.exports = Duration; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Constants * @module constants */ module.exports = { gregorian: { months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] }, persian: { months: ['Farvardin', 'Ordibehesht', 'Khordad', 'Tir', 'Mordad', 'Shahrivar', 'Mehr', 'Aban', 'Azar', 'Dey', 'Bahman', 'Esfand'], monthsShort: ['Far', 'Ord', 'Kho', 'Tir', 'Mor', 'Sha', 'Meh', 'Aba', 'Aza', 'Dey', 'Bah', 'Esf'], weekdays: ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], persianDaysName: ['Urmazd', 'Bahman', 'Ordibehesht', 'Shahrivar', 'Sepandarmaz', 'Khurdad', 'Amordad', 'Dey-be-azar', 'Azar', 'Aban', 'Khorshid', 'Mah', 'Tir', 'Gush', 'Dey-be-mehr', 'Mehr', 'Sorush', 'Rashn', 'Farvardin', 'Bahram', 'Ram', 'Bad', 'Dey-be-din', 'Din', 'Ord', 'Ashtad', 'Asman', 'Zamyad', 'Mantre-sepand', 'Anaram', 'Ziadi'] } }; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Constants * @module constants */ module.exports = { gregorian: { months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), monthsShort: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), weekdays: '\u06CC\u06A9\u200C\u0634\u0646\u0628\u0647_\u062F\u0648\u0634\u0646\u0628\u0647_\u0633\u0647\u200C\u0634\u0646\u0628\u0647_\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647_\u067E\u0646\u062C\u200C\u0634\u0646\u0628\u0647_\u062C\u0645\u0639\u0647_\u0634\u0646\u0628\u0647'.split('_'), weekdaysShort: '\u06CC\u06A9\u200C\u0634\u0646\u0628\u0647_\u062F\u0648\u0634\u0646\u0628\u0647_\u0633\u0647\u200C\u0634\u0646\u0628\u0647_\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647_\u067E\u0646\u062C\u200C\u0634\u0646\u0628\u0647_\u062C\u0645\u0639\u0647_\u0634\u0646\u0628\u0647'.split('_'), weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_') }, persian: { months: ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'], monthsShort: ['فرو', 'ارد', 'خرد', 'تیر', 'مرد', 'شهر', 'مهر', 'آبا', 'آذر', 'دی', 'بهم', 'اسف'], weekdays: ['شنبه', 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهار شنبه', '\u067E\u0646\u062C\u200C\u0634\u0646\u0628\u0647', 'جمعه'], weekdaysShort: ['ش', 'ی', 'د', 'س', 'چ', 'پ', 'ج'], weekdaysMin: ['ش', 'ی', 'د', 'س', 'چ', 'پ', 'ج'], persianDaysName: ['اورمزد', 'بهمن', 'اوردیبهشت', 'شهریور', 'سپندارمذ', 'خورداد', 'امرداد', 'دی به آذز', 'آذز', 'آبان', 'خورشید', 'ماه', 'تیر', 'گوش', 'دی به مهر', 'مهر', 'سروش', 'رشن', 'فروردین', 'بهرام', 'رام', 'باد', 'دی به دین', 'دین', 'ارد', 'اشتاد', 'آسمان', 'زامیاد', 'مانتره سپند', 'انارام', 'زیادی'] } }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var PersianDateClass = __webpack_require__(1); PersianDateClass.calendarType = 'persian'; PersianDateClass.leapYearMode = 'astronomical'; PersianDateClass.localType = 'fa'; module.exports = PersianDateClass; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Container = function Container() { _classCallCheck(this, Container); this.gDate = null; /** * * @type {number} */ this.modifiedjulianday = 0; /** * * @type {number} */ this.julianday = 0; /** * * @type {{day: number}} */ this.gregserial = { day: 0 }; this.zone = 0; /** * * @type {{year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, weekday: number, unix: number, leap: number}} */ this.gregorian = { year: 0, month: 0, day: 0, hour: 0, minute: 0, second: 0, millisecond: 0, weekday: 0, unix: 0, leap: 0 }; /** * * @type {{year: number, month: number, day: number, leap: number, weekday: number}} */ this.juliancalendar = { year: 0, month: 0, day: 0, leap: 0, weekday: 0 }; /** * * @type {{year: number, month: number, day: number, leap: number, weekday: number}} */ this.islamic = { year: 0, month: 0, day: 0, leap: 0, weekday: 0 }; /** * * @type {{year: number, month: number, day: number, leap: number, weekday: number}} */ this.persianAlgo = this.persian = { year: 0, month: 0, day: 0, leap: 0, weekday: 0 }; /** * * @type {{year: number, month: number, day: number, leap: number, weekday: number}} */ this.persianAstro = { year: 0, month: 0, day: 0, leap: 0, weekday: 0 }; /** * * @type {{year: number, week: number, day: number}} */ this.isoweek = { year: 0, week: 0, day: 0 }; /** * * @type {{year: number, day: number}} */ this.isoday = { year: 0, day: 0 }; }; module.exports = Container; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { /** * @param input * @returns {boolean} */ isArray: function isArray(input) { return Object.prototype.toString.call(input) === '[object Array]'; }, /** * * @param input * @returns {boolean} */ isNumber: function isNumber(input) { return typeof input === 'number'; }, /** * * @param input * @returns {boolean} */ isDate: function isDate(input) { return input instanceof Date; } }; /***/ }) /******/ ]); }); |