PageSourceSearch

https://aeroscreen.ru/bitrix/js/ui/date-picker/dist/date-picker.bundle.min.js?178186049672598

js aeroscreen.ru collected 2026-10-08 23:48:33 UTC 72,598 bytes, 265 lines download raw bytes

1this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,t,s,i,n,r){"use strict";class a extends i.EventEmitter{#e=null;#t=new s.MemoryCache;#s=false;constructor(e){super();this.setEventNamespace("BX.UI.DatePicker.BasePicker");this.#e=e}getContainer(){throw new Error("You must implement getContainer method")}getHeaderContainer(...e){return this.#t.remember("header",(()=>t.Tag.render`<div class="ui-date-picker-header">${e}</div>`))}getContentContainer(...e){return this.#t.remember("content",(()=>t.Tag.render`<div class="ui-date-picker-content">${e}</div>`))}getPrevBtn(){return this.#t.remember("prev-button",(()=>t.Tag.render`
2				<button type="button" class="ui-date-picker-button --left-arrow" onclick="${this.handlePrevBtnClick.bind(this)}">
3					<span class="ui-icon-set --chevron-left" style="--ui-icon-set__icon-size: 20px"></span>
4				</button>
5			`))}getNextBtn(){return this.#t.remember("next-button",(()=>t.Tag.render`
6				<button type="button" class="ui-date-picker-button --right-arrow" onclick="${this.handleNextBtnClick.bind(this)}">
7					<span class="ui-icon-set --chevron-right" style="--ui-icon-set__icon-size: 20px"></span>
8				</button>
9			`))}handlePrevBtnClick(){this.emit("onPrevBtnClick")}handleNextBtnClick(){this.emit("onNextBtnClick")}render(){throw new Error("You must implement render method")}onShow(){}onHide(){}getDatePicker(){return this.#e}isRendered(){return this.#s}renderTo(e){t.Dom.append(this.getContainer(),e);this.#s=true}}function o(e){const t=new Date(e.getTime());if(e.__utc){t.__utc=true}return t}function l(e){const t=e.getUTCMonth();const s=e.getUTCFullYear();const i=[31,29,31,30,31,30,31,31,30,31,30,31];if(t!==1||s%4===0&&s%100!==0||s%400===0){return i[t]}return 28}function u(e,t,s){let i=o(e);if(!t||s===0){return i}switch(t.toLowerCase()){case"milli":i=new Date(e.getTime()+s);break;case"second":i=new Date(e.getTime()+s*1e3);break;case"minute":i=new Date(e.getTime()+s*6e4);break;case"hour":i=new Date(e.getTime()+s*36e5);break;case"day":i.setUTCDate(e.getUTCDate()+s);break;case"week":i.setUTCDate(e.getUTCDate()+s*7);break;case"month":{let t=e.getUTCDate();if(t>28){const i=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1));t=Math.min(t,l(u(i,"month",s)))}i.setUTCDate(t);i.setUTCMonth(i.getUTCMonth()+s);break}case"quarter":i=u(e,"month",s*3);break;case"year":i.setUTCFullYear(e.getUTCFullYear()+s);break}if(e.__utc){i.__utc=true}return i}function d(e,t,s){let i=o(e);switch(t){case"day":i.setUTCHours(0,0,0,0);break;case"week":{const e=i.getUTCDay();i.setUTCHours(0,0,0,0);if(e!==s){const t=(e-s+7)%7;i=u(i,"day",-t)}break}case"month":i.setUTCHours(0,0,0,0);i.setUTCDate(1);break;case"hour":i.setUTCMinutes(0,0,0);break;case"minute":i.setUTCSeconds(0);i.setUTCMilliseconds(0);break;case"second":i.setUTCMilliseconds(0);break;case"year":i=new Date(Date.UTC(e.getUTCFullYear(),0,1));break;case"quarter":{i.setUTCHours(0,0,0,0);i.setUTCDate(1);i=u(i,"month",-(i.getUTCMonth()%3));break}}if(e.__utc){i.__utc=true}return i}function c(e,t,s=1,i=0){let n=o(e);switch(t){case"day":n.setUTCMinutes(0,0,0);n=u(n,"day",s);break;case"week":{const e=n.getUTCDay();n=u(n,"day",7*(s-1)+(e<i?i-e:7-e+i));break}case"month":n=u(n,"month",s);n.setUTCDate(1);break;case"quarter":n=u(n,"month",(s-1)*3+(3-n.getUTCMonth()%3));break;case"year":n=new Date(Date.UTC(n.getUTCFullYear()+s,0,1));break;default:n=u(e,t,s)}if(e.__utc){n.__utc=true}return n}function h(e,t,s,i){const n=o(e);if(t==="week"){n.setUTCHours(0,0,0,0);return u(d(n,t,i),t,1)}switch(t){case"hour":n.setUTCMinutes(0,0,0);break;case"minute":n.setUTCSeconds(0,0);break;case"second":n.setUTCMilliseconds(0);break;default:n.setUTCHours(0,0,0,0)}return c(n,t,s)}function m(e,t=0,s=1,i=0,n=0,r=0,a=0){const o=new Date(Date.UTC(e,t,s,i,n,r,a));if(e<100&&e>=0){o.setUTCFullYear(e)}o.__utc=true;return o}function g(e){const t=e.getUTCHours();const s=t%12===0?12:t%12;const i=t>11?"pm":"am";return{day:e.getUTCDate(),month:e.getUTCMonth(),year:e.getUTCFullYear(),weekDay:e.getUTCDay(),hours:t,hours12:s,minutes:e.getUTCMinutes(),seconds:e.getUTCSeconds(),dayPeriod:i,fullDay:String(e.getUTCDate()).padStart(2,"0"),fullHours:String(t).padStart(2,"0"),fullHours12:String(s).padStart(2,"0"),fullMinutes:String(e.getUTCMinutes()).padStart(2,"0")}}function f(e,s,i="day"){if(!t.Type.isDate(e)||!t.Type.isDate(s)){return false}const{day:n,month:r,year:a,hours:o,minutes:l,seconds:u}=g(e);const{day:d,month:c,year:h,hours:m,minutes:f,seconds:p}=g(s);if(i==="day"){return n===d&&r===c&&a===h}if(i==="datetime"){return n===d&&r===c&&a===h&&o===m&&l===f&&u===p}if(i==="month"){return r===c&&a===h}if(i==="year"){return a===h}return false}class p extends a{#t=new s.MemoryCache;#i=null;#n=null;getContainer(){return this.#t.remember("container",(()=>t.Tag.render`
10				<div class="ui-day-picker${this.getDatePicker().isFullYear()?" --full-year":""}">
11					${this.getHeader()}
12					${this.getContentContainer(this.getMonthContainer())}
13					${this.getDatePicker().isTimeEnabled()?this.getDatePicker().isRangeMode()?this.getTimeRangeContainer():this.getTimeContainer():null}
14				</div>
15			`))}getHeader(){const e=this.getDatePicker().getNumberOfMonths();if(this.getDatePicker().isFullYear()){return this.getHeaderContainer(this.getPrevBtn(),t.Tag.render`
16					<div class="ui-date-picker-header-title">
17						${this.getFullYearHeader()}
18					</div>
19				`,this.getNextBtn())}return this.getHeaderContainer(this.getPrevBtn(),...Array.from({length:e}).map(((e,s)=>t.Tag.render`
20					<div class="ui-date-picker-header-title">
21						${this.getHeaderMonth(s)}
22						${this.getHeaderYear(s)}
23					</div>
24				`)),this.getNextBtn())}getFullYearHeader(){return this.#t.remember("header-full-year",(()=>t.Tag.render`
25				<span class="ui-date-picker-header-full-year"></span>
26			`))}getHeaderMonth(e){return this.#t.remember(`header-month-${e}`,(()=>t.Tag.render`
27				<button type="button" class="ui-date-picker-header-month" onclick="${this.#r.bind(this)}"></button>
28			`))}getMonthContainer(){return this.#t.remember("month-container",(()=>t.Tag.render`
29				<div class="ui-day-picker-content" 
30					onclick="${this.#a.bind(this)}"
31					onmouseover="${this.#o.bind(this)}"
32					onmouseout="${this.#l.bind(this)}"
33				></div>
34			`))}getHeaderYear(e){return this.#t.remember(`header-year-${e}`,(()=>t.Tag.render`
35				<button type="button" class="ui-date-picker-header-year" onclick="${this.#u.bind(this)}"></button>
36			`))}getTimeContainer(){return this.#t.remember("date-time-container",(()=>t.Tag.render`
37				<div class="ui-date-picker-time-container">
38					<button type="button" class="ui-date-picker-time-box" onclick="${this.#d.bind(this)}">
39						<span class="ui-date-picker-time-clock"></span>
40						${this.getTimeValueContainer()}
41					</button>
42				</div>
43			`))}getTimeRangeContainer(){return this.#t.remember("range-time-container",(()=>t.Tag.render`
44				<div class="ui-date-picker-time-container --range">
45					<div class="ui-date-picker-time-range-slot">
46						<button 
47							type="button" 
48							class="ui-date-picker-time-box --range-start" 
49							onclick="${this.#c.bind(this)}"
50						>
51							<span class="ui-date-picker-time-clock"></span>
52							${this.getTimeRangeStartContainer()}
53						</button>
54					</div>
55					<div class="ui-date-picker-time-range-slot">
56						<button 
57							type="button" 
58							class="ui-date-picker-time-box --range-end" 
59							onclick="${this.#h.bind(this)}"
60						>
61							<span class="ui-date-picker-time-clock"></span>
62							${this.getTimeRangeEndContainer()}
63						</button>
64					</div>
65				</div>
66			`))}getTimeValueContainer(){return this.#t.remember("time-value",(()=>t.Tag.render`<div class="ui-date-picker-time-value"></div>`))}getTimeRangeStartContainer(){return this.#t.remember("time-range-start",(()=>t.Tag.render`<div class="ui-date-picker-time-value"></div>`))}getTimeRangeEndContainer(){return this.#t.remember("time-range-end",(()=>t.Tag.render`<div class="ui-date-picker-time-value"></div>`))}getWeekDays(){if(this.#i!==null){return this.#i}const e=this.getDatePicker().getFirstWeekDay();const s=[t.Loc.getMessage("DOW_0"),t.Loc.getMessage("DOW_1"),t.Loc.getMessage("DOW_2"),t.Loc.getMessage("DOW_3"),t.Loc.getMessage("DOW_4"),t.Loc.getMessage("DOW_5"),t.Loc.getMessage("DOW_6")];this.#i=[...[...s].slice(e),...[...s].splice(0,e)];return this.#i}#m(e){const s=`month-${e}`;if(!this.#t.has(s)){const e=t.Tag.render`<div class="ui-day-picker-month"></div>`;this.#t.set(s,e);t.Dom.append(e,this.getMonthContainer())}return this.#t.get(s)}#g(e,s){return this.#t.remember(`month-header-${e}`,(()=>{const i=n.DateTimeFormat.format("f",m(2e3,e),null,true);const r=t.Tag.render`<div class="ui-day-picker-month-header">${t.Text.encode(i)}</div>`;t.Dom.append(r,s);return r}))}#f(e,s){return this.#t.remember(`week-day-${e}`,(()=>{const e=t.Tag.render`<div class="ui-day-picker-week --week-days"></div>`;t.Dom.append(e,s);if(this.getDatePicker().shouldShowWeekNumbers()){const s=t.Tag.render`<div class="ui-day-picker-week-day"></div>`;t.Dom.append(s,e)}this.getWeekDays().forEach((s=>{const i=t.Tag.render`<div class="ui-day-picker-week-day">${t.Text.encode(s)}</div>`;t.Dom.append(i,e)}));return e}))}#p(e,s,i){return this.#t.remember(`week-${e}-${s}`,(()=>{const e=t.Tag.render`<div class="ui-day-picker-week"></div>`;t.Dom.append(e,i);return e}))}#D(e,s,i,r){const a=this.#t.remember(`week-number-${e}-${s}`,(()=>{const e=t.Tag.render`<div class="ui-day-picker-week-number">${n.DateTimeFormat.format("W",i[0].date,null,true)}</div>`;t.Dom.append(e,r);return e}));a.textContent=n.DateTimeFormat.format("W",i[0].date,null,true)}#T(e,s,i){const n=this.#t.remember(e,(()=>{const e=t.Tag.render`
67				<button 
68					type="button"
69					class="ui-day-picker-day"
70					data-day="${s.day}"
71					data-month="${s.month}"
72					data-year="${s.year}"
73					data-tab-priority="true"
74					role="gridcell"
75				>
76					<span class="ui-day-picker-day-inner">${s.day}</span>
77					<span class="ui-day-picker-day-marks"></span>
78				</button>
79			`;t.Dom.append(e,i);return e}));const r=Number(n.dataset.day);const a=Number(n.dataset.month);const o=Number(n.dataset.year);if(r!==s.day||a!==s.month||o!==s.year){n.dataset.day=s.day;n.dataset.month=s.month;n.dataset.year=s.year;n.firstElementChild.textContent=s.day}const l={"--outside":s.outside,"--current":!s.outside&&s.current,"--day-off":!s.outside&&s.dayOff,"--selected":s.selected,"
79--hidden":s.hidden,"--range-from":s.rangeFrom,"--range-to":s.rangeTo,"--range-in":s.rangeIn,"--range-in-start":s.rangeInStart,"--range-in-end":s.rangeInEnd,"--range-in-selected":s.rangeInSelected,"--range-selected":s.rangeSelected,"--focused":s.focused};let u="ui-day-picker-day";for(const[e,t]of Object.entries(l)){if(t){u=`${u} ${e}`}}if(n.className!==u){n.className=u}const d=n.dataset.bgColor||null;const c=n.dataset.textColor||null;if(d!==s.bgColor){t.Dom.style(n.firstElementChild,"--ui-day-picker-day-bg-color",s.bgColor);t.Dom.attr(n,"data-bg-color",s.bgColor)}if(c!==s.textColor){t.Dom.style(n.firstElementChild,"--ui-day-picker-day-text-color",s.textColor);t.Dom.attr(n,"data-text-color",s.textColor)}const h=n.dataset.marks||"";if(h!==s.marks.toString()){t.Dom.clean(n.lastElementChild);if(s.marks.length>0){for(const e of s.marks){t.Dom.append(t.Tag.render`
80							<span class="ui-day-picker-day-mark" style="background-color: ${e}"></span>
81						`,n.lastElementChild)}}t.Dom.attr(n,"data-marks",s.marks.toString())}n.tabIndex=s.tabIndex;return n}#y(){if(this.getDatePicker().isRangeMode()){const e=this.getDatePicker().getRangeStart();const s=this.getTimeRangeStartContainer().parentNode;if(e===null){t.Dom.removeClass(this.getTimeRangeContainer(),"--range-start-set");s.disabled=true}else{t.Dom.addClass(this.getTimeRangeContainer(),"--range-start-set");s.disabled=false;this.getTimeRangeStartContainer().textContent=this.getDatePicker().formatTime(e)}const i=this.getDatePicker().getRangeEnd();const n=this.getTimeRangeEndContainer().parentNode;if(i===null){t.Dom.removeClass(this.getTimeRangeContainer(),"--range-end-set");n.disabled=true}else{t.Dom.addClass(this.getTimeRangeContainer(),"--range-end-set");n.disabled=false;this.getTimeRangeEndContainer().textContent=this.getDatePicker().formatTime(i)}}else{const e=this.getDatePicker().getSelectedDate();const s=this.getTimeContainer().firstElementChild;if(e===null){t.Dom.removeClass(this.getTimeContainer(),"--time-set");s.disabled=true}else{t.Dom.addClass(this.getTimeContainer(),"--time-set");s.disabled=false;this.getTimeValueContainer().textContent=this.getDatePicker().formatTime(e)}}}render(){let e=null;const t=this.getDatePicker().isFocused();this.getMonths().forEach(((t,s)=>{if(this.getDatePicker().isFullYear()){this.getFullYearHeader().textContent=n.DateTimeFormat.format("Y",t.date,null,true)}else{this.getHeaderMonth(s).textContent=n.DateTimeFormat.format("f",t.date,null,true);this.getHeaderYear(s).textContent=n.DateTimeFormat.format("Y",t.date,null,true)}const i=this.#m(s);if(this.getDatePicker().isFullYear()){this.#g(s,i)}if(this.getDatePicker().shouldShowWeekDays()){this.#f(s,i)}t.weeks.forEach(((t,n)=>{const r=this.#p(s,n,i);if(this.getDatePicker().shouldShowWeekNumbers()){this.#D(s,n,t,r)}t.forEach(((t,i)=>{const a=`day-${s}-${n}-${i}`;const o=this.#T(a,t,r);if(t.focused){e=o}}))}))}));if(e!==null&&t){e.focus({preventScroll:true})}if(this.getDatePicker().isTimeEnabled()){this.#y()}}getMonths(){const e=[];const t=this.getDatePicker();let s=t.getViewDate();const i=t.getNumberOfMonths();const n=t.getToday();const r=t.getFocusDate();const a=this.getDatePicker().getInitialFocusDate();const l=t.shouldShowOutsideDays();const{year:c,month:g}=t.getViewDateParts();const p=m(c,g);const D=h(m(c,g+i-1),"month");const[T,y]=this.#C();const C=t.isRangeMode()&&t.getRangeStart()!==null&&t.getRangeEnd()!==null;for(let c=0;c<i;c++){const c=[];const h=d(s,"month");const m=s.getUTCMonth();s=this.#k(s);for(let e=0;e<6;e++){const e=[];let d=null;for(let c=0;c<7;c++){let h=true;const g=s.getUTCMonth()!==m;if(g){if(l&&i>1){h=s.getTime()<p||s.getTime()>=D}else if(!l){h=false}}const k=h&&t.isDateSelected(s,"day");const b=h&&T&&y&&f(s,T);const S=h&&T&&y&&f(s,y);const M=h&&T&&y&&(b||S||s.getTime()>=T.getTime()&&s.getTime()<=y.getTime());const v=M&&(c===0||!d.rangeIn);const F=M&&c===6;if(!M&&d&&d.rangeIn){d.rangeInEnd=true}const w=k&&M&&!b&&!S;const E=h&&f(s,r,"day");const P=h&&(f(s,r,"day")||f(s,a,"day"))?0:-1;const I=this.getDatePicker().getDayColor(s);const H=this.getDatePicker().getDayMarks(s).map((e=>e.bgColor));const x={date:o(s),day:s.getUTCDate(),month:s.getUTCMonth(),year:s.getUTCFullYear(),outside:g,current:f(s,n,"day"),selected:k,hidden:g&&!l,dayOff:t.isDayOff(s),rangeSelected:k&&C,focused:E,tabIndex:P,rangeFrom
81:b,rangeTo:S,rangeIn:M,rangeInStart:v,rangeInEnd:F,rangeInSelected:w,bgColor:I===null?null:I.bgColor,textColor:I===null?null:I.textColor,marks:H};e.push(x);d=x;s=u(s,"day",1)}c.push(e)}e.push({weeks:c,date:h})}return e}#k(e){const t=this.getDatePicker();const s=t.getFirstWeekDay();const i=d(e,"month");let n=i.getUTCDay()-s;n=n<0?n+7:n;return u(i,"day",-n)}getFirstDay(){const e=this.getDatePicker().getViewDate();const t=e.getUTCMonth();const s=this.getDatePicker().shouldShowOutsideDays();const i=this.#k(this.getDatePicker().getViewDate());const n=i.getUTCMonth()!==t;if(n&&!s){return d(e,"month")}return i}getLastDay(){const e=this.getDatePicker().getNumberOfMonths();const t=this.getDatePicker().shouldShowOutsideDays();const{year:s,month:i}=this.getDatePicker().getViewDateParts();let n=h(m(s,i+e-1),"month");if(t){const t=m(s,i+e-1);const r=this.#k(t);n=u(r,"day",6*7)}return n}#C(){let e=null;let t=null;const s=this.getDatePicker().getFocusDate();if(this.getDatePicker().isRangeMode()){const i=this.getDatePicker().getSelectedDates();e=i[0]||null;t=i[1]||null;if(s!==null){if(i.length===1){if(s>e.getTime()){t=s}else{t=e;e=s}}}}return[e,t]}#a(e){const s=e.target.closest(".ui-day-picker-day");if(s===null){return}const i=s.dataset;const n=t.Text.toInteger(i.year);const r=t.Text.toInteger(i.month);const a=t.Text.toInteger(i.day);this.emit("onSelect",{year:n,month:r,day:a})}#o(e){const s=e.target.closest(".ui-day-picker-day");if(s===null){const t=e.target.closest(".ui-day-picker-week");if(t!==null&&this.#n!==null&&this.getDatePicker().getSelectedDates().length===1){clearTimeout(this.#n)}return}if(this.#n!==null){clearTimeout(this.#n)}const i=s.dataset;const n=t.Text.toInteger(i.year);const r=t.Text.toInteger(i.month);const a=t.Text.toInteger(i.day);this.emit("onFocus",{year:n,month:r,day:a})}#l(e){if(this.#n!==null){clearTimeout(this.#n)}this.#n=setTimeout((()=>{this.emit("onBlur");this.#n=null}),100)}#r(){this.emit("onMonthClick")}#u(){this.emit("onYearClick")}#d(){const e=this.getDatePicker().getSelectedDate();if(e!==null){this.emit("onTimeClick")}}#c(){const e=this.getDatePicker().getRangeStart();if(e!==null){this.emit("onRangeStartClick")}}#h(){const e=this.getDatePicker().getRangeEnd();if(e!==null){this.emit("onRangeEndClick")}}}const D={SELECT_CHANGE:"onSelectChange",BEFORE_SELECT:"onBeforeSelect",SELECT:"onSelect",BEFORE_DESELECT:"onBeforeDeselect",BEFORE_DAY_SELECT:"onBeforeDaySelect",DESELECT:"onDeselect",DESTROY:"onDestroy"};function T(e,t){return e.getTime()>t.getTime()}function y(e,t){return e.getTime()<t.getTime()}function C(e,t){t.setUTCHours(e.getUTCHours());t.setUTCMinutes(e.getUTCMinutes());t.setUTCSeconds(e.getUTCSeconds())}function k(e,s=[]){const[i=null,n=null]=t.Type.isArray(s)?s:[];if(i!==null&&n!==null){if(f(n,e)&&f(i,e)){return[]}if(f(n,e)){return[n]}if(f(i,e)){return[]}if(T(i,e)){C(i,e);return[e,n]}C(n,e);return[i,e]}if(n!==null){if(T(e,n)){return[n,e]}return[e,n]}if(i!==null){if(y(e,i)){return[e,i]}return[i,e]}return[e]}const b={Y:"YYYY",M:"MMM",f:"MMMM",m:"MM",d:"DD",A:"TT",a:"T",i:"MI",s:"SS",H:"HH",h:"H",G:"GG",g:"G",j:"DD",n:"MM"};function S(e){let t=e;for(const[e,s]of Object.entries(b)){t=t.replace(e,s)}return t}const M=/[^\p{L}\p{N}\u0600-\u06FF_]/u;const v=/^[1-9]\d{3}$/;const F=/^(0?[1-9]|[12]\d|3[01])$/;const w=/^(0?[1-9]|1[0-2])$/;const E=/^(\d|0\d|1\d|2[0-3])$/;const P=/^(\d|[0-5]\d)$/;const I=/^(\d|[0-5]\d)$/;function H(e,s){const i=s.split(M);const n=e.split(M);const r={};const a=new Map;for(const[e,t]of i.entries()){const s=x(t,n[e]);if(s!==null){const[e,t,i]=s;if(t==="error"){a.set(e,i);continue}r[e]=t}}const o=t.Type.isNumber(r.day);const l=t.Type.isNumber(r.month);const u=t.Type.isNumber(r.year);if(a.size>0){const e=u&&l&&o;const s=a.has("hours")&&a.has("minutes")&&t.Type.isUndefined(a.get("hours"))&&t.Type.isUndefined(a.get("minutes"))&&(a.has("seconds")&&t.Type.isUndefined(a.get("seconds"))||!a.has("seconds"));if(!e||!s){return null}}const d=U(new Date);const{day:c,month:h,year:f}=g(d);const p=f;const D=u?0:h;const T=u||l?1:c;const{meridiem:y}=r;const C=i.includes("H")||i.includes("G");const k=t.Type.isStringFilled(y)&&y.toLowerCase()==="pm";let{hours:b}=r;if(C){if(k){b+=b===12?0:12}else{b=b<12?b:0}}const{year:S=p,month:v=D,day:F=T,minutes:w=0,seconds:E=0}=r;return m(S,v,F,b,w,E)}function x(e,s){switch(e){case"YYYY":{if(!v.test(s)){return["year","error",s]}const e=t.Text.toInteger(s);return["year",e,s]}case"MMMM":case"MMM":{const e=n.DateTimeFormat.getMonthIndex(s);if(t.Type.isNumber(e)){return["month",e-1,s]}return["month","error",s]}case"MM":case"M":{if(!w.test(s)){return["month","error",s]}const e=t.Text.toInteger(s);return["month",e===0?e:Math.min(Math.max(e,1),12)-1,s]}case"DD":case"D":{if(!F.test(s)){return["day","error",s]}const e=t.Text.toInteger(s);return["day",Math.min(Math.max(e,1),31),s]}case"HH":case"GG":{if(!E.test(s)){return["hours","error",s]}const e=t.Text.toInteger(s);return["hours",Math.min(Math.max(e,0),23),s]}case"H":case"G":{if(!E.test(s)){return["hours","error",s]}const e=t.Text.toInteger(s);return["hours",e>12?e-12:e,s]}case"MI":{if(!P.test(s)){return["minutes","error",s]}const e=t.Text.toInteger(s);return["minutes",Math.min(Math.max(e,0),59),s]}case"SS":{if(t.Type.isStringFilled(s)&&["am","pm"].includes(s.toLowerCase())){return["meridiem",s,s]}if(t.Type.isStringFilled(s)&&!I.test(s)){return["seconds","error",s]}const e=t.Text.toInteger(s);return["seconds",Math.min(Math.max(e,0),59),s]}case"T":case"TT":if(t.Type.isStringFilled(s)){return["meridiem",s,s]}return null;default:return null}}function U(e,s=null){let i=null;if(t.Type.isStringFilled(e)&&t.Type.isStringFilled(s)){i=H(e,S(s))}else if(t.Type.isNumber(e)){i=new Date(e);i=$(i)}else if(t.Type.isDate(e)){i=e.__utc?e:$(e)}if(i===null){console.warn(`DatePicker: invalid date or format (${e}).`)}else{i.__utc=true}return i}function $(e){return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),0))}
81const R=["button:not([disabled])",'[tabindex]:not([tabindex="-1"]):not([disabled])'].join(", ");function O(e){return e.ownerDocument.activeElement===e}function N(e,s=null){const i=t.Type.isFunction(s)?s:()=>true;const n=[...e.querySelectorAll(R)].filter((e=>e.tabIndex!==-1&&i(e)));if(n.length===0){return[]}if(n.length===1){return[n[0],n[0]]}let r=n.at(0);let a=n.at(-1);for(const[e,s]of n.entries()){if(O(s)){a=e>0?n[e-1]:n.at(-1);r=t.Type.isUndefined(n[e+1])?n.at(0):n[e+1];break}}return[a,r]}function B(e){return t.Type.isStringFilled(e)||t.Type.isNumber(e)||t.Type.isDate(e)}function V(e,t=0,s=0,i=0){const n=o(e);if(t!==null){n.setUTCHours(t)}if(s!==null){n.setUTCMinutes(s)}if(i!==null){n.setUTCSeconds(i)}return n}function Y(e,s){return s.some((s=>{if(t.Type.isFunction(s)){return s(e)}if(t.Type.isDate(s)){return f(e,s)}if(t.Type.isArray(s)){return s.some((t=>f(e,t)))}if(t.Type.isBoolean(s)){return s}return false}))}const A={ArrowRight:{day:1,month:1,year:1,hours:1,minutes:1},ArrowLeft:{day:-1,month:-1,year:-1,hours:-1,minutes:-1},ArrowUp:{day:-7,month:-3,year:-3,hours:-4,minutes:-2},ArrowDown:{day:7,month:3,year:3,hours:4,minutes:2}};class L{#e=null;#b=null;constructor(e){this.#e=e}init(){t.Event.bind(this.#e.getContainer(),"keydown",this.#S.bind(this));t.Event.bind(this.#e.getContainer(),"focusin",this.#M.bind(this));t.Event.bind(this.#e.getContainer(),"focusout",this.#v.bind(this))}#S(e){const s=this.#e;if(e.key==="Backspace"&&s.getType()==="date"&&["year","month","time"].includes(s.getCurrentView())){e.preventDefault();this.resetLastFocusElement();s.setCurrentView("day");return}if(e.key==="Tab"&&!s.isInline()){this.#F(e);return}const i=s.getCurrentView();if(i==="time"&&s.getTimePickerStyle()==="wheel"){return}if(e.key==="Space"||e.key==="Enter"||e.key===" "){e.preventDefault();this.resetLastFocusElement();e.target.click()}else if(!t.Type.isUndefined(A[e.key])){e.preventDefault();this.resetLastFocusElement();const t=s.getFocusDate()===null&&this.#w();if(i==="time"){const i=this.#e.getPicker("time");let n=o(s.getInitialFocusDate(i.getMode()));let{hours:r,minutes:a}=g(n);if(t){s.setFocusDate(n);this.#E()}else if(i.getFocusColumn()==="hours"){const t=A[e.key].hours;r+=t;if(r<0){r+=24}else if(r>23){r-=24}n=V(n,r,null,null);s.setFocusDate(n);this.#E()}else if(i.getFocusColumn()==="minutes"){const t=A[e.key].minutes;a+=i.getCurrentMinuteStep()*t;if(a<0){a+=60}else if(a>59){a-=60}n=V(n,null,a,null);s.setFocusDate(n);i.adjustMinuteFocusPosition();this.#E()}}else{const n=o(s.getInitialFocusDate());if(t){s.setFocusDate(n)}else{const t=A[e.key][i];const r=u(n,i,t);s.setFocusDate(r)}this.#E()}}}#w(){const e=this.#e.getContainer();return e.ownerDocument.activeElement===e}#F(e){let t=null;let s=null;const i=this.#e.getPicker().getContainer();if(this.#w()){[t=null,s=null]=N(i,(e=>e.dataset.tabPriority==="true"))}if(t===null&&s===null){[t,s]=N(i)}if(e.shiftKey){t?.focus({preventScroll:true,focusVisible:true});this.setLastFocusElement(t)}else{s?.focus({preventScroll:true,focusVisible:true});this.setLastFocusElement(s)}e.preventDefault()}setLastFocusElement(e){this.resetLastFocusElement();this.#b=e;t.Dom.addClass(this.#b,"--focus-visible")}resetLastFocusElement(){t.Dom.removeClass(this.#b,"--focus-visible");this.#b=null}#E(){const e=this.#e.getContainer();const t=e.ownerDocument.activeElement;if(e.contains(t)){this.setLastFocusElement(t)}}#M(e){this.resetLastFocusElement()}#v(e){this.resetLastFocusElement()}}class _ extends a{#t=new s.MemoryCache;getContainer(){return this.#t.remember("container",(()=>t.Tag.render`
82				<div class="ui-month-picker">
83					${this.getHeaderContainer(this.getPrevBtn(),this.getHeaderTitle(),this.getNextBtn())}
84					${this.getContentContainer()}
85				</div>
86			`))}getHeaderTitle(){return this.#t.remember("header-title",(()=>t.Tag.render`
87				<button type="button" class="ui-month-picker-header-title" onclick="${this.#P.bind(this)}"></button>
88			`))}getMonths(){const{year:e}=g(this.getDatePicker().getViewDate());const t=this.getDatePicker().getToday();const s=this.getDatePicker().getFocusDate();const i=this.getDatePicker().getInitialFocusDate();const r=[];let a=0;for(let o=0;o<4;o++){const o=[];for(let r=0;r<3;r++){const r=m(e,a);const l=f(r,s,"month");const u={name:n.DateTimeFormat.format("f",r,null,true),date:r,year:e,month:a,current:f(r,t,"month"),selected:this.getDatePicker().isDateSelected(r,"month"),focused:l,tabIndex:l||f(r,i,"month")?0:-1};o.push(u);a++}r.push(o)}return r}renderTo(e){super.renderTo(e);t.Event.bind(this.getContentContainer(),"click",this.#r.bind(this))}render(){const e=this.getDatePicker().isFocused();let t=null;
88this.getMonths().forEach(((e,s)=>{const i=this.#I(s);e.forEach((e=>{const s=this.#H(e,i);if(e.focused){t=s}}))}));if(t!==null&&e){t.focus({preventScroll:true})}const{year:s}=g(this.getDatePicker().getViewDate());this.getHeaderTitle().textContent=s}#I(e){return this.#t.remember(`quarter-${e}`,(()=>{const e=t.Tag.render`<div class="ui-month-picker-quarter"></div>`;t.Dom.append(e,this.getContentContainer());return e}))}#H(e,s){const i=this.#t.remember(`month-${e.month}`,(()=>{const i=t.Tag.render`
89				<button
90					type="button"
91					class="ui-month-picker-month"
92					data-year="${e.year}"
93					data-month="${e.month}"
94					data-tab-priority="true"
95					onmouseenter="${this.#x.bind(this)}"
96					onmouseleave="${this.#U.bind(this)}"
97				>${t.Text.encode(e.name)}</button>
98			`;t.Dom.append(i,s);return i}));const n=Number(i.dataset.year);if(n!==e.year){i.dataset.year=e.year}if(e.current){t.Dom.addClass(i,"--current")}else{t.Dom.removeClass(i,"--current")}if(e.selected){t.Dom.addClass(i,"--selected")}else{t.Dom.removeClass(i,"--selected")}if(e.focused){t.Dom.addClass(i,"--focused")}else{t.Dom.removeClass(i,"--focused")}i.tabIndex=e.tabIndex;return i}#x(e){const s=e.target.dataset;const i=t.Text.toInteger(s.year);const n=t.Text.toInteger(s.month);this.emit("onFocus",{year:i,month:n})}#U(e){this.emit("onBlur")}#r(e){if(!t.Dom.hasClass(e.target,"ui-month-picker-month")){return}const s=t.Text.toInteger(e.target.dataset.year);const i=t.Text.toInteger(e.target.dataset.month);this.emit("onSelect",{year:s,month:i})}#P(e){this.emit("onTitleClick")}}class W extends a{#$="datetime";#R=Infinity;#O="hours";getTimeDate(){if(this.#$==="range-start"){return this.getDatePicker().getRangeStart()}if(this.#$==="range-end"){return this.getDatePicker().getRangeEnd()}return this.getDatePicker().getSelectedDate()}setMode(e){this.#$=e}getMode(){return this.#$}getFocusColumn(){return this.#O}setFocusColumn(e){if(t.Type.isStringFilled(e)&&["hours","minutes"].includes(e)){this.#O=e}}getHours(){const e=this.getTimeDate();const t=e===null?-1:e.getUTCHours();const s=this.getDatePicker().isAmPmMode();const i=this.getDatePicker().getFocusDate();const n=i===null?t:i.getUTCHours();const r=this.getDatePicker().getInitialFocusDate(this.getMode()).getUTCHours();const a=[];for(let e=0,i=0;e<24;e++,i++){let o=e;if(s){o%=12;o=o===0?12:o}a.push({index:i,name:s?o:String(o).padStart(2,"0"),value:e,selected:t===e,focused:n===e&&this.getFocusColumn()==="hours",tabIndex:n===e||r===e?0:-1})}return a}getMinutes(){const e=this.getTimeDate();const t=e===null?-1:e.getUTCMinutes();const s=Math.min(this.getDatePicker().getMinuteStepByDate(e),this.#R);const i=this.getDatePicker().getFocusDate();const n=i===null?t:i.getUTCMinutes();const r=this.getDatePicker().getInitialFocusDate(this.getMode()).getUTCMinutes();this.#R=s;const a=[];for(let e=0,i=0;e<60;e++){const o=e%s!==0;a.push({index:i,name:String(e).padStart(2,"0"),value:e,selected:t===e,hidden:o,focused:!o&&n===e&&this.getFocusColumn()==="minutes",tabIndex:!o&&(n===e||r===e)?0:-1});if(!o){i++}}return a}getMeridiems(){const e=this.getTimeDate();const t=e===null?-1:e.getUTCHours();const s=t>=12;return[{index:0,name:"AM",value:"am",selected:!s},{index:1,name:"PM",value:"pm",selected:s}]}getCurrentMinuteStep(){return this.#R}onHide(){this.setFocusColumn("hours")}render(){const e=this.getDatePicker();const t=this.getTimeDate();if(t===null){this.getHeaderTitle().textContent=""}else{this.getHeaderTitle().textContent=e.getType()==="time"?e.formatTime(t):e.formatDate(t)}}}class j extends W{#t=new s.MemoryCache;#N=null;#B=t.Runtime.debounce(this.#V,200,this);getContainer(){return this.#t.remember("container",(()=>t.Tag.render`
99				<div class="ui-time-picker">
100					${this.getDatePicker().getType()==="time"?null:this.getHeaderContainer(this.getPrevBtn(),this.getHeaderTitle())}
101					<div class="ui-time-picker-content">
102						${this.getTimeHighlighter()}
103						<div 
104							class="ui-time-picker-selector"
105							data-selector-id="hour" 
106							onmouseenter="${this.#Y.bind(this)}"
107						>
108							<div class="ui-time-picker-selector-title">${t.Loc.getMessage("UI_DATE_PICKER_HOURS")}</div>
109							<div class="ui-time-picker-viewport">
110								<div class="ui-time-picker-scroll-container" 
111									tabindex="0" 
112									onscroll="${this.#B}"
113									onfocus="${this.#A.bind(this)}"
114								>
115									${this.getHoursContainer()}
116								</div>
117							</div>
118						</div>
119						<div class="ui-time-picker-time-separator"></div>
120						<div 
121							class="ui-time-picker-selector"
122							data-selector-id="minute" 
123							onmouseenter="${this.#Y.bind(this)}"
124						>
125							<div class="ui-time-picker-selector-title">${t.Loc.getMessage("UI_DATE_PICKER_MINUTES")}</div>
126							<div class="ui-time-picker-viewport">
127								<div class="ui-time-picker-scroll-container" 
128									tabindex="0" 
129									onscroll="${this.#B}"
130									onfocus="${this.#A.bind(this)}"
131								>
132									${this.getMinutesContainer()}
133								</div>
134							</div>
135						</div>
136						${this.getDatePicker().isAmPmMode()?t.Tag.render`
137									<div 
138										class="ui-time-picker-selector" 
139										onmouseenter="${this.#Y.bind(this)}"
140										data-selector-id="meridiem"
141									>
142										<div class="ui-time-picker-selector-title">AM/PM</div>
143										<div class="ui-time-picker-viewport">
144											<div class="ui-time-picker-scroll-container" 
145												tabindex="0" 
146												onscroll="${this.#B}"
147												onfocus="${this.#A.bind(this)}"
148											>
149												${this.getMeridiemsContainer()}
150											</div>
151										</div>
152									</div>
153								`:null}
154					</div>
155				</div>
156			`))}getHeaderTitle(){return this.#t.remember("header-title",(()=>t.Tag.render`
157				<div class="ui-time-picker-header-title" onclick="${this.#P.bind(this)}"></div>
158			`))}getHoursContainer(){return this.#t.remember("hours",(()=>t.Tag.render`
159				<div 
160					class="ui-time-picker-list-container" 
161					onclick="${this.#L.bind(this)}"
162				></div>
163			`))}getMinutesContainer(){return this.#t.remember("minutes",(()=>t.Tag.render`
164				<div 
165					class="ui-time-picker-list-container" 
166					onclick="${this.#L.bind(this)}"
167				></div>
168			`))}getMeridiemsContainer(){return this.#t.remember("meridiems",(()=>t.Tag.render`
169				<div 
170					class="ui-time-picker-list-container" 
171					onclick="${this.#L.bind(this)}"
172				></div>
173			`))}getTimeHighlighter(){return this.#t.remember("time-highlighter",(()=>t.Tag.render`<div class="ui-time-picker-time-highlighter"></div>`))}onShow(){super.onShow();this.focusSelector("hour",!this.getDatePicker().isInline())}renderTo(e){super.renderTo(e);this.#_(this.getHoursContainer());this.#_(this.getMinutesContainer());if(this.getDatePicker().isAmPmMode()){this.#_(this.getMeridiemsContainer())}}render(){super.render();let e=0;this.getHours().forEach((t=>{if(t.selected){e=t.index}this.#W(t)}));this.#j(this.getHoursContainer(),e,false);let t=0;this.getMinutes().forEach((e=>{if(e.selected){t=e.index}this.#X(e)}));this.#j(this.getMinutesContainer(),t,false);const s=this.getDatePicker();if(s.isAmPmMode()){let e=0;this.getMeridiems().forEach((t=>{if(t.selected){e=t.index}this.#q(t)}));this.#j(this.getMeridiemsContainer(),e,false)}}getItemHeight(){return 30}focusSelector(e,s=true){if(this.#N===e){return}if(this.#N!==null){const e=this.getContainer().querySelector(`[data-selector-id="${this.#N}"]`);t.Dom.removeClass(e,"--focused")}this.#N=e;const i=this.getContainer().querySelector(`[data-selector-id="${e}"]`);const n=i.querySelector('[tabindex]:not([tabindex="-1"])');t.Dom.addClass(i,"--focused");if(s){n.focus({preventScroll:true})}}#W(e){const s=this.#t.remember(`hour-${e.value}`,(()=>{const s=t.Tag.render`
174				<div 
175					class="ui-time-picker-list-item" 
176					data-index="${e.index}" 
177					data-value="${e.value}"
178				>${e.name}</div>
179			`;t.Dom.append(s,this.getHoursContainer());return s}));if(e.selected){t.Dom.addClass(s,"--selected")}else{t.Dom.removeClass(s,"--selected")}}#X(e){const s=this.#t.remember(`minute-${e.value}`,(()=>{const s=t.Tag.render`
180				<div 
181					class="ui-time-picker-list-item"
182					data-index="${e.index}" 
183					data-value="${e.value}"
184				>${e.name}</div>
185			`;t.Dom.append(s,this.getMinutesContainer());return s}));if(e.selected){t.Dom.addClass(s,"--selected")}else{t.Dom.removeClass(s,"--selected")}if(e.hidden){s.dataset.index="";t.Dom.addClass(s,"--hidden")}else{s.dataset.index=e.index;t.Dom.removeClass(s,"--hidden")}}#q(e){const s=this.#t.remember(`meridiem-${e.value}`,(()=>{const s=t.Tag.render`
186				<div 
187					class="ui-time-picker-list-item"
188					data-index="${e.index}" 
189					data-value="${e.value}"
190				>${e.name}</div>
191			`;t.Dom.append(s,this.getMeridiemsContainer());return s}));if(e.selected){t.Dom.addClass(s,"--selected")}else{t.Dom.removeClass(s,"--selected")}}#_(e){const s=e.parentNode.parentNode;const i=s.offsetHeight/2-this.getItemHeight()/2;t.Dom.style(e,{marginTop:`${i}px`,marginBottom:`${i}px`})}#j(e,t,s=true){const i=e.parentNode;const n=this.getItemHeight()*t;if(i.scrollTop!==n){i.scrollTo({top:n,behavior:s?"smooth":"instant"});return true}return false}#L(e){const t=e.target;if(!t.closest(".ui-time-picker-list-item")){return}const s=t.parentNode;const i=Number(t.dataset.index);const n=this.#j(s,i);if(!n){this.#G(s.parentNode)}}
191#P(e){this.emit("onTitleClick")}#Y(e){this.focusSelector(e.target.dataset.selectorId)}#A(e){this.focusSelector(e.target.parentNode.parentNode.dataset.selectorId)}#V(e){const t=e.target;const s=t.scrollTop;const i=s%this.getItemHeight()===0;if(i){this.#G(t)}}#G(e){const t=e.scrollTop;const s=t/this.getItemHeight();const i=e.parentNode.parentNode;const n=i.dataset.selectorId;const r=i.querySelector(`[data-index="${s}"]`);const a=this.getTimeDate();const o=a===null?-1:a.getUTCHours();const l=a===null?-1:a.getUTCMinutes();switch(n){case"hour":{const e=Number(r.dataset.value);if(o!==e){this.emit("onSelect",{hour:e})}break}case"minute":{const e=Number(r.dataset.value);if(l!==e){this.emit("onSelect",{minute:e})}break}case"meridiem":{const e=r.dataset.value;if(e==="am"&&o>=12){const e=o-12;this.emit("onSelect",{hour:e})}else if(e==="pm"&&o>=0&&o<12){const e=o+12;this.emit("onSelect",{hour:e})}break}}}}class X extends W{#t=new s.MemoryCache;#K=true;getContainer(){return this.#t.remember("container",(()=>t.Tag.render`
192				<div class="ui-time-picker-grid${this.getDatePicker().isAmPmMode()?" --am-pm":""}">
193					${this.getDatePicker().getType()==="time"?null:this.getHeaderContainer(this.getPrevBtn(),this.getHeaderTitle())}
194					<div class="ui-time-picker-grid-content">
195						<div class="ui-time-picker-grid-column">
196							<div class="ui-time-picker-grid-column-title">${t.Loc.getMessage("UI_DATE_PICKER_HOURS")}</div>
197							<div class="ui-time-picker-grid-column-content">
198								${this.getHoursContainer()}
199							</div>
200						</div>
201						<div class="ui-time-picker-grid-column-separator"></div>
202						<div class="ui-time-picker-grid-column">
203							<div class="ui-time-picker-grid-column-title">${t.Loc.getMessage("UI_DATE_PICKER_MINUTES")}</div>
204							<div class="ui-time-picker-grid-column-content">
205								${this.getMinutesContainer()}
206							</div>
207						</div>
208					</div>
209				</div>
210			`))}getHeaderTitle(){return this.#t.remember("header-title",(()=>t.Tag.render`
211				<div class="ui-time-picker-grid-header-title" onclick="${this.#P.bind(this)}"></div>
212			`))}getHoursContainer(){return this.#t.remember("hours",(()=>t.Tag.render`
213				<div 
214					class="ui-time-picker-grid-column-items --hours" 
215					onclick="${this.#L.bind(this)}"
216				></div>
217			`))}getMinutesContainer(){return this.#t.remember("minutes",(()=>t.Tag.render`
218				<div 
219					class="ui-time-picker-grid-column-items --minutes" 
220					onclick="${this.#L.bind(this)}"
221					onscroll="${t.Runtime.debounce(this.#Z,100,this)}"
222				></div>
223			`))}onHide(){super.onHide();this.#K=true}render(){super.render();let e=null;this.getHours().forEach((t=>{const s=this.#W(t,this.getHoursContainer());if(t.focused){e=s}}));let s=null;let i=null;this.getMinutes().forEach((e=>{const t=this.#X(e,this.getMinutesContainer());if(e.selected){s=t}if(e.focused){i=t}}));if(this.#K){t.Dom.style(this.getMinutesContainer(),"height",`${this.getHoursContainer().offsetHeight}px`);
223if(s!==null){this.#j(s,false)}this.#Z();this.#K=false}if(this.getDatePicker().isFocused()){if(this.getFocusColumn()==="hours"&&e!==null){e.focus({preventScroll:true})}else if(this.getFocusColumn()==="minutes"&&i!==null){i.focus({preventScroll:true})}}}#W(e,s){const i=this.#t.remember(`hour-${e.value}`,(()=>{const i=t.Tag.render`
224				<button
225					type="button"
226					class="ui-time-picker-grid-item" 
227					data-index="${e.index}" 
228					data-hour="${e.value}"
229					data-tab-priority="true"
230					onmouseenter="${this.#x.bind(this)}"
231					onmouseleave="${this.#U.bind(this)}"
232					onfocus="${this.#A.bind(this)}"
233				><span class="ui-time-picker-grid-item-inner">${e.name}</span></button>
234			`;if(this.getDatePicker().isAmPmMode()){if(e.value===0){i.dataset.meridiem="AM";t.Dom.addClass(i,"--has-meridiem")}else if(e.value===12){i.dataset.meridiem="PM";t.Dom.addClass(i,"--has-meridiem")}}t.Dom.append(i,s);return i}));if(e.selected){t.Dom.addClass(i,"--selected")}else{t.Dom.removeClass(i,"--selected")}if(e.focused){t.Dom.addClass(i,"--focused")}else{t.Dom.removeClass(i,"--focused")}i.tabIndex=e.tabIndex;return i}#X(e,s){const i=this.#t.remember(`minute-${e.value}`,(()=>{const i=t.Tag.render`
235				<button
236					type="button"
237					class="ui-time-picker-grid-item"
238					data-index="${e.index}" 
239					data-minute="${e.value}"
240					onmouseenter="${this.#x.bind(this)}"
241					onmouseleave="${this.#U.bind(this)}"
242					onfocus="${this.#A.bind(this)}"
243				><span class="ui-time-picker-grid-item-inner">${e.name}</span></button>
244			`;t.Dom.append(i,s);return i}));if(e.selected){t.Dom.addClass(i,"--selected")}else{t.Dom.removeClass(i,"--selected")}if(e.hidden){i.dataset.index="";t.Dom.addClass(i,"--hidden")}else{i.dataset.index=e.index;t.Dom.removeClass(i,"--hidden")}if(e.focused){t.Dom.addClass(i,"--focused")}else{t.Dom.removeClass(i,"--focused")}i.tabIndex=e.tabIndex;return i}#j(e,t=true){const s=20;const i=this.getMinutesContainer().scrollTop;const n=i+s;const r=e.offsetTop;const a=r+e.offsetHeight;const o=this.getMinutesContainer().offsetHeight;const l=i+o-s;const u=r>=n&&r<=l&&a<=l&&a>=n;if(!u){this.getMinutesContainer().scrollTo({top:e.offsetTop-o/2,behavior:t?"smooth":"instant"})}}adjustMinuteFocusPosition(){const e=this.getContainer().ownerDocument.activeElement;if(!e.closest(".ui-time-picker-grid-item")){return}this.#j(e)}#Z(){const e=this.getMinutesContainer().scrollTop;const s=this.getMinutesContainer().scrollHeight;const i=this.getMinutesContainer().offsetHeight;const n=this.getMinutesContainer().parentNode.parentNode;if(e>0){t.Dom.addClass(n,"--top-shadow")}else{t.Dom.removeClass(n,"--top-shadow")}if(e===s-i){t.Dom.removeClass(n,"--bottom-shadow")}else{t.Dom.addClass(n,"--bottom-shadow")}}#L(e){const s=e.target;if(!s.closest(".ui-time-picker-grid-item")){return}if(t.Type.isStringFilled(s.dataset.hour)){this.setFocusColumn("hours");const e=Number(s.dataset.hour);this.emit("onSelect",{hour:e})}else if(t.Type.isStringFilled(s.dataset.minute)){this.setFocusColumn("minutes");this.#j(s);const e=Number(s.dataset.minute);this.emit("onSelect",{minute:e})}}#x(e){const{hour:s,minute:i}=e.target.dataset;if(t.Type.isStringFilled(s)){this.setFocusColumn("hours");this.emit("onFocus",{hour:t.Text.toInteger(s)})}else if(t.Type.isStringFilled(i)){this.setFocusColumn("minutes");this.emit("onFocus",{minute:t.Text.toInteger(i)})}}#U(e){this.emit("onBlur")}#A(e){const{hour:s,minute:i}=e.target.dataset;const n=this.getFocusColumn();if(t.Type.isStringFilled(s)){this.setFocusColumn("hours")}else if(t.Type.isStringFilled(i)){this.setFocusColumn("minutes")}if(n!==this.getFocusColumn()){this.render()}}#P(e){this.emit("onTitleClick")}}class q extends a{#t=new s.MemoryCache;getContainer(){return this.#t.remember("container",(()=>t.Tag.render`
245				<div class="ui-year-picker">
246					${this.getHeaderContainer(this.getPrevBtn(),this.getHeaderTitle(),this.getNextBtn())}
247					${this.getContentContainer()}
248				</div>
249			`))}getHeaderTitle(){return this.#t.remember("header-title",(()=>t.Tag.render`
250				<div class="ui-year-picker-header-title"></div>
251			`))}getYears(){const{year:e}=g(this.getDatePicker().getToday());const t=this.getDatePicker().getFocusDate();const s=this.getDatePicker().getInitialFocusDate().getUTCFullYear();const i=[];let n=0;let r=this.#Q();for(let a=0;a<4;a++){const a=[];for(let i=0;i<3;i++){const i=t!==null&&t.getUTCFullYear()===r;a.push({index:n,year:r,name:r,current:e===r,selected:this.getDatePicker().isDateSelected(m(r),"year"),focused:i,tabIndex:i||r===s?0:-1});r++;n++}i.push(a)}return i}#Q(){const{year:e}=this.getDatePicker().getViewDateParts();const{year:t}=g(this.getDatePicker().getToday());let s=t-4;s-=12*Math.ceil((s-e)/12);return s}getFirstYear(){return this.#Q()}getLastYear(){return this.#Q()+11}renderTo(e){super.renderTo(e);t.Event.bind(this.getContentContainer(),"click",this.#u.bind(this))}render(){let e=null;const t=this.getDatePicker().isFocused();const s=this.getYears();
251s.forEach(((t,s)=>{const i=this.#I(s);t.forEach((t=>{const s=this.#z(t,i);if(t.focused){e=s}}))}));if(e!==null&&t){e.focus({preventScroll:true})}const i=s[0][0].name;const n=s.at(-1).at(-1).name;this.getHeaderTitle().textContent=`${i} \u2014 ${n}`}#I(e){return this.#t.remember(`quarter-${e}`,(()=>{const e=t.Tag.render`<div class="ui-year-picker-trio"></div>`;t.Dom.append(e,this.getContentContainer());return e}))}#z(e,s){const i=this.#t.remember(`year-${e.index}`,(()=>{const i=t.Tag.render`
252				<button
253					type="button"
254					class="ui-year-picker-year"
255					data-year="${e}"
256					data-tab-priority="true"
257					onmouseenter="${this.#x.bind(this)}"
258					onmouseleave="${this.#U.bind(this)}"
259				>${t.Text.encode(e.name)}</button>
260			`;t.Dom.append(i,s);return i}));const n=Number(i.dataset.year);if(n!==e.year){i.dataset.year=e.year;i.textContent=e.name}if(e.current){t.Dom.addClass(i,"--current")}else{t.Dom.removeClass(i,"--current")}if(e.selected){t.Dom.addClass(i,"--selected")}else{t.Dom.removeClass(i,"--selected")}if(e.focused){t.Dom.addClass(i,"--focused")}else{t.Dom.removeClass(i,"--focused")}i.tabIndex=e.tabIndex;return i}#x(e){const s=e.target.dataset;const i=t.Text.toInteger(s.year);this.emit("onFocus",{year:i})}#U(e){this.emit("onBlur")}#u(e){if(!t.Dom.hasClass(e.target,"ui-year-picker-year")){return}const s=t.Text.toInteger(e.target.dataset.year);this.emit("onSelect",{year:s})}}let G=null;class K extends i.EventEmitter{#J=null;#ee=null;#te=[];#se=null;#ie="date";#ne=null;#re="single";#ae=new Map;#oe=1;#le=true;#ue=false;#de=true;#ce=1;#he=Infinity;#me=0;#ge=false;#fe=[0,6];#pe=[];#De=[];#Te=false;#ye=false;#Ce=false;#ke=5;#be="00:00:00";#Se=60;#Me="grid";#ve=true;#Fe=null;#we=null;#Ee=null;#Pe=null;#Ie=true;#He=", ";#xe=null;#Ue={};#$e=true;#Re=true;#Oe=true;#Ne=true;#t=new s.MemoryCache;#s=false;#Be=false;#Ve=true;#Ye=null;#Ae=null;#Le=null;#_e=true;#We=null;#je=false;#Xe=[];#qe=[];#Ge=null;#Ke=false;constructor(e){super();this.setEventNamespace("BX.UI.DatePicker");const s=t.Extension.getSettings("ui.date-picker");const i=t.Type.isPlainObject(e)?e:{};this.#Ze(i.type);this.#Qe(i.selectionMode);this.#We=t.Type.isStringFilled(i.locale)?i.locale:s.get("locale","en");this.#Te=t.Type.isBoolean(i.enableTime)?i.enableTime:this.#Te;if(this.isMultipleMode()){this.#Te=false}this.#ye=t.Type.isBoolean(i.allowSeconds)?i.allowSeconds:this.#ye;this.#Ce=t.Type.isBoolean(i.amPmMode)?i.amPmMode:n.DateTimeFormat.isAmPmMode();this.#ve=t.Type.isBoolean(i.cutZeroTime)?i.cutZeroTime:this.#ve;this.#Ye=t.Type.isStringFilled(i.dateFormat)?i.dateFormat:this.#ze();this.setDefaultTime(i.defaultTime);this.setDefaultTimeSpan(i.defaultTimeSpan);this.#Ae=t.Type.isStringFilled(i.timeFormat)?i.timeFormat:n.DateTimeFormat.getFormat(this.#ye?"LONG_TIME_FORMAT":"SHORT_TIME_FORMAT");this.#ke=t.Type.isNumber(i.minuteStep)&&[1,5,10,15,30].includes(i.minuteStep)?i.minuteStep:this.#ke;this.#Me=i.timePickerStyle==="wheel"?"wheel":this.#Me;this.#J=this.getToday();this.#Ie=t.Type.isBoolean(i.useInputEvents)?i.useInputEvents:this.#Ie;this.setAutoFocus(i.autoFocus);this.setInputField(i.inputField);this.setRangeStartInput(i.rangeStartInput);this.setRangeEndInput(i.rangeEndInput);this.setDateSeparator(i.dateSeparator);this.selectDates(i.selectedDates,{emitEvents:false});this.#ee=B(i.startDate)?this.createDate(i.startDate):null;const r=this.getDefaultViewDate();this.setViewDate(r);this.#Be=i.inline===true;let a=s.get("firstWeekDay",this.#oe);a=t.Type.isNumber(i.firstWeekDay)?i.firstWeekDay:a;this.#oe=Math.min(Math.max(0,a),6);this.#ce=t.Type.isNumber(i.numberOfMonths)?i.numberOfMonths:this.#ce;this.#ge=i.fullYear===true;if(this.#ge){this.#Te=false;this.#ce=12;this.setViewDate(m(r.getUTCFullYear(),0,1))}this.#le=t.Type.isBoolean(i.showWeekDays)?i.showWeekDays:this.#le;this.#ue=t.Type.isBoolean(i.showWeekNumbers)?i.showWeekNumbers:this.#ue;const o=s.get("weekends",[]);this.#fe=t.Type.isArray(i.weekends)?i.weekends:t.Type.isArrayFilled(o)?o:this.#fe;const l=s.get("holidays",[]);this.#pe=t.Type.isArray(i.holidays)?i.holidays:l;const u=s.get("workdays",[]);this.#De=t.Type.isArray(i.workdays)?i.workdays:u;this.#de=this.#ce>1?false:this.#de;this.#de=t.Type.isBoolean(i.showOutsideDays)?i.showOutsideDays:this.#de;this.#Ue=t.Type.isPlainObject(i.popupOptions)?i.popupOptions:this.#Ue;this.setMinDays(i.minDays);this.setMaxDays(i.maxDays);this.setHideOnSelect(i.hideOnSelect);this.setTargetNode(i.targetNode);this.setToggleSelected(i.toggleSelected);this.setAutoHide(i.autoHide);this.setHideByEsc(i.hideByEsc);this.setCacheable(i.cacheable);this.setSingleOpening(i.singleOpening);this.setDayColors(i.dayColors);this.setDayMarks(i.dayMarks);this.setHideHeader(i.hideHeader);this.subscribeFromOptions(i.events);
260this.#Ge=new L(this)}setViewDate(e){let t=this.createDate(e);if(t===null){return}t=V(t,0,0,0);this.#J=t;if(this.isDateOutOfView(this.getFocusDate())){this.setFocusDate(null,{adjustViewDate:false,render:false})}if(this.isRendered()){this.getPicker().render()}}getViewDate(){return this.#J}getDefaultViewDate(){return this.getSelectedDate()||this.#ee||this.getToday()}adjustViewDate(e){if(this.isSingleMode()){if(this.getNumberOfMonths()===1){if(!f(e,this.getViewDate(),"month")){this.setViewDate(m(e.getUTCFullYear(),e.getUTCMonth()))}}else{const{year:t,month:s}=this.getViewDateParts();const i=m(t,s);const n=h(m(t,s+this.getNumberOfMonths()-1),"month");if(e<i||e>=n){this.setViewDate(m(e.getUTCFullYear(),e.getUTCMonth()))}}}else{const t=this.getPicker("day");const s=t.getMonths();const i=s[0].weeks[0][0].date;const n=s.at(-1).weeks.at(-1).at(-1).date;if(e<i||e>n){this.setViewDate(m(e.getUTCFullYear(),e.getUTCMonth()))}}}getViewDateParts(){return g(this.#J)}selectDate(e,t={}){if(this.isRangeMode()){throw new Error("DatePicker: to select a range use selectRange method.")}if(!B(e)){return false}const s=this.createDate(e);if(this.isDateSelected(s,"datetime")){return false}const i=this.isDateSelected(s,"day");if(!i&&this.isMultipleMode()&&this.#te.length>=this.getMaxDays()){return false}const{emitEvents:n,render:r,updateInputs:a}={emitEvents:true,render:true,updateInputs:true,...t};if(n&&!this.#Je(s)){return false}if(this.isMultipleMode()){if(i){const e=this.#te.findIndex((e=>f(e,s,"day")));if(e!==-1){this.#te.splice(e,1,s)}}else{const e=this.#te.findIndex((e=>e>s));if(e===-1){this.#te.push(s)}else if(e===0){this.#te.unshift(s)}else{this.#te.splice(e,0,s)}}}else{const e=this.#te[0]||null;if(n&&e!==null){if(!this.#et(e)){return false}this.deselectDate(e,{emitEvents:false,render:false});this.emit(D.DESELECT,{date:e})}this.#te=[s]}this.adjustViewDate(s);if(this.isRendered()&&r){this.getPicker().render()}if(a){this.updateInputFields()}if(n){this.emit(D.SELECT,{date:s});this.emit(D.SELECT_CHANGE)}return true}selectDates(e,s={}){if(!t.Type.isArrayFilled(e)){return}if(this.isRangeMode()){const[t,i]=e;this.selectRange(t,i,s)}else{e.forEach((e=>{this.selectDate(e,s)}))}}selectRange(e,t=null,s={}){if(!this.isRangeMode()){throw new Error("DatePicker: to select a date use selectDate method.")}if(!B(e)||t!==null&&!B(t)){return false}let i=this.createDate(e);let n=t===null?null:this.createDate(t);if(i===null&&n===null){return false}if(i!==null&&n!==null&&i>n){[i,n]=[n,i]}const r=this.#te[0]||null;const a=this.#te[1]||null;if(f(i,r,"datetime")&&(n===null&&a===null||f(n,a,"datetime"))){return false}const{emitEvents:o,updateInputs:l}={emitEvents:true,updateInputs:true,...s};const u=r!==null&&o&&!f(i,r,"datetime")&&!f(n,r,"datetime");const d=a!==null&&o&&!f(i,a,"datetime")&&!f(n,a,"datetime");const c=!this.isDateSelected(i,"datetime");const h=n!==null&&(!this.isDateSelected(n,"datetime")||a===null&&f(n,i,"datetime"));if(u&&!this.#et(r)){return false}if(d&&!this.#et(a)){return false}if(c&&!this.#Je(i)){return false}if(h&&!this.#Je(n)){return false}if(u){this.deselectDate(r,{emitEvents:false,render:false});this.emit(D.DESELECT,{date:r})}if(d){this.deselectDate(a,{emitEvents:false,render:false});this.emit(D.DESELECT,{date:a})}this.#te=n===null?[i]:[i,n];this.adjustViewDate(i);if(this.isRendered()){this.getPicker().render()}if(l){this.updateInputFields()}if(o){if(c){this.emit(D.SELECT,{date:i})}if(h){this.emit(D.SELECT,{date:n})}this.emit(D.SELECT_CHANGE)}return true}deselectDate(e,t={}){if(!B(e)){return false}const s=this.createDate(e);const{emitEvents:i,render:n,updateInputs:r}={emitEvents:true,render:true,updateInputs:true,...t};if(i&&!this.#et(s)){return false}if(this.isMultipleMode()&&this.#te.length<=this.getMinDays()){return false}const a=this.#te.findIndex((e=>f(s,e)));if(a===-1){return false}this.#te.splice(a,1);if(i){this.emit(D.DESELECT,{date:s});this.emit(D.SELECT_CHANGE)}if(this.isRendered()&&n){this.getPicker().render()}if(r){this.updateInputFields()}return true}deselectAll(e={}){const t=[...this.#te];t.forEach((t=>{this.deselectDate(t,e)}));return this.#te.length===0}#Je(e){const t=new i.BaseEvent({data:{date:e}});
260this.emit(D.BEFORE_SELECT,t);return!t.isDefaultPrevented()}#et(e){const t=new i.BaseEvent({data:{date:e}});this.emit(D.BEFORE_DESELECT,t);return!t.isDefaultPrevented()}getSelectedDates(){return this.#te}getSelectedDate(){return this.#te[0]||null}getRangeStart(){return this.#te[0]||null}getRangeEnd(){return this.#te[1]||null}isDateSelected(e,t="day"){return this.#te.some((s=>f(e,s,t)))}setFocusDate(e,t={}){if(!B(e)&&e!==null){return}this.#se=e===null?null:this.createDate(e);const{render:s,adjustViewDate:i}={render:true,adjustViewDate:true,...t};if(i&&this.isDateOutOfView(this.#se)){this.setViewDate(m(this.#se.getUTCFullYear(),this.#se.getUTCMonth()))}if(this.isRendered()&&s){this.getPicker().render()}}getFocusDate(){return this.#se}getInitialFocusDate(e="datetime"){const s=this.getFocusDate();if(s!==null){return s}if(e==="range-start"){const{year:e,month:t,day:s}=this.getViewDateParts();return this.getRangeStart()||m(e,t,s)}if(e==="range-end"){const{year:e,month:t,day:s}=this.getViewDateParts();return this.getRangeEnd()||m(e,t,s)}const i=this.getSelectedDates();if(t.Type.isArrayFilled(i)){const e=i.find((e=>!this.isDateOutOfView(e)));if(t.Type.isDate(e)){return e}}return this.getViewDate()}isDateOutOfView(e){if(e===null){return false}let t=false;const{year:s}=this.getViewDateParts();const{year:i}=g(e);if(this.getCurrentView()==="day"){const s=this.getPicker("day");const i=s.getFirstDay();const n=s.getLastDay();const r=m(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());t=r<i||r>=n}else if(this.getCurrentView()==="month"){t=s!==i}else if(this.getCurrentView()==="year"){const e=this.getPicker("year");const s=e.getFirstYear();const n=e.getLastYear();t=i<s||i>n}return t}setCurrentView(e){if(this.#ne===e){return}const s=this.getPicker(e);if(s===null){return}t.Dom.style(this.getPicker()?.getContainer(),"display","none");t.Dom.attr(this.getPicker()?.getContainer(),"inert",true);this.getPicker()?.onHide();this.#ne=e;this.setFocusDate(null,{render:false});if(!s.isRendered()){s.renderTo(this.getViewsContainer())}this.focus();t.Dom.style(s.getContainer(),"display",null);t.Dom.attr(s.getContainer(),"inert",null);s.onShow();s.render()}getCurrentView(){return this.#ne}getPicker(e){const s=t.Type.isStringFilled(e)?e:this.#ne;let i=this.#ae.get(s)||null;if(i===null){i=this.#tt(s);if(i!==null){this.#ae.set(s,i)}}return i}#Ze(e){if(["date","year","month","time"].includes(e)){this.#ie=e}}getType(){return this.#ie}getFirstWeekDay(){return this.#oe}getNumberOfMonths(){return this.#ce}shouldShowWeekDays(){return this.#le}shouldShowWeekNumbers(){return this.#ue}shouldShowOutsideDays(){return this.#de}getWeekends(){return this.#fe}isWeekend(e){return this.#fe.includes(e.getUTCDay())}isHoliday(e){return this.#pe.some((([t,s])=>e.getUTCDate()===t&&e.getUTCMonth()===s))}isWorkday(e){return this.#De.some((([t,s])=>e.getUTCDate()===t&&e.getUTCMonth()===s))}isDayOff(e){return!this.isWorkday(e)&&(this.isWeekend(e)||this.isHoliday(e))}isTimeEnabled(){return this.#Te}setDefaultTime(e){if(t.Type.isStringFilled(e)&&/([01]{1,2}\d|2[0-3]):[0-5]\d(:[0-5]\d)?/.test(e)){this.#be=e}}getDefaultTime(){return this.#be}setDefaultTimeSpan(e){if(t.Type.isNumber(e)&&e>=0){this.#Se=e}}getDefaultTimeSpan(){return this.#Se}getDefaultTimeParts(){const e=this.getDefaultTime().split(":");return{hours:Number(e[0]||0),minutes:Number(e[1]||0),seconds:Number(e[2]||0)}}getTimePickerStyle(){return this.#Me}shouldCutZeroTime(){return this.#ve}shouldAllowSeconds(){return this.#ye}setToggleSelected(e){if(t.Type.isBoolean(e)||t.Type.isNull(e)){this.#Le=e}}shouldToggleSelected(){if(this.#Le!==null){return this.#Le}return this.isMultipleMode()}setMaxDays(e){if(t.Type.isNumber(e)&&e>0){this.#he=e}}getMaxDays(){return this.#he}setMinDays(e){if(t.Type.isNumber(e)&&e>0){this.#me=e}}getMinDays(){return this.#me}isFullYear(){return this.#ge}isAmPmMode(){return this.#Ce}getMinuteStep(){return this.#ke}getMinuteStepByDate(e){let s=this.getMinuteStep();if(!t.Type.isDate(e)){return s}const i=e.getUTCMinutes();if(i>0&&i%s!==0){const e=[30,15,10,5,1];const t=e.indexOf(i);const n=t===-1?[1]:e.slice(t);for(const e of n){if(i%e===0){s=e;break}}}return s}getToday(){return this.createDate(new Date)}show(){this.updateFromInputFields();if(this.isInline()){if(!this.isRendered()){this.#st()}}else{this.getPopup().show()}}
260hide(){if(!this.isRendered()||this.isInline()){return}this.getPopup().close()}isOpen(){return this.#xe!==null&&this.#xe.isShown()}adjustPosition(){if(this.isRendered()&&this.isOpen()){this.getPopup().adjustPosition()}}toggle(){if(this.isOpen()){this.hide()}else{this.show()}}focus(){if(this.isRendered()){this.getContainer().tabIndex=0;this.getContainer().focus({preventScroll:true});this.getContainer().tabIndex=-1}}setSingleOpening(e){if(t.Type.isBoolean(e)){this.#Ne=e}}isSingleOpening(){return this.#Ne}setDayColors(e){if(!t.Type.isArray(e)){return}const s=[];for(const i of e){if(!t.Type.isStringFilled(i.bgColor)&&!t.Type.isStringFilled(i.textColor)){continue}const e=this.#it(i.matcher);if(t.Type.isArrayFilled(e)){s.push({bgColor:t.Type.isStringFilled(i.bgColor)?i.bgColor:null,textColor:t.Type.isStringFilled(i.textColor)?i.textColor:null,matchers:e})}}this.#Xe=s;if(this.isRendered()){this.getPicker().render()}}getDayColor(e){return this.#Xe.find((t=>Y(e,t.matchers)))||null}setDayMarks(e){if(!t.Type.isArray(e)){return}const s=[];for(const i of e){if(!t.Type.isStringFilled(i.bgColor)){continue}const e=this.#it(i.matcher);if(t.Type.isArrayFilled(e)){s.push({bgColor:i.bgColor,matchers:e})}}this.#qe=s;if(this.isRendered()){this.getPicker().render()}}getDayMarks(e){return this.#qe.filter((t=>Y(e,t.matchers)))}#it(e){if(t.Type.isUndefined(e)){return[]}const s=[];const i=t.Type.isArray(e)?[...e]:[e];i.forEach((e=>{if(t.Type.isArray(e)){const t=[];e.forEach((s=>{if(!B(s)){return}const i=this.createDate(e);if(i!==null){t.push(i)}}));s.push(t)}else if(B(e)){const t=this.createDate(e);if(t!==null){s.push(t)}}else if(t.Type.isBoolean(e)||t.Type.isFunction(e)){s.push(e)}}));return s}getPopup(){if(this.#xe!==null){return this.#xe}const e={...this.#Ue};const t=e.events;delete e.events;this.#xe=new r.Popup({contentPadding:0,padding:0,offsetTop:5,bindElement:this.getTargetNode(),bindOptions:{forceBindPosition:true},autoHide:this.isAutoHide(),closeByEsc:this.shouldHideByEsc(),cacheable:this.isCacheable(),content:this.getContainer(),autoHideHandler:this.#nt.bind(this),events:{onFirstShow:this.#rt.bind(this),onShow:this.#at.bind(this),onClose:this.#ot.bind(this),onDestroy:this.#lt.bind(this)},...e});this.#xe.subscribeFromOptions(t);return this.#xe}#Qe(e){if(this.getType()!=="date"){this.#re="single"}else if(["single","multiple","range","none"].includes(e)){this.#re=e}}setHideOnSelect(e){if(t.Type.isBoolean(e)){this.#_e=e}}shouldHideOnSelect(){if(this.isInline()){return false}return this.#_e}setDateSeparator(e){if(t.Type.isStringFilled(e)){this.#He=e}}getDateSeparator(){return this.#He}setInputField(e){const t=this.#ut(e);if(t!==null){this.#we=t;this.#dt(t)}}setRangeStartInput(e){const t=this.#ut(e);if(t!==null){this.#Ee=t;this.#dt(t)}}setRangeEndInput(e){const t=this.#ut(e);if(t!==null){this.#Pe=t;this.#dt(t)}}#ut(e){if(t.Type.isStringFilled(e)){const s=document.querySelector(e);if(t.Type.isElementNode(s)||s.nodeName==="INPUT"||s.nodeName==="TEXTAREA"){return s}console.error(`Date Picker: a form element was not found (${e}).`)}else if(t.Type.isElementNode(e)&&(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA")){return e}return null}#dt(e){if(!this.shouldUseInputEvents()){return}t.Event.bind(e,"click",this.#t.remember("click-handler",(()=>this.#ct.bind(this))));t.Event.bind(e,"focusout",this.#t.remember("focusout-handler",(()=>this.#ht.bind(this))));t.Event.bind(e,"keydown",this.#t.remember("keydown-handler",(()=>this.#mt.bind(this))));t.Event.bind(e,"input",this.#t.remember("change-handler",(()=>this.#gt.bind(this))))}
260#ft(e){t.Event.unbind(e,"click",this.#t.get("click-handler"));t.Event.unbind(e,"focusout",this.#t.get("focusout-handler"));t.Event.unbind(e,"keydown",this.#t.get("keydown-handler"));t.Event.unbind(e,"input",this.#t.get("change-handler"))}#ct(e){if(this.isRangeMode()){this.setTargetNode(e.target);if(!this.isOpen()){this.show()}}else{this.show()}}#ht(e){if(!this.getContainer().contains(e.relatedTarget)){this.hide()}}#mt(e){if(e.key==="Tab"&&!e.shiftKey&&this.isOpen()){e.preventDefault();const t=this.getPicker().getContainer();const[,s]=N(t,(e=>e.dataset.tabPriority==="true"));if(s===null){this.focus()}else{s.focus({preventScroll:true,focusVisible:true});this.#Ge.setLastFocusElement(s)}}}#gt(e){if(this.isOpen()){this.updateFromInputFields()}}#nt(e){const t=e.target;const s=this.getPopup().getPopupContainer();if(t===s||s.contains(t)){return false}if(this.isRangeMode()){const e=(this.getRangeStartInput()===t||this.getRangeEndInput()===t)&&this.getTargetNode()!==t;return!e}return true}shouldUseInputEvents(){return this.#Ie}getInputField(){return this.#we}getRangeStartInput(){return this.#Ee}getRangeEndInput(){return this.#Pe}updateInputFields(){if(this.isSingleMode()){if(this.getType()==="time"){this.#pt(this.getInputField(),this.get
260SelectedDate(),this.getTimeFormat())}else{this.#pt(this.getInputField(),this.getSelectedDate())}}else if(this.isMultipleMode()){this.#pt(this.getInputField(),this.getSelectedDates().map((e=>this.formatDate(e))).join(this.getDateSeparator()))}else if(this.isRangeMode()){this.#pt(this.getRangeStartInput(),this.getRangeStart());this.#pt(this.getRangeEndInput(),this.getRangeEnd())}}#Dt(){if(this.getInputField()!==null){this.getInputField().focus({preventScroll:true})}else if(this.getRangeStartInput()!==null){this.getRangeStartInput().focus({preventScroll:true})}}updateFromInputFields(){if(this.isSingleMode()&&this.getInputField()!==null){const e=this.#Tt(this.getInputField());if(e===null){this.deselectAll({updateInputs:false,emitEvents:false})}else{this.selectDate(e,{updateInputs:false,emitEvents:false})}}else if(this.isMultipleMode()&&this.getInputField()!==null){const e=this.getInputField().value.trim();const t=e.split(this.getDateSeparator().trim()).map((e=>this.createDate(e.trim()))).filter((e=>e!==null));this.deselectAll({updateInputs:false,emitEvents:false});this.selectDates(t,{updateInputs:false,emitEvents:false})}else if(this.isRangeMode()&&this.getRangeStartInput()!==null){const e=this.#Tt(this.getRangeStartInput());const t=this.#Tt(this.getRangeEndInput());if(e===null){this.deselectAll({updateInputs:false,emitEvents:false})}else{this.selectRange(e,t,{updateInputs:false,emitEvents:false})}}}#Tt(e){if(e===null){return null}const s=e.value.trim();if(!t.Type.isStringFilled(s)){return null}if(this.getType()==="time"){return U(s,this.getTimeFormat())}return this.createDate(s)}#pt(e,s,i=null){if(e!==null){let n="";if(s===null){n=""}else if(t.Type.isString(s)){n=s}else{n=this.formatDate(s,i)}e.value=n}}getLocale(){return this.#We}isRendered(){return this.#s}getContainer(){return this.#t.remember("container",(()=>{const e=["ui-date-picker"];if(this.isInline()){e.push("--inline")}if(this.shouldHideHeader()){e.push("--hide-header")}e.push(`--${this.getType()}-picker`);return t.Tag.render`
261				<div tabindex="-1" onkeyup="${this.#yt.bind(this)}" class="${e.join(" ")}">
262					${this.getViewsContainer()}
263				</div>
264			`}))}getViewsContainer(){return this.#t.remember("views",(()=>t.Tag.render`<div class="ui-date-picker-views"></div>`))}isMultipleMode(){return this.#re==="multiple"}isSingleMode(){return this.#re==="single"}isRangeMode(){return this.#re==="range"}isInline(){return this.#Be}isFocused(){const e=this.getContainer();const t=e.ownerDocument.activeElement;return e.contains(t)||e===t}setAutoFocus(e){if(t.Type.isBoolean(e)){this.#Ve=e}}isAutoFocus(){return this.#Ve}setTargetNode(e){if(!t.Type.isDomNode(e)&&!t.Type.isNull(e)&&!t.Type.isObject(e)){return}this.#Fe=e;if(this.isRendered()){this.getPopup().setBindElement(this.#Fe);this.getPopup().adjustPosition()}}getTargetNode(){return this.#Fe}setAutoHide(e){if(t.Type.isBoolean(e)){this.#Re=e;if(this.isRendered()){this.getPopup().setAutoHide(e)}}}isAutoHide(){return this.#Re}setHideByEsc(e){if(t.Type.isBoolean(e)){this.#$e=e;if(this.isRendered()){this.getPopup().setClosingByEsc(e)}}}shouldHideByEsc(){return this.#$e}isCacheable(){return this.#Oe}setCacheable(e){if(t.Type.isBoolean(e)){this.#Oe=e;if(this.isRendered()){this.getPopup().setCacheable(e)}}}setHideHeader(e){if(t.Type.isBoolean(e)){this.#je=e;if(this.isRendered()){if(e){t.Dom.addClass(this.getContainer(),"--hide-header")}else{t.Dom.removeClass(this.getContainer(),"--hide-header")}}}}shouldHideHeader(){return this.#je}createDate(e){return U(e,this.getDateFormat())}formatDate(e,t=null){const s=e.getUTCHours()===0&&e.getUTCMinutes()===0&&e.getUTCSeconds()===0;const i=t===null?this.getDateFormat():t;let r=n.DateTimeFormat.format(i,e,null,true);if(this.isTimeEnabled()&&s&&this.shouldCutZeroTime()){r=r.replaceAll(/\s*12:00:00 am\s*/gi,"").replaceAll(/\s*12:00 am\s*/gi,"").replaceAll(/\s*00:00:00\s*/g,"").replaceAll(/\s*00:00\s*/g,"")}return r}formatTime(e,t=null){return n.DateTimeFormat.format(t===null?this.getTimeFormat():t,e,null,true)}getDateFormat(){return this.#Ye}#ze(){if(this.getType()==="year"){return"Y"}if(this.getType()==="month"){return"f - Y"}
264if(this.isTimeEnabled()){if(this.shouldAllowSeconds()){return n.DateTimeFormat.getFormat("FORMAT_DATETIME")}return n.DateTimeFormat.getFormat("FORMAT_DATETIME").replace(/:s/i,"")}return n.DateTimeFormat.getFormat("FORMAT_DATE")}getTimeFormat(){return this.#Ae}#st(){if(this.isRendered()){return}if(this.isInline()&&this.getTargetNode()!==null){t.Dom.append(this.getContainer(),this.getTargetNode())}const e=["day","month","year","time"];const s=e.indexOf(this.getType());const i=s===-1?"day":e[s];this.setCurrentView(i);this.#s=true;if(this.#Ge!==null){this.#Ge.init()}}#tt(e){if(e==="day"){const e=new p(this);e.subscribe("onSelect",this.#Ct.bind(this));e.subscribe("onFocus",this.#kt.bind(this));e.subscribe("onBlur",this.#bt.bind(this));e.subscribe("onPrevBtnClick",(()=>{const e=this.isFullYear()?"year":"month";const t=u(d(this.getViewDate(),e),e,-1);this.setViewDate(t)}));e.subscribe("onNextBtnClick",(()=>{const e=this.isFullYear()?"year":"month";const t=h(this.getViewDate(),e);this.setViewDate(t)}));e.subscribe("onMonthClick",(()=>this.setCurrentView("month")));e.subscribe("onYearClick",(()=>this.setCurrentView("year")));e.subscribe("onTimeClick",this.#d.bind(this,"datetime"));e.subscribe("onRangeStartClick",this.#d.bind(this,"range-start"));e.subscribe("onRangeEndClick",this.#d.bind(this,"range-end"));return e}if(e==="month"){const e=new _(this);e.subscribe("onSelect",this.#St.bind(this));e.subscribe("onFocus",this.#Mt.bind(this));e.subscribe("onBlur",this.#vt.bind(this));e.subscribe("onPrevBtnClick",(()=>{const{year:e,month:t}=g(this.getViewDate());const s=m(e-1,t,1);this.setViewDate(s)}));e.subscribe("onNextBtnClick",(()=>{const{year:e,month:t}=g(this.getViewDate());const s=m(e+1,t,1);this.setViewDate(s)}));e.subscribe("onTitleClick",(()=>this.setCurrentView("year")));return e}if(e==="year"){const e=new q(this);e.subscribe("onSelect",this.#Ft.bind(this));e.subscribe("onFocus",this.#wt.bind(this));e.subscribe("onBlur",this.#Et.bind(this));e.subscribe("onPrevBtnClick",(()=>{const{year:e}=g(this.getViewDate());const t=m(e-12,0,1);this.setViewDate(t)}));e.subscribe("onNextBtnClick",(()=>{const{year:e}=g(this.getViewDate());const t=m(e+12,0,1);this.setViewDate(t)}));return e}if(e==="time"){const e=this.getTimePickerStyle()==="wheel"?new j(this):new X(this);if(this.isRangeMode()){e.subscribe("onSelect",this.#Pt.bind(this))}else{e.subscribe("onSelect",this.#It.bind(this))}e.subscribe("onFocus",this.#Ht.bind(this));e.subscribe("onBlur",this.#xt.bind(this));e.subscribe("onPrevBtnClick",(()=>this.setCurrentView("day")));e.subscribe("onTitleClick",(()=>this.setCurrentView("day")));return e}return null}#yt(e){if(this.isInline()){return}if(e.key==="Escape"&&this.shouldHideByEsc()){this.hide()}}#d(e){const t=this.getPicker("time");const s=e==="range-start"&&this.getRangeStart()!==null||e==="range-end"&&this.getRangeEnd()!==null||this.getSelectedDate()!==null;if(s){t.setMode(e);this.setCurrentView("time")}}#Ct(e){const{year:t,month:s,day:n}=e.getData();let r=m(t,s,n);const a=new i.BaseEvent({data:{date:r}});this.emit(D.BEFORE_DAY_SELECT,a);if(a.isDefaultPrevented()){return}if(this.isRangeMode()){const e=this.#te;if(e.length===0){const{hours:e,minutes:t,seconds:s}=this.getDefaultTimeParts();r=V(r,e,t,s)}else if(e.length===1){let{hours:e,minutes:t,seconds:s}=this.getDefaultTimeParts();if(this.isDateSelected(r,"day")){({hours:e,minutes:t,seconds:s}=g(this.getRangeStart()));t+=this.getDefaultTimeSpan()}r=V(r,e,t,s)}const t=k(r,e);const[s,i]=t;if(t.length===0){this.deselectAll()}else{this.selectRange(s,i)}}else if(this.isDateSelected(r)){if(this.shouldToggleSelected()){this.deselectDate(r)}else if(this.shouldHideOnSelect()&&this.isSingleMode()){this.hide()}}else{let{hours:e,minutes:i,seconds:r}=this.getDefaultTimeParts();if(this.isSingleMode()&&this.getSelectedDate()!==null){({hours:e,minutes:i,seconds:r}=g(this.getSelectedDate()))}this.selectDate(m(t,s,n,e,i,r));if(this.shouldHideOnSelect()&&this.isSingleMode()&&!this.isTimeEnabled()){this.hide()}}}#kt(e){const{year:t,month:s,day:i}=e.getData();const n=m(t,s,i);if(!f(n,this.getFocusDate())){this.setFocusDate(n)}}#bt(e){this.setFocusDate(null)}#Mt(e){const{year:t,month:s}=e.getData();const i=m(t,s);if(!f(i,this.getFocusDate(),"month")){this.setFocusDate(i)}}#vt(e){this.setFocusDate(null)}#wt(e){const{year:t}=e.getData();const s=m(t);if(!f(s,this.getFocusDate(),"year")){this.setFocusDate(s)}}#Et(e){this.setFocusDate(null)}#Ht(e){const{hour:s,minute:i}=e.getData();let n=o(this.getInitialFocusDate());if(t.Type.isNumber(s)){n=V(n,s,null,null);this.setFocusDate(n)}else if(t.Type.isNumber(i)){n=V(n,null,i,null);this.setFocusDate(n)}}#xt(e){this.setFocusDate(null)}#St(e){const{year:t}=g(this.getViewDate());const s=e.getData().month;const i=m(t,s);if(this.getType()==="month"){this.selectDate(i);if(this.shouldHideOnSelect()){this.hide()}}else{this.setViewDate(i);this.setCurrentView("day")}}#Ft(e){const{month:t}=g(this.getViewDate());const s=e.getData().year;const i=m(s,t);if(this.getType()==="year"){this.selectDate(m(s));if(this.shouldHideOnSelect()){this.hide()}}else{this.setViewDate(i);this.setCurrentView("day")}}#It(e){let s=null;
264if(this.getType()==="time"){s=this.getSelectedDate()===null?h(this.getToday(),"day"):o(this.getSelectedDate())}else if(this.getSelectedDate()===null){return}else{s=o(this.getSelectedDate())}const i=()=>{if(this.shouldHideOnSelect()){this.hide()}else if(this.getType()==="date"){this.setCurrentView("day")}};const{hour:n,minute:r}=e.getData();if(t.Type.isNumber(n)){const e=this.getSelectedDate()===null?-1:s.getUTCHours();if(e===n){i()}else{s.setUTCHours(n);this.selectDate(s)}}else if(t.Type.isNumber(r)){const e=this.getSelectedDate()===null?-1:s.getUTCMinutes();if(e!==r){s.setUTCMinutes(r);this.selectDate(s)}if(this.getTimePickerStyle()==="grid"){i()}}}#Pt(e){const s=e.getTarget();const i=s.getMode()==="range-end";let n=this.getRangeStart()===null?null:o(this.getRangeStart());let r=this.getRangeEnd()===null?null:o(this.getRangeEnd());if(n===null||r===null&&i){return}const a=()=>{if(this.getType()==="date"&&this.getTimePickerStyle()==="grid"){this.setCurrentView("day")}};const{hour:l,minute:d}=e.getData();if(t.Type.isNumber(l)){if(i){const e=r.getUTCHours();if(e===l){a();return}r.setUTCHours(l)}else{const e=n.getUTCHours();if(e===l){a();return}n.setUTCHours(l)}}else if(t.Type.isNumber(d)){if(i){const e=r.getUTCMinutes();if(e===d){a();return}r.setUTCMinutes(d)}else{const e=n.getUTCMinutes();if(e===d){a();return}n.setUTCMinutes(d)}}if(r!==null&&n>r){if(i){n=u(r,"minute",-this.getDefaultTimeSpan())}else{r=u(n,"minute",this.getDefaultTimeSpan())}}this.selectRange(n,r);if(t.Type.isNumber(d)){a()}}#at(){if(!this.isFocused()&&this.isAutoFocus()){this.focus()}if(this.isSingleOpening()){if(G!==null){G.hide()}G=this}
264this.emit("onShow")}#rt(){this.#st();this.emit("onFirstShow")}#ot(){if(this.getType()==="date"){this.setCurrentView("day")}this.setFocusDate(null);this.setViewDate(this.getDefaultViewDate());if(this.isSingleOpening()){G=null}if(this.isFocused()){this.#Dt()}this.emit("onHide")}#lt(){this.destroy()}destroy(){if(this.#Ke){return}this.#Ke=true;this.emit(D.DESTROY);if(this.isRendered()){t.Dom.remove(this.getContainer())}this.#ft(this.getInputField());this.#ft(this.getRangeStartInput());this.#ft(this.getRangeEndInput());if(this.#xe!==null){this.#xe.destroy()}this.#t=null;this.#ae=null;this.#te=null;if(this.isSingleOpening()){G=null}Object.setPrototypeOf(this,null)}}function Z(e){if(!t.Type.isDate(e)){return false}return!Number.isNaN(e.getTime())}e.DatePicker=K;e.DatePickerEvent=D;e.addDate=u;e.addToRange=k;e.ceilDate=h;e.cloneDate=o;e.convertToDbFormat=S;e.copyTime=C;e.createDate=U;e.createUtcDate=m;e.floorDate=d;e.getDate=g;e.getDaysInMonth=l;e.getFocusableBoundaryElements=N;e.getNextDate=c;e.isDateAfter=T;e.isDateBefore=y;e.isDateLike=B;e.isDateMatch=Y;e.isDatesEqual=f;e.isValidDate=Z;e.parseDate=H;e.setTime=V})(this.BX.UI.DatePicker=this.BX.UI.DatePicker||{},BX,BX.Cache,BX.Event,BX.Main,BX.Main);
265//# sourceMappingURL=date-picker.bundle.map.js

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.