diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2880860eb..647076757 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,12 +14,20 @@ jobs: node-version: '16.x' registry-url: 'https://registry.npmjs.org' - run: npm ci -# - run: npm publish -# env: -# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.6 + with: + nuget-version: '6.x' - name: Pack NuGet - run: nuget pack **\*.nuspec -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath $env:SourcesPath + working-directory: ./src/nuget + run: | + nuget pack TempusDominus.nuspec -Verbosity detailed -NonInteractive -NoPackageAnalysis + nuget pack TempusDominus.scss.nuspec -Verbosity detailed -NonInteractive -NoPackageAnalysis - name: Push Nuget - run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} + working-directory: ./src/nuget + run: | + nuget push TempusDominus.*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NPM_TOKEN }} + nuget push TempusDominus.scss.*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NPM_TOKEN } diff --git a/README.md b/README.md index 324088290..6c2eb0146 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Rate on Openbase](https://badges.openbase.com/js/rating/@eonasdan/tempus-dominus.svg)](https://openbase.com/js/@eonasdan/tempus-dominus?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge) -# Tempus Dominus Date/Time Picker v6.0.0-beta10 +# Tempus Dominus Date/Time Picker v6.0.0 Tempus Dominus is a powerful and robust date time picker for javascript. Version 6 is another major rewrite over the previous version. V6 is written with modern browsers in mind and is written in typescript. Bootstrap, momentjs and jQuery are no longer required dependencies. Popper2 is all that is required for the picker to position correctly. If you still require jQuery (seriously, you should move off that asap) there's a jQuery provider that wraps the native js functions. diff --git a/dist/js/jQuery-provider.js b/dist/js/jQuery-provider.js index 86debde82..c6e313431 100644 --- a/dist/js/jQuery-provider.js +++ b/dist/js/jQuery-provider.js @@ -2,7 +2,7 @@ /*global $, tempusDominus */ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2021 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/js/jQuery-provider.min.js b/dist/js/jQuery-provider.min.js index 3e8a47f81..1542b0ca0 100644 --- a/dist/js/jQuery-provider.min.js +++ b/dist/js/jQuery-provider.min.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2021 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/js/tempus-dominus.esm.js b/dist/js/tempus-dominus.esm.js index 930518948..39f2bcf86 100644 --- a/dist/js/tempus-dominus.esm.js +++ b/dist/js/tempus-dominus.esm.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ @@ -3865,7 +3865,7 @@ const extend = function (plugin, option) { } return tempusDominus; }; -const version = '6.0.0-beta10'; +const version = '6.0.0'; const tempusDominus = { TempusDominus, extend, diff --git a/dist/js/tempus-dominus.esm.min.js b/dist/js/tempus-dominus.esm.min.js index 52b37c9e9..e76e8f078 100644 --- a/dist/js/tempus-dominus.esm.min.js +++ b/dist/js/tempus-dominus.esm.min.js @@ -1,6 +1,6 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ -import{createPopper as t}from"@popperjs/core";var e;!function(t){t.seconds="seconds",t.minutes="minutes",t.hours="hours",t.date="date",t.month="month",t.year="year"}(e||(e={}));const s={month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0},i={hour:"2-digit",hour12:!1},o=t=>{switch(t){case"date":return{dateStyle:"short"};case"month":return{month:"numeric",year:"numeric"};case"year":return{year:"numeric"}}};class a extends Date{constructor(){super(...arguments),this.locale="default",this.nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],this.leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335]}setLocale(t){return this.locale=t,this}static convert(t,e="default"){if(!t)throw new Error("A date is required");return new a(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).setLocale(e)}static fromString(t,e){return new a(t)}get clone(){return new a(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.getMilliseconds()).setLocale(this.locale)}startOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(0);break;case"minutes":this.setSeconds(0,0);break;case"hours":this.setMinutes(0,0,0);break;case"date":this.setHours(0,0,0,0);break;case"weekDay":if(this.startOf(e.date),this.weekDay===s)break;let t=this.weekDay;0!==s&&0===this.weekDay&&(t=8-s),this.manipulate(s-t,e.date);break;case"month":this.startOf(e.date),this.setDate(1);break;case"year":this.startOf(e.date),this.setMonth(0,1)}return this}endOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(999);break;case"minutes":this.setSeconds(59,999);break;case"hours":this.setMinutes(59,59,999);break;case"date":this.setHours(23,59,59,999);break;case"weekDay":this.endOf(e.date),this.manipulate(6+s-this.weekDay,e.date);break;case"month":this.endOf(e.date),this.manipulate(1,e.month),this.setDate(0);break;case"year":this.endOf(e.date),this.manipulate(1,e.year),this.setDate(0)}return this}manipulate(t,e){if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this[e]+=t,this}format(t,e=this.locale){return new Intl.DateTimeFormat(e,t).format(this)}isBefore(t,e){if(!e)return this.valueOf()t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this.clone.startOf(e).valueOf()>t.clone.startOf(e).valueOf()}isSame(t,e){if(!e)return this.valueOf()===t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return t=a.convert(t),this.clone.startOf(e).valueOf()===t.startOf(e).valueOf()}isBetween(t,e,s,i="()"){if(s&&void 0===this[s])throw new Error(`Unit '${s}' is not valid`);const o="("===i[0],a=")"===i[1];return(o?this.isAfter(t,s):!this.isBefore(t,s))&&(a?this.isBefore(e,s):!this.isAfter(e,s))||(o?this.isBefore(t,s):!this.isAfter(t,s))&&(a?this.isAfter(e,s):!this.isBefore(e,s))}parts(t=this.locale,e={dateStyle:"full",timeStyle:"long"}){const s={};return new Intl.DateTimeFormat(t,e).formatToParts(this).filter((t=>"literal"!==t.type)).forEach((t=>s[t.type]=t.value)),s}get seconds(){return this.getSeconds()}set seconds(t){this.setSeconds(t)}get secondsFormatted(){return this.parts(void 0,s).second}get minutes(){return this.getMinutes()}set minutes(t){this.setMinutes(t)}get minutesFormatted(){return this.parts(void 0,s).minute}get hours(){return this.getHours()}set hours(t){this.setHours(t)}get hoursFormatted(){return this.parts(void 0,i).hour}get twelveHoursFormatted(){return this.parts(void 0,s).hour}meridiem(t=this.locale){var e;return null===(e=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(this).find((t=>"dayPeriod"===t.type)))||void 0===e?void 0:e.value}get date(){return this.getDate()}set date(t){this.setDate(t)}get dateFormatted(){return this.parts(void 0,s).day}get weekDay(){return this.getDay()}get month(){return this.getMonth()}set month(t){const e=new Date(this.year,t+1);e.setDate(0);const s=e.getDate();this.date>s&&(this.date=s),this.setMonth(t)}get monthFormatted(){return this.parts(void 0,s).month}get year(){return this.getFullYear()}set year(t){this.setFullYear(t)}get week(){const t=this.computeOrdinal(),e=this.getUTCDay();let s=Math.floor((t-e+10)/7);return s<1?s=this.weeksInWeekYear(this.year-1):s>this.weeksInWeekYear(this.year)&&(s=1),s}weeksInWeekYear(t){const e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,s=t-1,i=(s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400))%7;return 4===e||3===i?53:52}get isLeapYear(){return this.year%4==0&&(this.year%100!=0||this.year%400==0)}computeOrdinal(){return this.date+(this.isLeapYear?this.leapLadder:this.nonLeapLadder)[this.month]}}class n extends Error{}class r{constructor(){this.base="TD:",this.failedToSetInvalidDate="Failed to set invalid date",this.failedToParseInput="Failed parse input field"}unexpectedOption(t){const e=new n(`${this.base} Unexpected option: ${t} does not match a known option.`);throw e.code=1,e}unexpectedOptions(t){const e=new n(`${this.base}: ${t.join(", ")}`);throw e.code=1,e}unexpectedOptionValue(t,e,s){const i=new n(`${this.base} Unexpected option value: ${t} does not accept a value of "${e}". Valid values are: ${s.join(", ")}`);throw i.code=2,i}typeMismatch(t,e,s){const i=new n(`${this.base} Mismatch types: ${t} has a type of ${e} instead of the required ${s}`);throw i.code=3,i}numbersOutOfRage(t,e,s){const i=new n(`${this.base} ${t} expected an array of number between ${e} and ${s}.`);throw i.code=4,i}failedToParseDate(t,e,s=!1){const i=new n(`${this.base} Could not correctly parse "${e}" to a date for ${t}.`);if(i.code=5,!s)throw i;console.warn(i)}mustProvideElement(){const t=new n(`${this.base} No element was provided.`);throw t.code=6,t}subscribeMismatch(){const t=new n(`${this.base} The subscribed events does not match the number of callbacks`);throw t.code=7,t}conflictingConfiguration(t){const e=new n(`${this.base} A configuration value conflicts with another rule. ${t}`);throw e.code=8,e}customDateFormatError(t){const e=new n(`${this.base} customDateFormat: ${t}`);throw e.code=9,e}dateString(){console.warn(`${this.base} Using a string for date options is not recommended unless you specify an ISO string or use the customDateFormat plugin.`)}throwError(t){const e=new n(`${this.base} ${t}`);throw e.code=9,e}}const d="tempus-dominus";class l{}l.NAME=d,l.dataKey="td",l.events=new class{constructor(){this.key=".td",this.change=`change${this.key}`,this.update=`update${this.key}`,this.error=`error${this.key}`,this.show=`show${this.key}`,this.hide=`hide${this.key}`,this.blur=`blur${this.key}`,this.focus=`focus${this.key}`,this.keyup=`keyup${this.key}`,this.keydown=`keydown${this.key}`}},l.css=new class{constructor(){this.widget=`${d}-widget`,this.calendarHeader="calendar-header",this.switch="picker-switch",this.toolbar="toolbar",this.noHighlight="no-highlight",this.sideBySide="timepicker-sbs",this.previous="previous",this.next="next",this.disabled="disabled",this.old="old",this.new="new",this.active="active",this.dateContainer="date-container",this.decadesContainer=`${this.dateContainer}-decades`,this.decade="decade",this.yearsContainer=`${this.dateContainer}-years`,this.year="year",this.monthsContainer=`${this.dateContainer}-months`,this.month="month",this.daysContainer=`${this.dateContainer}-days`,this.day="day",this.calendarWeeks="cw",this.dayOfTheWeek="dow",this.today="today",this.weekend="weekend",this.timeContainer="time-container",this.separator="separator",this.clockContainer=`${this.timeContainer}-clock`,this.hourContainer=`${this.timeContainer}-hour`,this.minuteContainer=`${this.timeContainer}-minute`,this.secondContainer=`${this.timeContainer}-second`,this.hour="hour",this.minute="minute",this.second="second",this.toggleMeridiem="toggleMeridiem",this.show="show",this.collapsing="td-collapsing",this.collapse="td-collapse",this.inline="inline",this.lightTheme="light",this.darkTheme="dark",this.isDarkPreferredQuery="(prefers-color-scheme: dark)"}},l.errorMessages=new r;class c{constructor(){this.cache=new Map}locate(t){const e=this.cache.get(t);if(e)return e;const s=new t;return this.cache.set(t,s),s}}let h;const p=[{name:"calendar",className:l.css.daysContainer,unit:e.month,step:1},{name:"months",className:l.css.monthsContainer,unit:e.year,step:1},{name:"years",className:l.css.yearsContainer,unit:e.year,step:10},{name:"decades",className:l.css.decadesContainer,unit:e.year,step:100}];class u{constructor(){this.viewDate=new a,this._currentCalendarViewMode=0,this.minimumCalendarViewMode=0,this.currentView="calendar"}get currentCalendarViewMode(){return this._currentCalendarViewMode}set currentCalendarViewMode(t){this._currentCalendarViewMode=t,this.currentView=p[t].name}refreshCurrentView(){this.currentView=p[this.currentCalendarViewMode].name}}class m{constructor(){this.optionsStore=h.locate(u)}isValid(t,s){var i;if(this.optionsStore.options.restrictions.disabledDates.length>0&&this._isInDisabledDates(t))return!1;if(this.optionsStore.options.restrictions.enabledDates.length>0&&!this._isInEnabledDates(t))return!1;if(s!==e.month&&s!==e.year&&(null===(i=this.optionsStore.options.restrictions.daysOfWeekDisabled)||void 0===i?void 0:i.length)>0&&-1!==this.optionsStore.options.restrictions.daysOfWeekDisabled.indexOf(t.weekDay))return!1;if(this.optionsStore.options.restrictions.minDate&&t.isBefore(this.optionsStore.options.restrictions.minDate,s))return!1;if(this.optionsStore.options.restrictions.maxDate&&t.isAfter(this.optionsStore.options.restrictions.maxDate,s))return!1;if(s===e.hours||s===e.minutes||s===e.seconds){if(this.optionsStore.options.restrictions.disabledHours.length>0&&this._isInDisabledHours(t))return!1;if(this.optionsStore.options.restrictions.enabledHours.length>0&&!this._isInEnabledHours(t))return!1;if(this.optionsStore.options.restrictions.disabledTimeIntervals.length>0)for(let e of this.optionsStore.options.restrictions.disabledTimeIntervals)if(t.isBetween(e.from,e.to))return!1}return!0}_isInDisabledDates(t){if(!this.optionsStore.options.restrictions.disabledDates||0===this.optionsStore.options.restrictions.disabledDates.length)return!1;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.disabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInEnabledDates(t){if(!this.optionsStore.options.restrictions.enabledDates||0===this.optionsStore.options.restrictions.enabledDates.length)return!0;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.enabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInDisabledHours(t){if(!this.optionsStore.options.restrictions.disabledHours||0===this.optionsStore.options.restrictions.disabledHours.length)return!1;const e=t.hours;return this.optionsStore.options.restrictions.disabledHours.find((t=>t===e))}_isInEnabledHours(t){if(!this.optionsStore.options.restrictions.enabledHours||0===this.optionsStore.options.restrictions.enabledHours.length)return!0;const e=t.hours;return this.optionsStore.options.restrictions.enabledHours.find((t=>t===e))}}class y{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),this.unsubscribe.bind(this,this.subscribers.length-1)}unsubscribe(t){this.subscribers.splice(t,1)}emit(t){this.subscribers.forEach((e=>{e(t)}))}destroy(){this.subscribers=null,this.subscribers=[]}}class v{constructor(){this.triggerEvent=new y,this.viewUpdate=new y,this.updateDisplay=new y,this.action=new y}destroy(){this.triggerEvent.destroy(),this.viewUpdate.destroy(),this.updateDisplay.destroy(),this.action.destroy()}}const g={restrictions:{minDate:void 0,maxDate:void 0,disabledDates:[],enabledDates:[],daysOfWeekDisabled:[],disabledTimeIntervals:[],disabledHours:[],enabledHours:[]},display:{icons:{type:"icons",time:"fa-solid fa-clock",date:"fa-solid fa-calendar",up:"fa-solid fa-arrow-up",down:"fa-solid fa-arrow-down",previous:"fa-solid fa-chevron-left",next:"fa-solid fa-chevron-right",today:"fa-solid fa-calendar-check",clear:"fa-solid fa-trash",close:"fa-solid fa-xmark"},sideBySide:!1,calendarWeeks:!1,viewMode:"calendar",toolbarPlacement:"bottom",keepOpen:!1,buttons:{today:!1,clear:!1,close:!1},components:{calendar:!0,date:!0,month:!0,year:!0,decades:!0,clock:!0,hours:!0,minutes:!0,seconds:!1,useTwentyfourHour:void 0},inline:!1,theme:"auto"},stepping:1,useCurrent:!0,defaultDate:void 0,localization:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",previousMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",previousYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",previousDecade:"Previous Decade",nextDecade:"Next Decade",previousCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",toggleMeridiem:"Toggle Meridiem",selectTime:"Select Time",selectDate:"Select Date",dayViewHeaderFormat:{month:"long",year:"2-digit"},locale:"default",startOfTheWeek:0,dateFormats:{LTS:"h:mm:ss T",LT:"h:mm T",L:"MM/dd/yyyy",LL:"MMMM d, yyyy",LLL:"MMMM d, yyyy h:mm T",LLLL:"dddd, MMMM d, yyyy h:mm T"},ordinal:t=>t,format:"L"},keepInvalid:!1,debug:!1,allowInputToggle:!1,viewDate:new a,multipleDates:!1,multipleDatesSeparator:"; ",promptTimeOnDateChange:!1,promptTimeOnDateChangeTransitionDelay:200,meta:{},container:void 0};class S{static deepCopy(t){const e={};return Object.keys(t).forEach((s=>{const i=t[s];e[s]=i,"object"!=typeof i||i instanceof HTMLElement||i instanceof Element||i instanceof Date||Array.isArray(i)||(e[s]=S.deepCopy(i))})),e}static objectPath(t,e){return"."===t.charAt(0)&&(t=t.slice(1)),t?t.split(".").reduce(((t,e)=>S.isValue(t)||S.isValue(t[e])?t[e]:void 0),e):e}static spread(t,e,s="",i){const o=S.objectPath(s,g),a=Object.keys(t).filter((t=>!Object.keys(o).includes(t)));if(a.length>0){const t=S.getFlattenDefaultOptions(),e=a.map((e=>{let i=`"${s}.${e}" in not a known option.`,o=t.find((t=>t.includes(e)));return o&&(i+=` Did you mean "${o}"?`),i}));l.errorMessages.unexpectedOptions(e)}Object.keys(t).filter((t=>"__proto__"!==t&&"constructor"!==t)).forEach((a=>{"."===(s+=`.${a}`).charAt(0)&&(s=s.slice(1));const n=o[a];let r=typeof t[a],d=typeof n,l=t[a];if(null==l)return e[a]=l,void(s=s.substring(0,s.lastIndexOf(`.${a}`)));"object"!=typeof n||Array.isArray(t[a])||n instanceof Date||S.ignoreProperties.includes(a)?e[a]=S.processKey(a,l,r,d,s,i):S.spread(t[a],e[a],s,i),s=s.substring(0,s.lastIndexOf(`.${a}`))}))}static processKey(t,e,s,i,o,a){switch(t){case"defaultDate":{const t=this.dateConversion(e,"defaultDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("defaultDate",s,"DateTime or Date");break}case"viewDate":{const t=this.dateConversion(e,"viewDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("viewDate",s,"DateTime or Date");break}case"minDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.minDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.minDate",s,"DateTime or Date");break}case"maxDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.maxDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.maxDate",s,"DateTime or Date");break}case"disabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.disabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.disabledHours",0,23),e);case"enabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.enabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.enabledHours",0,23),e);case"daysOfWeekDisabled":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.daysOfWeekDisabled",e,s),e.filter((t=>t<0||t>6)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.daysOfWeekDisabled",0,6),e);case"enabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.enabledDates",e,s,a),e);case"disabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.disabledDates",e,s,a),e);case"disabledTimeIntervals":if(void 0===e)return[];Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of { from: DateTime|Date, to: DateTime|Date }");const n=e;for(let e=0;e{const i=`${t}[${e}].${s}`;let o=n[e][s];const r=this.dateConversion(o,i,a);r||l.errorMessages.typeMismatch(i,typeof o,"DateTime or Date"),r.setLocale(a.locale),n[e][s]=r}));return n;case"toolbarPlacement":case"type":case"viewMode":case"theme":const r={toolbarPlacement:["top","bottom","default"],type:["icons","sprites"],viewMode:["clock","calendar","months","years","decades"],theme:["light","dark","auto"]}[t];return r.includes(e)||l.errorMessages.unexpectedOptionValue(o.substring(1),e,r),e;case"meta":case"dayViewHeaderFormat":return e;case"container":return e&&!(e instanceof HTMLElement||e instanceof Element||(null==e?void 0:e.appendChild))&&l.errorMessages.typeMismatch(o.substring(1),typeof e,"HTMLElement"),e;case"useTwentyfourHour":if(void 0===e||"boolean"===s)return e;l.errorMessages.typeMismatch(o,s,i);break;default:switch(i){case"boolean":return"true"===e||!0===e;case"number":return+e;case"string":return e.toString();case"object":return{};case"function":return e;default:l.errorMessages.typeMismatch(o,s,i)}}}static _mergeOptions(t,e){var s;const i=S.deepCopy(e),o="default"!==(null===(s=e.localization)||void 0===s?void 0:s.locale)?e.localization:(null==t?void 0:t.localization)||g.localization;return S.spread(t,i,"",o),i}static _dataToOptions(t,e){const s=JSON.parse(JSON.stringify(t.dataset));if((null==s?void 0:s.tdTargetInput)&&delete s.tdTargetInput,(null==s?void 0:s.tdTargetToggle)&&delete s.tdTargetToggle,!s||0===Object.keys(s).length||s.constructor!==DOMStringMap)return e;let i={};const o=t=>{const e={};return Object.keys(t).forEach((t=>{e[t.toLowerCase()]=t})),e},a=(t,e,s,i)=>{const n=o(s)[t[e].toLowerCase()],r={};return void 0===n||(s[n].constructor===Object?(e++,r[n]=a(t,e,s[n],i)):r[n]=i),r},n=o(e);return Object.keys(s).filter((t=>t.startsWith(l.dataKey))).map((t=>t.substring(2))).forEach((t=>{let o=n[t.toLowerCase()];if(t.includes("_")){const r=t.split("_");o=n[r[0].toLowerCase()],void 0!==o&&e[o].constructor===Object&&(i[o]=a(r,1,e[o],s[`td${t}`]))}else void 0!==o&&(i[o]=s[`td${t}`])})),this._mergeOptions(i,e)}static _dateTypeCheck(t,e){if(t.constructor.name===a.name)return t;if(t.constructor.name===Date.name)return a.convert(t);if("string"==typeof t){const s=a.fromString(t,e);return"null"===JSON.stringify(s)?null:s}return null}static _typeCheckDateArray(t,e,s,i){var o;Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of DateTime or Date");for(let s=0;s"number"!=typeof t))||l.errorMessages.typeMismatch(t,s,"array of numbers")}static dateConversion(t,e,s){"string"==typeof t&&"input"!==e&&l.errorMessages.dateString();const i=this._dateTypeCheck(t,s);return i||l.errorMessages.failedToParseDate(e,t,"input"===e),i}static getFlattenDefaultOptions(){if(this._flattenDefaults)return this._flattenDefaults;const t=(e,s=[])=>Array.isArray(e)?[]:Object(e)===e?Object.entries(e).flatMap((([e,i])=>t(i,[...s,e]))):s.join(".");return this._flattenDefaults=t(g),this._flattenDefaults}static _validateConflicts(t){!t.display.sideBySide||t.display.components.clock&&(t.display.components.hours||t.display.components.minutes||t.display.components.seconds)||l.errorMessages.conflictingConfiguration("Cannot use side by side mode without the clock components"),t.restrictions.minDate&&t.restrictions.maxDate&&(t.restrictions.minDate.isAfter(t.restrictions.maxDate)&&l.errorMessages.conflictingConfiguration("minDate is after maxDate"),t.restrictions.maxDate.isBefore(t.restrictions.minDate)&&l.errorMessages.conflictingConfiguration("maxDate is before minDate"))}}S.ignoreProperties=["meta","dayViewHeaderFormat","container","dateForms","ordinal"],S.isValue=t=>null!=t;class w{constructor(){this._dates=[],this.optionsStore=h.locate(u),this.validation=h.locate(m),this._eventEmitters=h.locate(v)}get picked(){return this._dates}get lastPicked(){return this._dates[this.lastPickedIndex]}get lastPickedIndex(){return 0===this._dates.length?0:this._dates.length-1}formatInput(t){const e=this.optionsStore.options.display.components;return t?t.format({year:e.calendar&&e.year?"numeric":void 0,month:e.calendar&&e.month?"2-digit":void 0,day:e.calendar&&e.date?"2-digit":void 0,hour:e.clock&&e.hours?e.useTwentyfourHour?"2-digit":"numeric":void 0,minute:e.clock&&e.minutes?"2-digit":void 0,second:e.clock&&e.seconds?"2-digit":void 0,hour12:!e.useTwentyfourHour}):""}parseInput(t){return S.dateConversion(t,"input",this.optionsStore.options.localization)}setFromInput(t,e){if(!t)return void this.setValue(void 0,e);const s=this.parseInput(t);s&&(s.setLocale(this.optionsStore.options.localization.locale),this.setValue(s,e))}add(t){this._dates.push(t)}isPicked(t,e){if(!e)return void 0!==this._dates.find((e=>e===t));const s=o(e);let i=t.format(s);return void 0!==this._dates.map((t=>t.format(s))).find((t=>t===i))}pickedIndex(t,e){if(!e)return this._dates.indexOf(t);const s=o(e);let i=t.format(s);return this._dates.map((t=>t.format(s))).indexOf(i)}clear(){this.optionsStore.unset=!0,this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:this.lastPicked,isClear:!0,isValid:!0}),this._dates=[]}static getStartEndYear(t,e){const s=t/10,i=Math.floor(e/t)*t;return[i,i+9*s,Math.floor(e/s)*s]}setValue(t,e){const s=void 0===e,i=!t&&s;let o=this.optionsStore.unset?null:this._dates[e];!o&&!this.optionsStore.unset&&s&&i&&(o=this.lastPicked);const a=()=>{if(!this.optionsStore.input)return;let e=this.formatInput(t);this.optionsStore.options.multipleDates&&(e=this._dates.map((t=>this.formatInput(t))).join(this.optionsStore.options.multipleDatesSeparator)),this.optionsStore.input.value!=e&&(this.optionsStore.input.value=e)};if(t&&(null==o?void 0:o.isSame(t)))a();else{if(!t)return!this.optionsStore.options.multipleDates||1===this._dates.length||i?(this.optionsStore.unset=!0,this._dates=[]):this._dates.splice(e,1),a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:o,isClear:i,isValid:!0}),void this._eventEmitters.updateDisplay.emit("all");if(e=e||0,t=t.clone,1!==this.optionsStore.options.stepping&&(t.minutes=Math.round(t.minutes/this.optionsStore.options.stepping)*this.optionsStore.options.stepping,t.seconds=0),this.validation.isValid(t))return this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this.optionsStore.unset=!1,this._eventEmitters.updateDisplay.emit("all"),void this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!0});this.optionsStore.options.keepInvalid&&(this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!1})),this._eventEmitters.triggerEvent.emit({type:l.events.error,reason:l.errorMessages.failedToSetInvalidDate,date:t,oldDate:o})}}}var b;!function(t){t.next="next",t.previous="previous",t.changeCalendarView="changeCalendarView",t.selectMonth="selectMonth",t.selectYear="selectYear",t.selectDecade="selectDecade",t.selectDay="selectDay",t.selectHour="selectHour",t.selectMinute="selectMinute",t.selectSecond="selectSecond",t.incrementHours="incrementHours",t.incrementMinutes="incrementMinutes",t.incrementSeconds="incrementSeconds",t.decrementHours="decrementHours",t.decrementMinutes="decrementMinutes",t.decrementSeconds="decrementSeconds",t.toggleMeridiem="toggleMeridiem",t.togglePicker="togglePicker",t.showClock="showClock",t.showHours="showHours",t.showMinutes="showMinutes",t.showSeconds="showSeconds",t.clear="clear",t.close="close",t.today="today"}(b||(b={}));var f=b;class D{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");if(t.classList.add(l.css.daysContainer),t.append(...this._daysOfTheWeek()),this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}for(let e=0;e<42;e++){if(0!==e&&e%7==0&&this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}const s=document.createElement("div");s.setAttribute("data-action",f.selectDay),t.appendChild(s)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.daysContainer)[0];if("calendar"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.daysContainer,this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)),this.optionsStore.options.display.components.month?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.month),e.month)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.month),e.month)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.month).startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).manipulate(12,e.hours);i.querySelectorAll(`[data-action="${f.selectDay}"], .${l.css.calendarWeeks}`).forEach((t=>{if(this.optionsStore.options.display.calendarWeeks&&t.classList.contains(l.css.calendarWeeks)){if("#"===t.innerText)return;return void(t.innerText=`${o.week}`)}let i=[];i.push(l.css.day),o.isBefore(this.optionsStore.viewDate,e.month)&&i.push(l.css.old),o.isAfter(this.optionsStore.viewDate,e.month)&&i.push(l.css.new),!this.optionsStore.unset&&this.dates.isPicked(o,e.date)&&i.push(l.css.active),this.validation.isValid(o,e.date)||i.push(l.css.disabled),o.isSame(new a,e.date)&&i.push(l.css.today),0!==o.weekDay&&6!==o.weekDay||i.push(l.css.weekend),s(e.date,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}-${o.monthFormatted}-${o.dateFormatted}`),t.setAttribute("data-day",`${o.date}`),t.innerText=o.format({day:"numeric"}),o.manipulate(1,e.date)}))}_daysOfTheWeek(){let t=this.optionsStore.viewDate.clone.startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).startOf(e.date);const s=[];if(document.createElement("div"),this.optionsStore.options.display.calendarWeeks){const t=document.createElement("div");t.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.innerText="#",s.push(t)}for(let i=0;i<7;i++){const i=document.createElement("div");i.classList.add(l.css.dayOfTheWeek,l.css.noHighlight),i.innerText=t.format({weekday:"short"}),t.manipulate(1,e.date),s.push(i)}return s}}class k{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.monthsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectMonth),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.monthsContainer)[0];if("months"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.monthsContainer,this.optionsStore.viewDate.format({year:"numeric"})),this.optionsStore.options.display.components.year?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.year),e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.year),e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year);i.querySelectorAll(`[data-action="${f.selectMonth}"]`).forEach(((t,i)=>{let a=[];a.push(l.css.month),!this.optionsStore.unset&&this.dates.isPicked(o,e.month)&&a.push(l.css.active),this.validation.isValid(o,e.month)||a.push(l.css.disabled),s(e.month,o,a,t),t.classList.remove(...t.classList),t.classList.add(...a),t.setAttribute("data-value",`${i}`),t.innerText=`${o.format({month:"short"})}`,o.manipulate(1,e.month)}))}}class _{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.yearsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectYear),t.appendChild(e)}return t}_update(t,s){this._startYear=this.optionsStore.viewDate.clone.manipulate(-1,e.year),this._endYear=this.optionsStore.viewDate.clone.manipulate(10,e.year);const i=t.getElementsByClassName(l.css.yearsContainer)[0];if("years"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.yearsContainer,`${this._startYear.format({year:"numeric"})}-${this._endYear.format({year:"numeric"})}`),this.optionsStore.options.display.components.decades?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this._startYear,e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this._endYear,e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year).manipulate(-1,e.year);i.querySelectorAll(`[data-action="${f.selectYear}"]`).forEach((t=>{let i=[];i.push(l.css.year),!this.optionsStore.unset&&this.dates.isPicked(o,e.year)&&i.push(l.css.active),this.validation.isValid(o,e.year)||i.push(l.css.disabled),s(e.year,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}`),t.innerText=o.format({year:"numeric"}),o.manipulate(1,e.year)}))}}class C{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.decadesContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectDecade),t.appendChild(e)}return t}_update(t,s){const[i,o]=w.getStartEndYear(100,this.optionsStore.viewDate.year);this._startDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._startDecade.year=i,this._endDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._endDecade.year=o;const a=t.getElementsByClassName(l.css.decadesContainer)[0],[n,r,d]=a.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");"decades"===this.optionsStore.currentView&&(r.setAttribute(l.css.decadesContainer,`${this._startDecade.format({year:"numeric"})}-${this._endDecade.format({year:"numeric"})}`),this.validation.isValid(this._startDecade,e.year)?n.classList.remove(l.css.disabled):n.classList.add(l.css.disabled),this.validation.isValid(this._endDecade,e.year)?d.classList.remove(l.css.disabled):d.classList.add(l.css.disabled));const c=this.dates.picked.map((t=>t.year));a.querySelectorAll(`[data-action="${f.selectDecade}"]`).forEach(((t,i)=>{if(0===i)return t.classList.add(l.css.old),this._startDecade.year-10<0?(t.textContent=" ",n.classList.add(l.css.disabled),t.classList.add(l.css.disabled),void t.setAttribute("data-value","")):(t.innerText=this._startDecade.clone.manipulate(-10,e.year).format({year:"numeric"}),void t.setAttribute("data-value",`${this._startDecade.year}`));let o=[];o.push(l.css.decade);const a=this._startDecade.year,r=this._startDecade.year+9;!this.optionsStore.unset&&c.filter((t=>t>=a&&t<=r)).length>0&&o.push(l.css.active),s("decade",this._startDecade,o,t),t.classList.remove(...t.classList),t.classList.add(...o),t.setAttribute("data-value",`${this._startDecade.year}`),t.innerText=`${this._startDecade.format({year:"numeric"})}`,this._startDecade.manipulate(10,e.year)}))}}class E{constructor(){this._gridColumns="",this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(t){const e=document.createElement("div");return e.classList.add(l.css.clockContainer),e.append(...this._grid(t)),e}_update(t){const s=t.getElementsByClassName(l.css.clockContainer)[0],i=(this.dates.lastPicked||this.optionsStore.viewDate).clone;if(s.querySelectorAll(".disabled").forEach((t=>t.classList.remove(l.css.disabled))),this.optionsStore.options.display.components.hours&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.hours),e.hours)||s.querySelector(`[data-action=${f.incrementHours}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.hours),e.hours)||s.querySelector(`[data-action=${f.decrementHours}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.hours}]`).innerText=this.optionsStore.options.display.components.useTwentyfourHour?i.hoursFormatted:i.twelveHoursFormatted),this.optionsStore.options.display.components.minutes&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.minutes),e.minutes)||s.querySelector(`[data-action=${f.incrementMinutes}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.minutes),e.minutes)||s.querySelector(`[data-action=${f.decrementMinutes}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.minutes}]`).innerText=i.minutesFormatted),this.optionsStore.options.display.components.seconds&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.seconds),e.seconds)||s.querySelector(`[data-action=${f.incrementSeconds}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.seconds),e.seconds)||s.querySelector(`[data-action=${f.decrementSeconds}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.seconds}]`).innerText=i.secondsFormatted),!this.optionsStore.options.display.components.useTwentyfourHour){const t=s.querySelector(`[data-action=${f.toggleMeridiem}]`);t.innerText=i.meridiem(),this.validation.isValid(i.clone.manipulate(i.hours>=12?-12:12,e.hours))?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled)}s.style.gridTemplateAreas=`"${this._gridColumns}"`}_grid(t){this._gridColumns="";const s=[],i=[],o=[],a=document.createElement("div"),n=t(this.optionsStore.options.display.icons.up),r=t(this.optionsStore.options.display.icons.down);a.classList.add(l.css.separator,l.css.noHighlight);const d=a.cloneNode(!0);d.innerHTML=":";const c=(t=!1)=>t?d.cloneNode(!0):a.cloneNode(!0);if(this.optionsStore.options.display.components.hours){let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementHour),t.setAttribute("data-action",f.incrementHours),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickHour),t.setAttribute("data-action",f.showHours),t.setAttribute("data-time-component",e.hours),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementHour),t.setAttribute("data-action",f.decrementHours),t.appendChild(r.cloneNode(!0)),o.push(t),this._gridColumns+="a"}if(this.optionsStore.options.display.components.minutes){this._gridColumns+=" a",this.optionsStore.options.display.components.hours&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementMinute),t.setAttribute("data-action",f.incrementMinutes),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickMinute),t.setAttribute("data-action",f.showMinutes),t.setAttribute("data-time-component",e.minutes),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementMinute),t.setAttribute("data-action",f.decrementMinutes),t.appendChild(r.cloneNode(!0)),o.push(t)}if(this.optionsStore.options.display.components.seconds){this._gridColumns+=" a",this.optionsStore.options.display.components.minutes&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementSecond),t.setAttribute("data-action",f.incrementSeconds),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickSecond),t.setAttribute("data-action",f.showSeconds),t.setAttribute("data-time-component",e.seconds),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementSecond),t.setAttribute("data-action",f.decrementSeconds),t.appendChild(r.cloneNode(!0)),o.push(t)}if(!this.optionsStore.options.display.components.useTwentyfourHour){this._gridColumns+=" a";let t=c();s.push(t);let e=document.createElement("button");e.setAttribute("title",this.optionsStore.options.localization.toggleMeridiem),e.setAttribute("data-action",f.toggleMeridiem),e.setAttribute("tabindex","-1"),l.css.toggleMeridiem.includes(",")?e.classList.add(...l.css.toggleMeridiem.split(",")):e.classList.add(l.css.toggleMeridiem),t=document.createElement("div"),t.classList.add(l.css.noHighlight),t.appendChild(e),i.push(t),t=c(),o.push(t)}return this._gridColumns=this._gridColumns.trim(),[...s,...i,...o]}}class M{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.hourContainer);for(let e=0;e<(this.optionsStore.options.display.components.useTwentyfourHour?24:12);e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectHour),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.hourContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.date);i.querySelectorAll(`[data-action="${f.selectHour}"]`).forEach((t=>{let i=[];i.push(l.css.hour),this.validation.isValid(o,e.hours)||i.push(l.css.disabled),s(e.hours,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.hours}`),t.innerText=this.optionsStore.options.display.components.useTwentyfourHour?o.hoursFormatted:o.twelveHoursFormatted,o.manipulate(1,e.hours)}))}}class L{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.minuteContainer);let e=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;for(let s=0;s<60/e;s++){const e=document.createElement("div");e.setAttribute("data-action",f.selectMinute),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.minuteContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.hours),a=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;i.querySelectorAll(`[data-action="${f.selectMinute}"]`).forEach((t=>{let i=[];i.push(l.css.minute),this.validation.isValid(o,e.minutes)||i.push(l.css.disabled),s(e.minutes,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.minutes}`),t.innerText=o.minutesFormatted,o.manipulate(a,e.minutes)}))}}class T{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.secondContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectSecond),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.secondContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.minutes);i.querySelectorAll(`[data-action="${f.selectSecond}"]`).forEach((t=>{let i=[];i.push(l.css.second),this.validation.isValid(o,e.seconds)||i.push(l.css.disabled),s(e.seconds,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.seconds}`),t.innerText=o.secondsFormatted,o.manipulate(5,e.seconds)}))}}class A{static toggle(t){t.classList.contains(l.css.show)?this.hide(t):this.show(t)}static showImmediately(t){t.classList.remove(l.css.collapsing),t.classList.add(l.css.collapse,l.css.show),t.style.height=""}static show(t){if(t.classList.contains(l.css.collapsing)||t.classList.contains(l.css.show))return;t.style.height="0",t.classList.remove(l.css.collapse),t.classList.add(l.css.collapsing),setTimeout((()=>{A.showImmediately(t)}),this.getTransitionDurationFromElement(t)),t.style.height=`${t.scrollHeight}px`}static hideImmediately(t){t&&(t.classList.remove(l.css.collapsing,l.css.show),t.classList.add(l.css.collapse))}static hide(t){if(t.classList.contains(l.css.collapsing)||!t.classList.contains(l.css.show))return;t.style.height=`${t.getBoundingClientRect().height}px`;t.offsetHeight,t.classList.remove(l.css.collapse,l.css.show),t.classList.add(l.css.collapsing),t.style.height="",setTimeout((()=>{A.hideImmediately(t)}),this.getTransitionDurationFromElement(t))}}A.getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e),o=Number.parseFloat(s);return i||o?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0};class ${constructor(){this._isVisible=!1,this._documentClickEvent=t=>{var e;this.optionsStore.options.debug||window.debug||!this._isVisible||t.composedPath().includes(this.widget)||(null===(e=t.composedPath())||void 0===e?void 0:e.includes(this.optionsStore.element))||this.hide()},this._actionsClickEvent=t=>{this._eventEmitters.action.emit({e:t})},this.optionsStore=h.locate(u),this.validation=h.locate(m),this.dates=h.locate(w),this.dateDisplay=h.locate(D),this.monthDisplay=h.locate(k),this.yearDisplay=h.locate(_),this.decadeDisplay=h.locate(C),this.timeDisplay=h.locate(E),this.hourDisplay=h.locate(M),this.minuteDisplay=h.locate(L),this.secondDisplay=h.locate(T),this._eventEmitters=h.locate(v),this._widget=void 0,this._eventEmitters.updateDisplay.subscribe((t=>{this._update(t)}))}get widget(){return this._widget}get isVisible(){return this._isVisible}_update(t){if(this.widget)switch(t){case e.seconds:this.secondDisplay._update(this.widget,this.paint);break;case e.minutes:this.minuteDisplay._update(this.widget,this.paint);break;case e.hours:this.hourDisplay._update(this.widget,this.paint);break;case e.date:this.dateDisplay._update(this.widget,this.paint);break;case e.month:this.monthDisplay._update(this.widget,this.paint);break;case e.year:this.yearDisplay._update(this.widget,this.paint);break;case"clock":if(!this._hasTime)break;this.timeDisplay._update(this.widget),this._update(e.hours),this._update(e.minutes),this._update(e.seconds);break;case"calendar":this._update(e.date),this._update(e.year),this._update(e.month),this.decadeDisplay._update(this.widget,this.paint),this._updateCalendarHeader();break;case"all":this._hasTime&&this._update("clock"),this._hasDate&&this._update("calendar")}}paint(t,e,s,i){}show(){var s,i;if(null==this.widget){if(0==this.dates.picked.length){if(this.optionsStore.options.useCurrent&&!this.optionsStore.options.defaultDate){const t=(new a).setLocale(this.optionsStore.options.localization.locale);if(!this.optionsStore.options.keepInvalid){let i=0,o=1;for((null===(s=this.optionsStore.options.restrictions.maxDate)||void 0===s?void 0:s.isBefore(t))&&(o=-1);!(this.validation.isValid(t)||(t.manipulate(o,e.date),i>31));)i++}this.dates.setValue(t)}this.optionsStore.options.defaultDate&&this.dates.setValue(this.optionsStore.options.defaultDate)}this._buildWidget(),this._updateTheme();const o=this._hasTime&&!this._hasDate;if(o&&(this.optionsStore.currentView="clock",this._eventEmitters.action.emit({e:null,action:f.showClock})),this.optionsStore.currentCalendarViewMode||(this.optionsStore.currentCalendarViewMode=this.optionsStore.minimumCalendarViewMode),o||"clock"===this.optionsStore.options.display.viewMode||(this._hasTime&&(this.optionsStore.options.display.sideBySide?A.show(this.widget.querySelector(`div.${l.css.timeContainer}`)):A.hideImmediately(this.widget.querySelector(`div.${l.css.timeContainer}`))),A.show(this.widget.querySelector(`div.${l.css.dateContainer}`))),this._hasDate&&this._showMode(),this.optionsStore.options.display.inline)this.optionsStore.element.appendChild(this.widget);else{((null===(i=this.optionsStore.options)||void 0===i?void 0:i.container)||document.body).appendChild(this.widget),this._popperInstance=t(this.optionsStore.element,this.widget,{modifiers:[{name:"eventListeners",enabled:!0}],placement:"rtl"===document.documentElement.dir?"bottom-end":"bottom-start"})}"clock"==this.optionsStore.options.display.viewMode&&this._eventEmitters.action.emit({e:null,action:f.showClock}),this.widget.querySelectorAll("[data-action]").forEach((t=>t.addEventListener("click",this._actionsClickEvent))),this._hasTime&&this.optionsStore.options.display.sideBySide&&(this.timeDisplay._update(this.widget),this.widget.getElementsByClassName(l.css.clockContainer)[0].style.display="grid")}this.widget.classList.add(l.css.show),this.optionsStore.options.display.inline||(this._popperInstance.update(),document.addEventListener("click",this._documentClickEvent)),this._eventEmitters.triggerEvent.emit({type:l.events.show}),this._isVisible=!0}_showMode(t){if(!this.widget)return;if(t){const e=Math.max(this.optionsStore.minimumCalendarViewMode,Math.min(3,this.optionsStore.currentCalendarViewMode+t));if(this.optionsStore.currentCalendarViewMode==e)return;this.optionsStore.currentCalendarViewMode=e}this.widget.querySelectorAll(`.${l.css.dateContainer} > div:not(.${l.css.calendarHeader}), .${l.css.timeContainer} > div:not(.${l.css.clockContainer})`).forEach((t=>t.style.display="none"));const e=p[this.optionsStore.currentCalendarViewMode];let s=this.widget.querySelector(`.${e.className}`);switch(e.className){case l.css.decadesContainer:this.decadeDisplay._update(this.widget,this.paint);break;case l.css.yearsContainer:this.yearDisplay._update(this.widget,this.paint);break;case l.css.monthsContainer:this.monthDisplay._update(this.widget,this.paint);break;case l.css.daysContainer:this.dateDisplay._update(this.widget,this.paint)}s.style.display="grid",this._updateCalendarHeader(),this._eventEmitters.viewUpdate.emit()}_updateTheme(t){if(this.widget){if(t){if(this.optionsStore.options.display.theme===t)return;this.optionsStore.options.display.theme=t}this.widget.classList.remove("light","dark"),this.widget.classList.add(this._getThemeClass()),"auto"===this.optionsStore.options.display.theme?window.matchMedia(l.css.isDarkPreferredQuery).addEventListener("change",(()=>this._updateTheme())):window.matchMedia(l.css.isDarkPreferredQuery).removeEventListener("change",(()=>this._updateTheme()))}}_getThemeClass(){const t=this.optionsStore.options.display.theme||"auto",e=window.matchMedia&&window.matchMedia(l.css.isDarkPreferredQuery).matches;switch(t){case"light":return l.css.lightTheme;case"dark":return l.css.darkTheme;case"auto":return e?l.css.darkTheme:l.css.lightTheme}}_updateCalendarHeader(){const t=[...this.widget.querySelector(`.${l.css.dateContainer} div[style*="display: grid"]`).classList].find((t=>t.startsWith(l.css.dateContainer))),[e,s,i]=this.widget.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");switch(t){case l.css.decadesContainer:e.setAttribute("title",this.optionsStore.options.localization.previousCentury),s.setAttribute("title",""),i.setAttribute("title",this.optionsStore.options.localization.nextCentury);break;case l.css.yearsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousDecade),s.setAttribute("title",this.optionsStore.options.localization.selectDecade),i.setAttribute("title",this.optionsStore.options.localization.nextDecade);break;case l.css.monthsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousYear),s.setAttribute("title",this.optionsStore.options.localization.selectYear),i.setAttribute("title",this.optionsStore.options.localization.nextYear);break;case l.css.daysContainer:e.setAttribute("title",this.optionsStore.options.localization.previousMonth),s.setAttribute("title",this.optionsStore.options.localization.selectMonth),i.setAttribute("title",this.optionsStore.options.localization.nextMonth),s.innerText=this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)}s.innerText=s.getAttribute(t)}hide(){this.widget&&this._isVisible&&(this.widget.classList.remove(l.css.show),this._isVisible&&(this._eventEmitters.triggerEvent.emit({type:l.events.hide,date:this.optionsStore.unset?null:this.dates.lastPicked?this.dates.lastPicked.clone:void 0}),this._isVisible=!1),document.removeEventListener("click",this._documentClickEvent))}toggle(){return this._isVisible?this.hide():this.show()}_dispose(){document.removeEventListener("click",this._documentClickEvent),this.widget&&(this.widget.querySelectorAll("[data-action]").forEach((t=>t.removeEventListener("click",this._actionsClickEvent))),this.widget.parentNode.removeChild(this.widget),this._widget=void 0)}_buildWidget(){const t=document.createElement("div");t.classList.add(l.css.widget);const e=document.createElement("div");e.classList.add(l.css.dateContainer),e.append(this.getHeadTemplate(),this.decadeDisplay.getPicker(),this.yearDisplay.getPicker(),this.monthDisplay.getPicker(),this.dateDisplay.getPicker());const s=document.createElement("div");s.classList.add(l.css.timeContainer),s.appendChild(this.timeDisplay.getPicker(this._iconTag.bind(this))),s.appendChild(this.hourDisplay.getPicker()),s.appendChild(this.minuteDisplay.getPicker()),s.appendChild(this.secondDisplay.getPicker());const i=document.createElement("div");if(i.classList.add(l.css.toolbar),i.append(...this.getToolbarElements()),this.optionsStore.options.display.inline&&t.classList.add(l.css.inline),this.optionsStore.options.display.calendarWeeks&&t.classList.add("calendarWeeks"),this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){t.classList.add(l.css.sideBySide),"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");return o.classList.add("td-row"),e.classList.add("td-half"),s.classList.add("td-half"),o.appendChild(e),o.appendChild(s),t.appendChild(o),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),void(this._widget=t)}"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),this._hasDate&&(this._hasTime&&(e.classList.add(l.css.collapse),"clock"!==this.optionsStore.options.display.viewMode&&e.classList.add(l.css.show)),t.appendChild(e)),this._hasTime&&(this._hasDate&&(s.classList.add(l.css.collapse),"clock"===this.optionsStore.options.display.viewMode&&s.classList.add(l.css.show)),t.appendChild(s)),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");o.classList.add("arrow"),o.setAttribute("data-popper-arrow",""),t.appendChild(o),this._widget=t}get _hasTime(){return this.optionsStore.options.display.components.clock&&(this.optionsStore.options.display.components.hours||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.components.seconds)}get _hasDate(){return this.optionsStore.options.display.components.calendar&&(this.optionsStore.options.display.components.year||this.optionsStore.options.display.components.month||this.optionsStore.options.display.components.date)}getToolbarElements(){const t=[];if(this.optionsStore.options.display.buttons.today){const e=document.createElement("div");e.setAttribute("data-action",f.today),e.setAttribute("title",this.optionsStore.options.localization.today),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.today)),t.push(e)}if(!this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){let e,s;"clock"===this.optionsStore.options.display.viewMode?(e=this.optionsStore.options.localization.selectDate,s=this.optionsStore.options.display.icons.date):(e=this.optionsStore.options.localization.selectTime,s=this.optionsStore.options.display.icons.time);const i=document.createElement("div");i.setAttribute("data-action",f.togglePicker),i.setAttribute("title",e),i.appendChild(this._iconTag(s)),t.push(i)}if(this.optionsStore.options.display.buttons.clear){const e=document.createElement("div");e.setAttribute("data-action",f.clear),e.setAttribute("title",this.optionsStore.options.localization.clear),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.clear)),t.push(e)}if(this.optionsStore.options.display.buttons.close){const e=document.createElement("div");e.setAttribute("data-action",f.close),e.setAttribute("title",this.optionsStore.options.localization.close),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.close)),t.push(e)}return t}getHeadTemplate(){const t=document.createElement("div");t.classList.add(l.css.calendarHeader);const e=document.createElement("div");e.classList.add(l.css.previous),e.setAttribute("data-action",f.previous),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.previous));const s=document.createElement("div");s.classList.add(l.css.switch),s.setAttribute("data-action",f.changeCalendarView);const i=document.createElement("div");return i.classList.add(l.css.next),i.setAttribute("data-action",f.next),i.appendChild(this._iconTag(this.optionsStore.options.display.icons.next)),t.append(e,s,i),t}_iconTag(t){if("sprites"===this.optionsStore.options.display.icons.type){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("xlink:href",t),s.setAttribute("href",t),e.appendChild(s),e}const e=document.createElement("i");return e.classList.add(...t.split(" ")),e}_rebuild(){const t=this._isVisible;t&&this.hide(),this._dispose(),t&&this.show()}}class O{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m),this.display=h.locate($),this._eventEmitters=h.locate(v),this._eventEmitters.action.subscribe((t=>{this.do(t.e,t.action)}))}do(t,s){var i,o;const n=null==t?void 0:t.currentTarget;if(null===(i=null==n?void 0:n.classList)||void 0===i?void 0:i.contains(l.css.disabled))return!1;s=s||(null===(o=null==n?void 0:n.dataset)||void 0===o?void 0:o.action);const r=(this.dates.lastPicked||this.optionsStore.viewDate).clone;switch(s){case f.next:case f.previous:this.handleNextPrevious(s);break;case f.changeCalendarView:this.display._showMode(1),this.display._updateCalendarHeader();break;case f.selectMonth:case f.selectYear:case f.selectDecade:const i=+n.dataset.value;switch(s){case f.selectMonth:this.optionsStore.viewDate.month=i;break;case f.selectYear:case f.selectDecade:this.optionsStore.viewDate.year=i}this.optionsStore.currentCalendarViewMode===this.optionsStore.minimumCalendarViewMode?(this.dates.setValue(this.optionsStore.viewDate,this.dates.lastPickedIndex),this.optionsStore.options.display.inline||this.display.hide()):this.display._showMode(-1);break;case f.selectDay:const o=this.optionsStore.viewDate.clone;n.classList.contains(l.css.old)&&o.manipulate(-1,e.month),n.classList.contains(l.css.new)&&o.manipulate(1,e.month),o.date=+n.dataset.day;let d=0;this.optionsStore.options.multipleDates?(d=this.dates.pickedIndex(o,e.date),-1!==d?this.dates.setValue(null,d):this.dates.setValue(o,this.dates.lastPickedIndex+1)):this.dates.setValue(o,this.dates.lastPickedIndex),this.display._hasTime||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline||this.optionsStore.options.multipleDates||this.display.hide();break;case f.selectHour:let c=+n.dataset.value;r.hours>=12&&!this.optionsStore.options.display.components.useTwentyfourHour&&(c+=12),r.hours=c,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case f.selectMinute:r.minutes=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case f.selectSecond:r.seconds=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case f.incrementHours:this.manipulateAndSet(r,e.hours);break;case f.incrementMinutes:this.manipulateAndSet(r,e.minutes,this.optionsStore.options.stepping);break;case f.incrementSeconds:this.manipulateAndSet(r,e.seconds);break;case f.decrementHours:this.manipulateAndSet(r,e.hours,-1);break;case f.decrementMinutes:this.manipulateAndSet(r,e.minutes,-1*this.optionsStore.options.stepping);break;case f.decrementSeconds:this.manipulateAndSet(r,e.seconds,-1);break;case f.toggleMeridiem:this.manipulateAndSet(r,e.hours,this.dates.lastPicked.hours>=12?-12:12);break;case f.togglePicker:n.getAttribute("title")===this.optionsStore.options.localization.selectDate?(n.setAttribute("title",this.optionsStore.options.localization.selectTime),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.time).outerHTML,this.display._updateCalendarHeader(),this.optionsStore.refreshCurrentView()):(n.setAttribute("title",this.optionsStore.options.localization.selectDate),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.date).outerHTML,this.display._hasTime&&(this.handleShowClockContainers(f.showClock),this.display._update("clock"))),this.display.widget.querySelectorAll(`.${l.css.dateContainer}, .${l.css.timeContainer}`).forEach((t=>A.toggle(t))),this._eventEmitters.viewUpdate.emit();break;case f.showClock:case f.showHours:case f.showMinutes:case f.showSeconds:this.optionsStore.options.display.sideBySide||"clock"===this.optionsStore.currentView||(A.hideImmediately(this.display.widget.querySelector(`div.${l.css.dateContainer}`)),A.showImmediately(this.display.widget.querySelector(`div.${l.css.timeContainer}`))),this.handleShowClockContainers(s);break;case f.clear:this.dates.setValue(null),this.display._updateCalendarHeader();break;case f.close:this.display.hide();break;case f.today:const h=(new a).setLocale(this.optionsStore.options.localization.locale);this.optionsStore.viewDate=h,this.validation.isValid(h,e.date)&&this.dates.setValue(h,this.dates.lastPickedIndex)}}handleShowClockContainers(t){if(!this.display._hasTime)return void l.errorMessages.throwError("Cannot show clock containers when time is disabled.");this.optionsStore.currentView="clock",this.display.widget.querySelectorAll(`.${l.css.timeContainer} > div`).forEach((t=>t.style.display="none"));let s="";switch(t){case f.showClock:s=l.css.clockContainer,this.display._update("clock");break;case f.showHours:s=l.css.hourContainer,this.display._update(e.hours);break;case f.showMinutes:s=l.css.minuteContainer,this.display._update(e.minutes);break;case f.showSeconds:s=l.css.secondContainer,this.display._update(e.seconds)}this.display.widget.getElementsByClassName(s)[0].style.display="grid"}handleNextPrevious(t){const{unit:e,step:s}=p[this.optionsStore.currentCalendarViewMode];t===f.next?this.optionsStore.viewDate.manipulate(s,e):this.optionsStore.viewDate.manipulate(-1*s,e),this._eventEmitters.viewUpdate.emit(),this.display._showMode()}hideOrClock(t){!this.optionsStore.options.display.components.useTwentyfourHour||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline?this.do(t,f.showClock):this.display.hide()}manipulateAndSet(t,e,s=1){const i=t.manipulate(s,e);this.validation.isValid(i,e)&&this.dates.setValue(i,this.dates.lastPickedIndex)}}class V{constructor(t,e={}){this._subscribers={},this._isDisabled=!1,this._inputChangeEvent=t=>{if(null==t?void 0:t.detail)return;const e=()=>{this.dates.lastPicked&&(this.optionsStore.viewDate=this.dates.lastPicked.clone)},s=this.optionsStore.input.value;if(this.optionsStore.options.multipleDates)try{const t=s.split(this.optionsStore.options.multipleDatesSeparator);for(let e=0;e{var t,e;(null===(t=this.optionsStore.element)||void 0===t?void 0:t.disabled)||(null===(e=this.optionsStore.input)||void 0===e?void 0:e.disabled)||this.toggle()},h=new c,this._eventEmitters=h.locate(v),this.optionsStore=h.locate(u),this.display=h.locate($),this.dates=h.locate(w),this.actions=h.locate(O),t||l.errorMessages.mustProvideElement(),this.optionsStore.element=t,this._initializeOptions(e,g,!0),this.optionsStore.viewDate.setLocale(this.optionsStore.options.localization.locale),this.optionsStore.unset=!0,this._initializeInput(),this._initializeToggle(),this.optionsStore.options.display.inline&&this.display.show(),this._eventEmitters.triggerEvent.subscribe((t=>{this._triggerEvent(t)})),this._eventEmitters.viewUpdate.subscribe((()=>{this._viewUpdate()}))}get viewDate(){return this.optionsStore.viewDate}updateOptions(t,e=!1){e?this._initializeOptions(t,g):this._initializeOptions(t,this.optionsStore.options),this.display._rebuild()}toggle(){this._isDisabled||this.display.toggle()}show(){this._isDisabled||this.display.show()}hide(){this.display.hide()}disable(){var t;this._isDisabled=!0,null===(t=this.optionsStore.input)||void 0===t||t.setAttribute("disabled","disabled"),this.display.hide()}enable(){var t;this._isDisabled=!1,null===(t=this.optionsStore.input)||void 0===t||t.removeAttribute("disabled")}clear(){this.optionsStore.input.value="",this.dates.clear()}subscribe(t,e){let s;"string"==typeof t&&(t=[t]),s=Array.isArray(e)?e:[e],t.length!==s.length&&l.errorMessages.subscribeMismatch();const i=[];for(let e=0;e{e(t)}))}_viewUpdate(){this._triggerEvent({type:l.events.update,viewDate:this.optionsStore.viewDate.clone})}_unsubscribe(t,e){this._subscribers[t].splice(e,1)}_initializeOptions(t,e,s=!1){var i,o;let a=S.deepCopy(t);a=S._mergeOptions(a,e),s&&(a=S._dataToOptions(this.optionsStore.element,a)),S._validateConflicts(a),a.viewDate=a.viewDate.setLocale(a.localization.locale),this.optionsStore.viewDate.isSame(a.viewDate)||(this.optionsStore.viewDate=a.viewDate),a.display.components.year&&(this.optionsStore.minimumCalendarViewMode=2),a.display.components.month&&(this.optionsStore.minimumCalendarViewMode=1),a.display.components.date&&(this.optionsStore.minimumCalendarViewMode=0),this.optionsStore.currentCalendarViewMode=Math.max(this.optionsStore.minimumCalendarViewMode,this.optionsStore.currentCalendarViewMode),p[this.optionsStore.currentCalendarViewMode].name!==a.display.viewMode&&(this.optionsStore.currentCalendarViewMode=Math.max(p.findIndex((t=>t.name===a.display.viewMode)),this.optionsStore.minimumCalendarViewMode)),(null===(i=this.display)||void 0===i?void 0:i.isVisible)&&this.display._update("all"),void 0===a.display.components.useTwentyfourHour&&(a.display.components.useTwentyfourHour=!(null===(o=a.viewDate.parts())||void 0===o?void 0:o.dayPeriod)),this.optionsStore.options=a}_initializeInput(){if("INPUT"==this.optionsStore.element.tagName)this.optionsStore.input=this.optionsStore.element;else{let t=this.optionsStore.element.dataset.tdTargetInput;this.optionsStore.input=null==t||"nearest"==t?this.optionsStore.element.querySelector("input"):this.optionsStore.element.querySelector(t)}this.optionsStore.input&&(this.optionsStore.input.addEventListener("change",this._inputChangeEvent),this.optionsStore.options.allowInputToggle&&this.optionsStore.input.addEventListener("click",this._toggleClickEvent),this.optionsStore.input.value&&this._inputChangeEvent())}_initializeToggle(){if(this.optionsStore.options.display.inline)return;let t=this.optionsStore.element.dataset.tdTargetToggle;"nearest"==t&&(t='[data-td-toggle="datetimepicker"]'),this._toggle=null==t?this.optionsStore.element:this.optionsStore.element.querySelector(t),this._toggle.addEventListener("click",this._toggleClickEvent)}_handleAfterChangeEvent(t){var e,s;!this.optionsStore.options.promptTimeOnDateChange||this.optionsStore.options.display.inline||this.optionsStore.options.display.sideBySide||!this.display._hasTime||(null===(e=this.display.widget)||void 0===e?void 0:e.getElementsByClassName(l.css.show)[0].classList.contains(l.css.timeContainer))||!t.oldDate&&this.optionsStore.options.useCurrent||t.oldDate&&(null===(s=t.date)||void 0===s?void 0:s.isSame(t.oldDate))||(clearTimeout(this._currentPromptTimeTimeout),this._currentPromptTimeTimeout=setTimeout((()=>{this.display.widget&&this._eventEmitters.action.emit({e:{currentTarget:this.display.widget.querySelector(`.${l.css.switch} div`)},action:f.togglePicker})}),this.optionsStore.options.promptTimeOnDateChangeTransitionDelay))}}const H={},x={TempusDominus:V,extend:function(t,e){return t?(t.installed||(t(e,{TempusDominus:V,Dates:w,Display:$,DateTime:a,ErrorMessages:r},x),t.installed=!0),x):x},loadLocale:t=>{H[t.name]||(H[t.name]=t.localization)},locale:t=>{let e=H[t];e&&(g.localization=e)},Namespace:l,DefaultOptions:g,DateTime:a,Unit:e,version:"6.0.0-beta10"};export{x as default}; +import{createPopper as t}from"@popperjs/core";var e;!function(t){t.seconds="seconds",t.minutes="minutes",t.hours="hours",t.date="date",t.month="month",t.year="year"}(e||(e={}));const s={month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0},i={hour:"2-digit",hour12:!1},o=t=>{switch(t){case"date":return{dateStyle:"short"};case"month":return{month:"numeric",year:"numeric"};case"year":return{year:"numeric"}}};class a extends Date{constructor(){super(...arguments),this.locale="default",this.nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],this.leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335]}setLocale(t){return this.locale=t,this}static convert(t,e="default"){if(!t)throw new Error("A date is required");return new a(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).setLocale(e)}static fromString(t,e){return new a(t)}get clone(){return new a(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.getMilliseconds()).setLocale(this.locale)}startOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(0);break;case"minutes":this.setSeconds(0,0);break;case"hours":this.setMinutes(0,0,0);break;case"date":this.setHours(0,0,0,0);break;case"weekDay":if(this.startOf(e.date),this.weekDay===s)break;let t=this.weekDay;0!==s&&0===this.weekDay&&(t=8-s),this.manipulate(s-t,e.date);break;case"month":this.startOf(e.date),this.setDate(1);break;case"year":this.startOf(e.date),this.setMonth(0,1)}return this}endOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(999);break;case"minutes":this.setSeconds(59,999);break;case"hours":this.setMinutes(59,59,999);break;case"date":this.setHours(23,59,59,999);break;case"weekDay":this.endOf(e.date),this.manipulate(6+s-this.weekDay,e.date);break;case"month":this.endOf(e.date),this.manipulate(1,e.month),this.setDate(0);break;case"year":this.endOf(e.date),this.manipulate(1,e.year),this.setDate(0)}return this}manipulate(t,e){if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this[e]+=t,this}format(t,e=this.locale){return new Intl.DateTimeFormat(e,t).format(this)}isBefore(t,e){if(!e)return this.valueOf()t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this.clone.startOf(e).valueOf()>t.clone.startOf(e).valueOf()}isSame(t,e){if(!e)return this.valueOf()===t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return t=a.convert(t),this.clone.startOf(e).valueOf()===t.startOf(e).valueOf()}isBetween(t,e,s,i="()"){if(s&&void 0===this[s])throw new Error(`Unit '${s}' is not valid`);const o="("===i[0],a=")"===i[1];return(o?this.isAfter(t,s):!this.isBefore(t,s))&&(a?this.isBefore(e,s):!this.isAfter(e,s))||(o?this.isBefore(t,s):!this.isAfter(t,s))&&(a?this.isAfter(e,s):!this.isBefore(e,s))}parts(t=this.locale,e={dateStyle:"full",timeStyle:"long"}){const s={};return new Intl.DateTimeFormat(t,e).formatToParts(this).filter((t=>"literal"!==t.type)).forEach((t=>s[t.type]=t.value)),s}get seconds(){return this.getSeconds()}set seconds(t){this.setSeconds(t)}get secondsFormatted(){return this.parts(void 0,s).second}get minutes(){return this.getMinutes()}set minutes(t){this.setMinutes(t)}get minutesFormatted(){return this.parts(void 0,s).minute}get hours(){return this.getHours()}set hours(t){this.setHours(t)}get hoursFormatted(){return this.parts(void 0,i).hour}get twelveHoursFormatted(){return this.parts(void 0,s).hour}meridiem(t=this.locale){var e;return null===(e=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(this).find((t=>"dayPeriod"===t.type)))||void 0===e?void 0:e.value}get date(){return this.getDate()}set date(t){this.setDate(t)}get dateFormatted(){return this.parts(void 0,s).day}get weekDay(){return this.getDay()}get month(){return this.getMonth()}set month(t){const e=new Date(this.year,t+1);e.setDate(0);const s=e.getDate();this.date>s&&(this.date=s),this.setMonth(t)}get monthFormatted(){return this.parts(void 0,s).month}get year(){return this.getFullYear()}set year(t){this.setFullYear(t)}get week(){const t=this.computeOrdinal(),e=this.getUTCDay();let s=Math.floor((t-e+10)/7);return s<1?s=this.weeksInWeekYear(this.year-1):s>this.weeksInWeekYear(this.year)&&(s=1),s}weeksInWeekYear(t){const e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,s=t-1,i=(s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400))%7;return 4===e||3===i?53:52}get isLeapYear(){return this.year%4==0&&(this.year%100!=0||this.year%400==0)}computeOrdinal(){return this.date+(this.isLeapYear?this.leapLadder:this.nonLeapLadder)[this.month]}}class n extends Error{}class r{constructor(){this.base="TD:",this.failedToSetInvalidDate="Failed to set invalid date",this.failedToParseInput="Failed parse input field"}unexpectedOption(t){const e=new n(`${this.base} Unexpected option: ${t} does not match a known option.`);throw e.code=1,e}unexpectedOptions(t){const e=new n(`${this.base}: ${t.join(", ")}`);throw e.code=1,e}unexpectedOptionValue(t,e,s){const i=new n(`${this.base} Unexpected option value: ${t} does not accept a value of "${e}". Valid values are: ${s.join(", ")}`);throw i.code=2,i}typeMismatch(t,e,s){const i=new n(`${this.base} Mismatch types: ${t} has a type of ${e} instead of the required ${s}`);throw i.code=3,i}numbersOutOfRage(t,e,s){const i=new n(`${this.base} ${t} expected an array of number between ${e} and ${s}.`);throw i.code=4,i}failedToParseDate(t,e,s=!1){const i=new n(`${this.base} Could not correctly parse "${e}" to a date for ${t}.`);if(i.code=5,!s)throw i;console.warn(i)}mustProvideElement(){const t=new n(`${this.base} No element was provided.`);throw t.code=6,t}subscribeMismatch(){const t=new n(`${this.base} The subscribed events does not match the number of callbacks`);throw t.code=7,t}conflictingConfiguration(t){const e=new n(`${this.base} A configuration value conflicts with another rule. ${t}`);throw e.code=8,e}customDateFormatError(t){const e=new n(`${this.base} customDateFormat: ${t}`);throw e.code=9,e}dateString(){console.warn(`${this.base} Using a string for date options is not recommended unless you specify an ISO string or use the customDateFormat plugin.`)}throwError(t){const e=new n(`${this.base} ${t}`);throw e.code=9,e}}const d="tempus-dominus";class l{}l.NAME=d,l.dataKey="td",l.events=new class{constructor(){this.key=".td",this.change=`change${this.key}`,this.update=`update${this.key}`,this.error=`error${this.key}`,this.show=`show${this.key}`,this.hide=`hide${this.key}`,this.blur=`blur${this.key}`,this.focus=`focus${this.key}`,this.keyup=`keyup${this.key}`,this.keydown=`keydown${this.key}`}},l.css=new class{constructor(){this.widget=`${d}-widget`,this.calendarHeader="calendar-header",this.switch="picker-switch",this.toolbar="toolbar",this.noHighlight="no-highlight",this.sideBySide="timepicker-sbs",this.previous="previous",this.next="next",this.disabled="disabled",this.old="old",this.new="new",this.active="active",this.dateContainer="date-container",this.decadesContainer=`${this.dateContainer}-decades`,this.decade="decade",this.yearsContainer=`${this.dateContainer}-years`,this.year="year",this.monthsContainer=`${this.dateContainer}-months`,this.month="month",this.daysContainer=`${this.dateContainer}-days`,this.day="day",this.calendarWeeks="cw",this.dayOfTheWeek="dow",this.today="today",this.weekend="weekend",this.timeContainer="time-container",this.separator="separator",this.clockContainer=`${this.timeContainer}-clock`,this.hourContainer=`${this.timeContainer}-hour`,this.minuteContainer=`${this.timeContainer}-minute`,this.secondContainer=`${this.timeContainer}-second`,this.hour="hour",this.minute="minute",this.second="second",this.toggleMeridiem="toggleMeridiem",this.show="show",this.collapsing="td-collapsing",this.collapse="td-collapse",this.inline="inline",this.lightTheme="light",this.darkTheme="dark",this.isDarkPreferredQuery="(prefers-color-scheme: dark)"}},l.errorMessages=new r;class c{constructor(){this.cache=new Map}locate(t){const e=this.cache.get(t);if(e)return e;const s=new t;return this.cache.set(t,s),s}}let h;const p=[{name:"calendar",className:l.css.daysContainer,unit:e.month,step:1},{name:"months",className:l.css.monthsContainer,unit:e.year,step:1},{name:"years",className:l.css.yearsContainer,unit:e.year,step:10},{name:"decades",className:l.css.decadesContainer,unit:e.year,step:100}];class u{constructor(){this.viewDate=new a,this._currentCalendarViewMode=0,this.minimumCalendarViewMode=0,this.currentView="calendar"}get currentCalendarViewMode(){return this._currentCalendarViewMode}set currentCalendarViewMode(t){this._currentCalendarViewMode=t,this.currentView=p[t].name}refreshCurrentView(){this.currentView=p[this.currentCalendarViewMode].name}}class m{constructor(){this.optionsStore=h.locate(u)}isValid(t,s){var i;if(this.optionsStore.options.restrictions.disabledDates.length>0&&this._isInDisabledDates(t))return!1;if(this.optionsStore.options.restrictions.enabledDates.length>0&&!this._isInEnabledDates(t))return!1;if(s!==e.month&&s!==e.year&&(null===(i=this.optionsStore.options.restrictions.daysOfWeekDisabled)||void 0===i?void 0:i.length)>0&&-1!==this.optionsStore.options.restrictions.daysOfWeekDisabled.indexOf(t.weekDay))return!1;if(this.optionsStore.options.restrictions.minDate&&t.isBefore(this.optionsStore.options.restrictions.minDate,s))return!1;if(this.optionsStore.options.restrictions.maxDate&&t.isAfter(this.optionsStore.options.restrictions.maxDate,s))return!1;if(s===e.hours||s===e.minutes||s===e.seconds){if(this.optionsStore.options.restrictions.disabledHours.length>0&&this._isInDisabledHours(t))return!1;if(this.optionsStore.options.restrictions.enabledHours.length>0&&!this._isInEnabledHours(t))return!1;if(this.optionsStore.options.restrictions.disabledTimeIntervals.length>0)for(let e of this.optionsStore.options.restrictions.disabledTimeIntervals)if(t.isBetween(e.from,e.to))return!1}return!0}_isInDisabledDates(t){if(!this.optionsStore.options.restrictions.disabledDates||0===this.optionsStore.options.restrictions.disabledDates.length)return!1;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.disabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInEnabledDates(t){if(!this.optionsStore.options.restrictions.enabledDates||0===this.optionsStore.options.restrictions.enabledDates.length)return!0;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.enabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInDisabledHours(t){if(!this.optionsStore.options.restrictions.disabledHours||0===this.optionsStore.options.restrictions.disabledHours.length)return!1;const e=t.hours;return this.optionsStore.options.restrictions.disabledHours.find((t=>t===e))}_isInEnabledHours(t){if(!this.optionsStore.options.restrictions.enabledHours||0===this.optionsStore.options.restrictions.enabledHours.length)return!0;const e=t.hours;return this.optionsStore.options.restrictions.enabledHours.find((t=>t===e))}}class y{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),this.unsubscribe.bind(this,this.subscribers.length-1)}unsubscribe(t){this.subscribers.splice(t,1)}emit(t){this.subscribers.forEach((e=>{e(t)}))}destroy(){this.subscribers=null,this.subscribers=[]}}class v{constructor(){this.triggerEvent=new y,this.viewUpdate=new y,this.updateDisplay=new y,this.action=new y}destroy(){this.triggerEvent.destroy(),this.viewUpdate.destroy(),this.updateDisplay.destroy(),this.action.destroy()}}const g={restrictions:{minDate:void 0,maxDate:void 0,disabledDates:[],enabledDates:[],daysOfWeekDisabled:[],disabledTimeIntervals:[],disabledHours:[],enabledHours:[]},display:{icons:{type:"icons",time:"fa-solid fa-clock",date:"fa-solid fa-calendar",up:"fa-solid fa-arrow-up",down:"fa-solid fa-arrow-down",previous:"fa-solid fa-chevron-left",next:"fa-solid fa-chevron-right",today:"fa-solid fa-calendar-check",clear:"fa-solid fa-trash",close:"fa-solid fa-xmark"},sideBySide:!1,calendarWeeks:!1,viewMode:"calendar",toolbarPlacement:"bottom",keepOpen:!1,buttons:{today:!1,clear:!1,close:!1},components:{calendar:!0,date:!0,month:!0,year:!0,decades:!0,clock:!0,hours:!0,minutes:!0,seconds:!1,useTwentyfourHour:void 0},inline:!1,theme:"auto"},stepping:1,useCurrent:!0,defaultDate:void 0,localization:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",previousMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",previousYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",previousDecade:"Previous Decade",nextDecade:"Next Decade",previousCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",toggleMeridiem:"Toggle Meridiem",selectTime:"Select Time",selectDate:"Select Date",dayViewHeaderFormat:{month:"long",year:"2-digit"},locale:"default",startOfTheWeek:0,dateFormats:{LTS:"h:mm:ss T",LT:"h:mm T",L:"MM/dd/yyyy",LL:"MMMM d, yyyy",LLL:"MMMM d, yyyy h:mm T",LLLL:"dddd, MMMM d, yyyy h:mm T"},ordinal:t=>t,format:"L"},keepInvalid:!1,debug:!1,allowInputToggle:!1,viewDate:new a,multipleDates:!1,multipleDatesSeparator:"; ",promptTimeOnDateChange:!1,promptTimeOnDateChangeTransitionDelay:200,meta:{},container:void 0};class S{static deepCopy(t){const e={};return Object.keys(t).forEach((s=>{const i=t[s];e[s]=i,"object"!=typeof i||i instanceof HTMLElement||i instanceof Element||i instanceof Date||Array.isArray(i)||(e[s]=S.deepCopy(i))})),e}static objectPath(t,e){return"."===t.charAt(0)&&(t=t.slice(1)),t?t.split(".").reduce(((t,e)=>S.isValue(t)||S.isValue(t[e])?t[e]:void 0),e):e}static spread(t,e,s="",i){const o=S.objectPath(s,g),a=Object.keys(t).filter((t=>!Object.keys(o).includes(t)));if(a.length>0){const t=S.getFlattenDefaultOptions(),e=a.map((e=>{let i=`"${s}.${e}" in not a known option.`,o=t.find((t=>t.includes(e)));return o&&(i+=` Did you mean "${o}"?`),i}));l.errorMessages.unexpectedOptions(e)}Object.keys(t).filter((t=>"__proto__"!==t&&"constructor"!==t)).forEach((a=>{"."===(s+=`.${a}`).charAt(0)&&(s=s.slice(1));const n=o[a];let r=typeof t[a],d=typeof n,l=t[a];if(null==l)return e[a]=l,void(s=s.substring(0,s.lastIndexOf(`.${a}`)));"object"!=typeof n||Array.isArray(t[a])||n instanceof Date||S.ignoreProperties.includes(a)?e[a]=S.processKey(a,l,r,d,s,i):S.spread(t[a],e[a],s,i),s=s.substring(0,s.lastIndexOf(`.${a}`))}))}static processKey(t,e,s,i,o,a){switch(t){case"defaultDate":{const t=this.dateConversion(e,"defaultDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("defaultDate",s,"DateTime or Date");break}case"viewDate":{const t=this.dateConversion(e,"viewDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("viewDate",s,"DateTime or Date");break}case"minDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.minDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.minDate",s,"DateTime or Date");break}case"maxDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.maxDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.maxDate",s,"DateTime or Date");break}case"disabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.disabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.disabledHours",0,23),e);case"enabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.enabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.enabledHours",0,23),e);case"daysOfWeekDisabled":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.daysOfWeekDisabled",e,s),e.filter((t=>t<0||t>6)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.daysOfWeekDisabled",0,6),e);case"enabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.enabledDates",e,s,a),e);case"disabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.disabledDates",e,s,a),e);case"disabledTimeIntervals":if(void 0===e)return[];Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of { from: DateTime|Date, to: DateTime|Date }");const n=e;for(let e=0;e{const i=`${t}[${e}].${s}`;let o=n[e][s];const r=this.dateConversion(o,i,a);r||l.errorMessages.typeMismatch(i,typeof o,"DateTime or Date"),r.setLocale(a.locale),n[e][s]=r}));return n;case"toolbarPlacement":case"type":case"viewMode":case"theme":const r={toolbarPlacement:["top","bottom","default"],type:["icons","sprites"],viewMode:["clock","calendar","months","years","decades"],theme:["light","dark","auto"]}[t];return r.includes(e)||l.errorMessages.unexpectedOptionValue(o.substring(1),e,r),e;case"meta":case"dayViewHeaderFormat":return e;case"container":return e&&!(e instanceof HTMLElement||e instanceof Element||(null==e?void 0:e.appendChild))&&l.errorMessages.typeMismatch(o.substring(1),typeof e,"HTMLElement"),e;case"useTwentyfourHour":if(void 0===e||"boolean"===s)return e;l.errorMessages.typeMismatch(o,s,i);break;default:switch(i){case"boolean":return"true"===e||!0===e;case"number":return+e;case"string":return e.toString();case"object":return{};case"function":return e;default:l.errorMessages.typeMismatch(o,s,i)}}}static _mergeOptions(t,e){var s;const i=S.deepCopy(e),o="default"!==(null===(s=e.localization)||void 0===s?void 0:s.locale)?e.localization:(null==t?void 0:t.localization)||g.localization;return S.spread(t,i,"",o),i}static _dataToOptions(t,e){const s=JSON.parse(JSON.stringify(t.dataset));if((null==s?void 0:s.tdTargetInput)&&delete s.tdTargetInput,(null==s?void 0:s.tdTargetToggle)&&delete s.tdTargetToggle,!s||0===Object.keys(s).length||s.constructor!==DOMStringMap)return e;let i={};const o=t=>{const e={};return Object.keys(t).forEach((t=>{e[t.toLowerCase()]=t})),e},a=(t,e,s,i)=>{const n=o(s)[t[e].toLowerCase()],r={};return void 0===n||(s[n].constructor===Object?(e++,r[n]=a(t,e,s[n],i)):r[n]=i),r},n=o(e);return Object.keys(s).filter((t=>t.startsWith(l.dataKey))).map((t=>t.substring(2))).forEach((t=>{let o=n[t.toLowerCase()];if(t.includes("_")){const r=t.split("_");o=n[r[0].toLowerCase()],void 0!==o&&e[o].constructor===Object&&(i[o]=a(r,1,e[o],s[`td${t}`]))}else void 0!==o&&(i[o]=s[`td${t}`])})),this._mergeOptions(i,e)}static _dateTypeCheck(t,e){if(t.constructor.name===a.name)return t;if(t.constructor.name===Date.name)return a.convert(t);if("string"==typeof t){const s=a.fromString(t,e);return"null"===JSON.stringify(s)?null:s}return null}static _typeCheckDateArray(t,e,s,i){var o;Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of DateTime or Date");for(let s=0;s"number"!=typeof t))||l.errorMessages.typeMismatch(t,s,"array of numbers")}static dateConversion(t,e,s){"string"==typeof t&&"input"!==e&&l.errorMessages.dateString();const i=this._dateTypeCheck(t,s);return i||l.errorMessages.failedToParseDate(e,t,"input"===e),i}static getFlattenDefaultOptions(){if(this._flattenDefaults)return this._flattenDefaults;const t=(e,s=[])=>Array.isArray(e)?[]:Object(e)===e?Object.entries(e).flatMap((([e,i])=>t(i,[...s,e]))):s.join(".");return this._flattenDefaults=t(g),this._flattenDefaults}static _validateConflicts(t){!t.display.sideBySide||t.display.components.clock&&(t.display.components.hours||t.display.components.minutes||t.display.components.seconds)||l.errorMessages.conflictingConfiguration("Cannot use side by side mode without the clock components"),t.restrictions.minDate&&t.restrictions.maxDate&&(t.restrictions.minDate.isAfter(t.restrictions.maxDate)&&l.errorMessages.conflictingConfiguration("minDate is after maxDate"),t.restrictions.maxDate.isBefore(t.restrictions.minDate)&&l.errorMessages.conflictingConfiguration("maxDate is before minDate"))}}S.ignoreProperties=["meta","dayViewHeaderFormat","container","dateForms","ordinal"],S.isValue=t=>null!=t;class w{constructor(){this._dates=[],this.optionsStore=h.locate(u),this.validation=h.locate(m),this._eventEmitters=h.locate(v)}get picked(){return this._dates}get lastPicked(){return this._dates[this.lastPickedIndex]}get lastPickedIndex(){return 0===this._dates.length?0:this._dates.length-1}formatInput(t){const e=this.optionsStore.options.display.components;return t?t.format({year:e.calendar&&e.year?"numeric":void 0,month:e.calendar&&e.month?"2-digit":void 0,day:e.calendar&&e.date?"2-digit":void 0,hour:e.clock&&e.hours?e.useTwentyfourHour?"2-digit":"numeric":void 0,minute:e.clock&&e.minutes?"2-digit":void 0,second:e.clock&&e.seconds?"2-digit":void 0,hour12:!e.useTwentyfourHour}):""}parseInput(t){return S.dateConversion(t,"input",this.optionsStore.options.localization)}setFromInput(t,e){if(!t)return void this.setValue(void 0,e);const s=this.parseInput(t);s&&(s.setLocale(this.optionsStore.options.localization.locale),this.setValue(s,e))}add(t){this._dates.push(t)}isPicked(t,e){if(!e)return void 0!==this._dates.find((e=>e===t));const s=o(e);let i=t.format(s);return void 0!==this._dates.map((t=>t.format(s))).find((t=>t===i))}pickedIndex(t,e){if(!e)return this._dates.indexOf(t);const s=o(e);let i=t.format(s);return this._dates.map((t=>t.format(s))).indexOf(i)}clear(){this.optionsStore.unset=!0,this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:this.lastPicked,isClear:!0,isValid:!0}),this._dates=[]}static getStartEndYear(t,e){const s=t/10,i=Math.floor(e/t)*t;return[i,i+9*s,Math.floor(e/s)*s]}setValue(t,e){const s=void 0===e,i=!t&&s;let o=this.optionsStore.unset?null:this._dates[e];!o&&!this.optionsStore.unset&&s&&i&&(o=this.lastPicked);const a=()=>{if(!this.optionsStore.input)return;let e=this.formatInput(t);this.optionsStore.options.multipleDates&&(e=this._dates.map((t=>this.formatInput(t))).join(this.optionsStore.options.multipleDatesSeparator)),this.optionsStore.input.value!=e&&(this.optionsStore.input.value=e)};if(t&&(null==o?void 0:o.isSame(t)))a();else{if(!t)return!this.optionsStore.options.multipleDates||1===this._dates.length||i?(this.optionsStore.unset=!0,this._dates=[]):this._dates.splice(e,1),a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:o,isClear:i,isValid:!0}),void this._eventEmitters.updateDisplay.emit("all");if(e=e||0,t=t.clone,1!==this.optionsStore.options.stepping&&(t.minutes=Math.round(t.minutes/this.optionsStore.options.stepping)*this.optionsStore.options.stepping,t.seconds=0),this.validation.isValid(t))return this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this.optionsStore.unset=!1,this._eventEmitters.updateDisplay.emit("all"),void this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!0});this.optionsStore.options.keepInvalid&&(this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!1})),this._eventEmitters.triggerEvent.emit({type:l.events.error,reason:l.errorMessages.failedToSetInvalidDate,date:t,oldDate:o})}}}var b;!function(t){t.next="next",t.previous="previous",t.changeCalendarView="changeCalendarView",t.selectMonth="selectMonth",t.selectYear="selectYear",t.selectDecade="selectDecade",t.selectDay="selectDay",t.selectHour="selectHour",t.selectMinute="selectMinute",t.selectSecond="selectSecond",t.incrementHours="incrementHours",t.incrementMinutes="incrementMinutes",t.incrementSeconds="incrementSeconds",t.decrementHours="decrementHours",t.decrementMinutes="decrementMinutes",t.decrementSeconds="decrementSeconds",t.toggleMeridiem="toggleMeridiem",t.togglePicker="togglePicker",t.showClock="showClock",t.showHours="showHours",t.showMinutes="showMinutes",t.showSeconds="showSeconds",t.clear="clear",t.close="close",t.today="today"}(b||(b={}));var f=b;class D{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");if(t.classList.add(l.css.daysContainer),t.append(...this._daysOfTheWeek()),this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}for(let e=0;e<42;e++){if(0!==e&&e%7==0&&this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}const s=document.createElement("div");s.setAttribute("data-action",f.selectDay),t.appendChild(s)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.daysContainer)[0];if("calendar"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.daysContainer,this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)),this.optionsStore.options.display.components.month?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.month),e.month)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.month),e.month)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.month).startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).manipulate(12,e.hours);i.querySelectorAll(`[data-action="${f.selectDay}"], .${l.css.calendarWeeks}`).forEach((t=>{if(this.optionsStore.options.display.calendarWeeks&&t.classList.contains(l.css.calendarWeeks)){if("#"===t.innerText)return;return void(t.innerText=`${o.week}`)}let i=[];i.push(l.css.day),o.isBefore(this.optionsStore.viewDate,e.month)&&i.push(l.css.old),o.isAfter(this.optionsStore.viewDate,e.month)&&i.push(l.css.new),!this.optionsStore.unset&&this.dates.isPicked(o,e.date)&&i.push(l.css.active),this.validation.isValid(o,e.date)||i.push(l.css.disabled),o.isSame(new a,e.date)&&i.push(l.css.today),0!==o.weekDay&&6!==o.weekDay||i.push(l.css.weekend),s(e.date,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}-${o.monthFormatted}-${o.dateFormatted}`),t.setAttribute("data-day",`${o.date}`),t.innerText=o.format({day:"numeric"}),o.manipulate(1,e.date)}))}_daysOfTheWeek(){let t=this.optionsStore.viewDate.clone.startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).startOf(e.date);const s=[];if(document.createElement("div"),this.optionsStore.options.display.calendarWeeks){const t=document.createElement("div");t.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.innerText="#",s.push(t)}for(let i=0;i<7;i++){const i=document.createElement("div");i.classList.add(l.css.dayOfTheWeek,l.css.noHighlight),i.innerText=t.format({weekday:"short"}),t.manipulate(1,e.date),s.push(i)}return s}}class k{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.monthsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectMonth),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.monthsContainer)[0];if("months"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.monthsContainer,this.optionsStore.viewDate.format({year:"numeric"})),this.optionsStore.options.display.components.year?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.year),e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.year),e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year);i.querySelectorAll(`[data-action="${f.selectMonth}"]`).forEach(((t,i)=>{let a=[];a.push(l.css.month),!this.optionsStore.unset&&this.dates.isPicked(o,e.month)&&a.push(l.css.active),this.validation.isValid(o,e.month)||a.push(l.css.disabled),s(e.month,o,a,t),t.classList.remove(...t.classList),t.classList.add(...a),t.setAttribute("data-value",`${i}`),t.innerText=`${o.format({month:"short"})}`,o.manipulate(1,e.month)}))}}class _{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.yearsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectYear),t.appendChild(e)}return t}_update(t,s){this._startYear=this.optionsStore.viewDate.clone.manipulate(-1,e.year),this._endYear=this.optionsStore.viewDate.clone.manipulate(10,e.year);const i=t.getElementsByClassName(l.css.yearsContainer)[0];if("years"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.yearsContainer,`${this._startYear.format({year:"numeric"})}-${this._endYear.format({year:"numeric"})}`),this.optionsStore.options.display.components.decades?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this._startYear,e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this._endYear,e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year).manipulate(-1,e.year);i.querySelectorAll(`[data-action="${f.selectYear}"]`).forEach((t=>{let i=[];i.push(l.css.year),!this.optionsStore.unset&&this.dates.isPicked(o,e.year)&&i.push(l.css.active),this.validation.isValid(o,e.year)||i.push(l.css.disabled),s(e.year,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}`),t.innerText=o.format({year:"numeric"}),o.manipulate(1,e.year)}))}}class C{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.decadesContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectDecade),t.appendChild(e)}return t}_update(t,s){const[i,o]=w.getStartEndYear(100,this.optionsStore.viewDate.year);this._startDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._startDecade.year=i,this._endDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._endDecade.year=o;const a=t.getElementsByClassName(l.css.decadesContainer)[0],[n,r,d]=a.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");"decades"===this.optionsStore.currentView&&(r.setAttribute(l.css.decadesContainer,`${this._startDecade.format({year:"numeric"})}-${this._endDecade.format({year:"numeric"})}`),this.validation.isValid(this._startDecade,e.year)?n.classList.remove(l.css.disabled):n.classList.add(l.css.disabled),this.validation.isValid(this._endDecade,e.year)?d.classList.remove(l.css.disabled):d.classList.add(l.css.disabled));const c=this.dates.picked.map((t=>t.year));a.querySelectorAll(`[data-action="${f.selectDecade}"]`).forEach(((t,i)=>{if(0===i)return t.classList.add(l.css.old),this._startDecade.year-10<0?(t.textContent=" ",n.classList.add(l.css.disabled),t.classList.add(l.css.disabled),void t.setAttribute("data-value","")):(t.innerText=this._startDecade.clone.manipulate(-10,e.year).format({year:"numeric"}),void t.setAttribute("data-value",`${this._startDecade.year}`));let o=[];o.push(l.css.decade);const a=this._startDecade.year,r=this._startDecade.year+9;!this.optionsStore.unset&&c.filter((t=>t>=a&&t<=r)).length>0&&o.push(l.css.active),s("decade",this._startDecade,o,t),t.classList.remove(...t.classList),t.classList.add(...o),t.setAttribute("data-value",`${this._startDecade.year}`),t.innerText=`${this._startDecade.format({year:"numeric"})}`,this._startDecade.manipulate(10,e.year)}))}}class E{constructor(){this._gridColumns="",this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(t){const e=document.createElement("div");return e.classList.add(l.css.clockContainer),e.append(...this._grid(t)),e}_update(t){const s=t.getElementsByClassName(l.css.clockContainer)[0],i=(this.dates.lastPicked||this.optionsStore.viewDate).clone;if(s.querySelectorAll(".disabled").forEach((t=>t.classList.remove(l.css.disabled))),this.optionsStore.options.display.components.hours&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.hours),e.hours)||s.querySelector(`[data-action=${f.incrementHours}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.hours),e.hours)||s.querySelector(`[data-action=${f.decrementHours}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.hours}]`).innerText=this.optionsStore.options.display.components.useTwentyfourHour?i.hoursFormatted:i.twelveHoursFormatted),this.optionsStore.options.display.components.minutes&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.minutes),e.minutes)||s.querySelector(`[data-action=${f.incrementMinutes}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.minutes),e.minutes)||s.querySelector(`[data-action=${f.decrementMinutes}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.minutes}]`).innerText=i.minutesFormatted),this.optionsStore.options.display.components.seconds&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.seconds),e.seconds)||s.querySelector(`[data-action=${f.incrementSeconds}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.seconds),e.seconds)||s.querySelector(`[data-action=${f.decrementSeconds}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.seconds}]`).innerText=i.secondsFormatted),!this.optionsStore.options.display.components.useTwentyfourHour){const t=s.querySelector(`[data-action=${f.toggleMeridiem}]`);t.innerText=i.meridiem(),this.validation.isValid(i.clone.manipulate(i.hours>=12?-12:12,e.hours))?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled)}s.style.gridTemplateAreas=`"${this._gridColumns}"`}_grid(t){this._gridColumns="";const s=[],i=[],o=[],a=document.createElement("div"),n=t(this.optionsStore.options.display.icons.up),r=t(this.optionsStore.options.display.icons.down);a.classList.add(l.css.separator,l.css.noHighlight);const d=a.cloneNode(!0);d.innerHTML=":";const c=(t=!1)=>t?d.cloneNode(!0):a.cloneNode(!0);if(this.optionsStore.options.display.components.hours){let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementHour),t.setAttribute("data-action",f.incrementHours),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickHour),t.setAttribute("data-action",f.showHours),t.setAttribute("data-time-component",e.hours),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementHour),t.setAttribute("data-action",f.decrementHours),t.appendChild(r.cloneNode(!0)),o.push(t),this._gridColumns+="a"}if(this.optionsStore.options.display.components.minutes){this._gridColumns+=" a",this.optionsStore.options.display.components.hours&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementMinute),t.setAttribute("data-action",f.incrementMinutes),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickMinute),t.setAttribute("data-action",f.showMinutes),t.setAttribute("data-time-component",e.minutes),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementMinute),t.setAttribute("data-action",f.decrementMinutes),t.appendChild(r.cloneNode(!0)),o.push(t)}if(this.optionsStore.options.display.components.seconds){this._gridColumns+=" a",this.optionsStore.options.display.components.minutes&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementSecond),t.setAttribute("data-action",f.incrementSeconds),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickSecond),t.setAttribute("data-action",f.showSeconds),t.setAttribute("data-time-component",e.seconds),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementSecond),t.setAttribute("data-action",f.decrementSeconds),t.appendChild(r.cloneNode(!0)),o.push(t)}if(!this.optionsStore.options.display.components.useTwentyfourHour){this._gridColumns+=" a";let t=c();s.push(t);let e=document.createElement("button");e.setAttribute("title",this.optionsStore.options.localization.toggleMeridiem),e.setAttribute("data-action",f.toggleMeridiem),e.setAttribute("tabindex","-1"),l.css.toggleMeridiem.includes(",")?e.classList.add(...l.css.toggleMeridiem.split(",")):e.classList.add(l.css.toggleMeridiem),t=document.createElement("div"),t.classList.add(l.css.noHighlight),t.appendChild(e),i.push(t),t=c(),o.push(t)}return this._gridColumns=this._gridColumns.trim(),[...s,...i,...o]}}class M{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.hourContainer);for(let e=0;e<(this.optionsStore.options.display.components.useTwentyfourHour?24:12);e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectHour),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.hourContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.date);i.querySelectorAll(`[data-action="${f.selectHour}"]`).forEach((t=>{let i=[];i.push(l.css.hour),this.validation.isValid(o,e.hours)||i.push(l.css.disabled),s(e.hours,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.hours}`),t.innerText=this.optionsStore.options.display.components.useTwentyfourHour?o.hoursFormatted:o.twelveHoursFormatted,o.manipulate(1,e.hours)}))}}class L{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.minuteContainer);let e=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;for(let s=0;s<60/e;s++){const e=document.createElement("div");e.setAttribute("data-action",f.selectMinute),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.minuteContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.hours),a=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;i.querySelectorAll(`[data-action="${f.selectMinute}"]`).forEach((t=>{let i=[];i.push(l.css.minute),this.validation.isValid(o,e.minutes)||i.push(l.css.disabled),s(e.minutes,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.minutes}`),t.innerText=o.minutesFormatted,o.manipulate(a,e.minutes)}))}}class T{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.secondContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",f.selectSecond),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.secondContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.minutes);i.querySelectorAll(`[data-action="${f.selectSecond}"]`).forEach((t=>{let i=[];i.push(l.css.second),this.validation.isValid(o,e.seconds)||i.push(l.css.disabled),s(e.seconds,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.seconds}`),t.innerText=o.secondsFormatted,o.manipulate(5,e.seconds)}))}}class A{static toggle(t){t.classList.contains(l.css.show)?this.hide(t):this.show(t)}static showImmediately(t){t.classList.remove(l.css.collapsing),t.classList.add(l.css.collapse,l.css.show),t.style.height=""}static show(t){if(t.classList.contains(l.css.collapsing)||t.classList.contains(l.css.show))return;t.style.height="0",t.classList.remove(l.css.collapse),t.classList.add(l.css.collapsing),setTimeout((()=>{A.showImmediately(t)}),this.getTransitionDurationFromElement(t)),t.style.height=`${t.scrollHeight}px`}static hideImmediately(t){t&&(t.classList.remove(l.css.collapsing,l.css.show),t.classList.add(l.css.collapse))}static hide(t){if(t.classList.contains(l.css.collapsing)||!t.classList.contains(l.css.show))return;t.style.height=`${t.getBoundingClientRect().height}px`;t.offsetHeight,t.classList.remove(l.css.collapse,l.css.show),t.classList.add(l.css.collapsing),t.style.height="",setTimeout((()=>{A.hideImmediately(t)}),this.getTransitionDurationFromElement(t))}}A.getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e),o=Number.parseFloat(s);return i||o?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0};class ${constructor(){this._isVisible=!1,this._documentClickEvent=t=>{var e;this.optionsStore.options.debug||window.debug||!this._isVisible||t.composedPath().includes(this.widget)||(null===(e=t.composedPath())||void 0===e?void 0:e.includes(this.optionsStore.element))||this.hide()},this._actionsClickEvent=t=>{this._eventEmitters.action.emit({e:t})},this.optionsStore=h.locate(u),this.validation=h.locate(m),this.dates=h.locate(w),this.dateDisplay=h.locate(D),this.monthDisplay=h.locate(k),this.yearDisplay=h.locate(_),this.decadeDisplay=h.locate(C),this.timeDisplay=h.locate(E),this.hourDisplay=h.locate(M),this.minuteDisplay=h.locate(L),this.secondDisplay=h.locate(T),this._eventEmitters=h.locate(v),this._widget=void 0,this._eventEmitters.updateDisplay.subscribe((t=>{this._update(t)}))}get widget(){return this._widget}get isVisible(){return this._isVisible}_update(t){if(this.widget)switch(t){case e.seconds:this.secondDisplay._update(this.widget,this.paint);break;case e.minutes:this.minuteDisplay._update(this.widget,this.paint);break;case e.hours:this.hourDisplay._update(this.widget,this.paint);break;case e.date:this.dateDisplay._update(this.widget,this.paint);break;case e.month:this.monthDisplay._update(this.widget,this.paint);break;case e.year:this.yearDisplay._update(this.widget,this.paint);break;case"clock":if(!this._hasTime)break;this.timeDisplay._update(this.widget),this._update(e.hours),this._update(e.minutes),this._update(e.seconds);break;case"calendar":this._update(e.date),this._update(e.year),this._update(e.month),this.decadeDisplay._update(this.widget,this.paint),this._updateCalendarHeader();break;case"all":this._hasTime&&this._update("clock"),this._hasDate&&this._update("calendar")}}paint(t,e,s,i){}show(){var s,i;if(null==this.widget){if(0==this.dates.picked.length){if(this.optionsStore.options.useCurrent&&!this.optionsStore.options.defaultDate){const t=(new a).setLocale(this.optionsStore.options.localization.locale);if(!this.optionsStore.options.keepInvalid){let i=0,o=1;for((null===(s=this.optionsStore.options.restrictions.maxDate)||void 0===s?void 0:s.isBefore(t))&&(o=-1);!(this.validation.isValid(t)||(t.manipulate(o,e.date),i>31));)i++}this.dates.setValue(t)}this.optionsStore.options.defaultDate&&this.dates.setValue(this.optionsStore.options.defaultDate)}this._buildWidget(),this._updateTheme();const o=this._hasTime&&!this._hasDate;if(o&&(this.optionsStore.currentView="clock",this._eventEmitters.action.emit({e:null,action:f.showClock})),this.optionsStore.currentCalendarViewMode||(this.optionsStore.currentCalendarViewMode=this.optionsStore.minimumCalendarViewMode),o||"clock"===this.optionsStore.options.display.viewMode||(this._hasTime&&(this.optionsStore.options.display.sideBySide?A.show(this.widget.querySelector(`div.${l.css.timeContainer}`)):A.hideImmediately(this.widget.querySelector(`div.${l.css.timeContainer}`))),A.show(this.widget.querySelector(`div.${l.css.dateContainer}`))),this._hasDate&&this._showMode(),this.optionsStore.options.display.inline)this.optionsStore.element.appendChild(this.widget);else{((null===(i=this.optionsStore.options)||void 0===i?void 0:i.container)||document.body).appendChild(this.widget),this._popperInstance=t(this.optionsStore.element,this.widget,{modifiers:[{name:"eventListeners",enabled:!0}],placement:"rtl"===document.documentElement.dir?"bottom-end":"bottom-start"})}"clock"==this.optionsStore.options.display.viewMode&&this._eventEmitters.action.emit({e:null,action:f.showClock}),this.widget.querySelectorAll("[data-action]").forEach((t=>t.addEventListener("click",this._actionsClickEvent))),this._hasTime&&this.optionsStore.options.display.sideBySide&&(this.timeDisplay._update(this.widget),this.widget.getElementsByClassName(l.css.clockContainer)[0].style.display="grid")}this.widget.classList.add(l.css.show),this.optionsStore.options.display.inline||(this._popperInstance.update(),document.addEventListener("click",this._documentClickEvent)),this._eventEmitters.triggerEvent.emit({type:l.events.show}),this._isVisible=!0}_showMode(t){if(!this.widget)return;if(t){const e=Math.max(this.optionsStore.minimumCalendarViewMode,Math.min(3,this.optionsStore.currentCalendarViewMode+t));if(this.optionsStore.currentCalendarViewMode==e)return;this.optionsStore.currentCalendarViewMode=e}this.widget.querySelectorAll(`.${l.css.dateContainer} > div:not(.${l.css.calendarHeader}), .${l.css.timeContainer} > div:not(.${l.css.clockContainer})`).forEach((t=>t.style.display="none"));const e=p[this.optionsStore.currentCalendarViewMode];let s=this.widget.querySelector(`.${e.className}`);switch(e.className){case l.css.decadesContainer:this.decadeDisplay._update(this.widget,this.paint);break;case l.css.yearsContainer:this.yearDisplay._update(this.widget,this.paint);break;case l.css.monthsContainer:this.monthDisplay._update(this.widget,this.paint);break;case l.css.daysContainer:this.dateDisplay._update(this.widget,this.paint)}s.style.display="grid",this._updateCalendarHeader(),this._eventEmitters.viewUpdate.emit()}_updateTheme(t){if(this.widget){if(t){if(this.optionsStore.options.display.theme===t)return;this.optionsStore.options.display.theme=t}this.widget.classList.remove("light","dark"),this.widget.classList.add(this._getThemeClass()),"auto"===this.optionsStore.options.display.theme?window.matchMedia(l.css.isDarkPreferredQuery).addEventListener("change",(()=>this._updateTheme())):window.matchMedia(l.css.isDarkPreferredQuery).removeEventListener("change",(()=>this._updateTheme()))}}_getThemeClass(){const t=this.optionsStore.options.display.theme||"auto",e=window.matchMedia&&window.matchMedia(l.css.isDarkPreferredQuery).matches;switch(t){case"light":return l.css.lightTheme;case"dark":return l.css.darkTheme;case"auto":return e?l.css.darkTheme:l.css.lightTheme}}_updateCalendarHeader(){const t=[...this.widget.querySelector(`.${l.css.dateContainer} div[style*="display: grid"]`).classList].find((t=>t.startsWith(l.css.dateContainer))),[e,s,i]=this.widget.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");switch(t){case l.css.decadesContainer:e.setAttribute("title",this.optionsStore.options.localization.previousCentury),s.setAttribute("title",""),i.setAttribute("title",this.optionsStore.options.localization.nextCentury);break;case l.css.yearsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousDecade),s.setAttribute("title",this.optionsStore.options.localization.selectDecade),i.setAttribute("title",this.optionsStore.options.localization.nextDecade);break;case l.css.monthsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousYear),s.setAttribute("title",this.optionsStore.options.localization.selectYear),i.setAttribute("title",this.optionsStore.options.localization.nextYear);break;case l.css.daysContainer:e.setAttribute("title",this.optionsStore.options.localization.previousMonth),s.setAttribute("title",this.optionsStore.options.localization.selectMonth),i.setAttribute("title",this.optionsStore.options.localization.nextMonth),s.innerText=this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)}s.innerText=s.getAttribute(t)}hide(){this.widget&&this._isVisible&&(this.widget.classList.remove(l.css.show),this._isVisible&&(this._eventEmitters.triggerEvent.emit({type:l.events.hide,date:this.optionsStore.unset?null:this.dates.lastPicked?this.dates.lastPicked.clone:void 0}),this._isVisible=!1),document.removeEventListener("click",this._documentClickEvent))}toggle(){return this._isVisible?this.hide():this.show()}_dispose(){document.removeEventListener("click",this._documentClickEvent),this.widget&&(this.widget.querySelectorAll("[data-action]").forEach((t=>t.removeEventListener("click",this._actionsClickEvent))),this.widget.parentNode.removeChild(this.widget),this._widget=void 0)}_buildWidget(){const t=document.createElement("div");t.classList.add(l.css.widget);const e=document.createElement("div");e.classList.add(l.css.dateContainer),e.append(this.getHeadTemplate(),this.decadeDisplay.getPicker(),this.yearDisplay.getPicker(),this.monthDisplay.getPicker(),this.dateDisplay.getPicker());const s=document.createElement("div");s.classList.add(l.css.timeContainer),s.appendChild(this.timeDisplay.getPicker(this._iconTag.bind(this))),s.appendChild(this.hourDisplay.getPicker()),s.appendChild(this.minuteDisplay.getPicker()),s.appendChild(this.secondDisplay.getPicker());const i=document.createElement("div");if(i.classList.add(l.css.toolbar),i.append(...this.getToolbarElements()),this.optionsStore.options.display.inline&&t.classList.add(l.css.inline),this.optionsStore.options.display.calendarWeeks&&t.classList.add("calendarWeeks"),this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){t.classList.add(l.css.sideBySide),"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");return o.classList.add("td-row"),e.classList.add("td-half"),s.classList.add("td-half"),o.appendChild(e),o.appendChild(s),t.appendChild(o),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),void(this._widget=t)}"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),this._hasDate&&(this._hasTime&&(e.classList.add(l.css.collapse),"clock"!==this.optionsStore.options.display.viewMode&&e.classList.add(l.css.show)),t.appendChild(e)),this._hasTime&&(this._hasDate&&(s.classList.add(l.css.collapse),"clock"===this.optionsStore.options.display.viewMode&&s.classList.add(l.css.show)),t.appendChild(s)),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");o.classList.add("arrow"),o.setAttribute("data-popper-arrow",""),t.appendChild(o),this._widget=t}get _hasTime(){return this.optionsStore.options.display.components.clock&&(this.optionsStore.options.display.components.hours||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.components.seconds)}get _hasDate(){return this.optionsStore.options.display.components.calendar&&(this.optionsStore.options.display.components.year||this.optionsStore.options.display.components.month||this.optionsStore.options.display.components.date)}getToolbarElements(){const t=[];if(this.optionsStore.options.display.buttons.today){const e=document.createElement("div");e.setAttribute("data-action",f.today),e.setAttribute("title",this.optionsStore.options.localization.today),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.today)),t.push(e)}if(!this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){let e,s;"clock"===this.optionsStore.options.display.viewMode?(e=this.optionsStore.options.localization.selectDate,s=this.optionsStore.options.display.icons.date):(e=this.optionsStore.options.localization.selectTime,s=this.optionsStore.options.display.icons.time);const i=document.createElement("div");i.setAttribute("data-action",f.togglePicker),i.setAttribute("title",e),i.appendChild(this._iconTag(s)),t.push(i)}if(this.optionsStore.options.display.buttons.clear){const e=document.createElement("div");e.setAttribute("data-action",f.clear),e.setAttribute("title",this.optionsStore.options.localization.clear),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.clear)),t.push(e)}if(this.optionsStore.options.display.buttons.close){const e=document.createElement("div");e.setAttribute("data-action",f.close),e.setAttribute("title",this.optionsStore.options.localization.close),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.close)),t.push(e)}return t}getHeadTemplate(){const t=document.createElement("div");t.classList.add(l.css.calendarHeader);const e=document.createElement("div");e.classList.add(l.css.previous),e.setAttribute("data-action",f.previous),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.previous));const s=document.createElement("div");s.classList.add(l.css.switch),s.setAttribute("data-action",f.changeCalendarView);const i=document.createElement("div");return i.classList.add(l.css.next),i.setAttribute("data-action",f.next),i.appendChild(this._iconTag(this.optionsStore.options.display.icons.next)),t.append(e,s,i),t}_iconTag(t){if("sprites"===this.optionsStore.options.display.icons.type){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("xlink:href",t),s.setAttribute("href",t),e.appendChild(s),e}const e=document.createElement("i");return e.classList.add(...t.split(" ")),e}_rebuild(){const t=this._isVisible;t&&this.hide(),this._dispose(),t&&this.show()}}class O{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m),this.display=h.locate($),this._eventEmitters=h.locate(v),this._eventEmitters.action.subscribe((t=>{this.do(t.e,t.action)}))}do(t,s){var i,o;const n=null==t?void 0:t.currentTarget;if(null===(i=null==n?void 0:n.classList)||void 0===i?void 0:i.contains(l.css.disabled))return!1;s=s||(null===(o=null==n?void 0:n.dataset)||void 0===o?void 0:o.action);const r=(this.dates.lastPicked||this.optionsStore.viewDate).clone;switch(s){case f.next:case f.previous:this.handleNextPrevious(s);break;case f.changeCalendarView:this.display._showMode(1),this.display._updateCalendarHeader();break;case f.selectMonth:case f.selectYear:case f.selectDecade:const i=+n.dataset.value;switch(s){case f.selectMonth:this.optionsStore.viewDate.month=i;break;case f.selectYear:case f.selectDecade:this.optionsStore.viewDate.year=i}this.optionsStore.currentCalendarViewMode===this.optionsStore.minimumCalendarViewMode?(this.dates.setValue(this.optionsStore.viewDate,this.dates.lastPickedIndex),this.optionsStore.options.display.inline||this.display.hide()):this.display._showMode(-1);break;case f.selectDay:const o=this.optionsStore.viewDate.clone;n.classList.contains(l.css.old)&&o.manipulate(-1,e.month),n.classList.contains(l.css.new)&&o.manipulate(1,e.month),o.date=+n.dataset.day;let d=0;this.optionsStore.options.multipleDates?(d=this.dates.pickedIndex(o,e.date),-1!==d?this.dates.setValue(null,d):this.dates.setValue(o,this.dates.lastPickedIndex+1)):this.dates.setValue(o,this.dates.lastPickedIndex),this.display._hasTime||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline||this.optionsStore.options.multipleDates||this.display.hide();break;case f.selectHour:let c=+n.dataset.value;r.hours>=12&&!this.optionsStore.options.display.components.useTwentyfourHour&&(c+=12),r.hours=c,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case f.selectMinute:r.minutes=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case f.selectSecond:r.seconds=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case f.incrementHours:this.manipulateAndSet(r,e.hours);break;case f.incrementMinutes:this.manipulateAndSet(r,e.minutes,this.optionsStore.options.stepping);break;case f.incrementSeconds:this.manipulateAndSet(r,e.seconds);break;case f.decrementHours:this.manipulateAndSet(r,e.hours,-1);break;case f.decrementMinutes:this.manipulateAndSet(r,e.minutes,-1*this.optionsStore.options.stepping);break;case f.decrementSeconds:this.manipulateAndSet(r,e.seconds,-1);break;case f.toggleMeridiem:this.manipulateAndSet(r,e.hours,this.dates.lastPicked.hours>=12?-12:12);break;case f.togglePicker:n.getAttribute("title")===this.optionsStore.options.localization.selectDate?(n.setAttribute("title",this.optionsStore.options.localization.selectTime),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.time).outerHTML,this.display._updateCalendarHeader(),this.optionsStore.refreshCurrentView()):(n.setAttribute("title",this.optionsStore.options.localization.selectDate),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.date).outerHTML,this.display._hasTime&&(this.handleShowClockContainers(f.showClock),this.display._update("clock"))),this.display.widget.querySelectorAll(`.${l.css.dateContainer}, .${l.css.timeContainer}`).forEach((t=>A.toggle(t))),this._eventEmitters.viewUpdate.emit();break;case f.showClock:case f.showHours:case f.showMinutes:case f.showSeconds:this.optionsStore.options.display.sideBySide||"clock"===this.optionsStore.currentView||(A.hideImmediately(this.display.widget.querySelector(`div.${l.css.dateContainer}`)),A.showImmediately(this.display.widget.querySelector(`div.${l.css.timeContainer}`))),this.handleShowClockContainers(s);break;case f.clear:this.dates.setValue(null),this.display._updateCalendarHeader();break;case f.close:this.display.hide();break;case f.today:const h=(new a).setLocale(this.optionsStore.options.localization.locale);this.optionsStore.viewDate=h,this.validation.isValid(h,e.date)&&this.dates.setValue(h,this.dates.lastPickedIndex)}}handleShowClockContainers(t){if(!this.display._hasTime)return void l.errorMessages.throwError("Cannot show clock containers when time is disabled.");this.optionsStore.currentView="clock",this.display.widget.querySelectorAll(`.${l.css.timeContainer} > div`).forEach((t=>t.style.display="none"));let s="";switch(t){case f.showClock:s=l.css.clockContainer,this.display._update("clock");break;case f.showHours:s=l.css.hourContainer,this.display._update(e.hours);break;case f.showMinutes:s=l.css.minuteContainer,this.display._update(e.minutes);break;case f.showSeconds:s=l.css.secondContainer,this.display._update(e.seconds)}this.display.widget.getElementsByClassName(s)[0].style.display="grid"}handleNextPrevious(t){const{unit:e,step:s}=p[this.optionsStore.currentCalendarViewMode];t===f.next?this.optionsStore.viewDate.manipulate(s,e):this.optionsStore.viewDate.manipulate(-1*s,e),this._eventEmitters.viewUpdate.emit(),this.display._showMode()}hideOrClock(t){!this.optionsStore.options.display.components.useTwentyfourHour||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline?this.do(t,f.showClock):this.display.hide()}manipulateAndSet(t,e,s=1){const i=t.manipulate(s,e);this.validation.isValid(i,e)&&this.dates.setValue(i,this.dates.lastPickedIndex)}}class V{constructor(t,e={}){this._subscribers={},this._isDisabled=!1,this._inputChangeEvent=t=>{if(null==t?void 0:t.detail)return;const e=()=>{this.dates.lastPicked&&(this.optionsStore.viewDate=this.dates.lastPicked.clone)},s=this.optionsStore.input.value;if(this.optionsStore.options.multipleDates)try{const t=s.split(this.optionsStore.options.multipleDatesSeparator);for(let e=0;e{var t,e;(null===(t=this.optionsStore.element)||void 0===t?void 0:t.disabled)||(null===(e=this.optionsStore.input)||void 0===e?void 0:e.disabled)||this.toggle()},h=new c,this._eventEmitters=h.locate(v),this.optionsStore=h.locate(u),this.display=h.locate($),this.dates=h.locate(w),this.actions=h.locate(O),t||l.errorMessages.mustProvideElement(),this.optionsStore.element=t,this._initializeOptions(e,g,!0),this.optionsStore.viewDate.setLocale(this.optionsStore.options.localization.locale),this.optionsStore.unset=!0,this._initializeInput(),this._initializeToggle(),this.optionsStore.options.display.inline&&this.display.show(),this._eventEmitters.triggerEvent.subscribe((t=>{this._triggerEvent(t)})),this._eventEmitters.viewUpdate.subscribe((()=>{this._viewUpdate()}))}get viewDate(){return this.optionsStore.viewDate}updateOptions(t,e=!1){e?this._initializeOptions(t,g):this._initializeOptions(t,this.optionsStore.options),this.display._rebuild()}toggle(){this._isDisabled||this.display.toggle()}show(){this._isDisabled||this.display.show()}hide(){this.display.hide()}disable(){var t;this._isDisabled=!0,null===(t=this.optionsStore.input)||void 0===t||t.setAttribute("disabled","disabled"),this.display.hide()}enable(){var t;this._isDisabled=!1,null===(t=this.optionsStore.input)||void 0===t||t.removeAttribute("disabled")}clear(){this.optionsStore.input.value="",this.dates.clear()}subscribe(t,e){let s;"string"==typeof t&&(t=[t]),s=Array.isArray(e)?e:[e],t.length!==s.length&&l.errorMessages.subscribeMismatch();const i=[];for(let e=0;e{e(t)}))}_viewUpdate(){this._triggerEvent({type:l.events.update,viewDate:this.optionsStore.viewDate.clone})}_unsubscribe(t,e){this._subscribers[t].splice(e,1)}_initializeOptions(t,e,s=!1){var i,o;let a=S.deepCopy(t);a=S._mergeOptions(a,e),s&&(a=S._dataToOptions(this.optionsStore.element,a)),S._validateConflicts(a),a.viewDate=a.viewDate.setLocale(a.localization.locale),this.optionsStore.viewDate.isSame(a.viewDate)||(this.optionsStore.viewDate=a.viewDate),a.display.components.year&&(this.optionsStore.minimumCalendarViewMode=2),a.display.components.month&&(this.optionsStore.minimumCalendarViewMode=1),a.display.components.date&&(this.optionsStore.minimumCalendarViewMode=0),this.optionsStore.currentCalendarViewMode=Math.max(this.optionsStore.minimumCalendarViewMode,this.optionsStore.currentCalendarViewMode),p[this.optionsStore.currentCalendarViewMode].name!==a.display.viewMode&&(this.optionsStore.currentCalendarViewMode=Math.max(p.findIndex((t=>t.name===a.display.viewMode)),this.optionsStore.minimumCalendarViewMode)),(null===(i=this.display)||void 0===i?void 0:i.isVisible)&&this.display._update("all"),void 0===a.display.components.useTwentyfourHour&&(a.display.components.useTwentyfourHour=!(null===(o=a.viewDate.parts())||void 0===o?void 0:o.dayPeriod)),this.optionsStore.options=a}_initializeInput(){if("INPUT"==this.optionsStore.element.tagName)this.optionsStore.input=this.optionsStore.element;else{let t=this.optionsStore.element.dataset.tdTargetInput;this.optionsStore.input=null==t||"nearest"==t?this.optionsStore.element.querySelector("input"):this.optionsStore.element.querySelector(t)}this.optionsStore.input&&(this.optionsStore.input.addEventListener("change",this._inputChangeEvent),this.optionsStore.options.allowInputToggle&&this.optionsStore.input.addEventListener("click",this._toggleClickEvent),this.optionsStore.input.value&&this._inputChangeEvent())}_initializeToggle(){if(this.optionsStore.options.display.inline)return;let t=this.optionsStore.element.dataset.tdTargetToggle;"nearest"==t&&(t='[data-td-toggle="datetimepicker"]'),this._toggle=null==t?this.optionsStore.element:this.optionsStore.element.querySelector(t),this._toggle.addEventListener("click",this._toggleClickEvent)}_handleAfterChangeEvent(t){var e,s;!this.optionsStore.options.promptTimeOnDateChange||this.optionsStore.options.display.inline||this.optionsStore.options.display.sideBySide||!this.display._hasTime||(null===(e=this.display.widget)||void 0===e?void 0:e.getElementsByClassName(l.css.show)[0].classList.contains(l.css.timeContainer))||!t.oldDate&&this.optionsStore.options.useCurrent||t.oldDate&&(null===(s=t.date)||void 0===s?void 0:s.isSame(t.oldDate))||(clearTimeout(this._currentPromptTimeTimeout),this._currentPromptTimeTimeout=setTimeout((()=>{this.display.widget&&this._eventEmitters.action.emit({e:{currentTarget:this.display.widget.querySelector(`.${l.css.switch} div`)},action:f.togglePicker})}),this.optionsStore.options.promptTimeOnDateChangeTransitionDelay))}}const H={},x={TempusDominus:V,extend:function(t,e){return t?(t.installed||(t(e,{TempusDominus:V,Dates:w,Display:$,DateTime:a,ErrorMessages:r},x),t.installed=!0),x):x},loadLocale:t=>{H[t.name]||(H[t.name]=t.localization)},locale:t=>{let e=H[t];e&&(g.localization=e)},Namespace:l,DefaultOptions:g,DateTime:a,Unit:e,version:"6.0.0"};export{x as default}; diff --git a/dist/js/tempus-dominus.js b/dist/js/tempus-dominus.js index 8bb35caac..b3f7261d9 100644 --- a/dist/js/tempus-dominus.js +++ b/dist/js/tempus-dominus.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ @@ -3869,7 +3869,7 @@ } return tempusDominus; }; - const version = '6.0.0-beta10'; + const version = '6.0.0'; const tempusDominus = { TempusDominus, extend, diff --git a/dist/js/tempus-dominus.min.js b/dist/js/tempus-dominus.min.js index 4bfb8862b..96dfa618f 100644 --- a/dist/js/tempus-dominus.min.js +++ b/dist/js/tempus-dominus.min.js @@ -1,6 +1,6 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).tempusDominus=e(t.Popper)}(this,(function(t){"use strict";var e;!function(t){t.seconds="seconds",t.minutes="minutes",t.hours="hours",t.date="date",t.month="month",t.year="year"}(e||(e={}));const s={month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0},i={hour:"2-digit",hour12:!1},o=t=>{switch(t){case"date":return{dateStyle:"short"};case"month":return{month:"numeric",year:"numeric"};case"year":return{year:"numeric"}}};class a extends Date{constructor(){super(...arguments),this.locale="default",this.nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],this.leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335]}setLocale(t){return this.locale=t,this}static convert(t,e="default"){if(!t)throw new Error("A date is required");return new a(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).setLocale(e)}static fromString(t,e){return new a(t)}get clone(){return new a(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.getMilliseconds()).setLocale(this.locale)}startOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(0);break;case"minutes":this.setSeconds(0,0);break;case"hours":this.setMinutes(0,0,0);break;case"date":this.setHours(0,0,0,0);break;case"weekDay":if(this.startOf(e.date),this.weekDay===s)break;let t=this.weekDay;0!==s&&0===this.weekDay&&(t=8-s),this.manipulate(s-t,e.date);break;case"month":this.startOf(e.date),this.setDate(1);break;case"year":this.startOf(e.date),this.setMonth(0,1)}return this}endOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(999);break;case"minutes":this.setSeconds(59,999);break;case"hours":this.setMinutes(59,59,999);break;case"date":this.setHours(23,59,59,999);break;case"weekDay":this.endOf(e.date),this.manipulate(6+s-this.weekDay,e.date);break;case"month":this.endOf(e.date),this.manipulate(1,e.month),this.setDate(0);break;case"year":this.endOf(e.date),this.manipulate(1,e.year),this.setDate(0)}return this}manipulate(t,e){if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this[e]+=t,this}format(t,e=this.locale){return new Intl.DateTimeFormat(e,t).format(this)}isBefore(t,e){if(!e)return this.valueOf()t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this.clone.startOf(e).valueOf()>t.clone.startOf(e).valueOf()}isSame(t,e){if(!e)return this.valueOf()===t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return t=a.convert(t),this.clone.startOf(e).valueOf()===t.startOf(e).valueOf()}isBetween(t,e,s,i="()"){if(s&&void 0===this[s])throw new Error(`Unit '${s}' is not valid`);const o="("===i[0],a=")"===i[1];return(o?this.isAfter(t,s):!this.isBefore(t,s))&&(a?this.isBefore(e,s):!this.isAfter(e,s))||(o?this.isBefore(t,s):!this.isAfter(t,s))&&(a?this.isAfter(e,s):!this.isBefore(e,s))}parts(t=this.locale,e={dateStyle:"full",timeStyle:"long"}){const s={};return new Intl.DateTimeFormat(t,e).formatToParts(this).filter((t=>"literal"!==t.type)).forEach((t=>s[t.type]=t.value)),s}get seconds(){return this.getSeconds()}set seconds(t){this.setSeconds(t)}get secondsFormatted(){return this.parts(void 0,s).second}get minutes(){return this.getMinutes()}set minutes(t){this.setMinutes(t)}get minutesFormatted(){return this.parts(void 0,s).minute}get hours(){return this.getHours()}set hours(t){this.setHours(t)}get hoursFormatted(){return this.parts(void 0,i).hour}get twelveHoursFormatted(){return this.parts(void 0,s).hour}meridiem(t=this.locale){var e;return null===(e=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(this).find((t=>"dayPeriod"===t.type)))||void 0===e?void 0:e.value}get date(){return this.getDate()}set date(t){this.setDate(t)}get dateFormatted(){return this.parts(void 0,s).day}get weekDay(){return this.getDay()}get month(){return this.getMonth()}set month(t){const e=new Date(this.year,t+1);e.setDate(0);const s=e.getDate();this.date>s&&(this.date=s),this.setMonth(t)}get monthFormatted(){return this.parts(void 0,s).month}get year(){return this.getFullYear()}set year(t){this.setFullYear(t)}get week(){const t=this.computeOrdinal(),e=this.getUTCDay();let s=Math.floor((t-e+10)/7);return s<1?s=this.weeksInWeekYear(this.year-1):s>this.weeksInWeekYear(this.year)&&(s=1),s}weeksInWeekYear(t){const e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,s=t-1,i=(s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400))%7;return 4===e||3===i?53:52}get isLeapYear(){return this.year%4==0&&(this.year%100!=0||this.year%400==0)}computeOrdinal(){return this.date+(this.isLeapYear?this.leapLadder:this.nonLeapLadder)[this.month]}}class n extends Error{}class r{constructor(){this.base="TD:",this.failedToSetInvalidDate="Failed to set invalid date",this.failedToParseInput="Failed parse input field"}unexpectedOption(t){const e=new n(`${this.base} Unexpected option: ${t} does not match a known option.`);throw e.code=1,e}unexpectedOptions(t){const e=new n(`${this.base}: ${t.join(", ")}`);throw e.code=1,e}unexpectedOptionValue(t,e,s){const i=new n(`${this.base} Unexpected option value: ${t} does not accept a value of "${e}". Valid values are: ${s.join(", ")}`);throw i.code=2,i}typeMismatch(t,e,s){const i=new n(`${this.base} Mismatch types: ${t} has a type of ${e} instead of the required ${s}`);throw i.code=3,i}numbersOutOfRage(t,e,s){const i=new n(`${this.base} ${t} expected an array of number between ${e} and ${s}.`);throw i.code=4,i}failedToParseDate(t,e,s=!1){const i=new n(`${this.base} Could not correctly parse "${e}" to a date for ${t}.`);if(i.code=5,!s)throw i;console.warn(i)}mustProvideElement(){const t=new n(`${this.base} No element was provided.`);throw t.code=6,t}subscribeMismatch(){const t=new n(`${this.base} The subscribed events does not match the number of callbacks`);throw t.code=7,t}conflictingConfiguration(t){const e=new n(`${this.base} A configuration value conflicts with another rule. ${t}`);throw e.code=8,e}customDateFormatError(t){const e=new n(`${this.base} customDateFormat: ${t}`);throw e.code=9,e}dateString(){console.warn(`${this.base} Using a string for date options is not recommended unless you specify an ISO string or use the customDateFormat plugin.`)}throwError(t){const e=new n(`${this.base} ${t}`);throw e.code=9,e}}const d="tempus-dominus";class l{}l.NAME=d,l.dataKey="td",l.events=new class{constructor(){this.key=".td",this.change=`change${this.key}`,this.update=`update${this.key}`,this.error=`error${this.key}`,this.show=`show${this.key}`,this.hide=`hide${this.key}`,this.blur=`blur${this.key}`,this.focus=`focus${this.key}`,this.keyup=`keyup${this.key}`,this.keydown=`keydown${this.key}`}},l.css=new class{constructor(){this.widget=`${d}-widget`,this.calendarHeader="calendar-header",this.switch="picker-switch",this.toolbar="toolbar",this.noHighlight="no-highlight",this.sideBySide="timepicker-sbs",this.previous="previous",this.next="next",this.disabled="disabled",this.old="old",this.new="new",this.active="active",this.dateContainer="date-container",this.decadesContainer=`${this.dateContainer}-decades`,this.decade="decade",this.yearsContainer=`${this.dateContainer}-years`,this.year="year",this.monthsContainer=`${this.dateContainer}-months`,this.month="month",this.daysContainer=`${this.dateContainer}-days`,this.day="day",this.calendarWeeks="cw",this.dayOfTheWeek="dow",this.today="today",this.weekend="weekend",this.timeContainer="time-container",this.separator="separator",this.clockContainer=`${this.timeContainer}-clock`,this.hourContainer=`${this.timeContainer}-hour`,this.minuteContainer=`${this.timeContainer}-minute`,this.secondContainer=`${this.timeContainer}-second`,this.hour="hour",this.minute="minute",this.second="second",this.toggleMeridiem="toggleMeridiem",this.show="show",this.collapsing="td-collapsing",this.collapse="td-collapse",this.inline="inline",this.lightTheme="light",this.darkTheme="dark",this.isDarkPreferredQuery="(prefers-color-scheme: dark)"}},l.errorMessages=new r;class c{constructor(){this.cache=new Map}locate(t){const e=this.cache.get(t);if(e)return e;const s=new t;return this.cache.set(t,s),s}}let h;const p=[{name:"calendar",className:l.css.daysContainer,unit:e.month,step:1},{name:"months",className:l.css.monthsContainer,unit:e.year,step:1},{name:"years",className:l.css.yearsContainer,unit:e.year,step:10},{name:"decades",className:l.css.decadesContainer,unit:e.year,step:100}];class u{constructor(){this.viewDate=new a,this._currentCalendarViewMode=0,this.minimumCalendarViewMode=0,this.currentView="calendar"}get currentCalendarViewMode(){return this._currentCalendarViewMode}set currentCalendarViewMode(t){this._currentCalendarViewMode=t,this.currentView=p[t].name}refreshCurrentView(){this.currentView=p[this.currentCalendarViewMode].name}}class m{constructor(){this.optionsStore=h.locate(u)}isValid(t,s){var i;if(this.optionsStore.options.restrictions.disabledDates.length>0&&this._isInDisabledDates(t))return!1;if(this.optionsStore.options.restrictions.enabledDates.length>0&&!this._isInEnabledDates(t))return!1;if(s!==e.month&&s!==e.year&&(null===(i=this.optionsStore.options.restrictions.daysOfWeekDisabled)||void 0===i?void 0:i.length)>0&&-1!==this.optionsStore.options.restrictions.daysOfWeekDisabled.indexOf(t.weekDay))return!1;if(this.optionsStore.options.restrictions.minDate&&t.isBefore(this.optionsStore.options.restrictions.minDate,s))return!1;if(this.optionsStore.options.restrictions.maxDate&&t.isAfter(this.optionsStore.options.restrictions.maxDate,s))return!1;if(s===e.hours||s===e.minutes||s===e.seconds){if(this.optionsStore.options.restrictions.disabledHours.length>0&&this._isInDisabledHours(t))return!1;if(this.optionsStore.options.restrictions.enabledHours.length>0&&!this._isInEnabledHours(t))return!1;if(this.optionsStore.options.restrictions.disabledTimeIntervals.length>0)for(let e of this.optionsStore.options.restrictions.disabledTimeIntervals)if(t.isBetween(e.from,e.to))return!1}return!0}_isInDisabledDates(t){if(!this.optionsStore.options.restrictions.disabledDates||0===this.optionsStore.options.restrictions.disabledDates.length)return!1;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.disabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInEnabledDates(t){if(!this.optionsStore.options.restrictions.enabledDates||0===this.optionsStore.options.restrictions.enabledDates.length)return!0;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.enabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInDisabledHours(t){if(!this.optionsStore.options.restrictions.disabledHours||0===this.optionsStore.options.restrictions.disabledHours.length)return!1;const e=t.hours;return this.optionsStore.options.restrictions.disabledHours.find((t=>t===e))}_isInEnabledHours(t){if(!this.optionsStore.options.restrictions.enabledHours||0===this.optionsStore.options.restrictions.enabledHours.length)return!0;const e=t.hours;return this.optionsStore.options.restrictions.enabledHours.find((t=>t===e))}}class y{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),this.unsubscribe.bind(this,this.subscribers.length-1)}unsubscribe(t){this.subscribers.splice(t,1)}emit(t){this.subscribers.forEach((e=>{e(t)}))}destroy(){this.subscribers=null,this.subscribers=[]}}class v{constructor(){this.triggerEvent=new y,this.viewUpdate=new y,this.updateDisplay=new y,this.action=new y}destroy(){this.triggerEvent.destroy(),this.viewUpdate.destroy(),this.updateDisplay.destroy(),this.action.destroy()}}const g={restrictions:{minDate:void 0,maxDate:void 0,disabledDates:[],enabledDates:[],daysOfWeekDisabled:[],disabledTimeIntervals:[],disabledHours:[],enabledHours:[]},display:{icons:{type:"icons",time:"fa-solid fa-clock",date:"fa-solid fa-calendar",up:"fa-solid fa-arrow-up",down:"fa-solid fa-arrow-down",previous:"fa-solid fa-chevron-left",next:"fa-solid fa-chevron-right",today:"fa-solid fa-calendar-check",clear:"fa-solid fa-trash",close:"fa-solid fa-xmark"},sideBySide:!1,calendarWeeks:!1,viewMode:"calendar",toolbarPlacement:"bottom",keepOpen:!1,buttons:{today:!1,clear:!1,close:!1},components:{calendar:!0,date:!0,month:!0,year:!0,decades:!0,clock:!0,hours:!0,minutes:!0,seconds:!1,useTwentyfourHour:void 0},inline:!1,theme:"auto"},stepping:1,useCurrent:!0,defaultDate:void 0,localization:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",previousMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",previousYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",previousDecade:"Previous Decade",nextDecade:"Next Decade",previousCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",toggleMeridiem:"Toggle Meridiem",selectTime:"Select Time",selectDate:"Select Date",dayViewHeaderFormat:{month:"long",year:"2-digit"},locale:"default",startOfTheWeek:0,dateFormats:{LTS:"h:mm:ss T",LT:"h:mm T",L:"MM/dd/yyyy",LL:"MMMM d, yyyy",LLL:"MMMM d, yyyy h:mm T",LLLL:"dddd, MMMM d, yyyy h:mm T"},ordinal:t=>t,format:"L"},keepInvalid:!1,debug:!1,allowInputToggle:!1,viewDate:new a,multipleDates:!1,multipleDatesSeparator:"; ",promptTimeOnDateChange:!1,promptTimeOnDateChangeTransitionDelay:200,meta:{},container:void 0};class S{static deepCopy(t){const e={};return Object.keys(t).forEach((s=>{const i=t[s];e[s]=i,"object"!=typeof i||i instanceof HTMLElement||i instanceof Element||i instanceof Date||Array.isArray(i)||(e[s]=S.deepCopy(i))})),e}static objectPath(t,e){return"."===t.charAt(0)&&(t=t.slice(1)),t?t.split(".").reduce(((t,e)=>S.isValue(t)||S.isValue(t[e])?t[e]:void 0),e):e}static spread(t,e,s="",i){const o=S.objectPath(s,g),a=Object.keys(t).filter((t=>!Object.keys(o).includes(t)));if(a.length>0){const t=S.getFlattenDefaultOptions(),e=a.map((e=>{let i=`"${s}.${e}" in not a known option.`,o=t.find((t=>t.includes(e)));return o&&(i+=` Did you mean "${o}"?`),i}));l.errorMessages.unexpectedOptions(e)}Object.keys(t).filter((t=>"__proto__"!==t&&"constructor"!==t)).forEach((a=>{"."===(s+=`.${a}`).charAt(0)&&(s=s.slice(1));const n=o[a];let r=typeof t[a],d=typeof n,l=t[a];if(null==l)return e[a]=l,void(s=s.substring(0,s.lastIndexOf(`.${a}`)));"object"!=typeof n||Array.isArray(t[a])||n instanceof Date||S.ignoreProperties.includes(a)?e[a]=S.processKey(a,l,r,d,s,i):S.spread(t[a],e[a],s,i),s=s.substring(0,s.lastIndexOf(`.${a}`))}))}static processKey(t,e,s,i,o,a){switch(t){case"defaultDate":{const t=this.dateConversion(e,"defaultDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("defaultDate",s,"DateTime or Date");break}case"viewDate":{const t=this.dateConversion(e,"viewDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("viewDate",s,"DateTime or Date");break}case"minDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.minDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.minDate",s,"DateTime or Date");break}case"maxDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.maxDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.maxDate",s,"DateTime or Date");break}case"disabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.disabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.disabledHours",0,23),e);case"enabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.enabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.enabledHours",0,23),e);case"daysOfWeekDisabled":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.daysOfWeekDisabled",e,s),e.filter((t=>t<0||t>6)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.daysOfWeekDisabled",0,6),e);case"enabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.enabledDates",e,s,a),e);case"disabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.disabledDates",e,s,a),e);case"disabledTimeIntervals":if(void 0===e)return[];Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of { from: DateTime|Date, to: DateTime|Date }");const n=e;for(let e=0;e{const i=`${t}[${e}].${s}`;let o=n[e][s];const r=this.dateConversion(o,i,a);r||l.errorMessages.typeMismatch(i,typeof o,"DateTime or Date"),r.setLocale(a.locale),n[e][s]=r}));return n;case"toolbarPlacement":case"type":case"viewMode":case"theme":const r={toolbarPlacement:["top","bottom","default"],type:["icons","sprites"],viewMode:["clock","calendar","months","years","decades"],theme:["light","dark","auto"]}[t];return r.includes(e)||l.errorMessages.unexpectedOptionValue(o.substring(1),e,r),e;case"meta":case"dayViewHeaderFormat":return e;case"container":return e&&!(e instanceof HTMLElement||e instanceof Element||(null==e?void 0:e.appendChild))&&l.errorMessages.typeMismatch(o.substring(1),typeof e,"HTMLElement"),e;case"useTwentyfourHour":if(void 0===e||"boolean"===s)return e;l.errorMessages.typeMismatch(o,s,i);break;default:switch(i){case"boolean":return"true"===e||!0===e;case"number":return+e;case"string":return e.toString();case"object":return{};case"function":return e;default:l.errorMessages.typeMismatch(o,s,i)}}}static _mergeOptions(t,e){var s;const i=S.deepCopy(e),o="default"!==(null===(s=e.localization)||void 0===s?void 0:s.locale)?e.localization:(null==t?void 0:t.localization)||g.localization;return S.spread(t,i,"",o),i}static _dataToOptions(t,e){const s=JSON.parse(JSON.stringify(t.dataset));if((null==s?void 0:s.tdTargetInput)&&delete s.tdTargetInput,(null==s?void 0:s.tdTargetToggle)&&delete s.tdTargetToggle,!s||0===Object.keys(s).length||s.constructor!==DOMStringMap)return e;let i={};const o=t=>{const e={};return Object.keys(t).forEach((t=>{e[t.toLowerCase()]=t})),e},a=(t,e,s,i)=>{const n=o(s)[t[e].toLowerCase()],r={};return void 0===n||(s[n].constructor===Object?(e++,r[n]=a(t,e,s[n],i)):r[n]=i),r},n=o(e);return Object.keys(s).filter((t=>t.startsWith(l.dataKey))).map((t=>t.substring(2))).forEach((t=>{let o=n[t.toLowerCase()];if(t.includes("_")){const r=t.split("_");o=n[r[0].toLowerCase()],void 0!==o&&e[o].constructor===Object&&(i[o]=a(r,1,e[o],s[`td${t}`]))}else void 0!==o&&(i[o]=s[`td${t}`])})),this._mergeOptions(i,e)}static _dateTypeCheck(t,e){if(t.constructor.name===a.name)return t;if(t.constructor.name===Date.name)return a.convert(t);if("string"==typeof t){const s=a.fromString(t,e);return"null"===JSON.stringify(s)?null:s}return null}static _typeCheckDateArray(t,e,s,i){var o;Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of DateTime or Date");for(let s=0;s"number"!=typeof t))||l.errorMessages.typeMismatch(t,s,"array of numbers")}static dateConversion(t,e,s){"string"==typeof t&&"input"!==e&&l.errorMessages.dateString();const i=this._dateTypeCheck(t,s);return i||l.errorMessages.failedToParseDate(e,t,"input"===e),i}static getFlattenDefaultOptions(){if(this._flattenDefaults)return this._flattenDefaults;const t=(e,s=[])=>Array.isArray(e)?[]:Object(e)===e?Object.entries(e).flatMap((([e,i])=>t(i,[...s,e]))):s.join(".");return this._flattenDefaults=t(g),this._flattenDefaults}static _validateConflicts(t){!t.display.sideBySide||t.display.components.clock&&(t.display.components.hours||t.display.components.minutes||t.display.components.seconds)||l.errorMessages.conflictingConfiguration("Cannot use side by side mode without the clock components"),t.restrictions.minDate&&t.restrictions.maxDate&&(t.restrictions.minDate.isAfter(t.restrictions.maxDate)&&l.errorMessages.conflictingConfiguration("minDate is after maxDate"),t.restrictions.maxDate.isBefore(t.restrictions.minDate)&&l.errorMessages.conflictingConfiguration("maxDate is before minDate"))}}S.ignoreProperties=["meta","dayViewHeaderFormat","container","dateForms","ordinal"],S.isValue=t=>null!=t;class w{constructor(){this._dates=[],this.optionsStore=h.locate(u),this.validation=h.locate(m),this._eventEmitters=h.locate(v)}get picked(){return this._dates}get lastPicked(){return this._dates[this.lastPickedIndex]}get lastPickedIndex(){return 0===this._dates.length?0:this._dates.length-1}formatInput(t){const e=this.optionsStore.options.display.components;return t?t.format({year:e.calendar&&e.year?"numeric":void 0,month:e.calendar&&e.month?"2-digit":void 0,day:e.calendar&&e.date?"2-digit":void 0,hour:e.clock&&e.hours?e.useTwentyfourHour?"2-digit":"numeric":void 0,minute:e.clock&&e.minutes?"2-digit":void 0,second:e.clock&&e.seconds?"2-digit":void 0,hour12:!e.useTwentyfourHour}):""}parseInput(t){return S.dateConversion(t,"input",this.optionsStore.options.localization)}setFromInput(t,e){if(!t)return void this.setValue(void 0,e);const s=this.parseInput(t);s&&(s.setLocale(this.optionsStore.options.localization.locale),this.setValue(s,e))}add(t){this._dates.push(t)}isPicked(t,e){if(!e)return void 0!==this._dates.find((e=>e===t));const s=o(e);let i=t.format(s);return void 0!==this._dates.map((t=>t.format(s))).find((t=>t===i))}pickedIndex(t,e){if(!e)return this._dates.indexOf(t);const s=o(e);let i=t.format(s);return this._dates.map((t=>t.format(s))).indexOf(i)}clear(){this.optionsStore.unset=!0,this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:this.lastPicked,isClear:!0,isValid:!0}),this._dates=[]}static getStartEndYear(t,e){const s=t/10,i=Math.floor(e/t)*t;return[i,i+9*s,Math.floor(e/s)*s]}setValue(t,e){const s=void 0===e,i=!t&&s;let o=this.optionsStore.unset?null:this._dates[e];!o&&!this.optionsStore.unset&&s&&i&&(o=this.lastPicked);const a=()=>{if(!this.optionsStore.input)return;let e=this.formatInput(t);this.optionsStore.options.multipleDates&&(e=this._dates.map((t=>this.formatInput(t))).join(this.optionsStore.options.multipleDatesSeparator)),this.optionsStore.input.value!=e&&(this.optionsStore.input.value=e)};if(t&&(null==o?void 0:o.isSame(t)))a();else{if(!t)return!this.optionsStore.options.multipleDates||1===this._dates.length||i?(this.optionsStore.unset=!0,this._dates=[]):this._dates.splice(e,1),a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:o,isClear:i,isValid:!0}),void this._eventEmitters.updateDisplay.emit("all");if(e=e||0,t=t.clone,1!==this.optionsStore.options.stepping&&(t.minutes=Math.round(t.minutes/this.optionsStore.options.stepping)*this.optionsStore.options.stepping,t.seconds=0),this.validation.isValid(t))return this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this.optionsStore.unset=!1,this._eventEmitters.updateDisplay.emit("all"),void this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!0});this.optionsStore.options.keepInvalid&&(this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!1})),this._eventEmitters.triggerEvent.emit({type:l.events.error,reason:l.errorMessages.failedToSetInvalidDate,date:t,oldDate:o})}}}var f;!function(t){t.next="next",t.previous="previous",t.changeCalendarView="changeCalendarView",t.selectMonth="selectMonth",t.selectYear="selectYear",t.selectDecade="selectDecade",t.selectDay="selectDay",t.selectHour="selectHour",t.selectMinute="selectMinute",t.selectSecond="selectSecond",t.incrementHours="incrementHours",t.incrementMinutes="incrementMinutes",t.incrementSeconds="incrementSeconds",t.decrementHours="decrementHours",t.decrementMinutes="decrementMinutes",t.decrementSeconds="decrementSeconds",t.toggleMeridiem="toggleMeridiem",t.togglePicker="togglePicker",t.showClock="showClock",t.showHours="showHours",t.showMinutes="showMinutes",t.showSeconds="showSeconds",t.clear="clear",t.close="close",t.today="today"}(f||(f={}));var b=f;class D{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");if(t.classList.add(l.css.daysContainer),t.append(...this._daysOfTheWeek()),this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}for(let e=0;e<42;e++){if(0!==e&&e%7==0&&this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}const s=document.createElement("div");s.setAttribute("data-action",b.selectDay),t.appendChild(s)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.daysContainer)[0];if("calendar"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.daysContainer,this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)),this.optionsStore.options.display.components.month?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.month),e.month)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.month),e.month)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.month).startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).manipulate(12,e.hours);i.querySelectorAll(`[data-action="${b.selectDay}"], .${l.css.calendarWeeks}`).forEach((t=>{if(this.optionsStore.options.display.calendarWeeks&&t.classList.contains(l.css.calendarWeeks)){if("#"===t.innerText)return;return void(t.innerText=`${o.week}`)}let i=[];i.push(l.css.day),o.isBefore(this.optionsStore.viewDate,e.month)&&i.push(l.css.old),o.isAfter(this.optionsStore.viewDate,e.month)&&i.push(l.css.new),!this.optionsStore.unset&&this.dates.isPicked(o,e.date)&&i.push(l.css.active),this.validation.isValid(o,e.date)||i.push(l.css.disabled),o.isSame(new a,e.date)&&i.push(l.css.today),0!==o.weekDay&&6!==o.weekDay||i.push(l.css.weekend),s(e.date,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}-${o.monthFormatted}-${o.dateFormatted}`),t.setAttribute("data-day",`${o.date}`),t.innerText=o.format({day:"numeric"}),o.manipulate(1,e.date)}))}_daysOfTheWeek(){let t=this.optionsStore.viewDate.clone.startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).startOf(e.date);const s=[];if(document.createElement("div"),this.optionsStore.options.display.calendarWeeks){const t=document.createElement("div");t.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.innerText="#",s.push(t)}for(let i=0;i<7;i++){const i=document.createElement("div");i.classList.add(l.css.dayOfTheWeek,l.css.noHighlight),i.innerText=t.format({weekday:"short"}),t.manipulate(1,e.date),s.push(i)}return s}}class k{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.monthsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectMonth),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.monthsContainer)[0];if("months"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.monthsContainer,this.optionsStore.viewDate.format({year:"numeric"})),this.optionsStore.options.display.components.year?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.year),e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.year),e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year);i.querySelectorAll(`[data-action="${b.selectMonth}"]`).forEach(((t,i)=>{let a=[];a.push(l.css.month),!this.optionsStore.unset&&this.dates.isPicked(o,e.month)&&a.push(l.css.active),this.validation.isValid(o,e.month)||a.push(l.css.disabled),s(e.month,o,a,t),t.classList.remove(...t.classList),t.classList.add(...a),t.setAttribute("data-value",`${i}`),t.innerText=`${o.format({month:"short"})}`,o.manipulate(1,e.month)}))}}class _{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.yearsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectYear),t.appendChild(e)}return t}_update(t,s){this._startYear=this.optionsStore.viewDate.clone.manipulate(-1,e.year),this._endYear=this.optionsStore.viewDate.clone.manipulate(10,e.year);const i=t.getElementsByClassName(l.css.yearsContainer)[0];if("years"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.yearsContainer,`${this._startYear.format({year:"numeric"})}-${this._endYear.format({year:"numeric"})}`),this.optionsStore.options.display.components.decades?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this._startYear,e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this._endYear,e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year).manipulate(-1,e.year);i.querySelectorAll(`[data-action="${b.selectYear}"]`).forEach((t=>{let i=[];i.push(l.css.year),!this.optionsStore.unset&&this.dates.isPicked(o,e.year)&&i.push(l.css.active),this.validation.isValid(o,e.year)||i.push(l.css.disabled),s(e.year,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}`),t.innerText=o.format({year:"numeric"}),o.manipulate(1,e.year)}))}}class C{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.decadesContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectDecade),t.appendChild(e)}return t}_update(t,s){const[i,o]=w.getStartEndYear(100,this.optionsStore.viewDate.year);this._startDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._startDecade.year=i,this._endDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._endDecade.year=o;const a=t.getElementsByClassName(l.css.decadesContainer)[0],[n,r,d]=a.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");"decades"===this.optionsStore.currentView&&(r.setAttribute(l.css.decadesContainer,`${this._startDecade.format({year:"numeric"})}-${this._endDecade.format({year:"numeric"})}`),this.validation.isValid(this._startDecade,e.year)?n.classList.remove(l.css.disabled):n.classList.add(l.css.disabled),this.validation.isValid(this._endDecade,e.year)?d.classList.remove(l.css.disabled):d.classList.add(l.css.disabled));const c=this.dates.picked.map((t=>t.year));a.querySelectorAll(`[data-action="${b.selectDecade}"]`).forEach(((t,i)=>{if(0===i)return t.classList.add(l.css.old),this._startDecade.year-10<0?(t.textContent=" ",n.classList.add(l.css.disabled),t.classList.add(l.css.disabled),void t.setAttribute("data-value","")):(t.innerText=this._startDecade.clone.manipulate(-10,e.year).format({year:"numeric"}),void t.setAttribute("data-value",`${this._startDecade.year}`));let o=[];o.push(l.css.decade);const a=this._startDecade.year,r=this._startDecade.year+9;!this.optionsStore.unset&&c.filter((t=>t>=a&&t<=r)).length>0&&o.push(l.css.active),s("decade",this._startDecade,o,t),t.classList.remove(...t.classList),t.classList.add(...o),t.setAttribute("data-value",`${this._startDecade.year}`),t.innerText=`${this._startDecade.format({year:"numeric"})}`,this._startDecade.manipulate(10,e.year)}))}}class E{constructor(){this._gridColumns="",this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(t){const e=document.createElement("div");return e.classList.add(l.css.clockContainer),e.append(...this._grid(t)),e}_update(t){const s=t.getElementsByClassName(l.css.clockContainer)[0],i=(this.dates.lastPicked||this.optionsStore.viewDate).clone;if(s.querySelectorAll(".disabled").forEach((t=>t.classList.remove(l.css.disabled))),this.optionsStore.options.display.components.hours&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.hours),e.hours)||s.querySelector(`[data-action=${b.incrementHours}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.hours),e.hours)||s.querySelector(`[data-action=${b.decrementHours}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.hours}]`).innerText=this.optionsStore.options.display.components.useTwentyfourHour?i.hoursFormatted:i.twelveHoursFormatted),this.optionsStore.options.display.components.minutes&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.minutes),e.minutes)||s.querySelector(`[data-action=${b.incrementMinutes}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.minutes),e.minutes)||s.querySelector(`[data-action=${b.decrementMinutes}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.minutes}]`).innerText=i.minutesFormatted),this.optionsStore.options.display.components.seconds&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.seconds),e.seconds)||s.querySelector(`[data-action=${b.incrementSeconds}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.seconds),e.seconds)||s.querySelector(`[data-action=${b.decrementSeconds}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.seconds}]`).innerText=i.secondsFormatted),!this.optionsStore.options.display.components.useTwentyfourHour){const t=s.querySelector(`[data-action=${b.toggleMeridiem}]`);t.innerText=i.meridiem(),this.validation.isValid(i.clone.manipulate(i.hours>=12?-12:12,e.hours))?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled)}s.style.gridTemplateAreas=`"${this._gridColumns}"`}_grid(t){this._gridColumns="";const s=[],i=[],o=[],a=document.createElement("div"),n=t(this.optionsStore.options.display.icons.up),r=t(this.optionsStore.options.display.icons.down);a.classList.add(l.css.separator,l.css.noHighlight);const d=a.cloneNode(!0);d.innerHTML=":";const c=(t=!1)=>t?d.cloneNode(!0):a.cloneNode(!0);if(this.optionsStore.options.display.components.hours){let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementHour),t.setAttribute("data-action",b.incrementHours),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickHour),t.setAttribute("data-action",b.showHours),t.setAttribute("data-time-component",e.hours),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementHour),t.setAttribute("data-action",b.decrementHours),t.appendChild(r.cloneNode(!0)),o.push(t),this._gridColumns+="a"}if(this.optionsStore.options.display.components.minutes){this._gridColumns+=" a",this.optionsStore.options.display.components.hours&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementMinute),t.setAttribute("data-action",b.incrementMinutes),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickMinute),t.setAttribute("data-action",b.showMinutes),t.setAttribute("data-time-component",e.minutes),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementMinute),t.setAttribute("data-action",b.decrementMinutes),t.appendChild(r.cloneNode(!0)),o.push(t)}if(this.optionsStore.options.display.components.seconds){this._gridColumns+=" a",this.optionsStore.options.display.components.minutes&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementSecond),t.setAttribute("data-action",b.incrementSeconds),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickSecond),t.setAttribute("data-action",b.showSeconds),t.setAttribute("data-time-component",e.seconds),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementSecond),t.setAttribute("data-action",b.decrementSeconds),t.appendChild(r.cloneNode(!0)),o.push(t)}if(!this.optionsStore.options.display.components.useTwentyfourHour){this._gridColumns+=" a";let t=c();s.push(t);let e=document.createElement("button");e.setAttribute("title",this.optionsStore.options.localization.toggleMeridiem),e.setAttribute("data-action",b.toggleMeridiem),e.setAttribute("tabindex","-1"),l.css.toggleMeridiem.includes(",")?e.classList.add(...l.css.toggleMeridiem.split(",")):e.classList.add(l.css.toggleMeridiem),t=document.createElement("div"),t.classList.add(l.css.noHighlight),t.appendChild(e),i.push(t),t=c(),o.push(t)}return this._gridColumns=this._gridColumns.trim(),[...s,...i,...o]}}class M{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.hourContainer);for(let e=0;e<(this.optionsStore.options.display.components.useTwentyfourHour?24:12);e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectHour),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.hourContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.date);i.querySelectorAll(`[data-action="${b.selectHour}"]`).forEach((t=>{let i=[];i.push(l.css.hour),this.validation.isValid(o,e.hours)||i.push(l.css.disabled),s(e.hours,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.hours}`),t.innerText=this.optionsStore.options.display.components.useTwentyfourHour?o.hoursFormatted:o.twelveHoursFormatted,o.manipulate(1,e.hours)}))}}class L{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.minuteContainer);let e=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;for(let s=0;s<60/e;s++){const e=document.createElement("div");e.setAttribute("data-action",b.selectMinute),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.minuteContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.hours),a=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;i.querySelectorAll(`[data-action="${b.selectMinute}"]`).forEach((t=>{let i=[];i.push(l.css.minute),this.validation.isValid(o,e.minutes)||i.push(l.css.disabled),s(e.minutes,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.minutes}`),t.innerText=o.minutesFormatted,o.manipulate(a,e.minutes)}))}}class T{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.secondContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectSecond),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.secondContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.minutes);i.querySelectorAll(`[data-action="${b.selectSecond}"]`).forEach((t=>{let i=[];i.push(l.css.second),this.validation.isValid(o,e.seconds)||i.push(l.css.disabled),s(e.seconds,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.seconds}`),t.innerText=o.secondsFormatted,o.manipulate(5,e.seconds)}))}}class A{static toggle(t){t.classList.contains(l.css.show)?this.hide(t):this.show(t)}static showImmediately(t){t.classList.remove(l.css.collapsing),t.classList.add(l.css.collapse,l.css.show),t.style.height=""}static show(t){if(t.classList.contains(l.css.collapsing)||t.classList.contains(l.css.show))return;t.style.height="0",t.classList.remove(l.css.collapse),t.classList.add(l.css.collapsing),setTimeout((()=>{A.showImmediately(t)}),this.getTransitionDurationFromElement(t)),t.style.height=`${t.scrollHeight}px`}static hideImmediately(t){t&&(t.classList.remove(l.css.collapsing,l.css.show),t.classList.add(l.css.collapse))}static hide(t){if(t.classList.contains(l.css.collapsing)||!t.classList.contains(l.css.show))return;t.style.height=`${t.getBoundingClientRect().height}px`;t.offsetHeight,t.classList.remove(l.css.collapse,l.css.show),t.classList.add(l.css.collapsing),t.style.height="",setTimeout((()=>{A.hideImmediately(t)}),this.getTransitionDurationFromElement(t))}}A.getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e),o=Number.parseFloat(s);return i||o?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0};class ${constructor(){this._isVisible=!1,this._documentClickEvent=t=>{var e;this.optionsStore.options.debug||window.debug||!this._isVisible||t.composedPath().includes(this.widget)||(null===(e=t.composedPath())||void 0===e?void 0:e.includes(this.optionsStore.element))||this.hide()},this._actionsClickEvent=t=>{this._eventEmitters.action.emit({e:t})},this.optionsStore=h.locate(u),this.validation=h.locate(m),this.dates=h.locate(w),this.dateDisplay=h.locate(D),this.monthDisplay=h.locate(k),this.yearDisplay=h.locate(_),this.decadeDisplay=h.locate(C),this.timeDisplay=h.locate(E),this.hourDisplay=h.locate(M),this.minuteDisplay=h.locate(L),this.secondDisplay=h.locate(T),this._eventEmitters=h.locate(v),this._widget=void 0,this._eventEmitters.updateDisplay.subscribe((t=>{this._update(t)}))}get widget(){return this._widget}get isVisible(){return this._isVisible}_update(t){if(this.widget)switch(t){case e.seconds:this.secondDisplay._update(this.widget,this.paint);break;case e.minutes:this.minuteDisplay._update(this.widget,this.paint);break;case e.hours:this.hourDisplay._update(this.widget,this.paint);break;case e.date:this.dateDisplay._update(this.widget,this.paint);break;case e.month:this.monthDisplay._update(this.widget,this.paint);break;case e.year:this.yearDisplay._update(this.widget,this.paint);break;case"clock":if(!this._hasTime)break;this.timeDisplay._update(this.widget),this._update(e.hours),this._update(e.minutes),this._update(e.seconds);break;case"calendar":this._update(e.date),this._update(e.year),this._update(e.month),this.decadeDisplay._update(this.widget,this.paint),this._updateCalendarHeader();break;case"all":this._hasTime&&this._update("clock"),this._hasDate&&this._update("calendar")}}paint(t,e,s,i){}show(){var s,i;if(null==this.widget){if(0==this.dates.picked.length){if(this.optionsStore.options.useCurrent&&!this.optionsStore.options.defaultDate){const t=(new a).setLocale(this.optionsStore.options.localization.locale);if(!this.optionsStore.options.keepInvalid){let i=0,o=1;for((null===(s=this.optionsStore.options.restrictions.maxDate)||void 0===s?void 0:s.isBefore(t))&&(o=-1);!(this.validation.isValid(t)||(t.manipulate(o,e.date),i>31));)i++}this.dates.setValue(t)}this.optionsStore.options.defaultDate&&this.dates.setValue(this.optionsStore.options.defaultDate)}this._buildWidget(),this._updateTheme();const o=this._hasTime&&!this._hasDate;if(o&&(this.optionsStore.currentView="clock",this._eventEmitters.action.emit({e:null,action:b.showClock})),this.optionsStore.currentCalendarViewMode||(this.optionsStore.currentCalendarViewMode=this.optionsStore.minimumCalendarViewMode),o||"clock"===this.optionsStore.options.display.viewMode||(this._hasTime&&(this.optionsStore.options.display.sideBySide?A.show(this.widget.querySelector(`div.${l.css.timeContainer}`)):A.hideImmediately(this.widget.querySelector(`div.${l.css.timeContainer}`))),A.show(this.widget.querySelector(`div.${l.css.dateContainer}`))),this._hasDate&&this._showMode(),this.optionsStore.options.display.inline)this.optionsStore.element.appendChild(this.widget);else{((null===(i=this.optionsStore.options)||void 0===i?void 0:i.container)||document.body).appendChild(this.widget),this._popperInstance=t.createPopper(this.optionsStore.element,this.widget,{modifiers:[{name:"eventListeners",enabled:!0}],placement:"rtl"===document.documentElement.dir?"bottom-end":"bottom-start"})}"clock"==this.optionsStore.options.display.viewMode&&this._eventEmitters.action.emit({e:null,action:b.showClock}),this.widget.querySelectorAll("[data-action]").forEach((t=>t.addEventListener("click",this._actionsClickEvent))),this._hasTime&&this.optionsStore.options.display.sideBySide&&(this.timeDisplay._update(this.widget),this.widget.getElementsByClassName(l.css.clockContainer)[0].style.display="grid")}this.widget.classList.add(l.css.show),this.optionsStore.options.display.inline||(this._popperInstance.update(),document.addEventListener("click",this._documentClickEvent)),this._eventEmitters.triggerEvent.emit({type:l.events.show}),this._isVisible=!0}_showMode(t){if(!this.widget)return;if(t){const e=Math.max(this.optionsStore.minimumCalendarViewMode,Math.min(3,this.optionsStore.currentCalendarViewMode+t));if(this.optionsStore.currentCalendarViewMode==e)return;this.optionsStore.currentCalendarViewMode=e}this.widget.querySelectorAll(`.${l.css.dateContainer} > div:not(.${l.css.calendarHeader}), .${l.css.timeContainer} > div:not(.${l.css.clockContainer})`).forEach((t=>t.style.display="none"));const e=p[this.optionsStore.currentCalendarViewMode];let s=this.widget.querySelector(`.${e.className}`);switch(e.className){case l.css.decadesContainer:this.decadeDisplay._update(this.widget,this.paint);break;case l.css.yearsContainer:this.yearDisplay._update(this.widget,this.paint);break;case l.css.monthsContainer:this.monthDisplay._update(this.widget,this.paint);break;case l.css.daysContainer:this.dateDisplay._update(this.widget,this.paint)}s.style.display="grid",this._updateCalendarHeader(),this._eventEmitters.viewUpdate.emit()}_updateTheme(t){if(this.widget){if(t){if(this.optionsStore.options.display.theme===t)return;this.optionsStore.options.display.theme=t}this.widget.classList.remove("light","dark"),this.widget.classList.add(this._getThemeClass()),"auto"===this.optionsStore.options.display.theme?window.matchMedia(l.css.isDarkPreferredQuery).addEventListener("change",(()=>this._updateTheme())):window.matchMedia(l.css.isDarkPreferredQuery).removeEventListener("change",(()=>this._updateTheme()))}}_getThemeClass(){const t=this.optionsStore.options.display.theme||"auto",e=window.matchMedia&&window.matchMedia(l.css.isDarkPreferredQuery).matches;switch(t){case"light":return l.css.lightTheme;case"dark":return l.css.darkTheme;case"auto":return e?l.css.darkTheme:l.css.lightTheme}}_updateCalendarHeader(){const t=[...this.widget.querySelector(`.${l.css.dateContainer} div[style*="display: grid"]`).classList].find((t=>t.startsWith(l.css.dateContainer))),[e,s,i]=this.widget.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");switch(t){case l.css.decadesContainer:e.setAttribute("title",this.optionsStore.options.localization.previousCentury),s.setAttribute("title",""),i.setAttribute("title",this.optionsStore.options.localization.nextCentury);break;case l.css.yearsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousDecade),s.setAttribute("title",this.optionsStore.options.localization.selectDecade),i.setAttribute("title",this.optionsStore.options.localization.nextDecade);break;case l.css.monthsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousYear),s.setAttribute("title",this.optionsStore.options.localization.selectYear),i.setAttribute("title",this.optionsStore.options.localization.nextYear);break;case l.css.daysContainer:e.setAttribute("title",this.optionsStore.options.localization.previousMonth),s.setAttribute("title",this.optionsStore.options.localization.selectMonth),i.setAttribute("title",this.optionsStore.options.localization.nextMonth),s.innerText=this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)}s.innerText=s.getAttribute(t)}hide(){this.widget&&this._isVisible&&(this.widget.classList.remove(l.css.show),this._isVisible&&(this._eventEmitters.triggerEvent.emit({type:l.events.hide,date:this.optionsStore.unset?null:this.dates.lastPicked?this.dates.lastPicked.clone:void 0}),this._isVisible=!1),document.removeEventListener("click",this._documentClickEvent))}toggle(){return this._isVisible?this.hide():this.show()}_dispose(){document.removeEventListener("click",this._documentClickEvent),this.widget&&(this.widget.querySelectorAll("[data-action]").forEach((t=>t.removeEventListener("click",this._actionsClickEvent))),this.widget.parentNode.removeChild(this.widget),this._widget=void 0)}_buildWidget(){const t=document.createElement("div");t.classList.add(l.css.widget);const e=document.createElement("div");e.classList.add(l.css.dateContainer),e.append(this.getHeadTemplate(),this.decadeDisplay.getPicker(),this.yearDisplay.getPicker(),this.monthDisplay.getPicker(),this.dateDisplay.getPicker());const s=document.createElement("div");s.classList.add(l.css.timeContainer),s.appendChild(this.timeDisplay.getPicker(this._iconTag.bind(this))),s.appendChild(this.hourDisplay.getPicker()),s.appendChild(this.minuteDisplay.getPicker()),s.appendChild(this.secondDisplay.getPicker());const i=document.createElement("div");if(i.classList.add(l.css.toolbar),i.append(...this.getToolbarElements()),this.optionsStore.options.display.inline&&t.classList.add(l.css.inline),this.optionsStore.options.display.calendarWeeks&&t.classList.add("calendarWeeks"),this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){t.classList.add(l.css.sideBySide),"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");return o.classList.add("td-row"),e.classList.add("td-half"),s.classList.add("td-half"),o.appendChild(e),o.appendChild(s),t.appendChild(o),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),void(this._widget=t)}"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),this._hasDate&&(this._hasTime&&(e.classList.add(l.css.collapse),"clock"!==this.optionsStore.options.display.viewMode&&e.classList.add(l.css.show)),t.appendChild(e)),this._hasTime&&(this._hasDate&&(s.classList.add(l.css.collapse),"clock"===this.optionsStore.options.display.viewMode&&s.classList.add(l.css.show)),t.appendChild(s)),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");o.classList.add("arrow"),o.setAttribute("data-popper-arrow",""),t.appendChild(o),this._widget=t}get _hasTime(){return this.optionsStore.options.display.components.clock&&(this.optionsStore.options.display.components.hours||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.components.seconds)}get _hasDate(){return this.optionsStore.options.display.components.calendar&&(this.optionsStore.options.display.components.year||this.optionsStore.options.display.components.month||this.optionsStore.options.display.components.date)}getToolbarElements(){const t=[];if(this.optionsStore.options.display.buttons.today){const e=document.createElement("div");e.setAttribute("data-action",b.today),e.setAttribute("title",this.optionsStore.options.localization.today),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.today)),t.push(e)}if(!this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){let e,s;"clock"===this.optionsStore.options.display.viewMode?(e=this.optionsStore.options.localization.selectDate,s=this.optionsStore.options.display.icons.date):(e=this.optionsStore.options.localization.selectTime,s=this.optionsStore.options.display.icons.time);const i=document.createElement("div");i.setAttribute("data-action",b.togglePicker),i.setAttribute("title",e),i.appendChild(this._iconTag(s)),t.push(i)}if(this.optionsStore.options.display.buttons.clear){const e=document.createElement("div");e.setAttribute("data-action",b.clear),e.setAttribute("title",this.optionsStore.options.localization.clear),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.clear)),t.push(e)}if(this.optionsStore.options.display.buttons.close){const e=document.createElement("div");e.setAttribute("data-action",b.close),e.setAttribute("title",this.optionsStore.options.localization.close),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.close)),t.push(e)}return t}getHeadTemplate(){const t=document.createElement("div");t.classList.add(l.css.calendarHeader);const e=document.createElement("div");e.classList.add(l.css.previous),e.setAttribute("data-action",b.previous),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.previous));const s=document.createElement("div");s.classList.add(l.css.switch),s.setAttribute("data-action",b.changeCalendarView);const i=document.createElement("div");return i.classList.add(l.css.next),i.setAttribute("data-action",b.next),i.appendChild(this._iconTag(this.optionsStore.options.display.icons.next)),t.append(e,s,i),t}_iconTag(t){if("sprites"===this.optionsStore.options.display.icons.type){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("xlink:href",t),s.setAttribute("href",t),e.appendChild(s),e}const e=document.createElement("i");return e.classList.add(...t.split(" ")),e}_rebuild(){const t=this._isVisible;t&&this.hide(),this._dispose(),t&&this.show()}}class O{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m),this.display=h.locate($),this._eventEmitters=h.locate(v),this._eventEmitters.action.subscribe((t=>{this.do(t.e,t.action)}))}do(t,s){var i,o;const n=null==t?void 0:t.currentTarget;if(null===(i=null==n?void 0:n.classList)||void 0===i?void 0:i.contains(l.css.disabled))return!1;s=s||(null===(o=null==n?void 0:n.dataset)||void 0===o?void 0:o.action);const r=(this.dates.lastPicked||this.optionsStore.viewDate).clone;switch(s){case b.next:case b.previous:this.handleNextPrevious(s);break;case b.changeCalendarView:this.display._showMode(1),this.display._updateCalendarHeader();break;case b.selectMonth:case b.selectYear:case b.selectDecade:const i=+n.dataset.value;switch(s){case b.selectMonth:this.optionsStore.viewDate.month=i;break;case b.selectYear:case b.selectDecade:this.optionsStore.viewDate.year=i}this.optionsStore.currentCalendarViewMode===this.optionsStore.minimumCalendarViewMode?(this.dates.setValue(this.optionsStore.viewDate,this.dates.lastPickedIndex),this.optionsStore.options.display.inline||this.display.hide()):this.display._showMode(-1);break;case b.selectDay:const o=this.optionsStore.viewDate.clone;n.classList.contains(l.css.old)&&o.manipulate(-1,e.month),n.classList.contains(l.css.new)&&o.manipulate(1,e.month),o.date=+n.dataset.day;let d=0;this.optionsStore.options.multipleDates?(d=this.dates.pickedIndex(o,e.date),-1!==d?this.dates.setValue(null,d):this.dates.setValue(o,this.dates.lastPickedIndex+1)):this.dates.setValue(o,this.dates.lastPickedIndex),this.display._hasTime||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline||this.optionsStore.options.multipleDates||this.display.hide();break;case b.selectHour:let c=+n.dataset.value;r.hours>=12&&!this.optionsStore.options.display.components.useTwentyfourHour&&(c+=12),r.hours=c,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case b.selectMinute:r.minutes=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case b.selectSecond:r.seconds=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case b.incrementHours:this.manipulateAndSet(r,e.hours);break;case b.incrementMinutes:this.manipulateAndSet(r,e.minutes,this.optionsStore.options.stepping);break;case b.incrementSeconds:this.manipulateAndSet(r,e.seconds);break;case b.decrementHours:this.manipulateAndSet(r,e.hours,-1);break;case b.decrementMinutes:this.manipulateAndSet(r,e.minutes,-1*this.optionsStore.options.stepping);break;case b.decrementSeconds:this.manipulateAndSet(r,e.seconds,-1);break;case b.toggleMeridiem:this.manipulateAndSet(r,e.hours,this.dates.lastPicked.hours>=12?-12:12);break;case b.togglePicker:n.getAttribute("title")===this.optionsStore.options.localization.selectDate?(n.setAttribute("title",this.optionsStore.options.localization.selectTime),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.time).outerHTML,this.display._updateCalendarHeader(),this.optionsStore.refreshCurrentView()):(n.setAttribute("title",this.optionsStore.options.localization.selectDate),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.date).outerHTML,this.display._hasTime&&(this.handleShowClockContainers(b.showClock),this.display._update("clock"))),this.display.widget.querySelectorAll(`.${l.css.dateContainer}, .${l.css.timeContainer}`).forEach((t=>A.toggle(t))),this._eventEmitters.viewUpdate.emit();break;case b.showClock:case b.showHours:case b.showMinutes:case b.showSeconds:this.optionsStore.options.display.sideBySide||"clock"===this.optionsStore.currentView||(A.hideImmediately(this.display.widget.querySelector(`div.${l.css.dateContainer}`)),A.showImmediately(this.display.widget.querySelector(`div.${l.css.timeContainer}`))),this.handleShowClockContainers(s);break;case b.clear:this.dates.setValue(null),this.display._updateCalendarHeader();break;case b.close:this.display.hide();break;case b.today:const h=(new a).setLocale(this.optionsStore.options.localization.locale);this.optionsStore.viewDate=h,this.validation.isValid(h,e.date)&&this.dates.setValue(h,this.dates.lastPickedIndex)}}handleShowClockContainers(t){if(!this.display._hasTime)return void l.errorMessages.throwError("Cannot show clock containers when time is disabled.");this.optionsStore.currentView="clock",this.display.widget.querySelectorAll(`.${l.css.timeContainer} > div`).forEach((t=>t.style.display="none"));let s="";switch(t){case b.showClock:s=l.css.clockContainer,this.display._update("clock");break;case b.showHours:s=l.css.hourContainer,this.display._update(e.hours);break;case b.showMinutes:s=l.css.minuteContainer,this.display._update(e.minutes);break;case b.showSeconds:s=l.css.secondContainer,this.display._update(e.seconds)}this.display.widget.getElementsByClassName(s)[0].style.display="grid"}handleNextPrevious(t){const{unit:e,step:s}=p[this.optionsStore.currentCalendarViewMode];t===b.next?this.optionsStore.viewDate.manipulate(s,e):this.optionsStore.viewDate.manipulate(-1*s,e),this._eventEmitters.viewUpdate.emit(),this.display._showMode()}hideOrClock(t){!this.optionsStore.options.display.components.useTwentyfourHour||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline?this.do(t,b.showClock):this.display.hide()}manipulateAndSet(t,e,s=1){const i=t.manipulate(s,e);this.validation.isValid(i,e)&&this.dates.setValue(i,this.dates.lastPickedIndex)}}class V{constructor(t,e={}){this._subscribers={},this._isDisabled=!1,this._inputChangeEvent=t=>{if(null==t?void 0:t.detail)return;const e=()=>{this.dates.lastPicked&&(this.optionsStore.viewDate=this.dates.lastPicked.clone)},s=this.optionsStore.input.value;if(this.optionsStore.options.multipleDates)try{const t=s.split(this.optionsStore.options.multipleDatesSeparator);for(let e=0;e{var t,e;(null===(t=this.optionsStore.element)||void 0===t?void 0:t.disabled)||(null===(e=this.optionsStore.input)||void 0===e?void 0:e.disabled)||this.toggle()},h=new c,this._eventEmitters=h.locate(v),this.optionsStore=h.locate(u),this.display=h.locate($),this.dates=h.locate(w),this.actions=h.locate(O),t||l.errorMessages.mustProvideElement(),this.optionsStore.element=t,this._initializeOptions(e,g,!0),this.optionsStore.viewDate.setLocale(this.optionsStore.options.localization.locale),this.optionsStore.unset=!0,this._initializeInput(),this._initializeToggle(),this.optionsStore.options.display.inline&&this.display.show(),this._eventEmitters.triggerEvent.subscribe((t=>{this._triggerEvent(t)})),this._eventEmitters.viewUpdate.subscribe((()=>{this._viewUpdate()}))}get viewDate(){return this.optionsStore.viewDate}updateOptions(t,e=!1){e?this._initializeOptions(t,g):this._initializeOptions(t,this.optionsStore.options),this.display._rebuild()}toggle(){this._isDisabled||this.display.toggle()}show(){this._isDisabled||this.display.show()}hide(){this.display.hide()}disable(){var t;this._isDisabled=!0,null===(t=this.optionsStore.input)||void 0===t||t.setAttribute("disabled","disabled"),this.display.hide()}enable(){var t;this._isDisabled=!1,null===(t=this.optionsStore.input)||void 0===t||t.removeAttribute("disabled")}clear(){this.optionsStore.input.value="",this.dates.clear()}subscribe(t,e){let s;"string"==typeof t&&(t=[t]),s=Array.isArray(e)?e:[e],t.length!==s.length&&l.errorMessages.subscribeMismatch();const i=[];for(let e=0;e{e(t)}))}_viewUpdate(){this._triggerEvent({type:l.events.update,viewDate:this.optionsStore.viewDate.clone})}_unsubscribe(t,e){this._subscribers[t].splice(e,1)}_initializeOptions(t,e,s=!1){var i,o;let a=S.deepCopy(t);a=S._mergeOptions(a,e),s&&(a=S._dataToOptions(this.optionsStore.element,a)),S._validateConflicts(a),a.viewDate=a.viewDate.setLocale(a.localization.locale),this.optionsStore.viewDate.isSame(a.viewDate)||(this.optionsStore.viewDate=a.viewDate),a.display.components.year&&(this.optionsStore.minimumCalendarViewMode=2),a.display.components.month&&(this.optionsStore.minimumCalendarViewMode=1),a.display.components.date&&(this.optionsStore.minimumCalendarViewMode=0),this.optionsStore.currentCalendarViewMode=Math.max(this.optionsStore.minimumCalendarViewMode,this.optionsStore.currentCalendarViewMode),p[this.optionsStore.currentCalendarViewMode].name!==a.display.viewMode&&(this.optionsStore.currentCalendarViewMode=Math.max(p.findIndex((t=>t.name===a.display.viewMode)),this.optionsStore.minimumCalendarViewMode)),(null===(i=this.display)||void 0===i?void 0:i.isVisible)&&this.display._update("all"),void 0===a.display.components.useTwentyfourHour&&(a.display.components.useTwentyfourHour=!(null===(o=a.viewDate.parts())||void 0===o?void 0:o.dayPeriod)),this.optionsStore.options=a}_initializeInput(){if("INPUT"==this.optionsStore.element.tagName)this.optionsStore.input=this.optionsStore.element;else{let t=this.optionsStore.element.dataset.tdTargetInput;this.optionsStore.input=null==t||"nearest"==t?this.optionsStore.element.querySelector("input"):this.optionsStore.element.querySelector(t)}this.optionsStore.input&&(this.optionsStore.input.addEventListener("change",this._inputChangeEvent),this.optionsStore.options.allowInputToggle&&this.optionsStore.input.addEventListener("click",this._toggleClickEvent),this.optionsStore.input.value&&this._inputChangeEvent())}_initializeToggle(){if(this.optionsStore.options.display.inline)return;let t=this.optionsStore.element.dataset.tdTargetToggle;"nearest"==t&&(t='[data-td-toggle="datetimepicker"]'),this._toggle=null==t?this.optionsStore.element:this.optionsStore.element.querySelector(t),this._toggle.addEventListener("click",this._toggleClickEvent)}_handleAfterChangeEvent(t){var e,s;!this.optionsStore.options.promptTimeOnDateChange||this.optionsStore.options.display.inline||this.optionsStore.options.display.sideBySide||!this.display._hasTime||(null===(e=this.display.widget)||void 0===e?void 0:e.getElementsByClassName(l.css.show)[0].classList.contains(l.css.timeContainer))||!t.oldDate&&this.optionsStore.options.useCurrent||t.oldDate&&(null===(s=t.date)||void 0===s?void 0:s.isSame(t.oldDate))||(clearTimeout(this._currentPromptTimeTimeout),this._currentPromptTimeTimeout=setTimeout((()=>{this.display.widget&&this._eventEmitters.action.emit({e:{currentTarget:this.display.widget.querySelector(`.${l.css.switch} div`)},action:b.togglePicker})}),this.optionsStore.options.promptTimeOnDateChangeTransitionDelay))}}const H={},x={TempusDominus:V,extend:function(t,e){return t?(t.installed||(t(e,{TempusDominus:V,Dates:w,Display:$,DateTime:a,ErrorMessages:r},x),t.installed=!0),x):x},loadLocale:t=>{H[t.name]||(H[t.name]=t.localization)},locale:t=>{let e=H[t];e&&(g.localization=e)},Namespace:l,DefaultOptions:g,DateTime:a,Unit:e,version:"6.0.0-beta10"};return x})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).tempusDominus=e(t.Popper)}(this,(function(t){"use strict";var e;!function(t){t.seconds="seconds",t.minutes="minutes",t.hours="hours",t.date="date",t.month="month",t.year="year"}(e||(e={}));const s={month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0},i={hour:"2-digit",hour12:!1},o=t=>{switch(t){case"date":return{dateStyle:"short"};case"month":return{month:"numeric",year:"numeric"};case"year":return{year:"numeric"}}};class a extends Date{constructor(){super(...arguments),this.locale="default",this.nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],this.leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335]}setLocale(t){return this.locale=t,this}static convert(t,e="default"){if(!t)throw new Error("A date is required");return new a(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).setLocale(e)}static fromString(t,e){return new a(t)}get clone(){return new a(this.year,this.month,this.date,this.hours,this.minutes,this.seconds,this.getMilliseconds()).setLocale(this.locale)}startOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(0);break;case"minutes":this.setSeconds(0,0);break;case"hours":this.setMinutes(0,0,0);break;case"date":this.setHours(0,0,0,0);break;case"weekDay":if(this.startOf(e.date),this.weekDay===s)break;let t=this.weekDay;0!==s&&0===this.weekDay&&(t=8-s),this.manipulate(s-t,e.date);break;case"month":this.startOf(e.date),this.setDate(1);break;case"year":this.startOf(e.date),this.setMonth(0,1)}return this}endOf(t,s=0){if(void 0===this[t])throw new Error(`Unit '${t}' is not valid`);switch(t){case"seconds":this.setMilliseconds(999);break;case"minutes":this.setSeconds(59,999);break;case"hours":this.setMinutes(59,59,999);break;case"date":this.setHours(23,59,59,999);break;case"weekDay":this.endOf(e.date),this.manipulate(6+s-this.weekDay,e.date);break;case"month":this.endOf(e.date),this.manipulate(1,e.month),this.setDate(0);break;case"year":this.endOf(e.date),this.manipulate(1,e.year),this.setDate(0)}return this}manipulate(t,e){if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this[e]+=t,this}format(t,e=this.locale){return new Intl.DateTimeFormat(e,t).format(this)}isBefore(t,e){if(!e)return this.valueOf()t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return this.clone.startOf(e).valueOf()>t.clone.startOf(e).valueOf()}isSame(t,e){if(!e)return this.valueOf()===t.valueOf();if(void 0===this[e])throw new Error(`Unit '${e}' is not valid`);return t=a.convert(t),this.clone.startOf(e).valueOf()===t.startOf(e).valueOf()}isBetween(t,e,s,i="()"){if(s&&void 0===this[s])throw new Error(`Unit '${s}' is not valid`);const o="("===i[0],a=")"===i[1];return(o?this.isAfter(t,s):!this.isBefore(t,s))&&(a?this.isBefore(e,s):!this.isAfter(e,s))||(o?this.isBefore(t,s):!this.isAfter(t,s))&&(a?this.isAfter(e,s):!this.isBefore(e,s))}parts(t=this.locale,e={dateStyle:"full",timeStyle:"long"}){const s={};return new Intl.DateTimeFormat(t,e).formatToParts(this).filter((t=>"literal"!==t.type)).forEach((t=>s[t.type]=t.value)),s}get seconds(){return this.getSeconds()}set seconds(t){this.setSeconds(t)}get secondsFormatted(){return this.parts(void 0,s).second}get minutes(){return this.getMinutes()}set minutes(t){this.setMinutes(t)}get minutesFormatted(){return this.parts(void 0,s).minute}get hours(){return this.getHours()}set hours(t){this.setHours(t)}get hoursFormatted(){return this.parts(void 0,i).hour}get twelveHoursFormatted(){return this.parts(void 0,s).hour}meridiem(t=this.locale){var e;return null===(e=new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).formatToParts(this).find((t=>"dayPeriod"===t.type)))||void 0===e?void 0:e.value}get date(){return this.getDate()}set date(t){this.setDate(t)}get dateFormatted(){return this.parts(void 0,s).day}get weekDay(){return this.getDay()}get month(){return this.getMonth()}set month(t){const e=new Date(this.year,t+1);e.setDate(0);const s=e.getDate();this.date>s&&(this.date=s),this.setMonth(t)}get monthFormatted(){return this.parts(void 0,s).month}get year(){return this.getFullYear()}set year(t){this.setFullYear(t)}get week(){const t=this.computeOrdinal(),e=this.getUTCDay();let s=Math.floor((t-e+10)/7);return s<1?s=this.weeksInWeekYear(this.year-1):s>this.weeksInWeekYear(this.year)&&(s=1),s}weeksInWeekYear(t){const e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,s=t-1,i=(s+Math.floor(s/4)-Math.floor(s/100)+Math.floor(s/400))%7;return 4===e||3===i?53:52}get isLeapYear(){return this.year%4==0&&(this.year%100!=0||this.year%400==0)}computeOrdinal(){return this.date+(this.isLeapYear?this.leapLadder:this.nonLeapLadder)[this.month]}}class n extends Error{}class r{constructor(){this.base="TD:",this.failedToSetInvalidDate="Failed to set invalid date",this.failedToParseInput="Failed parse input field"}unexpectedOption(t){const e=new n(`${this.base} Unexpected option: ${t} does not match a known option.`);throw e.code=1,e}unexpectedOptions(t){const e=new n(`${this.base}: ${t.join(", ")}`);throw e.code=1,e}unexpectedOptionValue(t,e,s){const i=new n(`${this.base} Unexpected option value: ${t} does not accept a value of "${e}". Valid values are: ${s.join(", ")}`);throw i.code=2,i}typeMismatch(t,e,s){const i=new n(`${this.base} Mismatch types: ${t} has a type of ${e} instead of the required ${s}`);throw i.code=3,i}numbersOutOfRage(t,e,s){const i=new n(`${this.base} ${t} expected an array of number between ${e} and ${s}.`);throw i.code=4,i}failedToParseDate(t,e,s=!1){const i=new n(`${this.base} Could not correctly parse "${e}" to a date for ${t}.`);if(i.code=5,!s)throw i;console.warn(i)}mustProvideElement(){const t=new n(`${this.base} No element was provided.`);throw t.code=6,t}subscribeMismatch(){const t=new n(`${this.base} The subscribed events does not match the number of callbacks`);throw t.code=7,t}conflictingConfiguration(t){const e=new n(`${this.base} A configuration value conflicts with another rule. ${t}`);throw e.code=8,e}customDateFormatError(t){const e=new n(`${this.base} customDateFormat: ${t}`);throw e.code=9,e}dateString(){console.warn(`${this.base} Using a string for date options is not recommended unless you specify an ISO string or use the customDateFormat plugin.`)}throwError(t){const e=new n(`${this.base} ${t}`);throw e.code=9,e}}const d="tempus-dominus";class l{}l.NAME=d,l.dataKey="td",l.events=new class{constructor(){this.key=".td",this.change=`change${this.key}`,this.update=`update${this.key}`,this.error=`error${this.key}`,this.show=`show${this.key}`,this.hide=`hide${this.key}`,this.blur=`blur${this.key}`,this.focus=`focus${this.key}`,this.keyup=`keyup${this.key}`,this.keydown=`keydown${this.key}`}},l.css=new class{constructor(){this.widget=`${d}-widget`,this.calendarHeader="calendar-header",this.switch="picker-switch",this.toolbar="toolbar",this.noHighlight="no-highlight",this.sideBySide="timepicker-sbs",this.previous="previous",this.next="next",this.disabled="disabled",this.old="old",this.new="new",this.active="active",this.dateContainer="date-container",this.decadesContainer=`${this.dateContainer}-decades`,this.decade="decade",this.yearsContainer=`${this.dateContainer}-years`,this.year="year",this.monthsContainer=`${this.dateContainer}-months`,this.month="month",this.daysContainer=`${this.dateContainer}-days`,this.day="day",this.calendarWeeks="cw",this.dayOfTheWeek="dow",this.today="today",this.weekend="weekend",this.timeContainer="time-container",this.separator="separator",this.clockContainer=`${this.timeContainer}-clock`,this.hourContainer=`${this.timeContainer}-hour`,this.minuteContainer=`${this.timeContainer}-minute`,this.secondContainer=`${this.timeContainer}-second`,this.hour="hour",this.minute="minute",this.second="second",this.toggleMeridiem="toggleMeridiem",this.show="show",this.collapsing="td-collapsing",this.collapse="td-collapse",this.inline="inline",this.lightTheme="light",this.darkTheme="dark",this.isDarkPreferredQuery="(prefers-color-scheme: dark)"}},l.errorMessages=new r;class c{constructor(){this.cache=new Map}locate(t){const e=this.cache.get(t);if(e)return e;const s=new t;return this.cache.set(t,s),s}}let h;const p=[{name:"calendar",className:l.css.daysContainer,unit:e.month,step:1},{name:"months",className:l.css.monthsContainer,unit:e.year,step:1},{name:"years",className:l.css.yearsContainer,unit:e.year,step:10},{name:"decades",className:l.css.decadesContainer,unit:e.year,step:100}];class u{constructor(){this.viewDate=new a,this._currentCalendarViewMode=0,this.minimumCalendarViewMode=0,this.currentView="calendar"}get currentCalendarViewMode(){return this._currentCalendarViewMode}set currentCalendarViewMode(t){this._currentCalendarViewMode=t,this.currentView=p[t].name}refreshCurrentView(){this.currentView=p[this.currentCalendarViewMode].name}}class m{constructor(){this.optionsStore=h.locate(u)}isValid(t,s){var i;if(this.optionsStore.options.restrictions.disabledDates.length>0&&this._isInDisabledDates(t))return!1;if(this.optionsStore.options.restrictions.enabledDates.length>0&&!this._isInEnabledDates(t))return!1;if(s!==e.month&&s!==e.year&&(null===(i=this.optionsStore.options.restrictions.daysOfWeekDisabled)||void 0===i?void 0:i.length)>0&&-1!==this.optionsStore.options.restrictions.daysOfWeekDisabled.indexOf(t.weekDay))return!1;if(this.optionsStore.options.restrictions.minDate&&t.isBefore(this.optionsStore.options.restrictions.minDate,s))return!1;if(this.optionsStore.options.restrictions.maxDate&&t.isAfter(this.optionsStore.options.restrictions.maxDate,s))return!1;if(s===e.hours||s===e.minutes||s===e.seconds){if(this.optionsStore.options.restrictions.disabledHours.length>0&&this._isInDisabledHours(t))return!1;if(this.optionsStore.options.restrictions.enabledHours.length>0&&!this._isInEnabledHours(t))return!1;if(this.optionsStore.options.restrictions.disabledTimeIntervals.length>0)for(let e of this.optionsStore.options.restrictions.disabledTimeIntervals)if(t.isBetween(e.from,e.to))return!1}return!0}_isInDisabledDates(t){if(!this.optionsStore.options.restrictions.disabledDates||0===this.optionsStore.options.restrictions.disabledDates.length)return!1;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.disabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInEnabledDates(t){if(!this.optionsStore.options.restrictions.enabledDates||0===this.optionsStore.options.restrictions.enabledDates.length)return!0;const s=t.format(o(e.date));return this.optionsStore.options.restrictions.enabledDates.map((t=>t.format(o(e.date)))).find((t=>t===s))}_isInDisabledHours(t){if(!this.optionsStore.options.restrictions.disabledHours||0===this.optionsStore.options.restrictions.disabledHours.length)return!1;const e=t.hours;return this.optionsStore.options.restrictions.disabledHours.find((t=>t===e))}_isInEnabledHours(t){if(!this.optionsStore.options.restrictions.enabledHours||0===this.optionsStore.options.restrictions.enabledHours.length)return!0;const e=t.hours;return this.optionsStore.options.restrictions.enabledHours.find((t=>t===e))}}class y{constructor(){this.subscribers=[]}subscribe(t){return this.subscribers.push(t),this.unsubscribe.bind(this,this.subscribers.length-1)}unsubscribe(t){this.subscribers.splice(t,1)}emit(t){this.subscribers.forEach((e=>{e(t)}))}destroy(){this.subscribers=null,this.subscribers=[]}}class v{constructor(){this.triggerEvent=new y,this.viewUpdate=new y,this.updateDisplay=new y,this.action=new y}destroy(){this.triggerEvent.destroy(),this.viewUpdate.destroy(),this.updateDisplay.destroy(),this.action.destroy()}}const g={restrictions:{minDate:void 0,maxDate:void 0,disabledDates:[],enabledDates:[],daysOfWeekDisabled:[],disabledTimeIntervals:[],disabledHours:[],enabledHours:[]},display:{icons:{type:"icons",time:"fa-solid fa-clock",date:"fa-solid fa-calendar",up:"fa-solid fa-arrow-up",down:"fa-solid fa-arrow-down",previous:"fa-solid fa-chevron-left",next:"fa-solid fa-chevron-right",today:"fa-solid fa-calendar-check",clear:"fa-solid fa-trash",close:"fa-solid fa-xmark"},sideBySide:!1,calendarWeeks:!1,viewMode:"calendar",toolbarPlacement:"bottom",keepOpen:!1,buttons:{today:!1,clear:!1,close:!1},components:{calendar:!0,date:!0,month:!0,year:!0,decades:!0,clock:!0,hours:!0,minutes:!0,seconds:!1,useTwentyfourHour:void 0},inline:!1,theme:"auto"},stepping:1,useCurrent:!0,defaultDate:void 0,localization:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",previousMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",previousYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",previousDecade:"Previous Decade",nextDecade:"Next Decade",previousCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",toggleMeridiem:"Toggle Meridiem",selectTime:"Select Time",selectDate:"Select Date",dayViewHeaderFormat:{month:"long",year:"2-digit"},locale:"default",startOfTheWeek:0,dateFormats:{LTS:"h:mm:ss T",LT:"h:mm T",L:"MM/dd/yyyy",LL:"MMMM d, yyyy",LLL:"MMMM d, yyyy h:mm T",LLLL:"dddd, MMMM d, yyyy h:mm T"},ordinal:t=>t,format:"L"},keepInvalid:!1,debug:!1,allowInputToggle:!1,viewDate:new a,multipleDates:!1,multipleDatesSeparator:"; ",promptTimeOnDateChange:!1,promptTimeOnDateChangeTransitionDelay:200,meta:{},container:void 0};class S{static deepCopy(t){const e={};return Object.keys(t).forEach((s=>{const i=t[s];e[s]=i,"object"!=typeof i||i instanceof HTMLElement||i instanceof Element||i instanceof Date||Array.isArray(i)||(e[s]=S.deepCopy(i))})),e}static objectPath(t,e){return"."===t.charAt(0)&&(t=t.slice(1)),t?t.split(".").reduce(((t,e)=>S.isValue(t)||S.isValue(t[e])?t[e]:void 0),e):e}static spread(t,e,s="",i){const o=S.objectPath(s,g),a=Object.keys(t).filter((t=>!Object.keys(o).includes(t)));if(a.length>0){const t=S.getFlattenDefaultOptions(),e=a.map((e=>{let i=`"${s}.${e}" in not a known option.`,o=t.find((t=>t.includes(e)));return o&&(i+=` Did you mean "${o}"?`),i}));l.errorMessages.unexpectedOptions(e)}Object.keys(t).filter((t=>"__proto__"!==t&&"constructor"!==t)).forEach((a=>{"."===(s+=`.${a}`).charAt(0)&&(s=s.slice(1));const n=o[a];let r=typeof t[a],d=typeof n,l=t[a];if(null==l)return e[a]=l,void(s=s.substring(0,s.lastIndexOf(`.${a}`)));"object"!=typeof n||Array.isArray(t[a])||n instanceof Date||S.ignoreProperties.includes(a)?e[a]=S.processKey(a,l,r,d,s,i):S.spread(t[a],e[a],s,i),s=s.substring(0,s.lastIndexOf(`.${a}`))}))}static processKey(t,e,s,i,o,a){switch(t){case"defaultDate":{const t=this.dateConversion(e,"defaultDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("defaultDate",s,"DateTime or Date");break}case"viewDate":{const t=this.dateConversion(e,"viewDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("viewDate",s,"DateTime or Date");break}case"minDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.minDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.minDate",s,"DateTime or Date");break}case"maxDate":{if(void 0===e)return e;const t=this.dateConversion(e,"restrictions.maxDate",a);if(void 0!==t)return t.setLocale(a.locale),t;l.errorMessages.typeMismatch("restrictions.maxDate",s,"DateTime or Date");break}case"disabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.disabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.disabledHours",0,23),e);case"enabledHours":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.enabledHours",e,s),e.filter((t=>t<0||t>24)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.enabledHours",0,23),e);case"daysOfWeekDisabled":return void 0===e?[]:(this._typeCheckNumberArray("restrictions.daysOfWeekDisabled",e,s),e.filter((t=>t<0||t>6)).length>0&&l.errorMessages.numbersOutOfRage("restrictions.daysOfWeekDisabled",0,6),e);case"enabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.enabledDates",e,s,a),e);case"disabledDates":return void 0===e?[]:(this._typeCheckDateArray("restrictions.disabledDates",e,s,a),e);case"disabledTimeIntervals":if(void 0===e)return[];Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of { from: DateTime|Date, to: DateTime|Date }");const n=e;for(let e=0;e{const i=`${t}[${e}].${s}`;let o=n[e][s];const r=this.dateConversion(o,i,a);r||l.errorMessages.typeMismatch(i,typeof o,"DateTime or Date"),r.setLocale(a.locale),n[e][s]=r}));return n;case"toolbarPlacement":case"type":case"viewMode":case"theme":const r={toolbarPlacement:["top","bottom","default"],type:["icons","sprites"],viewMode:["clock","calendar","months","years","decades"],theme:["light","dark","auto"]}[t];return r.includes(e)||l.errorMessages.unexpectedOptionValue(o.substring(1),e,r),e;case"meta":case"dayViewHeaderFormat":return e;case"container":return e&&!(e instanceof HTMLElement||e instanceof Element||(null==e?void 0:e.appendChild))&&l.errorMessages.typeMismatch(o.substring(1),typeof e,"HTMLElement"),e;case"useTwentyfourHour":if(void 0===e||"boolean"===s)return e;l.errorMessages.typeMismatch(o,s,i);break;default:switch(i){case"boolean":return"true"===e||!0===e;case"number":return+e;case"string":return e.toString();case"object":return{};case"function":return e;default:l.errorMessages.typeMismatch(o,s,i)}}}static _mergeOptions(t,e){var s;const i=S.deepCopy(e),o="default"!==(null===(s=e.localization)||void 0===s?void 0:s.locale)?e.localization:(null==t?void 0:t.localization)||g.localization;return S.spread(t,i,"",o),i}static _dataToOptions(t,e){const s=JSON.parse(JSON.stringify(t.dataset));if((null==s?void 0:s.tdTargetInput)&&delete s.tdTargetInput,(null==s?void 0:s.tdTargetToggle)&&delete s.tdTargetToggle,!s||0===Object.keys(s).length||s.constructor!==DOMStringMap)return e;let i={};const o=t=>{const e={};return Object.keys(t).forEach((t=>{e[t.toLowerCase()]=t})),e},a=(t,e,s,i)=>{const n=o(s)[t[e].toLowerCase()],r={};return void 0===n||(s[n].constructor===Object?(e++,r[n]=a(t,e,s[n],i)):r[n]=i),r},n=o(e);return Object.keys(s).filter((t=>t.startsWith(l.dataKey))).map((t=>t.substring(2))).forEach((t=>{let o=n[t.toLowerCase()];if(t.includes("_")){const r=t.split("_");o=n[r[0].toLowerCase()],void 0!==o&&e[o].constructor===Object&&(i[o]=a(r,1,e[o],s[`td${t}`]))}else void 0!==o&&(i[o]=s[`td${t}`])})),this._mergeOptions(i,e)}static _dateTypeCheck(t,e){if(t.constructor.name===a.name)return t;if(t.constructor.name===Date.name)return a.convert(t);if("string"==typeof t){const s=a.fromString(t,e);return"null"===JSON.stringify(s)?null:s}return null}static _typeCheckDateArray(t,e,s,i){var o;Array.isArray(e)||l.errorMessages.typeMismatch(t,s,"array of DateTime or Date");for(let s=0;s"number"!=typeof t))||l.errorMessages.typeMismatch(t,s,"array of numbers")}static dateConversion(t,e,s){"string"==typeof t&&"input"!==e&&l.errorMessages.dateString();const i=this._dateTypeCheck(t,s);return i||l.errorMessages.failedToParseDate(e,t,"input"===e),i}static getFlattenDefaultOptions(){if(this._flattenDefaults)return this._flattenDefaults;const t=(e,s=[])=>Array.isArray(e)?[]:Object(e)===e?Object.entries(e).flatMap((([e,i])=>t(i,[...s,e]))):s.join(".");return this._flattenDefaults=t(g),this._flattenDefaults}static _validateConflicts(t){!t.display.sideBySide||t.display.components.clock&&(t.display.components.hours||t.display.components.minutes||t.display.components.seconds)||l.errorMessages.conflictingConfiguration("Cannot use side by side mode without the clock components"),t.restrictions.minDate&&t.restrictions.maxDate&&(t.restrictions.minDate.isAfter(t.restrictions.maxDate)&&l.errorMessages.conflictingConfiguration("minDate is after maxDate"),t.restrictions.maxDate.isBefore(t.restrictions.minDate)&&l.errorMessages.conflictingConfiguration("maxDate is before minDate"))}}S.ignoreProperties=["meta","dayViewHeaderFormat","container","dateForms","ordinal"],S.isValue=t=>null!=t;class w{constructor(){this._dates=[],this.optionsStore=h.locate(u),this.validation=h.locate(m),this._eventEmitters=h.locate(v)}get picked(){return this._dates}get lastPicked(){return this._dates[this.lastPickedIndex]}get lastPickedIndex(){return 0===this._dates.length?0:this._dates.length-1}formatInput(t){const e=this.optionsStore.options.display.components;return t?t.format({year:e.calendar&&e.year?"numeric":void 0,month:e.calendar&&e.month?"2-digit":void 0,day:e.calendar&&e.date?"2-digit":void 0,hour:e.clock&&e.hours?e.useTwentyfourHour?"2-digit":"numeric":void 0,minute:e.clock&&e.minutes?"2-digit":void 0,second:e.clock&&e.seconds?"2-digit":void 0,hour12:!e.useTwentyfourHour}):""}parseInput(t){return S.dateConversion(t,"input",this.optionsStore.options.localization)}setFromInput(t,e){if(!t)return void this.setValue(void 0,e);const s=this.parseInput(t);s&&(s.setLocale(this.optionsStore.options.localization.locale),this.setValue(s,e))}add(t){this._dates.push(t)}isPicked(t,e){if(!e)return void 0!==this._dates.find((e=>e===t));const s=o(e);let i=t.format(s);return void 0!==this._dates.map((t=>t.format(s))).find((t=>t===i))}pickedIndex(t,e){if(!e)return this._dates.indexOf(t);const s=o(e);let i=t.format(s);return this._dates.map((t=>t.format(s))).indexOf(i)}clear(){this.optionsStore.unset=!0,this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:this.lastPicked,isClear:!0,isValid:!0}),this._dates=[]}static getStartEndYear(t,e){const s=t/10,i=Math.floor(e/t)*t;return[i,i+9*s,Math.floor(e/s)*s]}setValue(t,e){const s=void 0===e,i=!t&&s;let o=this.optionsStore.unset?null:this._dates[e];!o&&!this.optionsStore.unset&&s&&i&&(o=this.lastPicked);const a=()=>{if(!this.optionsStore.input)return;let e=this.formatInput(t);this.optionsStore.options.multipleDates&&(e=this._dates.map((t=>this.formatInput(t))).join(this.optionsStore.options.multipleDatesSeparator)),this.optionsStore.input.value!=e&&(this.optionsStore.input.value=e)};if(t&&(null==o?void 0:o.isSame(t)))a();else{if(!t)return!this.optionsStore.options.multipleDates||1===this._dates.length||i?(this.optionsStore.unset=!0,this._dates=[]):this._dates.splice(e,1),a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:void 0,oldDate:o,isClear:i,isValid:!0}),void this._eventEmitters.updateDisplay.emit("all");if(e=e||0,t=t.clone,1!==this.optionsStore.options.stepping&&(t.minutes=Math.round(t.minutes/this.optionsStore.options.stepping)*this.optionsStore.options.stepping,t.seconds=0),this.validation.isValid(t))return this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this.optionsStore.unset=!1,this._eventEmitters.updateDisplay.emit("all"),void this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!0});this.optionsStore.options.keepInvalid&&(this._dates[e]=t,this.optionsStore.viewDate=t.clone,a(),this._eventEmitters.triggerEvent.emit({type:l.events.change,date:t,oldDate:o,isClear:i,isValid:!1})),this._eventEmitters.triggerEvent.emit({type:l.events.error,reason:l.errorMessages.failedToSetInvalidDate,date:t,oldDate:o})}}}var f;!function(t){t.next="next",t.previous="previous",t.changeCalendarView="changeCalendarView",t.selectMonth="selectMonth",t.selectYear="selectYear",t.selectDecade="selectDecade",t.selectDay="selectDay",t.selectHour="selectHour",t.selectMinute="selectMinute",t.selectSecond="selectSecond",t.incrementHours="incrementHours",t.incrementMinutes="incrementMinutes",t.incrementSeconds="incrementSeconds",t.decrementHours="decrementHours",t.decrementMinutes="decrementMinutes",t.decrementSeconds="decrementSeconds",t.toggleMeridiem="toggleMeridiem",t.togglePicker="togglePicker",t.showClock="showClock",t.showHours="showHours",t.showMinutes="showMinutes",t.showSeconds="showSeconds",t.clear="clear",t.close="close",t.today="today"}(f||(f={}));var b=f;class D{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");if(t.classList.add(l.css.daysContainer),t.append(...this._daysOfTheWeek()),this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}for(let e=0;e<42;e++){if(0!==e&&e%7==0&&this.optionsStore.options.display.calendarWeeks){const e=document.createElement("div");e.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.appendChild(e)}const s=document.createElement("div");s.setAttribute("data-action",b.selectDay),t.appendChild(s)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.daysContainer)[0];if("calendar"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.daysContainer,this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)),this.optionsStore.options.display.components.month?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.month),e.month)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.month),e.month)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.month).startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).manipulate(12,e.hours);i.querySelectorAll(`[data-action="${b.selectDay}"], .${l.css.calendarWeeks}`).forEach((t=>{if(this.optionsStore.options.display.calendarWeeks&&t.classList.contains(l.css.calendarWeeks)){if("#"===t.innerText)return;return void(t.innerText=`${o.week}`)}let i=[];i.push(l.css.day),o.isBefore(this.optionsStore.viewDate,e.month)&&i.push(l.css.old),o.isAfter(this.optionsStore.viewDate,e.month)&&i.push(l.css.new),!this.optionsStore.unset&&this.dates.isPicked(o,e.date)&&i.push(l.css.active),this.validation.isValid(o,e.date)||i.push(l.css.disabled),o.isSame(new a,e.date)&&i.push(l.css.today),0!==o.weekDay&&6!==o.weekDay||i.push(l.css.weekend),s(e.date,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}-${o.monthFormatted}-${o.dateFormatted}`),t.setAttribute("data-day",`${o.date}`),t.innerText=o.format({day:"numeric"}),o.manipulate(1,e.date)}))}_daysOfTheWeek(){let t=this.optionsStore.viewDate.clone.startOf("weekDay",this.optionsStore.options.localization.startOfTheWeek).startOf(e.date);const s=[];if(document.createElement("div"),this.optionsStore.options.display.calendarWeeks){const t=document.createElement("div");t.classList.add(l.css.calendarWeeks,l.css.noHighlight),t.innerText="#",s.push(t)}for(let i=0;i<7;i++){const i=document.createElement("div");i.classList.add(l.css.dayOfTheWeek,l.css.noHighlight),i.innerText=t.format({weekday:"short"}),t.manipulate(1,e.date),s.push(i)}return s}}class k{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.monthsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectMonth),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.monthsContainer)[0];if("months"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.monthsContainer,this.optionsStore.viewDate.format({year:"numeric"})),this.optionsStore.options.display.components.year?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.year),e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.year),e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year);i.querySelectorAll(`[data-action="${b.selectMonth}"]`).forEach(((t,i)=>{let a=[];a.push(l.css.month),!this.optionsStore.unset&&this.dates.isPicked(o,e.month)&&a.push(l.css.active),this.validation.isValid(o,e.month)||a.push(l.css.disabled),s(e.month,o,a,t),t.classList.remove(...t.classList),t.classList.add(...a),t.setAttribute("data-value",`${i}`),t.innerText=`${o.format({month:"short"})}`,o.manipulate(1,e.month)}))}}class _{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.yearsContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectYear),t.appendChild(e)}return t}_update(t,s){this._startYear=this.optionsStore.viewDate.clone.manipulate(-1,e.year),this._endYear=this.optionsStore.viewDate.clone.manipulate(10,e.year);const i=t.getElementsByClassName(l.css.yearsContainer)[0];if("years"===this.optionsStore.currentView){const[t,s,o]=i.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");s.setAttribute(l.css.yearsContainer,`${this._startYear.format({year:"numeric"})}-${this._endYear.format({year:"numeric"})}`),this.optionsStore.options.display.components.decades?s.classList.remove(l.css.disabled):s.classList.add(l.css.disabled),this.validation.isValid(this._startYear,e.year)?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled),this.validation.isValid(this._endYear,e.year)?o.classList.remove(l.css.disabled):o.classList.add(l.css.disabled)}let o=this.optionsStore.viewDate.clone.startOf(e.year).manipulate(-1,e.year);i.querySelectorAll(`[data-action="${b.selectYear}"]`).forEach((t=>{let i=[];i.push(l.css.year),!this.optionsStore.unset&&this.dates.isPicked(o,e.year)&&i.push(l.css.active),this.validation.isValid(o,e.year)||i.push(l.css.disabled),s(e.year,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.year}`),t.innerText=o.format({year:"numeric"}),o.manipulate(1,e.year)}))}}class C{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.decadesContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectDecade),t.appendChild(e)}return t}_update(t,s){const[i,o]=w.getStartEndYear(100,this.optionsStore.viewDate.year);this._startDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._startDecade.year=i,this._endDecade=this.optionsStore.viewDate.clone.startOf(e.year),this._endDecade.year=o;const a=t.getElementsByClassName(l.css.decadesContainer)[0],[n,r,d]=a.parentElement.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");"decades"===this.optionsStore.currentView&&(r.setAttribute(l.css.decadesContainer,`${this._startDecade.format({year:"numeric"})}-${this._endDecade.format({year:"numeric"})}`),this.validation.isValid(this._startDecade,e.year)?n.classList.remove(l.css.disabled):n.classList.add(l.css.disabled),this.validation.isValid(this._endDecade,e.year)?d.classList.remove(l.css.disabled):d.classList.add(l.css.disabled));const c=this.dates.picked.map((t=>t.year));a.querySelectorAll(`[data-action="${b.selectDecade}"]`).forEach(((t,i)=>{if(0===i)return t.classList.add(l.css.old),this._startDecade.year-10<0?(t.textContent=" ",n.classList.add(l.css.disabled),t.classList.add(l.css.disabled),void t.setAttribute("data-value","")):(t.innerText=this._startDecade.clone.manipulate(-10,e.year).format({year:"numeric"}),void t.setAttribute("data-value",`${this._startDecade.year}`));let o=[];o.push(l.css.decade);const a=this._startDecade.year,r=this._startDecade.year+9;!this.optionsStore.unset&&c.filter((t=>t>=a&&t<=r)).length>0&&o.push(l.css.active),s("decade",this._startDecade,o,t),t.classList.remove(...t.classList),t.classList.add(...o),t.setAttribute("data-value",`${this._startDecade.year}`),t.innerText=`${this._startDecade.format({year:"numeric"})}`,this._startDecade.manipulate(10,e.year)}))}}class E{constructor(){this._gridColumns="",this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m)}getPicker(t){const e=document.createElement("div");return e.classList.add(l.css.clockContainer),e.append(...this._grid(t)),e}_update(t){const s=t.getElementsByClassName(l.css.clockContainer)[0],i=(this.dates.lastPicked||this.optionsStore.viewDate).clone;if(s.querySelectorAll(".disabled").forEach((t=>t.classList.remove(l.css.disabled))),this.optionsStore.options.display.components.hours&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.hours),e.hours)||s.querySelector(`[data-action=${b.incrementHours}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.hours),e.hours)||s.querySelector(`[data-action=${b.decrementHours}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.hours}]`).innerText=this.optionsStore.options.display.components.useTwentyfourHour?i.hoursFormatted:i.twelveHoursFormatted),this.optionsStore.options.display.components.minutes&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.minutes),e.minutes)||s.querySelector(`[data-action=${b.incrementMinutes}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.minutes),e.minutes)||s.querySelector(`[data-action=${b.decrementMinutes}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.minutes}]`).innerText=i.minutesFormatted),this.optionsStore.options.display.components.seconds&&(this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(1,e.seconds),e.seconds)||s.querySelector(`[data-action=${b.incrementSeconds}]`).classList.add(l.css.disabled),this.validation.isValid(this.optionsStore.viewDate.clone.manipulate(-1,e.seconds),e.seconds)||s.querySelector(`[data-action=${b.decrementSeconds}]`).classList.add(l.css.disabled),s.querySelector(`[data-time-component=${e.seconds}]`).innerText=i.secondsFormatted),!this.optionsStore.options.display.components.useTwentyfourHour){const t=s.querySelector(`[data-action=${b.toggleMeridiem}]`);t.innerText=i.meridiem(),this.validation.isValid(i.clone.manipulate(i.hours>=12?-12:12,e.hours))?t.classList.remove(l.css.disabled):t.classList.add(l.css.disabled)}s.style.gridTemplateAreas=`"${this._gridColumns}"`}_grid(t){this._gridColumns="";const s=[],i=[],o=[],a=document.createElement("div"),n=t(this.optionsStore.options.display.icons.up),r=t(this.optionsStore.options.display.icons.down);a.classList.add(l.css.separator,l.css.noHighlight);const d=a.cloneNode(!0);d.innerHTML=":";const c=(t=!1)=>t?d.cloneNode(!0):a.cloneNode(!0);if(this.optionsStore.options.display.components.hours){let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementHour),t.setAttribute("data-action",b.incrementHours),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickHour),t.setAttribute("data-action",b.showHours),t.setAttribute("data-time-component",e.hours),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementHour),t.setAttribute("data-action",b.decrementHours),t.appendChild(r.cloneNode(!0)),o.push(t),this._gridColumns+="a"}if(this.optionsStore.options.display.components.minutes){this._gridColumns+=" a",this.optionsStore.options.display.components.hours&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementMinute),t.setAttribute("data-action",b.incrementMinutes),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickMinute),t.setAttribute("data-action",b.showMinutes),t.setAttribute("data-time-component",e.minutes),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementMinute),t.setAttribute("data-action",b.decrementMinutes),t.appendChild(r.cloneNode(!0)),o.push(t)}if(this.optionsStore.options.display.components.seconds){this._gridColumns+=" a",this.optionsStore.options.display.components.minutes&&(s.push(c()),i.push(c(!0)),o.push(c()),this._gridColumns+=" a");let t=document.createElement("div");t.setAttribute("title",this.optionsStore.options.localization.incrementSecond),t.setAttribute("data-action",b.incrementSeconds),t.appendChild(n.cloneNode(!0)),s.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.pickSecond),t.setAttribute("data-action",b.showSeconds),t.setAttribute("data-time-component",e.seconds),i.push(t),t=document.createElement("div"),t.setAttribute("title",this.optionsStore.options.localization.decrementSecond),t.setAttribute("data-action",b.decrementSeconds),t.appendChild(r.cloneNode(!0)),o.push(t)}if(!this.optionsStore.options.display.components.useTwentyfourHour){this._gridColumns+=" a";let t=c();s.push(t);let e=document.createElement("button");e.setAttribute("title",this.optionsStore.options.localization.toggleMeridiem),e.setAttribute("data-action",b.toggleMeridiem),e.setAttribute("tabindex","-1"),l.css.toggleMeridiem.includes(",")?e.classList.add(...l.css.toggleMeridiem.split(",")):e.classList.add(l.css.toggleMeridiem),t=document.createElement("div"),t.classList.add(l.css.noHighlight),t.appendChild(e),i.push(t),t=c(),o.push(t)}return this._gridColumns=this._gridColumns.trim(),[...s,...i,...o]}}class M{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.hourContainer);for(let e=0;e<(this.optionsStore.options.display.components.useTwentyfourHour?24:12);e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectHour),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.hourContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.date);i.querySelectorAll(`[data-action="${b.selectHour}"]`).forEach((t=>{let i=[];i.push(l.css.hour),this.validation.isValid(o,e.hours)||i.push(l.css.disabled),s(e.hours,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.hours}`),t.innerText=this.optionsStore.options.display.components.useTwentyfourHour?o.hoursFormatted:o.twelveHoursFormatted,o.manipulate(1,e.hours)}))}}class L{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.minuteContainer);let e=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;for(let s=0;s<60/e;s++){const e=document.createElement("div");e.setAttribute("data-action",b.selectMinute),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.minuteContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.hours),a=1===this.optionsStore.options.stepping?5:this.optionsStore.options.stepping;i.querySelectorAll(`[data-action="${b.selectMinute}"]`).forEach((t=>{let i=[];i.push(l.css.minute),this.validation.isValid(o,e.minutes)||i.push(l.css.disabled),s(e.minutes,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.minutes}`),t.innerText=o.minutesFormatted,o.manipulate(a,e.minutes)}))}}class T{constructor(){this.optionsStore=h.locate(u),this.validation=h.locate(m)}getPicker(){const t=document.createElement("div");t.classList.add(l.css.secondContainer);for(let e=0;e<12;e++){const e=document.createElement("div");e.setAttribute("data-action",b.selectSecond),t.appendChild(e)}return t}_update(t,s){const i=t.getElementsByClassName(l.css.secondContainer)[0];let o=this.optionsStore.viewDate.clone.startOf(e.minutes);i.querySelectorAll(`[data-action="${b.selectSecond}"]`).forEach((t=>{let i=[];i.push(l.css.second),this.validation.isValid(o,e.seconds)||i.push(l.css.disabled),s(e.seconds,o,i,t),t.classList.remove(...t.classList),t.classList.add(...i),t.setAttribute("data-value",`${o.seconds}`),t.innerText=o.secondsFormatted,o.manipulate(5,e.seconds)}))}}class A{static toggle(t){t.classList.contains(l.css.show)?this.hide(t):this.show(t)}static showImmediately(t){t.classList.remove(l.css.collapsing),t.classList.add(l.css.collapse,l.css.show),t.style.height=""}static show(t){if(t.classList.contains(l.css.collapsing)||t.classList.contains(l.css.show))return;t.style.height="0",t.classList.remove(l.css.collapse),t.classList.add(l.css.collapsing),setTimeout((()=>{A.showImmediately(t)}),this.getTransitionDurationFromElement(t)),t.style.height=`${t.scrollHeight}px`}static hideImmediately(t){t&&(t.classList.remove(l.css.collapsing,l.css.show),t.classList.add(l.css.collapse))}static hide(t){if(t.classList.contains(l.css.collapsing)||!t.classList.contains(l.css.show))return;t.style.height=`${t.getBoundingClientRect().height}px`;t.offsetHeight,t.classList.remove(l.css.collapse,l.css.show),t.classList.add(l.css.collapsing),t.style.height="",setTimeout((()=>{A.hideImmediately(t)}),this.getTransitionDurationFromElement(t))}}A.getTransitionDurationFromElement=t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:s}=window.getComputedStyle(t);const i=Number.parseFloat(e),o=Number.parseFloat(s);return i||o?(e=e.split(",")[0],s=s.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(s))):0};class ${constructor(){this._isVisible=!1,this._documentClickEvent=t=>{var e;this.optionsStore.options.debug||window.debug||!this._isVisible||t.composedPath().includes(this.widget)||(null===(e=t.composedPath())||void 0===e?void 0:e.includes(this.optionsStore.element))||this.hide()},this._actionsClickEvent=t=>{this._eventEmitters.action.emit({e:t})},this.optionsStore=h.locate(u),this.validation=h.locate(m),this.dates=h.locate(w),this.dateDisplay=h.locate(D),this.monthDisplay=h.locate(k),this.yearDisplay=h.locate(_),this.decadeDisplay=h.locate(C),this.timeDisplay=h.locate(E),this.hourDisplay=h.locate(M),this.minuteDisplay=h.locate(L),this.secondDisplay=h.locate(T),this._eventEmitters=h.locate(v),this._widget=void 0,this._eventEmitters.updateDisplay.subscribe((t=>{this._update(t)}))}get widget(){return this._widget}get isVisible(){return this._isVisible}_update(t){if(this.widget)switch(t){case e.seconds:this.secondDisplay._update(this.widget,this.paint);break;case e.minutes:this.minuteDisplay._update(this.widget,this.paint);break;case e.hours:this.hourDisplay._update(this.widget,this.paint);break;case e.date:this.dateDisplay._update(this.widget,this.paint);break;case e.month:this.monthDisplay._update(this.widget,this.paint);break;case e.year:this.yearDisplay._update(this.widget,this.paint);break;case"clock":if(!this._hasTime)break;this.timeDisplay._update(this.widget),this._update(e.hours),this._update(e.minutes),this._update(e.seconds);break;case"calendar":this._update(e.date),this._update(e.year),this._update(e.month),this.decadeDisplay._update(this.widget,this.paint),this._updateCalendarHeader();break;case"all":this._hasTime&&this._update("clock"),this._hasDate&&this._update("calendar")}}paint(t,e,s,i){}show(){var s,i;if(null==this.widget){if(0==this.dates.picked.length){if(this.optionsStore.options.useCurrent&&!this.optionsStore.options.defaultDate){const t=(new a).setLocale(this.optionsStore.options.localization.locale);if(!this.optionsStore.options.keepInvalid){let i=0,o=1;for((null===(s=this.optionsStore.options.restrictions.maxDate)||void 0===s?void 0:s.isBefore(t))&&(o=-1);!(this.validation.isValid(t)||(t.manipulate(o,e.date),i>31));)i++}this.dates.setValue(t)}this.optionsStore.options.defaultDate&&this.dates.setValue(this.optionsStore.options.defaultDate)}this._buildWidget(),this._updateTheme();const o=this._hasTime&&!this._hasDate;if(o&&(this.optionsStore.currentView="clock",this._eventEmitters.action.emit({e:null,action:b.showClock})),this.optionsStore.currentCalendarViewMode||(this.optionsStore.currentCalendarViewMode=this.optionsStore.minimumCalendarViewMode),o||"clock"===this.optionsStore.options.display.viewMode||(this._hasTime&&(this.optionsStore.options.display.sideBySide?A.show(this.widget.querySelector(`div.${l.css.timeContainer}`)):A.hideImmediately(this.widget.querySelector(`div.${l.css.timeContainer}`))),A.show(this.widget.querySelector(`div.${l.css.dateContainer}`))),this._hasDate&&this._showMode(),this.optionsStore.options.display.inline)this.optionsStore.element.appendChild(this.widget);else{((null===(i=this.optionsStore.options)||void 0===i?void 0:i.container)||document.body).appendChild(this.widget),this._popperInstance=t.createPopper(this.optionsStore.element,this.widget,{modifiers:[{name:"eventListeners",enabled:!0}],placement:"rtl"===document.documentElement.dir?"bottom-end":"bottom-start"})}"clock"==this.optionsStore.options.display.viewMode&&this._eventEmitters.action.emit({e:null,action:b.showClock}),this.widget.querySelectorAll("[data-action]").forEach((t=>t.addEventListener("click",this._actionsClickEvent))),this._hasTime&&this.optionsStore.options.display.sideBySide&&(this.timeDisplay._update(this.widget),this.widget.getElementsByClassName(l.css.clockContainer)[0].style.display="grid")}this.widget.classList.add(l.css.show),this.optionsStore.options.display.inline||(this._popperInstance.update(),document.addEventListener("click",this._documentClickEvent)),this._eventEmitters.triggerEvent.emit({type:l.events.show}),this._isVisible=!0}_showMode(t){if(!this.widget)return;if(t){const e=Math.max(this.optionsStore.minimumCalendarViewMode,Math.min(3,this.optionsStore.currentCalendarViewMode+t));if(this.optionsStore.currentCalendarViewMode==e)return;this.optionsStore.currentCalendarViewMode=e}this.widget.querySelectorAll(`.${l.css.dateContainer} > div:not(.${l.css.calendarHeader}), .${l.css.timeContainer} > div:not(.${l.css.clockContainer})`).forEach((t=>t.style.display="none"));const e=p[this.optionsStore.currentCalendarViewMode];let s=this.widget.querySelector(`.${e.className}`);switch(e.className){case l.css.decadesContainer:this.decadeDisplay._update(this.widget,this.paint);break;case l.css.yearsContainer:this.yearDisplay._update(this.widget,this.paint);break;case l.css.monthsContainer:this.monthDisplay._update(this.widget,this.paint);break;case l.css.daysContainer:this.dateDisplay._update(this.widget,this.paint)}s.style.display="grid",this._updateCalendarHeader(),this._eventEmitters.viewUpdate.emit()}_updateTheme(t){if(this.widget){if(t){if(this.optionsStore.options.display.theme===t)return;this.optionsStore.options.display.theme=t}this.widget.classList.remove("light","dark"),this.widget.classList.add(this._getThemeClass()),"auto"===this.optionsStore.options.display.theme?window.matchMedia(l.css.isDarkPreferredQuery).addEventListener("change",(()=>this._updateTheme())):window.matchMedia(l.css.isDarkPreferredQuery).removeEventListener("change",(()=>this._updateTheme()))}}_getThemeClass(){const t=this.optionsStore.options.display.theme||"auto",e=window.matchMedia&&window.matchMedia(l.css.isDarkPreferredQuery).matches;switch(t){case"light":return l.css.lightTheme;case"dark":return l.css.darkTheme;case"auto":return e?l.css.darkTheme:l.css.lightTheme}}_updateCalendarHeader(){const t=[...this.widget.querySelector(`.${l.css.dateContainer} div[style*="display: grid"]`).classList].find((t=>t.startsWith(l.css.dateContainer))),[e,s,i]=this.widget.getElementsByClassName(l.css.calendarHeader)[0].getElementsByTagName("div");switch(t){case l.css.decadesContainer:e.setAttribute("title",this.optionsStore.options.localization.previousCentury),s.setAttribute("title",""),i.setAttribute("title",this.optionsStore.options.localization.nextCentury);break;case l.css.yearsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousDecade),s.setAttribute("title",this.optionsStore.options.localization.selectDecade),i.setAttribute("title",this.optionsStore.options.localization.nextDecade);break;case l.css.monthsContainer:e.setAttribute("title",this.optionsStore.options.localization.previousYear),s.setAttribute("title",this.optionsStore.options.localization.selectYear),i.setAttribute("title",this.optionsStore.options.localization.nextYear);break;case l.css.daysContainer:e.setAttribute("title",this.optionsStore.options.localization.previousMonth),s.setAttribute("title",this.optionsStore.options.localization.selectMonth),i.setAttribute("title",this.optionsStore.options.localization.nextMonth),s.innerText=this.optionsStore.viewDate.format(this.optionsStore.options.localization.dayViewHeaderFormat)}s.innerText=s.getAttribute(t)}hide(){this.widget&&this._isVisible&&(this.widget.classList.remove(l.css.show),this._isVisible&&(this._eventEmitters.triggerEvent.emit({type:l.events.hide,date:this.optionsStore.unset?null:this.dates.lastPicked?this.dates.lastPicked.clone:void 0}),this._isVisible=!1),document.removeEventListener("click",this._documentClickEvent))}toggle(){return this._isVisible?this.hide():this.show()}_dispose(){document.removeEventListener("click",this._documentClickEvent),this.widget&&(this.widget.querySelectorAll("[data-action]").forEach((t=>t.removeEventListener("click",this._actionsClickEvent))),this.widget.parentNode.removeChild(this.widget),this._widget=void 0)}_buildWidget(){const t=document.createElement("div");t.classList.add(l.css.widget);const e=document.createElement("div");e.classList.add(l.css.dateContainer),e.append(this.getHeadTemplate(),this.decadeDisplay.getPicker(),this.yearDisplay.getPicker(),this.monthDisplay.getPicker(),this.dateDisplay.getPicker());const s=document.createElement("div");s.classList.add(l.css.timeContainer),s.appendChild(this.timeDisplay.getPicker(this._iconTag.bind(this))),s.appendChild(this.hourDisplay.getPicker()),s.appendChild(this.minuteDisplay.getPicker()),s.appendChild(this.secondDisplay.getPicker());const i=document.createElement("div");if(i.classList.add(l.css.toolbar),i.append(...this.getToolbarElements()),this.optionsStore.options.display.inline&&t.classList.add(l.css.inline),this.optionsStore.options.display.calendarWeeks&&t.classList.add("calendarWeeks"),this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){t.classList.add(l.css.sideBySide),"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");return o.classList.add("td-row"),e.classList.add("td-half"),s.classList.add("td-half"),o.appendChild(e),o.appendChild(s),t.appendChild(o),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),void(this._widget=t)}"top"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i),this._hasDate&&(this._hasTime&&(e.classList.add(l.css.collapse),"clock"!==this.optionsStore.options.display.viewMode&&e.classList.add(l.css.show)),t.appendChild(e)),this._hasTime&&(this._hasDate&&(s.classList.add(l.css.collapse),"clock"===this.optionsStore.options.display.viewMode&&s.classList.add(l.css.show)),t.appendChild(s)),"bottom"===this.optionsStore.options.display.toolbarPlacement&&t.appendChild(i);const o=document.createElement("div");o.classList.add("arrow"),o.setAttribute("data-popper-arrow",""),t.appendChild(o),this._widget=t}get _hasTime(){return this.optionsStore.options.display.components.clock&&(this.optionsStore.options.display.components.hours||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.components.seconds)}get _hasDate(){return this.optionsStore.options.display.components.calendar&&(this.optionsStore.options.display.components.year||this.optionsStore.options.display.components.month||this.optionsStore.options.display.components.date)}getToolbarElements(){const t=[];if(this.optionsStore.options.display.buttons.today){const e=document.createElement("div");e.setAttribute("data-action",b.today),e.setAttribute("title",this.optionsStore.options.localization.today),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.today)),t.push(e)}if(!this.optionsStore.options.display.sideBySide&&this._hasDate&&this._hasTime){let e,s;"clock"===this.optionsStore.options.display.viewMode?(e=this.optionsStore.options.localization.selectDate,s=this.optionsStore.options.display.icons.date):(e=this.optionsStore.options.localization.selectTime,s=this.optionsStore.options.display.icons.time);const i=document.createElement("div");i.setAttribute("data-action",b.togglePicker),i.setAttribute("title",e),i.appendChild(this._iconTag(s)),t.push(i)}if(this.optionsStore.options.display.buttons.clear){const e=document.createElement("div");e.setAttribute("data-action",b.clear),e.setAttribute("title",this.optionsStore.options.localization.clear),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.clear)),t.push(e)}if(this.optionsStore.options.display.buttons.close){const e=document.createElement("div");e.setAttribute("data-action",b.close),e.setAttribute("title",this.optionsStore.options.localization.close),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.close)),t.push(e)}return t}getHeadTemplate(){const t=document.createElement("div");t.classList.add(l.css.calendarHeader);const e=document.createElement("div");e.classList.add(l.css.previous),e.setAttribute("data-action",b.previous),e.appendChild(this._iconTag(this.optionsStore.options.display.icons.previous));const s=document.createElement("div");s.classList.add(l.css.switch),s.setAttribute("data-action",b.changeCalendarView);const i=document.createElement("div");return i.classList.add(l.css.next),i.setAttribute("data-action",b.next),i.appendChild(this._iconTag(this.optionsStore.options.display.icons.next)),t.append(e,s,i),t}_iconTag(t){if("sprites"===this.optionsStore.options.display.icons.type){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("xlink:href",t),s.setAttribute("href",t),e.appendChild(s),e}const e=document.createElement("i");return e.classList.add(...t.split(" ")),e}_rebuild(){const t=this._isVisible;t&&this.hide(),this._dispose(),t&&this.show()}}class O{constructor(){this.optionsStore=h.locate(u),this.dates=h.locate(w),this.validation=h.locate(m),this.display=h.locate($),this._eventEmitters=h.locate(v),this._eventEmitters.action.subscribe((t=>{this.do(t.e,t.action)}))}do(t,s){var i,o;const n=null==t?void 0:t.currentTarget;if(null===(i=null==n?void 0:n.classList)||void 0===i?void 0:i.contains(l.css.disabled))return!1;s=s||(null===(o=null==n?void 0:n.dataset)||void 0===o?void 0:o.action);const r=(this.dates.lastPicked||this.optionsStore.viewDate).clone;switch(s){case b.next:case b.previous:this.handleNextPrevious(s);break;case b.changeCalendarView:this.display._showMode(1),this.display._updateCalendarHeader();break;case b.selectMonth:case b.selectYear:case b.selectDecade:const i=+n.dataset.value;switch(s){case b.selectMonth:this.optionsStore.viewDate.month=i;break;case b.selectYear:case b.selectDecade:this.optionsStore.viewDate.year=i}this.optionsStore.currentCalendarViewMode===this.optionsStore.minimumCalendarViewMode?(this.dates.setValue(this.optionsStore.viewDate,this.dates.lastPickedIndex),this.optionsStore.options.display.inline||this.display.hide()):this.display._showMode(-1);break;case b.selectDay:const o=this.optionsStore.viewDate.clone;n.classList.contains(l.css.old)&&o.manipulate(-1,e.month),n.classList.contains(l.css.new)&&o.manipulate(1,e.month),o.date=+n.dataset.day;let d=0;this.optionsStore.options.multipleDates?(d=this.dates.pickedIndex(o,e.date),-1!==d?this.dates.setValue(null,d):this.dates.setValue(o,this.dates.lastPickedIndex+1)):this.dates.setValue(o,this.dates.lastPickedIndex),this.display._hasTime||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline||this.optionsStore.options.multipleDates||this.display.hide();break;case b.selectHour:let c=+n.dataset.value;r.hours>=12&&!this.optionsStore.options.display.components.useTwentyfourHour&&(c+=12),r.hours=c,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case b.selectMinute:r.minutes=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case b.selectSecond:r.seconds=+n.dataset.value,this.dates.setValue(r,this.dates.lastPickedIndex),this.hideOrClock(t);break;case b.incrementHours:this.manipulateAndSet(r,e.hours);break;case b.incrementMinutes:this.manipulateAndSet(r,e.minutes,this.optionsStore.options.stepping);break;case b.incrementSeconds:this.manipulateAndSet(r,e.seconds);break;case b.decrementHours:this.manipulateAndSet(r,e.hours,-1);break;case b.decrementMinutes:this.manipulateAndSet(r,e.minutes,-1*this.optionsStore.options.stepping);break;case b.decrementSeconds:this.manipulateAndSet(r,e.seconds,-1);break;case b.toggleMeridiem:this.manipulateAndSet(r,e.hours,this.dates.lastPicked.hours>=12?-12:12);break;case b.togglePicker:n.getAttribute("title")===this.optionsStore.options.localization.selectDate?(n.setAttribute("title",this.optionsStore.options.localization.selectTime),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.time).outerHTML,this.display._updateCalendarHeader(),this.optionsStore.refreshCurrentView()):(n.setAttribute("title",this.optionsStore.options.localization.selectDate),n.innerHTML=this.display._iconTag(this.optionsStore.options.display.icons.date).outerHTML,this.display._hasTime&&(this.handleShowClockContainers(b.showClock),this.display._update("clock"))),this.display.widget.querySelectorAll(`.${l.css.dateContainer}, .${l.css.timeContainer}`).forEach((t=>A.toggle(t))),this._eventEmitters.viewUpdate.emit();break;case b.showClock:case b.showHours:case b.showMinutes:case b.showSeconds:this.optionsStore.options.display.sideBySide||"clock"===this.optionsStore.currentView||(A.hideImmediately(this.display.widget.querySelector(`div.${l.css.dateContainer}`)),A.showImmediately(this.display.widget.querySelector(`div.${l.css.timeContainer}`))),this.handleShowClockContainers(s);break;case b.clear:this.dates.setValue(null),this.display._updateCalendarHeader();break;case b.close:this.display.hide();break;case b.today:const h=(new a).setLocale(this.optionsStore.options.localization.locale);this.optionsStore.viewDate=h,this.validation.isValid(h,e.date)&&this.dates.setValue(h,this.dates.lastPickedIndex)}}handleShowClockContainers(t){if(!this.display._hasTime)return void l.errorMessages.throwError("Cannot show clock containers when time is disabled.");this.optionsStore.currentView="clock",this.display.widget.querySelectorAll(`.${l.css.timeContainer} > div`).forEach((t=>t.style.display="none"));let s="";switch(t){case b.showClock:s=l.css.clockContainer,this.display._update("clock");break;case b.showHours:s=l.css.hourContainer,this.display._update(e.hours);break;case b.showMinutes:s=l.css.minuteContainer,this.display._update(e.minutes);break;case b.showSeconds:s=l.css.secondContainer,this.display._update(e.seconds)}this.display.widget.getElementsByClassName(s)[0].style.display="grid"}handleNextPrevious(t){const{unit:e,step:s}=p[this.optionsStore.currentCalendarViewMode];t===b.next?this.optionsStore.viewDate.manipulate(s,e):this.optionsStore.viewDate.manipulate(-1*s,e),this._eventEmitters.viewUpdate.emit(),this.display._showMode()}hideOrClock(t){!this.optionsStore.options.display.components.useTwentyfourHour||this.optionsStore.options.display.components.minutes||this.optionsStore.options.display.keepOpen||this.optionsStore.options.display.inline?this.do(t,b.showClock):this.display.hide()}manipulateAndSet(t,e,s=1){const i=t.manipulate(s,e);this.validation.isValid(i,e)&&this.dates.setValue(i,this.dates.lastPickedIndex)}}class V{constructor(t,e={}){this._subscribers={},this._isDisabled=!1,this._inputChangeEvent=t=>{if(null==t?void 0:t.detail)return;const e=()=>{this.dates.lastPicked&&(this.optionsStore.viewDate=this.dates.lastPicked.clone)},s=this.optionsStore.input.value;if(this.optionsStore.options.multipleDates)try{const t=s.split(this.optionsStore.options.multipleDatesSeparator);for(let e=0;e{var t,e;(null===(t=this.optionsStore.element)||void 0===t?void 0:t.disabled)||(null===(e=this.optionsStore.input)||void 0===e?void 0:e.disabled)||this.toggle()},h=new c,this._eventEmitters=h.locate(v),this.optionsStore=h.locate(u),this.display=h.locate($),this.dates=h.locate(w),this.actions=h.locate(O),t||l.errorMessages.mustProvideElement(),this.optionsStore.element=t,this._initializeOptions(e,g,!0),this.optionsStore.viewDate.setLocale(this.optionsStore.options.localization.locale),this.optionsStore.unset=!0,this._initializeInput(),this._initializeToggle(),this.optionsStore.options.display.inline&&this.display.show(),this._eventEmitters.triggerEvent.subscribe((t=>{this._triggerEvent(t)})),this._eventEmitters.viewUpdate.subscribe((()=>{this._viewUpdate()}))}get viewDate(){return this.optionsStore.viewDate}updateOptions(t,e=!1){e?this._initializeOptions(t,g):this._initializeOptions(t,this.optionsStore.options),this.display._rebuild()}toggle(){this._isDisabled||this.display.toggle()}show(){this._isDisabled||this.display.show()}hide(){this.display.hide()}disable(){var t;this._isDisabled=!0,null===(t=this.optionsStore.input)||void 0===t||t.setAttribute("disabled","disabled"),this.display.hide()}enable(){var t;this._isDisabled=!1,null===(t=this.optionsStore.input)||void 0===t||t.removeAttribute("disabled")}clear(){this.optionsStore.input.value="",this.dates.clear()}subscribe(t,e){let s;"string"==typeof t&&(t=[t]),s=Array.isArray(e)?e:[e],t.length!==s.length&&l.errorMessages.subscribeMismatch();const i=[];for(let e=0;e{e(t)}))}_viewUpdate(){this._triggerEvent({type:l.events.update,viewDate:this.optionsStore.viewDate.clone})}_unsubscribe(t,e){this._subscribers[t].splice(e,1)}_initializeOptions(t,e,s=!1){var i,o;let a=S.deepCopy(t);a=S._mergeOptions(a,e),s&&(a=S._dataToOptions(this.optionsStore.element,a)),S._validateConflicts(a),a.viewDate=a.viewDate.setLocale(a.localization.locale),this.optionsStore.viewDate.isSame(a.viewDate)||(this.optionsStore.viewDate=a.viewDate),a.display.components.year&&(this.optionsStore.minimumCalendarViewMode=2),a.display.components.month&&(this.optionsStore.minimumCalendarViewMode=1),a.display.components.date&&(this.optionsStore.minimumCalendarViewMode=0),this.optionsStore.currentCalendarViewMode=Math.max(this.optionsStore.minimumCalendarViewMode,this.optionsStore.currentCalendarViewMode),p[this.optionsStore.currentCalendarViewMode].name!==a.display.viewMode&&(this.optionsStore.currentCalendarViewMode=Math.max(p.findIndex((t=>t.name===a.display.viewMode)),this.optionsStore.minimumCalendarViewMode)),(null===(i=this.display)||void 0===i?void 0:i.isVisible)&&this.display._update("all"),void 0===a.display.components.useTwentyfourHour&&(a.display.components.useTwentyfourHour=!(null===(o=a.viewDate.parts())||void 0===o?void 0:o.dayPeriod)),this.optionsStore.options=a}_initializeInput(){if("INPUT"==this.optionsStore.element.tagName)this.optionsStore.input=this.optionsStore.element;else{let t=this.optionsStore.element.dataset.tdTargetInput;this.optionsStore.input=null==t||"nearest"==t?this.optionsStore.element.querySelector("input"):this.optionsStore.element.querySelector(t)}this.optionsStore.input&&(this.optionsStore.input.addEventListener("change",this._inputChangeEvent),this.optionsStore.options.allowInputToggle&&this.optionsStore.input.addEventListener("click",this._toggleClickEvent),this.optionsStore.input.value&&this._inputChangeEvent())}_initializeToggle(){if(this.optionsStore.options.display.inline)return;let t=this.optionsStore.element.dataset.tdTargetToggle;"nearest"==t&&(t='[data-td-toggle="datetimepicker"]'),this._toggle=null==t?this.optionsStore.element:this.optionsStore.element.querySelector(t),this._toggle.addEventListener("click",this._toggleClickEvent)}_handleAfterChangeEvent(t){var e,s;!this.optionsStore.options.promptTimeOnDateChange||this.optionsStore.options.display.inline||this.optionsStore.options.display.sideBySide||!this.display._hasTime||(null===(e=this.display.widget)||void 0===e?void 0:e.getElementsByClassName(l.css.show)[0].classList.contains(l.css.timeContainer))||!t.oldDate&&this.optionsStore.options.useCurrent||t.oldDate&&(null===(s=t.date)||void 0===s?void 0:s.isSame(t.oldDate))||(clearTimeout(this._currentPromptTimeTimeout),this._currentPromptTimeTimeout=setTimeout((()=>{this.display.widget&&this._eventEmitters.action.emit({e:{currentTarget:this.display.widget.querySelector(`.${l.css.switch} div`)},action:b.togglePicker})}),this.optionsStore.options.promptTimeOnDateChangeTransitionDelay))}}const H={},x={TempusDominus:V,extend:function(t,e){return t?(t.installed||(t(e,{TempusDominus:V,Dates:w,Display:$,DateTime:a,ErrorMessages:r},x),t.installed=!0),x):x},loadLocale:t=>{H[t.name]||(H[t.name]=t.localization)},locale:t=>{let e=H[t];e&&(g.localization=e)},Namespace:l,DefaultOptions:g,DateTime:a,Unit:e,version:"6.0.0"};return x})); diff --git a/dist/locales/ar-SA.js b/dist/locales/ar-SA.js index 74d546874..e06c62983 100644 --- a/dist/locales/ar-SA.js +++ b/dist/locales/ar-SA.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/ar.js b/dist/locales/ar.js index 4e54adffd..7b9128aba 100644 --- a/dist/locales/ar.js +++ b/dist/locales/ar.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/de.js b/dist/locales/de.js index 10b730ea3..c748f5d8b 100644 --- a/dist/locales/de.js +++ b/dist/locales/de.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/es.js b/dist/locales/es.js index 9b80ecf69..ef014a5ed 100644 --- a/dist/locales/es.js +++ b/dist/locales/es.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/fi.js b/dist/locales/fi.js index 15ddcefb6..6a72f73ec 100644 --- a/dist/locales/fi.js +++ b/dist/locales/fi.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/fr.js b/dist/locales/fr.js index c8617d292..115481b6e 100644 --- a/dist/locales/fr.js +++ b/dist/locales/fr.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/it.js b/dist/locales/it.js index 1defe56fb..19bd40dc5 100644 --- a/dist/locales/it.js +++ b/dist/locales/it.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/nl.js b/dist/locales/nl.js index 6408c999a..57eed163b 100644 --- a/dist/locales/nl.js +++ b/dist/locales/nl.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/ro.js b/dist/locales/ro.js index 6c7193670..47af46569 100644 --- a/dist/locales/ro.js +++ b/dist/locales/ro.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/ru.js b/dist/locales/ru.js index 27cdd4075..c006ea69d 100644 --- a/dist/locales/ru.js +++ b/dist/locales/ru.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/locales/sl.js b/dist/locales/sl.js index c3c8d715c..6865d0545 100644 --- a/dist/locales/sl.js +++ b/dist/locales/sl.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/plugins/customDateFormat.js b/dist/plugins/customDateFormat.js index a1b615b37..5d484e926 100644 --- a/dist/plugins/customDateFormat.js +++ b/dist/plugins/customDateFormat.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/plugins/fa-five.js b/dist/plugins/fa-five.js index ff78cfe03..46f84575f 100644 --- a/dist/plugins/fa-five.js +++ b/dist/plugins/fa-five.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/dist/plugins/moment-parse.js b/dist/plugins/moment-parse.js index db658cb9f..8d9a8eb4f 100644 --- a/dist/plugins/moment-parse.js +++ b/dist/plugins/moment-parse.js @@ -1,5 +1,5 @@ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2022 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/package-lock.json b/package-lock.json index 851eaa592..0259f2fe3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@eonasdan/tempus-dominus", - "version": "6.0.0-beta10", + "version": "6.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@eonasdan/tempus-dominus", - "version": "6.0.0-beta10", + "version": "6.0.0", "license": "MIT", "devDependencies": { "@popperjs/core": "^2.11.6", @@ -378,7 +378,7 @@ "debug": "4" }, "engines": { - "node": ">= 6.0.0-beta10" + "node": ">= 6.0.0" } }, "node_modules/alphanum-sort": { @@ -1814,7 +1814,7 @@ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "dependencies": { - "semver": "^6.0.0-beta10" + "semver": "^6.0.0" }, "engines": { "node": ">=8" @@ -4858,7 +4858,7 @@ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "requires": { - "semver": "^6.0.0-beta10" + "semver": "^6.0.0" } }, "mdn-data": { diff --git a/package.json b/package.json index e8bf31543..c35ef8604 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "Jonathan Peterson" }, "name": "@eonasdan/tempus-dominus", - "version": "6.0.0-beta10", + "version": "6.0.0", "style": "dist/css/tempus-dominus.css", "sass": "scss/tempus-dominus.scss", "main": "dist/js/tempus-dominus.js", diff --git a/src/docs/partials/change-log.html b/src/docs/partials/change-log.html index 0f85ad734..1f3b19d9c 100644 --- a/src/docs/partials/change-log.html +++ b/src/docs/partials/change-log.html @@ -1,7 +1,7 @@

Version 6

-

6.0.0-beta10!

+

6.0.0!

New

  • Added a customDateFormat plugin and new options to allow custom formats to be provided for input parsing/setting
  • diff --git a/src/docs/templates/index.html b/src/docs/templates/index.html index 974494d16..fa1f59883 100644 --- a/src/docs/templates/index.html +++ b/src/docs/templates/index.html @@ -17,7 +17,7 @@

    Powerful and robust date and time picker

- Currently v6.0.0-beta10 + Currently v6.0.0 · v5 docs

diff --git a/src/docs/templates/shell.html b/src/docs/templates/shell.html index 935ba619f..ab1eb0100 100644 --- a/src/docs/templates/shell.html +++ b/src/docs/templates/shell.html @@ -181,7 +181,7 @@ target='_blank' rel='license noopener'>MIT, docs CC BY 3.0. -
  • Currently v6.0.0-beta10-alpha1.
  • +
  • Currently v6.0.0-alpha1.
  • diff --git a/src/js/jQuery-provider.js b/src/js/jQuery-provider.js index 86debde82..c6e313431 100644 --- a/src/js/jQuery-provider.js +++ b/src/js/jQuery-provider.js @@ -2,7 +2,7 @@ /*global $, tempusDominus */ /*! - * Tempus Dominus v6.0.0-beta10 (https://getdatepicker.com/) + * Tempus Dominus v6.0.0 (https://getdatepicker.com/) * Copyright 2013-2021 Jonathan Peterson * Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE) */ diff --git a/src/js/tempus-dominus.ts b/src/js/tempus-dominus.ts index 4f77cd34e..dc4441773 100644 --- a/src/js/tempus-dominus.ts +++ b/src/js/tempus-dominus.ts @@ -558,7 +558,7 @@ const extend = function (plugin, option) { return tempusDominus; }; -const version = '6.0.0-beta10'; +const version = '6.0.0'; const tempusDominus = { TempusDominus, diff --git a/src/nuget/TempusDominus.nuspec b/src/nuget/TempusDominus.nuspec index fe04e6f95..e2c7565c2 100644 --- a/src/nuget/TempusDominus.nuspec +++ b/src/nuget/TempusDominus.nuspec @@ -2,7 +2,7 @@ TempusDominus - 6.0.0-beta10 + 6.0.0 Tempus Dominus Eonasdan Eonasdan diff --git a/src/nuget/TempusDominus.scss.nuspec b/src/nuget/TempusDominus.scss.nuspec index 84fbf7793..10fe50f5b 100644 --- a/src/nuget/TempusDominus.scss.nuspec +++ b/src/nuget/TempusDominus.scss.nuspec @@ -2,7 +2,7 @@ TempusDominus.scss - 6.0.0-beta10 + 6.0.0 Tempus Dominus Eonasdan Eonasdan