/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/flatpickr-year-select-plugin@1.3.1/dist/flatpickr-year-select-plugin.umd.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
(function(u,i){typeof exports=="object"&&typeof module<"u"?module.exports=i():typeof define=="function"&&define.amd?define(i):(u=typeof globalThis<"u"?globalThis:u||self,u.yearSelectPlugin=i())})(this,(function(){"use strict";return function(i){const v={start:i&&i.start!==void 0?i.start:3,end:i&&i.end!==void 0?i.end:3};return function(l){if(!l)return{};const r=l,f={...v},p=a=>{if(!a)return;const n=e=>{if(e){if(e instanceof Date)return isNaN(e.getTime())?void 0:e;if(typeof e=="string"||typeof e=="number"){const t=r.parseDate?r.parseDate(e):new Date(e);return t&&!isNaN(t.getTime())?t:void 0}}};if(Array.isArray(a)){for(const e of a){const t=n(e);if(t)return t}return}return n(a)},g=()=>{const a=p(r.config.minDate),n=p(r.config.maxDate),e=a?.getFullYear(),t=n?.getFullYear(),o=e!==void 0&&t!==void 0?Math.min(e,t):e,s=e!==void 0&&t!==void 0?Math.max(e,t):t;return{minYear:o,maxYear:s}},y=a=>{const{minYear:n,maxYear:e}=g();return n!==void 0&&a<n?n:e!==void 0&&a>e?e:a},D=a=>{const{minYear:n,maxYear:e}=g(),t=y(a),o=f.start!==void 0?t-f.start:t,s=f.end!==void 0?t+f.end:t,x=n!==void 0?Math.max(o,n):o,N=e!==void 0?Math.min(s,e):s;return{clampedYear:t,start:x,end:N}},h=(()=>{const a=l.selectedDates?.[0]?.getFullYear(),n=p(l.config.defaultDate),e=n&&!isNaN(n.getTime())?n.getFullYear():void 0;return y(r.currentYear??a??e??new Date().getFullYear())})(),Y=document.createElement("div");Y.classList.add("flatpickr-current-year");const c=document.createElement("select");c.classList.add("flatpickr-monthDropdown-years"),c.setAttribute("aria-label","Year"),c.setAttribute("name","year");let d=!1;const m=function(a){c.innerHTML="";const{clampedYear:n,start:e,end:t}=D(a);for(let o=e;o<=t;o++){const s=document.createElement("option");s.value=String(o),s.text=String(o),c.appendChild(s)}return c.value=String(n),n};return r.yearSelectContainer=r._createElement("div","flatpickr-years",""),m(h),c.addEventListener("change",function(a){const n=a.target;if(!n)return;const e=n.options[n.selectedIndex].value;r.changeYear(Number(e)),r.redraw()}),Y.append(c),r.yearSelectContainer&&r.yearSelectContainer.append(Y),{onReady:function(){if(!r.monthNav||!r.calendarContainer){console.warn("flatpickr-year-select-plugin: Required elements not found");return}const n=r.monthNav.className,t=r.calendarContainer.getElementsByClassName(n)[0];if(!t||!t.parentNode||!r.yearSelectContainer)return;t.parentNode.insertBefore(r.yearSelectContainer,t.parentNode.firstChild);const{start:o,end:s}=D(h);r.config.minDate||r.set("minDate",`${o}-01-01`),r.config.maxDate||r.set("maxDate",`${s}-12-31`)},onOpen:function(n,e,t){const o=m(t.currentYear);o!==t.currentYear&&(d=!0,r.changeYear(o),r.redraw(),d=!1)},onYearChange:function(n,e,t){if(d){d=!1,m(t.currentYear);return}const o=m(t.currentYear);o!==t.currentYear&&(d=!0,r.changeYear(o),r.redraw(),d=!1)}}}}}));
//# sourceMappingURL=flatpickr-year-select-plugin.umd.js.map
