AlchemyCMS/alchemy_cms

View on GitHub
vendor/javascript/flatpickr.min.js

Summary

Maintainability
A
0 mins
Test Coverage
var e=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],n={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var n=new Date(e.getTime());n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7);var t=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},t={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},a=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},i=function(e){return!0===e?1:0};function o(e,n){var t;return function(){var a=this,i=arguments;clearTimeout(t),t=setTimeout((function(){return e.apply(a,i)}),n)}}var r=function(e){return e instanceof Array?e:[e]};function l(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function c(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function s(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function d(e,n){return n(e)?e:e.parentNode?d(e.parentNode,n):void 0}function u(e,n){var t=c("div","numInputWrapper"),a=c("input","numInput "+e),i=c("span","arrowUp"),o=c("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function f(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var m=function(){},g=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},p={D:m,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*i(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours((e.getHours()>=12?12:0)+parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:m,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:m,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},h={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},v={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[v.w(e,n,t)]},F:function(e,n,t){return g(v.n(e,n,t)-1,!1,n)},G:function(e,n,t){return a(v.h(e,n,t))},H:function(e){return a(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[i(e.getHours()>11)]},M:function(e,n){return g(e.getMonth(),!0,n)},S:function(e){return a(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return a(e.getFullYear(),4)},d:function(e){return a(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return a(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return a(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},D=function(e){var a=e.config,i=void 0===a?n:a,o=e.l10n,r=void 0===o?t:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,t){var a=t||r;return void 0===i.formatDate||c?n.split("").map((function(n,t,o){return v[n]&&"\\"!==o[t-1]?v[n](e,a,i):"\\"!==n?n:""})).join(""):i.formatDate(e,n,a)}},w=function(e){var a=e.config,i=void 0===a?n:a,o=e.l10n,r=void 0===o?t:o;return function(e,t,a,o){if(0===e||e){var l,c=o||r,s=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var d=t||(i||n).dateFormat,u=String(e).trim();if("today"===u)l=new Date,a=!0;else if(i&&i.parseDate)l=i.parseDate(e,d);else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else{for(var f=void 0,m=[],g=0,v=0,D="";g<d.length;g++){var w=d[g],b="\\"===w,C="\\"===d[g-1]||b;if(h[w]&&!C){D+=h[w];var M=new RegExp(D).exec(e);M&&(f=!0)&&m["Y"!==w?"push":"unshift"]({fn:p[w],val:M[++v]})}else b||(D+=".")}l=i&&i.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),m.forEach((function(e){var n=e.fn,t=e.val;return l=n(l,t,c)||l})),l=f?l:void 0}}if(l instanceof Date&&!isNaN(l.getTime()))return!0===a&&l.setHours(0,0,0,0),l;i.errorHandler(new Error("Invalid date provided: "+s))}}};function b(e,n,t){return void 0===t&&(t=!0),!1!==t?new Date(e.getTime()).setHours(0,0,0,0)-new Date(n.getTime()).setHours(0,0,0,0):e.getTime()-n.getTime()}var C=function(e,n,t){return e>Math.min(n,t)&&e<Math.max(n,t)},M=function(e,n,t){return 3600*e+60*n+t},y=function(e){var n=Math.floor(e/3600),t=(e-3600*n)/60;return[n,t,e-3600*n-60*t]},x={DAY:864e5};function E(e){var n=e.defaultHour,t=e.defaultMinute,a=e.defaultSeconds;if(void 0!==e.minDate){var i=e.minDate.getHours(),o=e.minDate.getMinutes(),r=e.minDate.getSeconds();n<i&&(n=i),n===i&&t<o&&(t=o),n===i&&t===o&&a<r&&(a=e.minDate.getSeconds())}if(void 0!==e.maxDate){var l=e.maxDate.getHours(),c=e.maxDate.getMinutes();(n=Math.min(n,l))===l&&(t=Math.min(c,t)),n===l&&t===c&&(a=e.maxDate.getSeconds())}return{hours:n,minutes:t,seconds:a}}"function"!=typeof Object.assign&&(Object.assign=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var a=function(n){n&&Object.keys(n).forEach((function(t){return e[t]=n[t]}))},i=0,o=n;i<o.length;i++){a(o[i])}return e});var k=window&&window.__assign||function(){return k=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},k.apply(this,arguments)},T=window&&window.__spreadArrays||function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var a=Array(e),i=0;for(n=0;n<t;n++)for(var o=arguments[n],r=0,l=o.length;r<l;r++,i++)a[i]=o[r];return a},I=300;function S(m,p){var v={config:k(k({},n),O.defaultConfig),l10n:t};function S(){var e;return(null===(e=v.calendarContainer)||void 0===e?void 0:e.getRootNode()).activeElement||document.activeElement}function _(e){return e.bind(v)}function F(){var e=v.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame((function(){if(void 0!==v.calendarContainer&&(v.calendarContainer.style.visibility="hidden",v.calendarContainer.style.display="block"),void 0!==v.daysContainer){var n=(v.days.offsetWidth+1)*e.showMonths;v.daysContainer.style.width=n+"px",v.calendarContainer.style.width=n+(void 0!==v.weekWrapper?v.weekWrapper.offsetWidth:0)+"px",v.calendarContainer.style.removeProperty("visibility"),v.calendarContainer.style.removeProperty("display")}}))}function A(e){if(0===v.selectedDates.length){var n=void 0===v.config.minDate||b(new Date,v.config.minDate)>=0?new Date:new Date(v.config.minDate.getTime()),t=E(v.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),v.selectedDates=[n],v.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=f(e),o=t;void 0!==v.amPM&&t===v.amPM&&(v.amPM.textContent=v.l10n.amPM[i(v.amPM.textContent===v.l10n.amPM[0])]);var r=parseFloat(o.getAttribute("min")),l=parseFloat(o.getAttribute("max")),c=parseFloat(o.getAttribute("step")),s=parseInt(o.value,10),d=e.delta||(n?38===e.which?1:-1:0),u=s+c*d;if(void 0!==o.value&&2===o.value.length){var m=o===v.hourElement,g=o===v.minuteElement;u<r?(u=l+u+i(!m)+(i(m)&&i(!v.amPM)),g&&B(void 0,-1,v.hourElement)):u>l&&(u=o===v.hourElement?u-l-i(!v.amPM):r,g&&B(void 0,1,v.hourElement)),v.amPM&&m&&(1===c?u+s===23:Math.abs(u-s)>c)&&(v.amPM.textContent=v.l10n.amPM[i(v.amPM.textContent===v.l10n.amPM[0])]),o.value=a(u)}}(e);var o=v._input.value;N(),ke(),v._input.value!==o&&v._debouncedChange()}function N(){if(void 0!==v.hourElement&&void 0!==v.minuteElement){var e,n,t=(parseInt(v.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(v.minuteElement.value,10)||0)%60,o=void 0!==v.secondElement?(parseInt(v.secondElement.value,10)||0)%60:0;void 0!==v.amPM&&(e=t,n=v.amPM.textContent,t=e%12+12*i(n===v.l10n.amPM[1]));var r=void 0!==v.config.minTime||v.config.minDate&&v.minDateHasTime&&v.latestSelectedDateObj&&0===b(v.latestSelectedDateObj,v.config.minDate,!0),l=void 0!==v.config.maxTime||v.config.maxDate&&v.maxDateHasTime&&v.latestSelectedDateObj&&0===b(v.latestSelectedDateObj,v.config.maxDate,!0);if(void 0!==v.config.maxTime&&void 0!==v.config.minTime&&v.config.minTime>v.config.maxTime){var c=M(v.config.minTime.getHours(),v.config.minTime.getMinutes(),v.config.minTime.getSeconds()),s=M(v.config.maxTime.getHours(),v.config.maxTime.getMinutes(),v.config.maxTime.getSeconds()),d=M(t,a,o);if(d>s&&d<c){var u=y(c);t=u[0],a=u[1],o=u[2]}}else{if(l){var f=void 0!==v.config.maxTime?v.config.maxTime:v.config.maxDate;(t=Math.min(t,f.getHours()))===f.getHours()&&(a=Math.min(a,f.getMinutes())),a===f.getMinutes()&&(o=Math.min(o,f.getSeconds()))}if(r){var m=void 0!==v.config.minTime?v.config.minTime:v.config.minDate;(t=Math.max(t,m.getHours()))===m.getHours()&&a<m.getMinutes()&&(a=m.getMinutes()),a===m.getMinutes()&&(o=Math.max(o,m.getSeconds()))}}Y(t,a,o)}}function P(e){var n=e||v.latestSelectedDateObj;n&&n instanceof Date&&Y(n.getHours(),n.getMinutes(),n.getSeconds())}function Y(e,n,t){void 0!==v.latestSelectedDateObj&&v.latestSelectedDateObj.setHours(e%24,n,t||0,0),v.hourElement&&v.minuteElement&&!v.isMobile&&(v.hourElement.value=a(v.config.time_24hr?e:(12+e)%12+12*i(e%12==0)),v.minuteElement.value=a(n),void 0!==v.amPM&&(v.amPM.textContent=v.l10n.amPM[i(e>=12)]),void 0!==v.secondElement&&(v.secondElement.value=a(t)))}function j(e){var n=f(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&ae(t)}function H(e,n,t,a){return n instanceof Array?n.forEach((function(n){return H(e,n,t,a)})):e instanceof Array?e.forEach((function(e){return H(e,n,t,a)})):(e.addEventListener(n,t,a),void v._handlers.push({remove:function(){return e.removeEventListener(n,t,a)}}))}function L(){Ce("onChange")}function R(e,n){var t=void 0!==e?v.parseDate(e):v.latestSelectedDateObj||(v.config.minDate&&v.config.minDate>v.now?v.config.minDate:v.config.maxDate&&v.config.maxDate<v.now?v.config.maxDate:v.now),a=v.currentYear,i=v.currentMonth;try{void 0!==t&&(v.currentYear=t.getFullYear(),v.currentMonth=t.getMonth())}catch(e){e.message="Invalid date supplied: "+t,v.config.errorHandler(e)}n&&v.currentYear!==a&&(Ce("onYearChange"),z()),!n||v.currentYear===a&&v.currentMonth===i||Ce("onMonthChange"),v.redraw()}function W(e){var n=f(e);~n.className.indexOf("arrow")&&B(e,n.classList.contains("arrowUp")?1:-1)}function B(e,n,t){var a=e&&f(e),i=t||a&&a.parentNode&&a.parentNode.firstChild,o=Me("increment");o.delta=n,i&&i.dispatchEvent(o)}function J(e,n,t,a){var i=ie(n,!0),o=c("span",e,n.getDate().toString());return o.dateObj=n,o.$i=a,o.setAttribute("aria-label",v.formatDate(n,v.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===b(n,v.now)&&(v.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,ye(n)&&(o.classList.add("selected"),v.selectedDateElem=o,"range"===v.config.mode&&(l(o,"startRange",v.selectedDates[0]&&0===b(n,v.selectedDates[0],!0)),l(o,"endRange",v.selectedDates[1]&&0===b(n,v.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===v.config.mode&&function(e){return!("range"!==v.config.mode||v.selectedDates.length<2)&&(b(e,v.selectedDates[0])>=0&&b(e,v.selectedDates[1])<=0)}(n)&&!ye(n)&&o.classList.add("inRange"),v.weekNumbers&&1===v.config.showMonths&&"prevMonthDay"!==e&&a%7==6&&v.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+v.config.getWeek(n)+"</span>"),Ce("onDayCreate",o),o}function K(e){e.focus(),"range"===v.config.mode&&ce(e)}function U(e){for(var n=e>0?0:v.config.showMonths-1,t=e>0?v.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=v.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&ie(c.dateObj))return c}}function q(e,n){var t=S(),a=oe(t||document.body),i=void 0!==e?e:a?t:void 0!==v.selectedDateElem&&oe(v.selectedDateElem)?v.selectedDateElem:void 0!==v.todayDateElem&&oe(v.todayDateElem)?v.todayDateElem:U(n>0?1:-1);void 0===i?v._input.focus():a?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():v.currentMonth,a=n>0?v.config.showMonths:-1,i=n>0?1:-1,o=t-v.currentMonth;o!=a;o+=i)for(var r=v.daysContainer.children[o],l=t-v.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,s=l;s>=0&&s<c&&s!=(n>0?c:-1);s+=i){var d=r.children[s];if(-1===d.className.indexOf("hidden")&&ie(d.dateObj)&&Math.abs(e.$i-s)>=Math.abs(n))return K(d)}v.changeMonth(i),q(U(i),0)}(i,n):K(i)}function $(e,n){for(var t=(new Date(e,n,1).getDay()-v.l10n.firstDayOfWeek+7)%7,a=v.utils.getDaysInMonth((n-1+12)%12,e),i=v.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=v.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",s=r?"nextMonthDay hidden":"nextMonthDay",d=a+1-t,u=0;d<=a;d++,u++)o.appendChild(J("flatpickr-day "+l,new Date(e,n-1,d),0,u));for(d=1;d<=i;d++,u++)o.appendChild(J("flatpickr-day",new Date(e,n,d),0,u));for(var f=i+1;f<=42-t&&(1===v.config.showMonths||u%7!=0);f++,u++)o.appendChild(J("flatpickr-day "+s,new Date(e,n+1,f%i),0,u));var m=c("div","dayContainer");return m.appendChild(o),m}function V(){if(void 0!==v.daysContainer){s(v.daysContainer),v.weekNumbers&&s(v.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n<v.config.showMonths;n++){var t=new Date(v.currentYear,v.currentMonth,1);t.setMonth(v.currentMonth+n),e.appendChild($(t.getFullYear(),t.getMonth()))}v.daysContainer.appendChild(e),v.days=v.daysContainer.firstChild,"range"===v.config.mode&&1===v.selectedDates.length&&ce()}}function z(){if(!(v.config.showMonths>1||"dropdown"!==v.config.monthSelectorType)){var e=function(e){return!(void 0!==v.config.minDate&&v.currentYear===v.config.minDate.getFullYear()&&e<v.config.minDate.getMonth())&&!(void 0!==v.config.maxDate&&v.currentYear===v.config.maxDate.getFullYear()&&e>v.config.maxDate.getMonth())};v.monthsDropdownContainer.tabIndex=-1,v.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=c("option","flatpickr-monthDropdown-month");t.value=new Date(v.currentYear,n).getMonth().toString(),t.textContent=g(n,v.config.shorthandCurrentMonth,v.l10n),t.tabIndex=-1,v.currentMonth===n&&(t.selected=!0),v.monthsDropdownContainer.appendChild(t)}}}function G(){var e,n=c("div","flatpickr-month"),t=window.document.createDocumentFragment();v.config.showMonths>1||"static"===v.config.monthSelectorType?e=c("span","cur-month"):(v.monthsDropdownContainer=c("select","flatpickr-monthDropdown-months"),v.monthsDropdownContainer.setAttribute("aria-label",v.l10n.monthAriaLabel),H(v.monthsDropdownContainer,"change",(function(e){var n=f(e),t=parseInt(n.value,10);v.changeMonth(t-v.currentMonth),Ce("onMonthChange")})),z(),e=v.monthsDropdownContainer);var a=u("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",v.l10n.yearAriaLabel),v.config.minDate&&i.setAttribute("min",v.config.minDate.getFullYear().toString()),v.config.maxDate&&(i.setAttribute("max",v.config.maxDate.getFullYear().toString()),i.disabled=!!v.config.minDate&&v.config.minDate.getFullYear()===v.config.maxDate.getFullYear());var o=c("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function Z(){s(v.monthNav),v.monthNav.appendChild(v.prevMonthNav),v.config.showMonths&&(v.yearElements=[],v.monthElements=[]);for(var e=v.config.showMonths;e--;){var n=G();v.yearElements.push(n.yearElement),v.monthElements.push(n.monthElement),v.monthNav.appendChild(n.container)}v.monthNav.appendChild(v.nextMonthNav)}function Q(){v.weekdayContainer?s(v.weekdayContainer):v.weekdayContainer=c("div","flatpickr-weekdays");for(var e=v.config.showMonths;e--;){var n=c("div","flatpickr-weekdaycontainer");v.weekdayContainer.appendChild(n)}return X(),v.weekdayContainer}function X(){if(v.weekdayContainer){var e=v.l10n.firstDayOfWeek,n=T(v.l10n.weekdays.shorthand);e>0&&e<n.length&&(n=T(n.splice(e,n.length),n.splice(0,e)));for(var t=v.config.showMonths;t--;)v.weekdayContainer.children[t].innerHTML="\n      <span class='flatpickr-weekday'>\n        "+n.join("</span><span class='flatpickr-weekday'>")+"\n      </span>\n      "}}function ee(e,n){void 0===n&&(n=!0);var t=n?e:e-v.currentMonth;t<0&&!0===v._hidePrevMonthArrow||t>0&&!0===v._hideNextMonthArrow||(v.currentMonth+=t,(v.currentMonth<0||v.currentMonth>11)&&(v.currentYear+=v.currentMonth>11?1:-1,v.currentMonth=(v.currentMonth+12)%12,Ce("onYearChange"),z()),V(),Ce("onMonthChange"),xe())}function ne(e){return v.calendarContainer.contains(e)}function te(e){if(v.isOpen&&!v.config.inline){var n=f(e),t=ne(n),a=!(n===v.input||n===v.altInput||v.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(v.input)||~e.path.indexOf(v.altInput)))&&!t&&!ne(e.relatedTarget),i=!v.config.ignoredFocusElements.some((function(e){return e.contains(n)}));a&&i&&(v.config.allowInput&&v.setDate(v._input.value,!1,v.config.altInput?v.config.altFormat:v.config.dateFormat),void 0!==v.timeContainer&&void 0!==v.minuteElement&&void 0!==v.hourElement&&""!==v.input.value&&void 0!==v.input.value&&A(),v.close(),v.config&&"range"===v.config.mode&&1===v.selectedDates.length&&v.clear(!1))}}function ae(e){if(!(!e||v.config.minDate&&e<v.config.minDate.getFullYear()||v.config.maxDate&&e>v.config.maxDate.getFullYear())){var n=e,t=v.currentYear!==n;v.currentYear=n||v.currentYear,v.config.maxDate&&v.currentYear===v.config.maxDate.getFullYear()?v.currentMonth=Math.min(v.config.maxDate.getMonth(),v.currentMonth):v.config.minDate&&v.currentYear===v.config.minDate.getFullYear()&&(v.currentMonth=Math.max(v.config.minDate.getMonth(),v.currentMonth)),t&&(v.redraw(),Ce("onYearChange"),z())}}function ie(e,n){var t;void 0===n&&(n=!0);var a=v.parseDate(e,void 0,n);if(v.config.minDate&&a&&b(a,v.config.minDate,void 0!==n?n:!v.minDateHasTime)<0||v.config.maxDate&&a&&b(a,v.config.maxDate,void 0!==n?n:!v.maxDateHasTime)>0)return!1;if(!v.config.enable&&0===v.config.disable.length)return!0;if(void 0===a)return!1;for(var i=!!v.config.enable,o=null!==(t=v.config.enable)&&void 0!==t?t:v.config.disable,r=0,l=void 0;r<o.length;r++){if("function"==typeof(l=o[r])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l){var c=v.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.getTime()<=l.to.getTime())return i}return!i}function oe(e){return void 0!==v.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&v.daysContainer.contains(e))}function re(e){var n=e.target===v._input,t=v._input.value.trimEnd()!==Ee();!n||!t||e.relatedTarget&&ne(e.relatedTarget)||v.setDate(v._input.value,!0,e.target===v.altInput?v.config.altFormat:v.config.dateFormat)}function le(e){var n=f(e),t=v.config.wrap?m.contains(n):n===v._input,a=v.config.allowInput,i=v.isOpen&&(!a||!t),o=v.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return v.setDate(v._input.value,!0,n===v.altInput?v.config.altFormat:v.config.dateFormat),v.close(),n.blur();v.open()}else if(ne(n)||i||o){var r=!!v.timeContainer&&v.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),A(),pe()):he(e);break;case 27:e.preventDefault(),pe();break;case 8:case 46:t&&!v.config.allowInput&&(e.preventDefault(),v.clear());break;case 37:case 39:if(r||t)v.hourElement&&v.hourElement.focus();else{e.preventDefault();var l=S();if(void 0!==v.daysContainer&&(!1===a||l&&oe(l))){var c=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),ee(c),q(U(1),0)):q(void 0,c)}}break;case 38:case 40:e.preventDefault();var s=40===e.keyCode?1:-1;v.daysContainer&&void 0!==n.$i||n===v.input||n===v.altInput?e.ctrlKey?(e.stopPropagation(),ae(v.currentYear-s),q(U(1),0)):r||q(void 0,7*s):n===v.currentYearElement?ae(v.currentYear-s):v.config.enableTime&&(!r&&v.hourElement&&v.hourElement.focus(),A(e),v._debouncedChange());break;case 9:if(r){var d=[v.hourElement,v.minuteElement,v.secondElement,v.amPM].concat(v.pluginElements).filter((function(e){return e})),u=d.indexOf(n);if(-1!==u){var g=d[u+(e.shiftKey?-1:1)];e.preventDefault(),(g||v._input).focus()}}else!v.config.noCalendar&&v.daysContainer&&v.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),v._input.focus())}}if(void 0!==v.amPM&&n===v.amPM)switch(e.key){case v.l10n.amPM[0].charAt(0):case v.l10n.amPM[0].charAt(0).toLowerCase():v.amPM.textContent=v.l10n.amPM[0],N(),ke();break;case v.l10n.amPM[1].charAt(0):case v.l10n.amPM[1].charAt(0).toLowerCase():v.amPM.textContent=v.l10n.amPM[1],N(),ke()}(t||ne(n))&&Ce("onKeyDown",e)}function ce(e,n){if(void 0===n&&(n="flatpickr-day"),1===v.selectedDates.length&&(!e||e.classList.contains(n)&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():v.days.firstElementChild.dateObj.getTime(),a=v.parseDate(v.selectedDates[0],void 0,!0).getTime(),i=Math.min(t,v.selectedDates[0].getTime()),o=Math.max(t,v.selectedDates[0].getTime()),r=!1,l=0,c=0,s=i;s<o;s+=x.DAY)ie(new Date(s),!0)||(r=r||s>i&&s<o,s<a&&(!l||s>l)?l=s:s>a&&(!c||s<c)&&(c=s));Array.from(v.rContainer.querySelectorAll("*:nth-child(-n+"+v.config.showMonths+") > ."+n)).forEach((function(n){var i=n.dateObj.getTime(),o=l>0&&i<l||c>0&&i>c;if(o)return n.classList.add("notAllowed"),void["inRange","startRange","endRange"].forEach((function(e){n.classList.remove(e)}));r&&!o||(["startRange","inRange","endRange","notAllowed"].forEach((function(e){n.classList.remove(e)})),void 0!==e&&(e.classList.add(t<=v.selectedDates[0].getTime()?"startRange":"endRange"),a<t&&i===a?n.classList.add("startRange"):a>t&&i===a&&n.classList.add("endRange"),i>=l&&(0===c||i<=c)&&C(i,a,t)&&n.classList.add("inRange")))}))}}function se(){!v.isOpen||v.config.static||v.config.inline||me()}function de(e){return function(n){var t=v.config["_"+e+"Date"]=v.parseDate(n,v.config.dateFormat),a=v.config["_"+("min"===e?"max":"min")+"Date"];void 0!==t&&(v["min"===e?"minDateHasTime":"maxDateHasTime"]=t.getHours()>0||t.getMinutes()>0||t.getSeconds()>0),v.selectedDates&&(v.selectedDates=v.selectedDates.filter((function(e){return ie(e)})),v.selectedDates.length||"min"!==e||P(t),ke()),v.daysContainer&&(ge(),void 0!==t?v.currentYearElement[e]=t.getFullYear().toString():v.currentYearElement.removeAttribute(e),v.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function ue(){return v.config.wrap?m.querySelector("[data-input]"):m}function fe(){"object"!=typeof v.config.locale&&void 0===O.l10ns[v.config.locale]&&v.config.errorHandler(new Error("flatpickr: invalid locale "+v.config.locale)),v.l10n=k(k({},O.l10ns.default),"object"==typeof v.config.locale?v.config.locale:"default"!==v.config.locale?O.l10ns[v.config.locale]:void 0),h.D="("+v.l10n.weekdays.shorthand.join("|")+")",h.l="("+v.l10n.weekdays.longhand.join("|")+")",h.M="("+v.l10n.months.shorthand.join("|")+")",h.F="("+v.l10n.months.longhand.join("|")+")",h.K="("+v.l10n.amPM[0]+"|"+v.l10n.amPM[1]+"|"+v.l10n.amPM[0].toLowerCase()+"|"+v.l10n.amPM[1].toLowerCase()+")",void 0===k(k({},p),JSON.parse(JSON.stringify(m.dataset||{}))).time_24hr&&void 0===O.defaultConfig.time_24hr&&(v.config.time_24hr=v.l10n.time_24hr),v.formatDate=D(v),v.parseDate=w({config:v.config,l10n:v.l10n})}function me(e){if("function"!=typeof v.config.position){if(void 0!==v.calendarContainer){Ce("onPreCalendarPosition");var n=e||v._positionElement,t=Array.prototype.reduce.call(v.calendarContainer.children,(function(e,n){return e+n.offsetHeight}),0),a=v.calendarContainer.offsetWidth,i=v.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,c=n.getBoundingClientRect(),s=window.innerHeight-c.bottom,d="above"===o||"below"!==o&&s<t&&c.top>t,u=window.pageYOffset+c.top+(d?-t-2:n.offsetHeight+2);if(l(v.calendarContainer,"arrowTop",!d),l(v.calendarContainer,"arrowBottom",d),!v.config.inline){var f=window.pageXOffset+c.left,m=!1,g=!1;"center"===r?(f-=(a-c.width)/2,m=!0):"right"===r&&(f-=a-c.width,g=!0),l(v.calendarContainer,"arrowLeft",!m&&!g),l(v.calendarContainer,"arrowCenter",m),l(v.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+c.right),h=f+a>window.document.body.offsetWidth,D=p+a>window.document.body.offsetWidth;if(l(v.calendarContainer,"rightMost",h),!v.config.static)if(v.calendarContainer.style.top=u+"px",h)if(D){var w=function(){for(var e=null,n=0;n<document.styleSheets.length;n++){var t=document.styleSheets[n];if(t.cssRules){try{t.cssRules}catch(e){continue}e=t;break}}return null!=e?e:(a=document.createElement("style"),document.head.appendChild(a),a.sheet);var a}();if(void 0===w)return;var b=window.document.body.offsetWidth,C=Math.max(0,b/2-a/2),M=w.cssRules.length,y="{left:"+c.left+"px;right:auto;}";l(v.calendarContainer,"rightMost",!1),l(v.calendarContainer,"centerMost",!0),w.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+y,M),v.calendarContainer.style.left=C+"px",v.calendarContainer.style.right="auto"}else v.calendarContainer.style.left="auto",v.calendarContainer.style.right=p+"px";else v.calendarContainer.style.left=f+"px",v.calendarContainer.style.right="auto"}}}else v.config.position(v,e)}function ge(){v.config.noCalendar||v.isMobile||(z(),xe(),V())}function pe(){v._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(v.close,0):v.close()}function he(e){e.preventDefault(),e.stopPropagation();var n=d(f(e),(function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")}));if(void 0!==n){var t=n,a=v.latestSelectedDateObj=new Date(t.dateObj.getTime()),i=(a.getMonth()<v.currentMonth||a.getMonth()>v.currentMonth+v.config.showMonths-1)&&"range"!==v.config.mode;if(v.selectedDateElem=t,"single"===v.config.mode)v.selectedDates=[a];else if("multiple"===v.config.mode){var o=ye(a);o?v.selectedDates.splice(parseInt(o),1):v.selectedDates.push(a)}else"range"===v.config.mode&&(2===v.selectedDates.length&&v.clear(!1,!1),v.latestSelectedDateObj=a,v.selectedDates.push(a),0!==b(a,v.selectedDates[0],!0)&&v.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()})));if(N(),i){var r=v.currentYear!==a.getFullYear();v.currentYear=a.getFullYear(),v.currentMonth=a.getMonth(),r&&(Ce("onYearChange"),z()),Ce("onMonthChange")}if(xe(),V(),ke(),i||"range"===v.config.mode||1!==v.config.showMonths?void 0!==v.selectedDateElem&&void 0===v.hourElement&&v.selectedDateElem&&v.selectedDateElem.focus():K(t),void 0!==v.hourElement&&void 0!==v.hourElement&&v.hourElement.focus(),v.config.closeOnSelect){var l="single"===v.config.mode&&!v.config.enableTime,c="range"===v.config.mode&&2===v.selectedDates.length&&!v.config.enableTime;(l||c)&&pe()}L()}}v.parseDate=w({config:v.config,l10n:v.l10n}),v._handlers=[],v.pluginElements=[],v.loadedPlugins=[],v._bind=H,v._setHoursFromDate=P,v._positionCalendar=me,v.changeMonth=ee,v.changeYear=ae,v.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);v.input.value="",void 0!==v.altInput&&(v.altInput.value="");void 0!==v.mobileInput&&(v.mobileInput.value="");v.selectedDates=[],v.latestSelectedDateObj=void 0,!0===n&&(v.currentYear=v._initialDate.getFullYear(),v.currentMonth=v._initialDate.getMonth());if(!0===v.config.enableTime){var t=E(v.config);Y(t.hours,t.minutes,t.seconds)}v.redraw(),e&&Ce("onChange")},v.close=function(){v.isOpen=!1,v.isMobile||(void 0!==v.calendarContainer&&v.calendarContainer.classList.remove("open"),void 0!==v._input&&v._input.classList.remove("active"));Ce("onClose")},v.onMouseOver=ce,v._createElement=c,v.createDay=J,v.destroy=function(){void 0!==v.config&&Ce("onDestroy");for(var e=v._handlers.length;e--;)v._handlers[e].remove();if(v._handlers=[],v.mobileInput)v.mobileInput.parentNode&&v.mobileInput.parentNode.removeChild(v.mobileInput),v.mobileInput=void 0;else if(v.calendarContainer&&v.calendarContainer.parentNode)if(v.config.static&&v.calendarContainer.parentNode){var n=v.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else v.calendarContainer.parentNode.removeChild(v.calendarContainer);v.altInput&&(v.input.type="text",v.altInput.parentNode&&v.altInput.parentNode.removeChild(v.altInput),delete v.altInput);v.input&&(v.input.type=v.input._type,v.input.classList.remove("flatpickr-input"),v.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete v[e]}catch(e){}}))},v.isEnabled=ie,v.jumpToDate=R,v.updateValue=ke,v.open=function(e,n){void 0===n&&(n=v._positionElement);if(!0===v.isMobile){if(e){e.preventDefault();var t=f(e);t&&t.blur()}return void 0!==v.mobileInput&&(v.mobileInput.focus(),v.mobileInput.click()),void Ce("onOpen")}if(v._input.disabled||v.config.inline)return;var a=v.isOpen;v.isOpen=!0,a||(v.calendarContainer.classList.add("open"),v._input.classList.add("active"),Ce("onOpen"),me(n));!0===v.config.enableTime&&!0===v.config.noCalendar&&(!1!==v.config.allowInput||void 0!==e&&v.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return v.hourElement.select()}),50))},v.redraw=ge,v.set=function(n,t){if(null!==n&&"object"==typeof n)for(var a in Object.assign(v.config,n),n)void 0!==ve[a]&&ve[a].forEach((function(e){return e()}));else v.config[n]=t,void 0!==ve[n]?ve[n].forEach((function(e){return e()})):e.indexOf(n)>-1&&(v.config[n]=r(t));v.redraw(),ke(!0)},v.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=v.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return v.clear(n);De(e,t),v.latestSelectedDateObj=v.selectedDates[v.selectedDates.length-1],v.redraw(),R(void 0,n),P(),0===v.selectedDates.length&&v.clear(!1);ke(n),n&&Ce("onChange")},v.toggle=function(e){if(!0===v.isOpen)return v.close();v.open(e)};var ve={locale:[fe,X],showMonths:[Z,F,Q],minDate:[R],maxDate:[R],positionElement:[be],clickOpens:[function(){!0===v.config.clickOpens?(H(v._input,"focus",v.open),H(v._input,"click",v.open)):(v._input.removeEventListener("focus",v.open),v._input.removeEventListener("click",v.open))}]};function De(e,n){var t=[];if(e instanceof Array)t=e.map((function(e){return v.parseDate(e,n)}));else if(e instanceof Date||"number"==typeof e)t=[v.parseDate(e,n)];else if("string"==typeof e)switch(v.config.mode){case"single":case"time":t=[v.parseDate(e,n)];break;case"multiple":t=e.split(v.config.conjunction).map((function(e){return v.parseDate(e,n)}));break;case"range":t=e.split(v.l10n.rangeSeparator).map((function(e){return v.parseDate(e,n)}))}else v.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));v.selectedDates=v.config.allowInvalidPreload?t:t.filter((function(e){return e instanceof Date&&ie(e,!1)})),"range"===v.config.mode&&v.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()}))}function we(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?v.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:v.parseDate(e.from,void 0),to:v.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function be(){v._positionElement=v.config.positionElement||v._input}function Ce(e,n){if(void 0!==v.config){var t=v.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a<t.length;a++)t[a](v.selectedDates,v.input.value,v,n);"onChange"===e&&(v.input.dispatchEvent(Me("change")),v.input.dispatchEvent(Me("input")))}}function Me(e){var n=document.createEvent("Event");return n.initEvent(e,!0,!0),n}function ye(e){for(var n=0;n<v.selectedDates.length;n++){var t=v.selectedDates[n];if(t instanceof Date&&0===b(t,e))return""+n}return!1}function xe(){v.config.noCalendar||v.isMobile||!v.monthNav||(v.yearElements.forEach((function(e,n){var t=new Date(v.currentYear,v.currentMonth,1);t.setMonth(v.currentMonth+n),v.config.showMonths>1||"static"===v.config.monthSelectorType?v.monthElements[n].textContent=g(t.getMonth(),v.config.shorthandCurrentMonth,v.l10n)+" ":v.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()})),v._hidePrevMonthArrow=void 0!==v.config.minDate&&(v.currentYear===v.config.minDate.getFullYear()?v.currentMonth<=v.config.minDate.getMonth():v.currentYear<v.config.minDate.getFullYear()),v._hideNextMonthArrow=void 0!==v.config.maxDate&&(v.currentYear===v.config.maxDate.getFullYear()?v.currentMonth+1>v.config.maxDate.getMonth():v.currentYear>v.config.maxDate.getFullYear()))}function Ee(e){var n=e||(v.config.altInput?v.config.altFormat:v.config.dateFormat);return v.selectedDates.map((function(e){return v.formatDate(e,n)})).filter((function(e,n,t){return"range"!==v.config.mode||v.config.enableTime||t.indexOf(e)===n})).join("range"!==v.config.mode?v.config.conjunction:v.l10n.rangeSeparator)}function ke(e){void 0===e&&(e=!0),void 0!==v.mobileInput&&v.mobileFormatStr&&(v.mobileInput.value=void 0!==v.latestSelectedDateObj?v.formatDate(v.latestSelectedDateObj,v.mobileFormatStr):""),v.input.value=Ee(v.config.dateFormat),void 0!==v.altInput&&(v.altInput.value=Ee(v.config.altFormat)),!1!==e&&Ce("onValueUpdate")}function Te(e){var n=f(e),t=v.prevMonthNav.contains(n),a=v.nextMonthNav.contains(n);t||a?ee(t?-1:1):v.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?v.changeYear(v.currentYear+1):n.classList.contains("arrowDown")&&v.changeYear(v.currentYear-1)}return function(){v.element=v.input=m,v.isOpen=!1,function(){var t=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],a=k(k({},JSON.parse(JSON.stringify(m.dataset||{}))),p),i={};v.config.parseDate=a.parseDate,v.config.formatDate=a.formatDate,Object.defineProperty(v.config,"enable",{get:function(){return v.config._enable},set:function(e){v.config._enable=we(e)}}),Object.defineProperty(v.config,"disable",{get:function(){return v.config._disable},set:function(e){v.config._disable=we(e)}});var o="time"===a.mode;if(!a.dateFormat&&(a.enableTime||o)){var l=O.defaultConfig.dateFormat||n.dateFormat;i.dateFormat=a.noCalendar||o?"H:i"+(a.enableSeconds?":S":""):l+" H:i"+(a.enableSeconds?":S":"")}if(a.altInput&&(a.enableTime||o)&&!a.altFormat){var c=O.defaultConfig.altFormat||n.altFormat;i.altFormat=a.noCalendar||o?"h:i"+(a.enableSeconds?":S K":" K"):c+" h:i"+(a.enableSeconds?":S":"")+" K"}Object.defineProperty(v.config,"minDate",{get:function(){return v.config._minDate},set:de("min")}),Object.defineProperty(v.config,"maxDate",{get:function(){return v.config._maxDate},set:de("max")});var s=function(e){return function(n){v.config["min"===e?"_minTime":"_maxTime"]=v.parseDate(n,"H:i:S")}};Object.defineProperty(v.config,"minTime",{get:function(){return v.config._minTime},set:s("min")}),Object.defineProperty(v.config,"maxTime",{get:function(){return v.config._maxTime},set:s("max")}),"time"===a.mode&&(v.config.noCalendar=!0,v.config.enableTime=!0);Object.assign(v.config,i,a);for(var d=0;d<t.length;d++)v.config[t[d]]=!0===v.config[t[d]]||"true"===v.config[t[d]];e.filter((function(e){return void 0!==v.config[e]})).forEach((function(e){v.config[e]=r(v.config[e]||[]).map(_)})),v.isMobile=!v.config.disableMobile&&!v.config.inline&&"single"===v.config.mode&&!v.config.disable.length&&!v.config.enable&&!v.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(d=0;d<v.config.plugins.length;d++){var u=v.config.plugins[d](v)||{};for(var f in u)e.indexOf(f)>-1?v.config[f]=r(u[f]).map(_).concat(v.config[f]):void 0===a[f]&&(v.config[f]=u[f])}a.altInputClass||(v.config.altInputClass=ue().className+" "+v.config.altInputClass);Ce("onParseConfig")}(),fe(),function(){if(v.input=ue(),!v.input)return void v.config.errorHandler(new Error("Invalid input element specified"));v.input._type=v.input.type,v.input.type="text",v.input.classList.add("flatpickr-input"),v._input=v.input,v.config.altInput&&(v.altInput=c(v.input.nodeName,v.config.altInputClass),v._input=v.altInput,v.altInput.placeholder=v.input.placeholder,v.altInput.disabled=v.input.disabled,v.altInput.required=v.input.required,v.altInput.tabIndex=v.input.tabIndex,v.altInput.type="text",v.input.setAttribute("type","hidden"),!v.config.static&&v.input.parentNode&&v.input.parentNode.insertBefore(v.altInput,v.input.nextSibling));v.config.allowInput||v._input.setAttribute("readonly","readonly");be()}(),function(){v.selectedDates=[],v.now=v.parseDate(v.config.now)||new Date;var e=v.config.defaultDate||("INPUT"!==v.input.nodeName&&"TEXTAREA"!==v.input.nodeName||!v.input.placeholder||v.input.value!==v.input.placeholder?v.input.value:null);e&&De(e,v.config.dateFormat);v._initialDate=v.selectedDates.length>0?v.selectedDates[0]:v.config.minDate&&v.config.minDate.getTime()>v.now.getTime()?v.config.minDate:v.config.maxDate&&v.config.maxDate.getTime()<v.now.getTime()?v.config.maxDate:v.now,v.currentYear=v._initialDate.getFullYear(),v.currentMonth=v._initialDate.getMonth(),v.selectedDates.length>0&&(v.latestSelectedDateObj=v.selectedDates[0]);void 0!==v.config.minTime&&(v.config.minTime=v.parseDate(v.config.minTime,"H:i"));void 0!==v.config.maxTime&&(v.config.maxTime=v.parseDate(v.config.maxTime,"H:i"));v.minDateHasTime=!!v.config.minDate&&(v.config.minDate.getHours()>0||v.config.minDate.getMinutes()>0||v.config.minDate.getSeconds()>0),v.maxDateHasTime=!!v.config.maxDate&&(v.config.maxDate.getHours()>0||v.config.maxDate.getMinutes()>0||v.config.maxDate.getSeconds()>0)}(),v.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=v.currentMonth),void 0===n&&(n=v.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:v.l10n.daysInMonth[e]}},v.isMobile||function(){var e=window.document.createDocumentFragment();if(v.calendarContainer=c("div","flatpickr-calendar"),v.calendarContainer.tabIndex=-1,!v.config.noCalendar){if(e.appendChild((v.monthNav=c("div","flatpickr-months"),v.yearElements=[],v.monthElements=[],v.prevMonthNav=c("span","flatpickr-prev-month"),v.prevMonthNav.innerHTML=v.config.prevArrow,v.nextMonthNav=c("span","flatpickr-next-month"),v.nextMonthNav.innerHTML=v.config.nextArrow,Z(),Object.defineProperty(v,"_hidePrevMonthArrow",{get:function(){return v.__hidePrevMonthArrow},set:function(e){v.__hidePrevMonthArrow!==e&&(l(v.prevMonthNav,"flatpickr-disabled",e),v.__hidePrevMonthArrow=e)}}),Object.defineProperty(v,"_hideNextMonthArrow",{get:function(){return v.__hideNextMonthArrow},set:function(e){v.__hideNextMonthArrow!==e&&(l(v.nextMonthNav,"flatpickr-disabled",e),v.__hideNextMonthArrow=e)}}),v.currentYearElement=v.yearElements[0],xe(),v.monthNav)),v.innerContainer=c("div","flatpickr-innerContainer"),v.config.weekNumbers){var n=function(){v.calendarContainer.classList.add("hasWeeks");var e=c("div","flatpickr-weekwrapper");e.appendChild(c("span","flatpickr-weekday",v.l10n.weekAbbreviation));var n=c("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,o=n.weekNumbers;v.innerContainer.appendChild(t),v.weekNumbers=o,v.weekWrapper=t}v.rContainer=c("div","flatpickr-rContainer"),v.rContainer.appendChild(Q()),v.daysContainer||(v.daysContainer=c("div","flatpickr-days"),v.daysContainer.tabIndex=-1),V(),v.rContainer.appendChild(v.daysContainer),v.innerContainer.appendChild(v.rContainer),e.appendChild(v.innerContainer)}v.config.enableTime&&e.appendChild(function(){v.calendarContainer.classList.add("hasTime"),v.config.noCalendar&&v.calendarContainer.classList.add("noCalendar");var e=E(v.config);v.timeContainer=c("div","flatpickr-time"),v.timeContainer.tabIndex=-1;var n=c("span","flatpickr-time-separator",":"),t=u("flatpickr-hour",{"aria-label":v.l10n.hourAriaLabel});v.hourElement=t.getElementsByTagName("input")[0];var o=u("flatpickr-minute",{"aria-label":v.l10n.minuteAriaLabel});v.minuteElement=o.getElementsByTagName("input")[0],v.hourElement.tabIndex=v.minuteElement.tabIndex=-1,v.hourElement.value=a(v.latestSelectedDateObj?v.latestSelectedDateObj.getHours():v.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),v.minuteElement.value=a(v.latestSelectedDateObj?v.latestSelectedDateObj.getMinutes():e.minutes),v.hourElement.setAttribute("step",v.config.hourIncrement.toString()),v.minuteElement.setAttribute("step",v.config.minuteIncrement.toString()),v.hourElement.setAttribute("min",v.config.time_24hr?"0":"1"),v.hourElement.setAttribute("max",v.config.time_24hr?"23":"12"),v.hourElement.setAttribute("maxlength","2"),v.minuteElement.setAttribute("min","0"),v.minuteElement.setAttribute("max","59"),v.minuteElement.setAttribute("maxlength","2"),v.timeContainer.appendChild(t),v.timeContainer.appendChild(n),v.timeContainer.appendChild(o),v.config.time_24hr&&v.timeContainer.classList.add("time24hr");if(v.config.enableSeconds){v.timeContainer.classList.add("hasSeconds");var r=u("flatpickr-second");v.secondElement=r.getElementsByTagName("input")[0],v.secondElement.value=a(v.latestSelectedDateObj?v.latestSelectedDateObj.getSeconds():e.seconds),v.secondElement.setAttribute("step",v.minuteElement.getAttribute("step")),v.secondElement.setAttribute("min","0"),v.secondElement.setAttribute("max","59"),v.secondElement.setAttribute("maxlength","2"),v.timeContainer.appendChild(c("span","flatpickr-time-separator",":")),v.timeContainer.appendChild(r)}v.config.time_24hr||(v.amPM=c("span","flatpickr-am-pm",v.l10n.amPM[i((v.latestSelectedDateObj?v.hourElement.value:v.config.defaultHour)>11)]),v.amPM.title=v.l10n.toggleTitle,v.amPM.tabIndex=-1,v.timeContainer.appendChild(v.amPM));return v.timeContainer}());l(v.calendarContainer,"rangeMode","range"===v.config.mode),l(v.calendarContainer,"animate",!0===v.config.animate),l(v.calendarContainer,"multiMonth",v.config.showMonths>1),v.calendarContainer.appendChild(e);var r=void 0!==v.config.appendTo&&void 0!==v.config.appendTo.nodeType;if((v.config.inline||v.config.static)&&(v.calendarContainer.classList.add(v.config.inline?"inline":"static"),v.config.inline&&(!r&&v.element.parentNode?v.element.parentNode.insertBefore(v.calendarContainer,v._input.nextSibling):void 0!==v.config.appendTo&&v.config.appendTo.appendChild(v.calendarContainer)),v.config.static)){var s=c("div","flatpickr-wrapper");v.element.parentNode&&v.element.parentNode.insertBefore(s,v.element),s.appendChild(v.element),v.altInput&&s.appendChild(v.altInput),s.appendChild(v.calendarContainer)}v.config.static||v.config.inline||(void 0!==v.config.appendTo?v.config.appendTo:window.document.body).appendChild(v.calendarContainer)}(),function(){v.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(v.element.querySelectorAll("[data-"+e+"]"),(function(n){return H(n,"click",v[e])}))}));if(v.isMobile)return void function(){var e=v.config.enableTime?v.config.noCalendar?"time":"datetime-local":"date";v.mobileInput=c("input",v.input.className+" flatpickr-mobile"),v.mobileInput.tabIndex=1,v.mobileInput.type=e,v.mobileInput.disabled=v.input.disabled,v.mobileInput.required=v.input.required,v.mobileInput.placeholder=v.input.placeholder,v.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",v.selectedDates.length>0&&(v.mobileInput.defaultValue=v.mobileInput.value=v.formatDate(v.selectedDates[0],v.mobileFormatStr));v.config.minDate&&(v.mobileInput.min=v.formatDate(v.config.minDate,"Y-m-d"));v.config.maxDate&&(v.mobileInput.max=v.formatDate(v.config.maxDate,"Y-m-d"));v.input.getAttribute("step")&&(v.mobileInput.step=String(v.input.getAttribute("step")));v.input.type="hidden",void 0!==v.altInput&&(v.altInput.type="hidden");try{v.input.parentNode&&v.input.parentNode.insertBefore(v.mobileInput,v.input.nextSibling)}catch(e){}H(v.mobileInput,"change",(function(e){v.setDate(f(e).value,!1,v.mobileFormatStr),Ce("onChange"),Ce("onClose")}))}();var e=o(se,50);v._debouncedChange=o(L,I),v.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&H(v.daysContainer,"mouseover",(function(e){"range"===v.config.mode&&ce(f(e))}));H(v._input,"keydown",le),void 0!==v.calendarContainer&&H(v.calendarContainer,"keydown",le);v.config.inline||v.config.static||H(window,"resize",e);void 0!==window.ontouchstart?H(window.document,"touchstart",te):H(window.document,"mousedown",te);H(window.document,"focus",te,{capture:!0}),!0===v.config.clickOpens&&(H(v._input,"focus",v.open),H(v._input,"click",v.open));void 0!==v.daysContainer&&(H(v.monthNav,"click",Te),H(v.monthNav,["keyup","increment"],j),H(v.daysContainer,"click",he));if(void 0!==v.timeContainer&&void 0!==v.minuteElement&&void 0!==v.hourElement){var n=function(e){return f(e).select()};H(v.timeContainer,["increment"],A),H(v.timeContainer,"blur",A,{capture:!0}),H(v.timeContainer,"click",W),H([v.hourElement,v.minuteElement],["focus","click"],n),void 0!==v.secondElement&&H(v.secondElement,"focus",(function(){return v.secondElement&&v.secondElement.select()})),void 0!==v.amPM&&H(v.amPM,"click",(function(e){A(e)}))}v.config.allowInput&&H(v._input,"blur",re)}(),(v.selectedDates.length||v.config.noCalendar)&&(v.config.enableTime&&P(v.config.noCalendar?v.latestSelectedDateObj:void 0),ke(!1)),F();var t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!v.isMobile&&t&&me(),Ce("onReady")}(),v}function _(e,n){for(var t=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],i=0;i<t.length;i++){var o=t[i];try{if(null!==o.getAttribute("data-fp-omit"))continue;void 0!==o._flatpickr&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=S(o,n||{}),a.push(o._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return _(this,e)},HTMLElement.prototype.flatpickr=function(e){return _([this],e)});var O=function(e,n){return"string"==typeof e?_(window.document.querySelectorAll(e),n):e instanceof Node?_([e],n):_(e,n)};O.defaultConfig={},O.l10ns={en:k({},t),default:k({},t)},O.localize=function(e){O.l10ns.default=k(k({},O.l10ns.default),e)},O.setDefaults=function(e){O.defaultConfig=k(k({},O.defaultConfig),e)},O.parseDate=w({}),O.formatDate=D({}),O.compareDates=b,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return _(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=O);export{O as default};