diff --git a/dist/nepali-date-picker.bundle.js b/dist/nepali-date-picker.bundle.js index 9097d25..9d3ae49 100644 --- a/dist/nepali-date-picker.bundle.js +++ b/dist/nepali-date-picker.bundle.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NepaliDatePicker=t():e.NepaliDatePicker=t()}(this,(()=>(()=>{"use strict";var e={0:(e,t,n)=>{n.d(t,{Z:()=>s});var a=n(650),r=n.n(a),i=n(196),o=n.n(i)()(r());o.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap);"]),o.push([e.id,":root {\n --ap-white: #ffffff;\n --ap-black: #000000;\n --rounded-md: 0.375rem;\n --gray-50: rgb(249 250 251 / 1);\n --gray-100: rgb(243 244 246 / 1);\n --gray-200: rgb(229 231 235 / 1);\n --gray-300: rgb(209 213 219 / 1);\n --gray-400: rgb(156 163 175 / 1);\n --gray-500: rgb(107 114 128 / 1);\n --gray-600: rgb(75 85 99 / 1);\n --gray-700: rgb(55 65 81 / 1);\n --gray-800: rgb(31 41 55 / 1);\n --gray-900: rgb(17 24 39 / 1);\n --gray-950: rgb(3 7 18 / 1);\n --red-400: rgb(248 113 113 / 1);\n --red-500: rgb(239 68 68 / 1);\n}\n\n.theme-dark {\n --ap-white: #1D1D1D;\n --ap-black: #fefefe;\n --gray-50: rgb(3 7 18 / 1);\n --gray-100: rgb(33 34 36 / 1);\n --gray-200: rgb(31 41 55 / 1);\n --gray-300: rgb(55 65 81 / 1);\n --gray-400: rgb(75 85 99 / 1 );\n --gray-500: rgb(210 210 210 / 1);\n --gray-600: rgb(156 163 175 / 1);\n --gray-700: rgb(209 213 219 / 1);\n --gray-800: rgb(229 231 235 / 1);\n --gray-900: rgb(243 244 246 / 1);\n --gray-950: rgb(249 250 251 / 1);\n --red-400: rgb(248 113 113 / 1);\n --red-500: rgb(239 68 68 / 1);\n}\n\n.ap-card {\n font-family: 'Inter', sans-serif;\n z-index: 10;\n position: absolute;\n display: none;\n width: auto;\n max-width: fit-content;\n background: var(--ap-white);\n box-shadow: 0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0 0 0 / 0.05);\n padding: 0.5rem;\n box-sizing: border-box;\n font-size: 0.875rem;\n line-height: 1.25rem;\n border: 1px solid var(--gray-200);\n border-radius: var(--rounded-md);\n margin-top: 0.25rem;\n}\n\n.ap-header-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n}\n\n.ap-header__button {\n padding: 0.25rem;\n border-radius: var(--rounded-md);\n color: var(--ap-black);\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n width: 2.5rem;\n height: 2.5rem;\n display: flex;\n justify-content: center;\n align-items: center;\n border: none;\n background: var(--ap-white);\n}\n\n.ap-header__button:hover {\n color: var(--gray-600);\n background: var(--gray-100);\n}\n\n.ap-header__button:focus {\n color: var(--ap-black);\n background: var(--ap-white);\n outline: none;\n}\n\n.ap-header__button > svg {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.ap-header__selects {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n}\n\n.ap-header__select {\n appearance: none;\n line-height: 1.8;\n text-align: center;\n height: 2.5rem;\n padding: 0.25rem 1rem;\n border-radius: var(--rounded-md);\n border: none;\n background: var(--ap-white);\n color: var(--ap-black);\n}\n\n.ap-header__select:focus {\n outline: none;\n}\n\n.ap-header__select:hover {\n background: var(--gray-100);\n}\n\n.ap-table {\n margin-top: 0.5rem;\n text-align: center;\n width: 100%;\n}\n\n.ap-table__thead__tr {\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: flex-start;\n color: var(--gray-500);\n padding-top: 0.5rem;\n padding-bottom: 0.75rem;\n gap: 0.25rem;\n}\n\n.ap-table__tbody__tr {\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: flex-start;\n color: var(--gray-500);\n gap: 0.25rem;\n}\n\n.ap-table__thead__tr_th {\n width: 2.5rem;\n font-weight: 500;\n padding: 0;\n}\n\n.holiday-marker-color {\n color: var(--red-400) !important;\n}\n\n.holiday-marker-color:hover > button {\n color: var(--red-500) !important;\n}\n\n.ap-table__tbody {\n display: flex;\n flex-direction: column;\n row-gap: 0.25rem;\n}\n\n.ap-table__thead__tr_td {\n height: 2.5rem;\n width: 2.5rem;\n text-align: center;\n padding: 0;\n position: relative;\n color: var(--gray-500);\n}\n\n.ap-table__thead__tr_td > button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--rounded-md);\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n width: 2.5rem;\n height: 2.5rem;\n padding: 0;\n font-weight: 400;\n border: none;\n background: var(--ap-white);\n color: inherit;\n}\n\n.ap-table__thead__tr_td > button:focus {\n outline: none;\n}\n\n.ap-table__thead__tr_td > button:disabled {\n color: var(--gray-400);\n background: var(--gray-100);\n cursor: not-allowed;\n}\n\n.ap-table__thead__tr_td > button:hover {\n color: var(--gray-500);\n background: var(--gray-100);\n}\n\n.no-hover:hover {\n color: transparent !important;\n background: transparent !important;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.bordered {\n border: 1px solid var(--gray-200);\n}\n\n.ap-width-tr-td {\n width: 2.5rem;\n}\n\n.ap-width-ddd {\n width: 4rem;\n}\n\n.ap-width-np-ddd {\n width: 5rem;\n}\n\n.ap-gap {\n gap: 0.25rem;\n}\n\n.ap-table__thead__tr_td > button.selected {\n background: var(--ap-black) !important;\n color: var(--ap-white) !important;\n border: none !important;\n}\n\n.ap-cell-button.selected:hover {\n background: var(--gray-800);\n color: var(--ap-white);\n}\n\n\n.bordered-theme {\n border: 1px solid var(--gray-200) !important;\n}\n\n.soft-theme {\n background: var(--gray-50) !important;\n transition: all ease;\n}\n\n.soft-theme:hover {\n background: var(--gray-100) !important;\n}\n\n.bordered-dashed {\n border-style: dashed !important;\n}\n\n.ap-table__thead__tr_td.active > button {\n background: var(--gray-100);\n border: 1px dashed var(--gray-400) !important;\n}\n\n.ap-position-left {\n left: 0;\n}\n\n.ap-position-right {\n right: 0 !important;\n}\n\n.ap-position-center {\n left: 0 !important;\n right: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}",""]);const s=o},196:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(a)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),t.push(c))}},t}},650:e=>{e.exports=function(e){return e[1]}},62:e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},911:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},107:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},552:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,r&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},227:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},840:(e,t,n)=>{n.d(t,{default:()=>r});class a{#e={format:"YYYY-MM-DD",closeOnDateSelect:!0,disableAfterToday:!1,disableBeforeToday:!1,disableToday:!1,markHolidays:!0,holidays:["Saturday"],indicateCurrentDate:!0,setCurrentDate:!1,position:"left",daysFormat:"dd",locale:"np",theme:"flat",darkMode:!1,inline:!1};#t=null;#n="data-ap-";constructor(e,t){this.today=new Date,this.currentYear=this.today.getFullYear(),this.currentMonth=this.today.getMonth(),this.currentDay=this.today.getDate(),"object"==typeof t&&(this.#e={...this.#e,...t}),this.#t={trGap:"ap-gap",trAndTdWidth:"ddd"===this.#e.daysFormat?"np"===this.#e.locale?"ap-width-np-ddd":"ap-width-ddd":"ap-width-tr-td",position:this.#a()},this.#r(e)}#r(e){this.#i(),this.#e.inline?this.#o(e):(this.#s(e),this.#d(),this.#l())}#i(){let{year:e,month:t,date:n}=a.convertToNepaliDate(this.currentYear,this.currentMonth+1,this.currentDay);this.currentYear=+e,this.currentMonth=+t,this.currentDay=+n}#s(e){this.#c(e),this.#p()}#p(){document.addEventListener("click",(e=>{if(e.target.classList.contains("ap-cell-button")){let t="selected";e.target.closest("table").querySelectorAll(".ap-cell-button").forEach((function(e){e&&t.split(" ").forEach((t=>e.classList.remove(t)))})),t.split(" ").forEach((t=>e.target.classList.add(t)));let n=parseInt(e.target.closest(".ap-card").querySelector(".ap-calendar-year").value),a=parseInt(e.target.closest(".ap-card").querySelector(".ap-calendar-month").value)+1,r=this.#u(e.target.textContent),i=("0"+a).slice(-2),o=("0"+r).slice(-2),s=this.#h(n,i,o),d=e.target.closest(".ap-card").previousElementSibling;d&&(d.value=s),this.#e.closeOnDateSelect&&document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")}))}}))}#c(e){const t=document.querySelectorAll(e);t.length>0&&t.forEach((e=>{this.#e.setCurrentDate&&!this.#e.disableToday&&(e.value=this.#h(this.currentYear,this.currentMonth+1,this.currentDay)),e.hasAttribute("placeholder")||e.setAttribute("placeholder",this.#e.format),e.addEventListener("click",(t=>{t.preventDefault();const n=t.target.nextElementSibling;if(n&&n.classList.contains("ap-card"))return;const a=Math.floor(1e5+9e5*Math.random()).toString();e.setAttribute(`${this.#n+a}`,""),this.#g({selector:e,selectorUniqueId:a})}))}))}#d(){document.addEventListener("click",(e=>{if(e.target.classList.contains("ap-calendar")){const t=e.target.nextElementSibling,n=t.classList;e.target.parentElement.style.position="relative";const a=this.#y(e.target,!0);document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")})),t&&n.contains(`ap-calendar-${a}`)&&(t.style.display="block")}}))}#l(){document.addEventListener("click",(function(e){e.target.matches(".ap-calendar, .ap-card, .ap-card *")||document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")}))}))}#g({selector:e,selectorUniqueId:t}){const n=this.#e.inline,a=e;a.classList.add("ap-calendar"),n&&a.classList.add("ap-inline");const r=this.#m(),i=this.#e.darkMode?"theme-dark":"theme-light",o=`\n \n `,s=`\n \n `,d=this.#b(),l=this.#f(),c=this.#v(),p=`\n
\n
\n
\n ${o}\n
\n \n \n
\n ${s}\n
\n
\n \n \n \n ${d}\n \n \n \n \n
\n
\n `;n?a.innerHTML=p:a.insertAdjacentHTML("afterend",p),this.#_(a,this.currentMonth,this.currentYear),this.#D(a)}#o(e){const t=document.querySelectorAll(e);t.length>0&&t.forEach((e=>{const t=Math.floor(1e5+9e5*Math.random()).toString();e.setAttribute(`${this.#n+t}`,""),this.#g({selector:e,selectorUniqueId:t})}))}#D(e){const t=this.#e.inline?e.querySelector(".btn-next"):e.nextElementSibling.querySelector(".btn-next"),n=this.#e.inline?e.querySelector(".btn-previous"):e.nextElementSibling.querySelector(".btn-previous"),a=this.#e.inline?e.querySelector(".ap-calendar-year"):e.nextElementSibling.querySelector(".ap-calendar-year"),r=this.#e.inline?e.querySelector(".ap-calendar-month"):e.nextElementSibling.querySelector(".ap-calendar-month");let i=parseInt(a.value),o=parseInt(r.value);t.removeEventListener("click",(()=>{})),n.removeEventListener("click",(()=>{})),t.addEventListener("click",(t=>{t.preventDefault(),i=11===o?i+1:i,o=(o+1)%12,this.#_(e,o,i)})),n.addEventListener("click",(t=>{t.preventDefault(),i=0===o?i-1:i,o=0===o?11:o-1,this.#_(e,o,i)}))}#_(e,t,n){const r=this.#e.inline?e.children[0]:e.nextElementSibling;let i;if(r&&r.classList.contains("ap-card")&&(i=r),!i)return;if(void 0===a.#x()[n])return;const o=a.#x()[n][1][t]-1,s=Object.keys(e.dataset).find((e=>e.includes("ap-"))).split("-")[1];i=document.querySelector(`.ap-calendar-${s}`);const d=i.querySelector(".calendar-body"),l=i.querySelector(".ap-calendar-year"),c=i.querySelector(".ap-calendar-month");l.removeEventListener("change",(()=>{})),c.removeEventListener("change",(()=>{})),l.addEventListener("change",(n=>{this.#_(e,t,n.target.value),this.#D(e)})),c.addEventListener("change",(t=>{this.#_(e,t.target.value,n),this.#D(e)})),l.value=n,c.value=t;const p=this.#m();if(d)for(;d.firstChild;)d.removeChild(d.firstChild);let u=1;for(let e=0;e<6;e++){const a=document.createElement("tr");a.classList.add("ap-table__tbody__tr");const r=this.#e.markHolidays&&this.#e.holidays.map((e=>this.#w().findIndex((t=>t.day.toLowerCase()===e.toLowerCase()))));for(let i=0;i<7;i++){let s=r&&r.includes(i)?"holiday-marker-color":null;if(0===e&&ithis.#k(t,n))break;const e=document.createElement("td");e.classList.add("ap-table__thead__tr_td",this.#t.trAndTdWidth,"ap-cell",s);const r=document.createElement("button");r.classList.add("ap-cell-button",p),this.#M(r,n,t,u);const i="np"===this.#e.locale?this.#L(u):u;this.#e.indicateCurrentDate&&+u==+this.currentDay&&+n==+this.currentYear&&+t==+this.currentMonth&&(e.classList.add("active"),r.classList.add("bordered-dashed")),r.appendChild(document.createTextNode(i)),e.appendChild(r),a.append(e),u++}}d.append(a)}}#M(e,t,n,a){const r=this.currentYear,i=this.currentMonth+1,o=this.currentDay;t=+t,n=+n,a=+a,this.#e.disableBeforeToday&&(tr||t===r&&n+1>i||t===r&&n+1===i&&a>o)&&e.setAttribute("disabled","disabled")}#v(){return Array.from({length:91},((e,t)=>``)).join("")}#b(){return this.#w().map((e=>`${e[this.#e.locale][this.#e.daysFormat]}`)).join("")}#f(){return this.#C().map(((e,t)=>``)).join("")}#T(){console.log("close date picker")}#C(){return[{en:"Baishak",np:"बैशाख"},{en:"Jestha",np:"जेठ"},{en:"Ashad",np:"असार"},{en:"Shrawn",np:"साउन"},{en:"Bhadra",np:"भदौ"},{en:"Ashwin",np:"असोज"},{en:"Kartik",np:"कार्तिक"},{en:"Mangshir",np:"मंसिर"},{en:"Poush",np:"पुष"},{en:"Magh",np:"माघ"},{en:"Falgun",np:"फाल्गुन"},{en:"Chaitra",np:"चैत्र"}]}static#S(){return[31,29,31,30,31,30,31,31,30,31,30,31]}static#Y(){return[31,28,31,30,31,30,31,31,30,31,30,31]}static#x(){return{2e3:[[30,32,31,32,31,30,30,30,29,30,29,31],[4,6,3,6,3,6,1,3,5,6,1,2]],2001:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2002:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2003:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2004:[[30,32,31,32,31,30,30,30,29,30,29,31],[2,4,1,4,1,4,6,1,3,4,6,7]],2005:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2006:[[31,31,32,32,31,30,30,29,30,29,30,30],[4,7,3,7,4,7,2,4,5,7,1,3]],2007:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2008:[[31,31,31,32,31,31,29,30,30,29,29,31],[7,3,6,2,6,2,5,6,1,3,4,5]],2009:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2010:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2011:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2012:[[31,31,31,32,31,31,29,30,30,29,30,30],[5,1,4,7,4,7,3,4,6,1,2,4]],2013:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2014:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2015:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2016:[[31,31,31,32,31,31,29,30,30,29,30,30],[3,6,2,5,2,5,1,2,4,6,7,2]],2017:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2018:[[31,32,31,32,31,30,30,29,30,29,30,30],[5,1,5,1,5,1,3,5,6,1,2,4]],2019:[[31,32,31,32,31,30,30,30,29,30,29,31],[6,2,6,2,6,2,4,6,1,2,4,5]],2020:[[31,31,31,32,31,31,30,29,30,29,30,30],[1,4,7,3,7,3,6,1,2,4,5,7]],2021:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2022:[[31,32,31,32,31,30,30,30,29,29,30,30],[3,6,3,6,3,6,1,3,5,6,7,2]],2023:[[31,32,31,32,31,30,30,30,29,30,29,31],[4,7,4,7,4,7,2,4,6,7,2,3]],2024:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2025:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2026:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2027:[[30,32,31,32,31,30,30,30,29,30,29,31],[3,5,2,5,2,5,7,2,4,5,7,1]],2028:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2029:[[31,31,32,31,32,30,30,29,30,29,30,30],[5,1,4,1,4,1,3,5,6,1,2,4]],2030:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2031:[[30,32,31,32,31,30,30,30,29,30,29,31],[1,3,7,3,7,3,5,7,2,3,5,6]],2032:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2033:[[31,31,32,32,31,30,30,29,30,29,30,30],[3,6,2,6,3,6,1,3,4,6,7,2]],2034:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2035:[[30,32,31,32,31,31,29,30,30,29,29,31],[6,1,5,1,5,1,4,5,7,2,3,4]],2036:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2037:[[31,31,32,32,31,30,30,29,30,29,30,30],[1,4,7,4,1,4,6,1,2,4,5,7]],2038:[[31,32,31,32,31,30,30,30,29,29,30,31],[2,5,2,5,2,5,7,2,4,5,6,1]],2039:[[31,31,31,32,31,31,29,30,30,29,30,30],[4,7,3,6,3,6,2,3,5,7,1,3]],2040:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2041:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2042:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2043:[[31,31,31,32,31,31,29,30,30,29,30,30],[2,5,1,4,1,4,7,1,3,5,6,1]],2044:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2045:[[31,32,31,32,31,30,30,29,30,29,30,30],[4,7,4,7,4,7,2,4,5,7,1,3]],2046:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2047:[[31,31,31,32,31,31,30,29,30,29,30,30],[7,3,6,2,6,2,5,7,1,3,4,6]],2048:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2049:[[31,32,31,32,31,30,30,30,29,29,30,30],[2,5,2,5,2,5,7,2,4,5,6,1]],2050:[[31,32,31,32,31,30,30,30,29,30,29,31],[3,6,3,6,3,6,1,3,5,6,1,2]],2051:[[31,31,31,32,31,31,30,29,30,29,30,30],[5,1,4,7,4,7,3,5,6,1,2,4]],2052:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2053:[[31,32,31,32,31,30,30,30,29,29,30,30],[7,3,7,3,7,3,5,7,2,3,4,6]],2054:[[31,32,31,32,31,30,30,30,29,30,29,31],[1,4,1,4,1,4,6,1,3,4,6,7]],2055:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2056:[[31,31,32,31,32,30,30,29,30,29,30,30],[4,7,3,7,3,7,2,4,5,7,1,3]],2057:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2058:[[30,32,31,32,31,30,30,30,29,30,29,31],[7,2,6,2,6,2,4,6,1,2,4,5]],2059:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2060:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2061:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2062:[[30,32,31,32,31,31,29,30,29,30,29,31],[5,7,4,7,4,7,3,4,6,7,2,3]],2063:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2064:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2065:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2066:[[31,31,31,32,31,31,29,30,30,29,29,31],[3,6,2,5,2,5,1,2,4,6,7,1]],2067:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2068:[[31,31,32,32,31,30,30,29,30,29,30,30],[5,1,4,1,5,1,3,5,6,1,2,4]],2069:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2070:[[31,31,31,32,31,31,29,30,30,29,30,30],[1,4,7,3,7,3,6,7,2,4,5,7]],2071:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2072:[[31,32,31,32,31,30,30,29,30,29,30,30],[3,6,3,6,3,6,1,3,4,6,7,2]],2073:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2074:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2075:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2076:[[31,32,31,32,31,30,30,30,29,29,30,30],[1,4,1,4,1,4,6,1,3,4,5,7]],2077:[[31,32,31,32,31,30,30,30,29,30,29,31],[2,5,2,5,2,5,7,2,4,5,7,1]],2078:[[31,31,31,32,31,31,30,29,30,29,30,30],[4,7,3,6,3,6,2,4,5,7,1,3]],2079:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2080:[[31,32,31,32,31,30,30,30,29,29,30,30],[6,2,6,2,6,2,4,6,1,2,3,5]],2081:[[31,31,32,32,31,30,30,30,29,30,30,30],[7,3,6,3,7,3,5,7,2,3,5,7]],2082:[[30,32,31,32,31,30,30,30,29,30,30,30],[2,4,1,4,1,4,6,1,3,4,6,1]],2083:[[31,31,32,31,31,30,30,30,29,30,30,30],[3,6,2,6,2,5,7,2,4,5,7,2]],2084:[[31,31,32,31,31,30,30,30,29,30,30,30],[4,7,3,7,3,6,1,3,5,6,1,3]],2085:[[31,32,31,32,30,31,30,30,29,30,30,30],[5,1,5,1,5,7,3,5,7,1,3,5]],2086:[[30,32,31,32,31,30,30,30,29,30,30,30],[7,2,6,2,6,2,4,6,1,2,4,6]],2087:[[31,31,32,31,31,31,30,30,29,30,30,30],[1,4,7,4,7,3,6,1,3,4,6,1]],2088:[[30,31,32,32,30,31,30,30,29,30,30,30],[3,5,1,5,2,4,7,2,4,5,7,2]],2089:[[30,32,31,32,31,30,30,30,29,30,30,30],[4,6,3,6,3,6,1,3,5,6,1,3]],2090:[[30,32,31,32,31,30,30,30,29,30,30,30],[5,7,4,7,4,7,2,4,6,7,2,4]]}}#w(){return[{day:"Sunday",en:{ddd:"Sunday",dd:"Sun",d:"S"},np:{ddd:"आइतबार",dd:"आइत",d:"आ"}},{day:"Monday",en:{ddd:"Monday",dd:"Mon",d:"M"},np:{ddd:"सोमबार",dd:"सोम",d:"सो"}},{day:"Tuesday",en:{ddd:"Tuesday",dd:"Tue",d:"T"},np:{ddd:"मंगलबार",dd:"मंगल",d:"मं"}},{day:"Wednesday",en:{ddd:"Wednesday",dd:"Wed",d:"W"},np:{ddd:"बुधबार",dd:"बुध",d:"बु"}},{day:"Thursday",en:{ddd:"Thursday",dd:"Thu",d:"T"},np:{ddd:"बिहिबार",dd:"बिहि",d:"बि"}},{day:"Friday",en:{ddd:"Friday",dd:"Fri",d:"F"},np:{ddd:"शुक्रबार",dd:"शुक्र",d:"शु"}},{day:"Saturday",en:{ddd:"Saturday",dd:"Sat",d:"S"},np:{ddd:"शनिबार",dd:"शनि",d:"श"}}]}#k(e,t){return a.#x()[t][0][e]}#L(e){const t={0:"०",1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९"};return e.toString().replace(/[0123456789]/g,(e=>t[e]))}#u(e){const t={"०":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9"};return e.toString().replace(/[०१२३४५६७८९]/g,(e=>t[e]))}#a(){switch(this.#e.position){case"left":default:return"ap-position-left";case"right":return"ap-position-right";case"center":return"ap-position-center"}}static convertToNepaliDate(e,t,n){e=+e,t=+t,n=+n;let a=this.#E(e,t,n),{nepaliYear:r,nepaliMonth:i,nepaliDate:o}=this.#$(a);return{year:r,month:i-1,date:o}}static#E(e,t,n){let a=0;for(let t=0;tthis.#x()[n][0][t-1]&&(a++,r=1,t++),i>7&&(i=1),a>12&&(n++,a=1),t>12&&(t=1),e--;return{nepaliYear:n,nepaliMonth:a,nepaliDate:r}}#h(e,t,n){const a=this.#e.format;switch(t=("0"+t).slice(-2),n=("0"+n).slice(-2),a){case"YYYY/MM/DD":return`${e}/${t}/${n}`;case"YYYY.MM.DD":return`${e}.${t}.${n}`;case"DD-MM-YYYY":return`${n}-${t}-${e}`;case"DD/MM/YYYY":return`${n}/${t}/${e}`;case"DD.MM.YYYY":return`${n}.${t}.${e}`;default:return`${e}-${t}-${n}`}}#A(e,t){const n=e.split(/[./-]/);switch(t){case"DD-MM-YYYY":case"DD/MM/YYYY":case"DD.MM.YYYY":return{year:parseInt(n[2]),month:parseInt(n[1]),day:parseInt(n[0])};default:return{year:parseInt(n[0]),month:parseInt(n[1]),day:parseInt(n[2])}}}#m(){switch(this.#e.theme){case"bordered":return"bordered-theme";case"soft":return"soft-theme";default:return"flat-theme"}}#y(e,t){const n=Object.keys(e.dataset);return t?n.find((e=>e.startsWith("ap-"))).split("-")[1]:n.find((e=>e.startsWith("ap-")))}}const r=a}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nc=void 0;var a={};return(()=>{n.d(a,{default:()=>m});var e=n(62),t=n.n(e),r=n(552),i=n.n(r),o=n(566),s=n.n(o),d=n(107),l=n.n(d),c=n(911),p=n.n(c),u=n(227),h=n.n(u),g=n(0),y={};y.styleTagTransform=h(),y.setAttributes=l(),y.insert=s().bind(null,"head"),y.domAPI=i(),y.insertStyleElement=p(),t()(g.Z,y),g.Z&&g.Z.locals&&g.Z.locals;const m=n(840).default})(),a.default})())); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NepaliDatePicker=t():e.NepaliDatePicker=t()}(this,(()=>(()=>{"use strict";var e={0:(e,t,n)=>{n.d(t,{Z:()=>s});var a=n(650),r=n.n(a),i=n(196),o=n.n(i)()(r());o.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap);"]),o.push([e.id,":root {\n --ap-white: #ffffff;\n --ap-black: #000000;\n --rounded-md: 0.375rem;\n --gray-50: rgb(249 250 251 / 1);\n --gray-100: rgb(243 244 246 / 1);\n --gray-200: rgb(229 231 235 / 1);\n --gray-300: rgb(209 213 219 / 1);\n --gray-400: rgb(156 163 175 / 1);\n --gray-500: rgb(107 114 128 / 1);\n --gray-600: rgb(75 85 99 / 1);\n --gray-700: rgb(55 65 81 / 1);\n --gray-800: rgb(31 41 55 / 1);\n --gray-900: rgb(17 24 39 / 1);\n --gray-950: rgb(3 7 18 / 1);\n --red-400: rgb(248 113 113 / 1);\n --red-500: rgb(239 68 68 / 1);\n}\n\n.theme-dark {\n --ap-white: #1D1D1D;\n --ap-black: #fefefe;\n --gray-50: rgb(3 7 18 / 1);\n --gray-100: rgb(33 34 36 / 1);\n --gray-200: rgb(31 41 55 / 1);\n --gray-300: rgb(55 65 81 / 1);\n --gray-400: rgb(75 85 99 / 1 );\n --gray-500: rgb(210 210 210 / 1);\n --gray-600: rgb(156 163 175 / 1);\n --gray-700: rgb(209 213 219 / 1);\n --gray-800: rgb(229 231 235 / 1);\n --gray-900: rgb(243 244 246 / 1);\n --gray-950: rgb(249 250 251 / 1);\n --red-400: rgb(248 113 113 / 1);\n --red-500: rgb(239 68 68 / 1);\n}\n\n.ap-card {\n font-family: 'Inter', sans-serif;\n z-index: 10;\n position: absolute;\n display: none;\n width: auto;\n max-width: fit-content;\n background: var(--ap-white);\n box-shadow: 0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgb(0 0 0 / 0.05);\n padding: 0.5rem;\n box-sizing: border-box;\n font-size: 0.875rem;\n line-height: 1.25rem;\n border: 1px solid var(--gray-200);\n border-radius: var(--rounded-md);\n margin-top: 0.25rem;\n}\n\n.ap-header-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n}\n\n.ap-header__button {\n padding: 0.25rem;\n border-radius: var(--rounded-md);\n color: var(--ap-black);\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n width: 2.5rem;\n height: 2.5rem;\n display: flex;\n justify-content: center;\n align-items: center;\n border: none;\n background: var(--ap-white);\n}\n\n.ap-header__button:hover {\n color: var(--gray-600);\n background: var(--gray-100);\n}\n\n.ap-header__button:focus {\n color: var(--ap-black);\n background: var(--ap-white);\n outline: none;\n}\n\n.ap-header__button > svg {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.ap-header__selects {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n}\n\n.ap-header__select {\n appearance: none;\n line-height: 1.8;\n text-align: center;\n height: 2.5rem;\n padding: 0.25rem 1rem;\n border-radius: var(--rounded-md);\n border: none;\n background: var(--ap-white);\n color: var(--ap-black);\n}\n\n.ap-header__select:focus {\n outline: none;\n}\n\n.ap-header__select:hover {\n background: var(--gray-100);\n}\n\n.ap-table {\n margin-top: 0.5rem;\n text-align: center;\n width: 100%;\n}\n\n.ap-table__thead__tr {\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: flex-start;\n color: var(--gray-500);\n padding-top: 0.5rem;\n padding-bottom: 0.75rem;\n gap: 0.25rem;\n}\n\n.ap-table__tbody__tr {\n display: flex;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: flex-start;\n color: var(--gray-500);\n gap: 0.25rem;\n}\n\n.ap-table__thead__tr_th {\n width: 2.5rem;\n font-weight: 500;\n padding: 0;\n}\n\n.holiday-marker-color {\n color: var(--red-400) !important;\n}\n\n.holiday-marker-color:hover > button {\n color: var(--red-500) !important;\n}\n\n.ap-table__tbody {\n display: flex;\n flex-direction: column;\n row-gap: 0.25rem;\n}\n\n.ap-table__thead__tr_td {\n height: 2.5rem;\n width: 2.5rem;\n text-align: center;\n padding: 0;\n position: relative;\n color: var(--gray-500);\n}\n\n.ap-table__thead__tr_td > button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--rounded-md);\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n width: 2.5rem;\n height: 2.5rem;\n padding: 0;\n font-weight: 400;\n border: none;\n background: var(--ap-white);\n color: inherit;\n}\n\n.ap-table__thead__tr_td > button:focus {\n outline: none;\n}\n\n.ap-table__thead__tr_td > button:disabled {\n color: var(--gray-400);\n background: var(--gray-100);\n cursor: not-allowed;\n}\n\n.ap-table__thead__tr_td > button:hover {\n color: var(--gray-500);\n background: var(--gray-100);\n}\n\n.no-hover:hover {\n color: transparent !important;\n background: transparent !important;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.bordered {\n border: 1px solid var(--gray-200);\n}\n\n.ap-width-tr-td {\n width: 2.5rem;\n}\n\n.ap-width-ddd {\n width: 4rem;\n}\n\n.ap-width-np-ddd {\n width: 5rem;\n}\n\n.ap-gap {\n gap: 0.25rem;\n}\n\n.ap-table__thead__tr_td > button.selected {\n background: var(--ap-black) !important;\n color: var(--ap-white) !important;\n border: none !important;\n}\n\n.ap-cell-button.selected:hover {\n background: var(--gray-800);\n color: var(--ap-white);\n}\n\n\n.bordered-theme {\n border: 1px solid var(--gray-200) !important;\n}\n\n.soft-theme {\n background: var(--gray-50) !important;\n transition: all ease;\n}\n\n.soft-theme:hover {\n background: var(--gray-100) !important;\n}\n\n.bordered-dashed {\n border-style: dashed !important;\n}\n\n.ap-table__thead__tr_td.active > button {\n background: var(--gray-100);\n border: 1px dashed var(--gray-400) !important;\n}\n\n.ap-position-left {\n left: 0;\n}\n\n.ap-position-right {\n right: 0 !important;\n}\n\n.ap-position-center {\n left: 0 !important;\n right: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}",""]);const s=o},196:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",a=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),a&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),a&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,a,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(a)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),t.push(c))}},t}},650:e=>{e.exports=function(e){return e[1]}},62:e=>{var t=[];function n(e){for(var n=-1,a=0;a{var t={};e.exports=function(e,n){var a=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(n)}},911:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},107:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},552:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var a="";n.supports&&(a+="@supports (".concat(n.supports,") {")),n.media&&(a+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(a+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),a+=n.css,r&&(a+="}"),n.media&&(a+="}"),n.supports&&(a+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(a+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(a,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},227:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},840:(e,t,n)=>{n.d(t,{default:()=>r});class a{#e={format:"YYYY-MM-DD",closeOnDateSelect:!0,disableAfterToday:!1,disableBeforeToday:!1,disableToday:!1,markHolidays:!0,holidays:["Saturday"],indicateCurrentDate:!0,setCurrentDate:!1,position:"left",daysFormat:"dd",locale:"np",theme:"flat",darkMode:!1,inline:!1};#t=null;#n="data-ap-";constructor(e,t){this.today=new Date,this.currentYear=this.today.getFullYear(),this.currentMonth=this.today.getMonth(),this.currentDay=this.today.getDate(),"object"==typeof t&&(this.#e={...this.#e,...t}),this.#t={trGap:"ap-gap",trAndTdWidth:"ddd"===this.#e.daysFormat?"np"===this.#e.locale?"ap-width-np-ddd":"ap-width-ddd":"ap-width-tr-td",position:this.#a()},this.#r(e)}#r(e){this.#i(),this.#e.inline?this.#o(e):(this.#s(e),this.#d(),this.#l())}#i(){let{year:e,month:t,date:n}=a.convertToNepaliDate(this.currentYear,this.currentMonth+1,this.currentDay);this.currentYear=+e,this.currentMonth=+t,this.currentDay=+n}#s(e){this.#c(e),this.#p()}#p(){document.addEventListener("click",(e=>{if(e.target.classList.contains("ap-cell-button")){let t="selected";e.target.closest("table").querySelectorAll(".ap-cell-button").forEach((function(e){e&&t.split(" ").forEach((t=>e.classList.remove(t)))})),t.split(" ").forEach((t=>e.target.classList.add(t)));let n=parseInt(e.target.closest(".ap-card").querySelector(".ap-calendar-year").value),a=parseInt(e.target.closest(".ap-card").querySelector(".ap-calendar-month").value)+1,r=this.#u(e.target.textContent),i=("0"+a).slice(-2),o=("0"+r).slice(-2),s=this.#h(n,i,o),d=e.target.closest(".ap-card").previousElementSibling;d&&(d.value=s),this.#e.closeOnDateSelect&&document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")}))}}))}#c(e){const t=document.querySelectorAll(e);t.length>0&&t.forEach((e=>{this.#e.setCurrentDate&&!this.#e.disableToday&&(e.value=this.#h(this.currentYear,this.currentMonth+1,this.currentDay)),e.hasAttribute("placeholder")||e.setAttribute("placeholder",this.#e.format),e.addEventListener("click",(t=>{t.preventDefault();const n=t.target.nextElementSibling;if(n&&n.classList.contains("ap-card"))return;const a=Math.floor(1e5+9e5*Math.random()).toString();e.setAttribute(`${this.#n+a}`,""),this.#g({selector:e,selectorUniqueId:a})}))}))}#d(){document.addEventListener("click",(e=>{if(e.target.classList.contains("ap-calendar")){const t=e.target.nextElementSibling,n=t.classList;e.target.parentElement.style.position="relative";const a=this.#y(e.target,!0);document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")})),t&&n.contains(`ap-calendar-${a}`)&&(t.style.display="block")}}))}#l(){document.addEventListener("click",(function(e){e.target.matches(".ap-calendar, .ap-card, .ap-card *")||document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")}))}))}#g({selector:e,selectorUniqueId:t}){const n=this.#e.inline,a=e;a.classList.add("ap-calendar"),n&&a.classList.add("ap-inline");const r=this.#m(),i=this.#e.darkMode?"theme-dark":"theme-light",o=`\n \n `,s=`\n \n `,d=this.#b(),l=this.#f(),c=this.#v(),p=`\n
\n
\n
\n ${o}\n
\n \n \n
\n ${s}\n
\n
\n \n \n \n ${d}\n \n \n \n \n
\n
\n `;n?a.innerHTML=p:a.insertAdjacentHTML("afterend",p),this.#_(a,this.currentMonth,this.currentYear),this.#D(a)}#o(e){const t=document.querySelectorAll(e);t.length>0&&t.forEach((e=>{const t=Math.floor(1e5+9e5*Math.random()).toString();e.setAttribute(`${this.#n+t}`,""),this.#g({selector:e,selectorUniqueId:t})}))}#D(e){const t=this.#e.inline?e.querySelector(".btn-next"):e.nextElementSibling.querySelector(".btn-next"),n=this.#e.inline?e.querySelector(".btn-previous"):e.nextElementSibling.querySelector(".btn-previous"),a=this.#e.inline?e.querySelector(".ap-calendar-year"):e.nextElementSibling.querySelector(".ap-calendar-year"),r=this.#e.inline?e.querySelector(".ap-calendar-month"):e.nextElementSibling.querySelector(".ap-calendar-month");let i=parseInt(a.value),o=parseInt(r.value);t.removeEventListener("click",(()=>{})),n.removeEventListener("click",(()=>{})),t.addEventListener("click",(t=>{t.preventDefault(),i=11===o?i+1:i,o=(o+1)%12,this.#_(e,o,i)})),n.addEventListener("click",(t=>{t.preventDefault(),i=0===o?i-1:i,o=0===o?11:o-1,this.#_(e,o,i)}))}#_(e,t,n){const r=this.#e.inline?e.children[0]:e.nextElementSibling;let i;if(r&&r.classList.contains("ap-card")&&(i=r),!i)return;if(void 0===a.#x()[n])return;const o=a.#x()[n][1][t]-1,s=Object.keys(e.dataset).find((e=>e.includes("ap-"))).split("-")[1];i=document.querySelector(`.ap-calendar-${s}`);const d=i.querySelector(".calendar-body"),l=i.querySelector(".ap-calendar-year"),c=i.querySelector(".ap-calendar-month");l.removeEventListener("change",(()=>{})),c.removeEventListener("change",(()=>{})),l.addEventListener("change",(n=>{this.#_(e,t,n.target.value),this.#D(e)})),c.addEventListener("change",(t=>{this.#_(e,t.target.value,n),this.#D(e)})),l.value=n,c.value=t;const p=this.#m();if(d)for(;d.firstChild;)d.removeChild(d.firstChild);let u=1;for(let e=0;e<6;e++){const a=document.createElement("tr");a.classList.add("ap-table__tbody__tr");const r=this.#e.markHolidays&&this.#e.holidays.map((e=>this.#w().findIndex((t=>t.day.toLowerCase()===e.toLowerCase()))));for(let i=0;i<7;i++){let s=r&&r.includes(i)?"holiday-marker-color":null;if(0===e&&ithis.#k(t,n))break;const e=document.createElement("td");e.classList.add("ap-table__thead__tr_td",this.#t.trAndTdWidth,"ap-cell",s);const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add("ap-cell-button",p),this.#M(r,n,t,u);const i="np"===this.#e.locale?this.#L(u):u;this.#e.indicateCurrentDate&&+u==+this.currentDay&&+n==+this.currentYear&&+t==+this.currentMonth&&(e.classList.add("active"),r.classList.add("bordered-dashed")),r.appendChild(document.createTextNode(i)),e.appendChild(r),a.append(e),u++}}d.append(a)}}#M(e,t,n,a){const r=this.currentYear,i=this.currentMonth+1,o=this.currentDay;t=+t,n=+n,a=+a,this.#e.disableBeforeToday&&(tr||t===r&&n+1>i||t===r&&n+1===i&&a>o)&&e.setAttribute("disabled","disabled")}#v(){return Array.from({length:91},((e,t)=>``)).join("")}#b(){return this.#w().map((e=>`${e[this.#e.locale][this.#e.daysFormat]}`)).join("")}#f(){return this.#C().map(((e,t)=>``)).join("")}#T(){console.log("close date picker")}#C(){return[{en:"Baishak",np:"बैशाख"},{en:"Jestha",np:"जेठ"},{en:"Ashad",np:"असार"},{en:"Shrawn",np:"साउन"},{en:"Bhadra",np:"भदौ"},{en:"Ashwin",np:"असोज"},{en:"Kartik",np:"कार्तिक"},{en:"Mangshir",np:"मंसिर"},{en:"Poush",np:"पुष"},{en:"Magh",np:"माघ"},{en:"Falgun",np:"फाल्गुन"},{en:"Chaitra",np:"चैत्र"}]}static#S(){return[31,29,31,30,31,30,31,31,30,31,30,31]}static#Y(){return[31,28,31,30,31,30,31,31,30,31,30,31]}static#x(){return{2e3:[[30,32,31,32,31,30,30,30,29,30,29,31],[4,6,3,6,3,6,1,3,5,6,1,2]],2001:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2002:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2003:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2004:[[30,32,31,32,31,30,30,30,29,30,29,31],[2,4,1,4,1,4,6,1,3,4,6,7]],2005:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2006:[[31,31,32,32,31,30,30,29,30,29,30,30],[4,7,3,7,4,7,2,4,5,7,1,3]],2007:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2008:[[31,31,31,32,31,31,29,30,30,29,29,31],[7,3,6,2,6,2,5,6,1,3,4,5]],2009:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2010:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2011:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2012:[[31,31,31,32,31,31,29,30,30,29,30,30],[5,1,4,7,4,7,3,4,6,1,2,4]],2013:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2014:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2015:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2016:[[31,31,31,32,31,31,29,30,30,29,30,30],[3,6,2,5,2,5,1,2,4,6,7,2]],2017:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2018:[[31,32,31,32,31,30,30,29,30,29,30,30],[5,1,5,1,5,1,3,5,6,1,2,4]],2019:[[31,32,31,32,31,30,30,30,29,30,29,31],[6,2,6,2,6,2,4,6,1,2,4,5]],2020:[[31,31,31,32,31,31,30,29,30,29,30,30],[1,4,7,3,7,3,6,1,2,4,5,7]],2021:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2022:[[31,32,31,32,31,30,30,30,29,29,30,30],[3,6,3,6,3,6,1,3,5,6,7,2]],2023:[[31,32,31,32,31,30,30,30,29,30,29,31],[4,7,4,7,4,7,2,4,6,7,2,3]],2024:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2025:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2026:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2027:[[30,32,31,32,31,30,30,30,29,30,29,31],[3,5,2,5,2,5,7,2,4,5,7,1]],2028:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2029:[[31,31,32,31,32,30,30,29,30,29,30,30],[5,1,4,1,4,1,3,5,6,1,2,4]],2030:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2031:[[30,32,31,32,31,30,30,30,29,30,29,31],[1,3,7,3,7,3,5,7,2,3,5,6]],2032:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2033:[[31,31,32,32,31,30,30,29,30,29,30,30],[3,6,2,6,3,6,1,3,4,6,7,2]],2034:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2035:[[30,32,31,32,31,31,29,30,30,29,29,31],[6,1,5,1,5,1,4,5,7,2,3,4]],2036:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2037:[[31,31,32,32,31,30,30,29,30,29,30,30],[1,4,7,4,1,4,6,1,2,4,5,7]],2038:[[31,32,31,32,31,30,30,30,29,29,30,31],[2,5,2,5,2,5,7,2,4,5,6,1]],2039:[[31,31,31,32,31,31,29,30,30,29,30,30],[4,7,3,6,3,6,2,3,5,7,1,3]],2040:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2041:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2042:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2043:[[31,31,31,32,31,31,29,30,30,29,30,30],[2,5,1,4,1,4,7,1,3,5,6,1]],2044:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2045:[[31,32,31,32,31,30,30,29,30,29,30,30],[4,7,4,7,4,7,2,4,5,7,1,3]],2046:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2047:[[31,31,31,32,31,31,30,29,30,29,30,30],[7,3,6,2,6,2,5,7,1,3,4,6]],2048:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2049:[[31,32,31,32,31,30,30,30,29,29,30,30],[2,5,2,5,2,5,7,2,4,5,6,1]],2050:[[31,32,31,32,31,30,30,30,29,30,29,31],[3,6,3,6,3,6,1,3,5,6,1,2]],2051:[[31,31,31,32,31,31,30,29,30,29,30,30],[5,1,4,7,4,7,3,5,6,1,2,4]],2052:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2053:[[31,32,31,32,31,30,30,30,29,29,30,30],[7,3,7,3,7,3,5,7,2,3,4,6]],2054:[[31,32,31,32,31,30,30,30,29,30,29,31],[1,4,1,4,1,4,6,1,3,4,6,7]],2055:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2056:[[31,31,32,31,32,30,30,29,30,29,30,30],[4,7,3,7,3,7,2,4,5,7,1,3]],2057:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2058:[[30,32,31,32,31,30,30,30,29,30,29,31],[7,2,6,2,6,2,4,6,1,2,4,5]],2059:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2060:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2061:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2062:[[30,32,31,32,31,31,29,30,29,30,29,31],[5,7,4,7,4,7,3,4,6,7,2,3]],2063:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2064:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2065:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2066:[[31,31,31,32,31,31,29,30,30,29,29,31],[3,6,2,5,2,5,1,2,4,6,7,1]],2067:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2068:[[31,31,32,32,31,30,30,29,30,29,30,30],[5,1,4,1,5,1,3,5,6,1,2,4]],2069:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2070:[[31,31,31,32,31,31,29,30,30,29,30,30],[1,4,7,3,7,3,6,7,2,4,5,7]],2071:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2072:[[31,32,31,32,31,30,30,29,30,29,30,30],[3,6,3,6,3,6,1,3,4,6,7,2]],2073:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2074:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2075:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2076:[[31,32,31,32,31,30,30,30,29,29,30,30],[1,4,1,4,1,4,6,1,3,4,5,7]],2077:[[31,32,31,32,31,30,30,30,29,30,29,31],[2,5,2,5,2,5,7,2,4,5,7,1]],2078:[[31,31,31,32,31,31,30,29,30,29,30,30],[4,7,3,6,3,6,2,4,5,7,1,3]],2079:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2080:[[31,32,31,32,31,30,30,30,29,29,30,30],[6,2,6,2,6,2,4,6,1,2,3,5]],2081:[[31,32,31,32,31,30,30,30,29,30,29,31],[7,3,7,3,7,3,5,7,2,3,5,6]],2082:[[30,32,31,32,31,30,30,30,29,30,30,30],[2,4,1,4,1,4,6,1,3,4,6,1]],2083:[[31,31,32,31,31,30,30,30,29,30,30,30],[3,6,2,6,2,5,7,2,4,5,7,2]],2084:[[31,31,32,31,31,30,30,30,29,30,30,30],[4,7,3,7,3,6,1,3,5,6,1,3]],2085:[[31,32,31,32,30,31,30,30,29,30,30,30],[5,1,5,1,5,7,3,5,7,1,3,5]],2086:[[30,32,31,32,31,30,30,30,29,30,30,30],[7,2,6,2,6,2,4,6,1,2,4,6]],2087:[[31,31,32,31,31,31,30,30,29,30,30,30],[1,4,7,4,7,3,6,1,3,4,6,1]],2088:[[30,31,32,32,30,31,30,30,29,30,30,30],[3,5,1,5,2,4,7,2,4,5,7,2]],2089:[[30,32,31,32,31,30,30,30,29,30,30,30],[4,6,3,6,3,6,1,3,5,6,1,3]],2090:[[30,32,31,32,31,30,30,30,29,30,30,30],[5,7,4,7,4,7,2,4,6,7,2,4]]}}#w(){return[{day:"Sunday",en:{ddd:"Sunday",dd:"Sun",d:"S"},np:{ddd:"आइतबार",dd:"आइत",d:"आ"}},{day:"Monday",en:{ddd:"Monday",dd:"Mon",d:"M"},np:{ddd:"सोमबार",dd:"सोम",d:"सो"}},{day:"Tuesday",en:{ddd:"Tuesday",dd:"Tue",d:"T"},np:{ddd:"मंगलबार",dd:"मंगल",d:"मं"}},{day:"Wednesday",en:{ddd:"Wednesday",dd:"Wed",d:"W"},np:{ddd:"बुधबार",dd:"बुध",d:"बु"}},{day:"Thursday",en:{ddd:"Thursday",dd:"Thu",d:"T"},np:{ddd:"बिहिबार",dd:"बिहि",d:"बि"}},{day:"Friday",en:{ddd:"Friday",dd:"Fri",d:"F"},np:{ddd:"शुक्रबार",dd:"शुक्र",d:"शु"}},{day:"Saturday",en:{ddd:"Saturday",dd:"Sat",d:"S"},np:{ddd:"शनिबार",dd:"शनि",d:"श"}}]}#k(e,t){return a.#x()[t][0][e]}#L(e){const t={0:"०",1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९"};return e.toString().replace(/[0123456789]/g,(e=>t[e]))}#u(e){const t={"०":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9"};return e.toString().replace(/[०१२३४५६७८९]/g,(e=>t[e]))}#a(){switch(this.#e.position){case"left":default:return"ap-position-left";case"right":return"ap-position-right";case"center":return"ap-position-center"}}static convertToNepaliDate(e,t,n){e=+e,t=+t,n=+n;let a=this.#E(e,t,n),{nepaliYear:r,nepaliMonth:i,nepaliDate:o}=this.#$(a);return{year:r,month:i-1,date:o}}static#E(e,t,n){let a=0;for(let t=0;tthis.#x()[n][0][t-1]&&(a++,r=1,t++),i>7&&(i=1),a>12&&(n++,a=1),t>12&&(t=1),e--;return{nepaliYear:n,nepaliMonth:a,nepaliDate:r}}#h(e,t,n){const a=this.#e.format;switch(t=("0"+t).slice(-2),n=("0"+n).slice(-2),a){case"YYYY/MM/DD":return`${e}/${t}/${n}`;case"YYYY.MM.DD":return`${e}.${t}.${n}`;case"DD-MM-YYYY":return`${n}-${t}-${e}`;case"DD/MM/YYYY":return`${n}/${t}/${e}`;case"DD.MM.YYYY":return`${n}.${t}.${e}`;default:return`${e}-${t}-${n}`}}#A(e,t){const n=e.split(/[./-]/);switch(t){case"DD-MM-YYYY":case"DD/MM/YYYY":case"DD.MM.YYYY":return{year:parseInt(n[2]),month:parseInt(n[1]),day:parseInt(n[0])};default:return{year:parseInt(n[0]),month:parseInt(n[1]),day:parseInt(n[2])}}}#m(){switch(this.#e.theme){case"bordered":return"bordered-theme";case"soft":return"soft-theme";default:return"flat-theme"}}#y(e,t){const n=Object.keys(e.dataset);return t?n.find((e=>e.startsWith("ap-"))).split("-")[1]:n.find((e=>e.startsWith("ap-")))}}const r=a}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var i=t[a]={id:a,exports:{}};return e[a](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nc=void 0;var a={};return(()=>{n.d(a,{default:()=>m});var e=n(62),t=n.n(e),r=n(552),i=n.n(r),o=n(566),s=n.n(o),d=n(107),l=n.n(d),c=n(911),p=n.n(c),u=n(227),h=n.n(u),g=n(0),y={};y.styleTagTransform=h(),y.setAttributes=l(),y.insert=s().bind(null,"head"),y.domAPI=i(),y.insertStyleElement=p(),t()(g.Z,y),g.Z&&g.Z.locals&&g.Z.locals;const m=n(840).default})(),a.default})())); \ No newline at end of file diff --git a/dist/nepali-date-picker.min.js b/dist/nepali-date-picker.min.js index c509cf9..2a631e0 100644 --- a/dist/nepali-date-picker.min.js +++ b/dist/nepali-date-picker.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NepaliDatePicker=t():e.NepaliDatePicker=t()}(this,(()=>(()=>{"use strict";var e={d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{default:()=>n});class a{#e={format:"YYYY-MM-DD",closeOnDateSelect:!0,disableAfterToday:!1,disableBeforeToday:!1,disableToday:!1,markHolidays:!0,holidays:["Saturday"],indicateCurrentDate:!0,setCurrentDate:!1,position:"left",daysFormat:"dd",locale:"np",theme:"flat",darkMode:!1,inline:!1};#t=null;#a="data-ap-";constructor(e,t){this.today=new Date,this.currentYear=this.today.getFullYear(),this.currentMonth=this.today.getMonth(),this.currentDay=this.today.getDate(),"object"==typeof t&&(this.#e={...this.#e,...t}),this.#t={trGap:"ap-gap",trAndTdWidth:"ddd"===this.#e.daysFormat?"np"===this.#e.locale?"ap-width-np-ddd":"ap-width-ddd":"ap-width-tr-td",position:this.#n()},this.#s(e)}#s(e){this.#i(),this.#e.inline?this.#r(e):(this.#d(e),this.#o(),this.#l())}#i(){let{year:e,month:t,date:n}=a.convertToNepaliDate(this.currentYear,this.currentMonth+1,this.currentDay);this.currentYear=+e,this.currentMonth=+t,this.currentDay=+n}#d(e){this.#c(e),this.#p()}#p(){document.addEventListener("click",(e=>{if(e.target.classList.contains("ap-cell-button")){let t="selected";e.target.closest("table").querySelectorAll(".ap-cell-button").forEach((function(e){e&&t.split(" ").forEach((t=>e.classList.remove(t)))})),t.split(" ").forEach((t=>e.target.classList.add(t)));let a=parseInt(e.target.closest(".ap-card").querySelector(".ap-calendar-year").value),n=parseInt(e.target.closest(".ap-card").querySelector(".ap-calendar-month").value)+1,s=this.#h(e.target.textContent),i=("0"+n).slice(-2),r=("0"+s).slice(-2),d=this.#u(a,i,r),o=e.target.closest(".ap-card").previousElementSibling;o&&(o.value=d),this.#e.closeOnDateSelect&&document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")}))}}))}#c(e){const t=document.querySelectorAll(e);t.length>0&&t.forEach((e=>{this.#e.setCurrentDate&&!this.#e.disableToday&&(e.value=this.#u(this.currentYear,this.currentMonth+1,this.currentDay)),e.hasAttribute("placeholder")||e.setAttribute("placeholder",this.#e.format),e.addEventListener("click",(t=>{t.preventDefault();const a=t.target.nextElementSibling;if(a&&a.classList.contains("ap-card"))return;const n=Math.floor(1e5+9e5*Math.random()).toString();e.setAttribute(`${this.#a+n}`,""),this.#y({selector:e,selectorUniqueId:n})}))}))}#o(){document.addEventListener("click",(e=>{if(e.target.classList.contains("ap-calendar")){const t=e.target.nextElementSibling,a=t.classList;e.target.parentElement.style.position="relative";const n=this.#g(e.target,!0);document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")})),t&&a.contains(`ap-calendar-${n}`)&&(t.style.display="block")}}))}#l(){document.addEventListener("click",(function(e){e.target.matches(".ap-calendar, .ap-card, .ap-card *")||document.querySelectorAll(".ap-card").forEach((function(e){e.classList.contains("ap-card-inline")||(e.style.display="none")}))}))}#y({selector:e,selectorUniqueId:t}){const a=this.#e.inline,n=e;n.classList.add("ap-calendar"),a&&n.classList.add("ap-inline");const s=this.#m(),i=this.#e.darkMode?"theme-dark":"theme-light",r=`\n \n `,d=`\n \n `,o=this.#b(),l=this.#f(),c=this.#D(),p=`\n
\n
\n
\n ${r}\n
\n \n \n
\n ${d}\n
\n
\n \n \n \n ${o}\n \n \n \n \n
\n
\n `;a?n.innerHTML=p:n.insertAdjacentHTML("afterend",p),this.#v(n,this.currentMonth,this.currentYear),this.#M(n)}#r(e){const t=document.querySelectorAll(e);t.length>0&&t.forEach((e=>{const t=Math.floor(1e5+9e5*Math.random()).toString();e.setAttribute(`${this.#a+t}`,""),this.#y({selector:e,selectorUniqueId:t})}))}#M(e){const t=this.#e.inline?e.querySelector(".btn-next"):e.nextElementSibling.querySelector(".btn-next"),a=this.#e.inline?e.querySelector(".btn-previous"):e.nextElementSibling.querySelector(".btn-previous"),n=this.#e.inline?e.querySelector(".ap-calendar-year"):e.nextElementSibling.querySelector(".ap-calendar-year"),s=this.#e.inline?e.querySelector(".ap-calendar-month"):e.nextElementSibling.querySelector(".ap-calendar-month");let i=parseInt(n.value),r=parseInt(s.value);t.removeEventListener("click",(()=>{})),a.removeEventListener("click",(()=>{})),t.addEventListener("click",(t=>{t.preventDefault(),i=11===r?i+1:i,r=(r+1)%12,this.#v(e,r,i)})),a.addEventListener("click",(t=>{t.preventDefault(),i=0===r?i-1:i,r=0===r?11:r-1,this.#v(e,r,i)}))}#v(e,t,n){const s=this.#e.inline?e.children[0]:e.nextElementSibling;let i;if(s&&s.classList.contains("ap-card")&&(i=s),!i)return;if(void 0===a.#L()[n])return;const r=a.#L()[n][1][t]-1,d=Object.keys(e.dataset).find((e=>e.includes("ap-"))).split("-")[1];i=document.querySelector(`.ap-calendar-${d}`);const o=i.querySelector(".calendar-body"),l=i.querySelector(".ap-calendar-year"),c=i.querySelector(".ap-calendar-month");l.removeEventListener("change",(()=>{})),c.removeEventListener("change",(()=>{})),l.addEventListener("change",(a=>{this.#v(e,t,a.target.value),this.#M(e)})),c.addEventListener("change",(t=>{this.#v(e,t.target.value,n),this.#M(e)})),l.value=n,c.value=t;const p=this.#m();if(o)for(;o.firstChild;)o.removeChild(o.firstChild);let h=1;for(let e=0;e<6;e++){const a=document.createElement("tr");a.classList.add("ap-table__tbody__tr");const s=this.#e.markHolidays&&this.#e.holidays.map((e=>this.#Y().findIndex((t=>t.day.toLowerCase()===e.toLowerCase()))));for(let i=0;i<7;i++){let d=s&&s.includes(i)?"holiday-marker-color":null;if(0===e&&ithis.#C(t,n))break;const e=document.createElement("td");e.classList.add("ap-table__thead__tr_td",this.#t.trAndTdWidth,"ap-cell",d);const s=document.createElement("button");s.classList.add("ap-cell-button",p),this.#$(s,n,t,h);const i="np"===this.#e.locale?this.#E(h):h;this.#e.indicateCurrentDate&&+h==+this.currentDay&&+n==+this.currentYear&&+t==+this.currentMonth&&(e.classList.add("active"),s.classList.add("bordered-dashed")),s.appendChild(document.createTextNode(i)),e.appendChild(s),a.append(e),h++}}o.append(a)}}#$(e,t,a,n){const s=this.currentYear,i=this.currentMonth+1,r=this.currentDay;t=+t,a=+a,n=+n,this.#e.disableBeforeToday&&(ts||t===s&&a+1>i||t===s&&a+1===i&&n>r)&&e.setAttribute("disabled","disabled")}#D(){return Array.from({length:91},((e,t)=>``)).join("")}#b(){return this.#Y().map((e=>`${e[this.#e.locale][this.#e.daysFormat]}`)).join("")}#f(){return this.#S().map(((e,t)=>``)).join("")}#T(){console.log("close date picker")}#S(){return[{en:"Baishak",np:"बैशाख"},{en:"Jestha",np:"जेठ"},{en:"Ashad",np:"असार"},{en:"Shrawn",np:"साउन"},{en:"Bhadra",np:"भदौ"},{en:"Ashwin",np:"असोज"},{en:"Kartik",np:"कार्तिक"},{en:"Mangshir",np:"मंसिर"},{en:"Poush",np:"पुष"},{en:"Magh",np:"माघ"},{en:"Falgun",np:"फाल्गुन"},{en:"Chaitra",np:"चैत्र"}]}static#k(){return[31,29,31,30,31,30,31,31,30,31,30,31]}static#_(){return[31,28,31,30,31,30,31,31,30,31,30,31]}static#L(){return{2e3:[[30,32,31,32,31,30,30,30,29,30,29,31],[4,6,3,6,3,6,1,3,5,6,1,2]],2001:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2002:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2003:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2004:[[30,32,31,32,31,30,30,30,29,30,29,31],[2,4,1,4,1,4,6,1,3,4,6,7]],2005:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2006:[[31,31,32,32,31,30,30,29,30,29,30,30],[4,7,3,7,4,7,2,4,5,7,1,3]],2007:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2008:[[31,31,31,32,31,31,29,30,30,29,29,31],[7,3,6,2,6,2,5,6,1,3,4,5]],2009:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2010:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2011:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2012:[[31,31,31,32,31,31,29,30,30,29,30,30],[5,1,4,7,4,7,3,4,6,1,2,4]],2013:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2014:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2015:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2016:[[31,31,31,32,31,31,29,30,30,29,30,30],[3,6,2,5,2,5,1,2,4,6,7,2]],2017:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2018:[[31,32,31,32,31,30,30,29,30,29,30,30],[5,1,5,1,5,1,3,5,6,1,2,4]],2019:[[31,32,31,32,31,30,30,30,29,30,29,31],[6,2,6,2,6,2,4,6,1,2,4,5]],2020:[[31,31,31,32,31,31,30,29,30,29,30,30],[1,4,7,3,7,3,6,1,2,4,5,7]],2021:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2022:[[31,32,31,32,31,30,30,30,29,29,30,30],[3,6,3,6,3,6,1,3,5,6,7,2]],2023:[[31,32,31,32,31,30,30,30,29,30,29,31],[4,7,4,7,4,7,2,4,6,7,2,3]],2024:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2025:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2026:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2027:[[30,32,31,32,31,30,30,30,29,30,29,31],[3,5,2,5,2,5,7,2,4,5,7,1]],2028:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2029:[[31,31,32,31,32,30,30,29,30,29,30,30],[5,1,4,1,4,1,3,5,6,1,2,4]],2030:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2031:[[30,32,31,32,31,30,30,30,29,30,29,31],[1,3,7,3,7,3,5,7,2,3,5,6]],2032:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2033:[[31,31,32,32,31,30,30,29,30,29,30,30],[3,6,2,6,3,6,1,3,4,6,7,2]],2034:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2035:[[30,32,31,32,31,31,29,30,30,29,29,31],[6,1,5,1,5,1,4,5,7,2,3,4]],2036:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2037:[[31,31,32,32,31,30,30,29,30,29,30,30],[1,4,7,4,1,4,6,1,2,4,5,7]],2038:[[31,32,31,32,31,30,30,30,29,29,30,31],[2,5,2,5,2,5,7,2,4,5,6,1]],2039:[[31,31,31,32,31,31,29,30,30,29,30,30],[4,7,3,6,3,6,2,3,5,7,1,3]],2040:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2041:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2042:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2043:[[31,31,31,32,31,31,29,30,30,29,30,30],[2,5,1,4,1,4,7,1,3,5,6,1]],2044:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2045:[[31,32,31,32,31,30,30,29,30,29,30,30],[4,7,4,7,4,7,2,4,5,7,1,3]],2046:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2047:[[31,31,31,32,31,31,30,29,30,29,30,30],[7,3,6,2,6,2,5,7,1,3,4,6]],2048:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2049:[[31,32,31,32,31,30,30,30,29,29,30,30],[2,5,2,5,2,5,7,2,4,5,6,1]],2050:[[31,32,31,32,31,30,30,30,29,30,29,31],[3,6,3,6,3,6,1,3,5,6,1,2]],2051:[[31,31,31,32,31,31,30,29,30,29,30,30],[5,1,4,7,4,7,3,5,6,1,2,4]],2052:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2053:[[31,32,31,32,31,30,30,30,29,29,30,30],[7,3,7,3,7,3,5,7,2,3,4,6]],2054:[[31,32,31,32,31,30,30,30,29,30,29,31],[1,4,1,4,1,4,6,1,3,4,6,7]],2055:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2056:[[31,31,32,31,32,30,30,29,30,29,30,30],[4,7,3,7,3,7,2,4,5,7,1,3]],2057:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2058:[[30,32,31,32,31,30,30,30,29,30,29,31],[7,2,6,2,6,2,4,6,1,2,4,5]],2059:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2060:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2061:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2062:[[30,32,31,32,31,31,29,30,29,30,29,31],[5,7,4,7,4,7,3,4,6,7,2,3]],2063:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2064:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2065:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2066:[[31,31,31,32,31,31,29,30,30,29,29,31],[3,6,2,5,2,5,1,2,4,6,7,1]],2067:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2068:[[31,31,32,32,31,30,30,29,30,29,30,30],[5,1,4,1,5,1,3,5,6,1,2,4]],2069:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2070:[[31,31,31,32,31,31,29,30,30,29,30,30],[1,4,7,3,7,3,6,7,2,4,5,7]],2071:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2072:[[31,32,31,32,31,30,30,29,30,29,30,30],[3,6,3,6,3,6,1,3,4,6,7,2]],2073:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2074:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2075:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2076:[[31,32,31,32,31,30,30,30,29,29,30,30],[1,4,1,4,1,4,6,1,3,4,5,7]],2077:[[31,32,31,32,31,30,30,30,29,30,29,31],[2,5,2,5,2,5,7,2,4,5,7,1]],2078:[[31,31,31,32,31,31,30,29,30,29,30,30],[4,7,3,6,3,6,2,4,5,7,1,3]],2079:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2080:[[31,32,31,32,31,30,30,30,29,29,30,30],[6,2,6,2,6,2,4,6,1,2,3,5]],2081:[[31,31,32,32,31,30,30,30,29,30,30,30],[7,3,6,3,7,3,5,7,2,3,5,7]],2082:[[30,32,31,32,31,30,30,30,29,30,30,30],[2,4,1,4,1,4,6,1,3,4,6,1]],2083:[[31,31,32,31,31,30,30,30,29,30,30,30],[3,6,2,6,2,5,7,2,4,5,7,2]],2084:[[31,31,32,31,31,30,30,30,29,30,30,30],[4,7,3,7,3,6,1,3,5,6,1,3]],2085:[[31,32,31,32,30,31,30,30,29,30,30,30],[5,1,5,1,5,7,3,5,7,1,3,5]],2086:[[30,32,31,32,31,30,30,30,29,30,30,30],[7,2,6,2,6,2,4,6,1,2,4,6]],2087:[[31,31,32,31,31,31,30,30,29,30,30,30],[1,4,7,4,7,3,6,1,3,4,6,1]],2088:[[30,31,32,32,30,31,30,30,29,30,30,30],[3,5,1,5,2,4,7,2,4,5,7,2]],2089:[[30,32,31,32,31,30,30,30,29,30,30,30],[4,6,3,6,3,6,1,3,5,6,1,3]],2090:[[30,32,31,32,31,30,30,30,29,30,30,30],[5,7,4,7,4,7,2,4,6,7,2,4]]}}#Y(){return[{day:"Sunday",en:{ddd:"Sunday",dd:"Sun",d:"S"},np:{ddd:"आइतबार",dd:"आइत",d:"आ"}},{day:"Monday",en:{ddd:"Monday",dd:"Mon",d:"M"},np:{ddd:"सोमबार",dd:"सोम",d:"सो"}},{day:"Tuesday",en:{ddd:"Tuesday",dd:"Tue",d:"T"},np:{ddd:"मंगलबार",dd:"मंगल",d:"मं"}},{day:"Wednesday",en:{ddd:"Wednesday",dd:"Wed",d:"W"},np:{ddd:"बुधबार",dd:"बुध",d:"बु"}},{day:"Thursday",en:{ddd:"Thursday",dd:"Thu",d:"T"},np:{ddd:"बिहिबार",dd:"बिहि",d:"बि"}},{day:"Friday",en:{ddd:"Friday",dd:"Fri",d:"F"},np:{ddd:"शुक्रबार",dd:"शुक्र",d:"शु"}},{day:"Saturday",en:{ddd:"Saturday",dd:"Sat",d:"S"},np:{ddd:"शनिबार",dd:"शनि",d:"श"}}]}#C(e,t){return a.#L()[t][0][e]}#E(e){const t={0:"०",1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९"};return e.toString().replace(/[0123456789]/g,(e=>t[e]))}#h(e){const t={"०":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9"};return e.toString().replace(/[०१२३४५६७८९]/g,(e=>t[e]))}#n(){switch(this.#e.position){case"left":default:return"ap-position-left";case"right":return"ap-position-right";case"center":return"ap-position-center"}}static convertToNepaliDate(e,t,a){e=+e,t=+t,a=+a;let n=this.#A(e,t,a),{nepaliYear:s,nepaliMonth:i,nepaliDate:r}=this.#x(n);return{year:s,month:i-1,date:r}}static#A(e,t,a){let n=0;for(let t=0;tthis.#L()[a][0][t-1]&&(n++,s=1,t++),i>7&&(i=1),n>12&&(a++,n=1),t>12&&(t=1),e--;return{nepaliYear:a,nepaliMonth:n,nepaliDate:s}}#u(e,t,a){const n=this.#e.format;switch(t=("0"+t).slice(-2),a=("0"+a).slice(-2),n){case"YYYY/MM/DD":return`${e}/${t}/${a}`;case"YYYY.MM.DD":return`${e}.${t}.${a}`;case"DD-MM-YYYY":return`${a}-${t}-${e}`;case"DD/MM/YYYY":return`${a}/${t}/${e}`;case"DD.MM.YYYY":return`${a}.${t}.${e}`;default:return`${e}-${t}-${a}`}}#q(e,t){const a=e.split(/[./-]/);switch(t){case"DD-MM-YYYY":case"DD/MM/YYYY":case"DD.MM.YYYY":return{year:parseInt(a[2]),month:parseInt(a[1]),day:parseInt(a[0])};default:return{year:parseInt(a[0]),month:parseInt(a[1]),day:parseInt(a[2])}}}#m(){switch(this.#e.theme){case"bordered":return"bordered-theme";case"soft":return"soft-theme";default:return"flat-theme"}}#g(e,t){const a=Object.keys(e.dataset);return t?a.find((e=>e.startsWith("ap-"))).split("-")[1]:a.find((e=>e.startsWith("ap-")))}}const n=a;return t.default})())); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.NepaliDatePicker=e():t.NepaliDatePicker=e()}(this,(()=>(()=>{"use strict";var t={d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>n});class a{#t={format:"YYYY-MM-DD",closeOnDateSelect:!0,disableAfterToday:!1,disableBeforeToday:!1,disableToday:!1,markHolidays:!0,holidays:["Saturday"],indicateCurrentDate:!0,setCurrentDate:!1,position:"left",daysFormat:"dd",locale:"np",theme:"flat",darkMode:!1,inline:!1};#e=null;#a="data-ap-";constructor(t,e){this.today=new Date,this.currentYear=this.today.getFullYear(),this.currentMonth=this.today.getMonth(),this.currentDay=this.today.getDate(),"object"==typeof e&&(this.#t={...this.#t,...e}),this.#e={trGap:"ap-gap",trAndTdWidth:"ddd"===this.#t.daysFormat?"np"===this.#t.locale?"ap-width-np-ddd":"ap-width-ddd":"ap-width-tr-td",position:this.#n()},this.#s(t)}#s(t){this.#i(),this.#t.inline?this.#r(t):(this.#d(t),this.#o(),this.#l())}#i(){let{year:t,month:e,date:n}=a.convertToNepaliDate(this.currentYear,this.currentMonth+1,this.currentDay);this.currentYear=+t,this.currentMonth=+e,this.currentDay=+n}#d(t){this.#c(t),this.#p()}#p(){document.addEventListener("click",(t=>{if(t.target.classList.contains("ap-cell-button")){let e="selected";t.target.closest("table").querySelectorAll(".ap-cell-button").forEach((function(t){t&&e.split(" ").forEach((e=>t.classList.remove(e)))})),e.split(" ").forEach((e=>t.target.classList.add(e)));let a=parseInt(t.target.closest(".ap-card").querySelector(".ap-calendar-year").value),n=parseInt(t.target.closest(".ap-card").querySelector(".ap-calendar-month").value)+1,s=this.#h(t.target.textContent),i=("0"+n).slice(-2),r=("0"+s).slice(-2),d=this.#u(a,i,r),o=t.target.closest(".ap-card").previousElementSibling;o&&(o.value=d),this.#t.closeOnDateSelect&&document.querySelectorAll(".ap-card").forEach((function(t){t.classList.contains("ap-card-inline")||(t.style.display="none")}))}}))}#c(t){const e=document.querySelectorAll(t);e.length>0&&e.forEach((t=>{this.#t.setCurrentDate&&!this.#t.disableToday&&(t.value=this.#u(this.currentYear,this.currentMonth+1,this.currentDay)),t.hasAttribute("placeholder")||t.setAttribute("placeholder",this.#t.format),t.addEventListener("click",(e=>{e.preventDefault();const a=e.target.nextElementSibling;if(a&&a.classList.contains("ap-card"))return;const n=Math.floor(1e5+9e5*Math.random()).toString();t.setAttribute(`${this.#a+n}`,""),this.#y({selector:t,selectorUniqueId:n})}))}))}#o(){document.addEventListener("click",(t=>{if(t.target.classList.contains("ap-calendar")){const e=t.target.nextElementSibling,a=e.classList;t.target.parentElement.style.position="relative";const n=this.#g(t.target,!0);document.querySelectorAll(".ap-card").forEach((function(t){t.classList.contains("ap-card-inline")||(t.style.display="none")})),e&&a.contains(`ap-calendar-${n}`)&&(e.style.display="block")}}))}#l(){document.addEventListener("click",(function(t){t.target.matches(".ap-calendar, .ap-card, .ap-card *")||document.querySelectorAll(".ap-card").forEach((function(t){t.classList.contains("ap-card-inline")||(t.style.display="none")}))}))}#y({selector:t,selectorUniqueId:e}){const a=this.#t.inline,n=t;n.classList.add("ap-calendar"),a&&n.classList.add("ap-inline");const s=this.#m(),i=this.#t.darkMode?"theme-dark":"theme-light",r=`\n \n `,d=`\n \n `,o=this.#b(),l=this.#f(),c=this.#D(),p=`\n
\n
\n
\n ${r}\n
\n \n \n
\n ${d}\n
\n
\n \n \n \n ${o}\n \n \n \n \n
\n
\n `;a?n.innerHTML=p:n.insertAdjacentHTML("afterend",p),this.#v(n,this.currentMonth,this.currentYear),this.#M(n)}#r(t){const e=document.querySelectorAll(t);e.length>0&&e.forEach((t=>{const e=Math.floor(1e5+9e5*Math.random()).toString();t.setAttribute(`${this.#a+e}`,""),this.#y({selector:t,selectorUniqueId:e})}))}#M(t){const e=this.#t.inline?t.querySelector(".btn-next"):t.nextElementSibling.querySelector(".btn-next"),a=this.#t.inline?t.querySelector(".btn-previous"):t.nextElementSibling.querySelector(".btn-previous"),n=this.#t.inline?t.querySelector(".ap-calendar-year"):t.nextElementSibling.querySelector(".ap-calendar-year"),s=this.#t.inline?t.querySelector(".ap-calendar-month"):t.nextElementSibling.querySelector(".ap-calendar-month");let i=parseInt(n.value),r=parseInt(s.value);e.removeEventListener("click",(()=>{})),a.removeEventListener("click",(()=>{})),e.addEventListener("click",(e=>{e.preventDefault(),i=11===r?i+1:i,r=(r+1)%12,this.#v(t,r,i)})),a.addEventListener("click",(e=>{e.preventDefault(),i=0===r?i-1:i,r=0===r?11:r-1,this.#v(t,r,i)}))}#v(t,e,n){const s=this.#t.inline?t.children[0]:t.nextElementSibling;let i;if(s&&s.classList.contains("ap-card")&&(i=s),!i)return;if(void 0===a.#L()[n])return;const r=a.#L()[n][1][e]-1,d=Object.keys(t.dataset).find((t=>t.includes("ap-"))).split("-")[1];i=document.querySelector(`.ap-calendar-${d}`);const o=i.querySelector(".calendar-body"),l=i.querySelector(".ap-calendar-year"),c=i.querySelector(".ap-calendar-month");l.removeEventListener("change",(()=>{})),c.removeEventListener("change",(()=>{})),l.addEventListener("change",(a=>{this.#v(t,e,a.target.value),this.#M(t)})),c.addEventListener("change",(e=>{this.#v(t,e.target.value,n),this.#M(t)})),l.value=n,c.value=e;const p=this.#m();if(o)for(;o.firstChild;)o.removeChild(o.firstChild);let h=1;for(let t=0;t<6;t++){const a=document.createElement("tr");a.classList.add("ap-table__tbody__tr");const s=this.#t.markHolidays&&this.#t.holidays.map((t=>this.#Y().findIndex((e=>e.day.toLowerCase()===t.toLowerCase()))));for(let i=0;i<7;i++){let d=s&&s.includes(i)?"holiday-marker-color":null;if(0===t&&ithis.#C(e,n))break;const t=document.createElement("td");t.classList.add("ap-table__thead__tr_td",this.#e.trAndTdWidth,"ap-cell",d);const s=document.createElement("button");s.setAttribute("type","button"),s.classList.add("ap-cell-button",p),this.#$(s,n,e,h);const i="np"===this.#t.locale?this.#E(h):h;this.#t.indicateCurrentDate&&+h==+this.currentDay&&+n==+this.currentYear&&+e==+this.currentMonth&&(t.classList.add("active"),s.classList.add("bordered-dashed")),s.appendChild(document.createTextNode(i)),t.appendChild(s),a.append(t),h++}}o.append(a)}}#$(t,e,a,n){const s=this.currentYear,i=this.currentMonth+1,r=this.currentDay;e=+e,a=+a,n=+n,this.#t.disableBeforeToday&&(es||e===s&&a+1>i||e===s&&a+1===i&&n>r)&&t.setAttribute("disabled","disabled")}#D(){return Array.from({length:91},((t,e)=>``)).join("")}#b(){return this.#Y().map((t=>`${t[this.#t.locale][this.#t.daysFormat]}`)).join("")}#f(){return this.#S().map(((t,e)=>``)).join("")}#T(){console.log("close date picker")}#S(){return[{en:"Baishak",np:"बैशाख"},{en:"Jestha",np:"जेठ"},{en:"Ashad",np:"असार"},{en:"Shrawn",np:"साउन"},{en:"Bhadra",np:"भदौ"},{en:"Ashwin",np:"असोज"},{en:"Kartik",np:"कार्तिक"},{en:"Mangshir",np:"मंसिर"},{en:"Poush",np:"पुष"},{en:"Magh",np:"माघ"},{en:"Falgun",np:"फाल्गुन"},{en:"Chaitra",np:"चैत्र"}]}static#k(){return[31,29,31,30,31,30,31,31,30,31,30,31]}static#_(){return[31,28,31,30,31,30,31,31,30,31,30,31]}static#L(){return{2e3:[[30,32,31,32,31,30,30,30,29,30,29,31],[4,6,3,6,3,6,1,3,5,6,1,2]],2001:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2002:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2003:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2004:[[30,32,31,32,31,30,30,30,29,30,29,31],[2,4,1,4,1,4,6,1,3,4,6,7]],2005:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2006:[[31,31,32,32,31,30,30,29,30,29,30,30],[4,7,3,7,4,7,2,4,5,7,1,3]],2007:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2008:[[31,31,31,32,31,31,29,30,30,29,29,31],[7,3,6,2,6,2,5,6,1,3,4,5]],2009:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2010:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2011:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2012:[[31,31,31,32,31,31,29,30,30,29,30,30],[5,1,4,7,4,7,3,4,6,1,2,4]],2013:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2014:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2015:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2016:[[31,31,31,32,31,31,29,30,30,29,30,30],[3,6,2,5,2,5,1,2,4,6,7,2]],2017:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2018:[[31,32,31,32,31,30,30,29,30,29,30,30],[5,1,5,1,5,1,3,5,6,1,2,4]],2019:[[31,32,31,32,31,30,30,30,29,30,29,31],[6,2,6,2,6,2,4,6,1,2,4,5]],2020:[[31,31,31,32,31,31,30,29,30,29,30,30],[1,4,7,3,7,3,6,1,2,4,5,7]],2021:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2022:[[31,32,31,32,31,30,30,30,29,29,30,30],[3,6,3,6,3,6,1,3,5,6,7,2]],2023:[[31,32,31,32,31,30,30,30,29,30,29,31],[4,7,4,7,4,7,2,4,6,7,2,3]],2024:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2025:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2026:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2027:[[30,32,31,32,31,30,30,30,29,30,29,31],[3,5,2,5,2,5,7,2,4,5,7,1]],2028:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2029:[[31,31,32,31,32,30,30,29,30,29,30,30],[5,1,4,1,4,1,3,5,6,1,2,4]],2030:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2031:[[30,32,31,32,31,30,30,30,29,30,29,31],[1,3,7,3,7,3,5,7,2,3,5,6]],2032:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2033:[[31,31,32,32,31,30,30,29,30,29,30,30],[3,6,2,6,3,6,1,3,4,6,7,2]],2034:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2035:[[30,32,31,32,31,31,29,30,30,29,29,31],[6,1,5,1,5,1,4,5,7,2,3,4]],2036:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2037:[[31,31,32,32,31,30,30,29,30,29,30,30],[1,4,7,4,1,4,6,1,2,4,5,7]],2038:[[31,32,31,32,31,30,30,30,29,29,30,31],[2,5,2,5,2,5,7,2,4,5,6,1]],2039:[[31,31,31,32,31,31,29,30,30,29,30,30],[4,7,3,6,3,6,2,3,5,7,1,3]],2040:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2041:[[31,31,32,32,31,30,30,29,30,29,30,30],[6,2,5,2,6,2,4,6,7,2,3,5]],2042:[[31,32,31,32,31,30,30,30,29,29,30,31],[7,3,7,3,7,3,5,7,2,3,4,6]],2043:[[31,31,31,32,31,31,29,30,30,29,30,30],[2,5,1,4,1,4,7,1,3,5,6,1]],2044:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2045:[[31,32,31,32,31,30,30,29,30,29,30,30],[4,7,4,7,4,7,2,4,5,7,1,3]],2046:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2047:[[31,31,31,32,31,31,30,29,30,29,30,30],[7,3,6,2,6,2,5,7,1,3,4,6]],2048:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2049:[[31,32,31,32,31,30,30,30,29,29,30,30],[2,5,2,5,2,5,7,2,4,5,6,1]],2050:[[31,32,31,32,31,30,30,30,29,30,29,31],[3,6,3,6,3,6,1,3,5,6,1,2]],2051:[[31,31,31,32,31,31,30,29,30,29,30,30],[5,1,4,7,4,7,3,5,6,1,2,4]],2052:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2053:[[31,32,31,32,31,30,30,30,29,29,30,30],[7,3,7,3,7,3,5,7,2,3,4,6]],2054:[[31,32,31,32,31,30,30,30,29,30,29,31],[1,4,1,4,1,4,6,1,3,4,6,7]],2055:[[31,31,32,31,31,31,30,29,30,29,30,30],[3,6,2,6,2,5,1,3,4,6,7,2]],2056:[[31,31,32,31,32,30,30,29,30,29,30,30],[4,7,3,7,3,7,2,4,5,7,1,3]],2057:[[31,32,31,32,31,30,30,30,29,29,30,31],[5,1,5,1,5,1,3,5,7,1,2,4]],2058:[[30,32,31,32,31,30,30,30,29,30,29,31],[7,2,6,2,6,2,4,6,1,2,4,5]],2059:[[31,31,32,31,31,31,30,29,30,29,30,30],[1,4,7,4,7,3,6,1,2,4,5,7]],2060:[[31,31,32,32,31,30,30,29,30,29,30,30],[2,5,1,5,2,5,7,2,3,5,6,1]],2061:[[31,32,31,32,31,30,30,30,29,29,30,31],[3,6,3,6,3,6,1,3,5,6,7,2]],2062:[[30,32,31,32,31,31,29,30,29,30,29,31],[5,7,4,7,4,7,3,4,6,7,2,3]],2063:[[31,31,32,31,31,31,30,29,30,29,30,30],[6,2,5,2,5,1,4,6,7,2,3,5]],2064:[[31,31,32,32,31,30,30,29,30,29,30,30],[7,3,6,3,7,3,5,7,1,3,4,6]],2065:[[31,32,31,32,31,30,30,30,29,29,30,31],[1,4,1,4,1,4,6,1,3,4,5,7]],2066:[[31,31,31,32,31,31,29,30,30,29,29,31],[3,6,2,5,2,5,1,2,4,6,7,1]],2067:[[31,31,32,31,31,31,30,29,30,29,30,30],[4,7,3,7,3,6,2,4,5,7,1,3]],2068:[[31,31,32,32,31,30,30,29,30,29,30,30],[5,1,4,1,5,1,3,5,6,1,2,4]],2069:[[31,32,31,32,31,30,30,30,29,29,30,31],[6,2,6,2,6,2,4,6,1,2,3,5]],2070:[[31,31,31,32,31,31,29,30,30,29,30,30],[1,4,7,3,7,3,6,7,2,4,5,7]],2071:[[31,31,32,31,31,31,30,29,30,29,30,30],[2,5,1,5,1,4,7,2,3,5,6,1]],2072:[[31,32,31,32,31,30,30,29,30,29,30,30],[3,6,3,6,3,6,1,3,4,6,7,2]],2073:[[31,32,31,32,31,30,30,30,29,29,30,31],[4,7,4,7,4,7,2,4,6,7,1,3]],2074:[[31,31,31,32,31,31,30,29,30,29,30,30],[6,2,5,1,5,1,4,6,7,2,3,5]],2075:[[31,31,32,31,31,31,30,29,30,29,30,30],[7,3,6,3,6,2,5,7,1,3,4,6]],2076:[[31,32,31,32,31,30,30,30,29,29,30,30],[1,4,1,4,1,4,6,1,3,4,5,7]],2077:[[31,32,31,32,31,30,30,30,29,30,29,31],[2,5,2,5,2,5,7,2,4,5,7,1]],2078:[[31,31,31,32,31,31,30,29,30,29,30,30],[4,7,3,6,3,6,2,4,5,7,1,3]],2079:[[31,31,32,31,31,31,30,29,30,29,30,30],[5,1,4,1,4,7,3,5,6,1,2,4]],2080:[[31,32,31,32,31,30,30,30,29,29,30,30],[6,2,6,2,6,2,4,6,1,2,3,5]],2081:[[31,32,31,32,31,30,30,30,29,30,29,31],[7,3,7,3,7,3,5,7,2,3,5,6]],2082:[[30,32,31,32,31,30,30,30,29,30,30,30],[2,4,1,4,1,4,6,1,3,4,6,1]],2083:[[31,31,32,31,31,30,30,30,29,30,30,30],[3,6,2,6,2,5,7,2,4,5,7,2]],2084:[[31,31,32,31,31,30,30,30,29,30,30,30],[4,7,3,7,3,6,1,3,5,6,1,3]],2085:[[31,32,31,32,30,31,30,30,29,30,30,30],[5,1,5,1,5,7,3,5,7,1,3,5]],2086:[[30,32,31,32,31,30,30,30,29,30,30,30],[7,2,6,2,6,2,4,6,1,2,4,6]],2087:[[31,31,32,31,31,31,30,30,29,30,30,30],[1,4,7,4,7,3,6,1,3,4,6,1]],2088:[[30,31,32,32,30,31,30,30,29,30,30,30],[3,5,1,5,2,4,7,2,4,5,7,2]],2089:[[30,32,31,32,31,30,30,30,29,30,30,30],[4,6,3,6,3,6,1,3,5,6,1,3]],2090:[[30,32,31,32,31,30,30,30,29,30,30,30],[5,7,4,7,4,7,2,4,6,7,2,4]]}}#Y(){return[{day:"Sunday",en:{ddd:"Sunday",dd:"Sun",d:"S"},np:{ddd:"आइतबार",dd:"आइत",d:"आ"}},{day:"Monday",en:{ddd:"Monday",dd:"Mon",d:"M"},np:{ddd:"सोमबार",dd:"सोम",d:"सो"}},{day:"Tuesday",en:{ddd:"Tuesday",dd:"Tue",d:"T"},np:{ddd:"मंगलबार",dd:"मंगल",d:"मं"}},{day:"Wednesday",en:{ddd:"Wednesday",dd:"Wed",d:"W"},np:{ddd:"बुधबार",dd:"बुध",d:"बु"}},{day:"Thursday",en:{ddd:"Thursday",dd:"Thu",d:"T"},np:{ddd:"बिहिबार",dd:"बिहि",d:"बि"}},{day:"Friday",en:{ddd:"Friday",dd:"Fri",d:"F"},np:{ddd:"शुक्रबार",dd:"शुक्र",d:"शु"}},{day:"Saturday",en:{ddd:"Saturday",dd:"Sat",d:"S"},np:{ddd:"शनिबार",dd:"शनि",d:"श"}}]}#C(t,e){return a.#L()[e][0][t]}#E(t){const e={0:"०",1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९"};return t.toString().replace(/[0123456789]/g,(t=>e[t]))}#h(t){const e={"०":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9"};return t.toString().replace(/[०१२३४५६७८९]/g,(t=>e[t]))}#n(){switch(this.#t.position){case"left":default:return"ap-position-left";case"right":return"ap-position-right";case"center":return"ap-position-center"}}static convertToNepaliDate(t,e,a){t=+t,e=+e,a=+a;let n=this.#A(t,e,a),{nepaliYear:s,nepaliMonth:i,nepaliDate:r}=this.#x(n);return{year:s,month:i-1,date:r}}static#A(t,e,a){let n=0;for(let e=0;ethis.#L()[a][0][e-1]&&(n++,s=1,e++),i>7&&(i=1),n>12&&(a++,n=1),e>12&&(e=1),t--;return{nepaliYear:a,nepaliMonth:n,nepaliDate:s}}#u(t,e,a){const n=this.#t.format;switch(e=("0"+e).slice(-2),a=("0"+a).slice(-2),n){case"YYYY/MM/DD":return`${t}/${e}/${a}`;case"YYYY.MM.DD":return`${t}.${e}.${a}`;case"DD-MM-YYYY":return`${a}-${e}-${t}`;case"DD/MM/YYYY":return`${a}/${e}/${t}`;case"DD.MM.YYYY":return`${a}.${e}.${t}`;default:return`${t}-${e}-${a}`}}#q(t,e){const a=t.split(/[./-]/);switch(e){case"DD-MM-YYYY":case"DD/MM/YYYY":case"DD.MM.YYYY":return{year:parseInt(a[2]),month:parseInt(a[1]),day:parseInt(a[0])};default:return{year:parseInt(a[0]),month:parseInt(a[1]),day:parseInt(a[2])}}}#m(){switch(this.#t.theme){case"bordered":return"bordered-theme";case"soft":return"soft-theme";default:return"flat-theme"}}#g(t,e){const a=Object.keys(t.dataset);return e?a.find((t=>t.startsWith("ap-"))).split("-")[1]:a.find((t=>t.startsWith("ap-")))}}const n=a;return e.default})())); \ No newline at end of file diff --git a/package.json b/package.json index 490f746..6cc75a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@anuz-pandey/nepali-date-picker", - "version": "2.1.2", + "version": "2.2.1", "description": "Lightweight, Powerful JavaScript Nepali Date Picker with no dependencies.", "main": "dist/nepali-date-picker.bundle.js", "module": "dist/nepali-date-picker.bundle.js",