nepali-datepicker-vue
Version:
A Vue 3 Nepali Datepicker with TypeScript Support
765 lines (764 loc) • 46.8 kB
JavaScript
import { defineComponent as Je, ref as Y, onMounted as Ze, watch as G, nextTick as Me, computed as se, onUnmounted as ea, openBlock as c, createElementBlock as h, normalizeClass as V, createElementVNode as N, withDirectives as aa, withKeys as ta, vModelText as la, withModifiers as U, createCommentVNode as k, createBlock as sa, Teleport as na, createVNode as ra, Transition as oa, withCtx as ia, normalizeStyle as ya, toDisplayString as _, Fragment as X, renderList as q, unref as Ee } from "vue";
var i = [{ year: 1976, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 1977, days: [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 1978, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1979, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1980, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 1981, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1982, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1983, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1984, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 1985, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1986, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1987, days: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1988, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 1989, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1990, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1991, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1992, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 1993, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1994, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1995, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1996, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 1997, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1998, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 1999, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2e3, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2001, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2002, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2003, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2004, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2005, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2006, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2007, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2008, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2009, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2010, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2011, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2012, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2013, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2014, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2015, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2016, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2017, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2018, days: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2019, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2020, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2021, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2022, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2023, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2024, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2025, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2026, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2027, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2028, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2029, days: [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2030, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2031, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2032, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2033, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2034, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2035, days: [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2036, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2037, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2038, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2039, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2040, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2041, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2042, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2043, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2044, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2045, days: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2046, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2047, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2048, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2049, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2050, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2051, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2052, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2053, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2054, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2055, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2056, days: [31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2057, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2058, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2059, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2060, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2061, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2062, days: [30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2063, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2064, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2065, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2066, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2067, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2068, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2069, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2070, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2071, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2072, days: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2073, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2074, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2075, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2076, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2077, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2078, days: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2079, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2080, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2081, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2082, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2083, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2084, days: [31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2085, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2086, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2087, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2088, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2089, days: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2090, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2091, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2092, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2093, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], totalDays: 0, daysTillNow: 0 }, { year: 2094, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2095, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2096, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }, { year: 2097, days: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2098, days: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2099, days: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], totalDays: 0, daysTillNow: 0 }, { year: 2100, days: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], totalDays: 0, daysTillNow: 0 }], Ye = 0;
i.forEach((r) => {
r.totalDays = r.days.reduce((e, a) => e + a, 0), Ye += r.totalDays, r.daysTillNow = Ye;
});
var ne = Date.UTC(1919, 3, 13), _e = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], me = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Ce = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"], Se = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], ge = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], Ie = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], Ve = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], xe = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], da = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"];
function oe(r) {
return r < 10 ? `0${String(r)}` : String(r);
}
function J(r) {
let e = "";
for (let a = 0; a < r.length; a += 1) e += da[r.charCodeAt(a) - 48];
return e;
}
function ua(r) {
return (e) => r <= 2 ? String(e.getYear()).substring(2) : r === 3 ? String(e.getYear()).substring(1) : String(e.getYear());
}
function ca(r) {
return (e) => J(r <= 2 ? String(e.getYear()).substring(2) : r === 3 ? String(e.getYear()).substring(1) : String(e.getYear()));
}
function ha(r) {
return (e) => r === 1 ? String(e.getMonth() + 1) : r === 2 ? oe(e.getMonth() + 1) : r === 3 ? Ie[e.getMonth()] : ge[e.getMonth()];
}
function va(r) {
return (e) => r === 1 ? J(String(e.getMonth() + 1)) : r === 2 ? J(oe(e.getMonth() + 1)) : r === 3 ? xe[e.getMonth()] : Ve[e.getMonth()];
}
function wa(r) {
return (e) => r === 1 ? String(e.getDate()) : r === 2 ? oe(e.getDate()) : r === 3 ? me[e.getDay()] : _e[e.getDay()];
}
function ma(r) {
return (e) => r === 1 ? J(String(e.getDate())) : r === 2 ? J(oe(e.getDate())) : r === 3 ? Se[e.getDay()] : Ce[e.getDay()];
}
function ke(r) {
return () => r;
}
var we = { Y: ua, y: ca, M: ha, m: va, D: wa, d: ma };
function ga(r) {
return r in we;
}
function fa(r) {
let e = !1, a = "", o = "", s = 0;
const y = [];
for (const d of r) d !== o ? (o !== "" && (y.push(we[o](s)), o = "", s = 0), d !== '"' ? !ga(d) || e ? a += d : (a && (y.push(ke(a)), a = ""), o = d, s = 1) : e = !e) : s += 1;
return a ? y.push(ke(a)) : o && y.push(we[o](s)), y;
}
function Da(r, e) {
return fa(e).map((a) => a(r)).join("");
}
function be(r) {
const e = r.split(/[-./]/, 3), [a, o = 1, s = 1] = e.map((d) => {
const D = parseInt(d, 10);
if (Number.isNaN(D)) throw new Error("Invalid date");
return D;
});
if (a < i[0].year || a >= i[0].year + i.length) throw new Error("Nepal year out of range");
if (o < 1 || o > 12) throw new Error("Invalid nepali month must be between 1 - 12");
const y = i[a - i[0].year].days[o - 1];
if (s < 1 || s > y) throw new Error(`Invalid nepali date must be between 1 - ${String(y)} in ${String(a)} ${String(o)}`);
return [a, o - 1, s];
}
var v = class u {
constructor(e, a, o) {
if (e == null) this.setEnglishDate(/* @__PURE__ */ new Date());
else if (typeof e == "object") if (e instanceof Date) this.setEnglishDate(e);
else {
if (!(e instanceof u)) throw new Error("Invalid argument syntax");
this.timestamp = e.timestamp, this.year = e.year, this.month = e.month, this.day = e.day;
}
else if (typeof e == "string") this.set(...be(e));
else if (typeof e == "number" && a !== void 0 && o !== void 0) this.set(e, a, o);
else {
if (typeof e != "number") throw new Error("Invalid argument syntax");
this.setEnglishDate(new Date(e));
}
}
setEnglishDate(e) {
var a, o;
this.timestamp = e;
const s = Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate());
let y = Math.floor((s - ne) / 864e5), d = Math.floor(y / 366);
for (; y >= i[d].daysTillNow; ) d += 1;
y -= (a = (o = i[d - 1]) === null || o === void 0 ? void 0 : o.daysTillNow) !== null && a !== void 0 ? a : 0;
const D = i[d];
for (this.year = D.year, this.month = 0; y >= D.days[this.month]; ) this.month += 1, y -= D.days[this.month - 1];
this.day = y + 1;
}
set(e, a, o) {
const s = e + Math.floor(a / 12) - i[0].year;
if (s < 0 || s >= i.length) throw new Error("Nepal year out of range!");
const y = i[s];
let d = y.daysTillNow - y.totalDays;
const D = a % 12, Q = D < 0 ? 12 + D : D;
for (let w = 0; w < Q; w += 1) d += y.days[w];
d += o - 1;
const M = new Date(ne + 864e5 * d);
this.setEnglishDate(M);
}
format(e) {
return Da(this, e);
}
clone() {
return new u(this);
}
toString() {
return `${String(this.year)}/${String(this.month + 1)}/${String(this.day)}`;
}
getEnglishDate() {
return this.timestamp;
}
parse(e) {
this.set(...be(e));
}
getYear() {
return this.year;
}
getMonth() {
return this.month;
}
getDay() {
return this.timestamp.getDay();
}
getDate() {
return this.day;
}
getHours() {
return this.timestamp.getHours();
}
getMinutes() {
return this.timestamp.getMinutes();
}
getSeconds() {
return this.timestamp.getSeconds();
}
getMilliseconds() {
return this.timestamp.getMilliseconds();
}
getTime() {
return this.timestamp.getTime();
}
setYear(e) {
this.set(e, this.month, this.day);
}
setMonth(e) {
this.set(this.year, e, this.day);
}
setDate(e) {
this.set(this.year, this.month, e);
}
addDays(e) {
const a = new Date(this.timestamp.getTime() + 864e5 * e);
return new u(a);
}
addMonths(e) {
let a = this.year, o = this.month + e;
a += Math.floor(o / 12), o %= 12, o < 0 && (o += 12, a -= 1);
const s = a - i[0].year;
if (s < 0 || s >= i.length) throw new Error("Resulting date is out of supported range");
const y = i[s].days[o], d = Math.min(this.day, y);
return new u(a, o, d);
}
addYears(e) {
const a = this.year + e;
if (a < i[0].year || a >= i[0].year + i.length) throw new Error("Resulting date is out of supported range");
const o = a - i[0].year, s = i[o].days[this.month], y = Math.min(this.day, s);
return new u(a, this.month, y);
}
static minimum() {
return new Date(ne);
}
static maximum() {
return new Date(ne + 864e5 * i[i.length - 1].daysTillNow);
}
daysInMonth(e, a) {
if (a !== void 0 && (a < 0 || a > 11)) throw new Error("Invalid month index, must be between 0-11");
const o = (e ?? this.year) - i[0].year;
return i[o].days[a ?? this.month];
}
isLeapYear() {
const e = this.year - i[0].year;
return i[e].totalDays >= 366;
}
getWeeksInMonth() {
const e = new u(this.year, this.month, 1).getDay(), a = this.daysInMonth();
return Math.ceil((e + a) / 7);
}
diff(e, a) {
switch (a) {
case "day":
return Math.floor((this.timestamp.getTime() - e.timestamp.getTime()) / 864e5);
case "month":
return 12 * (this.year - e.year) + (this.month - e.month);
case "year":
return this.year - e.year;
default:
throw new Error("Invalid unit for diff calculation");
}
}
startOfDay() {
const e = new Date(this.timestamp);
return e.setHours(0, 0, 0, 0), new u(e);
}
endOfDay() {
const e = new Date(this.timestamp);
return e.setHours(23, 59, 59, 999), new u(e);
}
startOfWeek() {
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
if (e < 0 || e > 6 || !Number.isInteger(e)) throw new Error("startOfWeek must be an integer between 0 and 6");
const a = (this.getDay() - e + 7) % 7;
return this.clone().startOfDay().addDays(-a);
}
endOfWeek() {
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
if (e < 0 || e > 6 || !Number.isInteger(e)) throw new Error("startOfWeek must be an integer between 0 and 6");
return this.startOfWeek(e).addDays(6).endOfDay();
}
startOfMonth() {
return new u(this.year, this.month, 1);
}
endOfMonth() {
const e = this.daysInMonth();
return new u(this.year, this.month, e).endOfDay();
}
startOfYear() {
return new u(this.year, 0, 1);
}
endOfYear() {
const e = this.year - i[0].year, a = i[e].days[11];
return new u(this.year, 11, a).endOfDay();
}
static getMonthName(e) {
let a = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], o = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
if (e < 0 || e > 11) throw new Error("Invalid month index, must be between 0-11");
let s = "";
return s = o ? a ? xe[e] : Ve[e] : a ? Ie[e] : ge[e], s;
}
static getDayName(e) {
let a = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], o = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
if (e < 0 || e > 6) throw new Error("Invalid day index, must be between 0-6");
let s = "";
return s = o ? a ? Se[e] : Ce[e] : a ? me[e] : _e[e], s;
}
static isValid(e, a, o) {
try {
if (e < i[0].year || e >= i[0].year + i.length || a < 0 || a > 11) return !1;
const s = e - i[0].year, y = i[s].days[a];
return !(o < 1 || o > y);
} catch {
return !1;
}
}
isValid() {
return u.isValid(this.year, this.month, this.day);
}
static getCalendarDays(e, a) {
if (!u.isValid(e, a, 1)) throw new Error("Invalid year or month");
const o = { year: 0, month: 0, days: [] }, s = { year: 0, month: 0, days: [] }, y = { year: 0, month: 0, days: [] }, d = e - i[0].year, D = new u(e, a, 1).getDay(), Q = i[d].days[a];
s.year = e, s.month = a;
let M = a - 1, w = e, C = a + 1, B = e;
if (M < 0 && (M = 11, w--), w >= i[0].year && (o.year = w, o.month = M), w >= i[0].year && D > 0) {
const g = w - i[0].year, $ = i[g].days[M];
for (let E = 0; E < D; E++) o.days.push($ - D + E + 1);
}
for (let g = 1; g <= Q; g++) s.days.push(g);
C > 11 && (C = 0, B++), B < i[0].year + i.length && (y.year = B, y.month = C);
const x = 42 - D - s.days.length;
if (B < i[0].year + i.length && x > 0) for (let g = 1; g <= x; g++) y.days.push(g);
return { prevRemainingDays: D, prevMonth: o, currentMonth: s, nextMonth: y, remainingDays: x };
}
isAfter(e) {
return this.timestamp.getTime() > e.timestamp.getTime();
}
isBefore(e) {
return this.timestamp.getTime() < e.timestamp.getTime();
}
isEqual(e) {
return this.year === e.year && this.month === e.month && this.day === e.day;
}
isSame(e, a) {
switch (a) {
case "year":
return this.year === e.year;
case "month":
return this.year === e.year && this.month === e.month;
case "day":
return this.isEqual(e);
default:
throw new Error("Invalid unit for comparison");
}
}
static getQuarter(e, a) {
if (e < 1 || e > 4 || !Number.isInteger(e)) throw new Error("Quarter must be an integer between 1 and 4");
const o = a ?? new u().getYear(), s = 3 * (e - 1);
return { start: new u(o, s, 1), end: new u(o, s + 2, 1).endOfMonth() };
}
getCurrentQuarter() {
return Math.floor(this.month / 3) + 1;
}
static getQuarters(e) {
const a = e ?? new u().getYear();
return { Q1: u.getQuarter(1, a), Q2: u.getQuarter(2, a), Q3: u.getQuarter(3, a), Q4: u.getQuarter(4, a) };
}
static getCurrentFiscalYear() {
const e = new u(), a = e.getYear();
return e.getMonth() < 3 ? a - 1 : a;
}
static getFiscalYearQuarter(e, a) {
if (e < 1 || e > 4 || !Number.isInteger(e)) throw new Error("Quarter must be an integer between 1 and 4");
const o = a ?? u.getCurrentFiscalYear();
let s = o, y = 3 * (e - 1) + 3;
e === 4 && (s = o + 1, y = 0), y > 11 && (s++, y -= 12);
let d = y + 2, D = s;
return d > 11 && (D++, d -= 12), { start: new u(s, y, 1), end: new u(D, d, 1).endOfMonth() };
}
getCurrentFiscalYearQuarter() {
const e = this.getMonth();
return e >= 3 && e <= 5 ? 1 : e >= 6 && e <= 8 ? 2 : e >= 9 && e <= 11 ? 3 : 4;
}
getCurrentFiscalYearQuarterDates() {
const e = this.getCurrentFiscalYearQuarter(), a = u.getCurrentFiscalYear();
return u.getFiscalYearQuarter(e, a);
}
static getFiscalYearQuarters(e) {
const a = e ?? u.getCurrentFiscalYear();
return { Q1: u.getFiscalYearQuarter(1, a), Q2: u.getFiscalYearQuarter(2, a), Q3: u.getFiscalYearQuarter(3, a), Q4: u.getFiscalYearQuarter(4, a) };
}
};
const Ta = ["id"], Na = ["placeholder", "id", "readonly", "disabled"], pa = {
key: 0,
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 1024 1024",
width: "1em",
height: "1em"
}, Ma = ["id"], Ea = { class: "calendar__body" }, Ya = { class: "calendar__head" }, ka = { class: "calendar__header_label" }, ba = { key: 0 }, _a = { key: 2 }, Ca = { key: 4 }, Sa = { class: "calendar__container" }, Ia = { key: 0 }, Va = { class: "calendar__weeks" }, xa = { class: "calendar__days" }, Oa = ["title", "onClick"], Ba = {
key: 0,
class: "calendar__english_day"
}, $a = ["title", "onClick"], Fa = {
key: 0,
class: "calendar__english_day"
}, Ha = ["title", "onClick"], Qa = {
key: 0,
class: "calendar__english_day"
}, Aa = ["onClick"], La = ["onClick"], re = 10, P = 1, Pa = /* @__PURE__ */ Je({
__name: "NepaliDatePicker",
props: {
id: { default: "" },
modelValue: { default: "" },
yearSelect: { type: Boolean, default: !0 },
monthSelect: { type: Boolean, default: !0 },
class: { default: "" },
placeholder: { default: "" },
minDate: { default: "" },
maxDate: { default: "" },
inputClass: { default: "" },
clickSelect: { type: Boolean, default: !1 },
updateOnInputChange: { type: Boolean, default: !1 },
autoFormat: { type: Boolean, default: !0 },
miniEnglishDate: { type: Boolean, default: !1 },
highlightSaturday: { type: Boolean, default: !1 },
allowTyping: { type: Boolean, default: !0 },
disabled: { type: Boolean, default: !1 }
},
emits: ["update:modelValue", "onSelect"],
setup(r, { emit: e }) {
const a = r, o = e, s = Y(a.modelValue ? new v(a.modelValue) : new v()), y = Y(!1), d = Y(a.modelValue), D = Y(a.modelValue ? new v(a.modelValue).getYear() : new v().getYear()), Q = Y(a.modelValue ? new v(a.modelValue).getMonth() : new v().getMonth()), M = Y(!1), w = Y(!1), C = Y(i?.[0]?.year), B = Y(i?.[i.length - 1]?.year ?? 0), x = Y(0), g = Y(), $ = Y(!1), E = Y(), A = Y(!1), Z = Y(!1), L = Y(0), fe = Y(0), De = Y(!1), Te = Y(null);
Ze(() => {
ye();
}), G(
() => a.modelValue,
() => {
d.value = a.modelValue, D.value = a.modelValue ? new v(a.modelValue).getYear() : new v().getYear(), Q.value = a.modelValue ? new v(a.modelValue).getMonth() : new v().getMonth(), s.value = a.modelValue ? new v(a.modelValue) : new v();
}
), G(
() => a.minDate,
() => {
ye();
}
), G(
() => a.maxDate,
() => {
ye();
}
), G([M, w], () => {
y.value && Me(() => {
O();
});
}), G(
() => d.value,
(l) => {
Z.value = !0, a.updateOnInputChange && /^\d{4}-\d{2}-\d{2}$/.test(l) && ve(!0);
}
);
const ie = () => {
a.disabled || (ce(!0), a.clickSelect && a.allowTyping && document.getElementById("nepali-date-input-" + H)?.select());
}, ye = () => {
if (a.minDate)
try {
g.value = new v(a.minDate), $.value = !0;
} catch (l) {
g.value = void 0, console.error("Invalid Minimum Date", l), $.value = !1;
}
if (a.maxDate)
try {
E.value = new v(a.maxDate), A.value = !0;
} catch (l) {
console.error("Invalid Maximum Date", l), A.value = !1;
}
A.value && $.value && (g.value && E.value && g.value.isAfter(E.value) ? (console.error("Minimum Date is Greater than Maximum Date"), A.value = !1, $.value = !1) : g.value && E.value && g.value.isEqual(E.value) && (console.error("Minimum Date is Equal to Maximum Date"), A.value = !1, $.value = !1));
}, p = se(() => v.getCalendarDays(s.value.year, s.value.month)), Oe = se(() => ({
top: `${L.value}px`,
left: `${fe.value}px`
})), Be = () => {
const l = Te.value;
if (!l) return { height: 267, width: 272 };
const t = l.style.transform;
l.style.transform = "none";
const n = l.scrollHeight, f = l.scrollWidth;
return l.style.transform = t, { height: n, width: f };
}, O = () => {
const l = document.getElementById("nepali-date-input-" + H), t = document.getElementById("nepali-calendar-" + H);
if (!l || !t) return;
const n = l.getBoundingClientRect(), f = window.innerHeight, T = window.innerWidth, { height: S, width: R } = Be();
console.log(S, R);
const F = S, m = R, I = n.top, z = f - n.bottom, j = z < F + P && I > z;
if (De.value = j, j)
L.value = n.top + window.scrollY - F - P - 1, L.value < window.scrollY && (L.value = window.scrollY + P);
else {
L.value = n.bottom + window.scrollY + P;
const pe = f + window.scrollY - F - P;
L.value > pe && (L.value = pe);
}
let K = n.left + window.scrollX;
K + m > T + window.scrollX && (K = n.right + window.scrollX - m), K < window.scrollX && (K = window.scrollX + P), m > T && (K = window.scrollX + P), fe.value = K;
}, b = (l, t) => new v(l.year, l.month, t), de = (l) => l.getEnglishDate().getDate(), ue = (l) => l.getEnglishDate().getDay() === 6, $e = () => {
if (w.value = !w.value, M.value = !1, w.value) {
const l = s.value.year, t = i.findIndex((n) => n.year === l);
x.value = Math.floor(t / re);
}
}, Fe = () => {
const l = new v();
W(l) && ($.value && g.value ? s.value = new v(g.value.year, g.value.month, g.value.day) : A.value && E.value && (s.value = new v(E.value.year, E.value.month, E.value.day)));
}, ce = (l, t) => {
l ? y.value = !0 : t ? y.value = !1 : y.value = !y.value, y.value ? (Fe(), Me(() => {
O(), window.addEventListener("scroll", O, !0), window.addEventListener("resize", O);
}), setTimeout(() => {
document.addEventListener("click", le);
}, 0)) : (document.removeEventListener("click", le), window.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O), Ne()), Z.value && (Z.value = !1);
}, He = () => {
M.value = !M.value, w.value = !1;
}, Qe = () => {
let l = s.value.month + 1, t = s.value.year;
l > 11 && (t++, l = 0), C.value && !(t + 1 < C.value || t > B.value) && (ae(l, t), s.value = new v(t, l, 1));
}, Ae = () => {
if (w.value)
x.value < Ue.value - 1 && x.value++;
else {
let l = s.value.month, t = s.value.year + 1;
C.value && !(t < C.value || t > B.value) && (ae(l, t), s.value = new v(t, l, 1));
}
}, Le = () => {
let l = s.value.month - 1, t = s.value.year;
l < 0 && (t--, l = 11), C.value && !(t < C.value || t > B.value) && (ae(l, t), s.value = new v(t, l, 1));
}, Pe = () => {
if (w.value)
x.value > 0 && x.value--;
else {
let l = s.value.month, t = s.value.year - 1;
C.value && !(t < C.value || t > B.value) && (ae(l, t), s.value = new v(t, l, 1));
}
}, We = (l) => a.modelValue ? new v(a.modelValue).getTime() === l.getTime() : !1, Re = (l) => s.value.month == l, ze = (l) => s.value.year == l, W = (l) => !!($.value && g.value && l.isBefore(g.value) || A.value && E.value && l.isAfter(E.value)), Ke = (l) => {
const t = new v();
return l.day === t.day && l.year === t.year && l.month === t.month;
}, ee = se(() => {
const l = i.map((n) => n.year), t = x.value * re;
return l.slice(t, t + re);
}), Ue = se(() => Math.ceil(i.length / re)), he = (l) => {
let t = "";
const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", f = n.length;
let T = 0;
for (; T < l; )
t += n.charAt(Math.floor(Math.random() * f)), T += 1;
return t;
}, H = he(5) + he(5) + he(5), ae = (l, t) => {
Q.value = l, D.value = t;
}, Xe = (l) => {
Q.value = l, s.value.setMonth(l), M.value = !1;
}, qe = (l) => {
D.value = l, s.value.setYear(l), w.value = !1, a.monthSelect && (M.value = !0);
}, te = (l, t = !1) => {
W(l) || (s.value = l, d.value = s.value.format("YYYY-MM-DD"), o("update:modelValue", d.value), o("onSelect", d.value), t || ce());
}, ve = (l = !1) => {
if (Z.value) {
if (!/^\d{4}-\d{2}-\d{2}$/.test(d.value)) {
d.value = a.modelValue;
return;
}
try {
const t = new v(d.value);
if (W(t)) {
console.warn("Entered date is outside allowed range"), d.value = a.modelValue;
return;
}
te(t, l);
} catch {
d.value = a.modelValue;
}
}
}, je = (l) => {
if (!a.autoFormat) {
d.value = l.target.value;
return;
}
let n = l.target.value.replace(/[^0-9]/g, "").slice(0, 9), f = "", T = "", S = "", R = 31;
if (n.length >= 4 ? f = n.slice(0, 4) : f = n, n.length >= 5) {
let m = n.charAt(4), I = n.charAt(5) || "";
m === "0" ? T = m + I : m === "1" ? ["0", "1", "2"].includes(I) ? T = m + I : I ? (T = "0" + m, n = n.slice(0, 5) + I + n.slice(6)) : T = m : "23456789".includes(m) && (T = "0" + m), T === "00" && (T = "0");
}
if (/^\d{4}$/.test(f) && /^\d{2}$/.test(T) && (R = s.value.endOfMonth().day), n.length >= 7) {
let m = n.charAt(6), I = n.charAt(7) || "", z = n.charAt(8) || "";
if (!z)
"123456789".includes(m) && (S = "0" + m);
else if (m == 0) {
let j = parseInt(I + z);
j >= 1 && j <= R ? S = I + z : S = m + I;
} else
S = m + I;
(S === "00" || parseInt(S) > R) && (S = "");
}
if (/^\d{4}$/.test(f)) {
let m = parseInt(f);
try {
if (g.value && m < g.value.year || E.value && m > E.value.year)
throw Error("Check Fail");
s.value.setYear(m);
} catch {
f = "";
}
}
if (/^\d{2}$/.test(T)) {
let m = parseInt(T) - 1;
try {
if (g.value && m < g.value.month || E.value && m > E.value.month)
throw Error("Check Fail");
s.value.setMonth(m);
} catch {
T = "";
}
}
let F = f;
T && (F += "-" + T), S && (F += "-" + S), l.target.value = F, d.value != F && (d.value = F);
}, le = (l) => {
const t = document.getElementById("nepali-calendar-" + H), n = document.getElementById("nepali-date-input-" + H);
t && !t.contains(l.target) && n && !n.contains(l.target) && (y.value = !1, Ne(), document.removeEventListener("click", le), window.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O), ve(!0));
}, Ne = () => {
M.value = !1, w.value = !1, s.value = a.modelValue ? new v(a.modelValue) : new v();
}, Ge = () => {
M.value = !1, w.value = !1, s.value = new v(), o("update:modelValue", ""), o("onSelect", ""), ce(!1, !0);
};
return ea(() => {
document.removeEventListener("click", le), window.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O);
}), (l, t) => (c(), h("div", {
class: V(["nepali-datepicker", a.class]),
key: H,
id: r.id,
onFocusin: t[11] || (t[11] = (n) => ie()),
tabindex: "0"
}, [
N("div", {
class: V(["calendar-input-div", r.modelValue ? "calendar-input-contain-value" : ""])
}, [
aa(N("input", {
type: "text",
class: V(["calendar-input", a.inputClass]),
onClick: t[0] || (t[0] = (n) => ie()),
"onUpdate:modelValue": t[1] || (t[1] = (n) => d.value = n),
placeholder: r.placeholder,
"aria-haspopup": "true",
id: "nepali-date-input-" + H,
onKeyup: t[2] || (t[2] = ta((n) => ve(), ["enter"])),
onInput: je,
readonly: !r.allowTyping,
disabled: r.disabled
}, null, 42, Na), [
[la, d.value]
]),
N("div", {
class: V(["calendar-input-icon", r.disabled ? "" : "calendar-icon"]),
onClick: t[3] || (t[3] = U((n) => ie(), ["stop"]))
}, [
!(y.value && r.modelValue) || r.disabled ? (c(), h("svg", pa, [...t[12] || (t[12] = [
N("path", { d: "M940.218 107.055H730.764v-60.51H665.6v60.51H363.055v-60.51H297.89v60.51H83.78c-18.617 0-32.581 13.963-32.581 32.581v805.237c0 18.618 13.964 32.582 32.582 32.582h861.09c18.619 0 32.583-13.964 32.583-32.582V139.636c-4.655-18.618-18.619-32.581-37.237-32.581zm-642.327 65.163v60.51h65.164v-60.51h307.2v60.51h65.163v-60.51h176.873v204.8H116.364v-204.8H297.89zM116.364 912.291V442.18H912.29v470.11H116.364z" }, null, -1)
])])) : k("", !0)
], 2),
r.modelValue && !r.disabled ? (c(), h("div", {
key: 0,
class: V(["calendar-input-icon", y.value ? "" : "calendar-clear-input"]),
onClick: t[4] || (t[4] = U((n) => Ge(), ["stop"]))
}, [...t[13] || (t[13] = [
N("svg", {
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, [
N("path", {
id: "Vector",
d: "M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",
"stroke-width": "2",
"stroke-linecap": "round",
"stroke-linejoin": "round"
})
], -1)
])], 2)) : k("", !0)
], 2),
(c(), sa(na, { to: "body" }, [
ra(oa, { name: "calendar-animation" }, {
default: ia(() => [
y.value ? (c(), h("div", {
key: 0,
class: V(["calendar", { show: y.value, "calendar-above": De.value }]),
id: "nepali-calendar-" + H,
style: ya([Oe.value, { "user-select": "none" }]),
ref_key: "calendarRef",
ref: Te
}, [
N("div", Ea, [
N("div", Ya, [
N("div", null, [
N("button", {
class: "calendar__toggle_button",
onClick: t[5] || (t[5] = (n) => Pe())
}, [...t[14] || (t[14] = [
N("i", { class: "calendar-icon-double-left" }, null, -1)
])]),
!M.value && !w.value ? (c(), h("button", {
key: 0,
class: "calendar__toggle_button",
onClick: t[6] || (t[6] = (n) => Le())
}, [...t[15] || (t[15] = [
N("i", { class: "calendar-icon-left" }, null, -1)
])])) : k("", !0)
]),
N("div", ka, [
r.monthSelect ? k("", !0) : (c(), h("a", ba, _(s.value.format("MMMM")), 1)),
!M.value && !w.value && r.monthSelect ? (c(), h("a", {
key: 1,
class: "calendar__header_selector",
onClick: U(He, ["stop"])
}, _(s.value.format("MMMM")), 1)) : k("", !0),
r.yearSelect ? k("", !0) : (c(), h("a", _a, _(s.value.format("YYYY")), 1)),
!w.value && r.yearSelect ? (c(), h("a", {
key: 3,
class: "calendar__header_selector",
onClick: U($e, ["stop"])
}, _(s.value.format("YYYY")), 1)) : k("", !0),
w.value && r.yearSelect ? (c(), h("a", Ca, _(ee.value[0]) + " ~ " + _(ee.value[ee.value.length - 1]), 1)) : k("", !0)
]),
N("div", null, [
!M.value && !w.value ? (c(), h("button", {
key: 0,
class: "calendar__toggle_button",
onClick: t[7] || (t[7] = (n) => Qe())
}, [...t[16] || (t[16] = [
N("i", { class: "calendar-icon-right" }, null, -1)
])])) : k("", !0),
N("button", {
class: "calendar__toggle_button",
onClick: t[8] || (t[8] = (n) => Ae())
}, [...t[17] || (t[17] = [
N("i", { class: "calendar-icon-double-right" }, null, -1)
])])
])
]),
N("div", Sa, [
!M.value && !w.value ? (c(), h("div", Ia, [
N("div", Va, [
(c(!0), h(X, null, q(Ee(me), (n, f) => (c(), h("div", {
key: f,
class: "calendar__weekday"
}, _(n), 1))), 128))
]),
N("div", xa, [
p.value.prevRemainingDays > 0 ? (c(!0), h(X, { key: 0 }, q(p.value.prevMonth.days, (n, f) => (c(), h("div", {
key: f,
class: V(["calendar__day calendar__not_current_month", {
calendar__disable_date: W(b(p.value.prevMonth, n)),
calendar__not_current_month_saturday: ue(b(p.value.prevMonth, n)) && r.highlightSaturday
}]),
title: b(p.value.prevMonth, n).format("YYYY-MM-DD"),
onClick: (T) => te(b(p.value.prevMonth, n))
}, [
N("span", null, _(n), 1),
r.miniEnglishDate ? (c(), h("span", Ba, _(de(b(p.value.currentMonth, n))), 1)) : k("", !0)
], 10, Oa))), 128)) : k("", !0),
(c(!0), h(X, null, q(p.value.currentMonth.days, (n, f) => (c(), h("div", {
key: f,
class: V(["calendar__day", {
calendar__selected: We(b(p.value.currentMonth, n)),
calendar__today: Ke(b(p.value.currentMonth, n)),
calendar__disable_date: W(b(p.value.currentMonth, n)),
calendar__saturday: ue(b(p.value.currentMonth, n)) && r.highlightSaturday
}]),
title: b(p.value.currentMonth, n).format("YYYY-MM-DD"),
onClick: (T) => te(b(p.value.currentMonth, n))
}, [
N("span", null, _(n), 1),
r.miniEnglishDate ? (c(), h("span", Fa, _(de(b(p.value.currentMonth, n))), 1)) : k("", !0)
], 10, $a))), 128)),
p.value.remainingDays > 0 ? (c(!0), h(X, { key: 1 }, q(p.value.nextMonth.days, (n, f) => (c(), h("div", {
key: f,
class: V(["calendar__day calendar__not_current_month", {
calendar__disable_date: W(b(p.value.nextMonth, n)),
calendar__not_current_month_saturday: ue(b(p.value.nextMonth, n)) && r.highlightSaturday
}]),
title: b(p.value.nextMonth, n).format("YYYY-MM-DD"),
onClick: (T) => te(b(p.value.nextMonth, n))
}, [
N("span", null, _(n), 1),
r.miniEnglishDate ? (c(), h("span", Qa, _(de(b(p.value.currentMonth, n))), 1)) : k("", !0)
], 10, Ha))), 128)) : k("", !0)
])
])) : k("", !0),
M.value ? (c(), h("div", {
key: 1,
class: "calendar__months",
onClick: t[9] || (t[9] = U(() => {
}, ["stop"]))
}, [
(c(!0), h(X, null, q(Ee(ge), (n, f) => (c(), h("div", {
class: V(["calendar_month", { calendar__selected: Re(f) }]),
onClick: (T) => Xe(f)
}, _(n), 11, Aa))), 256))
])) : k("", !0),
w.value ? (c(), h("div", {
key: 2,
class: "calendar__years",
onClick: t[10] || (t[10] = U(() => {
}, ["stop"]))
}, [
(c(!0), h(X, null, q(ee.value, (n) => (c(), h("div", {
class: V(["calendar__year", { calendar__selected: ze(n) }]),
onClick: (f) => qe(n)
}, _(n), 11, La))), 256))
])) : k("", !0)
])
])
], 14, Ma)) : k("", !0)
]),
_: 1
})
]))
], 42, Ta));
}
}), Wa = (r, e) => {
const a = r.__vccOpts || r;
for (const [o, s] of e)
a[o] = s;
return a;
}, za = /* @__PURE__ */ Wa(Pa, [["__scopeId", "data-v-920abd7e"]]);
export {
za as NepaliDatePicker,
za as default
};