@yuafox/easepick2 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,5 @@
1
+ # Software License Agreement
2
+
3
+ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
4
+
5
+ Copyright © 2021-2022, [Rinat G.](https://github.com/wakirin)
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @easepick/bundle
2
+
3
+ [![npm version](https://badge.fury.io/js/@easepick%2Fbundle.svg)](https://www.npmjs.com/package/@easepick/bundle).
4
+
5
+ Bundle of easepick.
6
+ Includes all packages.
7
+
8
+ ## Documentation
9
+
10
+ [https://easepick.com/packages/bundle](https://easepick.com/packages/bundle)
11
+
12
+
13
+ ## Options
14
+
15
+ See options in [@easepick/core](https://easepick.com/packages/core) and other [packages](https://easepick.com/packages).
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ :host{--color-bg-default:#fff;--color-bg-secondary:#f9f9f9;--color-fg-default:#333;--color-fg-primary:#6b82ff;--color-fg-secondary:#748194;--color-fg-selected:#fff;--color-fg-muted:#9e9e9e;--color-fg-accent:#e63757;--color-btn-primary-bg:#fff;--color-btn-primary-fg:#6b82ff;--color-btn-primary-border:#6b82ff;--color-btn-primary-hover-bg:#6b82ff;--color-btn-primary-hover-fg:#fff;--color-btn-primary-hover-border:#6b82ff;--color-btn-primary-disabled-bg:#a2b0ff;--color-btn-primary-disabled-fg:#fff;--color-btn-primary-disabled-border:#a2b0ff;--color-btn-secondary-bg:#fff;--color-btn-secondary-fg:#748194;--color-btn-secondary-border:#748194;--color-btn-secondary-hover-bg:#748194;--color-btn-secondary-hover-fg:#fff;--color-btn-secondary-hover-border:#748194;--color-btn-secondary-disabled-bg:#b5bbc4;--color-btn-secondary-disabled-fg:#fff;--color-btn-secondary-disabled-border:#b5bbc4;--color-border-default:#ddd;--color-border-locked:#f9f9f9;--day-width:42px;--day-height:37px;--border-radius:2px;--primary-color:#6b82ff;--secondary-color:#748194;--white-color:#fff;--black-color:#333;--lightgray-color:#f9f9f9;--gray-color:#9e9e9e;--red-color:#e63757}*{box-sizing:border-box}.container{border-radius:4px;color:var(--color-fg-default);cursor:default;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:.8em;height:0;overflow:hidden;pointer-events:all;position:absolute;transform:scale(0);transform-origin:top left;transition:transform .3s ease-out}.container.calc{height:auto;transform:none;transition:none;visibility:hidden}.container.show{box-shadow:0 0 25px rgba(0,0,0,.3);height:auto;transform:scale(1)}.container.inline{box-shadow:0 7px 14px 0 rgba(65,69,88,.1),0 3px 6px 0 rgba(0,0,0,.07);height:auto;left:0;position:relative;top:0;transform:scaleY(1)}.container>main{background-color:var(--color-bg-default)}.container>footer,.container>header{background-color:var(--color-bg-secondary);padding:10px}.container>footer .footer-buttons{-moz-column-gap:5px;column-gap:5px;display:flex;justify-content:flex-end}.container>footer .footer-buttons>button{background-color:transparent;border:1px solid transparent;border-radius:var(--border-radius);cursor:pointer;padding:5px 10px}.container>footer .footer-buttons>button.apply-button{background-color:var(--color-btn-primary-bg);border-color:var(--color-btn-primary-border);color:var(--color-btn-primary-fg)}.container>footer .footer-buttons>button.apply-button:hover{background-color:var(--color-btn-primary-hover-bg);border-color:var(--color-btn-primary-hover-border);color:var(--color-btn-primary-hover-fg)}.container>footer .footer-buttons>button.apply-button:disabled{background-color:var(--color-btn-primary-disabled-bg);border-color:var(--color-btn-primary-disabled-border);color:var(--color-btn-primary-disabled-fg);cursor:default}.container>footer .footer-buttons>button.cancel-button{background-color:var(--color-btn-secondary-bg);border-color:var(--color-btn-secondary-border);color:var(--color-btn-secondary-fg)}.container>footer .footer-buttons>button.cancel-button:hover{background-color:var(--color-btn-secondary-hover-bg);border-color:var(--color-btn-secondary-hover-border);color:var(--color-btn-secondary-hover-fg)}.container>footer .footer-buttons>button.cancel-button:disabled{background-color:var(--color-btn-secondary-disabled-bg);border-color:var(--color-btn-secondary-disabled-border);color:var(--color-btn-secondary-disabled-fg);cursor:default}.grid-1{grid-template-columns:repeat(1,1fr)}.grid-2{grid-template-columns:repeat(2,1fr)}.grid-3{grid-template-columns:repeat(3,1fr)}.grid-4{grid-template-columns:repeat(4,1fr)}.grid-5{grid-template-columns:repeat(5,1fr)}.grid-6{grid-template-columns:repeat(6,1fr)}.grid-7{grid-template-columns:repeat(7,1fr)}.grid-8{grid-template-columns:repeat(8,1fr)}.grid-9{grid-template-columns:repeat(9,1fr)}.grid-10{grid-template-columns:repeat(10,1fr)}.grid-11{grid-template-columns:repeat(11,1fr)}.grid-12{grid-template-columns:repeat(12,1fr)}.calendars{display:grid}.calendars:not(.grid-1) .calendar>.header .month-name{order:2;text-align:center}.calendars:not(.grid-1) .calendar>.header .previous-button{order:1;visibility:hidden}.calendars:not(.grid-1) .calendar>.header .next-button{order:3;visibility:hidden}.calendars:not(.grid-1) .calendar:first-child>.header .previous-button,.calendars:not(.grid-1) .calendar:last-child>.header .next-button{visibility:visible}.calendar{padding:10px}.calendar>.header{align-items:center;-moz-column-gap:5px;column-gap:5px;display:flex;justify-content:space-between;padding:10px}.calendar>.header .month-name{flex:1;font-size:15px;font-weight:500}.calendar>.header .month-name>span{font-weight:700}.calendar>.header button{align-items:center;background-color:transparent;border:1px solid transparent;border-radius:2px;color:var(--color-btn-secondary-fg);cursor:pointer;display:flex;justify-content:center;padding:4px 7px}.calendar>.header button:hover{background-color:var(--color-bg-secondary)}.calendar>.header button:hover>img,.calendar>.header button:hover>svg{fill:var(--color-fg-primary);color:var(--color-fg-primary)}.calendar>.header button>img,.calendar>.header button>svg{fill:var(--color-btn-secondary-fg);color:var(--color-btn-secondary-fg);pointer-events:none;transform:scale(.7)}.calendar>.daynames-row,.calendar>.days-grid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}.calendar>.daynames-row>.day,.calendar>.daynames-row>.dayname,.calendar>.days-grid>.day,.calendar>.days-grid>.dayname{align-items:center;cursor:default;display:flex;flex-direction:column;font-size:13px;justify-content:center}.calendar>.daynames-row>.dayname{color:var(--color-fg-muted);font-size:12px;padding:5px 0}.calendar>.days-grid>.day{border:1px solid transparent;border-radius:2px;height:var(--day-height);max-height:var(--day-height);max-width:var(--day-width);min-height:var(--day-height);min-width:var(--day-width);padding:10px 0;width:var(--day-width)}.calendar>.days-grid>.day:hover{border:1px solid var(--color-fg-primary);color:var(--color-fg-primary)}.calendar>.days-grid>.day.today{color:var(--color-fg-accent)}.calendar>.days-grid>.day.selected{background-color:var(--color-fg-primary);color:var(--color-fg-selected)}.calendar>.months-grid,.calendar>.years-grid{-moz-column-gap:2px;column-gap:2px;display:grid;grid-template-columns:repeat(4,1fr);row-gap:2px}.calendar>.months-grid>.month,.calendar>.months-grid>.year,.calendar>.years-grid>.month,.calendar>.years-grid>.year{align-items:center;border:1px solid transparent;border-radius:2px;cursor:default;display:flex;font-size:13px;justify-content:center;padding:12px 8px}.calendar>.months-grid>.month:hover,.calendar>.months-grid>.year:hover,.calendar>.years-grid>.month:hover,.calendar>.years-grid>.year:hover{border:1px solid var(--color-fg-primary);color:var(--color-fg-primary)}.calendar>.months-grid>.month.today,.calendar>.months-grid>.year.today,.calendar>.years-grid>.month.today,.calendar>.years-grid>.year.today{color:var(--color-fg-accent)}.calendar>.months-grid>.month.selected,.calendar>.months-grid>.year.selected,.calendar>.years-grid>.month.selected,.calendar>.years-grid>.year.selected{background-color:var(--color-fg-primary);color:var(--color-fg-selected)}.calendar>.months-grid>.month.outside,.calendar>.months-grid>.year.outside,.calendar>.years-grid>.month.outside,.calendar>.years-grid>.year.outside{color:var(--color-fg-muted)}.calendar>.years-grid{grid-template-columns:repeat(4,1fr)}@media (max-width:480px){.container:not(.inline){transform:scaleY(0)!important;transform-origin:bottom center!important}.container:not(.inline).show{bottom:0!important;left:0!important;position:fixed!important;right:0!important;top:auto!important;transform:scaleY(1)!important}.container{width:100%}.calendars{grid-template-columns:repeat(1,1fr)}.calendars .calendar{box-sizing:border-box;width:100%}.calendars .calendar:nth-child(n+2){display:none}.calendars .calendar>.days-grid>.day{height:auto;max-height:unset;max-width:unset;min-height:unset;min-width:unset;width:auto}.calendars .calendar>.header:not(.no-next-month) .next-button{visibility:visible}}:host{--color-fg-locked:#9e9e9e;--color-bg-locked:#ffab91;--color-bg-unavailable:#f9f9f9}.container.lock-plugin .calendars .calendar:first-child>.header.no-previous-month .previous-button,.container.lock-plugin .calendars .calendar:last-child>.header.no-next-month .next-button{visibility:hidden}.container.lock-plugin .calendar>.days-grid>.day.not-available{background-color:var(--color-bg-unavailable);color:var(--color-fg-locked);font-style:italic;pointer-events:none}.container.lock-plugin .calendar>.days-grid>.day.locked{background-color:transparent;border:1px solid var(--color-border-locked);color:var(--color-fg-locked);pointer-events:none}.container.lock-plugin .calendar>.days-grid>.day.locked:not(.start):not(.end){background-image:repeating-linear-gradient(135deg,transparent,var(--color-bg-locked) 2px,transparent 2px,transparent 4px);font-style:italic}.container.lock-plugin .calendar>.months-grid>.month.locked,.container.lock-plugin .calendar>.years-grid>.year.locked{background-color:transparent;border:1px solid var(--color-border-locked);color:var(--color-fg-locked);pointer-events:none}.container.lock-plugin .preset-plugin-container>button:disabled{color:var(--color-fg-locked);pointer-events:none}.container.preset-plugin>main{display:flex}.container.preset-plugin>main.preset-left{flex-direction:row-reverse}.container.preset-plugin>main.preset-right{flex-direction:row}.container.preset-plugin>main.preset-left .preset-plugin-container,.container.preset-plugin>main.preset-right .preset-plugin-container{flex-direction:column;width:130px}.container.preset-plugin>main.preset-top{flex-direction:column-reverse}.container.preset-plugin>main.preset-bottom{flex-direction:column}.container.preset-plugin>main.preset-bottom .preset-plugin-container,.container.preset-plugin>main.preset-top .preset-plugin-container{flex-direction:row}.preset-plugin-container{background-color:var(--color-bg-secondary);display:flex;justify-content:space-between;padding:10px}.preset-plugin-container>button{background-color:var(--color-bg-default);border:1px solid transparent;border-radius:4px;color:var(--color-fg-default);padding:5px}.preset-plugin-container>button:hover{border:1px solid var(--color-fg-primary);color:var(--color-fg-primary);cursor:pointer}:host{--color-bg-inrange:#d5dbff;--color-bg-tooltip:#fff;--color-fg-tooltip:#333}.range-plugin-tooltip{background-color:var(--color-bg-tooltip);border-radius:var(--border-radius);box-shadow:0 1px 3px rgba(0,0,0,.25);color:var(--color-fg-tooltip);font-size:12px;margin-top:-4px;padding:4px 8px;pointer-events:none;position:absolute;visibility:hidden;white-space:nowrap;z-index:1}.range-plugin-tooltip:before{border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid rgba(0,0,0,.12);bottom:-5px;content:"";left:calc(50% - 5px);position:absolute}.range-plugin-tooltip:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid var(--color-bg-tooltip);bottom:-4px;content:"";left:calc(50% - 4px);position:absolute}.container.range-plugin .calendar>.days-grid>.day{position:relative}.container.range-plugin .calendar>.days-grid>.day.in-range:last-of-type{border-bottom-right-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.container.range-plugin .calendar>.days-grid>.day.in-range{background-color:var(--color-bg-inrange);border-radius:0}.container.range-plugin .calendar>.days-grid>.day.end,.container.range-plugin .calendar>.days-grid>.day.start{background-color:var(--color-fg-primary);color:var(--color-fg-selected)}.container.range-plugin .calendar>.days-grid>.day.start{border-bottom-right-radius:0;border-top-right-radius:0}.container.range-plugin .calendar>.days-grid>.day.start:after{border:8px solid transparent;border-left:8px solid var(--color-fg-primary);content:"";pointer-events:none;position:absolute;right:-14px;z-index:1}.container.range-plugin .calendar>.days-grid>.day.start.flipped{border-bottom-left-radius:0;border-bottom-right-radius:var(--border-radius);border-top-left-radius:0;border-top-right-radius:var(--border-radius)}.container.range-plugin .calendar>.days-grid>.day.start.flipped:after{border-left-color:transparent;border-right-color:var(--color-fg-primary);left:-14px;right:auto}.container.range-plugin .calendar>.days-grid>.day.end{border-bottom-left-radius:0;border-top-left-radius:0}.container.range-plugin .calendar>.days-grid>.day.end:after{border:8px solid transparent;border-right:8px solid var(--color-fg-primary);content:"";left:-14px;pointer-events:none;position:absolute;z-index:1}.container.range-plugin .calendar>.days-grid>.day.end.flipped{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:0;border-top-left-radius:var(--border-radius);border-top-right-radius:0}.container.range-plugin .calendar>.days-grid>.day.end.flipped:after{border-left-color:var(--color-fg-primary);border-right-color:transparent;left:auto;right:-14px}.container.range-plugin .calendar>.days-grid>.day.start.end{border-radius:var(--border-radius)}.container.range-plugin .calendar>.days-grid>.day.start.end:after{content:none}.container.range-plugin .calendar>.days-grid>div:not(.day)+.day.in-range{border-bottom-left-radius:var(--border-radius);border-top-left-radius:var(--border-radius)}.container.range-plugin .calendar>.days-grid>div:nth-child(7n).in-range{border-bottom-right-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.container.range-plugin .calendar>.days-grid>div:nth-child(7n+1).in-range{border-bottom-left-radius:var(--border-radius);border-top-left-radius:var(--border-radius)}.container.range-plugin .calendar>.months-grid>.month.in-range,.container.range-plugin .calendar>.years-grid>.year.in-range{background-color:var(--color-bg-inrange);border-radius:0}.container.range-plugin .calendar>.months-grid>.month.end,.container.range-plugin .calendar>.months-grid>.month.start,.container.range-plugin .calendar>.years-grid>.year.end,.container.range-plugin .calendar>.years-grid>.year.start{background-color:var(--color-fg-primary);color:var(--color-fg-selected)}.container.range-plugin .calendar>.months-grid>.month.start,.container.range-plugin .calendar>.years-grid>.year.start{border-bottom-right-radius:0;border-top-right-radius:0}.container.range-plugin .calendar>.months-grid>.month.end,.container.range-plugin .calendar>.years-grid>.year.end{border-bottom-left-radius:0;border-top-left-radius:0}.container.range-plugin .calendar>.months-grid>.month.start.end,.container.range-plugin .calendar>.years-grid>.year.start.end{border-radius:var(--border-radius)}.container.preset-plugin main{display:grid}.container.preset-plugin main.preset-left>.calendars,.container.preset-plugin main.preset-top>.calendars{order:2}.container.preset-plugin main.preset-left>.preset-plugin-container,.container.preset-plugin main.preset-top>.preset-plugin-container{order:1}.container.preset-plugin main.preset-left,.container.preset-plugin main.preset-right{grid-template-columns:auto auto}.container.preset-plugin main.preset-left .preset-plugin-container,.container.preset-plugin main.preset-right .preset-plugin-container{grid-row:span 2;width:130px}.container.preset-plugin main.preset-bottom>.preset-plugin-container{order:4}.container.preset-plugin main.preset-bottom,.container.preset-plugin main.preset-top{grid-template-columns:auto}.container.preset-plugin main>.time-plugin-container{order:3}.container>main:not([class*=preset-]){flex-direction:column}.time-plugin-container{background-color:var(--color-bg-secondary);border-bottom:1px solid var(--color-border-default);display:flex;justify-content:space-around;padding:10px}.time-plugin-container input[type=time]{font-size:18px}.time-plugin-container input[type=time],.time-plugin-container select{background-color:var(--color-bg-default);border:1px solid transparent;border-radius:4px;color:var(--color-fg-default)}.time-plugin-container select{margin:0 3px}.container.amp-plugin .calendars .calendar>.header .month-name{align-items:center;-moz-column-gap:5px;column-gap:5px;display:flex;justify-content:center}.container.amp-plugin .calendars .calendar>.header .month-name select{border:none;font-size:14px;padding:3px}.container.amp-plugin .calendars .calendar>.header .month-name select.month-name--dropdown{font-weight:700}.container.amp-plugin .calendars .calendar>.header .reset-button{order:4}.container.amp-plugin .calendars.calendars:not(.grid-1) .calendar>.header .reset-button{visibility:hidden}.container.amp-plugin .calendars.calendars:not(.grid-1) .calendar:last-child>.header .reset-button{visibility:visible}.container.amp-plugin.week-numbers .calendar>.daynames-row,.container.amp-plugin.week-numbers .calendar>.days-grid{grid-template-columns:30px repeat(7,1fr)}.container.amp-plugin.week-numbers .calendar>.daynames-row .wnum-header,.container.amp-plugin.week-numbers .calendar>.daynames-row .wnum-item,.container.amp-plugin.week-numbers .calendar>.days-grid .wnum-header,.container.amp-plugin.week-numbers .calendar>.days-grid .wnum-item{align-items:center;color:var(--color-fg-muted);display:flex;font-size:12px;justify-content:center}.container[data-theme=dark]{--color-bg-default:#22272e;--color-bg-secondary:#2d333b;--color-bg-inrange:#2c542e;--color-bg-locked:#ec775c;--color-bg-unavailable:#545d68;--color-bg-tooltip:#9e9e9e;--color-fg-default:#adbac7;--color-fg-primary:#46954a;--color-fg-secondary:#202122;--color-fg-muted:#9e9e9e;--color-fg-accent:#ec775c;--color-fg-locked:#9e9e9e;--color-btn-primary-bg:#2d333b;--color-btn-primary-fg:#46954a;--color-btn-primary-border:#46954a;--color-btn-primary-hover-bg:#46954a;--color-btn-primary-hover-fg:#fff;--color-btn-primary-hover-border:#46954a;--color-btn-secondary-bg:#2d333b;--color-btn-secondary-fg:#adbac7;--color-btn-secondary-border:#adbac7;--color-btn-secondary-hover-bg:#adbac7;--color-btn-secondary-hover-fg:#202122;--color-btn-secondary-hover-border:#adbac7;--color-border-default:#373e47;--color-border-locked:#2d333b}
@@ -0,0 +1,10 @@
1
+ import { DateTime } from '@yuafox/easepick2-datetime';
2
+ import { easepick, create } from '@yuafox/easepick2-core';
3
+ import { LockPlugin } from '@yuafox/easepick2-lock-plugin';
4
+ import { PresetPlugin } from '@yuafox/easepick2-preset-plugin';
5
+ import { RangePlugin } from '@yuafox/easepick2-range-plugin';
6
+ import { TimePlugin } from '@yuafox/easepick2-time-plugin';
7
+ import { KbdPlugin } from '@yuafox/easepick2-kbd-plugin';
8
+ import { AmpPlugin } from '@yuafox/easepick2-amp-plugin';
9
+ import './index.scss';
10
+ export { easepick, create, DateTime, LockPlugin, PresetPlugin, RangePlugin, TimePlugin, KbdPlugin, AmpPlugin, };
@@ -0,0 +1 @@
1
+ class e extends Date{static parseDateTime(t,i="YYYY-MM-DD",n="en-US"){if(!t)return new Date((new Date).setHours(0,0,0,0));if(t instanceof e)return t.toJSDate();if(t instanceof Date)return t;if(/^-?\d{10,}$/.test(String(t)))return new Date(Number(t));if("string"==typeof t){const s=[];let a=null;for(;null!=(a=e.regex.exec(i));)"\\"!==a[1]&&s.push(a);if(s.length){const i={year:null,month:null,shortMonth:null,longMonth:null,day:null,hour:0,minute:0,second:0,ampm:null,value:""};s[0].index>0&&(i.value+=".*?");for(const[t,a]of Object.entries(s)){const s=Number(t),{group:o,pattern:r}=e.formatPatterns(a[0],n);i[o]=s+1,i.value+=r,i.value+=".*?"}const a=new RegExp(`^${i.value}$`);if(a.test(t)){const s=a.exec(t),o=Number(s[i.year]);let r=null;i.month?r=Number(s[i.month])-1:i.shortMonth?r=e.shortMonths(n).indexOf(s[i.shortMonth]):i.longMonth&&(r=e.longMonths(n).indexOf(s[i.longMonth]));const c=Number(s[i.day])||1,l=Number(s[i.hour]);let h=Number.isNaN(l)?0:l;const d=Number(s[i.minute]),p=Number.isNaN(d)?0:d,u=Number(s[i.second]),g=Number.isNaN(u)?0:u,m=s[i.ampm];return m&&"PM"===m&&(h+=12,24===h&&(h=0)),new Date(o,r,c,h,p,g,0)}}}return new Date((new Date).setHours(0,0,0,0))}static regex=/(\\)?(Y{2,4}|M{1,4}|D{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|A|a)/g;static MONTH_JS=[0,1,2,3,4,5,6,7,8,9,10,11];static shortMonths(t){return e.MONTH_JS.map((e=>new Date(2019,e).toLocaleString(t,{month:"short"})))}static longMonths(t){return e.MONTH_JS.map((e=>new Date(2019,e).toLocaleString(t,{month:"long"})))}static formatPatterns(t,i){switch(t){case"YY":case"YYYY":return{group:"year",pattern:`(\\d{${t.length}})`};case"M":return{group:"month",pattern:"(\\d{1,2})"};case"MM":return{group:"month",pattern:"(\\d{2})"};case"MMM":return{group:"shortMonth",pattern:`(${e.shortMonths(i).join("|")})`};case"MMMM":return{group:"longMonth",pattern:`(${e.longMonths(i).join("|")})`};case"D":return{group:"day",pattern:"(\\d{1,2})"};case"DD":return{group:"day",pattern:"(\\d{2})"};case"h":case"H":return{group:"hour",pattern:"(\\d{1,2})"};case"hh":case"HH":return{group:"hour",pattern:"(\\d{2})"};case"m":return{group:"minute",pattern:"(\\d{1,2})"};case"mm":return{group:"minute",pattern:"(\\d{2})"};case"s":return{group:"second",pattern:"(\\d{1,2})"};case"ss":return{group:"second",pattern:"(\\d{2})"};case"a":case"A":return{group:"ampm",pattern:"(AM|PM|am|pm)"}}}lang;constructor(t=null,i="YYYY-MM-DD",n="en-US"){super(e.parseDateTime(t,i,n)),this.lang=n}getWeek(e){const t=new Date(this.midnight_ts(this)),i=(this.getDay()+(7-e))%7;t.setDate(t.getDate()-i);const n=t.getTime();return t.setMonth(0,1),t.getDay()!==e&&t.setMonth(0,1+(4-t.getDay()+7)%7),1+Math.ceil((n-t.getTime())/6048e5)}clone(){return new e(this)}toJSDate(){return new Date(this)}inArray(e,t="[]"){return e.some((e=>e instanceof Array?this.isBetween(e[0],e[1],t):this.isSame(e,"day")))}isBetween(e,t,i="()"){switch(i){default:case"()":return this.midnight_ts(this)>this.midnight_ts(e)&&this.midnight_ts(this)<this.midnight_ts(t);case"[)":return this.midnight_ts(this)>=this.midnight_ts(e)&&this.midnight_ts(this)<this.midnight_ts(t);case"(]":return this.midnight_ts(this)>this.midnight_ts(e)&&this.midnight_ts(this)<=this.midnight_ts(t);case"[]":return this.midnight_ts()>=this.midnight_ts(e)&&this.midnight_ts()<=this.midnight_ts(t)}}isBefore(e,t="days"){switch(t){case"day":case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()>new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case"month":case"months":return new Date(e.getFullYear(),e.getMonth(),1).getTime()>new Date(this.getFullYear(),this.getMonth(),1).getTime();case"year":case"years":return e.getFullYear()>this.getFullYear()}throw new Error("isBefore: Invalid unit!")}isSameOrBefore(e,t="days"){switch(t){case"day":case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()>=new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case"month":case"months":return new Date(e.getFullYear(),e.getMonth(),1).getTime()>=new Date(this.getFullYear(),this.getMonth(),1).getTime()}throw new Error("isSameOrBefore: Invalid unit!")}isAfter(e,t="days"){switch(t){case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>new Date(e.getFullYear(),e.getMonth(),1).getTime();case"year":case"years":return this.getFullYear()>e.getFullYear()}throw new Error("isAfter: Invalid unit!")}isSameOrAfter(e,t="days"){switch(t){case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>=new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>=new Date(e.getFullYear(),e.getMonth(),1).getTime()}throw new Error("isSameOrAfter: Invalid unit!")}isSame(e,t="days"){switch(t){case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()===new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()===new Date(e.getFullYear(),e.getMonth(),1).getTime()}throw new Error("isSame: Invalid unit!")}add(e,t="days"){switch(t){case"day":case"days":this.setDate(this.getDate()+e);break;case"month":case"months":this.setMonth(this.getMonth()+e)}return this}subtract(e,t="days"){switch(t){case"day":case"days":this.setDate(this.getDate()-e);break;case"month":case"months":this.setMonth(this.getMonth()-e)}return this}diff(e,t="days"){switch(t){default:case"day":case"days":return Math.round((this.midnight_ts()-this.midnight_ts(e))/864e5);case"month":case"months":let t=12*(e.getFullYear()-this.getFullYear());return t-=e.getMonth(),t+=this.getMonth(),t}}format(t,i="en-US"){let n="";const s=[];let a=null;for(;null!=(a=e.regex.exec(t));)"\\"!==a[1]&&s.push(a);if(s.length){s[0].index>0&&(n+=t.substring(0,s[0].index));for(const[e,a]of Object.entries(s)){const o=Number(e);n+=this.formatTokens(a[0],i),s[o+1]&&(n+=t.substring(a.index+a[0].length,s[o+1].index)),o===s.length-1&&(n+=t.substring(a.index+a[0].length))}}return n.replace(/\\/g,"")}midnight_ts(e){return e?new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0).getTime():new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0,0).getTime()}formatTokens(t,i){switch(t){case"YY":return String(this.getFullYear()).slice(-2);case"YYYY":return String(this.getFullYear());case"M":return String(this.getMonth()+1);case"MM":return`0${this.getMonth()+1}`.slice(-2);case"MMM":return e.shortMonths(i)[this.getMonth()];case"MMMM":return e.longMonths(i)[this.getMonth()];case"D":return String(this.getDate());case"DD":return`0${this.getDate()}`.slice(-2);case"H":return String(this.getHours());case"HH":return`0${this.getHours()}`.slice(-2);case"h":return String(this.getHours()%12||12);case"hh":return`0${this.getHours()%12||12}`.slice(-2);case"m":return String(this.getMinutes());case"mm":return`0${this.getMinutes()}`.slice(-2);case"s":return String(this.getSeconds());case"ss":return`0${this.getSeconds()}`.slice(-2);case"a":return this.getHours()<12||24===this.getHours()?"am":"pm";case"A":return this.getHours()<12||24===this.getHours()?"AM":"PM";default:return""}}}class t{picker;constructor(e){this.picker=e}render(t,i){t||(t=new e),t.setDate(1),t.setHours(0,0,0,0),"function"==typeof this[`get${i}View`]&&this[`get${i}View`](t)}getContainerView(e){this.picker.ui.container.innerHTML="",this.picker.options.header&&this.picker.trigger("render",{date:e.clone(),view:"Header"}),this.picker.trigger("render",{date:e.clone(),view:"Main"}),this.picker.options.autoApply||this.picker.trigger("render",{date:e.clone(),view:"Footer"})}getHeaderView(e){const t=document.createElement("header");this.picker.options.header instanceof HTMLElement&&t.appendChild(this.picker.options.header),"string"==typeof this.picker.options.header&&(t.innerHTML=this.picker.options.header),this.picker.ui.container.appendChild(t),this.picker.trigger("view",{target:t,date:e.clone(),view:"Header"})}getMainView(e){const t=document.createElement("main");this.picker.ui.container.appendChild(t);const i=this.picker.options.viewMode||"day",n=document.createElement("div");if(n.className=`calendars grid-${this.picker.options.grid}`,"month"===i){const t=document.createElement("div");t.className="calendar",n.appendChild(t);const i=this.getCalendarHeaderView(e.clone());t.appendChild(i),this.picker.trigger("view",{date:e.clone(),view:"CalendarHeader",index:0,target:i});const s=this.getCalendarMonthsView(e.clone());t.appendChild(s),this.picker.trigger("view",{date:e.clone(),view:"CalendarMonths",index:0,target:s}),this.picker.trigger("view",{date:e.clone(),view:"CalendarItem",index:0,target:t})}else if("year"===i){const t=document.createElement("div");t.className="calendar",n.appendChild(t);const i=this.getCalendarHeaderView(e.clone());t.appendChild(i),this.picker.trigger("view",{date:e.clone(),view:"CalendarHeader",index:0,target:i});const s=this.getCalendarYearsView(e.clone());t.appendChild(s),this.picker.trigger("view",{date:e.clone(),view:"CalendarYears",index:0,target:s}),this.picker.trigger("view",{date:e.clone(),view:"CalendarItem",index:0,target:t})}else for(let t=0;t<this.picker.options.calendars;t++){const i=document.createElement("div");i.className="calendar",n.appendChild(i);const s=this.getCalendarHeaderView(e.clone());i.appendChild(s),this.picker.trigger("view",{date:e.clone(),view:"CalendarHeader",index:t,target:s});const a=this.getCalendarDayNamesView();i.appendChild(a),this.picker.trigger("view",{date:e.clone(),view:"CalendarDayNames",index:t,target:a});const o=this.getCalendarDaysView(e.clone());i.appendChild(o),this.picker.trigger("view",{date:e.clone(),view:"CalendarDays",index:t,target:o});const r=this.getCalendarFooterView(this.picker.options.lang,e.clone());i.appendChild(r),this.picker.trigger("view",{date:e.clone(),view:"CalendarFooter",index:t,target:r}),this.picker.trigger("view",{date:e.clone(),view:"CalendarItem",index:t,target:i}),e.add(1,"month")}t.appendChild(n),this.picker.trigger("view",{date:e.clone(),view:"Calendars",target:n}),this.picker.trigger("view",{date:e.clone(),view:"Main",target:t})}getFooterView(e){const t=document.createElement("footer"),i=document.createElement("div");i.className="footer-buttons";const n=document.createElement("button");n.className="cancel-button unit",n.innerHTML=this.picker.options.locale.cancel,i.appendChild(n);const s=document.createElement("button");s.className="apply-button unit",s.innerHTML=this.picker.options.locale.apply,s.disabled=!0,i.appendChild(s),t.appendChild(i),this.picker.ui.container.appendChild(t),this.picker.trigger("view",{date:e,target:t,view:"Footer"})}getCalendarHeaderView(e){const t=this.picker.options.viewMode||"day",i=document.createElement("div");i.className="header";const n=document.createElement("div");if(n.className="month-name","month"===t)n.innerHTML=`<span>${e.format("YYYY")}</span>`;else if("year"===t){const t=10*Math.floor(e.getFullYear()/10);n.innerHTML=`<span>${t} - ${t+9}</span>`}else n.innerHTML=`<span>${e.toLocaleString(this.picker.options.lang,{month:"long"})}</span> ${e.format("YYYY")}`;i.appendChild(n);const s=document.createElement("button");s.className="previous-button unit",s.innerHTML=this.picker.options.locale.previousMonth,i.appendChild(s);const a=document.createElement("button");return a.className="next-button unit",a.innerHTML=this.picker.options.locale.nextMonth,i.appendChild(a),i}getCalendarMonthsView(t){const i=document.createElement("div");i.className="months-grid";const n=new e;for(let s=0;s<12;s++){const a=new e(new Date(t.getFullYear(),s,1)),o=document.createElement("div");o.className="month unit",o.innerHTML=a.toLocaleString(this.picker.options.lang,{month:"short"}),o.dataset.time=String(a.getTime()),a.getFullYear()===n.getFullYear()&&s===n.getMonth()&&o.classList.add("today"),this.picker.datePicked.length?this.picker.datePicked[0].isSame(a,"month")&&o.classList.add("selected"):this.picker.options.date&&new e(this.picker.options.date).isSame(a,"month")&&o.classList.add("selected"),i.appendChild(o),this.picker.trigger("view",{date:a,view:"CalendarMonth",target:o})}return i}getCalendarYearsView(t){const i=document.createElement("div");i.className="years-grid";const n=new e,s=10*Math.floor(t.getFullYear()/10);for(let t=s;t<s+12;t++){const a=new e(new Date(t,0,1)),o=document.createElement("div");o.className="year unit",o.innerHTML=String(t),o.dataset.time=String(a.getTime()),t===n.getFullYear()&&o.classList.add("today"),(t<s||t>s+9)&&o.classList.add("outside"),this.picker.datePicked.length?this.picker.datePicked[0].getFullYear()===t&&o.classList.add("selected"):this.picker.options.date&&new e(this.picker.options.date).getFullYear()===t&&o.classList.add("selected"),i.appendChild(o),this.picker.trigger("view",{date:a,view:"CalendarYear",target:o})}return i}getCalendarDayNamesView(){const e=document.createElement("div");e.className="daynames-row";for(let t=1;t<=7;t++){const i=3+this.picker.options.firstDay+t,n=document.createElement("div");n.className="dayname",n.innerHTML=new Date(1970,0,i,12,0,0,0).toLocaleString(this.picker.options.lang,{weekday:"short"}),n.title=new Date(1970,0,i,12,0,0,0).toLocaleString(this.picker.options.lang,{weekday:"long"}),e.appendChild(n),this.picker.trigger("view",{dayIdx:i,view:"CalendarDayName",target:n})}return e}getCalendarDaysView(e){const t=document.createElement("div");t.className="days-grid";const i=this.calcOffsetDays(e,this.picker.options.firstDay),n=32-new Date(e.getFullYear(),e.getMonth(),32).getDate();for(let e=0;e<i;e++){const e=document.createElement("div");e.className="offset",t.appendChild(e)}for(let i=1;i<=n;i++){e.setDate(i);const n=this.getCalendarDayView(e);t.appendChild(n),this.picker.trigger("view",{date:e,view:"CalendarDay",target:n})}return t}getCalendarDayView(t){const i=this.picker.options.date?new e(this.picker.options.date):null,n=new e,s=document.createElement("div");return s.className="day unit",s.innerHTML=t.format("D"),s.dataset.time=String(t.getTime()),t.isSame(n,"day")&&s.classList.add("today"),[0,6].includes(t.getDay())&&s.classList.add("weekend"),this.picker.datePicked.length?this.picker.datePicked[0].isSame(t,"day")&&s.classList.add("selected"):i&&t.isSame(i,"day")&&s.classList.add("selected"),this.picker.trigger("view",{date:t,view:"CalendarDay",target:s}),s}getCalendarFooterView(e,t){const i=document.createElement("div");return i.className="footer",i}calcOffsetDays(e,t){let i=e.getDay()-t;return i<0&&(i+=7),i}}class i{picker;instances={};constructor(e){this.picker=e}initialize(){const e=[];this.picker.options.plugins.forEach((t=>{"function"==typeof t?e.push(new t):"string"==typeof t&&"undefined"!=typeof easepick&&Object.prototype.hasOwnProperty.call(easepick,t)?e.push(new easepick[t]):console.warn(`easepick: ${t} not found.`)})),e.sort(((e,t)=>e.priority>t.priority?-1:e.priority<t.priority||e.dependencies.length>t.dependencies.length?1:e.dependencies.length<t.dependencies.length?-1:0)),e.forEach((e=>{e.attach(this.picker),this.instances[e.getName()]=e}))}getInstance(e){return this.instances[e]}addInstance(e){if(Object.prototype.hasOwnProperty.call(this.instances,e))console.warn(`easepick: ${e} already added.`);else{if("undefined"!=typeof easepick&&Object.prototype.hasOwnProperty.call(easepick,e)){const t=new easepick[e];return t.attach(this.picker),this.instances[t.getName()]=t,t}if("undefined"!==this.getPluginFn(e)){const t=new(this.getPluginFn(e));return t.attach(this.picker),this.instances[t.getName()]=t,t}console.warn(`easepick: ${e} not found.`)}return null}removeInstance(e){return e in this.instances&&this.instances[e].detach(),delete this.instances[e]}reloadInstance(e){return this.removeInstance(e),this.addInstance(e)}getPluginFn(e){return[...this.picker.options.plugins].filter((t=>"function"==typeof t&&(new t).getName()===e)).shift()}}class n{Calendar=new t(this);PluginManager=new i(this);calendars=[];datePicked=[];cssLoaded=0;binds={hidePicker:this.hidePicker.bind(this),show:this.show.bind(this)};options={doc:document,css:[],element:null,firstDay:1,grid:1,calendars:1,lang:"en-US",date:null,format:"YYYY-MM-DD",readonly:!0,autoApply:!0,header:!1,inline:!1,viewMode:"day",scrollToDate:!0,locale:{nextMonth:'<svg width="11" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.748 16L0 13.333 5.333 8 0 2.667 2.748 0l7.919 8z" fill-rule="nonzero"/></svg>',previousMonth:'<svg width="11" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M7.919 0l2.748 2.667L5.333 8l5.334 5.333L7.919 16 0 8z" fill-rule="nonzero"/></svg>',cancel:"Cancel",apply:"Apply"},documentClick:this.binds.hidePicker,plugins:[]};ui={container:null,shadowRoot:null,wrapper:null};version="2.0.0";constructor(e){const t={...this.options.locale,...e.locale};this.options={...this.options,...e},this.options.locale=t,this.handleOptions(),this.ui.wrapper=document.createElement("span"),this.ui.wrapper.style.display="none",this.ui.wrapper.style.position="absolute",this.ui.wrapper.style.pointerEvents="none",this.ui.wrapper.className="easepick-wrapper",this.ui.wrapper.attachShadow({mode:"open"}),this.ui.shadowRoot=this.ui.wrapper.shadowRoot,this.ui.container=document.createElement("div"),this.ui.container.className="container",this.options.zIndex&&(this.ui.container.style.zIndex=String(this.options.zIndex)),this.options.inline&&(this.ui.wrapper.style.position="relative",this.ui.container.classList.add("inline")),this.ui.shadowRoot.appendChild(this.ui.container),this.options.element.after(this.ui.wrapper),this.handleCSS(),this.options.element.addEventListener("click",this.binds.show),this.on("view",this.onView.bind(this)),this.on("render",this.onRender.bind(this)),this.PluginManager.initialize(),this.parseValues(),"function"==typeof this.options.setup&&this.options.setup(this),this.on("click",this.onClick.bind(this));const i=this.options.scrollToDate?this.getDate():null;this.renderAll(i)}on(e,t,i={}){this.ui.container.addEventListener(e,t,i)}off(e,t,i={}){this.ui.container.removeEventListener(e,t,i)}trigger(e,t={}){return this.ui.container.dispatchEvent(new CustomEvent(e,{detail:t}))}destroy(){this.options.element.removeEventListener("click",this.binds.show),"function"==typeof this.options.documentClick&&document.removeEventListener("click",this.options.documentClick,!0),Object.keys(this.PluginManager.instances).forEach((e=>{this.PluginManager.removeInstance(e)})),this.ui.wrapper.remove()}onRender(e){const{view:t,date:i}=e.detail;this.Calendar.render(i,t)}onView(e){const{view:t,target:i}=e.detail;"Footer"===t&&this.datePicked.length&&(i.querySelector(".apply-button").disabled=!1)}onClickHeaderButton(e){if(this.isCalendarHeaderButton(e)){const t=this.options.viewMode||"day",i=e.classList.contains("next-button");"year"===t?i?this.calendars[0].setFullYear(this.calendars[0].getFullYear()+10):this.calendars[0].setFullYear(this.calendars[0].getFullYear()-10):"month"===t?i?this.calendars[0].setFullYear(this.calendars[0].getFullYear()+1):this.calendars[0].setFullYear(this.calendars[0].getFullYear()-1):i?this.calendars[0].add(1,"month"):this.calendars[0].subtract(1,"month"),this.renderAll(this.calendars[0])}}onClickCalendarDay(t){if(this.isCalendarDay(t)){const i=new e(t.dataset.time);this.options.autoApply?(this.setDate(i),this.trigger("select",{date:this.getDate()}),this.hide()):(this.datePicked[0]=i,this.trigger("preselect",{date:this.getDate()}),this.renderAll())}}onClickCalendarMonth(t){if(this.isCalendarMonth(t)){const i=new e(t.dataset.time);this.options.autoApply?(this.setDate(i),this.trigger("select",{date:this.getDate()}),this.hide()):(this.datePicked[0]=i,this.trigger("preselect",{date:this.getDate()}),this.renderAll())}}onClickCalendarYear(t){if(this.isCalendarYear(t)){const i=new e(t.dataset.time);this.options.autoApply?(this.setDate(i),this.trigger("select",{date:this.getDate()}),this.hide()):(this.datePicked[0]=i,this.trigger("preselect",{date:this.getDate()}),this.renderAll())}}onClickApplyButton(e){if(this.isApplyButton(e)){if(this.datePicked[0]instanceof Date){const e=this.datePicked[0].clone();this.setDate(e)}this.hide(),this.trigger("select",{date:this.getDate()})}}onClickCancelButton(e){this.isCancelButton(e)&&this.hide()}onClick(e){const t=e.target;if(t instanceof HTMLElement){const e=t.closest(".unit");if(!(e instanceof HTMLElement))return;this.onClickHeaderButton(e),this.onClickCalendarDay(e),this.onClickCalendarMonth(e),this.onClickCalendarYear(e),this.onClickApplyButton(e),this.onClickCancelButton(e)}}isShown(){return this.ui.container.classList.contains("inline")||this.ui.container.classList.contains("show")}show(e){if(this.isShown())return;const t=e&&"target"in e?e.target:this.options.element,{top:i,left:n}=this.adjustPosition(t);this.ui.container.style.top=`${i}px`,this.ui.container.style.left=`${n}px`,this.ui.container.classList.add("show"),this.trigger("show",{target:t})}hide(){this.ui.container.classList.remove("show"),this.datePicked.length=0,this.renderAll(),this.trigger("hide")}setDate(t){const i=new e(t,this.options.format);this.options.date=i.clone(),this.updateValues(),this.calendars.length&&this.renderAll()}getDate(){return this.options.date instanceof e?this.options.date.clone():null}parseValues(){this.options.date?this.setDate(this.options.date):this.options.element instanceof HTMLInputElement&&this.options.element.value.length&&this.setDate(this.options.element.value),this.options.date instanceof Date||(this.options.date=null)}updateValues(){const e=this.getDate(),t=e instanceof Date?e.format(this.options.format,this.options.lang):"",i=this.options.element;i instanceof HTMLInputElement?i.value=t:i instanceof HTMLElement&&(i.innerText=t)}hidePicker(e){let t=e.target,i=null;t.shadowRoot&&(t=e.composedPath()[0],i=t.getRootNode().host),this.isShown()&&!1===this.options.inline&&i!==this.ui.wrapper&&t!==this.options.element&&this.hide()}renderAll(e){this.trigger("render",{view:"Container",date:(e||this.calendars[0]).clone()})}isCalendarHeaderButton(e){return["previous-button","next-button"].some((t=>e.classList.contains(t)))}isCalendarDay(e){return e.classList.contains("day")}isCalendarMonth(e){return e.classList.contains("month")}isCalendarYear(e){return e.classList.contains("year")}isApplyButton(e){return e.classList.contains("apply-button")}isCancelButton(e){return e.classList.contains("cancel-button")}gotoDate(t){const i=new e(t,this.options.format);i.setDate(1),this.calendars[0]=i.clone(),this.renderAll()}clear(){this.options.date=null,this.datePicked.length=0,this.updateValues(),this.renderAll(),this.trigger("clear")}handleOptions(){this.options.element instanceof HTMLElement||(this.options.element=this.options.doc.querySelector(this.options.element)),"function"==typeof this.options.documentClick&&document.addEventListener("click",this.options.documentClick,!0),this.options.element instanceof HTMLInputElement&&(this.options.element.readOnly=this.options.readonly),this.options.date?this.calendars[0]=new e(this.options.date,this.options.format):this.calendars[0]=new e}handleCSS(){if(Array.isArray(this.options.css))this.options.css.forEach((e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet";const i=()=>{this.cssLoaded++,this.cssLoaded===this.options.css.length&&(this.ui.wrapper.style.display="")};t.addEventListener("load",i),t.addEventListener("error",i),this.ui.shadowRoot.append(t)}));else if("string"==typeof this.options.css){const e=document.createElement("style"),t=document.createTextNode(this.options.css);e.appendChild(t),this.ui.shadowRoot.append(e),this.ui.wrapper.style.display=""}else"function"==typeof this.options.css&&(this.options.css.call(this,this),this.ui.wrapper.style.display="")}adjustPosition(e){const t=e.getBoundingClientRect(),i=this.ui.wrapper.getBoundingClientRect();this.ui.container.classList.add("calc");const n=this.ui.container.getBoundingClientRect();this.ui.container.classList.remove("calc");let s=t.bottom-i.bottom,a=t.left-i.left;return"undefined"!=typeof window&&(window.innerHeight<s+n.height&&s-n.height>=0&&(s=t.top-i.top-n.height),window.innerWidth<a+n.width&&t.right-n.width>=0&&(a=t.right-i.right-n.width)),{left:a,top:s}}}var s=Object.freeze({__proto__:null,Core:n,create:n});class a{picker;options;priority=0;dependencies=[];attach(e){const t=this.getName(),i={...this.options};this.options={...this.options,...e.options[t]||{}};for(const n of Object.keys(i))if(null!==i[n]&&"object"==typeof i[n]&&Object.keys(i[n]).length&&t in e.options&&n in e.options[t]){const s={...e.options[t][n]};null!==s&&"object"==typeof s&&Object.keys(s).length&&Object.keys(s).every((e=>Object.keys(i[n]).includes(e)))&&(this.options[n]={...i[n],...s})}if(this.picker=e,this.dependenciesNotFound()){const e=this.dependencies.filter((e=>!this.pluginsAsStringArray().includes(e)));return void console.warn(`${this.getName()}: required dependencies (${e.join(", ")}).`)}const n=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.add(n),this.onAttach()}detach(){const e=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.remove(e),"function"==typeof this.onDetach&&this.onDetach()}dependenciesNotFound(){return this.dependencies.length&&!this.dependencies.every((e=>this.pluginsAsStringArray().includes(e)))}pluginsAsStringArray(){return this.picker.options.plugins.map((e=>"function"==typeof e?(new e).getName():e))}camelCaseToKebab(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}}class o extends a{priority=1;binds={onView:this.onView.bind(this)};options={minDate:null,maxDate:null,minDays:null,maxDays:null,selectForward:null,selectBackward:null,presets:!0,inseparable:!1,filter:null};getName(){return"LockPlugin"}onAttach(){if(this.options.minDate&&(this.options.minDate=new e(this.options.minDate,this.picker.options.format,this.picker.options.lang)),this.options.maxDate&&(this.options.maxDate=new e(this.options.maxDate,this.picker.options.format,this.picker.options.lang),this.options.maxDate instanceof e&&this.picker.options.calendars>1&&this.picker.calendars[0].isSame(this.options.maxDate,"month"))){const e=this.picker.calendars[0].clone().subtract(1,"month");this.picker.gotoDate(e)}if((this.options.minDays||this.options.maxDays||this.options.selectForward||this.options.selectBackward)&&!this.picker.options.plugins.includes("RangePlugin")){const e=["minDays","maxDays","selectForward","selectBackward"];console.warn(`${this.getName()}: options ${e.join(", ")} required RangePlugin.`)}this.picker.on("view",this.binds.onView)}onDetach(){this.picker.off("view",this.binds.onView)}onView(t){const{view:i,target:n,date:s}=t.detail;if("CalendarHeader"===i&&(this.options.minDate instanceof e&&s.isSameOrBefore(this.options.minDate,"month")&&n.classList.add("no-previous-month"),this.options.maxDate instanceof e&&s.isSameOrAfter(this.options.maxDate,"month")&&n.classList.add("no-next-month")),"CalendarMonth"===i){if(this.options.minDate instanceof e){const t=new e(new Date(this.options.minDate.getFullYear(),this.options.minDate.getMonth(),1));s.getTime()<t.getTime()&&n.classList.add("locked")}if(this.options.maxDate instanceof e){const t=new e(new Date(this.options.maxDate.getFullYear(),this.options.maxDate.getMonth(),1));s.getTime()>t.getTime()&&n.classList.add("locked")}}if("CalendarYear"===i&&(this.options.minDate instanceof e&&s.getFullYear()<this.options.minDate.getFullYear()&&n.classList.add("locked"),this.options.maxDate instanceof e&&s.getFullYear()>this.options.maxDate.getFullYear()&&n.classList.add("locked")),"CalendarDay"===i){const e=this.picker.datePicked.length?this.picker.datePicked[0]:null;if(this.testFilter(s))return void n.classList.add("locked");if(this.options.inseparable){if(this.options.minDays){const e=s.clone().subtract(this.options.minDays-1,"day"),t=s.clone().add(this.options.minDays-1,"day");let i=!1,a=!1;for(;e.isBefore(s,"day");){if(this.testFilter(e)){i=!0;break}e.add(1,"day")}for(;t.isAfter(s,"day");){if(this.testFilter(t)){a=!0;break}t.subtract(1,"day")}i&&a&&n.classList.add("not-available")}this.rangeIsNotAvailable(s,e)&&n.classList.add("not-available")}this.dateIsNotAvailable(s,e)&&n.classList.add("not-available")}if(this.options.presets&&"PresetPluginButton"===i){const t=new e(Number(n.dataset.start)),i=new e(Number(n.dataset.end)),s=i.diff(t,"day"),a=this.options.minDays&&s<this.options.minDays,o=this.options.maxDays&&s>this.options.maxDays;(a||o||this.lockMinDate(t)||this.lockMaxDate(t)||this.lockMinDate(i)||this.lockMaxDate(i)||this.rangeIsNotAvailable(t,i))&&n.setAttribute("disabled","disabled")}}dateIsNotAvailable(e,t){return this.lockMinDate(e)||this.lockMaxDate(e)||this.lockMinDays(e,t)||this.lockMaxDays(e,t)||this.lockSelectForward(e)||this.lockSelectBackward(e)}rangeIsNotAvailable(e,t){if(!e||!t)return!1;const i=(e.isSameOrBefore(t,"day")?e:t).clone(),n=(t.isSameOrAfter(e,"day")?t:e).clone();for(;i.isSameOrBefore(n,"day");){if(this.testFilter(i))return!0;i.add(1,"day")}return!1}lockMinDate(t){return this.options.minDate instanceof e&&t.isBefore(this.options.minDate,"day")}lockMaxDate(t){return this.options.maxDate instanceof e&&t.isAfter(this.options.maxDate,"day")}lockMinDays(e,t){if(this.options.minDays&&t){const i=t.clone().subtract(this.options.minDays-1,"day"),n=t.clone().add(this.options.minDays-1,"day");return e.isBetween(i,n)}return!1}lockMaxDays(e,t){if(this.options.maxDays&&t){const i=t.clone().subtract(this.options.maxDays,"day"),n=t.clone().add(this.options.maxDays,"day");return!e.isBetween(i,n)}return!1}lockSelectForward(e){if(1===this.picker.datePicked.length&&this.options.selectForward){const t=this.picker.datePicked[0].clone();return e.isBefore(t,"day")}return!1}lockSelectBackward(e){if(1===this.picker.datePicked.length&&this.options.selectBackward){const t=this.picker.datePicked[0].clone();return e.isAfter(t,"day")}return!1}testFilter(e){return"function"==typeof this.options.filter&&this.options.filter(e,this.picker.datePicked)}}class r extends a{dependencies=["RangePlugin"];binds={onView:this.onView.bind(this),onClick:this.onClick.bind(this)};options={customLabels:["Today","Yesterday","Last 7 Days","Last 30 Days","This Month","Last Month"],customPreset:{},position:"left"};getName(){return"PresetPlugin"}onAttach(){if(!Object.keys(this.options.customPreset).length){const t=new e,i=()=>{const i=t.clone();i.setDate(1);const n=new Date(t.getFullYear(),t.getMonth()+1,0);return[new e(i),new e(n)]},n=()=>{const i=t.clone();i.setMonth(i.getMonth()-1),i.setDate(1);const n=new Date(t.getFullYear(),t.getMonth(),0);return[new e(i),new e(n)]},s=[[t.clone(),t.clone()],[t.clone().subtract(1,"day"),t.clone().subtract(1,"day")],[t.clone().subtract(6,"day"),t.clone()],[t.clone().subtract(29,"day"),t.clone()],i(),n()];Object.values(this.options.customLabels).forEach(((e,t)=>{this.options.customPreset[e]=s[t]}))}this.picker.on("view",this.binds.onView),this.picker.on("click",this.binds.onClick)}onDetach(){this.picker.off("view",this.binds.onView),this.picker.off("click",this.binds.onClick)}onView(e){const{view:t,target:i}=e.detail;if("Main"===t){const e=document.createElement("div");e.className="preset-plugin-container",Object.keys(this.options.customPreset).forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.options.customPreset,t)){const i=this.options.customPreset[t],n=document.createElement("button");n.className="preset-button unit",n.innerHTML=t,n.dataset.start=i[0].getTime(),n.dataset.end=i[1].getTime(),e.appendChild(n),this.picker.trigger("view",{view:"PresetPluginButton",target:n})}})),i.appendChild(e),i.classList.add(`preset-${this.options.position}`),this.picker.trigger("view",{view:"PresetPluginContainer",target:e})}}onClick(t){const i=t.target;if(i instanceof HTMLElement){const t=i.closest(".unit");if(!(t instanceof HTMLElement))return;if(this.isPresetButton(t)){const i=new e(Number(t.dataset.start)),n=new e(Number(t.dataset.end));this.picker.options.autoApply?(this.picker.setDateRange(i,n),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide()):(this.picker.datePicked=[i,n],this.picker.renderAll())}}}isPresetButton(e){return e.classList.contains("preset-button")}}class c extends a{tooltipElement;triggerElement;binds={setStartDate:this.setStartDate.bind(this),setEndDate:this.setEndDate.bind(this),setDateRange:this.setDateRange.bind(this),getStartDate:this.getStartDate.bind(this),getEndDate:this.getEndDate.bind(this),onView:this.onView.bind(this),onShow:this.onShow.bind(this),onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),onClickCalendarDay:this.onClickCalendarDay.bind(this),onClickCalendarMonth:this.onClickCalendarMonth.bind(this),onClickCalendarYear:this.onClickCalendarYear.bind(this),onClickApplyButton:this.onClickApplyButton.bind(this),parseValues:this.parseValues.bind(this),updateValues:this.updateValues.bind(this),clear:this.clear.bind(this)};options={elementEnd:null,startDate:null,endDate:null,repick:!1,strict:!0,delimiter:" - ",tooltip:!0,tooltipNumber:e=>e,locale:{zero:"",one:"day",two:"",few:"",many:"",other:"days"},documentClick:this.hidePicker.bind(this)};getName(){return"RangePlugin"}onAttach(){this.binds._setStartDate=this.picker.setStartDate,this.binds._setEndDate=this.picker.setEndDate,this.binds._setDateRange=this.picker.setDateRange,this.binds._getStartDate=this.picker.getStartDate,this.binds._getEndDate=this.picker.getEndDate,this.binds._parseValues=this.picker.parseValues,this.binds._updateValues=this.picker.updateValues,this.binds._clear=this.picker.clear,this.binds._onClickCalendarDay=this.picker.onClickCalendarDay,this.binds._onClickApplyButton=this.picker.onClickApplyButton,this.binds._onClickCalendarMonth=this.picker.onClickCalendarMonth,this.binds._onClickCalendarYear=this.picker.onClickCalendarYear,Object.defineProperties(this.picker,{setStartDate:{configurable:!0,value:this.binds.setStartDate},setEndDate:{configurable:!0,value:this.binds.setEndDate},setDateRange:{configurable:!0,value:this.binds.setDateRange},getStartDate:{configurable:!0,value:this.binds.getStartDate},getEndDate:{configurable:!0,value:this.binds.getEndDate},parseValues:{configurable:!0,value:this.binds.parseValues},updateValues:{configurable:!0,value:this.binds.updateValues},clear:{configurable:!0,value:this.binds.clear},onClickCalendarDay:{configurable:!0,value:this.binds.onClickCalendarDay},onClickCalendarMonth:{configurable:!0,value:this.binds.onClickCalendarMonth},onClickCalendarYear:{configurable:!0,value:this.binds.onClickCalendarYear},onClickApplyButton:{configurable:!0,value:this.binds.onClickApplyButton}}),this.options.elementEnd&&(this.options.elementEnd instanceof HTMLElement||(this.options.elementEnd=this.picker.options.doc.querySelector(this.options.elementEnd)),this.options.elementEnd instanceof HTMLInputElement&&(this.options.elementEnd.readOnly=this.picker.options.readonly),"function"==typeof this.picker.options.documentClick&&(document.removeEventListener("click",this.picker.options.documentClick,!0),"function"==typeof this.options.documentClick&&document.addEventListener("click",this.options.documentClick,!0)),this.options.elementEnd.addEventListener("click",this.picker.show.bind(this.picker))),this.options.repick=this.options.repick&&this.options.elementEnd instanceof HTMLElement,this.picker.options.date=null,this.picker.on("view",this.binds.onView),this.picker.on("show",this.binds.onShow),this.picker.on("mouseenter",this.binds.onMouseEnter,!0),this.picker.on("mouseleave",this.binds.onMouseLeave,!0),this.checkIntlPluralLocales()}onDetach(){Object.defineProperties(this.picker,{setStartDate:{configurable:!0,value:this.binds._setStartDate},setEndDate:{configurable:!0,value:this.binds._setEndDate},setDateRange:{configurable:!0,value:this.binds._setDateRange},getStartDate:{configurable:!0,value:this.binds._getStartDate},getEndDate:{configurable:!0,value:this.binds._getEndDate},parseValues:{configurable:!0,value:this.binds._parseValues},updateValues:{configurable:!0,value:this.binds._updateValues},clear:{configurable:!0,value:this.binds._clear},onClickCalendarDay:{configurable:!0,value:this.binds._onClickCalendarDay},onClickCalendarMonth:{configurable:!0,value:this.binds._onClickCalendarMonth},onClickCalendarYear:{configurable:!0,value:this.binds._onClickCalendarYear},onClickApplyButton:{configurable:!0,value:this.binds._onClickApplyButton}}),this.picker.off("view",this.binds.onView),this.picker.off("show",this.binds.onShow),this.picker.off("mouseenter",this.binds.onMouseEnter,!0),this.picker.off("mouseleave",this.binds.onMouseLeave,!0)}parseValues(){if(this.options.startDate||this.options.endDate)this.options.strict?this.options.startDate&&this.options.endDate?this.setDateRange(this.options.startDate,this.options.endDate):(this.options.startDate=null,this.options.endDate=null):(this.options.startDate&&this.setStartDate(this.options.startDate),this.options.endDate&&this.setEndDate(this.options.endDate));else if(this.options.elementEnd)this.options.strict?this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length&&this.options.elementEnd instanceof HTMLInputElement&&this.options.elementEnd.value.length&&this.setDateRange(this.picker.options.element.value,this.options.elementEnd.value):(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length&&this.setStartDate(this.picker.options.element.value),this.options.elementEnd instanceof HTMLInputElement&&this.options.elementEnd.value.length&&this.setEndDate(this.options.elementEnd.value));else if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const[e,t]=this.picker.options.element.value.split(this.options.delimiter);this.options.strict?e&&t&&this.setDateRange(e,t):(e&&this.setStartDate(e),t&&this.setEndDate(t))}}updateValues(){const e=this.picker.options.element,t=this.options.elementEnd,i=this.picker.getStartDate(),n=this.picker.getEndDate(),s=i instanceof Date?i.format(this.picker.options.format,this.picker.options.lang):"",a=n instanceof Date?n.format(this.picker.options.format,this.picker.options.lang):"";if(t)e instanceof HTMLInputElement?e.value=s:e instanceof HTMLElement&&(e.innerText=s),t instanceof HTMLInputElement?t.value=a:t instanceof HTMLElement&&(t.innerText=a);else{const t=`${s}${s||a?this.options.delimiter:""}${a}`;e instanceof HTMLInputElement?e.value=t:e instanceof HTMLElement&&(e.innerText=t)}}clear(){this.options.startDate=null,this.options.endDate=null,this.picker.datePicked.length=0,this.updateValues(),this.picker.renderAll(),this.picker.trigger("clear")}onShow(e){const{target:t}=e.detail;this.triggerElement=t,this.picker.options.scrollToDate&&this.getStartDate()instanceof Date&&this.picker.gotoDate(this.getStartDate()),this.initializeRepick()}onView(t){const{view:i,target:n}=t.detail;if("Main"===i&&(this.tooltipElement=document.createElement("span"),this.tooltipElement.className="range-plugin-tooltip",n.appendChild(this.tooltipElement)),"CalendarDay"===i){const t=new e(n.dataset.time),i=this.picker.datePicked,s=i.length?this.picker.datePicked[0]:this.getStartDate(),a=i.length?this.picker.datePicked[1]:this.getEndDate();s&&s.isSame(t,"day")&&n.classList.add("start"),s&&a&&(a.isSame(t,"day")&&n.classList.add("end"),t.isBetween(s,a)&&n.classList.add("in-range"))}if("CalendarMonth"===i){const t=new e(n.dataset.time),i=this.picker.datePicked,s=i.length?this.picker.datePicked[0]:this.getStartDate(),a=1===i.length?null:i.length>=2?this.picker.datePicked[1]:this.getEndDate();if(s&&s.isSame(t,"month")&&(n.classList.add("start"),n.classList.add("selected")),s&&a){a.isSame(t,"month")&&(n.classList.add("end"),n.classList.add("selected"));const i=new e(new Date(s.getFullYear(),s.getMonth(),1)),o=new e(new Date(a.getFullYear(),a.getMonth(),1));t.getTime()>i.getTime()&&t.getTime()<o.getTime()&&n.classList.add("in-range")}}if("CalendarYear"===i){const t=new e(n.dataset.time),i=this.picker.datePicked,s=i.length?this.picker.datePicked[0]:this.getStartDate(),a=1===i.length?null:i.length>=2?this.picker.datePicked[1]:this.getEndDate();s&&t.getFullYear()===s.getFullYear()&&(n.classList.add("start"),n.classList.add("selected")),s&&a&&(t.getFullYear()===a.getFullYear()&&(n.classList.add("end"),n.classList.add("selected")),t.getFullYear()>s.getFullYear()&&t.getFullYear()<a.getFullYear()&&n.classList.add("in-range"))}if("Footer"===i){const e=1===this.picker.datePicked.length&&!this.options.strict||2===this.picker.datePicked.length;n.querySelector(".apply-button").disabled=!e}}hidePicker(e){let t=e.target,i=null;t.shadowRoot&&(t=e.composedPath()[0],i=t.getRootNode().host),this.picker.isShown()&&i!==this.picker.ui.wrapper&&t!==this.picker.options.element&&t!==this.options.elementEnd&&this.picker.hide()}setStartDate(t){const i=new e(t,this.picker.options.format);this.options.startDate=i?i.clone():null,this.updateValues(),this.picker.renderAll()}setEndDate(t){const i=new e(t,this.picker.options.format);this.options.endDate=i?i.clone():null,this.updateValues(),this.picker.renderAll()}setDateRange(t,i){const n=new e(t,this.picker.options.format),s=new e(i,this.picker.options.format);this.options.startDate=n?n.clone():null,this.options.endDate=s?s.clone():null,this.updateValues(),this.picker.renderAll()}getStartDate(){return this.options.startDate instanceof Date?this.options.startDate.clone():null}getEndDate(){return this.options.endDate instanceof Date?this.options.endDate.clone():null}onMouseEnter(t){const i=t.target;if(i instanceof HTMLElement){this.isContainer(i)&&this.initializeRepick();const t=i.closest(".unit");if(!(t instanceof HTMLElement))return;if(this.picker.isCalendarDay(t)){if(1!==this.picker.datePicked.length)return;let i=this.picker.datePicked[0].clone(),n=new e(t.dataset.time),s=!1;if(i.isAfter(n,"day")){const e=i.clone();i=n.clone(),n=e.clone(),s=!0}if([...this.picker.ui.container.querySelectorAll(".day")].forEach((a=>{const o=new e(a.dataset.time),r=this.picker.Calendar.getCalendarDayView(o);o.isBetween(i,n)&&r.classList.add("in-range"),o.isSame(this.picker.datePicked[0],"day")&&(r.classList.add("start"),r.classList.toggle("flipped",s)),a===t&&(r.classList.add("end"),r.classList.toggle("flipped",s)),a.className=r.className})),this.options.tooltip){const e=this.options.tooltipNumber(n.diff(i,"day")+1);if(e>0){const i=new Intl.PluralRules(this.picker.options.lang).select(e),n=`${e} ${this.options.locale[i]}`;this.showTooltip(t,n)}else this.hideTooltip()}}}}onMouseLeave(e){if(this.isContainer(e.target)&&this.options.repick){const e=this.getStartDate(),t=this.getEndDate();e&&t&&(this.picker.datePicked.length=0,this.picker.renderAll())}}onClickCalendarDay(t){if(this.picker.isCalendarDay(t)){2===this.picker.datePicked.length&&(this.picker.datePicked.length=0);const i=new e(t.dataset.time);if(this.picker.datePicked[this.picker.datePicked.length]=i,2===this.picker.datePicked.length&&this.picker.datePicked[0].isAfter(this.picker.datePicked[1])){const e=this.picker.datePicked[1].clone();this.picker.datePicked[1]=this.picker.datePicked[0].clone(),this.picker.datePicked[0]=e.clone()}1!==this.picker.datePicked.length&&this.picker.options.autoApply||this.picker.trigger("preselect",{start:this.picker.datePicked[0]instanceof Date?this.picker.datePicked[0].clone():null,end:this.picker.datePicked[1]instanceof Date?this.picker.datePicked[1].clone():null}),1===this.picker.datePicked.length&&(!this.options.strict&&this.picker.options.autoApply&&(this.picker.options.element===this.triggerElement&&this.setStartDate(this.picker.datePicked[0]),this.options.elementEnd===this.triggerElement&&this.setEndDate(this.picker.datePicked[0]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()})),this.picker.renderAll()),2===this.picker.datePicked.length&&(this.picker.options.autoApply?(this.setDateRange(this.picker.datePicked[0],this.picker.datePicked[1]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide()):(this.hideTooltip(),this.picker.renderAll()))}}onClickCalendarMonth(e){this.picker.isCalendarMonth(e)&&this.handleRangeClick(e,"month")}onClickCalendarYear(e){this.picker.isCalendarYear(e)&&this.handleRangeClick(e,"year")}handleRangeClick(t,i){2===this.picker.datePicked.length&&(this.picker.datePicked.length=0);const n=new e(t.dataset.time);if(this.picker.datePicked[this.picker.datePicked.length]=n,2===this.picker.datePicked.length&&this.picker.datePicked[0].isAfter(this.picker.datePicked[1],i)){const e=this.picker.datePicked[1].clone();this.picker.datePicked[1]=this.picker.datePicked[0].clone(),this.picker.datePicked[0]=e.clone()}1!==this.picker.datePicked.length&&this.picker.options.autoApply||this.picker.trigger("preselect",{start:this.picker.datePicked[0]instanceof Date?this.picker.datePicked[0].clone():null,end:this.picker.datePicked[1]instanceof Date?this.picker.datePicked[1].clone():null}),1===this.picker.datePicked.length&&this.picker.renderAll(),2===this.picker.datePicked.length&&(this.picker.options.autoApply?(this.setDateRange(this.picker.datePicked[0],this.picker.datePicked[1]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide()):this.picker.renderAll())}onClickApplyButton(e){this.picker.isApplyButton(e)&&(1!==this.picker.datePicked.length||this.options.strict||(this.picker.options.element===this.triggerElement&&(this.options.endDate=null,this.setStartDate(this.picker.datePicked[0])),this.options.elementEnd===this.triggerElement&&(this.options.startDate=null,this.setEndDate(this.picker.datePicked[0]))),2===this.picker.datePicked.length&&this.setDateRange(this.picker.datePicked[0],this.picker.datePicked[1]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide())}showTooltip(e,t){this.tooltipElement.style.visibility="visible",this.tooltipElement.innerHTML=t;const i=this.picker.ui.container.getBoundingClientRect(),n=this.tooltipElement.getBoundingClientRect(),s=e.getBoundingClientRect();let a=s.top,o=s.left;a-=i.top,o-=i.left,a-=n.height,o-=n.width/2,o+=s.width/2,this.tooltipElement.style.top=`${a}px`,this.tooltipElement.style.left=`${o}px`}hideTooltip(){this.tooltipElement.style.visibility="hidden"}checkIntlPluralLocales(){if(!this.options.tooltip)return;const e=[...new Set([new Intl.PluralRules(this.picker.options.lang).select(0),new Intl.PluralRules(this.picker.options.lang).select(1),new Intl.PluralRules(this.picker.options.lang).select(2),new Intl.PluralRules(this.picker.options.lang).select(6),new Intl.PluralRules(this.picker.options.lang).select(18)])],t=Object.keys(this.options.locale);e.every((e=>t.includes(e)))||console.warn(`${this.getName()}: provide locales (${e.join(", ")}) for correct tooltip text.`)}initializeRepick(){if(!this.options.repick)return;const e=this.getStartDate(),t=this.getEndDate();t&&this.triggerElement===this.picker.options.element&&(this.picker.datePicked[0]=t),e&&this.triggerElement===this.options.elementEnd&&(this.picker.datePicked[0]=e)}isContainer(e){return e===this.picker.ui.container}}class l extends a{options={native:!1,seconds:!1,stepHours:1,stepMinutes:5,stepSeconds:5,format12:!1};rangePlugin;timePicked={input:null,start:null,end:null};timePrePicked={input:null,start:null,end:null};binds={getDate:this.getDate.bind(this),getStartDate:this.getStartDate.bind(this),getEndDate:this.getEndDate.bind(this),onView:this.onView.bind(this),onInput:this.onInput.bind(this),onChange:this.onChange.bind(this),onClick:this.onClick.bind(this),setTime:this.setTime.bind(this),setStartTime:this.setStartTime.bind(this),setEndTime:this.setEndTime.bind(this)};getName(){return"TimePlugin"}onAttach(){this.binds._getDate=this.picker.getDate,this.binds._getStartDate=this.picker.getStartDate,this.binds._getEndDate=this.picker.getEndDate,Object.defineProperties(this.picker,{getDate:{configurable:!0,value:this.binds.getDate},getStartDate:{configurable:!0,value:this.binds.getStartDate},getEndDate:{configurable:!0,value:this.binds.getEndDate},setTime:{configurable:!0,value:this.binds.setTime},setStartTime:{configurable:!0,value:this.binds.setStartTime},setEndTime:{configurable:!0,value:this.binds.setEndTime}}),this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin"),this.parseValues(),this.picker.on("view",this.binds.onView),this.picker.on("input",this.binds.onInput),this.picker.on("change",this.binds.onChange),this.picker.on("click",this.binds.onClick)}onDetach(){delete this.picker.setTime,delete this.picker.setStartTime,delete this.picker.setEndTime,Object.defineProperties(this.picker,{getDate:{configurable:!0,value:this.binds._getDate},getStartDate:{configurable:!0,value:this.binds._getStartDate},getEndDate:{configurable:!0,value:this.binds._getEndDate}}),this.picker.off("view",this.binds.onView),this.picker.off("input",this.binds.onInput),this.picker.off("change",this.binds.onChange),this.picker.off("click",this.binds.onClick)}onView(e){const{view:t,target:i}=e.detail;if("Main"===t){this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin");const e=document.createElement("div");if(e.className="time-plugin-container",this.rangePlugin){const t=this.getStartInput();e.appendChild(t),this.picker.trigger("view",{view:"TimePluginInput",target:t});const i=this.getEndInput();e.appendChild(i),this.picker.trigger("view",{view:"TimePluginInput",target:i})}else{const t=this.getSingleInput();e.appendChild(t),this.picker.trigger("view",{view:"TimePluginInput",target:t})}i.appendChild(e),this.picker.trigger("view",{view:"TimePluginContainer",target:e})}}onInput(t){const i=t.target;if(i instanceof HTMLInputElement&&i.classList.contains("time-plugin-input")){const t=this.timePicked[i.name]||new e,[n,s]=i.value.split(":");t.setHours(Number(n)||0,Number(s)||0,0,0),this.picker.options.autoApply?(this.timePicked[i.name]=t,this.picker.updateValues()):this.timePrePicked[i.name]=t}}onChange(t){const i=t.target;if(i instanceof HTMLSelectElement&&i.classList.contains("time-plugin-custom-input")){const t=/(\w+)\[(\w+)\]/,[,n,s]=i.name.match(t),a=Number(i.value);let o=new e;switch(!this.picker.options.autoApply&&this.timePrePicked[n]instanceof Date?o=this.timePrePicked[n].clone():this.timePicked[n]instanceof Date&&(o=this.timePicked[n].clone()),s){case"HH":if(this.options.format12){const e=i.closest(".time-plugin-custom-block").querySelector(`select[name="${n}[period]"]`).value,t=this.handleFormat12(e,o,a);o.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}else o.setHours(a,o.getMinutes(),o.getSeconds(),0);break;case"mm":o.setHours(o.getHours(),a,o.getSeconds(),0);break;case"ss":o.setHours(o.getHours(),o.getMinutes(),a,0);break;case"period":if(this.options.format12){const e=i.closest(".time-plugin-custom-block").querySelector(`select[name="${n}[HH]"]`).value,t=this.handleFormat12(i.value,o,Number(e));o.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}}if(this.picker.options.autoApply)this.timePicked[n]=o,this.picker.updateValues();else{this.timePrePicked[n]=o;const e=this.picker.ui.container.querySelector(".apply-button");if(this.rangePlugin){const t=this.rangePlugin.options,i=this.picker.datePicked,n=t.strict&&2===i.length||!t.strict&&i.length>0||!i.length&&t.strict&&t.startDate instanceof Date&&t.endDate instanceof Date||!i.length&&!t.strict&&(t.startDate instanceof Date||t.endDate instanceof Date);e.disabled=!n}else this.picker.datePicked.length&&(e.disabled=!1)}}}onClick(e){const t=e.target;if(t instanceof HTMLElement){const e=t.closest(".unit");if(!(e instanceof HTMLElement))return;this.picker.isApplyButton(e)&&(Object.keys(this.timePicked).forEach((e=>{this.timePrePicked[e]instanceof Date&&(this.timePicked[e]=this.timePrePicked[e].clone())})),this.picker.updateValues(),this.timePrePicked={input:null,start:null,end:null}),this.picker.isCancelButton(e)&&(this.timePrePicked={input:null,start:null,end:null},this.picker.renderAll())}}setTime(e){const t=this.handleTimeString(e);this.timePicked.input=t.clone(),this.picker.renderAll(),this.picker.updateValues()}setStartTime(e){const t=this.handleTimeString(e);this.timePicked.start=t.clone(),this.picker.renderAll(),this.picker.updateValues()}setEndTime(e){const t=this.handleTimeString(e);this.timePicked.end=t.clone(),this.picker.renderAll(),this.picker.updateValues()}handleTimeString(t){const i=new e,[n,s,a]=t.split(":").map((e=>Number(e))),o=n&&!Number.isNaN(n)?n:0,r=s&&!Number.isNaN(s)?s:0,c=a&&!Number.isNaN(a)?a:0;return i.setHours(o,r,c,0),i}getDate(){if(this.picker.options.date instanceof Date){const t=new e(this.picker.options.date,this.picker.options.format);if(this.timePicked.input instanceof Date){const e=this.timePicked.input;t.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0)}return t}return null}getStartDate(){if(this.rangePlugin.options.startDate instanceof Date){const t=new e(this.rangePlugin.options.startDate,this.picker.options.format);if(this.timePicked.start instanceof Date){const e=this.timePicked.start;t.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0)}return t}return null}getEndDate(){if(this.rangePlugin.options.endDate instanceof Date){const t=new e(this.rangePlugin.options.endDate,this.picker.options.format);if(this.timePicked.end instanceof Date){const e=this.timePicked.end;t.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),0)}return t}return null}getSingleInput(){return this.options.native?this.getNativeInput("input"):this.getCustomInput("input")}getStartInput(){return this.options.native?this.getNativeInput("start"):this.getCustomInput("start")}getEndInput(){return this.options.native?this.getNativeInput("end"):this.getCustomInput("end")}getNativeInput(e){const t=document.createElement("input");t.type="time",t.name=e,t.className="time-plugin-input unit";const i=this.timePicked[e];if(i){const e=`0${i.getHours()}`.slice(-2),n=`0${i.getMinutes()}`.slice(-2);t.value=`${e}:${n}`}return t}getCustomInput(e){const t=document.createElement("div");t.className="time-plugin-custom-block";const i=document.createElement("select");i.className="time-plugin-custom-input unit",i.name=`${e}[HH]`;const n=this.options.format12?1:0,s=this.options.format12?13:24;let a=null;!this.picker.options.autoApply&&this.timePrePicked[e]instanceof Date?a=this.timePrePicked[e].clone():this.timePicked[e]instanceof Date&&(a=this.timePicked[e].clone());for(let e=n;e<s;e+=this.options.stepHours){const t=document.createElement("option");t.value=String(e),t.text=String(e),a&&(this.options.format12?(a.getHours()%12?a.getHours()%12:12)===e&&(t.selected=!0):a.getHours()===e&&(t.selected=!0)),i.appendChild(t)}t.appendChild(i);const o=document.createElement("select");o.className="time-plugin-custom-input unit",o.name=`${e}[mm]`;for(let e=0;e<60;e+=this.options.stepMinutes){const t=document.createElement("option");t.value=`0${String(e)}`.slice(-2),t.text=`0${String(e)}`.slice(-2),a&&a.getMinutes()===e&&(t.selected=!0),o.appendChild(t)}if(t.appendChild(o),this.options.seconds){const i=document.createElement("select");i.className="time-plugin-custom-input unit",i.name=`${e}[ss]`;const n=60;for(let e=0;e<n;e+=this.options.stepSeconds){const t=document.createElement("option");t.value=`0${String(e)}`.slice(-2),t.text=`0${String(e)}`.slice(-2),a&&a.getSeconds()===e&&(t.selected=!0),i.appendChild(t)}t.appendChild(i)}if(this.options.format12){const i=document.createElement("select");i.className="time-plugin-custom-input unit",i.name=`${e}[period]`,["AM","PM"].forEach((e=>{const t=document.createElement("option");t.value=e,t.text=e,a&&"PM"===e&&a.getHours()>=12&&(t.selected=!0),i.appendChild(t)})),t.appendChild(i)}return t}handleFormat12(e,t,i){const n=t.clone();switch(e){case"AM":12===i?n.setHours(0,n.getMinutes(),n.getSeconds(),0):n.setHours(i,n.getMinutes(),n.getSeconds(),0);break;case"PM":12!==i?n.setHours(i+12,n.getMinutes(),n.getSeconds(),0):n.setHours(i,n.getMinutes(),n.getSeconds(),0)}return n}parseValues(){if(this.rangePlugin){if(this.rangePlugin.options.strict){if(this.rangePlugin.options.startDate&&this.rangePlugin.options.endDate){const t=new e(this.rangePlugin.options.startDate,this.picker.options.format),i=new e(this.rangePlugin.options.endDate,this.picker.options.format);this.timePicked.start=t.clone(),this.timePicked.end=i.clone()}}else{if(this.rangePlugin.options.startDate){const t=new e(this.rangePlugin.options.startDate,this.picker.options.format);this.timePicked.start=t.clone()}if(this.rangePlugin.options.endDate){const t=new e(this.rangePlugin.options.endDate,this.picker.options.format);this.timePicked.end=t.clone()}}if(this.rangePlugin.options.elementEnd)if(this.rangePlugin.options.strict){if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length&&this.rangePlugin.options.elementEnd instanceof HTMLInputElement&&this.rangePlugin.options.elementEnd.value.length){const t=new e(this.picker.options.element.value,this.picker.options.format),i=new e(this.rangePlugin.options.elementEnd.value,this.picker.options.format);this.timePicked.start=t.clone(),this.timePicked.end=i.clone()}}else{if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const t=new e(this.picker.options.element.value,this.picker.options.format);this.timePicked.start=t.clone()}if(this.rangePlugin.options.elementEnd instanceof HTMLInputElement&&this.rangePlugin.options.elementEnd.value.length){const t=new e(this.rangePlugin.options.elementEnd.value,this.picker.options.format);this.timePicked.start=t.clone()}}else if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const[t,i]=this.picker.options.element.value.split(this.rangePlugin.options.delimiter);if(this.rangePlugin.options.strict){if(t&&i){const n=new e(t,this.picker.options.format),s=new e(i,this.picker.options.format);this.timePicked.start=n.clone(),this.timePicked.end=s.clone()}}else{if(t){const i=new e(t,this.picker.options.format);this.timePicked.start=i.clone()}if(i){const t=new e(i,this.picker.options.format);this.timePicked.start=t.clone()}}}}else{if(this.picker.options.date){const t=new e(this.picker.options.date,this.picker.options.format);this.timePicked.input=t.clone()}if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const t=new e(this.picker.options.element.value,this.picker.options.format);this.timePicked.input=t.clone()}}}}class h extends a{docElement=null;rangePlugin;binds={onView:this.onView.bind(this),onKeydown:this.onKeydown.bind(this)};options={unitIndex:1,dayIndex:2};getName(){return"KbdPlugin"}onAttach(){const e=this.picker.options.element,t=e.getBoundingClientRect();if(this.docElement=document.createElement("span"),this.docElement.style.position="absolute",this.docElement.style.top=`${e.offsetTop}px`,this.docElement.style.left=e.offsetLeft+t.width-25+"px",this.docElement.attachShadow({mode:"open"}),this.options.html)this.docElement.shadowRoot.innerHTML=this.options.html;else{const e=`\n <style>\n button {\n border: none;\n background: transparent;\n font-size: ${window.getComputedStyle(this.picker.options.element).fontSize};\n }\n </style>\n\n <button>&#128197;</button>\n `;this.docElement.shadowRoot.innerHTML=e}const i=this.docElement.shadowRoot.querySelector("button");i&&(i.addEventListener("click",(e=>{e.preventDefault(),this.picker.show({target:this.picker.options.element})}),{capture:!0}),i.addEventListener("keydown",(e=>{"Escape"===e.code&&this.picker.hide()}),{capture:!0})),this.picker.options.element.after(this.docElement),this.picker.on("view",this.binds.onView),this.picker.on("keydown",this.binds.onKeydown)}onDetach(){this.docElement&&this.docElement.isConnected&&this.docElement.remove(),this.picker.off("view",this.binds.onView),this.picker.off("keydown",this.binds.onKeydown)}onView(e){const{view:t,target:i}=e.detail;i&&"querySelector"in i&&("CalendarDay"!==t||["locked","not-available"].some((e=>i.classList.contains(e)))?[...i.querySelectorAll(".unit:not(.day)")].forEach((e=>e.tabIndex=this.options.unitIndex)):i.tabIndex=this.options.dayIndex)}onKeydown(e){switch(this.onMouseEnter(e),e.code){case"ArrowUp":case"ArrowDown":this.verticalMove(e);break;case"ArrowLeft":case"ArrowRight":this.horizontalMove(e);break;case"Enter":case"Space":this.handleEnter(e);break;case"Escape":this.picker.hide()}}findAllowableDaySibling(e,t,i){const n=Array.from(e.querySelectorAll(`.day[tabindex="${this.options.dayIndex}"]`)),s=n.indexOf(t);return n.filter(((e,t)=>i(t,s)&&e.tabIndex===this.options.dayIndex))[0]}changeMonth(e){const t={ArrowLeft:"previous",ArrowRight:"next"},i=this.picker.ui.container.querySelector(`.${t[e.code]}-button[tabindex="${this.options.unitIndex}"]`);i&&!i.parentElement.classList.contains(`no-${t[e.code]}-month`)&&(i.dispatchEvent(new Event("click",{bubbles:!0})),setTimeout((()=>{let t=null;switch(e.code){case"ArrowLeft":const e=this.picker.ui.container.querySelectorAll(`.day[tabindex="${this.options.dayIndex}"]`);t=e[e.length-1];break;case"ArrowRight":t=this.picker.ui.container.querySelector(`.day[tabindex="${this.options.dayIndex}"]`)}t&&t.focus()})))}verticalMove(e){const t=e.target;if(t.classList.contains("day")){e.preventDefault();const i=this.findAllowableDaySibling(this.picker.ui.container,t,((t,i)=>t===("ArrowUp"===e.code?i-7:i+7)));i&&i.focus()}}horizontalMove(e){const t=e.target;if(t.classList.contains("day")){e.preventDefault();const i=this.findAllowableDaySibling(this.picker.ui.container,t,((t,i)=>t===("ArrowLeft"===e.code?i-1:i+1)));i?i.focus():this.changeMonth(e)}}handleEnter(e){const t=e.target;t.classList.contains("day")&&(e.preventDefault(),t.dispatchEvent(new Event("click",{bubbles:!0})),setTimeout((()=>{if(this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin"),this.rangePlugin||!this.picker.options.autoApply){const e=this.picker.ui.container.querySelector(".day.selected");e&&setTimeout((()=>{e.focus()}))}})))}onMouseEnter(e){e.target.classList.contains("day")&&setTimeout((()=>{const e=this.picker.ui.shadowRoot.activeElement;e&&e.dispatchEvent(new Event("mouseenter",{bubbles:!0}))}))}}class d extends a{rangePlugin;lockPlugin;priority=10;binds={onView:this.onView.bind(this),onColorScheme:this.onColorScheme.bind(this)};options={dropdown:{months:!1,years:!1,minYear:1950,maxYear:null},darkMode:!0,locale:{resetButton:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"/></svg>'}};matchMedia;getName(){return"AmpPlugin"}onAttach(){this.options.darkMode&&window&&"matchMedia"in window&&(this.matchMedia=window.matchMedia("(prefers-color-scheme: dark)"),this.matchMedia.matches&&(this.picker.ui.container.dataset.theme="dark"),this.matchMedia.addEventListener("change",this.binds.onColorScheme)),this.options.weekNumbers&&this.picker.ui.container.classList.add("week-numbers"),this.picker.on("view",this.binds.onView)}onDetach(){this.options.darkMode&&window&&"matchMedia"in window&&this.matchMedia.removeEventListener("change",this.binds.onColorScheme),this.picker.ui.container.removeAttribute("data-theme"),this.picker.ui.container.classList.remove("week-numbers"),this.picker.off("view",this.binds.onView)}onView(e){this.lockPlugin=this.picker.PluginManager.getInstance("LockPlugin"),this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin"),this.handleDropdown(e),this.handleResetButton(e),this.handleWeekNumbers(e)}onColorScheme(e){const t=e.matches?"dark":"light";this.picker.ui.container.dataset.theme=t}handleDropdown(t){const{view:i,target:n,date:s,index:a}=t.detail;if("CalendarHeader"===i){const t=n.querySelector(".month-name");if(this.options.dropdown.months){t.childNodes[0].remove();const i=document.createElement("select");i.className="month-name--select month-name--dropdown";for(let t=0;t<12;t+=1){const n=document.createElement("option"),a=new e(new Date(s.getFullYear(),t,2,0,0,0)),o=new e(new Date(s.getFullYear(),t,1,0,0,0));n.value=String(t),n.text=a.toLocaleString(this.picker.options.lang,{month:"long"}),this.lockPlugin&&(n.disabled=this.lockPlugin.options.minDate&&o.isBefore(new e(this.lockPlugin.options.minDate),"month")||this.lockPlugin.options.maxDate&&o.isAfter(new e(this.lockPlugin.options.maxDate),"month")),n.selected=o.getMonth()===s.getMonth(),i.appendChild(n)}i.addEventListener("change",(e=>{const t=e.target;this.picker.calendars[0].setDate(1),this.picker.calendars[0].setMonth(Number(t.value)),this.picker.renderAll()})),t.prepend(i)}if(this.options.dropdown.years){t.childNodes[1].remove();const i=document.createElement("select");i.className="month-name--select";const n=this.options.dropdown.minYear,a=this.options.dropdown.maxYear?this.options.dropdown.maxYear:(new Date).getFullYear();if(s.getFullYear()>a){const e=document.createElement("option");e.value=String(s.getFullYear()),e.text=String(s.getFullYear()),e.selected=!0,e.disabled=!0,i.appendChild(e)}for(let t=a;t>=n;t-=1){const n=document.createElement("option"),a=new e(new Date(t,0,1,0,0,0));n.value=String(t),n.text=String(t),this.lockPlugin&&(n.disabled=this.lockPlugin.options.minDate&&a.isBefore(new e(this.lockPlugin.options.minDate),"year")||this.lockPlugin.options.maxDate&&a.isAfter(new e(this.lockPlugin.options.maxDate),"year")),n.selected=s.getFullYear()===t,i.appendChild(n)}if(s.getFullYear()<n){const e=document.createElement("option");e.value=String(s.getFullYear()),e.text=String(s.getFullYear()),e.selected=!0,e.disabled=!0,i.appendChild(e)}if("asc"===this.options.dropdown.years){const e=Array.prototype.slice.call(i.childNodes).reverse();i.innerHTML="",e.forEach((e=>{e.innerHTML=e.value,i.appendChild(e)}))}i.addEventListener("change",(e=>{const t=e.target;this.picker.calendars[0].setFullYear(Number(t.value)),this.picker.renderAll()})),t.appendChild(i)}}}handleResetButton(e){const{view:t,target:i}=e.detail;if("CalendarHeader"===t&&this.options.resetButton){const e=document.createElement("button");e.className="reset-button unit",e.innerHTML=this.options.locale.resetButton,e.addEventListener("click",(e=>{e.preventDefault();let t=!0;"function"==typeof this.options.resetButton&&(t=this.options.resetButton.call(this)),t&&this.picker.clear()})),i.appendChild(e)}}handleWeekNumbers(t){if(this.options.weekNumbers){const{view:i,target:n}=t.detail;if("CalendarDayNames"===i){const e=document.createElement("div");e.className="wnum-header",e.innerHTML="Wk",n.prepend(e)}"CalendarDays"===i&&[...n.children].forEach(((t,i)=>{if(0===i||i%7==0){let i;if(t.classList.contains("day"))i=new e(t.dataset.time);else{const t=n.querySelector(".day");i=new e(t.dataset.time)}let s=i.getWeek(this.picker.options.firstDay);53===s&&0===i.getMonth()&&(s="53/1");const a=document.createElement("div");a.className="wnum-item",a.innerHTML=String(s),n.insertBefore(a,t)}}))}}}export{d as AmpPlugin,e as DateTime,h as KbdPlugin,o as LockPlugin,r as PresetPlugin,c as RangePlugin,l as TimePlugin,n as create,s as easepick};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Package: @yuafox/easepick2
4
+ * Version: 2.0.0
5
+ * https://github.com/YuaFox/easepick2
6
+ * Copyright 2026 YuaFox
7
+ *
8
+ * Licensed under the terms of GNU General Public License Version 2 or later. (http://www.gnu.org/licenses/gpl.html)
9
+ */
10
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).easepick=e.easepick||{})}(this,(function(e){"use strict";class t extends Date{static parseDateTime(e,i="YYYY-MM-DD",n="en-US"){if(!e)return new Date((new Date).setHours(0,0,0,0));if(e instanceof t)return e.toJSDate();if(e instanceof Date)return e;if(/^-?\d{10,}$/.test(String(e)))return new Date(Number(e));if("string"==typeof e){const s=[];let a=null;for(;null!=(a=t.regex.exec(i));)"\\"!==a[1]&&s.push(a);if(s.length){const i={year:null,month:null,shortMonth:null,longMonth:null,day:null,hour:0,minute:0,second:0,ampm:null,value:""};s[0].index>0&&(i.value+=".*?");for(const[e,a]of Object.entries(s)){const s=Number(e),{group:o,pattern:r}=t.formatPatterns(a[0],n);i[o]=s+1,i.value+=r,i.value+=".*?"}const a=new RegExp(`^${i.value}$`);if(a.test(e)){const s=a.exec(e),o=Number(s[i.year]);let r=null;i.month?r=Number(s[i.month])-1:i.shortMonth?r=t.shortMonths(n).indexOf(s[i.shortMonth]):i.longMonth&&(r=t.longMonths(n).indexOf(s[i.longMonth]));const c=Number(s[i.day])||1,l=Number(s[i.hour]);let h=Number.isNaN(l)?0:l;const d=Number(s[i.minute]),p=Number.isNaN(d)?0:d,u=Number(s[i.second]),g=Number.isNaN(u)?0:u,m=s[i.ampm];return m&&"PM"===m&&(h+=12,24===h&&(h=0)),new Date(o,r,c,h,p,g,0)}}}return new Date((new Date).setHours(0,0,0,0))}static regex=/(\\)?(Y{2,4}|M{1,4}|D{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|A|a)/g;static MONTH_JS=[0,1,2,3,4,5,6,7,8,9,10,11];static shortMonths(e){return t.MONTH_JS.map((t=>new Date(2019,t).toLocaleString(e,{month:"short"})))}static longMonths(e){return t.MONTH_JS.map((t=>new Date(2019,t).toLocaleString(e,{month:"long"})))}static formatPatterns(e,i){switch(e){case"YY":case"YYYY":return{group:"year",pattern:`(\\d{${e.length}})`};case"M":return{group:"month",pattern:"(\\d{1,2})"};case"MM":return{group:"month",pattern:"(\\d{2})"};case"MMM":return{group:"shortMonth",pattern:`(${t.shortMonths(i).join("|")})`};case"MMMM":return{group:"longMonth",pattern:`(${t.longMonths(i).join("|")})`};case"D":return{group:"day",pattern:"(\\d{1,2})"};case"DD":return{group:"day",pattern:"(\\d{2})"};case"h":case"H":return{group:"hour",pattern:"(\\d{1,2})"};case"hh":case"HH":return{group:"hour",pattern:"(\\d{2})"};case"m":return{group:"minute",pattern:"(\\d{1,2})"};case"mm":return{group:"minute",pattern:"(\\d{2})"};case"s":return{group:"second",pattern:"(\\d{1,2})"};case"ss":return{group:"second",pattern:"(\\d{2})"};case"a":case"A":return{group:"ampm",pattern:"(AM|PM|am|pm)"}}}lang;constructor(e=null,i="YYYY-MM-DD",n="en-US"){super(t.parseDateTime(e,i,n)),this.lang=n}getWeek(e){const t=new Date(this.midnight_ts(this)),i=(this.getDay()+(7-e))%7;t.setDate(t.getDate()-i);const n=t.getTime();return t.setMonth(0,1),t.getDay()!==e&&t.setMonth(0,1+(4-t.getDay()+7)%7),1+Math.ceil((n-t.getTime())/6048e5)}clone(){return new t(this)}toJSDate(){return new Date(this)}inArray(e,t="[]"){return e.some((e=>e instanceof Array?this.isBetween(e[0],e[1],t):this.isSame(e,"day")))}isBetween(e,t,i="()"){switch(i){default:case"()":return this.midnight_ts(this)>this.midnight_ts(e)&&this.midnight_ts(this)<this.midnight_ts(t);case"[)":return this.midnight_ts(this)>=this.midnight_ts(e)&&this.midnight_ts(this)<this.midnight_ts(t);case"(]":return this.midnight_ts(this)>this.midnight_ts(e)&&this.midnight_ts(this)<=this.midnight_ts(t);case"[]":return this.midnight_ts()>=this.midnight_ts(e)&&this.midnight_ts()<=this.midnight_ts(t)}}isBefore(e,t="days"){switch(t){case"day":case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()>new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case"month":case"months":return new Date(e.getFullYear(),e.getMonth(),1).getTime()>new Date(this.getFullYear(),this.getMonth(),1).getTime();case"year":case"years":return e.getFullYear()>this.getFullYear()}throw new Error("isBefore: Invalid unit!")}isSameOrBefore(e,t="days"){switch(t){case"day":case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()>=new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case"month":case"months":return new Date(e.getFullYear(),e.getMonth(),1).getTime()>=new Date(this.getFullYear(),this.getMonth(),1).getTime()}throw new Error("isSameOrBefore: Invalid unit!")}isAfter(e,t="days"){switch(t){case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>new Date(e.getFullYear(),e.getMonth(),1).getTime();case"year":case"years":return this.getFullYear()>e.getFullYear()}throw new Error("isAfter: Invalid unit!")}isSameOrAfter(e,t="days"){switch(t){case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>=new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>=new Date(e.getFullYear(),e.getMonth(),1).getTime()}throw new Error("isSameOrAfter: Invalid unit!")}isSame(e,t="days"){switch(t){case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()===new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()===new Date(e.getFullYear(),e.getMonth(),1).getTime()}throw new Error("isSame: Invalid unit!")}add(e,t="days"){switch(t){case"day":case"days":this.setDate(this.getDate()+e);break;case"month":case"months":this.setMonth(this.getMonth()+e)}return this}subtract(e,t="days"){switch(t){case"day":case"days":this.setDate(this.getDate()-e);break;case"month":case"months":this.setMonth(this.getMonth()-e)}return this}diff(e,t="days"){switch(t){default:case"day":case"days":return Math.round((this.midnight_ts()-this.midnight_ts(e))/864e5);case"month":case"months":let t=12*(e.getFullYear()-this.getFullYear());return t-=e.getMonth(),t+=this.getMonth(),t}}format(e,i="en-US"){let n="";const s=[];let a=null;for(;null!=(a=t.regex.exec(e));)"\\"!==a[1]&&s.push(a);if(s.length){s[0].index>0&&(n+=e.substring(0,s[0].index));for(const[t,a]of Object.entries(s)){const o=Number(t);n+=this.formatTokens(a[0],i),s[o+1]&&(n+=e.substring(a.index+a[0].length,s[o+1].index)),o===s.length-1&&(n+=e.substring(a.index+a[0].length))}}return n.replace(/\\/g,"")}midnight_ts(e){return e?new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0).getTime():new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0,0).getTime()}formatTokens(e,i){switch(e){case"YY":return String(this.getFullYear()).slice(-2);case"YYYY":return String(this.getFullYear());case"M":return String(this.getMonth()+1);case"MM":return`0${this.getMonth()+1}`.slice(-2);case"MMM":return t.shortMonths(i)[this.getMonth()];case"MMMM":return t.longMonths(i)[this.getMonth()];case"D":return String(this.getDate());case"DD":return`0${this.getDate()}`.slice(-2);case"H":return String(this.getHours());case"HH":return`0${this.getHours()}`.slice(-2);case"h":return String(this.getHours()%12||12);case"hh":return`0${this.getHours()%12||12}`.slice(-2);case"m":return String(this.getMinutes());case"mm":return`0${this.getMinutes()}`.slice(-2);case"s":return String(this.getSeconds());case"ss":return`0${this.getSeconds()}`.slice(-2);case"a":return this.getHours()<12||24===this.getHours()?"am":"pm";case"A":return this.getHours()<12||24===this.getHours()?"AM":"PM";default:return""}}}class i{picker;constructor(e){this.picker=e}render(e,i){e||(e=new t),e.setDate(1),e.setHours(0,0,0,0),"function"==typeof this[`get${i}View`]&&this[`get${i}View`](e)}getContainerView(e){this.picker.ui.container.innerHTML="",this.picker.options.header&&this.picker.trigger("render",{date:e.clone(),view:"Header"}),this.picker.trigger("render",{date:e.clone(),view:"Main"}),this.picker.options.autoApply||this.picker.trigger("render",{date:e.clone(),view:"Footer"})}getHeaderView(e){const t=document.createElement("header");this.picker.options.header instanceof HTMLElement&&t.appendChild(this.picker.options.header),"string"==typeof this.picker.options.header&&(t.innerHTML=this.picker.options.header),this.picker.ui.container.appendChild(t),this.picker.trigger("view",{target:t,date:e.clone(),view:"Header"})}getMainView(e){const t=document.createElement("main");this.picker.ui.container.appendChild(t);const i=this.picker.options.viewMode||"day",n=document.createElement("div");if(n.className=`calendars grid-${this.picker.options.grid}`,"month"===i){const t=document.createElement("div");t.className="calendar",n.appendChild(t);const i=this.getCalendarHeaderView(e.clone());t.appendChild(i),this.picker.trigger("view",{date:e.clone(),view:"CalendarHeader",index:0,target:i});const s=this.getCalendarMonthsView(e.clone());t.appendChild(s),this.picker.trigger("view",{date:e.clone(),view:"CalendarMonths",index:0,target:s}),this.picker.trigger("view",{date:e.clone(),view:"CalendarItem",index:0,target:t})}else if("year"===i){const t=document.createElement("div");t.className="calendar",n.appendChild(t);const i=this.getCalendarHeaderView(e.clone());t.appendChild(i),this.picker.trigger("view",{date:e.clone(),view:"CalendarHeader",index:0,target:i});const s=this.getCalendarYearsView(e.clone());t.appendChild(s),this.picker.trigger("view",{date:e.clone(),view:"CalendarYears",index:0,target:s}),this.picker.trigger("view",{date:e.clone(),view:"CalendarItem",index:0,target:t})}else for(let t=0;t<this.picker.options.calendars;t++){const i=document.createElement("div");i.className="calendar",n.appendChild(i);const s=this.getCalendarHeaderView(e.clone());i.appendChild(s),this.picker.trigger("view",{date:e.clone(),view:"CalendarHeader",index:t,target:s});const a=this.getCalendarDayNamesView();i.appendChild(a),this.picker.trigger("view",{date:e.clone(),view:"CalendarDayNames",index:t,target:a});const o=this.getCalendarDaysView(e.clone());i.appendChild(o),this.picker.trigger("view",{date:e.clone(),view:"CalendarDays",index:t,target:o});const r=this.getCalendarFooterView(this.picker.options.lang,e.clone());i.appendChild(r),this.picker.trigger("view",{date:e.clone(),view:"CalendarFooter",index:t,target:r}),this.picker.trigger("view",{date:e.clone(),view:"CalendarItem",index:t,target:i}),e.add(1,"month")}t.appendChild(n),this.picker.trigger("view",{date:e.clone(),view:"Calendars",target:n}),this.picker.trigger("view",{date:e.clone(),view:"Main",target:t})}getFooterView(e){const t=document.createElement("footer"),i=document.createElement("div");i.className="footer-buttons";const n=document.createElement("button");n.className="cancel-button unit",n.innerHTML=this.picker.options.locale.cancel,i.appendChild(n);const s=document.createElement("button");s.className="apply-button unit",s.innerHTML=this.picker.options.locale.apply,s.disabled=!0,i.appendChild(s),t.appendChild(i),this.picker.ui.container.appendChild(t),this.picker.trigger("view",{date:e,target:t,view:"Footer"})}getCalendarHeaderView(e){const t=this.picker.options.viewMode||"day",i=document.createElement("div");i.className="header";const n=document.createElement("div");if(n.className="month-name","month"===t)n.innerHTML=`<span>${e.format("YYYY")}</span>`;else if("year"===t){const t=10*Math.floor(e.getFullYear()/10);n.innerHTML=`<span>${t} - ${t+9}</span>`}else n.innerHTML=`<span>${e.toLocaleString(this.picker.options.lang,{month:"long"})}</span> ${e.format("YYYY")}`;i.appendChild(n);const s=document.createElement("button");s.className="previous-button unit",s.innerHTML=this.picker.options.locale.previousMonth,i.appendChild(s);const a=document.createElement("button");return a.className="next-button unit",a.innerHTML=this.picker.options.locale.nextMonth,i.appendChild(a),i}getCalendarMonthsView(e){const i=document.createElement("div");i.className="months-grid";const n=new t;for(let s=0;s<12;s++){const a=new t(new Date(e.getFullYear(),s,1)),o=document.createElement("div");o.className="month unit",o.innerHTML=a.toLocaleString(this.picker.options.lang,{month:"short"}),o.dataset.time=String(a.getTime()),a.getFullYear()===n.getFullYear()&&s===n.getMonth()&&o.classList.add("today"),this.picker.datePicked.length?this.picker.datePicked[0].isSame(a,"month")&&o.classList.add("selected"):this.picker.options.date&&new t(this.picker.options.date).isSame(a,"month")&&o.classList.add("selected"),i.appendChild(o),this.picker.trigger("view",{date:a,view:"CalendarMonth",target:o})}return i}getCalendarYearsView(e){const i=document.createElement("div");i.className="years-grid";const n=new t,s=10*Math.floor(e.getFullYear()/10);for(let e=s;e<s+12;e++){const a=new t(new Date(e,0,1)),o=document.createElement("div");o.className="year unit",o.innerHTML=String(e),o.dataset.time=String(a.getTime()),e===n.getFullYear()&&o.classList.add("today"),(e<s||e>s+9)&&o.classList.add("outside"),this.picker.datePicked.length?this.picker.datePicked[0].getFullYear()===e&&o.classList.add("selected"):this.picker.options.date&&new t(this.picker.options.date).getFullYear()===e&&o.classList.add("selected"),i.appendChild(o),this.picker.trigger("view",{date:a,view:"CalendarYear",target:o})}return i}getCalendarDayNamesView(){const e=document.createElement("div");e.className="daynames-row";for(let t=1;t<=7;t++){const i=3+this.picker.options.firstDay+t,n=document.createElement("div");n.className="dayname",n.innerHTML=new Date(1970,0,i,12,0,0,0).toLocaleString(this.picker.options.lang,{weekday:"short"}),n.title=new Date(1970,0,i,12,0,0,0).toLocaleString(this.picker.options.lang,{weekday:"long"}),e.appendChild(n),this.picker.trigger("view",{dayIdx:i,view:"CalendarDayName",target:n})}return e}getCalendarDaysView(e){const t=document.createElement("div");t.className="days-grid";const i=this.calcOffsetDays(e,this.picker.options.firstDay),n=32-new Date(e.getFullYear(),e.getMonth(),32).getDate();for(let e=0;e<i;e++){const e=document.createElement("div");e.className="offset",t.appendChild(e)}for(let i=1;i<=n;i++){e.setDate(i);const n=this.getCalendarDayView(e);t.appendChild(n),this.picker.trigger("view",{date:e,view:"CalendarDay",target:n})}return t}getCalendarDayView(e){const i=this.picker.options.date?new t(this.picker.options.date):null,n=new t,s=document.createElement("div");return s.className="day unit",s.innerHTML=e.format("D"),s.dataset.time=String(e.getTime()),e.isSame(n,"day")&&s.classList.add("today"),[0,6].includes(e.getDay())&&s.classList.add("weekend"),this.picker.datePicked.length?this.picker.datePicked[0].isSame(e,"day")&&s.classList.add("selected"):i&&e.isSame(i,"day")&&s.classList.add("selected"),this.picker.trigger("view",{date:e,view:"CalendarDay",target:s}),s}getCalendarFooterView(e,t){const i=document.createElement("div");return i.className="footer",i}calcOffsetDays(e,t){let i=e.getDay()-t;return i<0&&(i+=7),i}}class n{picker;instances={};constructor(e){this.picker=e}initialize(){const e=[];this.picker.options.plugins.forEach((t=>{"function"==typeof t?e.push(new t):"string"==typeof t&&"undefined"!=typeof easepick&&Object.prototype.hasOwnProperty.call(easepick,t)?e.push(new easepick[t]):console.warn(`easepick: ${t} not found.`)})),e.sort(((e,t)=>e.priority>t.priority?-1:e.priority<t.priority||e.dependencies.length>t.dependencies.length?1:e.dependencies.length<t.dependencies.length?-1:0)),e.forEach((e=>{e.attach(this.picker),this.instances[e.getName()]=e}))}getInstance(e){return this.instances[e]}addInstance(e){if(Object.prototype.hasOwnProperty.call(this.instances,e))console.warn(`easepick: ${e} already added.`);else{if("undefined"!=typeof easepick&&Object.prototype.hasOwnProperty.call(easepick,e)){const t=new easepick[e];return t.attach(this.picker),this.instances[t.getName()]=t,t}if("undefined"!==this.getPluginFn(e)){const t=new(this.getPluginFn(e));return t.attach(this.picker),this.instances[t.getName()]=t,t}console.warn(`easepick: ${e} not found.`)}return null}removeInstance(e){return e in this.instances&&this.instances[e].detach(),delete this.instances[e]}reloadInstance(e){return this.removeInstance(e),this.addInstance(e)}getPluginFn(e){return[...this.picker.options.plugins].filter((t=>"function"==typeof t&&(new t).getName()===e)).shift()}}class s{Calendar=new i(this);PluginManager=new n(this);calendars=[];datePicked=[];cssLoaded=0;binds={hidePicker:this.hidePicker.bind(this),show:this.show.bind(this)};options={doc:document,css:[],element:null,firstDay:1,grid:1,calendars:1,lang:"en-US",date:null,format:"YYYY-MM-DD",readonly:!0,autoApply:!0,header:!1,inline:!1,viewMode:"day",scrollToDate:!0,locale:{nextMonth:'<svg width="11" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.748 16L0 13.333 5.333 8 0 2.667 2.748 0l7.919 8z" fill-rule="nonzero"/></svg>',previousMonth:'<svg width="11" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M7.919 0l2.748 2.667L5.333 8l5.334 5.333L7.919 16 0 8z" fill-rule="nonzero"/></svg>',cancel:"Cancel",apply:"Apply"},documentClick:this.binds.hidePicker,plugins:[]};ui={container:null,shadowRoot:null,wrapper:null};version="2.0.0";constructor(e){const t={...this.options.locale,...e.locale};this.options={...this.options,...e},this.options.locale=t,this.handleOptions(),this.ui.wrapper=document.createElement("span"),this.ui.wrapper.style.display="none",this.ui.wrapper.style.position="absolute",this.ui.wrapper.style.pointerEvents="none",this.ui.wrapper.className="easepick-wrapper",this.ui.wrapper.attachShadow({mode:"open"}),this.ui.shadowRoot=this.ui.wrapper.shadowRoot,this.ui.container=document.createElement("div"),this.ui.container.className="container",this.options.zIndex&&(this.ui.container.style.zIndex=String(this.options.zIndex)),this.options.inline&&(this.ui.wrapper.style.position="relative",this.ui.container.classList.add("inline")),this.ui.shadowRoot.appendChild(this.ui.container),this.options.element.after(this.ui.wrapper),this.handleCSS(),this.options.element.addEventListener("click",this.binds.show),this.on("view",this.onView.bind(this)),this.on("render",this.onRender.bind(this)),this.PluginManager.initialize(),this.parseValues(),"function"==typeof this.options.setup&&this.options.setup(this),this.on("click",this.onClick.bind(this));const i=this.options.scrollToDate?this.getDate():null;this.renderAll(i)}on(e,t,i={}){this.ui.container.addEventListener(e,t,i)}off(e,t,i={}){this.ui.container.removeEventListener(e,t,i)}trigger(e,t={}){return this.ui.container.dispatchEvent(new CustomEvent(e,{detail:t}))}destroy(){this.options.element.removeEventListener("click",this.binds.show),"function"==typeof this.options.documentClick&&document.removeEventListener("click",this.options.documentClick,!0),Object.keys(this.PluginManager.instances).forEach((e=>{this.PluginManager.removeInstance(e)})),this.ui.wrapper.remove()}onRender(e){const{view:t,date:i}=e.detail;this.Calendar.render(i,t)}onView(e){const{view:t,target:i}=e.detail;"Footer"===t&&this.datePicked.length&&(i.querySelector(".apply-button").disabled=!1)}onClickHeaderButton(e){if(this.isCalendarHeaderButton(e)){const t=this.options.viewMode||"day",i=e.classList.contains("next-button");"year"===t?i?this.calendars[0].setFullYear(this.calendars[0].getFullYear()+10):this.calendars[0].setFullYear(this.calendars[0].getFullYear()-10):"month"===t?i?this.calendars[0].setFullYear(this.calendars[0].getFullYear()+1):this.calendars[0].setFullYear(this.calendars[0].getFullYear()-1):i?this.calendars[0].add(1,"month"):this.calendars[0].subtract(1,"month"),this.renderAll(this.calendars[0])}}onClickCalendarDay(e){if(this.isCalendarDay(e)){const i=new t(e.dataset.time);this.options.autoApply?(this.setDate(i),this.trigger("select",{date:this.getDate()}),this.hide()):(this.datePicked[0]=i,this.trigger("preselect",{date:this.getDate()}),this.renderAll())}}onClickCalendarMonth(e){if(this.isCalendarMonth(e)){const i=new t(e.dataset.time);this.options.autoApply?(this.setDate(i),this.trigger("select",{date:this.getDate()}),this.hide()):(this.datePicked[0]=i,this.trigger("preselect",{date:this.getDate()}),this.renderAll())}}onClickCalendarYear(e){if(this.isCalendarYear(e)){const i=new t(e.dataset.time);this.options.autoApply?(this.setDate(i),this.trigger("select",{date:this.getDate()}),this.hide()):(this.datePicked[0]=i,this.trigger("preselect",{date:this.getDate()}),this.renderAll())}}onClickApplyButton(e){if(this.isApplyButton(e)){if(this.datePicked[0]instanceof Date){const e=this.datePicked[0].clone();this.setDate(e)}this.hide(),this.trigger("select",{date:this.getDate()})}}onClickCancelButton(e){this.isCancelButton(e)&&this.hide()}onClick(e){const t=e.target;if(t instanceof HTMLElement){const e=t.closest(".unit");if(!(e instanceof HTMLElement))return;this.onClickHeaderButton(e),this.onClickCalendarDay(e),this.onClickCalendarMonth(e),this.onClickCalendarYear(e),this.onClickApplyButton(e),this.onClickCancelButton(e)}}isShown(){return this.ui.container.classList.contains("inline")||this.ui.container.classList.contains("show")}show(e){if(this.isShown())return;const t=e&&"target"in e?e.target:this.options.element,{top:i,left:n}=this.adjustPosition(t);this.ui.container.style.top=`${i}px`,this.ui.container.style.left=`${n}px`,this.ui.container.classList.add("show"),this.trigger("show",{target:t})}hide(){this.ui.container.classList.remove("show"),this.datePicked.length=0,this.renderAll(),this.trigger("hide")}setDate(e){const i=new t(e,this.options.format);this.options.date=i.clone(),this.updateValues(),this.calendars.length&&this.renderAll()}getDate(){return this.options.date instanceof t?this.options.date.clone():null}parseValues(){this.options.date?this.setDate(this.options.date):this.options.element instanceof HTMLInputElement&&this.options.element.value.length&&this.setDate(this.options.element.value),this.options.date instanceof Date||(this.options.date=null)}updateValues(){const e=this.getDate(),t=e instanceof Date?e.format(this.options.format,this.options.lang):"",i=this.options.element;i instanceof HTMLInputElement?i.value=t:i instanceof HTMLElement&&(i.innerText=t)}hidePicker(e){let t=e.target,i=null;t.shadowRoot&&(t=e.composedPath()[0],i=t.getRootNode().host),this.isShown()&&!1===this.options.inline&&i!==this.ui.wrapper&&t!==this.options.element&&this.hide()}renderAll(e){this.trigger("render",{view:"Container",date:(e||this.calendars[0]).clone()})}isCalendarHeaderButton(e){return["previous-button","next-button"].some((t=>e.classList.contains(t)))}isCalendarDay(e){return e.classList.contains("day")}isCalendarMonth(e){return e.classList.contains("month")}isCalendarYear(e){return e.classList.contains("year")}isApplyButton(e){return e.classList.contains("apply-button")}isCancelButton(e){return e.classList.contains("cancel-button")}gotoDate(e){const i=new t(e,this.options.format);i.setDate(1),this.calendars[0]=i.clone(),this.renderAll()}clear(){this.options.date=null,this.datePicked.length=0,this.updateValues(),this.renderAll(),this.trigger("clear")}handleOptions(){this.options.element instanceof HTMLElement||(this.options.element=this.options.doc.querySelector(this.options.element)),"function"==typeof this.options.documentClick&&document.addEventListener("click",this.options.documentClick,!0),this.options.element instanceof HTMLInputElement&&(this.options.element.readOnly=this.options.readonly),this.options.date?this.calendars[0]=new t(this.options.date,this.options.format):this.calendars[0]=new t}handleCSS(){if(Array.isArray(this.options.css))this.options.css.forEach((e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet";const i=()=>{this.cssLoaded++,this.cssLoaded===this.options.css.length&&(this.ui.wrapper.style.display="")};t.addEventListener("load",i),t.addEventListener("error",i),this.ui.shadowRoot.append(t)}));else if("string"==typeof this.options.css){const e=document.createElement("style"),t=document.createTextNode(this.options.css);e.appendChild(t),this.ui.shadowRoot.append(e),this.ui.wrapper.style.display=""}else"function"==typeof this.options.css&&(this.options.css.call(this,this),this.ui.wrapper.style.display="")}adjustPosition(e){const t=e.getBoundingClientRect(),i=this.ui.wrapper.getBoundingClientRect();this.ui.container.classList.add("calc");const n=this.ui.container.getBoundingClientRect();this.ui.container.classList.remove("calc");let s=t.bottom-i.bottom,a=t.left-i.left;return"undefined"!=typeof window&&(window.innerHeight<s+n.height&&s-n.height>=0&&(s=t.top-i.top-n.height),window.innerWidth<a+n.width&&t.right-n.width>=0&&(a=t.right-i.right-n.width)),{left:a,top:s}}}var a=Object.freeze({__proto__:null,Core:s,create:s});class o{picker;options;priority=0;dependencies=[];attach(e){const t=this.getName(),i={...this.options};this.options={...this.options,...e.options[t]||{}};for(const n of Object.keys(i))if(null!==i[n]&&"object"==typeof i[n]&&Object.keys(i[n]).length&&t in e.options&&n in e.options[t]){const s={...e.options[t][n]};null!==s&&"object"==typeof s&&Object.keys(s).length&&Object.keys(s).every((e=>Object.keys(i[n]).includes(e)))&&(this.options[n]={...i[n],...s})}if(this.picker=e,this.dependenciesNotFound()){const e=this.dependencies.filter((e=>!this.pluginsAsStringArray().includes(e)));return void console.warn(`${this.getName()}: required dependencies (${e.join(", ")}).`)}const n=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.add(n),this.onAttach()}detach(){const e=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.remove(e),"function"==typeof this.onDetach&&this.onDetach()}dependenciesNotFound(){return this.dependencies.length&&!this.dependencies.every((e=>this.pluginsAsStringArray().includes(e)))}pluginsAsStringArray(){return this.picker.options.plugins.map((e=>"function"==typeof e?(new e).getName():e))}camelCaseToKebab(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}}e.AmpPlugin=class extends o{rangePlugin;lockPlugin;priority=10;binds={onView:this.onView.bind(this),onColorScheme:this.onColorScheme.bind(this)};options={dropdown:{months:!1,years:!1,minYear:1950,maxYear:null},darkMode:!0,locale:{resetButton:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"/></svg>'}};matchMedia;getName(){return"AmpPlugin"}onAttach(){this.options.darkMode&&window&&"matchMedia"in window&&(this.matchMedia=window.matchMedia("(prefers-color-scheme: dark)"),this.matchMedia.matches&&(this.picker.ui.container.dataset.theme="dark"),this.matchMedia.addEventListener("change",this.binds.onColorScheme)),this.options.weekNumbers&&this.picker.ui.container.classList.add("week-numbers"),this.picker.on("view",this.binds.onView)}onDetach(){this.options.darkMode&&window&&"matchMedia"in window&&this.matchMedia.removeEventListener("change",this.binds.onColorScheme),this.picker.ui.container.removeAttribute("data-theme"),this.picker.ui.container.classList.remove("week-numbers"),this.picker.off("view",this.binds.onView)}onView(e){this.lockPlugin=this.picker.PluginManager.getInstance("LockPlugin"),this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin"),this.handleDropdown(e),this.handleResetButton(e),this.handleWeekNumbers(e)}onColorScheme(e){const t=e.matches?"dark":"light";this.picker.ui.container.dataset.theme=t}handleDropdown(e){const{view:i,target:n,date:s,index:a}=e.detail;if("CalendarHeader"===i){const e=n.querySelector(".month-name");if(this.options.dropdown.months){e.childNodes[0].remove();const i=document.createElement("select");i.className="month-name--select month-name--dropdown";for(let e=0;e<12;e+=1){const n=document.createElement("option"),a=new t(new Date(s.getFullYear(),e,2,0,0,0)),o=new t(new Date(s.getFullYear(),e,1,0,0,0));n.value=String(e),n.text=a.toLocaleString(this.picker.options.lang,{month:"long"}),this.lockPlugin&&(n.disabled=this.lockPlugin.options.minDate&&o.isBefore(new t(this.lockPlugin.options.minDate),"month")||this.lockPlugin.options.maxDate&&o.isAfter(new t(this.lockPlugin.options.maxDate),"month")),n.selected=o.getMonth()===s.getMonth(),i.appendChild(n)}i.addEventListener("change",(e=>{const t=e.target;this.picker.calendars[0].setDate(1),this.picker.calendars[0].setMonth(Number(t.value)),this.picker.renderAll()})),e.prepend(i)}if(this.options.dropdown.years){e.childNodes[1].remove();const i=document.createElement("select");i.className="month-name--select";const n=this.options.dropdown.minYear,a=this.options.dropdown.maxYear?this.options.dropdown.maxYear:(new Date).getFullYear();if(s.getFullYear()>a){const e=document.createElement("option");e.value=String(s.getFullYear()),e.text=String(s.getFullYear()),e.selected=!0,e.disabled=!0,i.appendChild(e)}for(let e=a;e>=n;e-=1){const n=document.createElement("option"),a=new t(new Date(e,0,1,0,0,0));n.value=String(e),n.text=String(e),this.lockPlugin&&(n.disabled=this.lockPlugin.options.minDate&&a.isBefore(new t(this.lockPlugin.options.minDate),"year")||this.lockPlugin.options.maxDate&&a.isAfter(new t(this.lockPlugin.options.maxDate),"year")),n.selected=s.getFullYear()===e,i.appendChild(n)}if(s.getFullYear()<n){const e=document.createElement("option");e.value=String(s.getFullYear()),e.text=String(s.getFullYear()),e.selected=!0,e.disabled=!0,i.appendChild(e)}if("asc"===this.options.dropdown.years){const e=Array.prototype.slice.call(i.childNodes).reverse();i.innerHTML="",e.forEach((e=>{e.innerHTML=e.value,i.appendChild(e)}))}i.addEventListener("change",(e=>{const t=e.target;this.picker.calendars[0].setFullYear(Number(t.value)),this.picker.renderAll()})),e.appendChild(i)}}}handleResetButton(e){const{view:t,target:i}=e.detail;if("CalendarHeader"===t&&this.options.resetButton){const e=document.createElement("button");e.className="reset-button unit",e.innerHTML=this.options.locale.resetButton,e.addEventListener("click",(e=>{e.preventDefault();let t=!0;"function"==typeof this.options.resetButton&&(t=this.options.resetButton.call(this)),t&&this.picker.clear()})),i.appendChild(e)}}handleWeekNumbers(e){if(this.options.weekNumbers){const{view:i,target:n}=e.detail;if("CalendarDayNames"===i){const e=document.createElement("div");e.className="wnum-header",e.innerHTML="Wk",n.prepend(e)}"CalendarDays"===i&&[...n.children].forEach(((e,i)=>{if(0===i||i%7==0){let i;if(e.classList.contains("day"))i=new t(e.dataset.time);else{const e=n.querySelector(".day");i=new t(e.dataset.time)}let s=i.getWeek(this.picker.options.firstDay);53===s&&0===i.getMonth()&&(s="53/1");const a=document.createElement("div");a.className="wnum-item",a.innerHTML=String(s),n.insertBefore(a,e)}}))}}},e.DateTime=t,e.KbdPlugin=class extends o{docElement=null;rangePlugin;binds={onView:this.onView.bind(this),onKeydown:this.onKeydown.bind(this)};options={unitIndex:1,dayIndex:2};getName(){return"KbdPlugin"}onAttach(){const e=this.picker.options.element,t=e.getBoundingClientRect();if(this.docElement=document.createElement("span"),this.docElement.style.position="absolute",this.docElement.style.top=`${e.offsetTop}px`,this.docElement.style.left=e.offsetLeft+t.width-25+"px",this.docElement.attachShadow({mode:"open"}),this.options.html)this.docElement.shadowRoot.innerHTML=this.options.html;else{const e=`\n <style>\n button {\n border: none;\n background: transparent;\n font-size: ${window.getComputedStyle(this.picker.options.element).fontSize};\n }\n </style>\n\n <button>&#128197;</button>\n `;this.docElement.shadowRoot.innerHTML=e}const i=this.docElement.shadowRoot.querySelector("button");i&&(i.addEventListener("click",(e=>{e.preventDefault(),this.picker.show({target:this.picker.options.element})}),{capture:!0}),i.addEventListener("keydown",(e=>{"Escape"===e.code&&this.picker.hide()}),{capture:!0})),this.picker.options.element.after(this.docElement),this.picker.on("view",this.binds.onView),this.picker.on("keydown",this.binds.onKeydown)}onDetach(){this.docElement&&this.docElement.isConnected&&this.docElement.remove(),this.picker.off("view",this.binds.onView),this.picker.off("keydown",this.binds.onKeydown)}onView(e){const{view:t,target:i}=e.detail;i&&"querySelector"in i&&("CalendarDay"!==t||["locked","not-available"].some((e=>i.classList.contains(e)))?[...i.querySelectorAll(".unit:not(.day)")].forEach((e=>e.tabIndex=this.options.unitIndex)):i.tabIndex=this.options.dayIndex)}onKeydown(e){switch(this.onMouseEnter(e),e.code){case"ArrowUp":case"ArrowDown":this.verticalMove(e);break;case"ArrowLeft":case"ArrowRight":this.horizontalMove(e);break;case"Enter":case"Space":this.handleEnter(e);break;case"Escape":this.picker.hide()}}findAllowableDaySibling(e,t,i){const n=Array.from(e.querySelectorAll(`.day[tabindex="${this.options.dayIndex}"]`)),s=n.indexOf(t);return n.filter(((e,t)=>i(t,s)&&e.tabIndex===this.options.dayIndex))[0]}changeMonth(e){const t={ArrowLeft:"previous",ArrowRight:"next"},i=this.picker.ui.container.querySelector(`.${t[e.code]}-button[tabindex="${this.options.unitIndex}"]`);i&&!i.parentElement.classList.contains(`no-${t[e.code]}-month`)&&(i.dispatchEvent(new Event("click",{bubbles:!0})),setTimeout((()=>{let t=null;switch(e.code){case"ArrowLeft":const e=this.picker.ui.container.querySelectorAll(`.day[tabindex="${this.options.dayIndex}"]`);t=e[e.length-1];break;case"ArrowRight":t=this.picker.ui.container.querySelector(`.day[tabindex="${this.options.dayIndex}"]`)}t&&t.focus()})))}verticalMove(e){const t=e.target;if(t.classList.contains("day")){e.preventDefault();const i=this.findAllowableDaySibling(this.picker.ui.container,t,((t,i)=>t===("ArrowUp"===e.code?i-7:i+7)));i&&i.focus()}}horizontalMove(e){const t=e.target;if(t.classList.contains("day")){e.preventDefault();const i=this.findAllowableDaySibling(this.picker.ui.container,t,((t,i)=>t===("ArrowLeft"===e.code?i-1:i+1)));i?i.focus():this.changeMonth(e)}}handleEnter(e){const t=e.target;t.classList.contains("day")&&(e.preventDefault(),t.dispatchEvent(new Event("click",{bubbles:!0})),setTimeout((()=>{if(this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin"),this.rangePlugin||!this.picker.options.autoApply){const e=this.picker.ui.container.querySelector(".day.selected");e&&setTimeout((()=>{e.focus()}))}})))}onMouseEnter(e){e.target.classList.contains("day")&&setTimeout((()=>{const e=this.picker.ui.shadowRoot.activeElement;e&&e.dispatchEvent(new Event("mouseenter",{bubbles:!0}))}))}},e.LockPlugin=class extends o{priority=1;binds={onView:this.onView.bind(this)};options={minDate:null,maxDate:null,minDays:null,maxDays:null,selectForward:null,selectBackward:null,presets:!0,inseparable:!1,filter:null};getName(){return"LockPlugin"}onAttach(){if(this.options.minDate&&(this.options.minDate=new t(this.options.minDate,this.picker.options.format,this.picker.options.lang)),this.options.maxDate&&(this.options.maxDate=new t(this.options.maxDate,this.picker.options.format,this.picker.options.lang),this.options.maxDate instanceof t&&this.picker.options.calendars>1&&this.picker.calendars[0].isSame(this.options.maxDate,"month"))){const e=this.picker.calendars[0].clone().subtract(1,"month");this.picker.gotoDate(e)}if((this.options.minDays||this.options.maxDays||this.options.selectForward||this.options.selectBackward)&&!this.picker.options.plugins.includes("RangePlugin")){const e=["minDays","maxDays","selectForward","selectBackward"];console.warn(`${this.getName()}: options ${e.join(", ")} required RangePlugin.`)}this.picker.on("view",this.binds.onView)}onDetach(){this.picker.off("view",this.binds.onView)}onView(e){const{view:i,target:n,date:s}=e.detail;if("CalendarHeader"===i&&(this.options.minDate instanceof t&&s.isSameOrBefore(this.options.minDate,"month")&&n.classList.add("no-previous-month"),this.options.maxDate instanceof t&&s.isSameOrAfter(this.options.maxDate,"month")&&n.classList.add("no-next-month")),"CalendarMonth"===i){if(this.options.minDate instanceof t){const e=new t(new Date(this.options.minDate.getFullYear(),this.options.minDate.getMonth(),1));s.getTime()<e.getTime()&&n.classList.add("locked")}if(this.options.maxDate instanceof t){const e=new t(new Date(this.options.maxDate.getFullYear(),this.options.maxDate.getMonth(),1));s.getTime()>e.getTime()&&n.classList.add("locked")}}if("CalendarYear"===i&&(this.options.minDate instanceof t&&s.getFullYear()<this.options.minDate.getFullYear()&&n.classList.add("locked"),this.options.maxDate instanceof t&&s.getFullYear()>this.options.maxDate.getFullYear()&&n.classList.add("locked")),"CalendarDay"===i){const e=this.picker.datePicked.length?this.picker.datePicked[0]:null;if(this.testFilter(s))return void n.classList.add("locked");if(this.options.inseparable){if(this.options.minDays){const e=s.clone().subtract(this.options.minDays-1,"day"),t=s.clone().add(this.options.minDays-1,"day");let i=!1,a=!1;for(;e.isBefore(s,"day");){if(this.testFilter(e)){i=!0;break}e.add(1,"day")}for(;t.isAfter(s,"day");){if(this.testFilter(t)){a=!0;break}t.subtract(1,"day")}i&&a&&n.classList.add("not-available")}this.rangeIsNotAvailable(s,e)&&n.classList.add("not-available")}this.dateIsNotAvailable(s,e)&&n.classList.add("not-available")}if(this.options.presets&&"PresetPluginButton"===i){const e=new t(Number(n.dataset.start)),i=new t(Number(n.dataset.end)),s=i.diff(e,"day"),a=this.options.minDays&&s<this.options.minDays,o=this.options.maxDays&&s>this.options.maxDays;(a||o||this.lockMinDate(e)||this.lockMaxDate(e)||this.lockMinDate(i)||this.lockMaxDate(i)||this.rangeIsNotAvailable(e,i))&&n.setAttribute("disabled","disabled")}}dateIsNotAvailable(e,t){return this.lockMinDate(e)||this.lockMaxDate(e)||this.lockMinDays(e,t)||this.lockMaxDays(e,t)||this.lockSelectForward(e)||this.lockSelectBackward(e)}rangeIsNotAvailable(e,t){if(!e||!t)return!1;const i=(e.isSameOrBefore(t,"day")?e:t).clone(),n=(t.isSameOrAfter(e,"day")?t:e).clone();for(;i.isSameOrBefore(n,"day");){if(this.testFilter(i))return!0;i.add(1,"day")}return!1}lockMinDate(e){return this.options.minDate instanceof t&&e.isBefore(this.options.minDate,"day")}lockMaxDate(e){return this.options.maxDate instanceof t&&e.isAfter(this.options.maxDate,"day")}lockMinDays(e,t){if(this.options.minDays&&t){const i=t.clone().subtract(this.options.minDays-1,"day"),n=t.clone().add(this.options.minDays-1,"day");return e.isBetween(i,n)}return!1}lockMaxDays(e,t){if(this.options.maxDays&&t){const i=t.clone().subtract(this.options.maxDays,"day"),n=t.clone().add(this.options.maxDays,"day");return!e.isBetween(i,n)}return!1}lockSelectForward(e){if(1===this.picker.datePicked.length&&this.options.selectForward){const t=this.picker.datePicked[0].clone();return e.isBefore(t,"day")}return!1}lockSelectBackward(e){if(1===this.picker.datePicked.length&&this.options.selectBackward){const t=this.picker.datePicked[0].clone();return e.isAfter(t,"day")}return!1}testFilter(e){return"function"==typeof this.options.filter&&this.options.filter(e,this.picker.datePicked)}},e.PresetPlugin=class extends o{dependencies=["RangePlugin"];binds={onView:this.onView.bind(this),onClick:this.onClick.bind(this)};options={customLabels:["Today","Yesterday","Last 7 Days","Last 30 Days","This Month","Last Month"],customPreset:{},position:"left"};getName(){return"PresetPlugin"}onAttach(){if(!Object.keys(this.options.customPreset).length){const e=new t,i=()=>{const i=e.clone();i.setDate(1);const n=new Date(e.getFullYear(),e.getMonth()+1,0);return[new t(i),new t(n)]},n=()=>{const i=e.clone();i.setMonth(i.getMonth()-1),i.setDate(1);const n=new Date(e.getFullYear(),e.getMonth(),0);return[new t(i),new t(n)]},s=[[e.clone(),e.clone()],[e.clone().subtract(1,"day"),e.clone().subtract(1,"day")],[e.clone().subtract(6,"day"),e.clone()],[e.clone().subtract(29,"day"),e.clone()],i(),n()];Object.values(this.options.customLabels).forEach(((e,t)=>{this.options.customPreset[e]=s[t]}))}this.picker.on("view",this.binds.onView),this.picker.on("click",this.binds.onClick)}onDetach(){this.picker.off("view",this.binds.onView),this.picker.off("click",this.binds.onClick)}onView(e){const{view:t,target:i}=e.detail;if("Main"===t){const e=document.createElement("div");e.className="preset-plugin-container",Object.keys(this.options.customPreset).forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.options.customPreset,t)){const i=this.options.customPreset[t],n=document.createElement("button");n.className="preset-button unit",n.innerHTML=t,n.dataset.start=i[0].getTime(),n.dataset.end=i[1].getTime(),e.appendChild(n),this.picker.trigger("view",{view:"PresetPluginButton",target:n})}})),i.appendChild(e),i.classList.add(`preset-${this.options.position}`),this.picker.trigger("view",{view:"PresetPluginContainer",target:e})}}onClick(e){const i=e.target;if(i instanceof HTMLElement){const e=i.closest(".unit");if(!(e instanceof HTMLElement))return;if(this.isPresetButton(e)){const i=new t(Number(e.dataset.start)),n=new t(Number(e.dataset.end));this.picker.options.autoApply?(this.picker.setDateRange(i,n),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide()):(this.picker.datePicked=[i,n],this.picker.renderAll())}}}isPresetButton(e){return e.classList.contains("preset-button")}},e.RangePlugin=class extends o{tooltipElement;triggerElement;binds={setStartDate:this.setStartDate.bind(this),setEndDate:this.setEndDate.bind(this),setDateRange:this.setDateRange.bind(this),getStartDate:this.getStartDate.bind(this),getEndDate:this.getEndDate.bind(this),onView:this.onView.bind(this),onShow:this.onShow.bind(this),onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),onClickCalendarDay:this.onClickCalendarDay.bind(this),onClickCalendarMonth:this.onClickCalendarMonth.bind(this),onClickCalendarYear:this.onClickCalendarYear.bind(this),onClickApplyButton:this.onClickApplyButton.bind(this),parseValues:this.parseValues.bind(this),updateValues:this.updateValues.bind(this),clear:this.clear.bind(this)};options={elementEnd:null,startDate:null,endDate:null,repick:!1,strict:!0,delimiter:" - ",tooltip:!0,tooltipNumber:e=>e,locale:{zero:"",one:"day",two:"",few:"",many:"",other:"days"},documentClick:this.hidePicker.bind(this)};getName(){return"RangePlugin"}onAttach(){this.binds._setStartDate=this.picker.setStartDate,this.binds._setEndDate=this.picker.setEndDate,this.binds._setDateRange=this.picker.setDateRange,this.binds._getStartDate=this.picker.getStartDate,this.binds._getEndDate=this.picker.getEndDate,this.binds._parseValues=this.picker.parseValues,this.binds._updateValues=this.picker.updateValues,this.binds._clear=this.picker.clear,this.binds._onClickCalendarDay=this.picker.onClickCalendarDay,this.binds._onClickApplyButton=this.picker.onClickApplyButton,this.binds._onClickCalendarMonth=this.picker.onClickCalendarMonth,this.binds._onClickCalendarYear=this.picker.onClickCalendarYear,Object.defineProperties(this.picker,{setStartDate:{configurable:!0,value:this.binds.setStartDate},setEndDate:{configurable:!0,value:this.binds.setEndDate},setDateRange:{configurable:!0,value:this.binds.setDateRange},getStartDate:{configurable:!0,value:this.binds.getStartDate},getEndDate:{configurable:!0,value:this.binds.getEndDate},parseValues:{configurable:!0,value:this.binds.parseValues},updateValues:{configurable:!0,value:this.binds.updateValues},clear:{configurable:!0,value:this.binds.clear},onClickCalendarDay:{configurable:!0,value:this.binds.onClickCalendarDay},onClickCalendarMonth:{configurable:!0,value:this.binds.onClickCalendarMonth},onClickCalendarYear:{configurable:!0,value:this.binds.onClickCalendarYear},onClickApplyButton:{configurable:!0,value:this.binds.onClickApplyButton}}),this.options.elementEnd&&(this.options.elementEnd instanceof HTMLElement||(this.options.elementEnd=this.picker.options.doc.querySelector(this.options.elementEnd)),this.options.elementEnd instanceof HTMLInputElement&&(this.options.elementEnd.readOnly=this.picker.options.readonly),"function"==typeof this.picker.options.documentClick&&(document.removeEventListener("click",this.picker.options.documentClick,!0),"function"==typeof this.options.documentClick&&document.addEventListener("click",this.options.documentClick,!0)),this.options.elementEnd.addEventListener("click",this.picker.show.bind(this.picker))),this.options.repick=this.options.repick&&this.options.elementEnd instanceof HTMLElement,this.picker.options.date=null,this.picker.on("view",this.binds.onView),this.picker.on("show",this.binds.onShow),this.picker.on("mouseenter",this.binds.onMouseEnter,!0),this.picker.on("mouseleave",this.binds.onMouseLeave,!0),this.checkIntlPluralLocales()}onDetach(){Object.defineProperties(this.picker,{setStartDate:{configurable:!0,value:this.binds._setStartDate},setEndDate:{configurable:!0,value:this.binds._setEndDate},setDateRange:{configurable:!0,value:this.binds._setDateRange},getStartDate:{configurable:!0,value:this.binds._getStartDate},getEndDate:{configurable:!0,value:this.binds._getEndDate},parseValues:{configurable:!0,value:this.binds._parseValues},updateValues:{configurable:!0,value:this.binds._updateValues},clear:{configurable:!0,value:this.binds._clear},onClickCalendarDay:{configurable:!0,value:this.binds._onClickCalendarDay},onClickCalendarMonth:{configurable:!0,value:this.binds._onClickCalendarMonth},onClickCalendarYear:{configurable:!0,value:this.binds._onClickCalendarYear},onClickApplyButton:{configurable:!0,value:this.binds._onClickApplyButton}}),this.picker.off("view",this.binds.onView),this.picker.off("show",this.binds.onShow),this.picker.off("mouseenter",this.binds.onMouseEnter,!0),this.picker.off("mouseleave",this.binds.onMouseLeave,!0)}parseValues(){if(this.options.startDate||this.options.endDate)this.options.strict?this.options.startDate&&this.options.endDate?this.setDateRange(this.options.startDate,this.options.endDate):(this.options.startDate=null,this.options.endDate=null):(this.options.startDate&&this.setStartDate(this.options.startDate),this.options.endDate&&this.setEndDate(this.options.endDate));else if(this.options.elementEnd)this.options.strict?this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length&&this.options.elementEnd instanceof HTMLInputElement&&this.options.elementEnd.value.length&&this.setDateRange(this.picker.options.element.value,this.options.elementEnd.value):(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length&&this.setStartDate(this.picker.options.element.value),this.options.elementEnd instanceof HTMLInputElement&&this.options.elementEnd.value.length&&this.setEndDate(this.options.elementEnd.value));else if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const[e,t]=this.picker.options.element.value.split(this.options.delimiter);this.options.strict?e&&t&&this.setDateRange(e,t):(e&&this.setStartDate(e),t&&this.setEndDate(t))}}updateValues(){const e=this.picker.options.element,t=this.options.elementEnd,i=this.picker.getStartDate(),n=this.picker.getEndDate(),s=i instanceof Date?i.format(this.picker.options.format,this.picker.options.lang):"",a=n instanceof Date?n.format(this.picker.options.format,this.picker.options.lang):"";if(t)e instanceof HTMLInputElement?e.value=s:e instanceof HTMLElement&&(e.innerText=s),t instanceof HTMLInputElement?t.value=a:t instanceof HTMLElement&&(t.innerText=a);else{const t=`${s}${s||a?this.options.delimiter:""}${a}`;e instanceof HTMLInputElement?e.value=t:e instanceof HTMLElement&&(e.innerText=t)}}clear(){this.options.startDate=null,this.options.endDate=null,this.picker.datePicked.length=0,this.updateValues(),this.picker.renderAll(),this.picker.trigger("clear")}onShow(e){const{target:t}=e.detail;this.triggerElement=t,this.picker.options.scrollToDate&&this.getStartDate()instanceof Date&&this.picker.gotoDate(this.getStartDate()),this.initializeRepick()}onView(e){const{view:i,target:n}=e.detail;if("Main"===i&&(this.tooltipElement=document.createElement("span"),this.tooltipElement.className="range-plugin-tooltip",n.appendChild(this.tooltipElement)),"CalendarDay"===i){const e=new t(n.dataset.time),i=this.picker.datePicked,s=i.length?this.picker.datePicked[0]:this.getStartDate(),a=i.length?this.picker.datePicked[1]:this.getEndDate();s&&s.isSame(e,"day")&&n.classList.add("start"),s&&a&&(a.isSame(e,"day")&&n.classList.add("end"),e.isBetween(s,a)&&n.classList.add("in-range"))}if("CalendarMonth"===i){const e=new t(n.dataset.time),i=this.picker.datePicked,s=i.length?this.picker.datePicked[0]:this.getStartDate(),a=1===i.length?null:i.length>=2?this.picker.datePicked[1]:this.getEndDate();if(s&&s.isSame(e,"month")&&(n.classList.add("start"),n.classList.add("selected")),s&&a){a.isSame(e,"month")&&(n.classList.add("end"),n.classList.add("selected"));const i=new t(new Date(s.getFullYear(),s.getMonth(),1)),o=new t(new Date(a.getFullYear(),a.getMonth(),1));e.getTime()>i.getTime()&&e.getTime()<o.getTime()&&n.classList.add("in-range")}}if("CalendarYear"===i){const e=new t(n.dataset.time),i=this.picker.datePicked,s=i.length?this.picker.datePicked[0]:this.getStartDate(),a=1===i.length?null:i.length>=2?this.picker.datePicked[1]:this.getEndDate();s&&e.getFullYear()===s.getFullYear()&&(n.classList.add("start"),n.classList.add("selected")),s&&a&&(e.getFullYear()===a.getFullYear()&&(n.classList.add("end"),n.classList.add("selected")),e.getFullYear()>s.getFullYear()&&e.getFullYear()<a.getFullYear()&&n.classList.add("in-range"))}if("Footer"===i){const e=1===this.picker.datePicked.length&&!this.options.strict||2===this.picker.datePicked.length;n.querySelector(".apply-button").disabled=!e}}hidePicker(e){let t=e.target,i=null;t.shadowRoot&&(t=e.composedPath()[0],i=t.getRootNode().host),this.picker.isShown()&&i!==this.picker.ui.wrapper&&t!==this.picker.options.element&&t!==this.options.elementEnd&&this.picker.hide()}setStartDate(e){const i=new t(e,this.picker.options.format);this.options.startDate=i?i.clone():null,this.updateValues(),this.picker.renderAll()}setEndDate(e){const i=new t(e,this.picker.options.format);this.options.endDate=i?i.clone():null,this.updateValues(),this.picker.renderAll()}setDateRange(e,i){const n=new t(e,this.picker.options.format),s=new t(i,this.picker.options.format);this.options.startDate=n?n.clone():null,this.options.endDate=s?s.clone():null,this.updateValues(),this.picker.renderAll()}getStartDate(){return this.options.startDate instanceof Date?this.options.startDate.clone():null}getEndDate(){return this.options.endDate instanceof Date?this.options.endDate.clone():null}onMouseEnter(e){const i=e.target;if(i instanceof HTMLElement){this.isContainer(i)&&this.initializeRepick();const e=i.closest(".unit");if(!(e instanceof HTMLElement))return;if(this.picker.isCalendarDay(e)){if(1!==this.picker.datePicked.length)return;let i=this.picker.datePicked[0].clone(),n=new t(e.dataset.time),s=!1;if(i.isAfter(n,"day")){const e=i.clone();i=n.clone(),n=e.clone(),s=!0}if([...this.picker.ui.container.querySelectorAll(".day")].forEach((a=>{const o=new t(a.dataset.time),r=this.picker.Calendar.getCalendarDayView(o);o.isBetween(i,n)&&r.classList.add("in-range"),o.isSame(this.picker.datePicked[0],"day")&&(r.classList.add("start"),r.classList.toggle("flipped",s)),a===e&&(r.classList.add("end"),r.classList.toggle("flipped",s)),a.className=r.className})),this.options.tooltip){const t=this.options.tooltipNumber(n.diff(i,"day")+1);if(t>0){const i=new Intl.PluralRules(this.picker.options.lang).select(t),n=`${t} ${this.options.locale[i]}`;this.showTooltip(e,n)}else this.hideTooltip()}}}}onMouseLeave(e){if(this.isContainer(e.target)&&this.options.repick){const e=this.getStartDate(),t=this.getEndDate();e&&t&&(this.picker.datePicked.length=0,this.picker.renderAll())}}onClickCalendarDay(e){if(this.picker.isCalendarDay(e)){2===this.picker.datePicked.length&&(this.picker.datePicked.length=0);const i=new t(e.dataset.time);if(this.picker.datePicked[this.picker.datePicked.length]=i,2===this.picker.datePicked.length&&this.picker.datePicked[0].isAfter(this.picker.datePicked[1])){const e=this.picker.datePicked[1].clone();this.picker.datePicked[1]=this.picker.datePicked[0].clone(),this.picker.datePicked[0]=e.clone()}1!==this.picker.datePicked.length&&this.picker.options.autoApply||this.picker.trigger("preselect",{start:this.picker.datePicked[0]instanceof Date?this.picker.datePicked[0].clone():null,end:this.picker.datePicked[1]instanceof Date?this.picker.datePicked[1].clone():null}),1===this.picker.datePicked.length&&(!this.options.strict&&this.picker.options.autoApply&&(this.picker.options.element===this.triggerElement&&this.setStartDate(this.picker.datePicked[0]),this.options.elementEnd===this.triggerElement&&this.setEndDate(this.picker.datePicked[0]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()})),this.picker.renderAll()),2===this.picker.datePicked.length&&(this.picker.options.autoApply?(this.setDateRange(this.picker.datePicked[0],this.picker.datePicked[1]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide()):(this.hideTooltip(),this.picker.renderAll()))}}onClickCalendarMonth(e){this.picker.isCalendarMonth(e)&&this.handleRangeClick(e,"month")}onClickCalendarYear(e){this.picker.isCalendarYear(e)&&this.handleRangeClick(e,"year")}handleRangeClick(e,i){2===this.picker.datePicked.length&&(this.picker.datePicked.length=0);const n=new t(e.dataset.time);if(this.picker.datePicked[this.picker.datePicked.length]=n,2===this.picker.datePicked.length&&this.picker.datePicked[0].isAfter(this.picker.datePicked[1],i)){const e=this.picker.datePicked[1].clone();this.picker.datePicked[1]=this.picker.datePicked[0].clone(),this.picker.datePicked[0]=e.clone()}1!==this.picker.datePicked.length&&this.picker.options.autoApply||this.picker.trigger("preselect",{start:this.picker.datePicked[0]instanceof Date?this.picker.datePicked[0].clone():null,end:this.picker.datePicked[1]instanceof Date?this.picker.datePicked[1].clone():null}),1===this.picker.datePicked.length&&this.picker.renderAll(),2===this.picker.datePicked.length&&(this.picker.options.autoApply?(this.setDateRange(this.picker.datePicked[0],this.picker.datePicked[1]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide()):this.picker.renderAll())}onClickApplyButton(e){this.picker.isApplyButton(e)&&(1!==this.picker.datePicked.length||this.options.strict||(this.picker.options.element===this.triggerElement&&(this.options.endDate=null,this.setStartDate(this.picker.datePicked[0])),this.options.elementEnd===this.triggerElement&&(this.options.startDate=null,this.setEndDate(this.picker.datePicked[0]))),2===this.picker.datePicked.length&&this.setDateRange(this.picker.datePicked[0],this.picker.datePicked[1]),this.picker.trigger("select",{start:this.picker.getStartDate(),end:this.picker.getEndDate()}),this.picker.hide())}showTooltip(e,t){this.tooltipElement.style.visibility="visible",this.tooltipElement.innerHTML=t;const i=this.picker.ui.container.getBoundingClientRect(),n=this.tooltipElement.getBoundingClientRect(),s=e.getBoundingClientRect();let a=s.top,o=s.left;a-=i.top,o-=i.left,a-=n.height,o-=n.width/2,o+=s.width/2,this.tooltipElement.style.top=`${a}px`,this.tooltipElement.style.left=`${o}px`}hideTooltip(){this.tooltipElement.style.visibility="hidden"}checkIntlPluralLocales(){if(!this.options.tooltip)return;const e=[...new Set([new Intl.PluralRules(this.picker.options.lang).select(0),new Intl.PluralRules(this.picker.options.lang).select(1),new Intl.PluralRules(this.picker.options.lang).select(2),new Intl.PluralRules(this.picker.options.lang).select(6),new Intl.PluralRules(this.picker.options.lang).select(18)])],t=Object.keys(this.options.locale);e.every((e=>t.includes(e)))||console.warn(`${this.getName()}: provide locales (${e.join(", ")}) for correct tooltip text.`)}initializeRepick(){if(!this.options.repick)return;const e=this.getStartDate(),t=this.getEndDate();t&&this.triggerElement===this.picker.options.element&&(this.picker.datePicked[0]=t),e&&this.triggerElement===this.options.elementEnd&&(this.picker.datePicked[0]=e)}isContainer(e){return e===this.picker.ui.container}},e.TimePlugin=class extends o{options={native:!1,seconds:!1,stepHours:1,stepMinutes:5,stepSeconds:5,format12:!1};rangePlugin;timePicked={input:null,start:null,end:null};timePrePicked={input:null,start:null,end:null};binds={getDate:this.getDate.bind(this),getStartDate:this.getStartDate.bind(this),getEndDate:this.getEndDate.bind(this),onView:this.onView.bind(this),onInput:this.onInput.bind(this),onChange:this.onChange.bind(this),onClick:this.onClick.bind(this),setTime:this.setTime.bind(this),setStartTime:this.setStartTime.bind(this),setEndTime:this.setEndTime.bind(this)};getName(){return"TimePlugin"}onAttach(){this.binds._getDate=this.picker.getDate,this.binds._getStartDate=this.picker.getStartDate,this.binds._getEndDate=this.picker.getEndDate,Object.defineProperties(this.picker,{getDate:{configurable:!0,value:this.binds.getDate},getStartDate:{configurable:!0,value:this.binds.getStartDate},getEndDate:{configurable:!0,value:this.binds.getEndDate},setTime:{configurable:!0,value:this.binds.setTime},setStartTime:{configurable:!0,value:this.binds.setStartTime},setEndTime:{configurable:!0,value:this.binds.setEndTime}}),this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin"),this.parseValues(),this.picker.on("view",this.binds.onView),this.picker.on("input",this.binds.onInput),this.picker.on("change",this.binds.onChange),this.picker.on("click",this.binds.onClick)}onDetach(){delete this.picker.setTime,delete this.picker.setStartTime,delete this.picker.setEndTime,Object.defineProperties(this.picker,{getDate:{configurable:!0,value:this.binds._getDate},getStartDate:{configurable:!0,value:this.binds._getStartDate},getEndDate:{configurable:!0,value:this.binds._getEndDate}}),this.picker.off("view",this.binds.onView),this.picker.off("input",this.binds.onInput),this.picker.off("change",this.binds.onChange),this.picker.off("click",this.binds.onClick)}onView(e){const{view:t,target:i}=e.detail;if("Main"===t){this.rangePlugin=this.picker.PluginManager.getInstance("RangePlugin");const e=document.createElement("div");if(e.className="time-plugin-container",this.rangePlugin){const t=this.getStartInput();e.appendChild(t),this.picker.trigger("view",{view:"TimePluginInput",target:t});const i=this.getEndInput();e.appendChild(i),this.picker.trigger("view",{view:"TimePluginInput",target:i})}else{const t=this.getSingleInput();e.appendChild(t),this.picker.trigger("view",{view:"TimePluginInput",target:t})}i.appendChild(e),this.picker.trigger("view",{view:"TimePluginContainer",target:e})}}onInput(e){const i=e.target;if(i instanceof HTMLInputElement&&i.classList.contains("time-plugin-input")){const e=this.timePicked[i.name]||new t,[n,s]=i.value.split(":");e.setHours(Number(n)||0,Number(s)||0,0,0),this.picker.options.autoApply?(this.timePicked[i.name]=e,this.picker.updateValues()):this.timePrePicked[i.name]=e}}onChange(e){const i=e.target;if(i instanceof HTMLSelectElement&&i.classList.contains("time-plugin-custom-input")){const e=/(\w+)\[(\w+)\]/,[,n,s]=i.name.match(e),a=Number(i.value);let o=new t;switch(!this.picker.options.autoApply&&this.timePrePicked[n]instanceof Date?o=this.timePrePicked[n].clone():this.timePicked[n]instanceof Date&&(o=this.timePicked[n].clone()),s){case"HH":if(this.options.format12){const e=i.closest(".time-plugin-custom-block").querySelector(`select[name="${n}[period]"]`).value,t=this.handleFormat12(e,o,a);o.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}else o.setHours(a,o.getMinutes(),o.getSeconds(),0);break;case"mm":o.setHours(o.getHours(),a,o.getSeconds(),0);break;case"ss":o.setHours(o.getHours(),o.getMinutes(),a,0);break;case"period":if(this.options.format12){const e=i.closest(".time-plugin-custom-block").querySelector(`select[name="${n}[HH]"]`).value,t=this.handleFormat12(i.value,o,Number(e));o.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}}if(this.picker.options.autoApply)this.timePicked[n]=o,this.picker.updateValues();else{this.timePrePicked[n]=o;const e=this.picker.ui.container.querySelector(".apply-button");if(this.rangePlugin){const t=this.rangePlugin.options,i=this.picker.datePicked,n=t.strict&&2===i.length||!t.strict&&i.length>0||!i.length&&t.strict&&t.startDate instanceof Date&&t.endDate instanceof Date||!i.length&&!t.strict&&(t.startDate instanceof Date||t.endDate instanceof Date);e.disabled=!n}else this.picker.datePicked.length&&(e.disabled=!1)}}}onClick(e){const t=e.target;if(t instanceof HTMLElement){const e=t.closest(".unit");if(!(e instanceof HTMLElement))return;this.picker.isApplyButton(e)&&(Object.keys(this.timePicked).forEach((e=>{this.timePrePicked[e]instanceof Date&&(this.timePicked[e]=this.timePrePicked[e].clone())})),this.picker.updateValues(),this.timePrePicked={input:null,start:null,end:null}),this.picker.isCancelButton(e)&&(this.timePrePicked={input:null,start:null,end:null},this.picker.renderAll())}}setTime(e){const t=this.handleTimeString(e);this.timePicked.input=t.clone(),this.picker.renderAll(),this.picker.updateValues()}setStartTime(e){const t=this.handleTimeString(e);this.timePicked.start=t.clone(),this.picker.renderAll(),this.picker.updateValues()}setEndTime(e){const t=this.handleTimeString(e);this.timePicked.end=t.clone(),this.picker.renderAll(),this.picker.updateValues()}handleTimeString(e){const i=new t,[n,s,a]=e.split(":").map((e=>Number(e))),o=n&&!Number.isNaN(n)?n:0,r=s&&!Number.isNaN(s)?s:0,c=a&&!Number.isNaN(a)?a:0;return i.setHours(o,r,c,0),i}getDate(){if(this.picker.options.date instanceof Date){const e=new t(this.picker.options.date,this.picker.options.format);if(this.timePicked.input instanceof Date){const t=this.timePicked.input;e.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}return e}return null}getStartDate(){if(this.rangePlugin.options.startDate instanceof Date){const e=new t(this.rangePlugin.options.startDate,this.picker.options.format);if(this.timePicked.start instanceof Date){const t=this.timePicked.start;e.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}return e}return null}getEndDate(){if(this.rangePlugin.options.endDate instanceof Date){const e=new t(this.rangePlugin.options.endDate,this.picker.options.format);if(this.timePicked.end instanceof Date){const t=this.timePicked.end;e.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),0)}return e}return null}getSingleInput(){return this.options.native?this.getNativeInput("input"):this.getCustomInput("input")}getStartInput(){return this.options.native?this.getNativeInput("start"):this.getCustomInput("start")}getEndInput(){return this.options.native?this.getNativeInput("end"):this.getCustomInput("end")}getNativeInput(e){const t=document.createElement("input");t.type="time",t.name=e,t.className="time-plugin-input unit";const i=this.timePicked[e];if(i){const e=`0${i.getHours()}`.slice(-2),n=`0${i.getMinutes()}`.slice(-2);t.value=`${e}:${n}`}return t}getCustomInput(e){const t=document.createElement("div");t.className="time-plugin-custom-block";const i=document.createElement("select");i.className="time-plugin-custom-input unit",i.name=`${e}[HH]`;const n=this.options.format12?1:0,s=this.options.format12?13:24;let a=null;!this.picker.options.autoApply&&this.timePrePicked[e]instanceof Date?a=this.timePrePicked[e].clone():this.timePicked[e]instanceof Date&&(a=this.timePicked[e].clone());for(let e=n;e<s;e+=this.options.stepHours){const t=document.createElement("option");t.value=String(e),t.text=String(e),a&&(this.options.format12?(a.getHours()%12?a.getHours()%12:12)===e&&(t.selected=!0):a.getHours()===e&&(t.selected=!0)),i.appendChild(t)}t.appendChild(i);const o=document.createElement("select");o.className="time-plugin-custom-input unit",o.name=`${e}[mm]`;for(let e=0;e<60;e+=this.options.stepMinutes){const t=document.createElement("option");t.value=`0${String(e)}`.slice(-2),t.text=`0${String(e)}`.slice(-2),a&&a.getMinutes()===e&&(t.selected=!0),o.appendChild(t)}if(t.appendChild(o),this.options.seconds){const i=document.createElement("select");i.className="time-plugin-custom-input unit",i.name=`${e}[ss]`;const n=60;for(let e=0;e<n;e+=this.options.stepSeconds){const t=document.createElement("option");t.value=`0${String(e)}`.slice(-2),t.text=`0${String(e)}`.slice(-2),a&&a.getSeconds()===e&&(t.selected=!0),i.appendChild(t)}t.appendChild(i)}if(this.options.format12){const i=document.createElement("select");i.className="time-plugin-custom-input unit",i.name=`${e}[period]`,["AM","PM"].forEach((e=>{const t=document.createElement("option");t.value=e,t.text=e,a&&"PM"===e&&a.getHours()>=12&&(t.selected=!0),i.appendChild(t)})),t.appendChild(i)}return t}handleFormat12(e,t,i){const n=t.clone();switch(e){case"AM":12===i?n.setHours(0,n.getMinutes(),n.getSeconds(),0):n.setHours(i,n.getMinutes(),n.getSeconds(),0);break;case"PM":12!==i?n.setHours(i+12,n.getMinutes(),n.getSeconds(),0):n.setHours(i,n.getMinutes(),n.getSeconds(),0)}return n}parseValues(){if(this.rangePlugin){if(this.rangePlugin.options.strict){if(this.rangePlugin.options.startDate&&this.rangePlugin.options.endDate){const e=new t(this.rangePlugin.options.startDate,this.picker.options.format),i=new t(this.rangePlugin.options.endDate,this.picker.options.format);this.timePicked.start=e.clone(),this.timePicked.end=i.clone()}}else{if(this.rangePlugin.options.startDate){const e=new t(this.rangePlugin.options.startDate,this.picker.options.format);this.timePicked.start=e.clone()}if(this.rangePlugin.options.endDate){const e=new t(this.rangePlugin.options.endDate,this.picker.options.format);this.timePicked.end=e.clone()}}if(this.rangePlugin.options.elementEnd)if(this.rangePlugin.options.strict){if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length&&this.rangePlugin.options.elementEnd instanceof HTMLInputElement&&this.rangePlugin.options.elementEnd.value.length){const e=new t(this.picker.options.element.value,this.picker.options.format),i=new t(this.rangePlugin.options.elementEnd.value,this.picker.options.format);this.timePicked.start=e.clone(),this.timePicked.end=i.clone()}}else{if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const e=new t(this.picker.options.element.value,this.picker.options.format);this.timePicked.start=e.clone()}if(this.rangePlugin.options.elementEnd instanceof HTMLInputElement&&this.rangePlugin.options.elementEnd.value.length){const e=new t(this.rangePlugin.options.elementEnd.value,this.picker.options.format);this.timePicked.start=e.clone()}}else if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const[e,i]=this.picker.options.element.value.split(this.rangePlugin.options.delimiter);if(this.rangePlugin.options.strict){if(e&&i){const n=new t(e,this.picker.options.format),s=new t(i,this.picker.options.format);this.timePicked.start=n.clone(),this.timePicked.end=s.clone()}}else{if(e){const i=new t(e,this.picker.options.format);this.timePicked.start=i.clone()}if(i){const e=new t(i,this.picker.options.format);this.timePicked.start=e.clone()}}}}else{if(this.picker.options.date){const e=new t(this.picker.options.date,this.picker.options.format);this.timePicked.input=e.clone()}if(this.picker.options.element instanceof HTMLInputElement&&this.picker.options.element.value.length){const e=new t(this.picker.options.element.value,this.picker.options.format);this.timePicked.input=e.clone()}}}},e.create=s,e.easepick=a,Object.defineProperty(e,"__esModule",{value:!0})}));
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@yuafox/easepick2",
3
+ "description": "A modern, lightweight date picker with day, month, and year view modes.",
4
+ "version": "2.0.0",
5
+ "main": "dist/index.umd.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "dependencies": {
9
+ "@yuafox/easepick2-core": "^2.0.0",
10
+ "@yuafox/easepick2-datetime": "^2.0.0",
11
+ "@yuafox/easepick2-base-plugin": "^2.0.0",
12
+ "@yuafox/easepick2-kbd-plugin": "^2.0.0",
13
+ "@yuafox/easepick2-lock-plugin": "^2.0.0",
14
+ "@yuafox/easepick2-preset-plugin": "^2.0.0",
15
+ "@yuafox/easepick2-range-plugin": "^2.0.0",
16
+ "@yuafox/easepick2-time-plugin": "^2.0.0",
17
+ "@yuafox/easepick2-amp-plugin": "^2.0.0"
18
+ },
19
+ "author": {
20
+ "name": "YuaFox"
21
+ },
22
+ "license": "GPL-2.0-or-later",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/YuaFox/easepick2.git",
26
+ "directory": "packages/bundle"
27
+ },
28
+ "homepage": "https://github.com/YuaFox/easepick2",
29
+ "bugs": {
30
+ "url": "https://github.com/YuaFox/easepick2/issues"
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ]
35
+ }