bs-ad-calendar-react 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,78 +1,78 @@
1
- import { jsx as g, jsxs as S, Fragment as pe } from "react/jsx-runtime";
2
- import { useMemo as $t, useState as B, useEffect as Yt, useRef as xt } from "react";
3
- const Q = [1943, 4, 14], Lt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], be = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], W = [[[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365]];
1
+ import { jsxs as C, jsx as g, Fragment as pe } from "react/jsx-runtime";
2
+ import { useMemo as mt, useState as H, useEffect as Dt, useRef as xt } from "react";
3
+ const tt = [1943, 4, 14], Lt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Se = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], _ = [[[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365]];
4
4
  let Rt = class extends Error {
5
5
  constructor(t) {
6
6
  super(t), this.name = "DateOutOfRangeError";
7
7
  }
8
8
  };
9
- const _t = () => Q[0] + 1, jt = () => Q[0] + W.length - 1, Pt = () => 2e3, Wt = () => 2e3 + W.length - 1, yt = (e) => e % 400 === 0 || e % 4 === 0 && e % 100 !== 0, kt = (e) => yt(e) ? be : Lt, Se = (e, t, n) => !(e < _t() || e > jt() || t < 1 || t > 12 || n < 1 || n > kt(e)[t - 1]), Ft = (e, t, n) => {
9
+ const _t = () => tt[0] + 1, jt = () => tt[0] + _.length - 1, Pt = () => 2e3, Wt = () => 2e3 + _.length - 1, yt = (e) => e % 400 === 0 || e % 4 === 0 && e % 100 !== 0, Ct = (e) => yt(e) ? Se : Lt, be = (e, t, n) => !(e < _t() || e > jt() || t < 1 || t > 12 || n < 1 || n > Ct(e)[t - 1]), Nt = (e, t, n) => {
10
10
  let a = e * 365 + n;
11
11
  for (let s = 0; s < t - 1; s++) a += Lt[s];
12
12
  return t <= 2 && (e -= 1), a += Math.floor(e / 4) - Math.floor(e / 100) + Math.floor(e / 400), a;
13
13
  };
14
14
  function Ee(e, t, n) {
15
15
  const a = t + 1;
16
- if (!Se(e, a, n)) throw new Rt("Date out of range");
17
- let s = 2e3, r = 1, o = 1, u = Math.abs(Ft(e, a, n) - Ft(...Q)), i = 0;
18
- for (; u >= W[i][1]; ) u -= W[i][1], s += 1, i += 1;
16
+ if (!be(e, a, n)) throw new Rt("Date out of range");
17
+ let s = 2e3, r = 1, o = 1, i = Math.abs(Nt(e, a, n) - Nt(...tt)), u = 0;
18
+ for (; i >= _[u][1]; ) i -= _[u][1], s += 1, u += 1;
19
19
  let h = 0;
20
- for (; u >= W[i][0][h]; ) u -= W[i][0][h], r += 1, h += 1;
21
- return o += u, [s, r - 1, o];
20
+ for (; i >= _[u][0][h]; ) i -= _[u][0][h], r += 1, h += 1;
21
+ return o += i, [s, r - 1, o];
22
22
  }
23
- const we = (e, t, n) => !(e < Pt() || e > Wt() || t < 1 || t > 12 || n < 1 || n > W[e - 2e3][0][t - 1]), Ye = (e, t, n) => {
23
+ const we = (e, t, n) => !(e < Pt() || e > Wt() || t < 1 || t > 12 || n < 1 || n > _[e - 2e3][0][t - 1]), Ye = (e, t, n) => {
24
24
  let a = n - 1;
25
25
  const s = e - 2e3;
26
- for (let r = 0; r < t - 1; r++) a += W[s][0][r];
27
- for (let r = 0; r < s; r++) a += W[r][1];
26
+ for (let r = 0; r < t - 1; r++) a += _[s][0][r];
27
+ for (let r = 0; r < s; r++) a += _[r][1];
28
28
  return a;
29
29
  }, ke = (e, t, n) => {
30
30
  const a = t + 1;
31
31
  if (!we(e, a, n)) throw new Rt("Date out of range");
32
- let [s, r, o] = [Q[0], 1, 1];
33
- const u = kt(s).slice(0, Q[1] - 1).reduce((D, d) => D + d, 0) + Q[2] - 1;
34
- let i = Math.abs(Ye(e, a, n) + u);
35
- for (; i >= 366 && yt(s) || i >= 365 && !yt(s); ) i -= yt(s) ? 366 : 365, s += 1;
36
- const h = kt(s);
32
+ let [s, r, o] = [tt[0], 1, 1];
33
+ const i = Ct(s).slice(0, tt[1] - 1).reduce((f, l) => f + l, 0) + tt[2] - 1;
34
+ let u = Math.abs(Ye(e, a, n) + i);
35
+ for (; u >= 366 && yt(s) || u >= 365 && !yt(s); ) u -= yt(s) ? 366 : 365, s += 1;
36
+ const h = Ct(s);
37
37
  let c = 0;
38
- for (; i >= h[c]; ) i -= h[c], r += 1, c += 1;
39
- return o += i, [s, r - 1, o];
40
- }, J = { enMinYear: _t, enMaxYear: jt, npMinYear: Pt, npMaxYear: Wt, englishToNepali: Ee, nepaliToEnglish: ke }, Ut = "en", L = "ne", Jt = 207e5, Vt = 198e5, Ce = 5049018e5, Ae = new Date(1986, 0, 1, 0, 15), Mt = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], Ct = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], Kt = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], ve = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], At = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], vt = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], $e = ["जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"], xe = ["जन", "फेब", "मार", "अप्रि", "मे", "जुन", "जुला", "अग", "सेप", "अक्टो", "नोभे", "डिसे"], Gt = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], tt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], pt = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], zt = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], qt = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"], Fe = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DD?|ddd?d?|do?|YYYY|YY|y{2,4}|yo?|a|A|hh?|HH?|mm?|ss?|SSS|x|X|.)/g, Oe = (e) => {
41
- const t = e.getTime(), n = t < Ce ? Vt : Jt, a = new Date(t + n), s = a.getUTCFullYear(), r = a.getUTCMonth(), o = a.getUTCDate(), u = a.getUTCHours(), i = a.getUTCMinutes(), h = a.getUTCSeconds(), c = a.getUTCMilliseconds(), D = a.getUTCDay();
42
- return { year: s, month0: r, day: o, hour: u, minute: i, second: h, ms: c, weekDay: D };
43
- }, Ot = (e, t, n, a, s, r, o) => {
44
- const u = new Date(e, t, n, a, s, r, o);
45
- let i = u < Ae ? Vt : Jt;
46
- const h = -1 * u.getTimezoneOffset() * 60 * 1e3;
47
- return new Date(u.getTime() - i + h);
38
+ for (; u >= h[c]; ) u -= h[c], r += 1, c += 1;
39
+ return o += u, [s, r - 1, o];
40
+ }, W = { enMinYear: _t, enMaxYear: jt, npMinYear: Pt, npMaxYear: Wt, englishToNepali: Ee, nepaliToEnglish: ke }, Ut = "en", T = "ne", Jt = 207e5, Kt = 198e5, Ce = 5049018e5, $e = new Date(1986, 0, 1, 0, 15), pt = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], $t = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], Gt = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], Ae = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], At = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], vt = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ve = ["जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"], Fe = ["जन", "फेब", "मार", "अप्रि", "मे", "जुन", "जुला", "अग", "सेप", "अक्टो", "नोभे", "डिसे"], zt = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], et = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], St = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Vt = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], qt = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"], xe = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DD?|ddd?d?|do?|YYYY|YY|y{2,4}|yo?|a|A|hh?|HH?|mm?|ss?|SSS|x|X|.)/g, Ne = (e) => {
41
+ const t = e.getTime(), n = t < Ce ? Kt : Jt, a = new Date(t + n), s = a.getUTCFullYear(), r = a.getUTCMonth(), o = a.getUTCDate(), i = a.getUTCHours(), u = a.getUTCMinutes(), h = a.getUTCSeconds(), c = a.getUTCMilliseconds(), f = a.getUTCDay();
42
+ return { year: s, month0: r, day: o, hour: i, minute: u, second: h, ms: c, weekDay: f };
43
+ }, Ht = (e, t, n, a, s, r, o) => {
44
+ const i = new Date(e, t, n, a, s, r, o);
45
+ let u = i < $e ? Kt : Jt;
46
+ const h = -1 * i.getTimezoneOffset() * 60 * 1e3;
47
+ return new Date(i.getTime() - u + h);
48
48
  }, bt = (e) => {
49
- const t = e.match(Fe);
49
+ const t = e.match(xe);
50
50
  return t ? t.map((n) => n.startsWith("[") && n.endsWith("]") ? n.slice(1, -1) : n) : [];
51
- }, P = (e) => {
51
+ }, R = (e) => {
52
52
  if (e.length === 0) return new RegExp("");
53
53
  let t = [...e];
54
54
  if (t = t.sort((a, s) => s.length - a.length), t[0] === "") return new RegExp("");
55
55
  const n = `(${t.join("|")})`;
56
56
  return new RegExp(n);
57
- }, F = (e) => e.toString().padStart(2, "0"), Xt = (e) => e.toString().padStart(3, "0"), Ne = (e) => e.split("").map((t) => Gt[t.charCodeAt(0) - 48]).join(""), b = (e, t) => {
57
+ }, x = (e) => e.toString().padStart(2, "0"), Xt = (e) => e.toString().padStart(3, "0"), He = (e) => e.split("").map((t) => zt[t.charCodeAt(0) - 48]).join(""), Y = (e, t) => {
58
58
  const n = typeof e == "string" ? e : String(e);
59
- return t !== L ? n : Ne(n);
60
- }, Te = (e, t) => b(e.getYear(), t).substring(2), He = (e, t) => b(e.getYear(), t), Be = (e, t) => b(e.getEnglishYear(), t).substring(2), Ie = (e, t) => b(e.getEnglishYear(), t), Le = (e, t) => b(e.getMonth() + 1, t), Re = (e, t) => b(F(e.getMonth() + 1), t), _e = (e, t) => t === L ? ve[e.getMonth()] : Ct[e.getMonth()], je = (e, t) => t === L ? Kt[e.getMonth()] : Mt[e.getMonth()], Pe = (e, t) => b(e.getEnglishMonth() + 1, t), We = (e, t) => b(F(e.getEnglishMonth() + 1), t), Ue = (e, t) => t === L ? xe[e.getEnglishMonth()] : vt[e.getEnglishMonth()], Je = (e, t) => t === L ? $e[e.getEnglishMonth()] : At[e.getEnglishMonth()], Ve = (e, t) => b(e.getDate(), t), Ke = (e, t) => b(F(e.getDate()), t), Ge = (e, t) => b(e.getEnglishDate(), t), ze = (e, t) => b(F(e.getEnglishDate()), t), Zt = (e, t) => b(e.getDay(), t), ft = (e, t) => t === L ? zt[e.getDay()] : tt[e.getDay()], Qt = (e, t) => t === L ? qt[e.getDay()] : pt[e.getDay()], te = (e, t) => b(e.getHours(), t), ee = (e, t) => b(F(e.getHours()), t), ne = (e, t) => {
59
+ return t !== T ? n : He(n);
60
+ }, Oe = (e, t) => Y(e.getYear(), t).substring(2), Be = (e, t) => Y(e.getYear(), t), Te = (e, t) => Y(e.getEnglishYear(), t).substring(2), Ie = (e, t) => Y(e.getEnglishYear(), t), Le = (e, t) => Y(e.getMonth() + 1, t), Re = (e, t) => Y(x(e.getMonth() + 1), t), _e = (e, t) => t === T ? Ae[e.getMonth()] : $t[e.getMonth()], je = (e, t) => t === T ? Gt[e.getMonth()] : pt[e.getMonth()], Pe = (e, t) => Y(e.getEnglishMonth() + 1, t), We = (e, t) => Y(x(e.getEnglishMonth() + 1), t), Ue = (e, t) => t === T ? Fe[e.getEnglishMonth()] : vt[e.getEnglishMonth()], Je = (e, t) => t === T ? ve[e.getEnglishMonth()] : At[e.getEnglishMonth()], Ke = (e, t) => Y(e.getDate(), t), Ge = (e, t) => Y(x(e.getDate()), t), ze = (e, t) => Y(e.getEnglishDate(), t), Ve = (e, t) => Y(x(e.getEnglishDate()), t), Zt = (e, t) => Y(e.getDay(), t), ft = (e, t) => t === T ? Vt[e.getDay()] : et[e.getDay()], Qt = (e, t) => t === T ? qt[e.getDay()] : St[e.getDay()], te = (e, t) => Y(e.getHours(), t), ee = (e, t) => Y(x(e.getHours()), t), ne = (e, t) => {
61
61
  const n = e.getHours(), a = n > 12 ? n - 12 : n;
62
- return b(a, t);
62
+ return Y(a, t);
63
63
  }, se = (e, t) => {
64
64
  const n = e.getHours(), a = n > 12 ? n - 12 : n;
65
- return b(F(a), t);
66
- }, ae = (e, t) => b(e.getMinutes(), t), re = (e, t) => b(F(e.getMinutes()), t), oe = (e, t) => b(e.getSeconds(), t), ie = (e, t) => b(F(e.getSeconds()), t), ue = (e, t) => b(Xt(e.getMilliseconds()), t), ce = (e, t) => t === L ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "PM" : "AM", he = (e, t) => t === L ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "pm" : "am", Nt = { YY: Te, YYYY: He, M: Le, MM: Re, MMM: _e, MMMM: je, D: Ve, DD: Ke, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, le = (e, t, n) => {
67
- const a = bt(t), s = (r) => r in Nt ? Nt[r](e, n) : r;
65
+ return Y(x(a), t);
66
+ }, ae = (e, t) => Y(e.getMinutes(), t), re = (e, t) => Y(x(e.getMinutes()), t), oe = (e, t) => Y(e.getSeconds(), t), ie = (e, t) => Y(x(e.getSeconds()), t), ue = (e, t) => Y(Xt(e.getMilliseconds()), t), ce = (e, t) => t === T ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "PM" : "AM", he = (e, t) => t === T ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "pm" : "am", Ot = { YY: Oe, YYYY: Be, M: Le, MM: Re, MMM: _e, MMMM: je, D: Ke, DD: Ge, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, le = (e, t, n) => {
67
+ const a = bt(t), s = (r) => r in Ot ? Ot[r](e, n) : r;
68
68
  return a.map(s).join("");
69
- }, qe = (e, t) => le(e, t, Ut), Xe = (e, t) => le(e, t, L), Ze = (e) => {
70
- const t = F(e.getYear()), n = F(e.getMonth() + 1), a = F(e.getDate()), s = F(e.getHours()), r = F(e.getMinutes()), o = F(e.getSeconds()), u = e.getMilliseconds(), i = u === 0 ? "" : `.${Xt(u)}`;
71
- return `${t}-${n}-${a} ${s}:${r}:${o}${i}`;
72
- }, Tt = { YY: Be, YYYY: Ie, M: Pe, MM: We, MMM: Ue, MMMM: Je, D: Ge, DD: ze, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, de = (e, t, n) => {
73
- const a = bt(t), s = (r) => r in Tt ? Tt[r](e, n) : r;
69
+ }, qe = (e, t) => le(e, t, Ut), Xe = (e, t) => le(e, t, T), Ze = (e) => {
70
+ const t = x(e.getYear()), n = x(e.getMonth() + 1), a = x(e.getDate()), s = x(e.getHours()), r = x(e.getMinutes()), o = x(e.getSeconds()), i = e.getMilliseconds(), u = i === 0 ? "" : `.${Xt(i)}`;
71
+ return `${t}-${n}-${a} ${s}:${r}:${o}${u}`;
72
+ }, Bt = { YY: Te, YYYY: Ie, M: Pe, MM: We, MMM: Ue, MMMM: Je, D: ze, DD: Ve, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, de = (e, t, n) => {
73
+ const a = bt(t), s = (r) => r in Bt ? Bt[r](e, n) : r;
74
74
  return a.map(s).join("");
75
- }, Qe = (e, t) => de(e, t, Ut), t3 = (e, t) => de(e, t, L);
75
+ }, Qe = (e, t) => de(e, t, Ut), t3 = (e, t) => de(e, t, T);
76
76
  function e3(e) {
77
77
  const t = e.split(/[-./]/, 3), [n, a = 1, s = 1] = t.map((r) => {
78
78
  const o = parseInt(r, 10);
@@ -83,149 +83,149 @@ function e3(e) {
83
83
  }
84
84
  function n3(e) {
85
85
  if (!e) return [0, 0, 0, 0];
86
- const [t, n = "0"] = e.split(".", 2), a = t.split(":", 3), [s, r = 0, o = 0] = a.map((i) => {
87
- const h = parseInt(i, 10);
86
+ const [t, n = "0"] = e.split(".", 2), a = t.split(":", 3), [s, r = 0, o = 0] = a.map((u) => {
87
+ const h = parseInt(u, 10);
88
88
  if (Number.isNaN(h)) throw new Error("Invalid time");
89
89
  return h;
90
90
  });
91
- let u = parseInt(n, 10);
92
- return Number.isNaN(u) && (u = 0), [s, r, o, u];
91
+ let i = parseInt(n, 10);
92
+ return Number.isNaN(i) && (i = 0), [s, r, o, i];
93
93
  }
94
94
  function s3(e) {
95
- const [t, n] = e.split(" ", 2), [a, s, r] = e3(t), [o, u, i, h] = n3(n);
96
- return [a, s, r, o, u, i, h];
95
+ const [t, n] = e.split(" ", 2), [a, s, r] = e3(t), [o, i, u, h] = n3(n);
96
+ return [a, s, r, o, i, u, h];
97
97
  }
98
- const Ht = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: P(Mt), MMM: P(Ct), dddd: P(pt), ddd: P(tt), dd: P(tt), d: /([0-6])/ };
98
+ const Tt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: R(pt), MMM: R($t), dddd: R(St), ddd: R(et), dd: R(et), d: /([0-6])/ };
99
99
  function a3(e) {
100
100
  const t = [], n = [];
101
- for (const s of e) s in Ht ? (t.push(s), n.push(Ht[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
101
+ for (const s of e) s in Tt ? (t.push(s), n.push(Tt[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
102
102
  const a = n.join("");
103
103
  return { dateTokens: t, regex: new RegExp(`^${a}$`) };
104
104
  }
105
105
  function r3(e, t) {
106
- let [n, a, s, r, o, u, i, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, D = !1;
107
- for (let d = 0; d < e.length; d++) {
108
- const k = e[d], m = parseInt(t[d + 1]);
109
- switch (k) {
106
+ let [n, a, s, r, o, i, u, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
107
+ for (let l = 0; l < e.length; l++) {
108
+ const $ = e[l], D = parseInt(t[l + 1]);
109
+ switch ($) {
110
110
  case "YYYY":
111
- n = m;
111
+ n = D;
112
112
  break;
113
113
  case "YY":
114
- n = 2e3 + parseInt(t[d]);
114
+ n = 2e3 + parseInt(t[l]);
115
115
  break;
116
116
  case "MM":
117
117
  case "M":
118
- a = m;
118
+ a = D;
119
119
  break;
120
120
  case "MMMM":
121
- a = Mt.indexOf(t[d + 1]) + 1;
121
+ a = pt.indexOf(t[l + 1]) + 1;
122
122
  break;
123
123
  case "MMM":
124
- a = Ct.indexOf(t[d + 1]) + 1;
124
+ a = $t.indexOf(t[l + 1]) + 1;
125
125
  break;
126
126
  case "DD":
127
127
  case "D":
128
- s = m;
128
+ s = D;
129
129
  break;
130
130
  case "HH":
131
131
  case "H":
132
- r = m;
132
+ r = D;
133
133
  break;
134
134
  case "hh":
135
135
  case "h":
136
- o = m, D = !0;
136
+ o = D, f = !0;
137
137
  break;
138
138
  case "mm":
139
139
  case "m":
140
- u = m;
140
+ i = D;
141
141
  break;
142
142
  case "ss":
143
143
  case "s":
144
- i = m;
144
+ u = D;
145
145
  break;
146
146
  case "SSS":
147
- h = m;
147
+ h = D;
148
148
  break;
149
149
  case "A":
150
150
  case "a":
151
- c = t[d + 1].toLowerCase() === "pm";
151
+ c = t[l + 1].toLowerCase() === "pm";
152
152
  }
153
153
  }
154
- return D && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: u, second: i, ms: h };
154
+ return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: i, second: u, ms: h };
155
155
  }
156
156
  function ge(e, t) {
157
157
  const n = bt(t), { dateTokens: a, regex: s } = a3(n), r = RegExp(s).exec(e);
158
158
  if (!r) throw new Error("Invalid date format");
159
- const { year: o, month0: u, day: i, hour: h, minute: c, second: D, ms: d } = r3(a, r);
160
- return [o, u, i, h, c, D, d];
159
+ const { year: o, month0: i, day: u, hour: h, minute: c, second: f, ms: l } = r3(a, r);
160
+ return [o, i, u, h, c, f, l];
161
161
  }
162
- const Bt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: P(At), MMM: P(vt), dddd: P(pt), ddd: P(tt), dd: P(tt), d: /([0-6])/ };
162
+ const It = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: R(At), MMM: R(vt), dddd: R(St), ddd: R(et), dd: R(et), d: /([0-6])/ };
163
163
  function o3(e) {
164
164
  const t = [], n = [];
165
- for (const s of e) s in Bt ? (t.push(s), n.push(Bt[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
165
+ for (const s of e) s in It ? (t.push(s), n.push(It[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
166
166
  const a = n.join("");
167
167
  return { dateTokens: t, regex: new RegExp(`^${a}$`) };
168
168
  }
169
169
  function i3(e, t) {
170
- let [n, a, s, r, o, u, i, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, D = !1;
171
- for (let d = 0; d < e.length; d++) {
172
- const k = e[d], m = parseInt(t[d + 1]);
173
- switch (k) {
170
+ let [n, a, s, r, o, i, u, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
171
+ for (let l = 0; l < e.length; l++) {
172
+ const $ = e[l], D = parseInt(t[l + 1]);
173
+ switch ($) {
174
174
  case "YYYY":
175
- n = m;
175
+ n = D;
176
176
  break;
177
177
  case "YY":
178
- n = 2e3 + parseInt(t[d]);
178
+ n = 2e3 + parseInt(t[l]);
179
179
  break;
180
180
  case "MM":
181
181
  case "M":
182
- a = m;
182
+ a = D;
183
183
  break;
184
184
  case "MMMM":
185
- a = At.indexOf(t[d + 1]) + 1;
185
+ a = At.indexOf(t[l + 1]) + 1;
186
186
  break;
187
187
  case "MMM":
188
- a = vt.indexOf(t[d + 1]) + 1;
188
+ a = vt.indexOf(t[l + 1]) + 1;
189
189
  break;
190
190
  case "DD":
191
191
  case "D":
192
- s = m;
192
+ s = D;
193
193
  break;
194
194
  case "HH":
195
195
  case "H":
196
- r = m;
196
+ r = D;
197
197
  break;
198
198
  case "hh":
199
199
  case "h":
200
- o = m, D = !0;
200
+ o = D, f = !0;
201
201
  break;
202
202
  case "mm":
203
203
  case "m":
204
- u = m;
204
+ i = D;
205
205
  break;
206
206
  case "ss":
207
207
  case "s":
208
- i = m;
208
+ u = D;
209
209
  break;
210
210
  case "SSS":
211
- h = m;
211
+ h = D;
212
212
  break;
213
213
  case "A":
214
214
  case "a":
215
- c = t[d + 1].toLowerCase() === "pm";
215
+ c = t[l + 1].toLowerCase() === "pm";
216
216
  }
217
217
  }
218
- return D && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: u, second: i, ms: h };
218
+ return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: i, second: u, ms: h };
219
219
  }
220
220
  function u3(e, t) {
221
221
  const n = bt(t), { dateTokens: a, regex: s } = o3(n), r = RegExp(s).exec(e);
222
222
  if (!r) throw new Error("Invalid date format");
223
- const { year: o, month0: u, day: i, hour: h, minute: c, second: D, ms: d } = i3(a, r);
224
- return [o, u, i, h, c, D, d];
223
+ const { year: o, month0: i, day: u, hour: h, minute: c, second: f, ms: l } = i3(a, r);
224
+ return [o, i, u, h, c, f, l];
225
225
  }
226
226
  function c3(e) {
227
227
  const t = { एम: "AM", पिम: "PM" };
228
- Kt.forEach((a, s) => t[a] = Mt[s]), qt.forEach((a, s) => t[a] = pt[s]), zt.forEach((a, s) => t[a] = tt[s]), Gt.forEach((a, s) => t[a] = String(s));
228
+ Gt.forEach((a, s) => t[a] = pt[s]), qt.forEach((a, s) => t[a] = St[s]), Vt.forEach((a, s) => t[a] = et[s]), zt.forEach((a, s) => t[a] = String(s));
229
229
  const n = new RegExp(Object.keys(t).join("|"), "g");
230
230
  return e.replace(n, (a) => t[a]);
231
231
  }
@@ -233,23 +233,23 @@ function h3(e, t) {
233
233
  const n = c3(e);
234
234
  return ge(n, t);
235
235
  }
236
- class St extends Error {
236
+ class Et extends Error {
237
237
  constructor(t) {
238
238
  super(t), this.name = "ValidationError";
239
239
  }
240
240
  }
241
241
  const l3 = (e) => {
242
- if (e < 0 || e > 23) throw new St("Hour should be in the range 0-23");
242
+ if (e < 0 || e > 23) throw new Et("Hour should be in the range 0-23");
243
243
  }, d3 = (e) => {
244
- if (e < 0 || e > 59) throw new St("Minute should be in the range 0-59");
244
+ if (e < 0 || e > 59) throw new Et("Minute should be in the range 0-59");
245
245
  }, g3 = (e) => {
246
- if (e < 0 || e > 59) throw new St("Second should be in the range 0-59");
246
+ if (e < 0 || e > 59) throw new Et("Second should be in the range 0-59");
247
247
  }, m3 = (e) => {
248
- if (e < 0 || e > 999) throw new St("Millisecond should be in the range 0-999");
248
+ if (e < 0 || e > 999) throw new Et("Millisecond should be in the range 0-999");
249
249
  }, D3 = (e, t, n, a) => {
250
250
  l3(e), d3(t), g3(n), m3(a);
251
251
  };
252
- class Y {
252
+ class w {
253
253
  timestamp;
254
254
  year;
255
255
  yearEn;
@@ -263,7 +263,7 @@ class Y {
263
263
  constructor(...t) {
264
264
  if (t.length === 0) this.initFromCurrentDate();
265
265
  else if (t.length === 1 && t[0] instanceof Date) this.initFromEnglishDate(t[0]);
266
- else if (t.length === 1 && t[0] instanceof Y) this.initFromNepaliDate(t[0]);
266
+ else if (t.length === 1 && t[0] instanceof w) this.initFromNepaliDate(t[0]);
267
267
  else if (t.length === 1 && typeof t[0] == "string") this.parseFromString(t[0]);
268
268
  else if (t.length === 1 && typeof t[0] == "number") this.initFromTimestamp(t[0]);
269
269
  else if (t.length === 2 && typeof t[0] == "string" && typeof t[1] == "string") this.parseFromStringWithFormat(t[0], t[1]);
@@ -295,10 +295,10 @@ class Y {
295
295
  }
296
296
  _setDateObject(t, n = !0) {
297
297
  this.timestamp = t;
298
- const { year: a, month0: s, day: r, hour: o, minute: u, weekDay: i } = Oe(t);
299
- if (this.yearEn = a, this.monthEn = s, this.dayEn = r, this.hour = o, this.minute = u, this.weekDay = i, n) {
300
- const [h, c, D] = J.englishToNepali(a, s, r);
301
- this.year = h, this.month = c, this.day = D;
298
+ const { year: a, month0: s, day: r, hour: o, minute: i, weekDay: u } = Ne(t);
299
+ if (this.yearEn = a, this.monthEn = s, this.dayEn = r, this.hour = o, this.minute = i, this.weekDay = u, n) {
300
+ const [h, c, f] = W.englishToNepali(a, s, r);
301
+ this.year = h, this.month = c, this.day = f;
302
302
  }
303
303
  }
304
304
  getDateObject() {
@@ -364,10 +364,10 @@ class Y {
364
364
  setTime(t) {
365
365
  this._setDateObject(new Date(t));
366
366
  }
367
- set(t, n, a, s, r, o, u) {
368
- D3(s, r, o, u);
369
- const [i, h, c] = J.nepaliToEnglish(t, n, a);
370
- this.year = t, this.month = n, this.day = a, this._setDateObject(Ot(i, h, c, s, r, o, u), !1);
367
+ set(t, n, a, s, r, o, i) {
368
+ D3(s, r, o, i);
369
+ const [u, h, c] = W.nepaliToEnglish(t, n, a);
370
+ this.year = t, this.month = n, this.day = a, this._setDateObject(Ht(u, h, c, s, r, o, i), !1);
371
371
  }
372
372
  setDateObject(t) {
373
373
  this._setDateObject(t, !0);
@@ -387,35 +387,35 @@ class Y {
387
387
  formatEnglishDateInNepali(t) {
388
388
  return t3(this, t);
389
389
  }
390
- static fromEnglishDate(t, n, a, s = 0, r = 0, o = 0, u = 0) {
391
- const i = Ot(t, n, a, s, r, o, u);
392
- return new Y(i);
390
+ static fromEnglishDate(t, n, a, s = 0, r = 0, o = 0, i = 0) {
391
+ const u = Ht(t, n, a, s, r, o, i);
392
+ return new w(u);
393
393
  }
394
394
  static parseNepaliFormat(t, n) {
395
- const [a, s, r, o, u, i, h] = h3(t, n);
396
- return new Y(a, s, r, o, u, i, h);
395
+ const [a, s, r, o, i, u, h] = h3(t, n);
396
+ return new w(a, s, r, o, i, u, h);
397
397
  }
398
398
  static parseEnglishDate(t, n) {
399
- const [a, s, r, o, u, i, h] = u3(t, n);
400
- return Y.fromEnglishDate(a, s, r, o, u, i, h);
399
+ const [a, s, r, o, i, u, h] = u3(t, n);
400
+ return w.fromEnglishDate(a, s, r, o, i, u, h);
401
401
  }
402
402
  static getDaysOfMonth(t, n) {
403
- if (t < J.npMinYear() || t > J.npMaxYear()) throw new Error("Year out of range");
403
+ if (t < W.npMinYear() || t > W.npMaxYear()) throw new Error("Year out of range");
404
404
  if (n < 0 || n > 11) throw new Error("Month out of range");
405
- return W[t - J.npMinYear()][0][n];
405
+ return _[t - W.npMinYear()][0][n];
406
406
  }
407
407
  static minSupportedDate() {
408
- return Y.fromEnglishDate(J.enMinYear(), 0, 1).getDateObject();
408
+ return w.fromEnglishDate(W.enMinYear(), 0, 1).getDateObject();
409
409
  }
410
410
  static maxSupportedDate() {
411
- return Y.fromEnglishDate(J.enMaxYear(), 11, 31).getDateObject();
411
+ return w.fromEnglishDate(W.enMaxYear(), 11, 31).getDateObject();
412
412
  }
413
413
  static minSupportedNepaliDate() {
414
- return new Y(J.npMinYear(), 0, 1);
414
+ return new w(W.npMinYear(), 0, 1);
415
415
  }
416
416
  static maxSupportedNepaliDate() {
417
- const t = J.npMaxYear();
418
- return new Y(t, 11, this.getDaysOfMonth(t, 11));
417
+ const t = W.npMaxYear();
418
+ return new w(t, 11, this.getDaysOfMonth(t, 11));
419
419
  }
420
420
  static minimum() {
421
421
  return console.warn("`NepaliDate.minimum()` is deprecated and will be removed in a future version. Please use `NepaliDate.minSupportedDate()` instead."), this.minSupportedDate();
@@ -463,7 +463,7 @@ const y3 = [
463
463
  "October",
464
464
  "November",
465
465
  "December"
466
- ], M3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], p3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], b3 = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], O3 = {
466
+ ], M3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], p3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], S3 = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], N3 = {
467
467
  light: {
468
468
  primary: "#3b82f6",
469
469
  background: "#ffffff",
@@ -484,19 +484,19 @@ const y3 = [
484
484
  today: "#1e40af",
485
485
  disabled: "#6b7280"
486
486
  }
487
- }, V = (e) => e.toString().split("").map((t) => b3[parseInt(t)]).join(""), De = (e, t, n) => {
487
+ }, U = (e) => e.toString().split("").map((t) => S3[parseInt(t)]).join(""), De = (e, t, n) => {
488
488
  if (e === "BS")
489
489
  try {
490
- const a = n === 11 ? new Y(t + 1, 0, 1) : new Y(t, n + 1, 1);
491
- return new Y(a.getTime() - 1440 * 60 * 1e3).getDate();
490
+ const a = n === 11 ? new w(t + 1, 0, 1) : new w(t, n + 1, 1);
491
+ return new w(a.getTime() - 1440 * 60 * 1e3).getDate();
492
492
  } catch {
493
493
  return 30;
494
494
  }
495
495
  return new Date(t, n + 1, 0).getDate();
496
- }, S3 = (e, t, n) => {
496
+ }, b3 = (e, t, n) => {
497
497
  if (e === "BS")
498
498
  try {
499
- return new Y(t, n, 1).getDay() || 0;
499
+ return new w(t, n, 1).getDay() || 0;
500
500
  } catch {
501
501
  return 0;
502
502
  }
@@ -505,30 +505,22 @@ const y3 = [
505
505
  const t = /* @__PURE__ */ new Date();
506
506
  if (e === "BS")
507
507
  try {
508
- const n = Y.fromEnglishDate(t.getFullYear(), t.getMonth(), t.getDate());
508
+ const n = w.fromEnglishDate(t.getFullYear(), t.getMonth(), t.getDate());
509
509
  return { year: n.getYear(), month: n.getMonth(), day: n.getDate() };
510
510
  } catch {
511
511
  return { year: 2081, month: 0, day: 1 };
512
512
  }
513
513
  return { year: t.getFullYear(), month: t.getMonth(), day: t.getDate() };
514
- }, wt = (e, t, n, a, s) => {
514
+ }, kt = (e, t, n, a, s) => {
515
515
  if (e === "BS")
516
516
  try {
517
- const r = new Y(t, n, a), u = new Date(
518
- r.getEnglishYear(),
519
- r.getEnglishMonth(),
520
- r.getEnglishDate()
521
- ).toISOString().split("T")[0];
517
+ const r = new w(t, n, a), o = r.getEnglishYear(), i = r.getEnglishMonth(), u = r.getEnglishDate(), h = `${o}-${String(i + 1).padStart(2, "0")}-${String(u).padStart(2, "0")}`;
522
518
  return {
523
519
  bs: `${t}-${String(n + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`,
524
- ad: u,
520
+ ad: h,
525
521
  formatted: {
526
522
  bs: `${s[n]} ${a}, ${t}`,
527
- ad: new Date(
528
- r.getEnglishYear(),
529
- r.getEnglishMonth(),
530
- r.getEnglishDate()
531
- ).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
523
+ ad: new Date(o, i, u).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
532
524
  }
533
525
  };
534
526
  } catch {
@@ -543,119 +535,120 @@ const y3 = [
543
535
  };
544
536
  }
545
537
  else {
546
- const r = new Date(t, n, a), o = r.toISOString().split("T")[0];
538
+ const r = `${t}-${String(n + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`, o = new Date(t, n, a);
547
539
  try {
548
- const u = Y.fromEnglishDate(t, n, a), i = `${u.getYear()}-${String(u.getMonth() + 1).padStart(2, "0")}-${String(u.getDate()).padStart(2, "0")}`;
540
+ const i = w.fromEnglishDate(t, n, a), u = `${i.getYear()}-${String(i.getMonth() + 1).padStart(2, "0")}-${String(i.getDate()).padStart(2, "0")}`;
549
541
  return {
550
- ad: o,
551
- bs: i,
542
+ ad: r,
543
+ bs: u,
552
544
  formatted: {
553
- ad: r.toLocaleDateString("en-US", {
545
+ ad: o.toLocaleDateString("en-US", {
554
546
  year: "numeric",
555
547
  month: "long",
556
548
  day: "numeric"
557
549
  }),
558
- bs: `${me[u.getMonth()]} ${u.getDate()}, ${u.getYear()}`
550
+ bs: `${me[i.getMonth()]} ${i.getDate()}, ${i.getYear()}`
559
551
  }
560
552
  };
561
553
  } catch {
562
554
  return {
563
- ad: o,
564
- bs: o,
555
+ ad: r,
556
+ bs: r,
565
557
  formatted: {
566
- ad: r.toLocaleDateString("en-US", {
558
+ ad: o.toLocaleDateString("en-US", {
567
559
  year: "numeric",
568
560
  month: "long",
569
561
  day: "numeric"
570
562
  }),
571
- bs: r.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
563
+ bs: o.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
572
564
  }
573
565
  };
574
566
  }
575
567
  }
576
- }, N3 = (e, t, n) => {
568
+ }, H3 = (e, t, n) => {
577
569
  const a = new Date(e.year, e.month, e.day).getTime(), s = new Date(t.year, t.month, t.day).getTime(), r = new Date(n.year, n.month, n.day).getTime();
578
570
  return a >= s && a <= r;
579
- }, It = (e) => {
571
+ }, Mt = (e) => {
580
572
  try {
581
573
  const [t, n, a] = e.split("-").map(Number);
582
574
  return !t || !n || !a ? null : { year: t, month: n - 1, day: a };
583
575
  } catch {
584
576
  return null;
585
577
  }
586
- }, et = (e, t, n) => {
578
+ }, nt = (e, t, n) => {
587
579
  if (!t && !n) return !1;
588
580
  const a = new Date(e.year, e.month, e.day).getTime();
589
581
  if (t) {
590
- const s = It(t);
582
+ const s = Mt(t);
591
583
  if (s) {
592
584
  const r = new Date(s.year, s.month, s.day).getTime();
593
585
  if (a < r) return !0;
594
586
  }
595
587
  }
596
588
  if (n) {
597
- const s = It(n);
589
+ const s = Mt(n);
598
590
  if (s) {
599
591
  const r = new Date(s.year, s.month, s.day).getTime();
600
592
  if (a > r) return !0;
601
593
  }
602
594
  }
603
595
  return !1;
604
- }, E3 = (e = "AD") => {
605
- const t = $t(() => N(e), [e]), [n, a] = B(t.year), [s, r] = B(t.month), [o, u] = B(null), [i, h] = B(null), [c, D] = B(null);
606
- Yt(() => {
607
- a(t.year), r(t.month);
608
- }, [t.year, t.month]);
609
- const d = $t(() => {
610
- const E = De(e, n, s), v = S3(e, n, s), p = [];
611
- for (let C = 0; C < v; C++)
612
- p.push(null);
613
- for (let C = 1; C <= E; C++)
614
- p.push(C);
615
- return p;
616
- }, [n, s, e]);
596
+ }, E3 = (e = "AD", t) => {
597
+ const n = mt(() => N(e), [e]), a = mt(() => t ? Mt(t) : null, [t]), [s, r] = H(a?.year ?? n.year), [o, i] = H(a?.month ?? n.month), [u, h] = H(a), [c, f] = H(null), [l, $] = H(null);
598
+ Dt(() => {
599
+ const M = t ? Mt(t) : null;
600
+ M ? (r(M.year), i(M.month)) : (r(n.year), i(n.month));
601
+ }, [e]);
602
+ const D = mt(() => {
603
+ const M = De(e, s, o), B = b3(e, s, o), k = [];
604
+ for (let b = 0; b < B; b++)
605
+ k.push(null);
606
+ for (let b = 1; b <= M; b++)
607
+ k.push(b);
608
+ return k;
609
+ }, [s, o, e]);
617
610
  return {
618
611
  // State
619
- currentYear: n,
620
- currentMonth: s,
621
- selectedDate: o,
622
- rangeStart: i,
623
- rangeEnd: c,
624
- today: t,
625
- calendarDays: d,
612
+ currentYear: s,
613
+ currentMonth: o,
614
+ selectedDate: u,
615
+ rangeStart: c,
616
+ rangeEnd: l,
617
+ today: n,
618
+ calendarDays: D,
626
619
  // Actions
627
- setCurrentYear: a,
628
- setCurrentMonth: r,
629
- setSelectedDate: u,
630
- setRangeStart: h,
631
- setRangeEnd: D,
632
- navigateMonth: (E) => {
633
- let p = s + E, C = n;
634
- for (; p > 11; )
635
- p -= 12, C += 1;
636
- for (; p < 0; )
637
- p += 12, C -= 1;
638
- r(p), a(C);
620
+ setCurrentYear: r,
621
+ setCurrentMonth: i,
622
+ setSelectedDate: h,
623
+ setRangeStart: f,
624
+ setRangeEnd: $,
625
+ navigateMonth: (M) => {
626
+ let k = o + M, b = s;
627
+ for (; k > 11; )
628
+ k -= 12, b += 1;
629
+ for (; k < 0; )
630
+ k += 12, b -= 1;
631
+ i(k), r(b);
639
632
  },
640
633
  // Helpers
641
- isToday: (E) => n === t.year && s === t.month && E === t.day,
642
- isSelected: (E, v = "single") => v === "range" ? !!(i && i.year === n && i.month === s && i.day === E) || !!(c && c.year === n && c.month === s && c.day === E) : !!(o && o.year === n && o.month === s && o.day === E),
643
- isInRange: (E) => {
644
- if (!i || !c) return !1;
645
- const v = new Date(n, s, E).getTime(), p = new Date(i.year, i.month, i.day).getTime(), C = new Date(c.year, c.month, c.day).getTime();
646
- return v >= p && v <= C;
634
+ isToday: (M) => s === n.year && o === n.month && M === n.day,
635
+ isSelected: (M, B = "single") => B === "range" ? !!(c && c.year === s && c.month === o && c.day === M) || !!(l && l.year === s && l.month === o && l.day === M) : !!(u && u.year === s && u.month === o && u.day === M),
636
+ isInRange: (M) => {
637
+ if (!c || !l) return !1;
638
+ const B = new Date(s, o, M).getTime(), k = new Date(c.year, c.month, c.day).getTime(), b = new Date(l.year, l.month, l.day).getTime();
639
+ return B >= k && B <= b;
647
640
  }
648
641
  };
649
- }, Z = (e, t, n) => {
642
+ }, Q = (e, t, n) => {
650
643
  if (n === "BS")
651
644
  try {
652
- const a = new Y(e.year, e.month, e.day), s = new Date(
645
+ const a = new w(e.year, e.month, e.day), s = new Date(
653
646
  a.getEnglishYear(),
654
647
  a.getEnglishMonth(),
655
648
  a.getEnglishDate()
656
649
  );
657
650
  s.setDate(s.getDate() + t);
658
- const r = Y.fromEnglishDate(
651
+ const r = w.fromEnglishDate(
659
652
  s.getFullYear(),
660
653
  s.getMonth(),
661
654
  s.getDate()
@@ -668,7 +661,7 @@ const y3 = [
668
661
  const a = new Date(e.year, e.month, e.day);
669
662
  return a.setDate(a.getDate() + t), { year: a.getFullYear(), month: a.getMonth(), day: a.getDate() };
670
663
  }
671
- }, dt = (e, t, n) => {
664
+ }, ht = (e, t, n) => {
672
665
  if (n === "BS")
673
666
  try {
674
667
  let a = e.year, s = e.month + t;
@@ -685,11 +678,11 @@ const y3 = [
685
678
  const a = new Date(e.year, e.month, e.day);
686
679
  return a.setMonth(a.getMonth() + t), { year: a.getFullYear(), month: a.getMonth(), day: a.getDate() };
687
680
  }
688
- }, z = (e) => ({ year: e.year, month: e.month, day: 1 }), w3 = (e, t) => {
681
+ }, V = (e) => ({ year: e.year, month: e.month, day: 1 }), w3 = (e, t) => {
689
682
  if (t === "BS")
690
683
  try {
691
- const a = new Y(e.year, e.month, e.day).getDay();
692
- return Z(e, -a, "BS");
684
+ const a = new w(e.year, e.month, e.day).getDay();
685
+ return Q(e, -a, "BS");
693
686
  } catch {
694
687
  return e;
695
688
  }
@@ -697,7 +690,7 @@ const y3 = [
697
690
  const n = new Date(e.year, e.month, e.day), a = n.getDay();
698
691
  return n.setDate(n.getDate() - a), { year: n.getFullYear(), month: n.getMonth(), day: n.getDate() };
699
692
  }
700
- }, T3 = {
693
+ }, O3 = {
701
694
  TODAY: "today",
702
695
  YESTERDAY: "yesterday",
703
696
  THIS_WEEK: "thisWeek",
@@ -724,7 +717,7 @@ const y3 = [
724
717
  key: "yesterday",
725
718
  label: "Yesterday",
726
719
  getValue: (s) => {
727
- const r = N(s), o = Z(r, -1, s);
720
+ const r = N(s), o = Q(r, -1, s);
728
721
  return { start: o, end: o };
729
722
  }
730
723
  },
@@ -741,7 +734,7 @@ const y3 = [
741
734
  label: "Last 7 Days",
742
735
  getValue: (s) => {
743
736
  const r = N(s);
744
- return { start: Z(r, -6, s), end: r };
737
+ return { start: Q(r, -6, s), end: r };
745
738
  }
746
739
  },
747
740
  {
@@ -749,7 +742,7 @@ const y3 = [
749
742
  label: "Last 30 Days",
750
743
  getValue: (s) => {
751
744
  const r = N(s);
752
- return { start: Z(r, -29, s), end: r };
745
+ return { start: Q(r, -29, s), end: r };
753
746
  }
754
747
  },
755
748
  {
@@ -757,31 +750,31 @@ const y3 = [
757
750
  label: "This Month",
758
751
  getValue: (s) => {
759
752
  const r = N(s);
760
- return { start: z(r), end: r };
753
+ return { start: V(r), end: r };
761
754
  }
762
755
  },
763
756
  {
764
757
  key: "lastMonth",
765
758
  label: "Last Month",
766
759
  getValue: (s) => {
767
- const r = N(s), o = Z(z(r), -1, s);
768
- return { start: z(o), end: o };
760
+ const r = N(s), o = Q(V(r), -1, s);
761
+ return { start: V(o), end: o };
769
762
  }
770
763
  },
771
764
  {
772
765
  key: "last3months",
773
766
  label: "Last 3 Months",
774
767
  getValue: (s) => {
775
- const r = N(s), o = dt(r, -2, s);
776
- return { start: z(o), end: r };
768
+ const r = N(s), o = ht(r, -2, s);
769
+ return { start: V(o), end: r };
777
770
  }
778
771
  },
779
772
  {
780
773
  key: "last6months",
781
774
  label: "Last 6 Months",
782
775
  getValue: (s) => {
783
- const r = N(s), o = dt(r, -5, s);
784
- return { start: z(o), end: r };
776
+ const r = N(s), o = ht(r, -5, s);
777
+ return { start: V(o), end: r };
785
778
  }
786
779
  },
787
780
  {
@@ -789,23 +782,23 @@ const y3 = [
789
782
  label: "Last 180 Days",
790
783
  getValue: (s) => {
791
784
  const r = N(s);
792
- return { start: Z(r, -179, s), end: r };
785
+ return { start: Q(r, -179, s), end: r };
793
786
  }
794
787
  },
795
788
  {
796
789
  key: "last9months",
797
790
  label: "Last 9 Months",
798
791
  getValue: (s) => {
799
- const r = N(s), o = dt(r, -8, s);
800
- return { start: z(o), end: r };
792
+ const r = N(s), o = ht(r, -8, s);
793
+ return { start: V(o), end: r };
801
794
  }
802
795
  },
803
796
  {
804
797
  key: "lastYear",
805
798
  label: "Last Year",
806
799
  getValue: (s) => {
807
- const r = N(s), o = dt(r, -11, s);
808
- return { start: z(o), end: r };
800
+ const r = N(s), o = ht(r, -11, s);
801
+ return { start: V(o), end: r };
809
802
  }
810
803
  }
811
804
  ], a = e ? n.filter((s) => e.includes(s.key)) : n;
@@ -818,59 +811,59 @@ const y3 = [
818
811
  onMonthChange: s,
819
812
  onClose: r,
820
813
  showNepaliNumbers: o = !1,
821
- convertToNepaliNumber: u = (h) => h.toString(),
822
- calendarType: i
814
+ convertToNepaliNumber: i = (h) => h.toString(),
815
+ calendarType: u
823
816
  }) => {
824
- const [h, c] = B(Math.floor(e / 12) * 12), D = i === "BS" ? 2e3 : 1944, d = i === "BS" ? 2100 : 2043;
825
- return /* @__PURE__ */ g("div", { className: "bsac-picker-overlay", onClick: r, children: /* @__PURE__ */ S("div", { className: "bsac-picker-content", onClick: (k) => k.stopPropagation(), children: [
826
- /* @__PURE__ */ S("div", { className: "bsac-picker-header", children: [
817
+ const [h, c] = H(Math.floor(e / 12) * 12), f = u === "BS" ? 2e3 : 1944, l = u === "BS" ? 2100 : 2043;
818
+ return /* @__PURE__ */ C("div", { className: "bsac-picker-inline", onClick: ($) => $.stopPropagation(), children: [
819
+ /* @__PURE__ */ C("div", { className: "bsac-picker-header", children: [
827
820
  /* @__PURE__ */ g("h3", { children: "Select Month & Year" }),
828
821
  /* @__PURE__ */ g("button", { className: "bsac-close-btn", onClick: r, children: "×" })
829
822
  ] }),
830
- /* @__PURE__ */ S("div", { className: "bsac-picker-body", children: [
831
- /* @__PURE__ */ S("div", { className: "bsac-picker-section", children: [
832
- /* @__PURE__ */ S("div", { className: "bsac-picker-section-header", children: [
823
+ /* @__PURE__ */ C("div", { className: "bsac-picker-body", children: [
824
+ /* @__PURE__ */ C("div", { className: "bsac-picker-section", children: [
825
+ /* @__PURE__ */ C("div", { className: "bsac-picker-section-header", children: [
833
826
  /* @__PURE__ */ g("label", { children: "Year" }),
834
- /* @__PURE__ */ S("div", { className: "bsac-year-nav", children: [
835
- /* @__PURE__ */ g("button", { onClick: () => c(Math.max(D, h - 12)), disabled: h <= D, children: "«" }),
836
- /* @__PURE__ */ S("span", { children: [
837
- o ? u(h) : h,
827
+ /* @__PURE__ */ C("div", { className: "bsac-year-nav", children: [
828
+ /* @__PURE__ */ g("button", { onClick: () => c(Math.max(f, h - 12)), disabled: h <= f, children: "«" }),
829
+ /* @__PURE__ */ C("span", { children: [
830
+ o ? i(h) : h,
838
831
  " – ",
839
- o ? u(h + 11) : h + 11
832
+ o ? i(h + 11) : h + 11
840
833
  ] }),
841
- /* @__PURE__ */ g("button", { onClick: () => c(Math.min(d - 11, h + 12)), disabled: h + 11 >= d, children: "»" })
834
+ /* @__PURE__ */ g("button", { onClick: () => c(Math.min(l - 11, h + 12)), disabled: h + 11 >= l, children: "»" })
842
835
  ] })
843
836
  ] }),
844
- /* @__PURE__ */ g("div", { className: "bsac-year-grid", children: Array.from({ length: 12 }, (k, m) => {
845
- const A = h + m;
846
- return A > d ? null : /* @__PURE__ */ g(
837
+ /* @__PURE__ */ g("div", { className: "bsac-year-grid", children: Array.from({ length: 12 }, ($, D) => {
838
+ const F = h + D;
839
+ return F > l ? null : /* @__PURE__ */ g(
847
840
  "button",
848
841
  {
849
- onClick: () => a(A),
850
- className: A === e ? "bsac-selected" : "",
851
- children: o ? u(A) : A
842
+ onClick: () => a(F),
843
+ className: F === e ? "bsac-selected" : "",
844
+ children: o ? i(F) : F
852
845
  },
853
- A
846
+ F
854
847
  );
855
848
  }) })
856
849
  ] }),
857
- /* @__PURE__ */ S("div", { className: "bsac-picker-section", children: [
850
+ /* @__PURE__ */ C("div", { className: "bsac-picker-section", children: [
858
851
  /* @__PURE__ */ g("label", { children: "Month" }),
859
- /* @__PURE__ */ g("div", { className: "bsac-month-grid", children: n.map((k, m) => /* @__PURE__ */ g(
852
+ /* @__PURE__ */ g("div", { className: "bsac-month-grid", children: n.map(($, D) => /* @__PURE__ */ g(
860
853
  "button",
861
854
  {
862
855
  onClick: () => {
863
- s(m), r();
856
+ s(D), r();
864
857
  },
865
- className: m === t ? "bsac-selected" : "",
866
- children: k
858
+ className: D === t ? "bsac-selected" : "",
859
+ children: $
867
860
  },
868
- m
861
+ D
869
862
  )) })
870
863
  ] })
871
864
  ] })
872
- ] }) });
873
- }, gt = ({
865
+ ] });
866
+ }, lt = ({
874
867
  currentMonth: e,
875
868
  currentYear: t,
876
869
  months: n,
@@ -878,18 +871,18 @@ const y3 = [
878
871
  onYearChange: s,
879
872
  onMonthChange: r,
880
873
  disabled: o = !1,
881
- showNepaliNumbers: u = !1,
882
- convertToNepaliNumber: i,
874
+ showNepaliNumbers: i = !1,
875
+ convertToNepaliNumber: u,
883
876
  calendarType: h
884
877
  }) => {
885
- const [c, D] = B(!1);
886
- return /* @__PURE__ */ S("div", { className: "bsac-header", children: [
878
+ const [c, f] = H(!1);
879
+ return /* @__PURE__ */ C("div", { className: "bsac-header", children: [
887
880
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(-12), disabled: o, "aria-label": "Previous year", children: "«" }),
888
881
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(-1), disabled: o, "aria-label": "Previous month", children: "‹" }),
889
- /* @__PURE__ */ S("button", { className: "bsac-month-year-btn", onClick: () => D(!0), disabled: o, children: [
882
+ /* @__PURE__ */ C("button", { className: "bsac-month-year-btn", onClick: () => f(!0), disabled: o, children: [
890
883
  n[e],
891
884
  " ",
892
- u ? i(t) : t
885
+ i ? u(t) : t
893
886
  ] }),
894
887
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(1), disabled: o, "aria-label": "Next month", children: "›" }),
895
888
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(12), disabled: o, "aria-label": "Next year", children: "»" }),
@@ -901,14 +894,14 @@ const y3 = [
901
894
  months: n,
902
895
  onYearChange: s,
903
896
  onMonthChange: r,
904
- onClose: () => D(!1),
905
- showNepaliNumbers: u,
906
- convertToNepaliNumber: i,
897
+ onClose: () => f(!1),
898
+ showNepaliNumbers: i,
899
+ convertToNepaliNumber: u,
907
900
  calendarType: h
908
901
  }
909
902
  )
910
903
  ] });
911
- }, mt = ({
904
+ }, dt = ({
912
905
  calendarDays: e,
913
906
  days: t,
914
907
  onDateSelect: n,
@@ -916,27 +909,27 @@ const y3 = [
916
909
  isInRange: s,
917
910
  isToday: r,
918
911
  isDisabled: o,
919
- disabled: u = !1,
920
- showNepaliNumbers: i = !1,
912
+ disabled: i = !1,
913
+ showNepaliNumbers: u = !1,
921
914
  convertToNepaliNumber: h
922
- }) => /* @__PURE__ */ S("div", { className: "bsac-grid", children: [
915
+ }) => /* @__PURE__ */ C("div", { className: "bsac-grid", children: [
923
916
  t.map((c) => /* @__PURE__ */ g("div", { className: "bsac-day-header", children: c }, c)),
924
- e.map((c, D) => {
925
- const d = c ? o?.(c) || u : !1, k = c ? a(c) : !1, m = c ? s(c) : !1, A = c ? r(c) : !1, T = [
917
+ e.map((c, f) => {
918
+ const l = c ? o?.(c) || i : !1, $ = c ? a(c) : !1, D = c ? s(c) : !1, F = c ? r(c) : !1, I = [
926
919
  "bsac-day",
927
- c ? d ? "bsac-day-disabled" : k ? "bsac-day-selected" : m ? "bsac-day-in-range" : A ? "bsac-day-today" : "" : "bsac-day-empty"
920
+ c ? l ? "bsac-day-disabled" : $ ? "bsac-day-selected" : D ? "bsac-day-in-range" : F ? "bsac-day-today" : "" : "bsac-day-empty"
928
921
  ].filter(Boolean).join(" ");
929
922
  return /* @__PURE__ */ g(
930
923
  "div",
931
924
  {
932
- className: T,
933
- onClick: () => c && !d && n(c),
934
- children: c ? i ? h(c) : c : ""
925
+ className: I,
926
+ onClick: () => c && !l && n(c),
927
+ children: c ? u ? h(c) : c : ""
935
928
  },
936
- D
929
+ f
937
930
  );
938
931
  })
939
- ] }), Dt = ({
932
+ ] }), gt = ({
940
933
  presets: e,
941
934
  calendarType: t,
942
935
  onPresetSelect: n,
@@ -944,8 +937,8 @@ const y3 = [
944
937
  position: s = "top"
945
938
  }) => {
946
939
  const r = (o) => {
947
- const u = o.getValue(t);
948
- n(o, u);
940
+ const i = o.getValue(t);
941
+ n(o, i);
949
942
  };
950
943
  return /* @__PURE__ */ g("div", { className: `bsac-presets bsac-presets--${s}`, children: e.map((o) => /* @__PURE__ */ g(
951
944
  "button",
@@ -964,290 +957,290 @@ const y3 = [
964
957
  showToday: s = !0,
965
958
  disabled: r = !1,
966
959
  outputFormat: o = "both",
967
- onDateSelect: u,
968
- mode: i = "single",
960
+ onDateSelect: i,
961
+ mode: u = "single",
969
962
  onRangeSelect: h,
970
963
  showRangePresets: c = !1,
971
- rangePresetsPosition: D = "top",
972
- predefinedRanges: d,
973
- presetKeys: k,
974
- presetLabels: m,
975
- onPresetSelect: A,
976
- renderPresets: T,
977
- showNepaliMonths: E = !1,
978
- showNepaliDays: v = !1,
979
- showNepaliNumbers: p = !1,
980
- theme: C = "light",
981
- colors: nt,
982
- minDate: I,
983
- maxDate: K
964
+ rangePresetsPosition: f = "top",
965
+ predefinedRanges: l,
966
+ presetKeys: $,
967
+ presetLabels: D,
968
+ onPresetSelect: F,
969
+ renderPresets: I,
970
+ showNepaliMonths: st = !1,
971
+ showNepaliDays: q = !1,
972
+ showNepaliNumbers: M = !1,
973
+ theme: B = "light",
974
+ colors: k,
975
+ minDate: b,
976
+ maxDate: J
984
977
  }) => {
985
978
  const {
986
- currentYear: H,
987
- currentMonth: O,
988
- rangeStart: U,
989
- rangeEnd: y,
990
- calendarDays: w,
991
- setSelectedDate: R,
992
- setRangeStart: M,
993
- setRangeEnd: $,
994
- setCurrentYear: _,
995
- setCurrentMonth: j,
996
- navigateMonth: x,
997
- isToday: st,
998
- isSelected: at,
999
- isInRange: rt
1000
- } = E3(e), [ot, Et] = B(), it = d || Y3(k, m), ut = (l, f) => ({
1001
- start: wt(e, l.year, l.month, l.day, G),
1002
- end: wt(e, f.year, f.month, f.day, G)
1003
- }), G = e === "BS" && E ? y3 : e === "BS" ? me : f3, ct = e === "BS" && v ? M3 : p3, ht = (l, f) => {
1004
- f.start && f.end && (M(f.start), $(f.end), _(f.start.year), j(f.start.month), Et(l.key), A?.(l, f), h?.(ut(f.start, f.end)));
1005
- }, ye = (l, f) => {
1006
- M(l), $(f), Et(void 0), h?.(ut(l, f));
1007
- }, lt = (l) => {
979
+ currentYear: O,
980
+ currentMonth: v,
981
+ rangeStart: L,
982
+ rangeEnd: wt,
983
+ calendarDays: K,
984
+ setSelectedDate: Ft,
985
+ setRangeStart: m,
986
+ setRangeEnd: S,
987
+ setCurrentYear: A,
988
+ setCurrentMonth: y,
989
+ navigateMonth: E,
990
+ isToday: j,
991
+ isSelected: P,
992
+ isInRange: G
993
+ } = E3(e, t), [at, Yt] = H(), rt = l || Y3($, D), ot = (d, p) => ({
994
+ start: kt(e, d.year, d.month, d.day, z),
995
+ end: kt(e, p.year, p.month, p.day, z)
996
+ }), z = e === "BS" && st ? y3 : e === "BS" ? me : f3, it = e === "BS" && q ? M3 : p3, ut = (d, p) => {
997
+ p.start && p.end && (m(p.start), S(p.end), A(p.start.year), y(p.start.month), Yt(d.key), F?.(d, p), h?.(ot(p.start, p.end)));
998
+ }, ye = (d, p) => {
999
+ m(d), S(p), Yt(void 0), h?.(ot(d, p));
1000
+ }, ct = (d) => {
1008
1001
  if (r) return;
1009
- const f = { year: H, month: O, day: l };
1010
- if (et(f, I, K)) return;
1011
- if (i === "range") {
1012
- if (Et(void 0), !U || U && y)
1013
- M(f), $(null);
1002
+ const p = { year: O, month: v, day: d };
1003
+ if (nt(p, b, J)) return;
1004
+ if (u === "range") {
1005
+ if (Yt(void 0), !L || L && wt)
1006
+ m(p), S(null);
1014
1007
  else {
1015
- const X = new Date(U.year, U.month, U.day).getTime();
1016
- new Date(f.year, f.month, f.day).getTime() < X ? (M(f), $(U), h?.(ut(f, U))) : ($(f), h?.(ut(U, f)));
1008
+ const Z = new Date(L.year, L.month, L.day).getTime();
1009
+ new Date(p.year, p.month, p.day).getTime() < Z ? (m(p), S(L), h?.(ot(p, L))) : (S(p), h?.(ot(L, p)));
1017
1010
  }
1018
1011
  return;
1019
1012
  }
1020
- R(f);
1021
- const q = wt(e, H, O, l, G);
1022
- if (u?.(q), n) {
1023
- let X;
1013
+ Ft(p);
1014
+ const X = kt(e, O, v, d, z);
1015
+ if (i?.(X), n) {
1016
+ let Z;
1024
1017
  switch (o) {
1025
1018
  case "iso":
1026
- X = q.ad;
1019
+ Z = X.ad;
1027
1020
  break;
1028
1021
  case "object":
1029
- X = JSON.stringify(q);
1022
+ Z = JSON.stringify(X);
1030
1023
  break;
1031
1024
  default:
1032
- X = JSON.stringify(q);
1025
+ Z = JSON.stringify(X);
1033
1026
  break;
1034
1027
  }
1035
- n(X);
1028
+ n(Z);
1036
1029
  }
1037
- }, fe = (l) => {
1030
+ }, fe = (d) => {
1038
1031
  if (!r) {
1039
- switch (l.key) {
1032
+ switch (d.key) {
1040
1033
  case "ArrowLeft":
1041
- x(-1);
1034
+ E(-1);
1042
1035
  break;
1043
1036
  case "ArrowRight":
1044
- x(1);
1037
+ E(1);
1045
1038
  break;
1046
1039
  case "ArrowUp":
1047
- x(-12);
1040
+ E(-12);
1048
1041
  break;
1049
1042
  case "ArrowDown":
1050
- x(12);
1043
+ E(12);
1051
1044
  break;
1052
1045
  case "PageUp":
1053
- l.shiftKey ? x(-12) : x(-1);
1046
+ d.shiftKey ? E(-12) : E(-1);
1054
1047
  break;
1055
1048
  case "PageDown":
1056
- l.shiftKey ? x(12) : x(1);
1049
+ d.shiftKey ? E(12) : E(1);
1057
1050
  break;
1058
1051
  default:
1059
1052
  return;
1060
1053
  }
1061
- l.preventDefault();
1054
+ d.preventDefault();
1062
1055
  }
1063
1056
  }, Me = {
1064
- ...nt ? Object.entries(nt).reduce(
1065
- (l, [f, q]) => (l[`--calendar-${f}`] = q, l),
1057
+ ...k ? Object.entries(k).reduce(
1058
+ (d, [p, X]) => (d[`--calendar-${p}`] = X, d),
1066
1059
  {}
1067
1060
  ) : {}
1068
1061
  };
1069
- return /* @__PURE__ */ S(
1062
+ return /* @__PURE__ */ C(
1070
1063
  "div",
1071
1064
  {
1072
1065
  className: `bsac-calendar ${a}`,
1073
1066
  style: Me,
1074
- "data-theme": C,
1067
+ "data-theme": B,
1075
1068
  onKeyDown: fe,
1076
1069
  tabIndex: 0,
1077
1070
  role: "application",
1078
1071
  "aria-label": "Calendar",
1079
1072
  children: [
1080
- i === "range" && T && /* @__PURE__ */ S("div", { style: { display: "flex", gap: "16px" }, children: [
1081
- /* @__PURE__ */ g("div", { children: T({ onRangeChange: ye }) }),
1082
- /* @__PURE__ */ S("div", { style: { flex: 1 }, children: [
1073
+ u === "range" && I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px" }, children: [
1074
+ /* @__PURE__ */ g("div", { children: I({ onRangeChange: ye }) }),
1075
+ /* @__PURE__ */ C("div", { style: { flex: 1 }, children: [
1083
1076
  /* @__PURE__ */ g(
1084
- gt,
1077
+ lt,
1085
1078
  {
1086
- currentMonth: O,
1087
- currentYear: H,
1088
- months: G,
1089
- onNavigateMonth: x,
1090
- onYearChange: _,
1091
- onMonthChange: j,
1079
+ currentMonth: v,
1080
+ currentYear: O,
1081
+ months: z,
1082
+ onNavigateMonth: E,
1083
+ onYearChange: A,
1084
+ onMonthChange: y,
1092
1085
  disabled: r,
1093
- showNepaliNumbers: p,
1094
- convertToNepaliNumber: V,
1086
+ showNepaliNumbers: M,
1087
+ convertToNepaliNumber: U,
1095
1088
  calendarType: e
1096
1089
  }
1097
1090
  ),
1098
1091
  /* @__PURE__ */ g(
1099
- mt,
1092
+ dt,
1100
1093
  {
1101
- calendarDays: w,
1102
- days: ct,
1103
- onDateSelect: lt,
1104
- isSelected: (l) => at(l, i),
1105
- isInRange: rt,
1106
- isToday: (l) => s && st(l),
1107
- isDisabled: (l) => et({ year: H, month: O, day: l }, I, K),
1094
+ calendarDays: K,
1095
+ days: it,
1096
+ onDateSelect: ct,
1097
+ isSelected: (d) => P(d, u),
1098
+ isInRange: G,
1099
+ isToday: (d) => s && j(d),
1100
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1108
1101
  disabled: r,
1109
- showNepaliNumbers: p,
1110
- convertToNepaliNumber: V
1102
+ showNepaliNumbers: M,
1103
+ convertToNepaliNumber: U
1111
1104
  }
1112
1105
  )
1113
1106
  ] })
1114
1107
  ] }),
1115
- i === "range" && c && D === "left" && !T && /* @__PURE__ */ S("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1108
+ u === "range" && c && f === "left" && !I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1116
1109
  /* @__PURE__ */ g(
1117
- Dt,
1110
+ gt,
1118
1111
  {
1119
- presets: it,
1112
+ presets: rt,
1120
1113
  calendarType: e,
1121
- onPresetSelect: ht,
1122
- activePreset: ot,
1114
+ onPresetSelect: ut,
1115
+ activePreset: at,
1123
1116
  position: "left"
1124
1117
  }
1125
1118
  ),
1126
- /* @__PURE__ */ S("div", { children: [
1119
+ /* @__PURE__ */ C("div", { children: [
1127
1120
  /* @__PURE__ */ g(
1128
- gt,
1121
+ lt,
1129
1122
  {
1130
- currentMonth: O,
1131
- currentYear: H,
1132
- months: G,
1133
- onNavigateMonth: x,
1134
- onYearChange: _,
1135
- onMonthChange: j,
1123
+ currentMonth: v,
1124
+ currentYear: O,
1125
+ months: z,
1126
+ onNavigateMonth: E,
1127
+ onYearChange: A,
1128
+ onMonthChange: y,
1136
1129
  disabled: r,
1137
- showNepaliNumbers: p,
1138
- convertToNepaliNumber: V,
1130
+ showNepaliNumbers: M,
1131
+ convertToNepaliNumber: U,
1139
1132
  calendarType: e
1140
1133
  }
1141
1134
  ),
1142
1135
  /* @__PURE__ */ g(
1143
- mt,
1136
+ dt,
1144
1137
  {
1145
- calendarDays: w,
1146
- days: ct,
1147
- onDateSelect: lt,
1148
- isSelected: (l) => at(l, i),
1149
- isInRange: rt,
1150
- isToday: (l) => s && st(l),
1151
- isDisabled: (l) => et({ year: H, month: O, day: l }, I, K),
1138
+ calendarDays: K,
1139
+ days: it,
1140
+ onDateSelect: ct,
1141
+ isSelected: (d) => P(d, u),
1142
+ isInRange: G,
1143
+ isToday: (d) => s && j(d),
1144
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1152
1145
  disabled: r,
1153
- showNepaliNumbers: p,
1154
- convertToNepaliNumber: V
1146
+ showNepaliNumbers: M,
1147
+ convertToNepaliNumber: U
1155
1148
  }
1156
1149
  )
1157
1150
  ] })
1158
1151
  ] }),
1159
- i === "range" && c && D === "right" && !T && /* @__PURE__ */ S("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1160
- /* @__PURE__ */ S("div", { children: [
1152
+ u === "range" && c && f === "right" && !I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1153
+ /* @__PURE__ */ C("div", { children: [
1161
1154
  /* @__PURE__ */ g(
1162
- gt,
1155
+ lt,
1163
1156
  {
1164
- currentMonth: O,
1165
- currentYear: H,
1166
- months: G,
1167
- onNavigateMonth: x,
1168
- onYearChange: _,
1169
- onMonthChange: j,
1157
+ currentMonth: v,
1158
+ currentYear: O,
1159
+ months: z,
1160
+ onNavigateMonth: E,
1161
+ onYearChange: A,
1162
+ onMonthChange: y,
1170
1163
  disabled: r,
1171
- showNepaliNumbers: p,
1172
- convertToNepaliNumber: V,
1164
+ showNepaliNumbers: M,
1165
+ convertToNepaliNumber: U,
1173
1166
  calendarType: e
1174
1167
  }
1175
1168
  ),
1176
1169
  /* @__PURE__ */ g(
1177
- mt,
1170
+ dt,
1178
1171
  {
1179
- calendarDays: w,
1180
- days: ct,
1181
- onDateSelect: lt,
1182
- isSelected: (l) => at(l, i),
1183
- isInRange: rt,
1184
- isToday: (l) => s && st(l),
1185
- isDisabled: (l) => et({ year: H, month: O, day: l }, I, K),
1172
+ calendarDays: K,
1173
+ days: it,
1174
+ onDateSelect: ct,
1175
+ isSelected: (d) => P(d, u),
1176
+ isInRange: G,
1177
+ isToday: (d) => s && j(d),
1178
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1186
1179
  disabled: r,
1187
- showNepaliNumbers: p,
1188
- convertToNepaliNumber: V
1180
+ showNepaliNumbers: M,
1181
+ convertToNepaliNumber: U
1189
1182
  }
1190
1183
  )
1191
1184
  ] }),
1192
1185
  /* @__PURE__ */ g(
1193
- Dt,
1186
+ gt,
1194
1187
  {
1195
- presets: it,
1188
+ presets: rt,
1196
1189
  calendarType: e,
1197
- onPresetSelect: ht,
1198
- activePreset: ot,
1190
+ onPresetSelect: ut,
1191
+ activePreset: at,
1199
1192
  position: "right"
1200
1193
  }
1201
1194
  )
1202
1195
  ] }),
1203
- (!i || i === "single" || !c && !T || D === "top" || D === "bottom") && /* @__PURE__ */ S(pe, { children: [
1204
- i === "range" && c && D === "top" && /* @__PURE__ */ g(
1205
- Dt,
1196
+ (!u || u === "single" || !c && !I || f === "top" || f === "bottom") && /* @__PURE__ */ C(pe, { children: [
1197
+ u === "range" && c && f === "top" && /* @__PURE__ */ g(
1198
+ gt,
1206
1199
  {
1207
- presets: it,
1200
+ presets: rt,
1208
1201
  calendarType: e,
1209
- onPresetSelect: ht,
1210
- activePreset: ot,
1202
+ onPresetSelect: ut,
1203
+ activePreset: at,
1211
1204
  position: "top"
1212
1205
  }
1213
1206
  ),
1214
1207
  /* @__PURE__ */ g(
1215
- gt,
1208
+ lt,
1216
1209
  {
1217
- currentMonth: O,
1218
- currentYear: H,
1219
- months: G,
1220
- onNavigateMonth: x,
1221
- onYearChange: _,
1222
- onMonthChange: j,
1210
+ currentMonth: v,
1211
+ currentYear: O,
1212
+ months: z,
1213
+ onNavigateMonth: E,
1214
+ onYearChange: A,
1215
+ onMonthChange: y,
1223
1216
  disabled: r,
1224
- showNepaliNumbers: p,
1225
- convertToNepaliNumber: V,
1217
+ showNepaliNumbers: M,
1218
+ convertToNepaliNumber: U,
1226
1219
  calendarType: e
1227
1220
  }
1228
1221
  ),
1229
1222
  /* @__PURE__ */ g(
1230
- mt,
1223
+ dt,
1231
1224
  {
1232
- calendarDays: w,
1233
- days: ct,
1234
- onDateSelect: lt,
1235
- isSelected: (l) => at(l, i),
1236
- isInRange: rt,
1237
- isToday: (l) => s && st(l),
1238
- isDisabled: (l) => et({ year: H, month: O, day: l }, I, K),
1225
+ calendarDays: K,
1226
+ days: it,
1227
+ onDateSelect: ct,
1228
+ isSelected: (d) => P(d, u),
1229
+ isInRange: G,
1230
+ isToday: (d) => s && j(d),
1231
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1239
1232
  disabled: r,
1240
- showNepaliNumbers: p,
1241
- convertToNepaliNumber: V
1233
+ showNepaliNumbers: M,
1234
+ convertToNepaliNumber: U
1242
1235
  }
1243
1236
  ),
1244
- i === "range" && c && D === "bottom" && /* @__PURE__ */ g(
1245
- Dt,
1237
+ u === "range" && c && f === "bottom" && /* @__PURE__ */ g(
1238
+ gt,
1246
1239
  {
1247
- presets: it,
1240
+ presets: rt,
1248
1241
  calendarType: e,
1249
- onPresetSelect: ht,
1250
- activePreset: ot,
1242
+ onPresetSelect: ut,
1243
+ activePreset: at,
1251
1244
  position: "bottom"
1252
1245
  }
1253
1246
  )
@@ -1255,7 +1248,7 @@ const y3 = [
1255
1248
  ]
1256
1249
  }
1257
1250
  );
1258
- }, H3 = ({
1251
+ }, B3 = ({
1259
1252
  placeholder: e = "Select date",
1260
1253
  format: t = "YYYY-MM-DD",
1261
1254
  defaultValue: n,
@@ -1263,92 +1256,117 @@ const y3 = [
1263
1256
  inputClassName: s = "",
1264
1257
  popupClassName: r = "",
1265
1258
  style: o,
1266
- inputStyle: u,
1267
- icon: i,
1259
+ inputStyle: i,
1260
+ icon: u,
1268
1261
  showIcon: h = !0,
1269
1262
  calendarType: c = "AD",
1270
- ...D
1263
+ ...f
1271
1264
  }) => {
1272
- const [d, k] = B(!1), [m, A] = B(null), [T, E] = B(() => {
1265
+ const [l, $] = H(!1), [D, F] = H(null), [I, st] = H(void 0), [q, M] = H(() => {
1273
1266
  if (!n) return "";
1274
1267
  if (c === "BS")
1275
1268
  try {
1276
- const [y, w, R] = n.split("-").map(Number), M = Y.fromEnglishDate(y, w - 1, R);
1277
- return `${M.getYear()}-${String(M.getMonth() + 1).padStart(2, "0")}-${String(M.getDate()).padStart(2, "0")}`;
1269
+ const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
1270
+ return `${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`;
1278
1271
  } catch {
1279
1272
  return n;
1280
1273
  }
1281
1274
  return n;
1282
- }), v = xt(null), p = xt(null), [C, nt] = B({ visibility: "hidden" }), I = () => {
1283
- if (!v.current) return;
1284
- const y = v.current.getBoundingClientRect(), w = p.current?.offsetHeight || 360, R = p.current?.offsetWidth || 280, M = window.innerHeight - y.bottom, $ = window.innerWidth - y.left, _ = M >= w + 8 ? y.bottom + 8 : Math.max(8, y.top - w - 8), j = $ >= R ? y.left : Math.max(8, y.right - R);
1285
- nt({ top: _, left: j, visibility: "visible" });
1275
+ });
1276
+ Dt(() => {
1277
+ if (n)
1278
+ if (c === "BS")
1279
+ try {
1280
+ const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
1281
+ M(`${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`);
1282
+ } catch {
1283
+ M(n);
1284
+ }
1285
+ else
1286
+ M(n);
1287
+ }, [n, c]);
1288
+ const B = mt(() => {
1289
+ if (n) {
1290
+ if (c === "BS")
1291
+ try {
1292
+ const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
1293
+ return `${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`;
1294
+ } catch {
1295
+ return n;
1296
+ }
1297
+ return n;
1298
+ }
1299
+ }, [n, c]), k = xt(null), b = xt(null), [J, O] = H({ visibility: "hidden" }), v = () => {
1300
+ if (!k.current) return;
1301
+ const m = k.current.getBoundingClientRect(), S = b.current?.offsetHeight || 360, A = b.current?.offsetWidth || 280, y = window.innerHeight - m.bottom, E = window.innerWidth - m.left, j = y >= S + 8 ? m.bottom + 8 : Math.max(8, m.top - S - 8), P = E >= A ? m.left : Math.max(8, m.right - A);
1302
+ O({ top: j, left: P, visibility: "visible" });
1286
1303
  };
1287
- Yt(() => (d && (requestAnimationFrame(I), window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), () => {
1288
- window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I);
1289
- }), [d]), Yt(() => {
1290
- const y = (w) => {
1291
- v.current && !v.current.contains(w.target) && k(!1);
1304
+ Dt(() => (l && (requestAnimationFrame(v), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v)), () => {
1305
+ window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v);
1306
+ }), [l]), Dt(() => {
1307
+ const m = (S) => {
1308
+ k.current && !k.current.contains(S.target) && $(!1);
1292
1309
  };
1293
- return d && document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
1294
- }, [d]);
1295
- const K = (y) => {
1296
- A(y), E(c === "BS" ? y.bs : y.ad), k(!1), a?.(y);
1297
- }, H = (y) => {
1298
- const w = y.target.value;
1299
- if (w === "") {
1300
- E("");
1310
+ return l && document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
1311
+ }, [l]);
1312
+ const L = (m) => {
1313
+ F(m), st(c === "BS" ? m.bs : m.ad), M(c === "BS" ? m.bs : m.ad), $(!1), a?.(m);
1314
+ }, wt = (m) => {
1315
+ const S = m.target.value;
1316
+ if (S === "") {
1317
+ M("");
1301
1318
  return;
1302
1319
  }
1303
- if ((y.target.selectionStart || 0) === w.length && w.length > T.length) {
1304
- const M = w.replace(/[^0-9]/g, "");
1305
- let $ = M;
1306
- M.length > 4 && M.length <= 6 ? $ = M.slice(0, 4) + "-" + M.slice(4) : M.length > 6 && ($ = M.slice(0, 4) + "-" + M.slice(4, 6) + "-" + M.slice(6, 8)), E($);
1320
+ if ((m.target.selectionStart || 0) === S.length && S.length > q.length) {
1321
+ const y = S.replace(/[^0-9]/g, "");
1322
+ let E = y;
1323
+ y.length > 4 && y.length <= 6 ? E = y.slice(0, 4) + "-" + y.slice(4) : y.length > 6 && (E = y.slice(0, 4) + "-" + y.slice(4, 6) + "-" + y.slice(6, 8)), M(E);
1307
1324
  } else {
1308
- const M = w.replace(/[^0-9-]/g, "");
1309
- M.length <= 10 && E(M);
1325
+ const y = S.replace(/[^0-9-]/g, "");
1326
+ y.length <= 10 && M(y);
1310
1327
  }
1311
- }, O = () => {
1312
- const y = T.trim();
1313
- if (!y) {
1314
- A(null);
1328
+ }, K = () => {
1329
+ const m = q.trim();
1330
+ if (!m) {
1331
+ F(null);
1315
1332
  return;
1316
1333
  }
1317
- const w = y.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1318
- if (w) {
1319
- const [, R, M, $] = w, _ = parseInt(M), j = parseInt($);
1320
- if (_ < 1 || _ > 12 || j < 1 || j > 32) {
1321
- E(m ? c === "BS" ? m.bs : m.ad : "");
1334
+ const S = m.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1335
+ if (S) {
1336
+ const [, A, y, E] = S, j = parseInt(y), P = parseInt(E);
1337
+ if (j < 1 || j > 12 || P < 1 || P > 32) {
1338
+ M(D ? c === "BS" ? D.bs : D.ad : "");
1322
1339
  return;
1323
1340
  }
1324
- const x = {
1325
- bs: c === "BS" ? `${R}-${M}-${$}` : "",
1326
- ad: c === "AD" ? `${R}-${M}-${$}` : "",
1341
+ const G = {
1342
+ bs: c === "BS" ? `${A}-${y}-${E}` : "",
1343
+ ad: c === "AD" ? `${A}-${y}-${E}` : "",
1327
1344
  formatted: {
1328
- bs: c === "BS" ? y : "",
1329
- ad: c === "AD" ? y : ""
1345
+ bs: c === "BS" ? m : "",
1346
+ ad: c === "AD" ? m : ""
1330
1347
  }
1331
1348
  };
1332
- A(x), a?.(x);
1333
- } else y.length < 10 && E(m ? c === "BS" ? m.bs : m.ad : "");
1349
+ if (F(G), D === null) return;
1350
+ a?.(G);
1351
+ } else m.length < 10 && M(D ? c === "BS" ? D.bs : D.ad : "");
1334
1352
  };
1335
- return /* @__PURE__ */ S("div", { className: "bsac-datepicker", ref: v, style: o, children: [
1353
+ return /* @__PURE__ */ C("div", { className: "bsac-datepicker", ref: k, style: o, children: [
1336
1354
  /* @__PURE__ */ g(
1337
1355
  "input",
1338
1356
  {
1339
1357
  type: "text",
1340
- value: T,
1358
+ value: q,
1341
1359
  placeholder: e,
1342
- onChange: H,
1343
- onBlur: O,
1344
- onKeyDown: (y) => {
1345
- y.key === "Enter" ? (O(), k(!1)) : y.key === "Escape" && k(!1);
1360
+ onChange: wt,
1361
+ onBlur: K,
1362
+ onKeyDown: (m) => {
1363
+ m.key === "Enter" ? (K(), $(!1)) : m.key === "Escape" && $(!1);
1346
1364
  },
1347
1365
  className: `bsac-input ${s}`,
1348
- style: u,
1366
+ style: i,
1349
1367
  "aria-label": "Date picker input",
1350
1368
  "aria-haspopup": "dialog",
1351
- "aria-expanded": d,
1369
+ "aria-expanded": l,
1352
1370
  maxLength: 10
1353
1371
  }
1354
1372
  ),
@@ -1357,10 +1375,10 @@ const y3 = [
1357
1375
  {
1358
1376
  type: "button",
1359
1377
  className: "bsac-icon-btn",
1360
- onClick: () => k(!d),
1378
+ onClick: () => $(!l),
1361
1379
  "aria-label": "Toggle calendar",
1362
1380
  style: { display: h ? "flex" : "none" },
1363
- children: i || /* @__PURE__ */ S("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1381
+ children: u || /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1364
1382
  /* @__PURE__ */ g("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
1365
1383
  /* @__PURE__ */ g("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
1366
1384
  /* @__PURE__ */ g("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
@@ -1368,27 +1386,27 @@ const y3 = [
1368
1386
  ] })
1369
1387
  }
1370
1388
  ),
1371
- d && /* @__PURE__ */ g("div", { ref: p, className: `bsac-popup ${r}`, style: C, children: /* @__PURE__ */ g(C3, { calendarType: c, onDateSelect: K, ...D }) })
1389
+ /* @__PURE__ */ g("div", { ref: b, className: `bsac-popup ${r}`, style: { ...J, display: l ? void 0 : "none" }, children: /* @__PURE__ */ g(C3, { calendarType: c, onDateSelect: L, value: I ?? B, ...f }) })
1372
1390
  ] });
1373
1391
  };
1374
1392
  export {
1375
1393
  C3 as Calendar,
1376
- H3 as CalendarInput,
1377
- O3 as DEFAULT_COLORS,
1378
- H3 as DatePicker,
1394
+ B3 as CalendarInput,
1395
+ N3 as DEFAULT_COLORS,
1396
+ B3 as DatePicker,
1379
1397
  p3 as ENGLISH_DAYS,
1380
1398
  f3 as ENGLISH_MONTHS_AD,
1381
1399
  me as ENGLISH_MONTHS_BS,
1382
1400
  M3 as NEPALI_DAYS,
1383
- b3 as NEPALI_DIGITS,
1401
+ S3 as NEPALI_DIGITS,
1384
1402
  y3 as NEPALI_MONTHS,
1385
- T3 as PRESET_KEYS,
1386
- V as convertToNepaliNumber,
1387
- wt as createDateOutput,
1403
+ O3 as PRESET_KEYS,
1404
+ U as convertToNepaliNumber,
1405
+ kt as createDateOutput,
1388
1406
  Y3 as createPredefinedRanges,
1389
1407
  De as getDaysInMonth,
1390
- S3 as getFirstDayOfMonth,
1408
+ b3 as getFirstDayOfMonth,
1391
1409
  N as getTodayDate,
1392
- N3 as isDateInRange,
1410
+ H3 as isDateInRange,
1393
1411
  E3 as useCalendar
1394
1412
  };