@lekoala/date-picker 0.5.3 → 0.6.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.
@@ -1,16 +1,16 @@
1
- /*** @lekoala/date-picker v0.5.3 - https://github.com/lekoala/date-picker ***/
2
- (()=>{var Pt=":where(date-calendar,date-picker){--dp-bg: #ffffff;--dp-fg: #1f2328;--dp-muted: color-mix(in srgb,var(--dp-fg) 58%,var(--dp-bg));--dp-border: color-mix(in srgb,var(--dp-fg) 16%,var(--dp-bg));--dp-hover: color-mix(in srgb,var(--dp-fg) 5%,var(--dp-bg));--dp-accent: #2563eb;--dp-accent-fg: #fff;--dp-focus: var(--dp-accent);--dp-focus-width: 2px;--dp-radius: 0.5rem;--dp-day-size: 2.75rem;--dp-gap: 0.375rem;--dp-header-control-size: 2.25rem;--dp-header-block-gap: 0.75rem;--dp-row-gap: 0.375rem;--dp-picker-button-size: 2.5rem;--dp-year-inline-size: 5.5rem;--dp-day-radius: calc(var(--dp-radius) * 0.75);color: var(--dp-fg);font: inherit}.dp-visually-hidden{position: absolute !important;inline-size: 1px !important;block-size: 1px !important;padding: 0 !important;margin: -1px !important;overflow: hidden !important;clip: rect(0 0 0 0) !important;white-space: nowrap !important;border: 0 !important}date-calendar{display: block;inline-size: max-content;max-inline-size: 100%}.dp-calendar-shell{inline-size: max-content;max-inline-size: 100%}.dp-calendar-header{display: grid;grid-template-columns: minmax(0,1fr) var(--dp-year-inline-size) auto auto;align-items: stretch;gap: var(--dp-gap);margin-block-end: var(--dp-header-block-gap)}date-calendar[data-year-first] .dp-calendar-header{grid-template-columns: var(--dp-year-inline-size) minmax(0,1fr) auto auto}.dp-calendar-header :where(button,select,input){box-sizing: border-box;min-inline-size: 0}.dp-calendar-header .dp-skin{min-block-size: var(--dp-header-control-size);padding-block: 0.15rem;border: 1px solid var(--dp-border);border-radius: calc(var(--dp-radius) * 0.75);background: var(--dp-bg);color: var(--dp-fg);font: inherit;line-height: 1.2}.dp-calendar-header input.dp-skin{padding-inline: 0.45rem}.dp-month-select{inline-size: 100%;overflow: hidden;text-overflow: ellipsis}.dp-month-select.dp-skin{appearance: none;padding-inline: 0.45rem 2rem;background-image: linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);background-position: calc(100% - 0.9rem) 50%,calc(100% - 0.65rem) 50%;background-size: 0.3rem 0.3rem;background-repeat: no-repeat}[dir=\"rtl\"] .dp-month-select.dp-skin,html[dir=\"rtl\"] .dp-month-select.dp-skin{background-position: 0.9rem 50%,0.65rem 50%}.dp-year-input{inline-size: 100%}.dp-nav.dp-skin{display: grid;place-items: center;inline-size: var(--dp-header-control-size);padding: 0;font-size: 1.35rem;line-height: 1;cursor: pointer}.dp-nav svg{display: block;inline-size: 1rem;block-size: 1rem;pointer-events: none}.dp-calendar-header .dp-skin:disabled,.dp-picker-button:disabled{cursor: not-allowed;opacity: 0.45}.dp-nav.dp-skin:hover:not(:disabled){background: var(--dp-hover)}.dp-calendar-header .dp-skin:focus-visible,date-picker>input:not([type=\"hidden\"]):focus-visible,.dp-day:focus-visible{outline: var(--dp-focus-width) solid var(--dp-focus);outline-offset: calc(var(--dp-focus-width) * -1)}.dp-day:hover:not([data-disabled=\"true\"]):not([data-selected=\"true\"]):not([data-range-start=\"true\"]):not( [data-range-end=\"true\"] ){background: var(--dp-hover)}.dp-grid{border-collapse: separate;border-spacing: 0 var(--dp-row-gap);table-layout: fixed}.dp-grid :where(th,td){box-sizing: border-box;inline-size: var(--dp-day-size);block-size: var(--dp-day-size);padding: 0;text-align: center}.dp-grid thead th{block-size: 1.5rem;color: var(--dp-muted);font-size: 0.72rem;font-weight: 500}.dp-day{position: relative;border: 1px solid transparent;border-radius: var(--dp-day-radius);cursor: pointer;outline: none;vertical-align: middle;font-size: 0.875rem}.dp-day:is([data-selected=\"true\"],[data-range-start=\"true\"],[data-range-end=\"true\"]):focus-visible{outline-color: var(--dp-accent-fg)}.dp-day[data-outside-month=\"true\"]{color: var(--dp-muted)}.dp-day[data-selected=\"true\"]{background: var(--dp-accent);color: var(--dp-accent-fg)}.dp-day[data-today=\"true\"]:not([data-selected=\"true\"],[data-range-start=\"true\"],[data-range-end=\"true\"]){border-color: var(--dp-accent)}.dp-day[data-disabled=\"true\"]{cursor: not-allowed;opacity: 0.42}.dp-day[data-range-start=\"true\"],.dp-day[data-range-end=\"true\"]{background: var(--dp-accent);color: var(--dp-accent-fg)}.dp-day[data-in-range=\"true\"]{border-radius: 0;background: color-mix(in srgb,var(--dp-accent) 18%,var(--dp-bg))}.dp-day[data-range-start=\"true\"]:has(+ [data-in-range=\"true\"],+ [data-range-end=\"true\"]){border-start-end-radius: 0;border-end-end-radius: 0}.dp-day:is([data-in-range=\"true\"],[data-range-start=\"true\"]) + .dp-day[data-range-end=\"true\"]{border-start-start-radius: 0;border-end-start-radius: 0}.dp-day[data-in-range=\"true\"]:first-of-type{border-start-start-radius: var(--dp-day-radius);border-end-start-radius: var(--dp-day-radius)}.dp-day[data-in-range=\"true\"]:last-of-type{border-start-end-radius: var(--dp-day-radius);border-end-end-radius: var(--dp-day-radius)}[data-range-preview] .dp-day:is([data-range-start=\"true\"],[data-range-end=\"true\"]){background: color-mix(in srgb,var(--dp-accent) 58%,var(--dp-bg))}[data-range-preview] .dp-day[data-in-range=\"true\"]{background: color-mix(in srgb,var(--dp-accent) 11%,var(--dp-bg))}[data-range-drag] .dp-day:is([data-range-start=\"true\"],[data-range-end=\"true\"]){cursor: grab}[data-range-drag=\"active\"],[data-range-drag=\"active\"] .dp-day{cursor: grabbing}.dp-day-number{display: block;font-variant-numeric: tabular-nums}.dp-day[data-disabled=\"true\"]:focus-visible{opacity: 1}.dp-day[data-disabled=\"true\"]:focus-visible .dp-day-number{color: var(--dp-muted)}.dp-day-extra{position: absolute;inset-inline: 2px;inset-block-end: 1px;display: flex;justify-content: center;gap: 2px;min-block-size: 0.35rem;font-size: 0.55rem;line-height: 1;pointer-events: none}.dp-week-number,.dp-week-heading{inline-size: 1.6rem !important;color: var(--dp-muted);font-size: 0.65rem;font-weight: 500}date-picker{position: relative;display: inline-grid;grid-template-columns: minmax(0,1fr);align-items: stretch;max-inline-size: 100%}date-picker>input:not([type=\"hidden\"]){min-inline-size: 0}date-picker>input:not([type=\"hidden\"]):not([type=\"time\"]){grid-column: 1;grid-row: 1;box-sizing: border-box;inline-size: 100%;padding-inline-end: calc(var(--dp-picker-button-size) + 0.5rem)}.dp-picker-button{display: grid;place-items: center;grid-column: 1;grid-row: 1;justify-self: end;align-self: stretch;inline-size: var(--dp-picker-button-size);min-inline-size: 0;border: 0;background: transparent;color: var(--dp-fg);font: inherit;cursor: pointer}.dp-picker-button:focus-visible{outline: var(--dp-focus-width) solid var(--dp-focus);outline-offset: -5px;border-radius: var(--dp-radius)}date-picker:has(>[data-time-start],>[data-time-end]){grid-template-columns: minmax(0,1fr) minmax(0,1fr);column-gap: var(--dp-gap)}date-picker:has(>[data-time-start]):has(>[data-time-end]){grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}date-picker>input[data-time-start]{grid-column: 2;grid-row: 1;min-inline-size: 0}date-picker>input[data-time-end]{grid-column: 3;grid-row: 1;min-inline-size: 0}date-picker[range]{row-gap: var(--dp-gap)}date-picker[range]>input[data-range-start]{grid-row: 1}date-picker[range]>input[data-range-end]{grid-row: 2}date-picker[range]>.dp-picker-button[data-endpoint=\"start\"]{grid-row: 1}date-picker[range]>.dp-picker-button[data-endpoint=\"end\"]{grid-row: 2}.dp-picker-panel[popover]{position: fixed;inset: auto;margin: 0;padding: 0.875rem 1rem;border: 1px solid var(--dp-border);border-radius: var(--dp-radius);background: var(--dp-bg);color: var(--dp-fg);box-shadow: 0 0.5rem 1.5rem rgb(15 23 42 / 0.12);max-block-size: var(--available-height,90svh);max-inline-size: calc(100vi - 1rem);overflow: auto}.dp-picker-panel:not(:popover-open){display: none}@media (forced-colors: active){.dp-month-select.dp-skin,[dir=\"rtl\"] .dp-month-select.dp-skin{appearance: auto;background-image: none;padding-inline: 0.45rem}.dp-day:is([data-selected=\"true\"],[data-range-start=\"true\"],[data-range-end=\"true\"]){border: 2px solid Highlight;background-color: Canvas;color: CanvasText}.dp-day[data-in-range=\"true\"]{color: CanvasText}.dp-day[data-in-range=\"true\"]::after{content: \"\";position: absolute;inset-inline: 3px;inset-block-end: 4px;block-size: 1px;background-color: Highlight}.dp-day[data-today=\"true\"]{border-color: Highlight}.dp-day-extra{color: CanvasText;forced-color-adjust: none}}";var tt=new WeakMap;var _e=/^(\d{4})-(\d{2})-(\d{2})$/,ye=/^(\d{4})-(\d{2})$/;function be(t){return t%4===0&&(t%100!==0||t%400===0)}function st(t,e){if(e===2)return be(t)?29:28;return[4,6,9,11].includes(e)?30:31}function F(t){let e=_e.exec(String(t||""));if(!e)return null;let s=Number(e[1]),i=Number(e[2]),n=Number(e[3]);if(s<1||s>9999||i<1||i>12)return null;if(n<1||n>st(s,i))return null;return{year:s,month:i,day:n}}function c(t){return F(t)!==null}function p(t){let e=String(t||""),s=ye.exec(e);if(s){let n=Number(s[1]),r=Number(s[2]);if(n>=1&&n<=9999&&r>=1&&r<=12)return`${s[1]}-${String(r).padStart(2,"0")}`}let i=F(e);if(!i)throw TypeError(`Invalid civil date/month: ${t}`);return`${String(i.year).padStart(4,"0")}-${String(i.month).padStart(2,"0")}`}function U(t,e,s){let i=`${String(t).padStart(4,"0")}-${String(e).padStart(2,"0")}-${String(s).padStart(2,"0")}`;if(!c(i))throw TypeError(`Invalid civil date: ${i}`);return i}function B(t){let e=new Date(0);return e.setUTCHours(12,0,0,0),e.setUTCFullYear(t.year,t.month-1,t.day),e}function ve(t){return U(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate())}function N(t){let e=F(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return B(e)}function g(t,e){if(!c(t)||!c(e))throw TypeError("compareDates() expects YYYY-MM-DD values");return t===e?0:t<e?-1:1}function I(t,e){let s=F(t);if(!s||!Number.isInteger(e))throw TypeError("addDays() expects a date and integer amount");let i=B(s);return i.setUTCDate(i.getUTCDate()+e),ve(i)}function ht(t,e){let s=F(t);if(!s||!Number.isInteger(e))throw TypeError("addMonths() expects a date and integer amount");let i=s.year*12+(s.month-1)+e,n=Math.floor(i/12),a=(i%12+12)%12+1,o=Math.min(s.day,st(n,a));return U(n,a,o)}function Ht(t,e){let s=F(t);if(!s||!Number.isInteger(e))throw TypeError("addYears() expects a date and integer amount");let i=s.year+e,n=Math.min(s.day,st(i,s.month));return U(i,s.month,n)}function et(t,e){let s=`${p(t)}-01`;return p(ht(s,e))}function we(t){return`${p(t)}-01`}function Dt(t){let e=F(`${p(t)}-01`);if(!e)throw TypeError(`Invalid month: ${t}`);return U(e.year,e.month,st(e.year,e.month))}function De(t){let e=F(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return B(e).getUTCDay()}function Y(t){if(t===7)return 0;if(!Number.isInteger(t)||t<0||t>6)throw RangeError("firstDay must be 0..6 (Sunday=0, 7 accepted as Sunday alias)");return t}function ft(t,e=1){let s=(De(t)-Y(e)+7)%7;return I(t,-s)}function xt(t,e=1){return I(ft(t,e),6)}function Bt(t,e={}){let s=e.firstDay??1,i=ft(we(t),s),n=xt(Dt(t),s),r=[],a=i;for(;;){let o=[];for(let d=0;d<7;d++)o.push(I(a,d));if(r.push(o),g(o[6],n)>=0){if(!e.fixedWeeks||r.length>=6||g(o[6],I("9999-12-31",-7))>0)break}a=I(a,7)}return r}function zt(t,e,s){let i=B({year:1,month:1,day:1});return Math.round((B({year:t,month:e,day:s}).getTime()-i.getTime())/86400000)}function it(t,e=1){let s=Y(e),i=zt(9999,12,31),n=p(t);for(;;){let r=F(`${n}-01`);if(!r)throw TypeError(`Invalid civil date/month: ${t}`);let a=zt(r.year,r.month,1),o=(B(r).getUTCDay()-s+7)%7;if(a-o<0){n=et(n,1);continue}let d=st(r.year,r.month),l={year:r.year,month:r.month,day:d},h=a+d-1,b=(B(l).getUTCDay()-s+7)%7;if(h-b+6>i){n=et(n,-1);continue}return n}}function Nt(t,e="",s=""){if(!c(t))throw TypeError(`Invalid civil date: ${t}`);if(e&&g(t,e)<0)return e;if(s&&g(t,s)>0)return s;return t}function O(){let t=new Date;return U(t.getFullYear(),t.getMonth()+1,t.getDate())}function Vt(t){let e=F(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);let s=B(e),i=s.getUTCDay()||7;s.setUTCDate(s.getUTCDate()+4-i);let n=new Date(0);return n.setUTCHours(12,0,0,0),n.setUTCFullYear(s.getUTCFullYear(),0,1),Math.ceil(((s.getTime()-n.getTime())/86400000+1)/7)}class Et{constructor(t={}){let e=O();this.firstDay=Y(t.firstDay??1),this.value=t.value&&c(t.value)?t.value:"",this.focused=t.focused&&c(t.focused)?t.focused:this.value||e,this.display=t.display?p(t.display):p(this.focused)}setValue(t){if(t&&!c(t))throw TypeError(`Invalid value: ${t}`);return this.value=t||"",this.value}setDisplay(t){let e=p(t),s=Number(this.focused.slice(8,10))||1,i=ht(`${e}-01`,0),n=I(i,Math.max(0,s-1));return this.focused=p(n)===e?n:I(`${et(e,1)}-01`,-1),this.display=e,this.display}setFocused(t,e={}){if(!c(t))throw TypeError(`Invalid focused date: ${t}`);if(this.focused=t,e.follow!==!1)this.display=p(t);return this.focused}moveFocusDays(t){return this.setFocused(I(this.focused,t))}moveFocusMonths(t){return this.setFocused(ht(this.focused,t))}moveFocusYears(t){return this.setFocused(Ht(this.focused,t))}focusWeekStart(){return this.setFocused(ft(this.focused,this.firstDay))}focusWeekEnd(){return this.setFocused(xt(this.focused,this.firstDay))}navigateMonth(t){let e=et(this.display,t);return this.setDisplay(e),this.display}}function xe(t){if(typeof t!=="string")return"";return[...new Set(t.split(/\s+/).filter((e)=>e&&!e.startsWith("dp-")&&![...e].some((s)=>s.charCodeAt(0)<32||s.charCodeAt(0)===127)))].join(" ")}function At(t,e){return t.month===e.month&&t.year===e.year&&t.nav===e.nav}var Ct={month:"",year:"",nav:""};function nt(){return{...Ct}}function rt(t){if(t==null)return null;let e={};for(let s of["month","year","nav"])if(Object.hasOwn(t,s))e[s]=xe(t[s]);return e}function Ut(t){return t==null||["month","year","nav"].some((e)=>!Object.hasOwn(t,e))}function at(t){return{...nt(),...rt(t)}}function pt(t){let e=at(t);if(At(Ct,e))return;Ct=e;for(let s of kt)s()}var kt=new Set;function jt(t){return kt.add(t),()=>{kt.delete(t)}}function mt(t){if(t==null)return{start:"",end:""};if(typeof t!=="object")throw TypeError("highlightedRange expects { start, end }");let{start:e="",end:s=""}=t;if(e&&!c(e))throw TypeError(`Invalid range start: ${e}`);if(s&&!c(s))throw TypeError(`Invalid range end: ${s}`);if(!e&&s)throw TypeError("highlightedRange cannot define an end without a start");if(e&&s&&g(s,e)<0)throw TypeError("highlightedRange must be ordered; start must be on or before end");return{start:e,end:s}}function gt(t,e){if(!e||!c(t))return"";let{start:s,end:i}=e;if(!s||!c(s))return"";if(s===t)return i?i===t?"single":"start":"start";if(i&&i===t)return"end";if(i&&g(t,s)>=0&&g(t,i)<=0)return"in";return""}class St{constructor(){this.activeEndpoint="",this.start="",this.end=""}get range(){return{start:this.start,end:this.end}}get complete(){return Boolean(this.start&&this.end&&g(this.end,this.start)>=0)}focus(t){this.activeEndpoint=t}_refuse(t){return{status:"refused",endpoint:t,changedEndpoints:[],range:this.range,activeEndpoint:this.activeEndpoint}}project(t,e=()=>!0){if(!c(t))throw TypeError(`Invalid range activation: ${t}`);let{start:s,end:i}=this;if(this.complete&&(g(t,s)<0||g(t,i)>0)){let r=g(t,s)<0?"start":"end";if(!e(r))return this._refuse(r);return{status:"complete",endpoint:r,changedEndpoints:[r],range:r==="start"?{start:t,end:i}:{start:s,end:t},activeEndpoint:r}}if(this.activeEndpoint==="end"){if(s&&!i&&g(t,s)<0){if(!e("start"))return this._refuse("start");if(!e("end"))return this._refuse("end");return{status:"complete",endpoint:"end",changedEndpoints:["start","end"],range:{start:t,end:s},activeEndpoint:"end"}}if(s&&g(t,s)<0)return this._refuse("end");if(!e("end"))return this._refuse("end");return{status:s?"complete":"pending",endpoint:"end",changedEndpoints:["end"],range:{start:s,end:t},activeEndpoint:"end"}}if(i&&!s&&g(t,i)>0){if(!e("start"))return this._refuse("start");if(!e("end"))return this._refuse("end");return{status:"complete",endpoint:"start",changedEndpoints:["start","end"],range:{start:i,end:t},activeEndpoint:"start"}}if(!e("start"))return this._refuse("start");let n=e("end");return{status:"pending",endpoint:"start",changedEndpoints:["start"],range:{start:t,end:i},activeEndpoint:n?"end":this.activeEndpoint,...n?{}:{close:!0}}}projectEndpoint(t,e,s=()=>!0){if(!c(t))throw TypeError(`Invalid range activation: ${t}`);if(!this.complete||!s(e))return this._refuse(e);let{start:i,end:n}=this,r=e==="start"?i:n,a=e==="start"?Ce(t,n):Ee(t,i);return{status:"complete",endpoint:e,changedEndpoints:a===r?[]:[e],range:e==="start"?{start:a,end:n}:{start:i,end:a},activeEndpoint:e}}previewRange(t,e="",s=()=>!0){if(!c(t))return null;if(!e&&Boolean(this.start)===Boolean(this.end))return null;let i=e?this.projectEndpoint(t,e,s):this.project(t,s);if(i.status==="refused")return null;let{start:n,end:r}=i.range;if(!n||r&&g(r,n)<0)return null;return{start:n,end:r}}_apply(t){if(t.status==="refused")return t;return this.start=t.range.start,this.end=t.range.end,this.activeEndpoint=t.activeEndpoint,t}activate(t,e=()=>!0){return this._apply(this.project(t,e))}moveEndpoint(t,e,s=()=>!0){return this._apply(this.projectEndpoint(t,e,s))}}function Ee(t,e){if(!t)return e;if(!e)return t;return g(t,e)>=0?t:e}function Ce(t,e){if(!t)return e;if(!e)return t;return g(t,e)<=0?t:e}var Yt=/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g,ke=new Map,Ae=new Map;function Wt(t,e,s){let i=t.get(e);if(i!==void 0)return i;let n=s(),r=t.keys().next().value;if(t.size>=64&&r!==void 0)t.delete(r);return t.set(e,n),n}function W(t,e){let s=JSON.stringify([t,e]);return Wt(ke,s,()=>new Intl.DateTimeFormat(t,e))}function P(t=""){if(t)return t;if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang;if(typeof navigator<"u"&&navigator.language)return navigator.language;return"en-US"}function Se(t){return Wt(Ae,t,()=>{let e=new Intl.NumberFormat(t,{useGrouping:!1}),s=new Map;for(let i=0;i<=9;i++)s.set(e.format(i),String(i));return s})}function Gt(t,e,s={}){let i=String(t||"").replace(Yt,"");if(s.trim!==!1)i=i.trim();for(let[n,r]of Se(e))i=i.split(n).join(r);return i}function ot(t,e=""){let s=P(e);return W(s,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(N(t))}function qt(t,e=""){let s=P(e);return W(s,{calendar:"gregory",year:"numeric",month:"long",timeZone:"UTC"}).format(N(`${t.slice(0,7)}-15`))}function Kt(t=""){let e=P(t);try{let s=W(e,{calendar:"gregory",year:"numeric",month:"long",timeZone:"UTC"}).formatToParts(N("2026-09-15")),i=-1,n=-1;if(s.forEach((r,a)=>{let o=r.type;if(o==="month"){if(i<0)i=a}else if(o==="year"||o==="relatedYear"||o==="yearName"){if(n<0)n=a}}),i>=0&&n>=0)return n<i?["year","month"]:["month","year"]}catch{}return["month","year"]}function Xt(t="",e="long"){let s=P(t),i=W(s,{calendar:"gregory",month:e,timeZone:"UTC"});return Array.from({length:12},(n,r)=>i.format(N(`2026-${String(r+1).padStart(2,"0")}-15`)))}function Tt(t="",e=1,s="short"){let i=P(t),n=W(i,{calendar:"gregory",weekday:s,timeZone:"UTC"}),r=Y(e),a=N("2026-01-04");return Array.from({length:7},(o,d)=>{let l=new Date(a);return l.setUTCDate(a.getUTCDate()+(r+d)%7),n.format(l)})}function Te(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dt(t=""){let e=P(t),s=W(e,{calendar:"gregory",year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC"}),i=N("2006-11-22"),n=s.formatToParts(i).filter((l)=>l.type!=="literal"||l.value),r=n.filter((l)=>["day","month","year"].includes(l.type)).map((l)=>l.type),a=n.map((l)=>{if(l.type==="day")return"DD";if(l.type==="month")return"MM";if(l.type==="year")return"YYYY";return l.value.replace(Yt,"")}).join(""),o=n.map((l)=>{if(l.type==="day"||l.type==="month")return"(\\d{1,2})";if(l.type==="year")return"(\\d{4})";let h=Gt(l.value,e,{trim:!1});return Te(h).replace(/\s+/g,"\\s*")}).join(""),d=new RegExp(`^\\s*${o}\\s*$`);return{locale:e,placeholder:a,format(l){if(!c(l))return"";return s.format(N(l))},parse(l){let h=Gt(l,e);if(c(h))return h;let b=d.exec(h);if(!b)return"";let D={};if(r.forEach((x,S)=>{D[x]=Number(b[S+1])}),!D.year||!D.month||!D.day)return"";try{return U(D.year,D.month,D.day)}catch{return""}}}}var Me={chooseDate:"Choose date",changeDate:"Change date",previousMonth:"Previous month",nextMonth:"Next month",month:"Month",year:"Year",calendar:"Choose a date",unavailable:"Unavailable",invalidDate:"Enter a valid date",unavailableDate:"This date is unavailable",formatHint:"Format",week:"Week",rangeStart:"Range start",rangeInRange:"Inside range",rangeEnd:"Range end",rangeSingle:"Range of one day",rangeOrderStart:"Start must be on or before end",rangeOrderEnd:"End must be on or after start"},Mt={...Me};function V(){return{...Mt}}function _t(t){Mt={...Mt,...t};for(let e of It)e()}var It=new Set;function yt(t){return It.add(t),()=>{It.delete(t)}}function Zt(t){let e=t&&typeof t==="object"&&!Array.isArray(t)&&"dates"in t?t.dates:t,s=new Map;if(Array.isArray(e)){for(let i of e){if(!i||typeof i!=="object"||!("date"in i))continue;let{date:n,...r}=i;s.set(String(n),r)}return s}if(e&&typeof e==="object")for(let[i,n]of Object.entries(e))s.set(i,n&&typeof n==="object"?n:{});return s}function q(t,e){for(let s of e){if(!Object.hasOwn(t,s))continue;let i=Reflect.get(t,s);Reflect.deleteProperty(t,s),Reflect.set(t,s,i)}}var Ie=0;function A(t){return String(t).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function $e(t){let e=Number(t);if(e===7)return 0;return Number.isInteger(e)&&e>=0&&e<=6?e:1}function Fe(t){return Number(t.slice(0,4))}function bt(t,e){let[s,i]=t.split("-").map(Number),n=s*12+(i-1)+e,r=Math.floor(n/12),a=(n%12+12)%12+1;if(r<1||r>9999)return null;return`${String(r).padStart(4,"0")}-${String(a).padStart(2,"0")}`}function Jt(t){return{"data-range-start":t==="start"||t==="single","data-range-end":t==="end"||t==="single","data-in-range":t==="in"}}function Le(t){return Object.entries(Jt(t)).filter(([,e])=>e).map(([e])=>` ${e}="true"`).join("")}function Re(t){if(t==="single")return"rangeSingle";if(t==="start")return"rangeStart";if(t==="end")return"rangeEnd";if(t==="in")return"rangeInRange";return""}class lt extends HTMLElement{static observedAttributes=["value","display","min","max","first-day","locale","fixed-weeks","show-week-numbers","selection","month-format"];static setDefaultControlClasses(t){pt(t)}static getDefaultControlClasses(){return nt()}static setDefaultMessages(t){_t(t)}static getDefaultMessages(){return V()}constructor(){super();this._id=`date-calendar-${++Ie}`,this._model=new Et,this._connected=!1,this._lifecycleId=0,this._rendering=!1,this._heading=null,this._renderRoot=null,this._source=null,this._hostIntent=null,this._sourceStates=new Map,this._loadedRanges=new Set,this._loadController=null,this._loadingKey="",this._loadingPromise=null,this._dateState=null,this._renderDay=null,this._isDateDisabled=null,this._highlightedRange={start:"",end:""},this._paintedRange={start:"",end:""},this._paintedPreview=!1,this._renderedStates=new Map,this._messages=null,this._controlClasses=null,this._stopDefaultMessages=null,this._stopDefaultControlClasses=null,this._onClick=this._onClick.bind(this),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this)}connectedCallback(){if(this._connected)return;this._lifecycleId++,q(this,["locale","min","max","firstDay","selection","monthFormat","fixedWeeks","showWeekNumbers","controlClasses","messages","source","dateState","renderDay","isDateDisabled","highlightedRange","value","display"]),this._syncModel(),q(this,["focusedDate"]),this._stopDefaultControlClasses=jt(()=>{if(Ut(this._controlClasses))this.render()}),this._stopDefaultMessages=yt(()=>{if(this._messages===null)this.render()}),this._connected=!0,this.addEventListener("click",this._onClick),this.addEventListener("change",this._onChange),this.addEventListener("keydown",this._onKeyDown),this.addEventListener("focusin",this._onFocusIn),this.render()}disconnectedCallback(){this._stopDefaultControlClasses?.(),this._stopDefaultControlClasses=null,this._stopDefaultMessages?.(),this._stopDefaultMessages=null,this._connected=!1,this._lifecycleId++,this._loadController?.abort(),this._loadController=null,this._loadingKey="",this._loadingPromise=null,this.removeEventListener("click",this._onClick),this.removeEventListener("change",this._onChange),this.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("focusin",this._onFocusIn)}attributeChangedCallback(t,e,s){if(this._rendering)return;if(t==="value"&&s&&!c(s)){this._reflect("value",this._model.value);return}if((t==="min"||t==="max")&&s&&!c(s)){if(this._reflect(t,""),this._connected)this._syncModel(),this.render();return}if(t==="display"&&s)try{if(p(s)!==s)throw TypeError("Non-canonical month")}catch{this._reflect("display",this._model.display);return}if(!this._connected)return;this._syncModel(),this.render()}_queueFocus(t){let e=this._lifecycleId;queueMicrotask(()=>{if(!this._connected||e!==this._lifecycleId)return;t()})}get locale(){return P(this.getAttribute("locale")||"")}set locale(t){if(t)this.setAttribute("locale",t);else this.removeAttribute("locale")}get value(){return this._model.value}set value(t){let e=t||"";if(e&&!c(e))throw TypeError(`Invalid calendar value: ${e}`);if(e===this._model.value)return;if(this._model.setValue(e),this._reflect("value",e),this._connected)this.render()}get display(){return this._model.display}set display(t){this._setDisplay(t,{emit:!1})}get focusedDate(){return this._model.focused}set focusedDate(t){let e=t||"";if(e===this._model.focused)return;this.focusDate(e,{moveFocus:!1})}get min(){let t=this.getAttribute("min")||"";return c(t)?t:""}set min(t){if(t)this.setAttribute("min",t);else this.removeAttribute("min")}get max(){let t=this.getAttribute("max")||"";return c(t)?t:""}set max(t){if(t)this.setAttribute("max",t);else this.removeAttribute("max")}get firstDay(){return $e(this.getAttribute("first-day")||"1")}set firstDay(t){this.setAttribute("first-day",String(t))}get selection(){return this.getAttribute("selection")==="none"?"none":"single"}set selection(t){this.setAttribute("selection",t==="none"?"none":"single")}get monthFormat(){return this.getAttribute("month-format")==="short"?"short":"long"}set monthFormat(t){if(t==="short")this.setAttribute("month-format","short");else this.removeAttribute("month-format")}get highlightedRange(){return{...this._highlightedRange}}set highlightedRange(t){let e=mt(t),s=this.hasAttribute("data-range-preview");if(e.start===this._paintedRange.start&&e.end===this._paintedRange.end&&s===this._paintedPreview)return;if(this._highlightedRange=e,this._connected)this._updateRangeDom()}get fixedWeeks(){return this.hasAttribute("fixed-weeks")}set fixedWeeks(t){this.toggleAttribute("fixed-weeks",Boolean(t))}get showWeekNumbers(){return this.hasAttribute("show-week-numbers")}set showWeekNumbers(t){this.toggleAttribute("show-week-numbers",Boolean(t))}get controlClasses(){return at(this._controlClasses)}set controlClasses(t){let e=this.controlClasses;if(this._controlClasses=rt(t),At(e,this.controlClasses))return;if(this._connected)this.render()}get messages(){return this._messages??V()}set messages(t){if(this._messages=t==null?null:{...V(),...t},this._connected)this.render()}get source(){return this._source}set source(t){this._source=t||null,this.refreshSource()}get dateState(){return this._dateState}set dateState(t){if(this._dateState=typeof t==="function"?t:null,this._connected)this.render()}get renderDay(){return this._renderDay}set renderDay(t){if(this._renderDay=typeof t==="function"?t:null,this._connected)this.render()}get isDateDisabled(){return this._isDateDisabled}set isDateDisabled(t){if(this._isDateDisabled=typeof t==="function"?t:null,this._connected)this.render()}_syncModel(){let t=this.firstDay;this._model.firstDay=t;let e=this.getAttribute("value")||"";if(!e||c(e))this._model.value=e;let s=this.getAttribute("display")||"";if(s)try{this._model.setDisplay(it(s,t))}catch{}else if(this._model.value)this._model.display=p(this._model.value),this._model.focused=this._model.value;if(this._model.focused=this._clamp(this._model.focused),!this.getAttribute("display"))this._model.display=p(this._model.focused)}_reflect(t,e){if(this._rendering=!0,e){if(this.getAttribute(t)!==e)this.setAttribute(t,e)}else if(this.hasAttribute(t))this.removeAttribute(t);this._rendering=!1}_clamp(t){let e=Nt(t,this.min,this.max),s=p(e),i=it(s,this.firstDay);if(i===s)return e;let n=Number(e.slice(8,10))||1,r=I(`${i}-01`,n-1),a=Dt(i);return g(r,a)>0?a:r}_weeks(t=this.display){return Bt(it(t,this.firstDay),{firstDay:this.firstDay,fixedWeeks:this.fixedWeeks})}_focusTargetKey(t){if(t.matches(".dp-month-select, .dp-year-input")&&t.id)return`#${CSS.escape(t.id)}`;if(t.matches(".dp-nav[data-calendar-action]"))return`.dp-nav[data-calendar-action="${CSS.escape(t.dataset.calendarAction||"")}"]`;if(t.matches(".dp-day[data-date]")){let e=t.getAttribute("data-date")||"";if(c(e))return`.dp-day[data-date="${e}"]`}return""}_range(t=this.display){let e=this._weeks(t),s=e[0],i=e[e.length-1];if(!s||!i)throw Error("Calendar month produced no weeks");return{start:s[0],end:i[6]}}getDateState(t){let e=this._sourceStates.get(t)||{},s=this._dateState?.(t,{...e})||{},i={...e,...s},n=this.min&&g(t,this.min)<0||this.max&&g(t,this.max)>0,a=i.enabled===!0?!1:Boolean(this._isDateDisabled?.(t)),o=Boolean(n)||Boolean(i.disabled)||a;return{...i,disabled:o}}async refreshSource(){if(this._loadController?.abort(),this._loadController=null,this._loadingKey="",this._loadingPromise=null,this._loadedRanges.clear(),this._sourceStates.clear(),this._connected)this.render(),await this._loadDisplay(this.display)}async ensureDate(t){if(!c(t)||!this._source)return!0;return await this._loadDisplay(p(t),!1)==="loaded"}async _loadDisplay(t,e=!0){if(!this._source)return"loaded";let s=this._range(t),i=`${s.start}/${s.end}`;if(this._loadedRanges.has(i))return"loaded";if(i===this._loadingKey&&this._loadingPromise)return this._loadingPromise;this._loadController?.abort();let n=new AbortController;this._loadController=n,this._loadingKey=i;let r=this._source,a=(async()=>{this.toggleAttribute("data-loading",!0),this.dispatchEvent(new CustomEvent("dateloadstart",{detail:s,bubbles:!0}));try{let o=typeof r==="function"?r:r?.load?.bind(r);if(!o)throw TypeError("Date source must be a function or expose load(range, { signal })");let d=await o(s,{signal:n.signal});if(n.signal.aborted)return"cancelled";for(let[l,h]of Zt(d))this._sourceStates.set(l,h);if(this._loadedRanges.add(i),this.dispatchEvent(new CustomEvent("dateloadend",{detail:s,bubbles:!0})),e&&this._connected&&p(this.display)===p(t))this.render(!1);return"loaded"}catch(o){if(n.signal.aborted)return"cancelled";return this.dispatchEvent(new CustomEvent("dateloaderror",{detail:{...s,error:o},bubbles:!0})),"failed"}finally{if(this._loadController===n)this._loadController=null,this.removeAttribute("data-loading");if(this._loadingKey===i)this._loadingKey="",this._loadingPromise=null}})();return this._loadingPromise=a,a}_setDisplay(t,e={}){let s=this._model.display;if(this._model.setDisplay(it(t,this.firstDay)),this._model.focused=this._clamp(this._model.focused),this._model.display=p(this._model.focused),this._reflect("display",this._model.display),this._connected)this.render();if(e.emit!==!1&&s!==this._model.display)this._emitDisplayChange();return this._model.display}_emitDisplayChange(){let t=this._range();this.dispatchEvent(new CustomEvent("displaychange",{detail:{display:this.display,...t},bubbles:!0}))}previousMonth(){return this._setDisplay(bt(this.display,-1)??this.display)}nextMonth(){return this._setDisplay(bt(this.display,1)??this.display)}focusDate(t,e={}){if(!c(t))throw TypeError(`Invalid date: ${t}`);let s=this._clamp(t),i=this.display,n=this._model.focused,r=e.moveFocus!==!1;if(this._model.setFocused(s),this._reflect("display",this._model.display),i!==this.display){if(this._connected)this.render();this._emitDisplayChange()}else if(this._connected&&n!==this._model.focused)this._moveFocusDom(n,this._model.focused,r);if(r)this._queueFocus(()=>this.focusGrid())}_moveFocusDom(t,e,s=!0){let i=t?this.querySelector(`.dp-day[data-date="${CSS.escape(t)}"]`):null,n=this.querySelector(`.dp-day[data-date="${CSS.escape(e)}"]`);if(i instanceof HTMLElement)i.tabIndex=-1;if(n instanceof HTMLElement){if(n.tabIndex=0,s)n.focus()}else if(s)this.focusGrid()}_syncRovingDom(t){for(let s of this.querySelectorAll('.dp-day[tabindex="0"]'))if(s instanceof HTMLElement&&s.dataset.date!==t)s.tabIndex=-1;let e=this.querySelector(`.dp-day[data-date="${CSS.escape(t)}"]`);if(e instanceof HTMLElement)e.tabIndex=0}_moveSelectionDom(t,e){if(t){let s=this.querySelector(`.dp-day[data-date="${CSS.escape(t)}"]`);if(s instanceof HTMLElement)s.removeAttribute("data-selected"),s.removeAttribute("aria-selected")}if(e){let s=this.querySelector(`.dp-day[data-date="${CSS.escape(e)}"]`);if(s instanceof HTMLElement)return s.setAttribute("data-selected","true"),s.setAttribute("aria-selected","true"),!0}return!1}_dayLabel(t,e,s){let i=this.hasAttribute("data-range-preview")?"":Re(s),n=typeof e.description==="string"?e.description:"";return[ot(t,this.locale),n,i?this.messages[i]:"",e.disabled?this.messages.unavailable:""].filter(Boolean).join(". ")}_updateRangeDom(){let t=this._paintedRange,e=this._paintedPreview;this._paintedRange={...this._highlightedRange},this._paintedPreview=this.hasAttribute("data-range-preview");for(let s of this.querySelectorAll(".dp-day[data-date]")){if(!(s instanceof HTMLTableCellElement))continue;let i=s.dataset.date||"",n=gt(i,this._highlightedRange);if(n===gt(i,t)&&e===this._paintedPreview)continue;for(let[r,a]of Object.entries(Jt(n)))if(a)s.setAttribute(r,"true");else s.removeAttribute(r);if(!e||!this._paintedPreview){let r=this._renderedStates.get(i)||{},a=this._dayLabel(i,r,n);if(s.getAttribute("aria-label")!==a)s.setAttribute("aria-label",a)}}}focusGrid(){let t=this.querySelector(`.dp-day[data-date="${CSS.escape(this.focusedDate)}"]`);if(t instanceof HTMLElement)t.focus()}async activateDate(t){if(!this._connected)return!1;let e=this._lifecycleId,s=this._hostIntent?.date===t?this._hostIntent.intent:void 0;this._hostIntent=null;let i=(o)=>{if(s!==void 0)tt.set(o,s);return o},n=await this.ensureDate(t);if(!this._connected||e!==this._lifecycleId)return!1;let r=this.getDateState(t);if(!n||r.disabled)return this.dispatchEvent(i(new CustomEvent("dateinvalid",{detail:{date:t,state:r},bubbles:!0}))),!1;if(!this.dispatchEvent(i(new CustomEvent("dateactivate",{detail:{date:t,state:r},bubbles:!0,cancelable:!0}))))return!1;if(this.selection==="single"){let o=this._model.value;if(this._model.setValue(t),this._reflect("value",t),this.dispatchEvent(new CustomEvent("datechange",{detail:{value:t},bubbles:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})),this._connected)if(p(t)===this.display)this._moveSelectionDom(o,t);else this.render()}else if(this._connected){if(p(t)!==this.display)this.render()}return!0}_onClick(t){let e=t.target;if(!(e instanceof Element))return;let s=e.closest("[data-calendar-action]");if(s instanceof HTMLButtonElement){let a=s.dataset.calendarAction;if(a==="previous")this.previousMonth();if(a==="next")this.nextMonth();return}let i=e.closest(".dp-day[data-date]");if(!(i instanceof HTMLTableCellElement))return;let n=i.dataset.date||"";if(!c(n))return;let r=this.display;if(this._model.setFocused(this._clamp(n)),this._reflect("display",this._model.display),r!==this.display)this._emitDisplayChange();else this._syncRovingDom(this._model.focused);this.activateDate(n)}_onChange(t){let e=t.target;if(e instanceof HTMLSelectElement&&e.matches(".dp-month-select")){this._setDisplay(`${this.display.slice(0,4)}-${e.value}`);return}if(e instanceof HTMLInputElement&&e.matches(".dp-year-input")){let s=Number(e.value);if(!Number.isInteger(s)||s<1||s>9999){if(this._connected)this.render(!1);return}this._setDisplay(`${String(s).padStart(4,"0")}-${this.display.slice(5,7)}`)}}_onFocusIn(t){let e=t.target;if(!(e instanceof HTMLTableCellElement)||!e.matches(".dp-day[data-date]"))return;let s=e.dataset.date||"";if(!c(s))return;this._model.focused=s,this._syncRovingDom(s),this.dispatchEvent(new CustomEvent("datefocus",{detail:{date:s,state:this.getDateState(s)},bubbles:!0}))}_onKeyDown(t){let e=t.target;if(!(e instanceof HTMLTableCellElement)||!e.matches(".dp-day[data-date]"))return;let s=e.dataset.date||this.focusedDate;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.activateDate(s);return}let i=this._model.focused,n=this._model.display;if(this._model.firstDay=this.firstDay,this._model.setFocused(s,{follow:!1}),t.key==="ArrowLeft")this._model.moveFocusDays(-1);else if(t.key==="ArrowRight")this._model.moveFocusDays(1);else if(t.key==="ArrowUp")this._model.moveFocusDays(-7);else if(t.key==="ArrowDown")this._model.moveFocusDays(7);else if(t.key==="Home")this._model.focusWeekStart();else if(t.key==="End")this._model.focusWeekEnd();else if(t.key==="PageUp")t.shiftKey?this._model.moveFocusYears(-1):this._model.moveFocusMonths(-1);else if(t.key==="PageDown")t.shiftKey?this._model.moveFocusYears(1):this._model.moveFocusMonths(1);else return;let r=this._model.focused;if(this._model.focused=i,this._model.display=n,!r)return;t.preventDefault(),this.focusDate(this._clamp(r))}render(t=!0){if(!this._connected)return;let e=this.locale,s=this.display,i=Fe(s),n=Number(s.slice(5,7)),r=Xt(e,this.monthFormat),a=Tt(e,this.firstDay,"short"),o=Tt(e,this.firstDay,"long"),d=this._weeks(),l=O(),h=`${this._id}-heading`,b=`${this._id}-grid`,D=this.min?p(this.min):"",x=this.max?p(this.max):"",S=bt(s,-1),T=bt(s,1),M=Boolean(D&&S!==null&&S<D),y=Boolean(x&&T!==null&&T>x),v=` min="${this.min?Number(this.min.slice(0,4)):1}"`,E=` max="${this.max?Number(this.max.slice(0,4)):9999}"`,k=this.showWeekNumbers&&this.firstDay===1,C=k?`<th scope="col" class="dp-week-heading" abbr="${A(this.messages.week)}">#</th>`:"",H=r.map((u,f)=>{let w=f+1,m=`${String(i).padStart(4,"0")}-${String(w).padStart(2,"0")}`,Q=D&&m<D||x&&m>x;return`<option value="${String(w).padStart(2,"0")}"${w===n?" selected":""}${Q?" disabled":""}>${A(u)}</option>`}).join(""),L=a.map((u,f)=>`<th scope="col" abbr="${A(o[f])}">${A(u.replace(".",""))}</th>`).join("");this._renderedStates.clear();let j=d.map((u)=>{let f=k?`<th scope="row" class="dp-week-number">${Vt(u[0])}</th>`:"",w=u.map((m)=>{let Q=this.getDateState(m);this._renderedStates.set(m,Q);let he=p(m)!==s,fe=this.value===m,pe=this.focusedDate===m,me=m===l,Ot=gt(m,this._highlightedRange),ge=this._dayLabel(m,Q,Ot);return`<td class="dp-day" data-date="${m}"${he?' data-outside-month="true"':""}${me?' data-today="true" aria-current="date"':""}${fe?' data-selected="true" aria-selected="true"':""}${Le(Ot)}${Q.disabled?' data-disabled="true" aria-disabled="true"':""} tabindex="${pe?"0":"-1"}" aria-label="${A(ge)}"><span class="dp-day-number" aria-hidden="true">${Number(m.slice(8,10))}</span><span class="dp-day-extra" aria-hidden="true"></span></td>`}).join("");return`<tr>${f}${w}</tr>`}).join(""),K=document.activeElement,X=K instanceof HTMLElement&&this.contains(K)?this._focusTargetKey(K):"",R=Kt(e)[0]==="year";this.toggleAttribute("data-year-first",R);let Z=this.controlClasses,G=A(Z.month||"dp-skin"),wt=A(Z.year||"dp-skin"),ut=A(Z.nav||"dp-skin"),J=`<label class="dp-visually-hidden" for="${this._id}-month">${A(this.messages.month)}</label>
3
- <select id="${this._id}-month" class="dp-month-select ${G}" aria-label="${A(this.messages.month)}">${H}</select>`,_=`<label class="dp-visually-hidden" for="${this._id}-year">${A(this.messages.year)}</label>
4
- <input id="${this._id}-year" class="dp-year-input ${wt}" type="number" inputmode="numeric" value="${i}"${v}${E} aria-label="${A(this.messages.year)}">`;if(!this._heading?.isConnected||!this._renderRoot?.isConnected){this.replaceChildren();let u=document.createElement("h2");u.id=h,u.className="dp-calendar-heading dp-visually-hidden",u.setAttribute("aria-live","polite");let f=document.createElement("div");f.className="dp-calendar-render",this.append(u,f),this._heading=u,this._renderRoot=f}if(this._rendering=!0,this._renderRoot.innerHTML=`
1
+ /*** @lekoala/date-picker v0.6.0 - https://github.com/lekoala/date-picker ***/
2
+ (()=>{var Ht=":where(date-calendar,date-picker){--dp-bg: #ffffff;--dp-fg: #1f2328;--dp-muted: color-mix(in srgb,var(--dp-fg) 58%,var(--dp-bg));--dp-border: color-mix(in srgb,var(--dp-fg) 16%,var(--dp-bg));--dp-hover: color-mix(in srgb,var(--dp-fg) 5%,var(--dp-bg));--dp-accent: #2563eb;--dp-accent-fg: #fff;--dp-focus: var(--dp-accent);--dp-focus-width: 2px;--dp-radius: 0.5rem;--dp-day-size: 2.75rem;--dp-gap: 0.375rem;--dp-header-control-size: 2.25rem;--dp-header-block-gap: 0.75rem;--dp-row-gap: 0.375rem;--dp-picker-button-size: 2.5rem;--dp-year-inline-size: 5.5rem;--dp-day-radius: calc(var(--dp-radius) * 0.75);color: var(--dp-fg);font: inherit}.dp-visually-hidden{position: absolute !important;inline-size: 1px !important;block-size: 1px !important;padding: 0 !important;margin: -1px !important;overflow: hidden !important;clip: rect(0 0 0 0) !important;white-space: nowrap !important;border: 0 !important}date-calendar{display: block;inline-size: max-content;max-inline-size: 100%}.dp-calendar-shell{inline-size: max-content;max-inline-size: 100%}.dp-calendar-header{display: grid;grid-template-columns: minmax(0,1fr) var(--dp-year-inline-size) auto auto;align-items: stretch;gap: var(--dp-gap);margin-block-end: var(--dp-header-block-gap)}date-calendar[data-year-first] .dp-calendar-header{grid-template-columns: var(--dp-year-inline-size) minmax(0,1fr) auto auto}.dp-calendar-header :where(button,select,input){box-sizing: border-box;min-inline-size: 0}.dp-calendar-header .dp-skin{min-block-size: var(--dp-header-control-size);padding-block: 0.15rem;border: 1px solid var(--dp-border);border-radius: calc(var(--dp-radius) * 0.75);background: var(--dp-bg);color: var(--dp-fg);font: inherit;line-height: 1.2}.dp-calendar-header input.dp-skin{padding-inline: 0.45rem}.dp-month-select{inline-size: 100%;overflow: hidden;text-overflow: ellipsis}.dp-month-select.dp-skin{appearance: none;padding-inline: 0.45rem 2rem;background-image: linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);background-position: calc(100% - 0.9rem) 50%,calc(100% - 0.65rem) 50%;background-size: 0.3rem 0.3rem;background-repeat: no-repeat}[dir=\"rtl\"] .dp-month-select.dp-skin,html[dir=\"rtl\"] .dp-month-select.dp-skin{background-position: 0.9rem 50%,0.65rem 50%}.dp-year-input{inline-size: 100%}.dp-nav.dp-skin{display: grid;place-items: center;inline-size: var(--dp-header-control-size);padding: 0;font-size: 1.35rem;line-height: 1;cursor: pointer}.dp-nav svg{display: block;inline-size: 1rem;block-size: 1rem;pointer-events: none}.dp-calendar-header .dp-skin:disabled,.dp-picker-button:disabled{cursor: not-allowed;opacity: 0.45}.dp-nav.dp-skin:hover:not(:disabled){background: var(--dp-hover)}.dp-calendar-header .dp-skin:focus-visible,date-picker>input:not([type=\"hidden\"]):focus-visible,.dp-day:focus-visible{outline: var(--dp-focus-width) solid var(--dp-focus);outline-offset: calc(var(--dp-focus-width) * -1)}.dp-day:hover:not([data-disabled=\"true\"]):not([data-selected=\"true\"]):not([data-range-start=\"true\"]):not( [data-range-end=\"true\"] ){background: var(--dp-hover)}.dp-grid{border-collapse: separate;border-spacing: 0 var(--dp-row-gap);table-layout: fixed}.dp-grid :where(th,td){box-sizing: border-box;inline-size: var(--dp-day-size);block-size: var(--dp-day-size);padding: 0;text-align: center}.dp-grid thead th{block-size: 1.5rem;color: var(--dp-muted);font-size: 0.72rem;font-weight: 500}.dp-day{position: relative;border: 1px solid transparent;border-radius: var(--dp-day-radius);cursor: pointer;outline: none;vertical-align: middle;font-size: 0.875rem}.dp-day:is([data-selected=\"true\"],[data-range-start=\"true\"],[data-range-end=\"true\"]):focus-visible{outline-color: var(--dp-accent-fg)}.dp-day[data-outside-month=\"true\"]{color: var(--dp-muted)}.dp-day[data-selected=\"true\"]{background: var(--dp-accent);color: var(--dp-accent-fg)}.dp-day[data-today=\"true\"]:not([data-selected=\"true\"],[data-range-start=\"true\"],[data-range-end=\"true\"]){border-color: var(--dp-accent)}.dp-day[data-disabled=\"true\"]{cursor: not-allowed;opacity: 0.42}.dp-day[data-range-start=\"true\"],.dp-day[data-range-end=\"true\"]{background: var(--dp-accent);color: var(--dp-accent-fg)}.dp-day[data-in-range=\"true\"]{border-radius: 0;background: color-mix(in srgb,var(--dp-accent) 18%,var(--dp-bg))}.dp-day[data-range-start=\"true\"]:has(+ [data-in-range=\"true\"],+ [data-range-end=\"true\"]){border-start-end-radius: 0;border-end-end-radius: 0}.dp-day:is([data-in-range=\"true\"],[data-range-start=\"true\"]) + .dp-day[data-range-end=\"true\"]{border-start-start-radius: 0;border-end-start-radius: 0}.dp-day[data-in-range=\"true\"]:first-of-type{border-start-start-radius: var(--dp-day-radius);border-end-start-radius: var(--dp-day-radius)}.dp-day[data-in-range=\"true\"]:last-of-type{border-start-end-radius: var(--dp-day-radius);border-end-end-radius: var(--dp-day-radius)}[data-range-preview] .dp-day:is([data-range-start=\"true\"],[data-range-end=\"true\"]){background: color-mix(in srgb,var(--dp-accent) 58%,var(--dp-bg))}[data-range-preview] .dp-day[data-in-range=\"true\"]{background: color-mix(in srgb,var(--dp-accent) 11%,var(--dp-bg))}.dp-day-number{display: block;font-variant-numeric: tabular-nums}.dp-day[data-disabled=\"true\"]:focus-visible{opacity: 1}.dp-day[data-disabled=\"true\"]:focus-visible .dp-day-number{color: var(--dp-muted)}.dp-day-extra{position: absolute;inset-inline: 2px;inset-block-end: 1px;display: flex;justify-content: center;gap: 2px;min-block-size: 0.35rem;font-size: 0.55rem;line-height: 1;pointer-events: none}.dp-week-number,.dp-week-heading{inline-size: 1.6rem !important;color: var(--dp-muted);font-size: 0.65rem;font-weight: 500}date-picker{position: relative;display: inline-grid;grid-template-columns: minmax(0,1fr);align-items: stretch;max-inline-size: 100%}date-picker>input:not([type=\"hidden\"]){min-inline-size: 0}date-picker>input:not([type=\"hidden\"]):not([type=\"time\"]){grid-column: 1;grid-row: 1;box-sizing: border-box;inline-size: 100%;padding-inline-end: calc(var(--dp-picker-button-size) + 0.5rem)}.dp-picker-button{display: grid;place-items: center;grid-column: 1;grid-row: 1;justify-self: end;align-self: stretch;inline-size: var(--dp-picker-button-size);min-inline-size: 0;border: 0;background: transparent;color: var(--dp-fg);font: inherit;cursor: pointer}.dp-picker-button:focus-visible{outline: var(--dp-focus-width) solid var(--dp-focus);outline-offset: -5px;border-radius: var(--dp-radius)}date-picker:has(>[data-time-start],>[data-time-end]){grid-template-columns: minmax(0,1fr) minmax(0,1fr);column-gap: var(--dp-gap)}date-picker:has(>[data-time-start]):has(>[data-time-end]){grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}date-picker>input[data-time-start]{grid-column: 2;grid-row: 1;min-inline-size: 0}date-picker>input[data-time-end]{grid-column: 3;grid-row: 1;min-inline-size: 0}date-picker[range]{row-gap: var(--dp-gap)}date-picker[range]>input[data-range-start]{grid-row: 1}date-picker[range]>input[data-range-end]{grid-row: 2}date-picker[range]>.dp-picker-button[data-endpoint=\"start\"]{grid-row: 1}date-picker[range]>.dp-picker-button[data-endpoint=\"end\"]{grid-row: 2}.dp-picker-panel[popover]{position: fixed;inset: auto;margin: 0;padding: 0.875rem 1rem;border: 1px solid var(--dp-border);border-radius: var(--dp-radius);background: var(--dp-bg);color: var(--dp-fg);box-shadow: 0 0.5rem 1.5rem rgb(15 23 42 / 0.12);max-block-size: var(--available-height,90svh);max-inline-size: calc(100vi - 1rem);overflow: auto}.dp-picker-panel:not(:popover-open){display: none}@media (forced-colors: active){.dp-month-select.dp-skin,[dir=\"rtl\"] .dp-month-select.dp-skin{appearance: auto;background-image: none;padding-inline: 0.45rem}.dp-day:is([data-selected=\"true\"],[data-range-start=\"true\"],[data-range-end=\"true\"]){border: 2px solid Highlight;background-color: Canvas;color: CanvasText}.dp-day[data-in-range=\"true\"]{color: CanvasText}.dp-day[data-in-range=\"true\"]::after{content: \"\";position: absolute;inset-inline: 3px;inset-block-end: 4px;block-size: 1px;background-color: Highlight}.dp-day[data-today=\"true\"]{border-color: Highlight}.dp-day-extra{color: CanvasText;forced-color-adjust: none}}";var st=new WeakMap;var be=/^(\d{4})-(\d{2})-(\d{2})$/,ye=/^(\d{4})-(\d{2})$/;function ve(t){return t%4===0&&(t%100!==0||t%400===0)}function nt(t,e){if(e===2)return ve(t)?29:28;return[4,6,9,11].includes(e)?30:31}function R(t){let e=be.exec(String(t||""));if(!e)return null;let s=Number(e[1]),i=Number(e[2]),n=Number(e[3]);if(s<1||s>9999||i<1||i>12)return null;if(n<1||n>nt(s,i))return null;return{year:s,month:i,day:n}}function d(t){return R(t)!==null}function p(t){let e=String(t||""),s=ye.exec(e);if(s){let n=Number(s[1]),r=Number(s[2]);if(n>=1&&n<=9999&&r>=1&&r<=12)return`${s[1]}-${String(r).padStart(2,"0")}`}let i=R(e);if(!i)throw TypeError(`Invalid civil date/month: ${t}`);return`${String(i.year).padStart(4,"0")}-${String(i.month).padStart(2,"0")}`}function U(t,e,s){let i=`${String(t).padStart(4,"0")}-${String(e).padStart(2,"0")}-${String(s).padStart(2,"0")}`;if(!d(i))throw TypeError(`Invalid civil date: ${i}`);return i}function B(t){let e=new Date(0);return e.setUTCHours(12,0,0,0),e.setUTCFullYear(t.year,t.month-1,t.day),e}function we(t){return U(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate())}function N(t){let e=R(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return B(e)}function _(t,e){if(!d(t)||!d(e))throw TypeError("compareDates() expects YYYY-MM-DD values");return t===e?0:t<e?-1:1}function F(t,e){let s=R(t);if(!s||!Number.isInteger(e))throw TypeError("addDays() expects a date and integer amount");let i=B(s);return i.setUTCDate(i.getUTCDate()+e),we(i)}function pt(t,e){let s=R(t);if(!s||!Number.isInteger(e))throw TypeError("addMonths() expects a date and integer amount");let i=s.year*12+(s.month-1)+e,n=Math.floor(i/12),a=(i%12+12)%12+1,o=Math.min(s.day,nt(n,a));return U(n,a,o)}function Nt(t,e){let s=R(t);if(!s||!Number.isInteger(e))throw TypeError("addYears() expects a date and integer amount");let i=s.year+e,n=Math.min(s.day,nt(i,s.month));return U(i,s.month,n)}function it(t,e){let s=`${p(t)}-01`;return p(pt(s,e))}function De(t){return`${p(t)}-01`}function Et(t){let e=R(`${p(t)}-01`);if(!e)throw TypeError(`Invalid month: ${t}`);return U(e.year,e.month,nt(e.year,e.month))}function xe(t){let e=R(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return B(e).getUTCDay()}function Y(t){if(t===7)return 0;if(!Number.isInteger(t)||t<0||t>6)throw RangeError("firstDay must be 0..6 (Sunday=0, 7 accepted as Sunday alias)");return t}function mt(t,e=1){let s=(xe(t)-Y(e)+7)%7;return F(t,-s)}function Ct(t,e=1){return F(mt(t,e),6)}function Vt(t,e={}){let s=e.firstDay??1,i=mt(De(t),s),n=Ct(Et(t),s),r=[],a=i;for(;;){let o=[];for(let l=0;l<7;l++)o.push(F(a,l));if(r.push(o),_(o[6],n)>=0){if(!e.fixedWeeks||r.length>=6||_(o[6],F("9999-12-31",-7))>0)break}a=F(a,7)}return r}function Bt(t,e,s){let i=B({year:1,month:1,day:1});return Math.round((B({year:t,month:e,day:s}).getTime()-i.getTime())/86400000)}function rt(t,e=1){let s=Y(e),i=Bt(9999,12,31),n=p(t);for(;;){let r=R(`${n}-01`);if(!r)throw TypeError(`Invalid civil date/month: ${t}`);let a=Bt(r.year,r.month,1),o=(B(r).getUTCDay()-s+7)%7;if(a-o<0){n=it(n,1);continue}let l=nt(r.year,r.month),c={year:r.year,month:r.month,day:l},h=a+l-1,y=(B(c).getUTCDay()-s+7)%7;if(h-y+6>i){n=it(n,-1);continue}return n}}function Ut(t,e="",s=""){if(!d(t))throw TypeError(`Invalid civil date: ${t}`);if(e&&_(t,e)<0)return e;if(s&&_(t,s)>0)return s;return t}function O(){let t=new Date;return U(t.getFullYear(),t.getMonth()+1,t.getDate())}function Wt(t){let e=R(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);let s=B(e),i=s.getUTCDay()||7;s.setUTCDate(s.getUTCDate()+4-i);let n=new Date(0);return n.setUTCHours(12,0,0,0),n.setUTCFullYear(s.getUTCFullYear(),0,1),Math.ceil(((s.getTime()-n.getTime())/86400000+1)/7)}class kt{constructor(t={}){let e=O();this.firstDay=Y(t.firstDay??1),this.value=t.value&&d(t.value)?t.value:"",this.focused=t.focused&&d(t.focused)?t.focused:this.value||e,this.display=t.display?p(t.display):p(this.focused)}setValue(t){if(t&&!d(t))throw TypeError(`Invalid value: ${t}`);return this.value=t||"",this.value}setDisplay(t){let e=p(t),s=Number(this.focused.slice(8,10))||1,i=pt(`${e}-01`,0),n=F(i,Math.max(0,s-1));return this.focused=p(n)===e?n:F(`${it(e,1)}-01`,-1),this.display=e,this.display}setFocused(t,e={}){if(!d(t))throw TypeError(`Invalid focused date: ${t}`);if(this.focused=t,e.follow!==!1)this.display=p(t);return this.focused}moveFocusDays(t){return this.setFocused(F(this.focused,t))}moveFocusMonths(t){return this.setFocused(pt(this.focused,t))}moveFocusYears(t){return this.setFocused(Nt(this.focused,t))}focusWeekStart(){return this.setFocused(mt(this.focused,this.firstDay))}focusWeekEnd(){return this.setFocused(Ct(this.focused,this.firstDay))}navigateMonth(t){let e=it(this.display,t);return this.setDisplay(e),this.display}}function Ee(t){if(typeof t!=="string")return"";return[...new Set(t.split(/\s+/).filter((e)=>e&&!e.startsWith("dp-")&&![...e].some((s)=>s.charCodeAt(0)<32||s.charCodeAt(0)===127)))].join(" ")}function Tt(t,e){return t.month===e.month&&t.year===e.year&&t.nav===e.nav}var At={month:"",year:"",nav:""};function at(){return{...At}}function ot(t){if(t==null)return null;let e={};for(let s of["month","year","nav"])if(Object.hasOwn(t,s))e[s]=Ee(t[s]);return e}function jt(t){return t==null||["month","year","nav"].some((e)=>!Object.hasOwn(t,e))}function dt(t){return{...at(),...ot(t)}}function gt(t){let e=dt(t);if(Tt(At,e))return;At=e;for(let s of St)s()}var St=new Set;function Yt(t){return St.add(t),()=>{St.delete(t)}}function _t(t){if(t==null)return{start:"",end:""};if(typeof t!=="object")throw TypeError("highlightedRange expects { start, end }");let{start:e="",end:s=""}=t;if(e&&!d(e))throw TypeError(`Invalid range start: ${e}`);if(s&&!d(s))throw TypeError(`Invalid range end: ${s}`);if(!e&&s)throw TypeError("highlightedRange cannot define an end without a start");if(e&&s&&_(s,e)<0)throw TypeError("highlightedRange must be ordered; start must be on or before end");return{start:e,end:s}}function bt(t,e){if(!e||!d(t))return"";let{start:s,end:i}=e;if(!s||!d(s))return"";if(s===t)return i?i===t?"single":"start":"start";if(i&&i===t)return"end";if(i&&_(t,s)>=0&&_(t,i)<=0)return"in";return""}class Mt{constructor(){this.activeEndpoint="",this.start="",this.end=""}get range(){return{start:this.start,end:this.end}}get complete(){return Boolean(this.start&&this.end&&_(this.end,this.start)>=0)}focus(t){this.activeEndpoint=t}_refuse(t){return{status:"refused",endpoint:t,changedEndpoints:[],range:this.range,activeEndpoint:this.activeEndpoint}}project(t,e=()=>!0){if(!d(t))throw TypeError(`Invalid range activation: ${t}`);let{start:s,end:i}=this;if(this.complete&&(_(t,s)<0||_(t,i)>0)){let r=_(t,s)<0?"start":"end";if(!e(r))return this._refuse(r);return{status:"complete",endpoint:r,changedEndpoints:[r],range:r==="start"?{start:t,end:i}:{start:s,end:t},activeEndpoint:r}}if(this.activeEndpoint==="end"){if(s&&!i&&_(t,s)<0){if(!e("start"))return this._refuse("start");if(!e("end"))return this._refuse("end");return{status:"complete",endpoint:"end",changedEndpoints:["start","end"],range:{start:t,end:s},activeEndpoint:"end"}}if(s&&_(t,s)<0)return this._refuse("end");if(!e("end"))return this._refuse("end");return{status:s?"complete":"pending",endpoint:"end",changedEndpoints:["end"],range:{start:s,end:t},activeEndpoint:"end"}}if(i&&!s&&_(t,i)>0){if(!e("start"))return this._refuse("start");if(!e("end"))return this._refuse("end");return{status:"complete",endpoint:"start",changedEndpoints:["start","end"],range:{start:i,end:t},activeEndpoint:"start"}}if(!e("start"))return this._refuse("start");let n=e("end");return{status:"pending",endpoint:"start",changedEndpoints:["start"],range:{start:t,end:i},activeEndpoint:n?"end":this.activeEndpoint,...n?{}:{close:!0}}}previewRange(t,e=()=>!0){if(!d(t))return null;if(Boolean(this.start)===Boolean(this.end))return null;let s=this.project(t,e);if(s.status==="refused")return null;let{start:i,end:n}=s.range;if(!i||n&&_(n,i)<0)return null;return{start:i,end:n}}_apply(t){if(t.status==="refused")return t;return this.start=t.range.start,this.end=t.range.end,this.activeEndpoint=t.activeEndpoint,t}activate(t,e=()=>!0){return this._apply(this.project(t,e))}}var Kt=/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g,Ce=new Map,ke=new Map;function Gt(t,e,s){let i=t.get(e);if(i!==void 0)return i;let n=s(),r=t.keys().next().value;if(t.size>=64&&r!==void 0)t.delete(r);return t.set(e,n),n}function q(t,e){let s=JSON.stringify([t,e]);return Gt(Ce,s,()=>new Intl.DateTimeFormat(t,e))}function z(t=""){if(t)return t;if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang;if(typeof navigator<"u"&&navigator.language)return navigator.language;return"en-US"}function Ae(t){return Gt(ke,t,()=>{let e=new Intl.NumberFormat(t,{useGrouping:!1}),s=new Map;for(let i=0;i<=9;i++)s.set(e.format(i),String(i));return s})}function qt(t,e,s={}){let i=String(t||"").replace(Kt,"");if(s.trim!==!1)i=i.trim();for(let[n,r]of Ae(e))i=i.split(n).join(r);return i}function lt(t,e=""){let s=z(e);return q(s,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(N(t))}function Zt(t,e=""){let s=z(e);return q(s,{calendar:"gregory",year:"numeric",month:"long",timeZone:"UTC"}).format(N(`${t.slice(0,7)}-15`))}function Xt(t=""){let e=z(t);try{let s=q(e,{calendar:"gregory",year:"numeric",month:"long",timeZone:"UTC"}).formatToParts(N("2026-09-15")),i=-1,n=-1;if(s.forEach((r,a)=>{let o=r.type;if(o==="month"){if(i<0)i=a}else if(o==="year"||o==="relatedYear"||o==="yearName"){if(n<0)n=a}}),i>=0&&n>=0)return n<i?["year","month"]:["month","year"]}catch{}return["month","year"]}function Jt(t="",e="long"){let s=z(t),i=q(s,{calendar:"gregory",month:e,timeZone:"UTC"});return Array.from({length:12},(n,r)=>i.format(N(`2026-${String(r+1).padStart(2,"0")}-15`)))}function $t(t="",e=1,s="short"){let i=z(t),n=q(i,{calendar:"gregory",weekday:s,timeZone:"UTC"}),r=Y(e),a=N("2026-01-04");return Array.from({length:7},(o,l)=>{let c=new Date(a);return c.setUTCDate(a.getUTCDate()+(r+l)%7),n.format(c)})}function Se(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ct(t=""){let e=z(t),s=q(e,{calendar:"gregory",year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC"}),i=N("2006-11-22"),n=s.formatToParts(i).filter((c)=>c.type!=="literal"||c.value),r=n.filter((c)=>["day","month","year"].includes(c.type)).map((c)=>c.type),a=n.map((c)=>{if(c.type==="day")return"DD";if(c.type==="month")return"MM";if(c.type==="year")return"YYYY";return c.value.replace(Kt,"")}).join(""),o=n.map((c)=>{if(c.type==="day"||c.type==="month")return"(\\d{1,2})";if(c.type==="year")return"(\\d{4})";let h=qt(c.value,e,{trim:!1});return Se(h).replace(/\s+/g,"\\s*")}).join(""),l=new RegExp(`^\\s*${o}\\s*$`);return{locale:e,placeholder:a,format(c){if(!d(c))return"";return s.format(N(c))},parse(c){let h=qt(c,e);if(d(h))return h;let y=l.exec(h);if(!y)return"";let D={};if(r.forEach((x,S)=>{D[x]=Number(y[S+1])}),!D.year||!D.month||!D.day)return"";try{return U(D.year,D.month,D.day)}catch{return""}}}}var Te={chooseDate:"Choose date",changeDate:"Change date",previousMonth:"Previous month",nextMonth:"Next month",month:"Month",year:"Year",calendar:"Choose a date",unavailable:"Unavailable",invalidDate:"Enter a valid date",unavailableDate:"This date is unavailable",formatHint:"Format",week:"Week",rangeStart:"Range start",rangeInRange:"Inside range",rangeEnd:"Range end",rangeSingle:"Range of one day",rangeOrderStart:"Start must be on or before end",rangeOrderEnd:"End must be on or after start"},Ft={...Te};function V(){return{...Ft}}function yt(t){Ft={...Ft,...t};for(let e of Rt)e()}var Rt=new Set;function vt(t){return Rt.add(t),()=>{Rt.delete(t)}}function K(){return new AbortController}function G(t,e){return()=>{if(!t.aborted)e()}}function Qt(t){let e=t&&typeof t==="object"&&!Array.isArray(t)&&"dates"in t?t.dates:t,s=new Map;if(Array.isArray(e)){for(let i of e){if(!i||typeof i!=="object"||!("date"in i))continue;let{date:n,...r}=i;s.set(String(n),r)}return s}if(e&&typeof e==="object")for(let[i,n]of Object.entries(e))s.set(i,n&&typeof n==="object"?n:{});return s}function Z(t,e){for(let s of e){if(!Object.hasOwn(t,s))continue;let i=Reflect.get(t,s);Reflect.deleteProperty(t,s),Reflect.set(t,s,i)}}var Me=0;function A(t){return String(t).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function $e(t){let e=Number(t);if(e===7)return 0;return Number.isInteger(e)&&e>=0&&e<=6?e:1}function Fe(t){return Number(t.slice(0,4))}function wt(t,e){let[s,i]=t.split("-").map(Number),n=s*12+(i-1)+e,r=Math.floor(n/12),a=(n%12+12)%12+1;if(r<1||r>9999)return null;return`${String(r).padStart(4,"0")}-${String(a).padStart(2,"0")}`}function te(t){return{"data-range-start":t==="start"||t==="single","data-range-end":t==="end"||t==="single","data-in-range":t==="in"}}function Re(t){return Object.entries(te(t)).filter(([,e])=>e).map(([e])=>` ${e}="true"`).join("")}function Ie(t){if(t==="single")return"rangeSingle";if(t==="start")return"rangeStart";if(t==="end")return"rangeEnd";if(t==="in")return"rangeInRange";return""}class ut extends HTMLElement{static observedAttributes=["value","display","min","max","first-day","locale","fixed-weeks","show-week-numbers","selection","month-format"];static setDefaultControlClasses(t){gt(t)}static getDefaultControlClasses(){return at()}static setDefaultMessages(t){yt(t)}static getDefaultMessages(){return V()}constructor(){super();this._id=`date-calendar-${++Me}`,this._model=new kt,this._connected=!1,this._session=null,this._rendering=!1,this._heading=null,this._renderRoot=null,this._source=null,this._hostIntent=null,this._sourceStates=new Map,this._loadedRanges=new Set,this._loadController=null,this._loadingKey="",this._loadingPromise=null,this._dateState=null,this._renderDay=null,this._isDateDisabled=null,this._highlightedRange={start:"",end:""},this._paintedRange={start:"",end:""},this._paintedPreview=!1,this._renderedStates=new Map,this._messages=null,this._controlClasses=null,this._stopDefaultMessages=null,this._stopDefaultControlClasses=null,this._onClick=this._onClick.bind(this),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this)}connectedCallback(){if(this._connected)return;if(this._session=K(),Z(this,["locale","min","max","firstDay","selection","monthFormat","fixedWeeks","showWeekNumbers","controlClasses","messages","source","dateState","renderDay","isDateDisabled","highlightedRange","value","display"]),this._normalizeAttributes(),this._syncModel(),this.hasAttribute("display"))this._reflect("display",this._model.display);Z(this,["focusedDate"]),this._stopDefaultControlClasses=Yt(()=>{if(jt(this._controlClasses))this.render()}),this._stopDefaultMessages=vt(()=>{if(this._messages===null)this.render()}),this._connected=!0;let{signal:t}=this._session;this.addEventListener("click",this._onClick,{signal:t}),this.addEventListener("change",this._onChange,{signal:t}),this.addEventListener("keydown",this._onKeyDown,{signal:t}),this.addEventListener("focusin",this._onFocusIn,{signal:t}),this.render()}disconnectedCallback(){this._stopDefaultControlClasses?.(),this._stopDefaultControlClasses=null,this._stopDefaultMessages?.(),this._stopDefaultMessages=null,this._connected=!1,this._loadController?.abort(),this._loadController=null,this._loadingKey="",this._loadingPromise=null,this.removeAttribute("data-loading"),this._session?.abort(),this._session=null}_normalizeAttributes(){let t=this.getAttribute("value");if(t&&!d(t))this.removeAttribute("value");for(let e of["min","max"]){let s=this.getAttribute(e);if(s&&!d(s))this.removeAttribute(e)}}attributeChangedCallback(t,e,s){if(this._rendering)return;if(!this._connected)return;if(t==="value"&&s&&!d(s)){this._reflect("value",this._model.value);return}if((t==="min"||t==="max")&&s&&!d(s)){if(this._reflect(t,""),this._connected)this._syncModel(),this.render();return}if(t==="display"&&s)try{if(p(s)!==s)throw TypeError("Non-canonical month")}catch{this._reflect("display",this._model.display);return}this._syncModel(),this.render()}_queueFocus(t){let e=this._session;if(!e)return;queueMicrotask(G(e.signal,t))}get locale(){return z(this.getAttribute("locale")||"")}set locale(t){if(t)this.setAttribute("locale",t);else this.removeAttribute("locale")}get value(){return this._model.value}set value(t){let e=t||"";if(e&&!d(e))throw TypeError(`Invalid calendar value: ${e}`);if(e===this._model.value)return;if(this._model.setValue(e),this._reflect("value",e),this._connected)this.render()}get display(){return this._model.display}set display(t){this._setDisplay(t,{emit:!1})}get focusedDate(){return this._model.focused}set focusedDate(t){let e=t||"";if(e===this._model.focused)return;this.focusDate(e,{moveFocus:!1})}get min(){let t=this.getAttribute("min")||"";return d(t)?t:""}set min(t){if(t)this.setAttribute("min",t);else this.removeAttribute("min")}get max(){let t=this.getAttribute("max")||"";return d(t)?t:""}set max(t){if(t)this.setAttribute("max",t);else this.removeAttribute("max")}get firstDay(){return $e(this.getAttribute("first-day")||"1")}set firstDay(t){this.setAttribute("first-day",String(t))}get selection(){return this.getAttribute("selection")==="none"?"none":"single"}set selection(t){this.setAttribute("selection",t==="none"?"none":"single")}get monthFormat(){return this.getAttribute("month-format")==="short"?"short":"long"}set monthFormat(t){if(t==="short")this.setAttribute("month-format","short");else this.removeAttribute("month-format")}get highlightedRange(){return{...this._highlightedRange}}set highlightedRange(t){let e=_t(t),s=this.hasAttribute("data-range-preview");if(e.start===this._paintedRange.start&&e.end===this._paintedRange.end&&s===this._paintedPreview)return;if(this._highlightedRange=e,this._connected)this._updateRangeDom()}get fixedWeeks(){return this.hasAttribute("fixed-weeks")}set fixedWeeks(t){this.toggleAttribute("fixed-weeks",Boolean(t))}get showWeekNumbers(){return this.hasAttribute("show-week-numbers")}set showWeekNumbers(t){this.toggleAttribute("show-week-numbers",Boolean(t))}get controlClasses(){return dt(this._controlClasses)}set controlClasses(t){let e=this.controlClasses;if(this._controlClasses=ot(t),Tt(e,this.controlClasses))return;if(this._connected)this.render()}get messages(){return this._messages??V()}set messages(t){if(this._messages=t==null?null:{...V(),...t},this._connected)this.render()}get source(){return this._source}set source(t){this._source=t||null,this.refreshSource()}get dateState(){return this._dateState}set dateState(t){if(this._dateState=typeof t==="function"?t:null,this._connected)this.render()}get renderDay(){return this._renderDay}set renderDay(t){if(this._renderDay=typeof t==="function"?t:null,this._connected)this.render()}get isDateDisabled(){return this._isDateDisabled}set isDateDisabled(t){if(this._isDateDisabled=typeof t==="function"?t:null,this._connected)this.render()}_syncModel(){let t=this.firstDay;this._model.firstDay=t;let e=this.getAttribute("value")||"";if(!e||d(e))this._model.value=e;let s=this.getAttribute("display")||"";if(s)try{this._model.setDisplay(rt(s,t))}catch{}else if(this._model.value)this._model.display=p(this._model.value),this._model.focused=this._model.value;if(this._model.focused=this._clamp(this._model.focused),!this.getAttribute("display"))this._model.display=p(this._model.focused)}_reflect(t,e){if(this._rendering=!0,e){if(this.getAttribute(t)!==e)this.setAttribute(t,e)}else if(this.hasAttribute(t))this.removeAttribute(t);this._rendering=!1}_clamp(t){let e=Ut(t,this.min,this.max),s=p(e),i=rt(s,this.firstDay);if(i===s)return e;let n=Number(e.slice(8,10))||1,r=F(`${i}-01`,n-1),a=Et(i);return _(r,a)>0?a:r}_weeks(t=this.display){return Vt(rt(t,this.firstDay),{firstDay:this.firstDay,fixedWeeks:this.fixedWeeks})}_focusTargetKey(t){if(t.matches(".dp-month-select, .dp-year-input")&&t.id)return`#${CSS.escape(t.id)}`;if(t.matches(".dp-nav[data-calendar-action]"))return`.dp-nav[data-calendar-action="${CSS.escape(t.dataset.calendarAction||"")}"]`;if(t.matches(".dp-day[data-date]")){let e=t.getAttribute("data-date")||"";if(d(e))return`.dp-day[data-date="${e}"]`}return""}_range(t=this.display){let e=this._weeks(t),s=e[0],i=e[e.length-1];if(!s||!i)throw Error("Calendar month produced no weeks");return{start:s[0],end:i[6]}}getDateState(t){let e=this._sourceStates.get(t)||{},s=this._dateState?.(t,{...e})||{},i={...e,...s},n=this.min&&_(t,this.min)<0||this.max&&_(t,this.max)>0,a=i.enabled===!0?!1:Boolean(this._isDateDisabled?.(t)),o=Boolean(n)||Boolean(i.disabled)||a;return{...i,disabled:o}}async refreshSource(){if(this._loadController?.abort(),this._loadController=null,this._loadingKey="",this._loadingPromise=null,this._loadedRanges.clear(),this._sourceStates.clear(),this._connected)this.render(),await this._loadDisplay(this.display)}async ensureDate(t){if(!d(t)||!this._source)return!0;return await this._loadDisplay(p(t),!1)==="loaded"}async _loadDisplay(t,e=!0){if(!this._source)return"loaded";let s=this._range(t),i=`${s.start}/${s.end}`;if(this._loadedRanges.has(i))return"loaded";if(i===this._loadingKey&&this._loadingPromise)return this._loadingPromise;this._loadController?.abort();let n=new AbortController;this._loadController=n,this._loadingKey=i;let r=this._source,a=(async()=>{this.toggleAttribute("data-loading",!0),this.dispatchEvent(new CustomEvent("dateloadstart",{detail:s,bubbles:!0}));try{let o=typeof r==="function"?r:r?.load?.bind(r);if(!o)throw TypeError("Date source must be a function or expose load(range, { signal })");let l=await o(s,{signal:n.signal});if(n.signal.aborted)return"cancelled";for(let[c,h]of Qt(l))this._sourceStates.set(c,h);if(this._loadedRanges.add(i),this.dispatchEvent(new CustomEvent("dateloadend",{detail:s,bubbles:!0})),e&&this._connected&&p(this.display)===p(t))this.render(!1);return"loaded"}catch(o){if(n.signal.aborted)return"cancelled";return this.dispatchEvent(new CustomEvent("dateloaderror",{detail:{...s,error:o},bubbles:!0})),"failed"}finally{if(this._loadController===n)this._loadController=null,this._loadingKey="",this._loadingPromise=null,this.removeAttribute("data-loading")}})();return this._loadingPromise=a,a}_setDisplay(t,e={}){let s=this._model.display;if(this._model.setDisplay(rt(t,this.firstDay)),this._model.focused=this._clamp(this._model.focused),this._model.display=p(this._model.focused),this._reflect("display",this._model.display),this._connected)this.render();if(e.emit!==!1&&s!==this._model.display)this._emitDisplayChange();return this._model.display}_emitDisplayChange(){let t=this._range();this.dispatchEvent(new CustomEvent("displaychange",{detail:{display:this.display,...t},bubbles:!0}))}previousMonth(){return this._setDisplay(wt(this.display,-1)??this.display)}nextMonth(){return this._setDisplay(wt(this.display,1)??this.display)}focusDate(t,e={}){if(!d(t))throw TypeError(`Invalid date: ${t}`);let s=this._clamp(t),i=this.display,n=this._model.focused,r=e.moveFocus!==!1;if(this._model.setFocused(s),this._reflect("display",this._model.display),i!==this.display){if(this._connected)this.render();this._emitDisplayChange()}else if(this._connected&&n!==this._model.focused)this._moveFocusDom(n,this._model.focused,r);if(r)this._queueFocus(()=>this.focusGrid())}_moveFocusDom(t,e,s=!0){let i=t?this.querySelector(`.dp-day[data-date="${CSS.escape(t)}"]`):null,n=this.querySelector(`.dp-day[data-date="${CSS.escape(e)}"]`);if(i instanceof HTMLElement)i.tabIndex=-1;if(n instanceof HTMLElement){if(n.tabIndex=0,s)n.focus()}else if(s)this.focusGrid()}_syncRovingDom(t){for(let s of this.querySelectorAll('.dp-day[tabindex="0"]'))if(s instanceof HTMLElement&&s.dataset.date!==t)s.tabIndex=-1;let e=this.querySelector(`.dp-day[data-date="${CSS.escape(t)}"]`);if(e instanceof HTMLElement)e.tabIndex=0}_moveSelectionDom(t,e){if(t){let s=this.querySelector(`.dp-day[data-date="${CSS.escape(t)}"]`);if(s instanceof HTMLElement)s.removeAttribute("data-selected"),s.removeAttribute("aria-selected")}if(e){let s=this.querySelector(`.dp-day[data-date="${CSS.escape(e)}"]`);if(s instanceof HTMLElement)return s.setAttribute("data-selected","true"),s.setAttribute("aria-selected","true"),!0}return!1}_dayLabel(t,e,s){let i=this.hasAttribute("data-range-preview")?"":Ie(s),n=typeof e.description==="string"?e.description:"";return[lt(t,this.locale),n,i?this.messages[i]:"",e.disabled?this.messages.unavailable:""].filter(Boolean).join(". ")}_updateRangeDom(){let t=this._paintedRange,e=this._paintedPreview;this._paintedRange={...this._highlightedRange},this._paintedPreview=this.hasAttribute("data-range-preview");for(let s of this.querySelectorAll(".dp-day[data-date]")){if(!(s instanceof HTMLTableCellElement))continue;let i=s.dataset.date||"",n=bt(i,this._highlightedRange);if(n===bt(i,t)&&e===this._paintedPreview)continue;for(let[r,a]of Object.entries(te(n)))if(a)s.setAttribute(r,"true");else s.removeAttribute(r);if(!e||!this._paintedPreview){let r=this._renderedStates.get(i)||{},a=this._dayLabel(i,r,n);if(s.getAttribute("aria-label")!==a)s.setAttribute("aria-label",a)}}}focusGrid(){let t=this.querySelector(`.dp-day[data-date="${CSS.escape(this.focusedDate)}"]`);if(t instanceof HTMLElement)t.focus()}async activateDate(t){if(!this._connected)return!1;let e=this._session,s=this._hostIntent?.date===t?this._hostIntent.intent:void 0;this._hostIntent=null;let i=(o)=>{if(s!==void 0)st.set(o,s);return o},n=await this.ensureDate(t);if(!e||e.signal.aborted)return!1;let r=this.getDateState(t);if(!n||r.disabled)return this.dispatchEvent(i(new CustomEvent("dateinvalid",{detail:{date:t,state:r},bubbles:!0}))),!1;if(!this.dispatchEvent(i(new CustomEvent("dateactivate",{detail:{date:t,state:r},bubbles:!0,cancelable:!0})))||e.signal.aborted)return!1;if(this.selection==="single"){let o=this._model.value;if(this._model.setValue(t),this._reflect("value",t),this.dispatchEvent(new CustomEvent("datechange",{detail:{value:t},bubbles:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})),this._connected)if(p(t)===this.display)this._moveSelectionDom(o,t);else this.render()}else if(this._connected){if(p(t)!==this.display)this.render()}return!0}_onClick(t){let e=t.target;if(!(e instanceof Element))return;let s=e.closest("[data-calendar-action]");if(s instanceof HTMLButtonElement){let a=s.dataset.calendarAction;if(a==="previous")this.previousMonth();if(a==="next")this.nextMonth();return}let i=e.closest(".dp-day[data-date]");if(!(i instanceof HTMLTableCellElement))return;let n=i.dataset.date||"";if(!d(n))return;let r=this.display;if(this._model.setFocused(this._clamp(n)),this._reflect("display",this._model.display),r!==this.display)this._emitDisplayChange();else this._syncRovingDom(this._model.focused);this.activateDate(n)}_onChange(t){let e=t.target;if(e instanceof HTMLSelectElement&&e.matches(".dp-month-select")){this._setDisplay(`${this.display.slice(0,4)}-${e.value}`);return}if(e instanceof HTMLInputElement&&e.matches(".dp-year-input")){let s=Number(e.value);if(!Number.isInteger(s)||s<1||s>9999){if(this._connected)this.render(!1);return}this._setDisplay(`${String(s).padStart(4,"0")}-${this.display.slice(5,7)}`)}}_onFocusIn(t){let e=t.target;if(!(e instanceof HTMLTableCellElement)||!e.matches(".dp-day[data-date]"))return;let s=e.dataset.date||"";if(!d(s))return;this._model.focused=s,this._syncRovingDom(s),this.dispatchEvent(new CustomEvent("datefocus",{detail:{date:s,state:this.getDateState(s)},bubbles:!0}))}_onKeyDown(t){let e=t.target;if(!(e instanceof HTMLTableCellElement)||!e.matches(".dp-day[data-date]"))return;let s=e.dataset.date||this.focusedDate;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.activateDate(s);return}let i=this._model.focused,n=this._model.display;if(this._model.firstDay=this.firstDay,this._model.setFocused(s,{follow:!1}),t.key==="ArrowLeft")this._model.moveFocusDays(-1);else if(t.key==="ArrowRight")this._model.moveFocusDays(1);else if(t.key==="ArrowUp")this._model.moveFocusDays(-7);else if(t.key==="ArrowDown")this._model.moveFocusDays(7);else if(t.key==="Home")this._model.focusWeekStart();else if(t.key==="End")this._model.focusWeekEnd();else if(t.key==="PageUp")t.shiftKey?this._model.moveFocusYears(-1):this._model.moveFocusMonths(-1);else if(t.key==="PageDown")t.shiftKey?this._model.moveFocusYears(1):this._model.moveFocusMonths(1);else return;let r=this._model.focused;if(this._model.focused=i,this._model.display=n,!r)return;t.preventDefault(),this.focusDate(this._clamp(r))}render(t=!0){if(!this._connected)return;let e=this.locale,s=this.display,i=Fe(s),n=Number(s.slice(5,7)),r=Jt(e,this.monthFormat),a=$t(e,this.firstDay,"short"),o=$t(e,this.firstDay,"long"),l=this._weeks(),c=O(),h=`${this._id}-heading`,y=`${this._id}-grid`,D=this.min?p(this.min):"",x=this.max?p(this.max):"",S=wt(s,-1),T=wt(s,1),M=Boolean(D&&S!==null&&S<D),b=Boolean(x&&T!==null&&T>x),v=` min="${this.min?Number(this.min.slice(0,4)):1}"`,E=` max="${this.max?Number(this.max.slice(0,4)):9999}"`,k=this.showWeekNumbers&&this.firstDay===1,C=k?`<th scope="col" class="dp-week-heading" abbr="${A(this.messages.week)}">#</th>`:"",H=r.map((u,f)=>{let w=f+1,m=`${String(i).padStart(4,"0")}-${String(w).padStart(2,"0")}`,et=D&&m<D||x&&m>x;return`<option value="${String(w).padStart(2,"0")}"${w===n?" selected":""}${et?" disabled":""}>${A(u)}</option>`}).join(""),I=a.map((u,f)=>`<th scope="col" abbr="${A(o[f])}">${A(u.replace(".",""))}</th>`).join("");this._renderedStates.clear();let W=l.map((u)=>{let f=k?`<th scope="row" class="dp-week-number">${Wt(u[0])}</th>`:"",w=u.map((m)=>{let et=this.getDateState(m);this._renderedStates.set(m,et);let fe=p(m)!==s,pe=this.value===m,me=this.focusedDate===m,ge=m===c,Pt=bt(m,this._highlightedRange),_e=this._dayLabel(m,et,Pt);return`<td class="dp-day" data-date="${m}"${fe?' data-outside-month="true"':""}${ge?' data-today="true" aria-current="date"':""}${pe?' data-selected="true" aria-selected="true"':""}${Re(Pt)}${et.disabled?' data-disabled="true" aria-disabled="true"':""} tabindex="${me?"0":"-1"}" aria-label="${A(_e)}"><span class="dp-day-number" aria-hidden="true">${Number(m.slice(8,10))}</span><span class="dp-day-extra" aria-hidden="true"></span></td>`}).join("");return`<tr>${f}${w}</tr>`}).join(""),X=document.activeElement,J=X instanceof HTMLElement&&this.contains(X)?this._focusTargetKey(X):"",L=Xt(e)[0]==="year";this.toggleAttribute("data-year-first",L);let Q=this.controlClasses,j=A(Q.month||"dp-skin"),xt=A(Q.year||"dp-skin"),ft=A(Q.nav||"dp-skin"),tt=`<label class="dp-visually-hidden" for="${this._id}-month">${A(this.messages.month)}</label>
3
+ <select id="${this._id}-month" class="dp-month-select ${j}" aria-label="${A(this.messages.month)}">${H}</select>`,g=`<label class="dp-visually-hidden" for="${this._id}-year">${A(this.messages.year)}</label>
4
+ <input id="${this._id}-year" class="dp-year-input ${xt}" type="number" inputmode="numeric" value="${i}"${v}${E} aria-label="${A(this.messages.year)}">`;if(!this._heading?.isConnected||!this._renderRoot?.isConnected){this.replaceChildren();let u=document.createElement("h2");u.id=h,u.className="dp-calendar-heading dp-visually-hidden",u.setAttribute("aria-live","polite");let f=document.createElement("div");f.className="dp-calendar-render",this.append(u,f),this._heading=u,this._renderRoot=f}if(this._rendering=!0,this._renderRoot.innerHTML=`
5
5
  <div class="dp-calendar-shell">
6
6
  <div class="dp-calendar-header">
7
- ${R?_:J}
8
- ${R?J:_}
9
- <button type="button" class="dp-nav dp-prev ${ut}" data-calendar-action="previous" aria-label="${A(this.messages.previousMonth)}"${M?" disabled":""}><svg aria-hidden="true" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 10 4-4 4 4"/></svg></button>
10
- <button type="button" class="dp-nav dp-next ${ut}" data-calendar-action="next" aria-label="${A(this.messages.nextMonth)}"${y?" disabled":""}><svg aria-hidden="true" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 6 4 4 4-4"/></svg></button>
7
+ ${L?g:tt}
8
+ ${L?tt:g}
9
+ <button type="button" class="dp-nav dp-prev ${ft}" data-calendar-action="previous" aria-label="${A(this.messages.previousMonth)}"${M?" disabled":""}><svg aria-hidden="true" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 10 4-4 4 4"/></svg></button>
10
+ <button type="button" class="dp-nav dp-next ${ft}" data-calendar-action="next" aria-label="${A(this.messages.nextMonth)}"${b?" disabled":""}><svg aria-hidden="true" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 6 4 4 4-4"/></svg></button>
11
11
  </div>
12
- <table id="${b}" class="dp-grid" role="grid" aria-labelledby="${h}">
13
- <thead><tr>${C}${L}</tr></thead>
14
- <tbody>${j}</tbody>
12
+ <table id="${y}" class="dp-grid" role="grid" aria-labelledby="${h}">
13
+ <thead><tr>${C}${I}</tr></thead>
14
+ <tbody>${W}</tbody>
15
15
  </table>
16
- </div>`,this._heading.textContent=qt(`${s}-15`,e),this._rendering=!1,this._paintedRange={...this._highlightedRange},this._paintedPreview=this.hasAttribute("data-range-preview"),X)this._queueFocus(()=>{let u=X;if(u.startsWith(".dp-day[data-date="))u=`.dp-day[data-date="${CSS.escape(this._model.focused)}"]`;let f=this.querySelector(u);if(f instanceof HTMLElement)f.focus()});if(this._renderDay)for(let u of this.querySelectorAll(".dp-day[data-date]")){if(!(u instanceof HTMLTableCellElement))continue;let f=u.dataset.date||"",w=u.querySelector(".dp-day-extra");if(!(w instanceof HTMLElement))continue;let m=this._renderDay(f,this._renderedStates.get(f)||{});if(m instanceof Node)w.append(m);else if(m!==void 0&&m!==null)w.textContent=String(m)}if(t)this._loadDisplay(s)}}function vt(t){return t==="top"||t==="bottom"?"x":"y"}var ne={top:"bottom",bottom:"top",left:"right",right:"left"},Oe=new Set(Object.keys(ne).flatMap((t)=>[t,`${t}-start`,`${t}-end`])),Pe=new Set(["viewport","document"]);function ze(t){if(!Oe.has(t))throw TypeError(`Unknown placement: ${t}`);let[e,s=null]=t.split("-");return{side:e,align:s,crossAxis:vt(e)}}function He(t,e,s,i,n,r){let a=vt(s),o=t.x+t.width/2-e.width/2,d=t.y+t.height/2-e.height/2,l=t[a==="x"?"width":"height"]/2-e[a==="x"?"width":"height"]/2,h;switch(s){case"top":h={x:o,y:t.y-e.height-r};break;case"bottom":h={x:o,y:t.y+t.height+r};break;case"right":h={x:t.x+t.width+r,y:d};break;case"left":h={x:t.x-e.width-r,y:d};break;default:h={x:t.x,y:t.y}}if(i==="start"||i==="end"){let b=(n&&a==="x"?-1:1)*(i==="end"?1:-1);h[a]+=l*b}return h}function Be(t,e,s,i){return Math.max(s-t,0)+Math.max(t+e-i,0)}function Ne(t){let e=t.ownerDocument?.defaultView;if(e&&t instanceof e.Element)return e.getComputedStyle(t).direction==="rtl";return"dir"in t&&t.dir==="rtl"}var Ve=25;function Ue(t){let e=t.defaultView;if(!e)return null;let s=t.documentElement,i=e.visualViewport,n=i?.offsetLeft||0,r=i?.offsetTop||0,a=i?.width||s.clientWidth||e.innerWidth,o=i?.height||s.clientHeight||e.innerHeight,d=t.compatMode==="BackCompat"?a-s.clientWidth:s.clientWidth-s.getBoundingClientRect().width;if(d>0&&d<=Ve){let l=e.getComputedStyle?.(s).scrollbarGutter;if(l&&l!=="auto")a-=d}return{x:n,y:r,width:a,height:o,right:n+a,bottom:r+o}}function je(t,e){return e.scope?e.scope.getBoundingClientRect():Ue(t.ownerDocument)}function Qt(t,e,s,i,n){let r=s+n,a=i-e-n,o=a>=r,d=o?r:s,l=o?a:i-e;return Math.max(d,Math.min(t,l))}function te(t,e,s){if(!s)return 50;let i=(t-e)/s*100;return Math.round(Math.min(100,Math.max(0,i))*1000)/1000}function Ge(t,e){for(let s=0;s<t.length;s++){let i=t[s];if(i.right>=e.x&&i.left<=e.right&&i.bottom>=e.y&&i.top<=e.bottom)return!1}return!0}function Ye(t,e,s,i,n){if(e==="top")return Math.max(0,t.top-s.y-i-n);if(e==="bottom")return Math.max(0,s.bottom-t.bottom-i-n);return Math.max(0,s.height-n*2)}function We(t){if(t.hidden)return!1;if(typeof t.checkVisibility==="function")return t.checkVisibility();return t.getClientRects().length>0}function re(t){let{offsetWidth:e,offsetHeight:s}=t;if(e&&s)return{width:e,height:s};let i=t.getBoundingClientRect();return{width:e||i.width,height:s||i.height}}var ee=new WeakMap,se={scroll:0,resize:1,"element-resize":2};function qe(t){let e=t.defaultView;if(!e)throw TypeError("floating must belong to a document with a browsing context");let s=new Set,i=new Map,n=e.ResizeObserver,r=!1,a=!1,o=e.visualViewport;function d(y,v){let E=i.get(y);if(E===void 0||se[v]>se[E])i.set(y,v)}function l(){if(r)return;r=!0,e.requestAnimationFrame(()=>{let y=[...i];i.clear(),r=!1;for(let[v,E]of y){if(!s.has(v)||!v.floating.isConnected)continue;try{v.callback({type:E})}catch(k){h(k)}}})}function h(y){if(typeof e.reportError==="function")e.reportError(y);else e.setTimeout(()=>{throw y})}function b(y){for(let v of s)d(v,y);l()}function D(y){if(!n)return null;let v=new Set,E=new n((H)=>{let L=!1;for(let j of H)if(v.has(j.target))L=!0;else v.add(j.target);if(!L)return;d(y,"element-resize"),l()}),{reference:k,floating:C}=y;if(k)E.observe(k);if(C!==k)E.observe(C);return E}let x=()=>b("scroll"),S=()=>b("resize");function T(){if(a)return;t.addEventListener("scroll",x,{passive:!0,capture:!0}),e.addEventListener("resize",S,{passive:!0}),o?.addEventListener("scroll",x,{passive:!0}),o?.addEventListener("resize",S,{passive:!0}),a=!0}function M(){if(!a)return;t.removeEventListener("scroll",x,{capture:!0}),e.removeEventListener("resize",S),o?.removeEventListener("scroll",x),o?.removeEventListener("resize",S),a=!1}return{add(y,v,E){let k={reference:y,floating:v,callback:E};s.add(k),T();let C=D(k),H=!1;return()=>{if(H)return;if(H=!0,s.delete(k),i.delete(k),C?.disconnect(),s.size===0)M()}}}}function Ke(t){let e=t.ownerDocument,s=ee.get(e);if(!s)s=qe(e),ee.set(e,s);return s}function ae(t,e,s){if(!e?.ownerDocument)throw TypeError("autoUpdate() expects a floating HTMLElement");if(t&&t.ownerDocument!==e.ownerDocument)throw TypeError("reference and floating must belong to the same document");if(typeof s!=="function")throw TypeError("callback must be a function");return Ke(e).add(t,e,s)}function ie(t,e,s){let i=s.placement===void 0?"bottom-start":s.placement,{side:n,align:r,crossAxis:a}=ze(i),o=s.coordinateSpace===void 0?"viewport":s.coordinateSpace;if(!Pe.has(o))throw TypeError(`Unknown coordinateSpace: ${o}`);if(!We(e))return null;let d=s.distance||0,l=s.flip!==!1,h=s.shift!==!1,b=s.shiftPadding??4,D=r?Ne(t):!1,x=t.getClientRects();if(!x.length)return null;let S=(_)=>_==="bottom"?x[x.length-1]:x[0],T=je(t,s);if(!T||Ge(x,T))return null;let M=re(e),y={x:{size:M.width,start:T.x,end:T.right},y:{size:M.height,start:T.y,end:T.bottom}},v=(_,u)=>He(S(_),M,_,u,D,d),E=(_,u)=>{let{size:f,start:w,end:m}=y[u];return Be(_,f,w+b,m-b)},k=(_,u)=>{let{size:f,start:w,end:m}=y[u];return E(h?Qt(_,f,w,m,b):_,u)},C=v(n,r),H=(_,u)=>{let f=vt(_),w=f==="x"?"y":"x",m=E(u[w],w);return{main:m,total:m+k(u[f],f)}};if(l){let _=H(n,C),u=(f)=>{let w=v(f,r),m=H(f,w);if(m.total<_.total)n=f,C=w,_=m};if(_.main>0)u(ne[n]);if(a==="y"&&_.main>0)u("top"),u("bottom");a=vt(n)}if(a==="x"&&h&&r){let _=E(C.x,"x");if(_>0){let u=r==="end"?"start":"end",f=v(n,u);if(E(f.x,"x")<_)r=u,C=f}}if(h){let{size:_,start:u,end:f}=y[a];C[a]=Qt(C[a],_,u,f,b)}let L=S(n),j=te(L.x+L.width/2,C.x,M.width),K=te(L.y+L.height/2,C.y,M.height),X=`${Ye(L,n,T,d,b)}px`,{style:R}=e,Z=R.getPropertyValue("--available-height")!==X,G=o==="document"?t.ownerDocument.defaultView:null,wt=G?G.scrollX:0,ut=G?G.scrollY:0;R.left=`${C.x+wt}px`,R.top=`${C.y+ut}px`,R.setProperty("--arrow-x",`${j}%`),R.setProperty("--arrow-y",`${K}%`),R.setProperty("--available-height",X);let J=r?`${n}-${r}`:n;return e.dataset.placement=J,{width:M.width,height:M.height,roomChanged:Z,placement:J}}function oe(t,e,s={}){let i=ie(t,e,s);if(!i)return!1;if(i.roomChanged){let n=re(e);if(n.width!==i.width||n.height!==i.height)ie(t,e,{...s,placement:i.placement,flip:!1})}return!0}function z(t){return!t.matches(":disabled")&&!t.readOnly}class ct{constructor(t,e={}){this.input=t,this.messages=e.messages||{},this.adapter=dt(e.locale||""),this.hidden=null,this.canonical="",this._dirty=!1,this._commitId=0,this._disposed=!1,this._originalName=t.getAttribute("name")||"",this._attributeObserver=null,this.onAttributesChanged=null,this.confirm=null,this._generatedDefault=null}setLocale(t){let e=this._generatedDefault,s=e?this.adapter.format(e):null;if(this.adapter=dt(t||""),e&&this.input.defaultValue===s)this.input.defaultValue=this.adapter.format(e)}adoptDefault(){let t=this.input;if(t.getAttribute("value")!=null||t.defaultValue!=="")return;t.defaultValue=t.value,this._generatedDefault=this.canonical&&t.value?this.canonical:null}setMessages(t){this.messages=t||{}}format(t){return this.adapter.format(t)}parse(t){return this.adapter.parse(t)}get placeholder(){return this.adapter.placeholder}get isDisabled(){return this.input.matches(":disabled")}get isReadOnly(){return this.input.readOnly}setupFormValue(){let t=this.input;this._originalName=t.getAttribute("name")||"",this._attributeObserver=new MutationObserver(()=>this.onAttributesChanged?.()),this._attributeObserver.observe(t,{attributes:!0,attributeFilter:["disabled","readonly","name","form"]}),this.syncInputState()}syncInputState(){let t=this.input,e=t.getAttribute("name")||"";if(e){if(!this.hidden){let s=document.createElement("input");s.type="hidden",s.value=this.canonical,t.insertAdjacentElement("afterend",s),this.hidden=s}if(this.hidden)this.hidden.name=e;t.removeAttribute("name")}if(this.hidden){if(t.hasAttribute("form"))this.hidden.setAttribute("form",t.getAttribute("form")||"");else this.hidden.removeAttribute("form");this.hidden.disabled=t.disabled}}dirty(){this._commitId++}get isDirty(){return this._dirty}handleInput(){let t=this.input,e=t.value.trim(),s=this.canonical?this.adapter.format(this.canonical):"";if(this.dirty(),e===s){if(this._dirty=!1,this.hidden)this.hidden.value=this.canonical;t.setCustomValidity("");return}if(this._dirty=!0,this.hidden)this.hidden.value="";if(!e){t.setCustomValidity("");return}t.setCustomValidity(this.messages.invalidDate)}async commit(t={}){let e=this.input,s=++this._commitId;if(this._disposed)return{status:"stale",commitId:s};let i=e.value.trim();if(!i){if(s!==this._commitId)return{status:"stale",commitId:s};return e.setCustomValidity(""),{status:"clear",value:"",commitId:s}}let n=this.adapter.parse(i);if(!n){if(s!==this._commitId)return{status:"stale",commitId:s};if(this.hidden)this.hidden.value="";return e.setCustomValidity(this.messages.invalidDate),{status:"invalid",commitId:s}}if(this.confirm){let r=await this.confirm(n,t);if(this._disposed||s!==this._commitId)return{status:"stale",commitId:s};if(!r?.ok){if(this.hidden)this.hidden.value="";return e.setCustomValidity(r?.message||this.messages.unavailableDate),{status:"invalid",commitId:s}}}return{status:"ok",value:n,commitId:s}}isCommitCurrent(t){return t===this._commitId}setCanonical(t,e={}){let s=t||"";if(s&&!c(s))throw TypeError(`Invalid date-picker value: ${s}`);if(this.dirty(),this.canonical=s,this._dirty=!1,this.hidden)this.hidden.value=s;if(e.format!==!1)this.input.value=s?this.adapter.format(s):"";this.input.setCustomValidity("")}restoreDefault(){let t=String(this.input.defaultValue??"").trim(),e=c(t)?t:this.adapter.parse(t);return e&&c(e)?e:""}teardown(){this.dirty(),this._disposed=!0,this._attributeObserver?.disconnect(),this._attributeObserver=null;let t=this.hidden?.getAttribute("name")||this._originalName;if(t)this.input.setAttribute("name",t);this.hidden?.remove(),this.hidden=null}}var Xe=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/;function $t(t){let e=Xe.exec(String(t||""));if(!e)return null;let s=Number(e[1]),i=Number(e[2]),n=e[3]===void 0?0:Number(e[3]),r=e[4]===void 0?0:Number(e[4].padEnd(3,"0"));if(s>23||i>59||n>59||r>999)return null;return{hour:s,minute:i,second:n,millisecond:r}}function Ft(t){return $t(t)!==null}function de(t){return((t.hour*60+t.minute)*60+t.second)*1000+t.millisecond}function le(t,e){let s=$t(t),i=$t(e);if(!s||!i)throw TypeError("compareTimes() expects HH:MM values");let n=de(s)-de(i);return n===0?0:n<0?-1:1}var Ze=0,ce=4;class Lt extends HTMLElement{static observedAttributes=["value","locale","min","max","open-on-focus","month-format"];static setDefaultControlClasses(t){pt(t)}static getDefaultControlClasses(){return nt()}static setDefaultMessages(t){_t(t)}static getDefaultMessages(){return V()}constructor(){super();this._id=`date-picker-${++Ze}`,this._connected=!1,this._reflecting=!1,this._value="",this._input=null,this._field=null,this._fields=null,this._range=null,this._orderTags=new Set,this._timeFields=[null,null],this._timeOrderOwned=new Set,this._lastFocusEndpoint="",this._activationId=0,this._previewDate="",this._drag=null,this._suppressGridClick=!1,this._buttons=[],this._returnFocus=null,this._panel=null,this._calendar=null,this._originalDescribedBy="",this._rangeOriginalDescribedBy=["",""],this._formatHint=null,this._generatedPlaceholders=new WeakSet,this._controller=null,this._stopTracking=null,this._open=!1,this._suppressFocusOpen=!1,this._messages=null,this._controlClasses=null,this._stopDefaultMessages=null,this._source=null,this._dateState=null,this._renderDay=null,this._isDateDisabled=null,this._coordinateSpace="viewport"}_rangeMode(){return this.hasAttribute("range")&&Boolean(this._range)}_ownsField(t){return this._connected&&(t===this._field||Boolean(this._fields?.includes(t)))}connectedCallback(){if(this._connected)return;if(q(this,["locale","min","max","monthFormat","openOnFocus","coordinateSpace","controlClasses","messages","source","dateState","renderDay","isDateDisabled"]),this.hasAttribute("range"))this._connectRange();else this._connectSingle();if(this._connected)q(this,["value","range"]),this._stopDefaultMessages=yt(()=>{if(this._messages===null)this._refreshMessages()}),this.validate()}_connectSingle(){let t=this.querySelector(":scope > input:not([type=hidden]):not([type=time]):not([data-time-start]):not([data-time-end])");if(!(t instanceof HTMLInputElement)){console.warn("<date-picker> expects a direct child text input");return}this._connected=!0,this._input=t,this._discoverTimeFields(),this._field=new ct(t,{messages:this.messages,locale:this.locale}),this._field.onAttributesChanged=()=>this._syncInputState(),this._field.confirm=(i,n)=>this._confirmDate(i,n),this._setupFormValue(),this._build(),this._syncInputState(),this._bind(),this._syncCalendarOptions();let e=this._adapter(),s=this.getAttribute("value")||(c(t.value)?t.value:e.parse(t.value));if(s&&c(s))this._setValue(s,{emit:!1,format:!0});else if(!t.value)this._setValue("",{emit:!1,format:!1});else t.setCustomValidity(this.messages.invalidDate);if(this._field.hidden)this._field.hidden.defaultValue=this._value;this._field.adoptDefault()}_discoverTimeFields(){this._timeFields=[null,null];let t=["data-time-start","data-time-end"];for(let[e,s]of t.entries()){let i=this.querySelectorAll(`:scope > input[${s}]`);if(i.length>1)console.warn(`<date-picker> expects at most one direct child input[${s}]; ignoring extras`);let n=i[0];if(n==null)continue;if(!(n instanceof HTMLInputElement)||n.type!=="time"){console.warn(`<date-picker> input[${s}] must be an <input type="time">; ignoring it`);continue}this._timeFields[e]=n}if(this.querySelector(":scope > input[type=time]:not([data-time-start]):not([data-time-end])"))console.warn("<date-picker> time inputs need [data-time-start] or [data-time-end]; ignoring it")}_connectRange(){if(this.querySelector(":scope > input[data-time-start], :scope > input[data-time-end]"))console.warn("<date-picker range> time companions are not supported yet; leaving them native");let t=this.querySelector(":scope > input[data-range-start]"),e=this.querySelector(":scope > input[data-range-end]");if(!(t instanceof HTMLInputElement)||!(e instanceof HTMLInputElement)){console.warn("<date-picker range> expects direct child inputs marked [data-range-start] and [data-range-end]");return}this._connected=!0,this._input=null,this._fields=[new ct(t,{messages:this.messages,locale:this.locale}),new ct(e,{messages:this.messages,locale:this.locale})],this._range=new St,this._rangeOriginalDescribedBy=[t.getAttribute("aria-describedby")||"",e.getAttribute("aria-describedby")||""];for(let o of this._fields)o.onAttributesChanged=()=>this._syncRangeFields(),o.confirm=(d,l)=>this._confirmDate(d,l),o.setupFormValue();this._build(),this._setRangeAria(),this._syncRangeFields(),this._bindRange(),this._syncCalendarOptions();let s=this._adapter(),i=c(t.value)?t.value:s.parse(t.value),n=c(e.value)?e.value:s.parse(e.value),r=t.value,a=e.value;this._setRange(i||"",n||"",{emit:!1});for(let[o,d,l]of[[t,r,i],[e,a,n]]){if(!d.trim()||c(l))continue;o.value=d,o.setCustomValidity(this.messages.invalidDate)}if(this._fields[0].hidden)this._fields[0].hidden.defaultValue=this._range.start;if(this._fields[1].hidden)this._fields[1].hidden.defaultValue=this._range.end;for(let o of this._fields)o.adoptDefault()}disconnectedCallback(){if(this._stopDefaultMessages?.(),this._stopDefaultMessages=null,this._connected=!1,this._suppressFocusOpen=!1,this.hide(!1),this._controller?.abort(),this._controller=null,this._clearTimeOrderValidity(),this._timeFields=[null,null],this._rangeMode()){for(let t of this._fields||[])this._teardownField(t);this._fields=null,this._range=null}else this._teardownField(this._field);this._field=null;for(let{button:t}of this._buttons)t.remove();this._buttons=[],this._returnFocus=null,this._panel?.remove(),this._formatHint?.remove(),this._panel=null,this._calendar=null,this._formatHint=null}_teardownField(t){if(!t)return;let e=t.input,s=this._fields?.includes(t)?this._rangeOriginalDescribedBy[this._fields?.indexOf(t)??0]||"":this._originalDescribedBy;if(t.teardown(),s)e.setAttribute("aria-describedby",s);else e.removeAttribute("aria-describedby");e.removeAttribute("role"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-controls")}attributeChangedCallback(t,e,s){if(this._reflecting||e===s)return;if(t==="value"&&s&&!c(s)){this._reflectValue(this._value);return}if((t==="min"||t==="max")&&s&&!c(s)){if(this.removeAttribute(t),this._connected)this._syncCalendarOptions(),this.validate();return}if(!this._connected)return;if(t==="value"){if(this._rangeMode())return;if(!s||c(s))this._supersedeActivations(),this._setValue(s||"",{emit:!1,format:!0,reflect:!1});return}if(t==="locale")this._refreshLocale();if(t==="open-on-focus")return;this._syncCalendarOptions(),this.validate()}get input(){return this._rangeMode()?void 0:this._input}get calendar(){return this._calendar}get value(){return this._rangeMode()?void 0:this._value}set value(t){if(this._rangeMode())throw TypeError("value is not available in range mode; use range");if(t&&!c(t))throw TypeError(`Invalid date-picker value: ${t}`);this._supersedeActivations(),this._setValue(t||"",{emit:!1,format:!0})}get range(){return this._rangeMode()&&this._range?{...this._range.range}:void 0}set range(t){if(!this._rangeMode())throw TypeError("range is only available on <date-picker range>");let{start:e,end:s}=mt(t);this._supersedeActivations(),this._setRange(e,s)}get locale(){return P(this.getAttribute("locale")||"")}set locale(t){if(t)this.setAttribute("locale",t);else this.removeAttribute("locale")}get monthFormat(){return this.getAttribute("month-format")==="short"?"short":"long"}set monthFormat(t){if(t==="short")this.setAttribute("month-format","short");else this.removeAttribute("month-format")}get min(){let t=this.getAttribute("min")||"";return c(t)?t:""}set min(t){if(t)this.setAttribute("min",t);else this.removeAttribute("min")}get max(){let t=this.getAttribute("max")||"";return c(t)?t:""}set max(t){if(t)this.setAttribute("max",t);else this.removeAttribute("max")}get openOnFocus(){return this.getAttribute("open-on-focus")!=="false"}set openOnFocus(t){if(t===!1)this.setAttribute("open-on-focus","false");else this.removeAttribute("open-on-focus")}get open(){return this._open}get controlClasses(){return at(this._controlClasses)}set controlClasses(t){if(this._controlClasses=rt(t),this._calendar)this._calendar.controlClasses=this._controlClasses}get messages(){return this._messages??V()}set messages(t){if(this._messages=t==null?null:{...V(),...t},this._calendar)this._calendar.messages=this._messages;this._refreshMessages()}_refreshMessages(){let t=this.messages;for(let s of this._fields||[])s.setMessages(t);this._field?.setMessages(t),this._panel?.setAttribute("aria-label",t.calendar);let e=this._field??this._fields?.[0];if(this._formatHint&&e)this._formatHint.textContent=`${t.formatHint}: ${e.placeholder}`;if(this._refreshButtonLabel(),this._connected)this.validate()}get source(){return this._source}set source(t){if(this._source=t||null,this._calendar)this._calendar.source=this._source;if(this._connected)this.validate()}get dateState(){return this._dateState}set dateState(t){if(this._dateState=typeof t==="function"?t:null,this._calendar)this._calendar.dateState=this._dateState;if(this._connected)this.validate()}get renderDay(){return this._renderDay}set renderDay(t){if(this._renderDay=typeof t==="function"?t:null,this._calendar)this._calendar.renderDay=this._renderDay}get isDateDisabled(){return this._isDateDisabled}set isDateDisabled(t){if(this._isDateDisabled=typeof t==="function"?t:null,this._calendar)this._calendar.isDateDisabled=this._isDateDisabled;if(this._connected)this.validate()}get coordinateSpace(){return this._coordinateSpace}set coordinateSpace(t){this._coordinateSpace=t==="document"?"document":"viewport"}_adapter(){return this._field?.adapter??this._fields?.[0]?.adapter??dt(this.locale)}_setupFormValue(){this._field?.setupFormValue()}_syncInputState(){let t=this._input;if(!t)return;this._field?.syncInputState();let e=this._buttons[0]?.button;if(e)e.disabled=t.disabled||t.readOnly;if(this._open&&!z(t))this.hide(!1)}_syncRangeFields(){if(!this._fields)return;for(let s of this._fields)s.syncInputState();for(let{button:s,endpoint:i}of this._buttons){let n=i==="end"?1:0,r=this._fields[n];s.disabled=Boolean(r?.input.disabled||r?.input.readOnly)}this._syncDragAffordance();let t=this._range?.activeEndpoint==="end"?1:0,e=this._fields[t]?.input;if(this._open&&e&&!z(e))this.hide(!1)}_setRangeAria(){if(!this._fields||!this._panel||!this._formatHint)return;for(let t of this._fields){let e=t.input,s=[this._rangeOriginalDescribedBy[this._fields.indexOf(t)],this._formatHint.id].filter(Boolean).join(" ");e.setAttribute("aria-describedby",s),e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",this._panel.id)}}_createTrigger(t){let e=document.createElement("button");if(e.type="button",e.className="dp-picker-button",e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",`${this._id}-panel`),t)e.dataset.endpoint=t;return e.innerHTML='<span aria-hidden="true"><svg viewBox="0 0 16 16" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><rect x="1.75" y="3" width="12.5" height="11" rx="1.75"/><path d="M1.75 6.75h12.5"/><path d="M5.25 1.75v2.5M10.75 1.75v2.5"/></svg></span>',e}_build(){let t=this._rangeMode(),e=[];if(t)for(let[o,d]of(this._fields||[]).entries())e.push([d.input,o===1?"end":"start"]);else if(this._input)e.push([this._input,""]);if(!e.length)return;let s=`${this._id}-panel`,i=`${this._id}-format`;this._buttons=e.map(([o,d])=>{let l=this._createTrigger(d);return o.insertAdjacentElement("afterend",l),{button:l,endpoint:d}});let n=document.createElement("div");n.id=s,n.className="dp-picker-panel",n.setAttribute("popover","manual"),n.setAttribute("role","dialog"),n.setAttribute("aria-label",this.messages.calendar);let r=new lt;r.selection="none",r.fixedWeeks=!0,n.append(r);let a=document.createElement("span");if(a.id=i,a.className="dp-visually-hidden",this.append(n,a),this._panel=n,this._calendar=r,this._formatHint=a,!t&&this._input){this._originalDescribedBy=this._input.getAttribute("aria-describedby")||"";let o=[this._originalDescribedBy,i].filter(Boolean).join(" ");this._input.setAttribute("aria-describedby",o),this._input.setAttribute("role","combobox"),this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded","false"),this._input.setAttribute("aria-controls",s)}this._refreshLocale(),this._refreshButtonLabel()}_bindPopup(t,e,s){this.ownerDocument.addEventListener("pointerdown",(i)=>{if(!this._open||i.composedPath().includes(this))return;this.hide(!1)},{capture:!0,signal:t}),this.ownerDocument.addEventListener("reset",(i)=>{if(!(i.target instanceof HTMLFormElement)||!e||i.target!==e.form)return;this.hide(!1),queueMicrotask(()=>{if(!t.aborted&&!i.defaultPrevented)s()})},{capture:!0,signal:t}),this.addEventListener("keydown",(i)=>this._onEscape(i),{signal:t})}_bind(){let t=this._input,e=this._buttons[0]?.button,s=this._calendar;if(!t||!e||!s)return;let i=new AbortController;this._controller=i;let{signal:n}=i;t.addEventListener("input",()=>{this._field?.handleInput()},{signal:n}),t.addEventListener("change",()=>void this._commitText(!1),{signal:n}),t.addEventListener("blur",()=>void this._commitText(!1),{signal:n}),t.addEventListener("focus",(r)=>{if(!this.openOnFocus||this._suppressFocusOpen)return;let a=r.relatedTarget;if(a instanceof Node&&this.contains(a))return;if(!this._open)this.show({moveFocus:!1})},{signal:n}),t.addEventListener("keydown",(r)=>{this._onFieldKeyDown("",r)},{signal:n});for(let[r,a]of this._timeFields.entries()){if(!a)continue;let o=r===1?"end":"start";a.addEventListener("input",()=>this._revalidateTimeOrder(o),{signal:n}),a.addEventListener("change",()=>this._revalidateTimeOrder(o),{signal:n})}e.addEventListener("click",(r)=>{if(this._open){if(r.detail===0){this._defer(()=>this._calendar?.focusGrid());return}this.hide(!1);return}this.show({returnFocus:e})},{signal:n}),e.addEventListener("keydown",(r)=>this._onTriggerKeyDown("",r),{signal:n}),s.addEventListener("click",(r)=>this._captureGridIntent(r),{capture:!0,signal:n}),s.addEventListener("keydown",(r)=>this._captureGridIntent(r),{capture:!0,signal:n}),s.addEventListener("dateactivate",(r)=>{let a=r,o=a.detail?.date;if(!c(o))return;let d=tt.get(a);queueMicrotask(()=>{if(n.aborted||a.defaultPrevented||!this._connected)return;if(d&&d.id!==this._activationId)return;if(!this._input||!z(this._input))return;this._field?.dirty(),this._setValue(o,{emit:!0,format:!0}),this.hide(!1),this._restoreFocus()})},{signal:n}),s.addEventListener("dateloadend",()=>void this.validate(),{signal:n}),this._bindPopup(n,this._input,()=>this._restoreDefault())}_bindRange(){let t=this._calendar;if(!this._fields||!this._buttons.length||!t)return;let e=new AbortController;this._controller=e;let{signal:s}=e;for(let[i,n]of this._fields.entries()){let r=i===1?"end":"start";n.input.addEventListener("input",()=>{if(n.handleInput(),this._orderTags.delete(i),!n.isDirty)this._revalidateRange(r)},{signal:s}),n.input.addEventListener("change",()=>void this._commitFieldText(r),{signal:s}),n.input.addEventListener("blur",()=>void this._commitFieldText(r),{signal:s}),n.input.addEventListener("focus",(a)=>this._onFieldFocus(r,a),{signal:s}),n.input.addEventListener("keydown",(a)=>this._onFieldKeyDown(r,a),{signal:s})}for(let i of this._buttons){let n=i.endpoint;if(n==="")continue;i.button.addEventListener("click",(r)=>this._onRangeTriggerClick(n,r),{signal:s}),i.button.addEventListener("keydown",(r)=>this._onTriggerKeyDown(n,r),{signal:s})}t.addEventListener("click",(i)=>{if(this._suppressGridClick){this._suppressGridClick=!1,i.preventDefault(),i.stopImmediatePropagation();return}this._captureGridIntent(i)},{capture:!0,signal:s}),t.addEventListener("keydown",(i)=>this._captureGridIntent(i),{capture:!0,signal:s}),t.addEventListener("dateactivate",(i)=>{let n=i,r=n.detail?.date;if(!c(r))return;queueMicrotask(()=>{if(s.aborted||n.defaultPrevented||!this._connected||!this._range)return;let a=tt.get(n);if(a===void 0||a.id!==this._activationId)return;let o=(l)=>this._boundEditable(l),d=a.endpoint?this._range.moveEndpoint(r,a.endpoint,o):this._range.activate(r,o);if(d.status==="refused"){this._calendar?.dispatchEvent(new CustomEvent("dateinvalid",{detail:{date:r,state:this._calendar.getDateState(r)},bubbles:!0}));return}if(this._applyRangeTransition(d),a.endpoint)return;if(d.close||d.status==="complete")this.hide(!1),this._focusField(d.endpoint)})},{signal:s}),t.addEventListener("datefocus",(i)=>this._onGridDateFocus(i),{signal:s}),t.addEventListener("pointerover",(i)=>this._onGridPointerOver(i),{signal:s}),t.addEventListener("pointerleave",()=>this._onGridPointerLeave(),{signal:s}),t.addEventListener("pointerdown",(i)=>this._onGridPointerDown(i),{signal:s}),t.addEventListener("pointermove",(i)=>this._onGridPointerMove(i),{signal:s}),t.addEventListener("pointerup",(i)=>this._onGridPointerUp(i),{signal:s}),t.addEventListener("pointercancel",(i)=>this._onGridPointerCancel(i),{signal:s}),t.addEventListener("lostpointercapture",(i)=>this._onGridPointerCancel(i),{signal:s}),t.addEventListener("dateloadend",()=>void this.validate(),{signal:s}),this._bindPopup(s,this._fields?.[0]?.input,()=>this._restoreRangeDefault())}_activateRangeEndpoint(t){let e=this._calendar;if(!this._range||!e)return;this._range.focus(t),this._activationId++,this._lastFocusEndpoint=t;let s=this._boundCanonical(t)||O();e.display=p(s),e.focusedDate=s,this._clearPreview()}_onRangeTriggerClick(t,e){if(!this._open){this.show({endpoint:t});return}if(e.detail===0){this._activateRangeEndpoint(t),this._defer(()=>this._calendar?.focusGrid());return}if(t!==this._range?.activeEndpoint){this._activateRangeEndpoint(t);return}this.hide(!1)}_onTriggerKeyDown(t,e){if(e.key!=="ArrowDown")return;if(e.preventDefault(),this._open){if(this._rangeMode()&&t)this._activateRangeEndpoint(t);this._defer(()=>this._calendar?.focusGrid());return}if(this._rangeMode())this.show({endpoint:t||void 0});else this.show({returnFocus:this._buttons[0]?.button})}_onFieldKeyDown(t,e){if(e.key==="ArrowDown"){if(e.preventDefault(),this._rangeMode()&&t)this._lastFocusEndpoint=t,this._range?.focus(t);if(this._open)this._defer(()=>this._calendar?.focusGrid());else this.show()}else if(e.key==="Escape"&&this._open)e.preventDefault(),this.hide(!1)}_onFieldFocus(t,e){if(!this._rangeMode()||!t)return;let s=t!==this._range?.activeEndpoint;if(this._lastFocusEndpoint=t,this._range?.focus(t),s)this._activationId++;if(!this.openOnFocus||this._suppressFocusOpen)return;let i=e.relatedTarget;if(i instanceof Node&&this.contains(i))return;if(!this._open)this.show({moveFocus:!1})}_captureGridIntent(t){if(this._rangeMode()?!this._range:!this._field)return;if(t.type==="keydown"){let i=t.key;if(i!=="Enter"&&i!==" ")return}if(t.type==="click"&&this._suppressGridClick)return;if(!(t.target instanceof Element))return;let s=t.target.closest(".dp-day[data-date]")?.getAttribute("data-date")||"";if(!c(s))return;this._attachIntent(s,"")}_attachIntent(t,e){if(!this._calendar)return;this._calendar._hostIntent={date:t,intent:{id:++this._activationId,endpoint:e}}}_supersedeActivations(){this._activationId++}_boundEditable(t){let e=this._fields?.[t==="end"?1:0];return e!=null&&z(e.input)}_applyRangeTransition(t){let e=this._fields;if(!e||!this._range||t.status==="refused")return;let s=[];for(let i of t.changedEndpoints){let n=e[i==="end"?1:0],r=i==="end"?t.range.end:t.range.start;if(!n||n.canonical===r)continue;n.setCanonical(r,{format:!0}),s.push(n)}if(this._syncHighlight(),this._refreshRangeButtonLabel(),this._revalidateRange(t.endpoint),!s.length)return;this._emitRangeChange();for(let i of s)i.input.dispatchEvent(new Event("input",{bubbles:!0})),i.input.dispatchEvent(new Event("change",{bubbles:!0}))}_setPreview(t,e=""){let s=this._calendar;if(!s||!this._range||!this._open)return;let i=c(t)&&!s.getDateState(t).disabled?t:"",n=i?this._range.previewRange(i,e,(r)=>this._boundEditable(r)):null;if(!n){this._clearPreview();return}this._previewDate=i,s.toggleAttribute("data-range-preview",!0),s.highlightedRange=n}_clearPreview(){if(!this._previewDate)return;this._syncHighlight()}_onGridDateFocus(t){if(this._drag)return;let e=t.detail?.date;if(c(e))this._setPreview(e)}_onGridPointerOver(t){let e=t;if(this._drag||e.pointerType==="touch")return;this._setPreview(this._cellDate(e.target))}_onGridPointerLeave(){if(this._drag?.active===!1)this._drag=null;if(this._drag)return;this._clearPreview()}_cellDate(t){let s=(t instanceof Element?t.closest(".dp-day[data-date]"):null)?.getAttribute("data-date")||"";return c(s)?s:""}_dateAtPoint(t,e){let s=this.ownerDocument.elementFromPoint(t,e);if(!(s instanceof Element)||!this._calendar?.contains(s))return"";return this._cellDate(s)}_onGridPointerDown(t){let e=t;if(this._suppressGridClick=!1,this._drag?.active===!1)this._drag=null;if(!this._open||!this._range||this._drag)return;if(!e.isPrimary||e.button!==0)return;if(e.pointerType!=="mouse"&&e.pointerType!=="pen")return;if(!this._range.complete)return;let s=e.target instanceof Element?e.target.closest(".dp-day[data-date]"):null;if(!(s instanceof HTMLElement))return;let i=s.hasAttribute("data-range-start"),n=s.hasAttribute("data-range-end");if(i===n)return;let r=i?"start":"end",a=this._cellDate(s);if(!a||!this._boundEditable(r))return;this._drag={pointerId:e.pointerId,endpoint:r,x:e.clientX,y:e.clientY,date:a,active:!1}}_onGridPointerMove(t){let e=t,s=this._drag;if(!s||e.pointerId!==s.pointerId)return;if(!s.active){if(!(Math.abs(e.clientX-s.x)>ce||Math.abs(e.clientY-s.y)>ce))return;s.active=!0;try{this._calendar?.setPointerCapture(s.pointerId)}catch{}this._syncDragAffordance()}let i=this._dateAtPoint(e.clientX,e.clientY);if(!i||this._calendar?.getDateState(i).disabled)return;s.date=i,this._setPreview(i,s.endpoint)}_onGridPointerUp(t){let e=t,s=this._drag;if(!s||e.pointerId!==s.pointerId)return;if(this._drag=null,this._releaseDragCapture(s.pointerId),!s.active){this._syncDragAffordance();return}this._suppressGridClick=!0;let i=this._range?.projectEndpoint(s.date,s.endpoint,(r)=>this._boundEditable(r));if(!i||i.status==="refused"||!i.changedEndpoints.length){this._syncHighlight();return}let n=s.endpoint==="start"?i.range.start:i.range.end;this._attachIntent(n,s.endpoint),this._calendar?.activateDate(n)}_onGridPointerCancel(t){let e=t,s=this._drag;if(!s||e.pointerId!==s.pointerId)return;this._drag=null,this._releaseDragCapture(s.pointerId),this._syncHighlight()}_releaseDragCapture(t){let e=this._calendar;if(e?.hasPointerCapture(t))e.releasePointerCapture(t)}_syncDragAffordance(){let t=this._calendar;if(!t||!this._range)return;if(this._drag?.active){t.setAttribute("data-range-drag","active");return}let{start:e,end:s}=this._range;if(this._range.complete&&e!==s&&(this._boundEditable("start")||this._boundEditable("end")))t.setAttribute("data-range-drag","ready");else t.removeAttribute("data-range-drag")}_onEscape(t){if(t.key==="Escape"&&this._open)t.preventDefault(),t.stopPropagation(),this.hide(!0)}_syncCalendarOptions(){let t=this._calendar,e=this._panel;if(!t)return;if(t.locale=this.locale,t.min=this.min,t.max=this.max,t.monthFormat=this.monthFormat,t.controlClasses=this._controlClasses,t.messages=this._messages,t.source=this._source,t.dateState=this._dateState,t.renderDay=this._renderDay,t.isDateDisabled=this._isDateDisabled,!this._rangeMode()&&this._value)t.value=this._value;if(e)e.setAttribute("aria-label",this.messages.calendar)}_refreshLocale(){let t=this._formatHint;if(!t)return;if(this._rangeMode()&&this._fields){this._fields[0].setLocale(this.locale),this._fields[1].setLocale(this.locale),t.textContent=`${this.messages.formatHint}: ${this._fields[0].placeholder}`;for(let[s,i]of this._fields.entries()){if(!i.input.hasAttribute("placeholder")||this._generatedPlaceholders.has(i.input))i.input.placeholder=i.placeholder,this._generatedPlaceholders.add(i.input);let n=s===1?this._range?.end||"":this._range?.start||"";if(n)i.input.value=i.format(n)}this._refreshButtonLabel();return}let e=this._field;if(!e)return;if(e.setLocale(this.locale),t.textContent=`${this.messages.formatHint}: ${e.placeholder}`,!e.input.hasAttribute("placeholder")||this._generatedPlaceholders.has(e.input))e.input.placeholder=e.placeholder,this._generatedPlaceholders.add(e.input);if(this._value)e.input.value=e.format(this._value);this._refreshButtonLabel()}_refreshButtonLabel(){let t=this._buttons[0]?.button;if(!t)return;if(this._rangeMode()){this._refreshRangeButtonLabel();return}let e=this._value?this.messages.changeDate:this.messages.chooseDate,s=this._value?`, ${ot(this._value,this.locale)}`:"";t.setAttribute("aria-label",`${e}${s}`)}_refreshRangeButtonLabel(){if(!this._range)return;let{start:t,end:e}=this._range;for(let{button:s,endpoint:i}of this._buttons){let n=i==="end"?e:t,r=n?this.messages.changeDate:this.messages.chooseDate,a=n?`, ${ot(n,this.locale)}`:"",o=i==="end"?this.messages.rangeEnd:this.messages.rangeStart;s.setAttribute("aria-label",`${r}${a}, ${o}`)}}_reflectValue(t){if(this._reflecting=!0,t)this.setAttribute("value",t);else this.removeAttribute("value");this._reflecting=!1}_setValue(t,e={}){if(t&&!c(t))throw TypeError(`Invalid date-picker value: ${t}`);let s=this._value;if(this._value=t||"",e.reflect!==!1)this._reflectValue(this._value);if(this._field?.setCanonical(this._value,{format:e.format!==!1}),this._calendar){if(this._calendar.value=this._value,this._value&&e.moveDisplay!==!1)this._calendar.focusedDate=this._value}if(this._refreshButtonLabel(),s!==this._value){if(this.dispatchEvent(new CustomEvent("valuechange",{detail:{value:this._value},bubbles:!0})),e.emit&&this._field){let i=this._field.input;i.dispatchEvent(new Event("input",{bubbles:!0})),i.dispatchEvent(new Event("change",{bubbles:!0}))}}}async _confirmDate(t,e={}){let s=this._calendar;if(!s)return{ok:!0};if(e.moveDisplay!==!1){let r=p(t);if(s.display!==r)s.display=r}let i=await s.ensureDate(t),n=s.getDateState(t);if(!i||n.disabled)return{ok:!1,message:this.messages.unavailableDate};return{ok:!0}}async _commitText(t,e={}){let s=this._field;if(!s)return!1;if(!e.force&&!s.isDirty)return!1;let i=await s.commit(e);if(!this._ownsField(s)||!s.isCommitCurrent(i.commitId))return!1;if(i.status==="stale"||i.status==="invalid")return!1;return this._setValue(i.value||"",{emit:t,format:i.status==="ok",moveDisplay:e.moveDisplay}),!0}async _commitFieldText(t){let e=this._fields;if(!e)return!1;let s=t==="end"?1:0,i=e[s];if(!i?.isDirty)return!1;let n=await i.commit();if(!this._ownsField(i)||!i.isCommitCurrent(n.commitId))return!1;if(n.status==="stale")return!1;if(n.status==="invalid")return this._orderTags.delete(s),!1;return this._setBound(t,n.value||"",{emit:!1,user:!0,format:n.status==="ok"}),!0}_setBound(t,e,s={}){if(!this._range)return!1;let i=this._fields;if(!i)return!1;let r=i[t==="end"?1:0];if(!r)return!1;if(s.user===!0&&!z(r.input))return!1;let a=e||"",o=r.canonical;if(r.setCanonical(a,{format:s.format!==!1}),t==="end")this._range.end=a;else this._range.start=a;let d=o!==a;if(d){if(this._syncHighlight(),this._refreshRangeButtonLabel(),this._emitRangeChange(),s.emit)r.input.dispatchEvent(new Event("input",{bubbles:!0})),r.input.dispatchEvent(new Event("change",{bubbles:!0}))}return this._revalidateRange(t),d}_setRange(t,e,s={}){if(!this._range||!this._fields)return;if(this._range.start=t||"",this._range.end=e||"",this._fields[0].setCanonical(t||"",{format:s.format!==!1}),this._fields[1].setCanonical(e||"",{format:s.format!==!1}),this._syncHighlight(),this._refreshRangeButtonLabel(),this._revalidateRange("start"),this._revalidateRange("end"),s.emit!==!1)this._emitRangeChange()}_boundCanonical(t){return this._range?t==="end"?this._range.end:this._range.start:""}_emitRangeChange(){if(!this._range)return;this.dispatchEvent(new CustomEvent("rangechange",{detail:{...this._range.range},bubbles:!0}))}_displayRange(){let{start:t,end:e}=this._range?.range??{start:"",end:""};if(!t)return{start:"",end:""};if(e&&g(e,t)<0)return{start:t,end:""};return{start:t,end:e}}_syncHighlight(){if(!this._calendar||!this._range)return;this._previewDate="",this._calendar.removeAttribute("data-range-preview"),this._calendar.highlightedRange=this._displayRange(),this._syncDragAffordance()}_revalidateRange(t){if(!this._fields||!this._range)return;let{start:e,end:s}=this._range,i=Boolean(e&&s&&g(s,e)<0),n=["start","end"];for(let r of n){let a=r==="end"?1:0,o=this._fields[a].input,d=r==="end"?this.messages.rangeOrderEnd:this.messages.rangeOrderStart;if(i&&r===t)o.setCustomValidity(d),this._orderTags.add(a);else if(this._orderTags.has(a))o.setCustomValidity(""),this._orderTags.delete(a)}}_revalidateTimeOrder(t){let[e,s]=this._timeFields,i=["start","end"],n=[e,s],r=e&&!e.matches(":disabled")?e.value.trim():"",a=s&&!s.matches(":disabled")?s.value.trim():"",o=Boolean(e&&s&&r&&a)&&Ft(r)&&Ft(a)&&le(a,r)<0;for(let[d,l]of i.entries()){let h=n[d];if(!h)continue;let b=l==="end"?this.messages.rangeOrderEnd:this.messages.rangeOrderStart;if(o&&l===t)h.setCustomValidity(b),this._timeOrderOwned.add(h);else if(this._timeOrderOwned.has(h))h.setCustomValidity(""),this._timeOrderOwned.delete(h)}}_clearTimeOrderValidity(){for(let t of this._timeOrderOwned)t.setCustomValidity("");this._timeOrderOwned.clear()}_defer(t){let e=this._controller;setTimeout(()=>{if(!this._connected||!e||e.signal.aborted||this._controller!==e)return;t()},0)}_restoreDefault(){let t=this._field;if(!t)return;let e=t.restoreDefault();if(this._setValue(e,{emit:!1,format:!0}),this._calendar)if(this._value)this._calendar.display=p(this._value),this._calendar.focusedDate=this._value;else this._calendar.display=p(O()),this._calendar.focusedDate=O();this.validate()}_restoreRangeDefault(){if(!this._fields)return;let t=this._fields[0].restoreDefault(),e=this._fields[1].restoreDefault();if(this._setRange(t,e),this._calendar){let s=this._range?.start||O();this._calendar.display=p(s),this._calendar.focusedDate=s}this.validate()}_focusField(t){let e=t==="end"?1:0,s=this._fields?.[e]?.input;if(!s)return;this._suppressFocusOpen=!0,this._defer(()=>{s.focus(),this._suppressFocusOpen=!1})}_restoreFocus(){let t=this._returnFocus;if(this._returnFocus=null,!(t instanceof HTMLElement)||!t.isConnected||t.matches(":disabled"))return;this._suppressFocusOpen=!0,this._defer(()=>{t.focus(),this._suppressFocusOpen=!1})}_resolveRangeEndpoint(){if(!this._fields)return"";let t=this._lastFocusEndpoint||"start",e=t==="end"?1:0;if(z(this._fields[e].input))return t;let s=t==="end"?"start":"end",i=s==="end"?1:0;if(z(this._fields[i].input))return s;return""}async validate(){if(this._rangeMode()){let s=this._fields;if(!s)return!0;for(let[i,n]of s.entries()){let r=await n.commit({moveDisplay:!1});if(!this._ownsField(n)||!n.isCommitCurrent(r.commitId))continue;if(r.status==="invalid")this._orderTags.delete(i);if(r.status==="ok"||r.status==="clear"){let a=i===1?"end":"start";this._setBound(a,r.value||"",{format:r.status==="ok"})}}return this._revalidateRange("start"),this._revalidateRange("end"),s.every((i)=>i.input.checkValidity())}let t=this._field?.input;if(!t){let s=this.hasAttribute("range")?this.querySelectorAll(":scope > input[data-range-start], :scope > input[data-range-end]"):this._input?[this._input]:[],i=this.querySelectorAll(":scope > input[type=time][data-time-start], :scope > input[type=time][data-time-end]");return[...s,...i].every((n)=>n instanceof HTMLInputElement&&n.checkValidity())}await this._commitText(!1,{force:!0,moveDisplay:!1}),this._revalidateTimeOrder("start"),this._revalidateTimeOrder("end");let e=this._timeFields.every((s)=>s?.checkValidity()??!0);return t.checkValidity()&&e}show(t={}){let e=this._panel,s=this._calendar;if(!e||!s||!this._buttons.length||this._open)return;if(this._rangeMode()){let r=t.endpoint||this._resolveRangeEndpoint();if(!r)return;this._activateRangeEndpoint(r)}else{let r=this._input;if(!r||!z(r))return;let a=this._value||this._adapter().parse(r.value)||O();s.display=p(a),s.focusedDate=a,this._returnFocus=t.returnFocus instanceof HTMLElement?t.returnFocus:r}e.showPopover(),this._open=!0,this._setExpanded(!0);let i=this.coordinateSpace;e.style.position=i==="document"?"absolute":"fixed";let n=()=>oe(this,e,{placement:"bottom-start",distance:4,shiftPadding:8,coordinateSpace:i});if(n(),this._stopTracking=ae(this,e,n),t.moveFocus!==!1){let r=this._controller;queueMicrotask(()=>{if(!this._connected||!r||r.signal.aborted||this._controller!==r)return;s.focusGrid()})}this.dispatchEvent(new Event("open",{bubbles:!0}))}_setExpanded(t){let e=t?"true":"false";this._input?.setAttribute("aria-expanded",e);for(let{button:s}of this._buttons)s.setAttribute("aria-expanded",e);for(let s of this._fields||[])s.input.setAttribute("aria-expanded",e)}hide(t=!1){if(!this._panel||!this._open)return;this._stopTracking?.(),this._stopTracking=null;try{this._panel.hidePopover()}catch{}if(this._open=!1,this._setExpanded(!1),this._supersedeActivations(),this._suppressGridClick=!1,this._drag)this._releaseDragCapture(this._drag.pointerId),this._drag=null;if(this._syncHighlight(),t)if(this._rangeMode()){let e=this._restoreFocusEndpoint();if(e)this._focusField(e)}else this._restoreFocus();this.dispatchEvent(new Event("close",{bubbles:!0}))}_restoreFocusEndpoint(){let t=this._range?.activeEndpoint||"";if(t){let e=t==="end"?1:0,s=this._fields?.[e];if(s&&z(s.input))return t}return this._resolveRangeEndpoint()}}function Rt(){if(!customElements.get("date-calendar"))customElements.define("date-calendar",lt);if(!customElements.get("date-picker"))customElements.define("date-picker",Lt)}Rt();var ue="lekoala-date-picker-styles";if(!document.getElementById(ue)){let t=document.createElement("style");t.id=ue,t.textContent=Pt;let e=document.currentScript?.nonce;if(e)t.nonce=e;document.head.append(t)}Rt();})();
16
+ </div>`,this._heading.textContent=Zt(`${s}-15`,e),this._rendering=!1,this._paintedRange={...this._highlightedRange},this._paintedPreview=this.hasAttribute("data-range-preview"),J)this._queueFocus(()=>{let u=J;if(u.startsWith(".dp-day[data-date="))u=`.dp-day[data-date="${CSS.escape(this._model.focused)}"]`;let f=this.querySelector(u);if(f instanceof HTMLElement)f.focus()});if(this._renderDay)for(let u of this.querySelectorAll(".dp-day[data-date]")){if(!(u instanceof HTMLTableCellElement))continue;let f=u.dataset.date||"",w=u.querySelector(".dp-day-extra");if(!(w instanceof HTMLElement))continue;let m=this._renderDay(f,this._renderedStates.get(f)||{});if(m instanceof Node)w.append(m);else if(m!==void 0&&m!==null)w.textContent=String(m)}if(t)this._loadDisplay(s)}}function Dt(t){return t==="top"||t==="bottom"?"x":"y"}var ae={top:"bottom",bottom:"top",left:"right",right:"left"},Le=new Set(Object.keys(ae).flatMap((t)=>[t,`${t}-start`,`${t}-end`])),Oe=new Set(["viewport","document"]);function ze(t){if(!Le.has(t))throw TypeError(`Unknown placement: ${t}`);let[e,s=null]=t.split("-");return{side:e,align:s,crossAxis:Dt(e)}}function Pe(t,e,s,i,n,r){let a=Dt(s),o=t.x+t.width/2-e.width/2,l=t.y+t.height/2-e.height/2,c=t[a==="x"?"width":"height"]/2-e[a==="x"?"width":"height"]/2,h;switch(s){case"top":h={x:o,y:t.y-e.height-r};break;case"bottom":h={x:o,y:t.y+t.height+r};break;case"right":h={x:t.x+t.width+r,y:l};break;case"left":h={x:t.x-e.width-r,y:l};break;default:h={x:t.x,y:t.y}}if(i==="start"||i==="end"){let y=(n&&a==="x"?-1:1)*(i==="end"?1:-1);h[a]+=c*y}return h}function He(t,e,s,i){return Math.max(s-t,0)+Math.max(t+e-i,0)}function Be(t){let e=t.ownerDocument?.defaultView;if(e&&t instanceof e.Element)return e.getComputedStyle(t).direction==="rtl";return"dir"in t&&t.dir==="rtl"}var Ne=25;function Ve(t){let e=t.defaultView;if(!e)return null;let s=t.documentElement,i=e.visualViewport,n=i?.offsetLeft||0,r=i?.offsetTop||0,a=i?.width||s.clientWidth||e.innerWidth,o=i?.height||s.clientHeight||e.innerHeight,l=t.compatMode==="BackCompat"?a-s.clientWidth:s.clientWidth-s.getBoundingClientRect().width;if(l>0&&l<=Ne){let c=e.getComputedStyle?.(s).scrollbarGutter;if(c&&c!=="auto")a-=l}return{x:n,y:r,width:a,height:o,right:n+a,bottom:r+o}}function Ue(t,e){return e.scope?e.scope.getBoundingClientRect():Ve(t.ownerDocument)}function ee(t,e,s,i,n){let r=s+n,a=i-e-n,o=a>=r,l=o?r:s,c=o?a:i-e;return Math.max(l,Math.min(t,c))}function se(t,e,s){if(!s)return 50;let i=(t-e)/s*100;return Math.round(Math.min(100,Math.max(0,i))*1000)/1000}function We(t,e){for(let s=0;s<t.length;s++){let i=t[s];if(i.right>=e.x&&i.left<=e.right&&i.bottom>=e.y&&i.top<=e.bottom)return!1}return!0}function je(t,e,s,i,n){if(e==="top")return Math.max(0,t.top-s.y-i-n);if(e==="bottom")return Math.max(0,s.bottom-t.bottom-i-n);return Math.max(0,s.height-n*2)}function Ye(t){if(t.hidden)return!1;if(typeof t.checkVisibility==="function")return t.checkVisibility();return t.getClientRects().length>0}function oe(t){let{offsetWidth:e,offsetHeight:s}=t;if(e&&s)return{width:e,height:s};let i=t.getBoundingClientRect();return{width:e||i.width,height:s||i.height}}var ie=new WeakMap,ne={scroll:0,resize:1,"element-resize":2};function qe(t){let e=t.defaultView;if(!e)throw TypeError("floating must belong to a document with a browsing context");let s=new Set,i=new Map,n=e.ResizeObserver,r=!1,a=!1,o=e.visualViewport;function l(b,v){let E=i.get(b);if(E===void 0||ne[v]>ne[E])i.set(b,v)}function c(){if(r)return;r=!0,e.requestAnimationFrame(()=>{let b=[...i];i.clear(),r=!1;for(let[v,E]of b){if(!s.has(v)||!v.floating.isConnected)continue;try{v.callback({type:E})}catch(k){h(k)}}})}function h(b){if(typeof e.reportError==="function")e.reportError(b);else e.setTimeout(()=>{throw b})}function y(b){for(let v of s)l(v,b);c()}function D(b){if(!n)return null;let v=new Set,E=new n((H)=>{let I=!1;for(let W of H)if(v.has(W.target))I=!0;else v.add(W.target);if(!I)return;l(b,"element-resize"),c()}),{reference:k,floating:C}=b;if(k)E.observe(k);if(C!==k)E.observe(C);return E}let x=()=>y("scroll"),S=()=>y("resize");function T(){if(a)return;t.addEventListener("scroll",x,{passive:!0,capture:!0}),e.addEventListener("resize",S,{passive:!0}),o?.addEventListener("scroll",x,{passive:!0}),o?.addEventListener("resize",S,{passive:!0}),a=!0}function M(){if(!a)return;t.removeEventListener("scroll",x,{capture:!0}),e.removeEventListener("resize",S),o?.removeEventListener("scroll",x),o?.removeEventListener("resize",S),a=!1}return{add(b,v,E){let k={reference:b,floating:v,callback:E};s.add(k),T();let C=D(k),H=!1;return()=>{if(H)return;if(H=!0,s.delete(k),i.delete(k),C?.disconnect(),s.size===0)M()}}}}function Ke(t){let e=t.ownerDocument,s=ie.get(e);if(!s)s=qe(e),ie.set(e,s);return s}function de(t,e,s){if(!e?.ownerDocument)throw TypeError("autoUpdate() expects a floating HTMLElement");if(t&&t.ownerDocument!==e.ownerDocument)throw TypeError("reference and floating must belong to the same document");if(typeof s!=="function")throw TypeError("callback must be a function");return Ke(e).add(t,e,s)}function re(t,e,s){let i=s.placement===void 0?"bottom-start":s.placement,{side:n,align:r,crossAxis:a}=ze(i),o=s.coordinateSpace===void 0?"viewport":s.coordinateSpace;if(!Oe.has(o))throw TypeError(`Unknown coordinateSpace: ${o}`);if(!Ye(e))return null;let l=s.distance||0,c=s.flip!==!1,h=s.shift!==!1,y=s.shiftPadding??4,D=r?Be(t):!1,x=t.getClientRects();if(!x.length)return null;let S=(g)=>g==="bottom"?x[x.length-1]:x[0],T=Ue(t,s);if(!T||We(x,T))return null;let M=oe(e),b={x:{size:M.width,start:T.x,end:T.right},y:{size:M.height,start:T.y,end:T.bottom}},v=(g,u)=>Pe(S(g),M,g,u,D,l),E=(g,u)=>{let{size:f,start:w,end:m}=b[u];return He(g,f,w+y,m-y)},k=(g,u)=>{let{size:f,start:w,end:m}=b[u];return E(h?ee(g,f,w,m,y):g,u)},C=v(n,r),H=(g,u)=>{let f=Dt(g),w=f==="x"?"y":"x",m=E(u[w],w);return{main:m,total:m+k(u[f],f)}};if(c){let g=H(n,C),u=(f)=>{let w=v(f,r),m=H(f,w);if(m.total<g.total)n=f,C=w,g=m};if(g.main>0)u(ae[n]);if(a==="y"&&g.main>0)u("top"),u("bottom");a=Dt(n)}if(a==="x"&&h&&r){let g=E(C.x,"x");if(g>0){let u=r==="end"?"start":"end",f=v(n,u);if(E(f.x,"x")<g)r=u,C=f}}if(h){let{size:g,start:u,end:f}=b[a];C[a]=ee(C[a],g,u,f,y)}let I=S(n),W=se(I.x+I.width/2,C.x,M.width),X=se(I.y+I.height/2,C.y,M.height),J=`${je(I,n,T,l,y)}px`,{style:L}=e,Q=L.getPropertyValue("--available-height")!==J,j=o==="document"?t.ownerDocument.defaultView:null,xt=j?j.scrollX:0,ft=j?j.scrollY:0;L.left=`${C.x+xt}px`,L.top=`${C.y+ft}px`,L.setProperty("--arrow-x",`${W}%`),L.setProperty("--arrow-y",`${X}%`),L.setProperty("--available-height",J);let tt=r?`${n}-${r}`:n;return e.dataset.placement=tt,{width:M.width,height:M.height,roomChanged:Q,placement:tt}}function le(t,e,s={}){let i=re(t,e,s);if(!i)return!1;if(i.roomChanged){let n=oe(e);if(n.width!==i.width||n.height!==i.height)re(t,e,{...s,placement:i.placement,flip:!1})}return!0}function P(t){return!t.matches(":disabled")&&!t.readOnly}class ht{constructor(t,e={}){this.input=t,this.messages=e.messages||{},this.adapter=ct(e.locale||""),this.hidden=null,this.canonical="",this._dirty=!1,this._commitId=0,this._session=K(),this._originalName=t.getAttribute("name")||"",this._attributeObserver=null,this.onAttributesChanged=null,this.confirm=null,this._generatedDefault=null}setLocale(t){let e=this._generatedDefault,s=e?this.adapter.format(e):null;if(this.adapter=ct(t||""),e&&this.input.defaultValue===s)this.input.defaultValue=this.adapter.format(e)}adoptDefault(){let t=this.input;if(t.getAttribute("value")!=null||t.defaultValue!=="")return;t.defaultValue=t.value,this._generatedDefault=this.canonical&&t.value?this.canonical:null}setMessages(t){this.messages=t||{}}format(t){return this.adapter.format(t)}parse(t){return this.adapter.parse(t)}get placeholder(){return this.adapter.placeholder}get isDisabled(){return this.input.matches(":disabled")}get isReadOnly(){return this.input.readOnly}setupFormValue(){let t=this.input;this._originalName=t.getAttribute("name")||"",this._attributeObserver=new MutationObserver(()=>this.onAttributesChanged?.()),this._attributeObserver.observe(t,{attributes:!0,attributeFilter:["disabled","readonly","name","form"]}),this.syncInputState()}syncInputState(){let t=this.input,e=t.getAttribute("name")||"";if(e){if(!this.hidden){let s=document.createElement("input");s.type="hidden",s.value=this.canonical,t.insertAdjacentElement("afterend",s),this.hidden=s}if(this.hidden)this.hidden.name=e;t.removeAttribute("name")}if(this.hidden){if(t.hasAttribute("form"))this.hidden.setAttribute("form",t.getAttribute("form")||"");else this.hidden.removeAttribute("form");this.hidden.disabled=t.disabled}}dirty(){this._commitId++}get isDirty(){return this._dirty}handleInput(){let t=this.input,e=t.value.trim(),s=this.canonical?this.adapter.format(this.canonical):"";if(this.dirty(),e===s){if(this._dirty=!1,this.hidden)this.hidden.value=this.canonical;t.setCustomValidity("");return}if(this._dirty=!0,this.hidden)this.hidden.value="";if(!e){t.setCustomValidity("");return}t.setCustomValidity(this.messages.invalidDate)}async commit(t={}){let e=this.input,s=++this._commitId,i=this._session;if(i.signal.aborted)return{status:"stale",commitId:s};let n=e.value.trim();if(!n){if(s!==this._commitId)return{status:"stale",commitId:s};return e.setCustomValidity(""),{status:"clear",value:"",commitId:s}}let r=this.adapter.parse(n);if(!r){if(s!==this._commitId)return{status:"stale",commitId:s};if(this.hidden)this.hidden.value="";return e.setCustomValidity(this.messages.invalidDate),{status:"invalid",commitId:s}}if(this.confirm){let a=await this.confirm(r,t);if(i.signal.aborted||s!==this._commitId)return{status:"stale",commitId:s};if(!a?.ok){if(this.hidden)this.hidden.value="";return e.setCustomValidity(a?.message||this.messages.unavailableDate),{status:"invalid",commitId:s}}}return{status:"ok",value:r,commitId:s}}isCommitCurrent(t){return t===this._commitId}setCanonical(t,e={}){let s=t||"";if(s&&!d(s))throw TypeError(`Invalid date-picker value: ${s}`);if(this.dirty(),this.canonical=s,this._dirty=!1,this.hidden)this.hidden.value=s;if(e.format!==!1)this.input.value=s?this.adapter.format(s):"";this.input.setCustomValidity("")}restoreDefault(){let t=String(this.input.defaultValue??"").trim(),e=d(t)?t:this.adapter.parse(t);return e&&d(e)?e:""}teardown(){this.dirty(),this._session.abort(),this._attributeObserver?.disconnect(),this._attributeObserver=null;let t=this.hidden?.getAttribute("name")||this._originalName;if(t)this.input.setAttribute("name",t);this.hidden?.remove(),this.hidden=null}}var Ge=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/;function It(t){let e=Ge.exec(String(t||""));if(!e)return null;let s=Number(e[1]),i=Number(e[2]),n=e[3]===void 0?0:Number(e[3]),r=e[4]===void 0?0:Number(e[4].padEnd(3,"0"));if(s>23||i>59||n>59||r>999)return null;return{hour:s,minute:i,second:n,millisecond:r}}function Lt(t){return It(t)!==null}function ce(t){return((t.hour*60+t.minute)*60+t.second)*1000+t.millisecond}function ue(t,e){let s=It(t),i=It(e);if(!s||!i)throw TypeError("compareTimes() expects HH:MM values");let n=ce(s)-ce(i);return n===0?0:n<0?-1:1}var Ze=0;class Ot extends HTMLElement{static observedAttributes=["value","locale","min","max","open-on-focus","month-format"];static setDefaultControlClasses(t){gt(t)}static getDefaultControlClasses(){return at()}static setDefaultMessages(t){yt(t)}static getDefaultMessages(){return V()}constructor(){super();this._id=`date-picker-${++Ze}`,this._connected=!1,this._reflecting=!1,this._value="",this._input=null,this._field=null,this._fields=null,this._range=null,this._orderTags=new Set,this._timeFields=[null,null],this._timeOrderOwned=new Set,this._lastFocusEndpoint="",this._activationId=0,this._previewDate="",this._buttons=[],this._returnFocus=null,this._panel=null,this._calendar=null,this._originalDescribedBy="",this._rangeOriginalDescribedBy=["",""],this._formatHint=null,this._generatedPlaceholders=new WeakSet,this._session=null,this._stopTracking=null,this._open=!1,this._suppressFocusOpen=!1,this._messages=null,this._controlClasses=null,this._stopDefaultMessages=null,this._source=null,this._dateState=null,this._renderDay=null,this._isDateDisabled=null,this._coordinateSpace="viewport"}_rangeMode(){return this.hasAttribute("range")&&Boolean(this._range)}connectedCallback(){if(this._connected)return;if(this._session=K(),Z(this,["locale","min","max","monthFormat","openOnFocus","coordinateSpace","controlClasses","messages","source","dateState","renderDay","isDateDisabled"]),this._normalizeAttributes(),this.hasAttribute("range"))this._connectRange();else this._connectSingle();if(!this._connected){this._session.abort(),this._session=null;return}Z(this,["value","range"]),this._stopDefaultMessages=vt(()=>{if(this._messages===null)this._refreshMessages()}),this.validate()}_normalizeAttributes(){let t=this.getAttribute("value");if(t&&!d(t))this.removeAttribute("value");for(let e of["min","max"]){let s=this.getAttribute(e);if(s&&!d(s))this.removeAttribute(e)}}_connectSingle(){let t=this.querySelector(":scope > input:not([type=hidden]):not([type=time]):not([data-time-start]):not([data-time-end])");if(!(t instanceof HTMLInputElement)){console.warn("<date-picker> expects a direct child text input");return}this._connected=!0,this._input=t,this._discoverTimeFields(),this._field=new ht(t,{messages:this.messages,locale:this.locale}),this._field.onAttributesChanged=()=>this._syncInputState(),this._field.confirm=(i,n)=>this._confirmDate(i,n),this._setupFormValue(),this._build(),this._syncInputState(),this._bind(),this._syncCalendarOptions();let e=this._adapter(),s=this.getAttribute("value")||(d(t.value)?t.value:e.parse(t.value));if(s&&d(s))this._setValue(s,{emit:!1,format:!0});else if(!t.value)this._setValue("",{emit:!1,format:!1});else t.setCustomValidity(this.messages.invalidDate);if(this._field.hidden)this._field.hidden.defaultValue=this._value;this._field.adoptDefault()}_discoverTimeFields(){this._timeFields=[null,null];let t=["data-time-start","data-time-end"];for(let[e,s]of t.entries()){let i=this.querySelectorAll(`:scope > input[${s}]`);if(i.length>1)console.warn(`<date-picker> expects at most one direct child input[${s}]; ignoring extras`);let n=i[0];if(n==null)continue;if(!(n instanceof HTMLInputElement)||n.type!=="time"){console.warn(`<date-picker> input[${s}] must be an <input type="time">; ignoring it`);continue}this._timeFields[e]=n}if(this.querySelector(":scope > input[type=time]:not([data-time-start]):not([data-time-end])"))console.warn("<date-picker> time inputs need [data-time-start] or [data-time-end]; ignoring it")}_connectRange(){if(this.querySelector(":scope > input[data-time-start], :scope > input[data-time-end]"))console.warn("<date-picker range> time companions are not supported yet; leaving them native");let t=this.querySelector(":scope > input[data-range-start]"),e=this.querySelector(":scope > input[data-range-end]");if(!(t instanceof HTMLInputElement)||!(e instanceof HTMLInputElement)){console.warn("<date-picker range> expects direct child inputs marked [data-range-start] and [data-range-end]");return}this._connected=!0,this._input=null,this._fields=[new ht(t,{messages:this.messages,locale:this.locale}),new ht(e,{messages:this.messages,locale:this.locale})],this._range=new Mt,this._rangeOriginalDescribedBy=[t.getAttribute("aria-describedby")||"",e.getAttribute("aria-describedby")||""];for(let o of this._fields)o.onAttributesChanged=()=>this._syncRangeFields(),o.confirm=(l,c)=>this._confirmDate(l,c),o.setupFormValue();this._build(),this._setRangeAria(),this._syncRangeFields(),this._bindRange(),this._syncCalendarOptions();let s=this._adapter(),i=d(t.value)?t.value:s.parse(t.value),n=d(e.value)?e.value:s.parse(e.value),r=t.value,a=e.value;this._setRange(i||"",n||"",{emit:!1});for(let[o,l,c]of[[t,r,i],[e,a,n]]){if(!l.trim()||d(c))continue;o.value=l,o.setCustomValidity(this.messages.invalidDate)}if(this._fields[0].hidden)this._fields[0].hidden.defaultValue=this._range.start;if(this._fields[1].hidden)this._fields[1].hidden.defaultValue=this._range.end;for(let o of this._fields)o.adoptDefault()}disconnectedCallback(){if(this._stopDefaultMessages?.(),this._stopDefaultMessages=null,this._connected=!1,this._suppressFocusOpen=!1,this.hide(!1),this._session?.abort(),this._session=null,this._clearTimeOrderValidity(),this._timeFields=[null,null],this._rangeMode()){for(let t of this._fields||[])this._teardownField(t);this._fields=null,this._range=null}else this._teardownField(this._field);this._field=null;for(let{button:t}of this._buttons)t.remove();this._buttons=[],this._returnFocus=null,this._panel?.remove(),this._formatHint?.remove(),this._panel=null,this._calendar=null,this._formatHint=null}_teardownField(t){if(!t)return;let e=t.input,s=this._fields?.includes(t)?this._rangeOriginalDescribedBy[this._fields?.indexOf(t)??0]||"":this._originalDescribedBy;if(t.teardown(),s)e.setAttribute("aria-describedby",s);else e.removeAttribute("aria-describedby");e.removeAttribute("role"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-controls")}attributeChangedCallback(t,e,s){if(this._reflecting||e===s)return;if(!this._connected)return;if(t==="value"&&s&&!d(s)){this._reflectValue(this._value);return}if((t==="min"||t==="max")&&s&&!d(s)){if(this.removeAttribute(t),this._connected)this._syncCalendarOptions(),this.validate();return}if(t==="value"){if(this._rangeMode())return;if(!s||d(s))this._supersedeActivations(),this._setValue(s||"",{emit:!1,format:!0,reflect:!1});return}if(t==="locale")this._refreshLocale();if(t==="open-on-focus")return;this._syncCalendarOptions(),this.validate()}get input(){return this._rangeMode()?void 0:this._input}get calendar(){return this._calendar}get value(){return this._rangeMode()?void 0:this._value}set value(t){if(this._rangeMode())throw TypeError("value is not available in range mode; use range");if(t&&!d(t))throw TypeError(`Invalid date-picker value: ${t}`);this._supersedeActivations(),this._setValue(t||"",{emit:!1,format:!0})}get range(){return this._rangeMode()&&this._range?{...this._range.range}:void 0}set range(t){if(!this._rangeMode())throw TypeError("range is only available on <date-picker range>");let{start:e,end:s}=_t(t);this._supersedeActivations(),this._setRange(e,s)}get locale(){return z(this.getAttribute("locale")||"")}set locale(t){if(t)this.setAttribute("locale",t);else this.removeAttribute("locale")}get monthFormat(){return this.getAttribute("month-format")==="short"?"short":"long"}set monthFormat(t){if(t==="short")this.setAttribute("month-format","short");else this.removeAttribute("month-format")}get min(){let t=this.getAttribute("min")||"";return d(t)?t:""}set min(t){if(t)this.setAttribute("min",t);else this.removeAttribute("min")}get max(){let t=this.getAttribute("max")||"";return d(t)?t:""}set max(t){if(t)this.setAttribute("max",t);else this.removeAttribute("max")}get openOnFocus(){return this.getAttribute("open-on-focus")!=="false"}set openOnFocus(t){if(t===!1)this.setAttribute("open-on-focus","false");else this.removeAttribute("open-on-focus")}get open(){return this._open}get controlClasses(){return dt(this._controlClasses)}set controlClasses(t){if(this._controlClasses=ot(t),this._calendar)this._calendar.controlClasses=this._controlClasses}get messages(){return this._messages??V()}set messages(t){if(this._messages=t==null?null:{...V(),...t},this._calendar)this._calendar.messages=this._messages;this._refreshMessages()}_refreshMessages(){let t=this.messages;for(let s of this._fields||[])s.setMessages(t);this._field?.setMessages(t),this._panel?.setAttribute("aria-label",t.calendar);let e=this._field??this._fields?.[0];if(this._formatHint&&e)this._formatHint.textContent=`${t.formatHint}: ${e.placeholder}`;if(this._refreshButtonLabel(),this._connected)this.validate()}get source(){return this._source}set source(t){if(this._source=t||null,this._calendar)this._calendar.source=this._source;if(this._connected)this.validate()}get dateState(){return this._dateState}set dateState(t){if(this._dateState=typeof t==="function"?t:null,this._calendar)this._calendar.dateState=this._dateState;if(this._connected)this.validate()}get renderDay(){return this._renderDay}set renderDay(t){if(this._renderDay=typeof t==="function"?t:null,this._calendar)this._calendar.renderDay=this._renderDay}get isDateDisabled(){return this._isDateDisabled}set isDateDisabled(t){if(this._isDateDisabled=typeof t==="function"?t:null,this._calendar)this._calendar.isDateDisabled=this._isDateDisabled;if(this._connected)this.validate()}get coordinateSpace(){return this._coordinateSpace}set coordinateSpace(t){this._coordinateSpace=t==="document"?"document":"viewport"}_adapter(){return this._field?.adapter??this._fields?.[0]?.adapter??ct(this.locale)}_setupFormValue(){this._field?.setupFormValue()}_syncInputState(){let t=this._input;if(!t)return;this._field?.syncInputState();let e=this._buttons[0]?.button;if(e)e.disabled=t.disabled||t.readOnly;if(this._open&&!P(t))this.hide(!1)}_syncRangeFields(){if(!this._fields)return;for(let s of this._fields)s.syncInputState();for(let{button:s,endpoint:i}of this._buttons){let n=i==="end"?1:0,r=this._fields[n];s.disabled=Boolean(r?.input.disabled||r?.input.readOnly)}let t=this._range?.activeEndpoint==="end"?1:0,e=this._fields[t]?.input;if(this._open&&e&&!P(e))this.hide(!1)}_setRangeAria(){if(!this._fields||!this._panel||!this._formatHint)return;for(let t of this._fields){let e=t.input,s=[this._rangeOriginalDescribedBy[this._fields.indexOf(t)],this._formatHint.id].filter(Boolean).join(" ");e.setAttribute("aria-describedby",s),e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",this._panel.id)}}_createTrigger(t){let e=document.createElement("button");if(e.type="button",e.className="dp-picker-button",e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",`${this._id}-panel`),t)e.dataset.endpoint=t;return e.innerHTML='<span aria-hidden="true"><svg viewBox="0 0 16 16" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><rect x="1.75" y="3" width="12.5" height="11" rx="1.75"/><path d="M1.75 6.75h12.5"/><path d="M5.25 1.75v2.5M10.75 1.75v2.5"/></svg></span>',e}_build(){let t=this._rangeMode(),e=[];if(t)for(let[o,l]of(this._fields||[]).entries())e.push([l.input,o===1?"end":"start"]);else if(this._input)e.push([this._input,""]);if(!e.length)return;let s=`${this._id}-panel`,i=`${this._id}-format`;this._buttons=e.map(([o,l])=>{let c=this._createTrigger(l);return o.insertAdjacentElement("afterend",c),{button:c,endpoint:l}});let n=document.createElement("div");n.id=s,n.className="dp-picker-panel",n.setAttribute("popover","manual"),n.setAttribute("role","dialog"),n.setAttribute("aria-label",this.messages.calendar);let r=new ut;r.selection="none",r.fixedWeeks=!0,n.append(r);let a=document.createElement("span");if(a.id=i,a.className="dp-visually-hidden",this.append(n,a),this._panel=n,this._calendar=r,this._formatHint=a,!t&&this._input){this._originalDescribedBy=this._input.getAttribute("aria-describedby")||"";let o=[this._originalDescribedBy,i].filter(Boolean).join(" ");this._input.setAttribute("aria-describedby",o),this._input.setAttribute("role","combobox"),this._input.setAttribute("aria-haspopup","dialog"),this._input.setAttribute("aria-expanded","false"),this._input.setAttribute("aria-controls",s)}this._refreshLocale(),this._refreshButtonLabel()}_bindPopup(t,e,s){this.ownerDocument.addEventListener("pointerdown",(i)=>{if(!this._open||i.composedPath().includes(this))return;this.hide(!1)},{capture:!0,signal:t}),this.ownerDocument.addEventListener("reset",(i)=>{if(!(i.target instanceof HTMLFormElement)||!e||i.target!==e.form)return;this.hide(!1),queueMicrotask(G(t,()=>{if(!i.defaultPrevented)s()}))},{capture:!0,signal:t}),this.addEventListener("keydown",(i)=>this._onEscape(i),{signal:t})}_bind(){let t=this._input,e=this._buttons[0]?.button,s=this._calendar;if(!t||!e||!s)return;let i=this._session;if(!i)return;let{signal:n}=i;t.addEventListener("input",()=>{this._field?.handleInput()},{signal:n}),t.addEventListener("change",()=>void this._commitText(!1),{signal:n}),t.addEventListener("blur",()=>void this._commitText(!1),{signal:n}),t.addEventListener("focus",(r)=>{if(!this.openOnFocus||this._suppressFocusOpen)return;let a=r.relatedTarget;if(a instanceof Node&&this.contains(a))return;if(!this._open)this.show({moveFocus:!1})},{signal:n}),t.addEventListener("keydown",(r)=>{this._onFieldKeyDown("",r)},{signal:n});for(let[r,a]of this._timeFields.entries()){if(!a)continue;let o=r===1?"end":"start";a.addEventListener("input",()=>this._revalidateTimeOrder(o),{signal:n}),a.addEventListener("change",()=>this._revalidateTimeOrder(o),{signal:n})}e.addEventListener("click",(r)=>{if(this._open){if(r.detail===0){this._defer(()=>this._calendar?.focusGrid());return}this.hide(!1);return}this.show({returnFocus:e})},{signal:n}),e.addEventListener("keydown",(r)=>this._onTriggerKeyDown("",r),{signal:n}),s.addEventListener("click",(r)=>this._captureGridIntent(r),{capture:!0,signal:n}),s.addEventListener("keydown",(r)=>this._captureGridIntent(r),{capture:!0,signal:n}),s.addEventListener("dateactivate",(r)=>{let a=r,o=a.detail?.date;if(!d(o))return;let l=st.get(a);queueMicrotask(()=>{if(n.aborted||a.defaultPrevented)return;if(l&&l.id!==this._activationId)return;if(!this._input||!P(this._input))return;this._field?.dirty(),this._setValue(o,{emit:!0,format:!0}),this.hide(!1),this._restoreFocus()})},{signal:n}),s.addEventListener("dateloadend",()=>void this.validate(),{signal:n}),this._bindPopup(n,this._input,()=>this._restoreDefault())}_bindRange(){let t=this._calendar;if(!this._fields||!this._buttons.length||!t)return;let e=this._session;if(!e)return;let{signal:s}=e;for(let[i,n]of this._fields.entries()){let r=i===1?"end":"start";n.input.addEventListener("input",()=>{if(n.handleInput(),this._orderTags.delete(i),!n.isDirty)this._revalidateRange(r)},{signal:s}),n.input.addEventListener("change",()=>void this._commitFieldText(r),{signal:s}),n.input.addEventListener("blur",()=>void this._commitFieldText(r),{signal:s}),n.input.addEventListener("focus",(a)=>this._onFieldFocus(r,a),{signal:s}),n.input.addEventListener("keydown",(a)=>this._onFieldKeyDown(r,a),{signal:s})}for(let i of this._buttons){let n=i.endpoint;if(n==="")continue;i.button.addEventListener("click",(r)=>this._onRangeTriggerClick(n,r),{signal:s}),i.button.addEventListener("keydown",(r)=>this._onTriggerKeyDown(n,r),{signal:s})}t.addEventListener("click",(i)=>{this._captureGridIntent(i)},{capture:!0,signal:s}),t.addEventListener("keydown",(i)=>this._captureGridIntent(i),{capture:!0,signal:s}),t.addEventListener("dateactivate",(i)=>{let n=i,r=n.detail?.date;if(!d(r))return;queueMicrotask(()=>{if(s.aborted||n.defaultPrevented||!this._range)return;let a=st.get(n);if(a===void 0||a.id!==this._activationId)return;let o=(c)=>this._boundEditable(c),l=this._range.activate(r,o);if(l.status==="refused"){this._calendar?.dispatchEvent(new CustomEvent("dateinvalid",{detail:{date:r,state:this._calendar.getDateState(r)},bubbles:!0}));return}if(this._applyRangeTransition(l),l.close||l.status==="complete")this.hide(!1),this._focusField(l.endpoint)})},{signal:s}),t.addEventListener("datefocus",(i)=>this._onGridDateFocus(i),{signal:s}),t.addEventListener("pointerover",(i)=>this._onGridPointerOver(i),{signal:s}),t.addEventListener("pointerleave",()=>this._onGridPointerLeave(),{signal:s}),t.addEventListener("dateloadend",()=>void this.validate(),{signal:s}),this._bindPopup(s,this._fields?.[0]?.input,()=>this._restoreRangeDefault())}_activateRangeEndpoint(t){let e=this._calendar;if(!this._range||!e)return;this._range.focus(t),this._activationId++,this._lastFocusEndpoint=t;let s=this._boundCanonical(t)||O();e.display=p(s),e.focusedDate=s,this._clearPreview()}_onRangeTriggerClick(t,e){if(!this._open){this.show({endpoint:t});return}if(e.detail===0){this._activateRangeEndpoint(t),this._defer(()=>this._calendar?.focusGrid());return}if(t!==this._range?.activeEndpoint){this._activateRangeEndpoint(t);return}this.hide(!1)}_onTriggerKeyDown(t,e){if(e.key!=="ArrowDown")return;if(e.preventDefault(),this._open){if(this._rangeMode()&&t)this._activateRangeEndpoint(t);this._defer(()=>this._calendar?.focusGrid());return}if(this._rangeMode())this.show({endpoint:t||void 0});else this.show({returnFocus:this._buttons[0]?.button})}_onFieldKeyDown(t,e){if(e.key==="ArrowDown"){if(e.preventDefault(),this._rangeMode()&&t)this._lastFocusEndpoint=t,this._range?.focus(t);if(this._open)this._defer(()=>this._calendar?.focusGrid());else this.show()}else if(e.key==="Escape"&&this._open)e.preventDefault(),this.hide(!1)}_onFieldFocus(t,e){if(!this._rangeMode()||!t)return;let s=t!==this._range?.activeEndpoint;if(this._lastFocusEndpoint=t,this._range?.focus(t),s)this._activationId++;if(!this.openOnFocus||this._suppressFocusOpen)return;let i=e.relatedTarget;if(i instanceof Node&&this.contains(i))return;if(!this._open)this.show({moveFocus:!1})}_captureGridIntent(t){if(this._rangeMode()?!this._range:!this._field)return;if(t.type==="keydown"){let i=t.key;if(i!=="Enter"&&i!==" ")return}if(!(t.target instanceof Element))return;let s=t.target.closest(".dp-day[data-date]")?.getAttribute("data-date")||"";if(!d(s))return;this._attachIntent(s)}_attachIntent(t){if(!this._calendar)return;this._calendar._hostIntent={date:t,intent:{id:++this._activationId}}}_supersedeActivations(){this._activationId++}_boundEditable(t){let e=this._fields?.[t==="end"?1:0];return e!=null&&P(e.input)}_applyRangeTransition(t){let e=this._fields;if(!e||!this._range||t.status==="refused")return;let s=[];for(let i of t.changedEndpoints){let n=e[i==="end"?1:0],r=i==="end"?t.range.end:t.range.start;if(!n||n.canonical===r)continue;n.setCanonical(r,{format:!0}),s.push(n)}if(this._syncHighlight(),this._refreshRangeButtonLabel(),this._revalidateRange(t.endpoint),!s.length)return;this._emitRangeChange();for(let i of s)i.input.dispatchEvent(new Event("input",{bubbles:!0})),i.input.dispatchEvent(new Event("change",{bubbles:!0}))}_setPreview(t){let e=this._calendar;if(!e||!this._range||!this._open)return;let s=d(t)&&!e.getDateState(t).disabled?t:"",i=s?this._range.previewRange(s,(n)=>this._boundEditable(n)):null;if(!i){this._clearPreview();return}this._previewDate=s,e.toggleAttribute("data-range-preview",!0),e.highlightedRange=i}_clearPreview(){if(!this._previewDate)return;this._syncHighlight()}_onGridDateFocus(t){let e=t.detail?.date;if(d(e))this._setPreview(e)}_onGridPointerOver(t){let e=t;if(e.pointerType==="touch")return;this._setPreview(this._cellDate(e.target))}_onGridPointerLeave(){this._clearPreview()}_cellDate(t){let s=(t instanceof Element?t.closest(".dp-day[data-date]"):null)?.getAttribute("data-date")||"";return d(s)?s:""}_onEscape(t){if(t.key==="Escape"&&this._open)t.preventDefault(),t.stopPropagation(),this.hide(!0)}_syncCalendarOptions(){let t=this._calendar,e=this._panel;if(!t)return;if(t.locale=this.locale,t.min=this.min,t.max=this.max,t.monthFormat=this.monthFormat,t.controlClasses=this._controlClasses,t.messages=this._messages,t.source=this._source,t.dateState=this._dateState,t.renderDay=this._renderDay,t.isDateDisabled=this._isDateDisabled,!this._rangeMode()&&this._value)t.value=this._value;if(e)e.setAttribute("aria-label",this.messages.calendar)}_refreshLocale(){let t=this._formatHint;if(!t)return;if(this._rangeMode()&&this._fields){this._fields[0].setLocale(this.locale),this._fields[1].setLocale(this.locale),t.textContent=`${this.messages.formatHint}: ${this._fields[0].placeholder}`;for(let[s,i]of this._fields.entries()){if(!i.input.hasAttribute("placeholder")||this._generatedPlaceholders.has(i.input))i.input.placeholder=i.placeholder,this._generatedPlaceholders.add(i.input);let n=s===1?this._range?.end||"":this._range?.start||"";if(n)i.input.value=i.format(n)}this._refreshButtonLabel();return}let e=this._field;if(!e)return;if(e.setLocale(this.locale),t.textContent=`${this.messages.formatHint}: ${e.placeholder}`,!e.input.hasAttribute("placeholder")||this._generatedPlaceholders.has(e.input))e.input.placeholder=e.placeholder,this._generatedPlaceholders.add(e.input);if(this._value)e.input.value=e.format(this._value);this._refreshButtonLabel()}_refreshButtonLabel(){let t=this._buttons[0]?.button;if(!t)return;if(this._rangeMode()){this._refreshRangeButtonLabel();return}let e=this._value?this.messages.changeDate:this.messages.chooseDate,s=this._value?`, ${lt(this._value,this.locale)}`:"";t.setAttribute("aria-label",`${e}${s}`)}_refreshRangeButtonLabel(){if(!this._range)return;let{start:t,end:e}=this._range;for(let{button:s,endpoint:i}of this._buttons){let n=i==="end"?e:t,r=n?this.messages.changeDate:this.messages.chooseDate,a=n?`, ${lt(n,this.locale)}`:"",o=i==="end"?this.messages.rangeEnd:this.messages.rangeStart;s.setAttribute("aria-label",`${r}${a}, ${o}`)}}_reflectValue(t){if(this._reflecting=!0,t)this.setAttribute("value",t);else this.removeAttribute("value");this._reflecting=!1}_setValue(t,e={}){if(t&&!d(t))throw TypeError(`Invalid date-picker value: ${t}`);let s=this._value;if(this._value=t||"",e.reflect!==!1)this._reflectValue(this._value);if(this._field?.setCanonical(this._value,{format:e.format!==!1}),this._calendar){if(this._calendar.value=this._value,this._value&&e.moveDisplay!==!1)this._calendar.focusedDate=this._value}if(this._refreshButtonLabel(),s!==this._value){if(this.dispatchEvent(new CustomEvent("valuechange",{detail:{value:this._value},bubbles:!0})),e.emit&&this._field){let i=this._field.input;i.dispatchEvent(new Event("input",{bubbles:!0})),i.dispatchEvent(new Event("change",{bubbles:!0}))}}}async _confirmDate(t,e={}){let s=this._calendar;if(!s)return{ok:!0};if(e.moveDisplay!==!1){let r=p(t);if(s.display!==r)s.display=r}let i=await s.ensureDate(t),n=s.getDateState(t);if(!i||n.disabled)return{ok:!1,message:this.messages.unavailableDate};return{ok:!0}}async _commitText(t,e={}){let s=this._field,i=this._session;if(!s||!i)return!1;if(!e.force&&!s.isDirty)return!1;let n=await s.commit(e);if(i.signal.aborted||!s.isCommitCurrent(n.commitId))return!1;if(n.status==="stale"||n.status==="invalid")return!1;return this._setValue(n.value||"",{emit:t,format:n.status==="ok",moveDisplay:e.moveDisplay}),!0}async _commitFieldText(t){let e=this._fields,s=this._session;if(!e||!s)return!1;let i=t==="end"?1:0,n=e[i];if(!n?.isDirty)return!1;let r=await n.commit();if(s.signal.aborted||!n.isCommitCurrent(r.commitId))return!1;if(r.status==="stale")return!1;if(r.status==="invalid")return this._orderTags.delete(i),!1;return this._setBound(t,r.value||"",{emit:!1,user:!0,format:r.status==="ok"}),!0}_setBound(t,e,s={}){if(!this._range)return!1;let i=this._fields;if(!i)return!1;let r=i[t==="end"?1:0];if(!r)return!1;if(s.user===!0&&!P(r.input))return!1;let a=e||"",o=r.canonical;if(r.setCanonical(a,{format:s.format!==!1}),t==="end")this._range.end=a;else this._range.start=a;let l=o!==a;if(l){if(this._syncHighlight(),this._refreshRangeButtonLabel(),this._emitRangeChange(),s.emit)r.input.dispatchEvent(new Event("input",{bubbles:!0})),r.input.dispatchEvent(new Event("change",{bubbles:!0}))}return this._revalidateRange(t),l}_setRange(t,e,s={}){if(!this._range||!this._fields)return;if(this._range.start=t||"",this._range.end=e||"",this._fields[0].setCanonical(t||"",{format:s.format!==!1}),this._fields[1].setCanonical(e||"",{format:s.format!==!1}),this._syncHighlight(),this._refreshRangeButtonLabel(),this._revalidateRange("start"),this._revalidateRange("end"),s.emit!==!1)this._emitRangeChange()}_boundCanonical(t){return this._range?t==="end"?this._range.end:this._range.start:""}_emitRangeChange(){if(!this._range)return;this.dispatchEvent(new CustomEvent("rangechange",{detail:{...this._range.range},bubbles:!0}))}_displayRange(){let{start:t,end:e}=this._range?.range??{start:"",end:""};if(!t)return{start:"",end:""};if(e&&_(e,t)<0)return{start:t,end:""};return{start:t,end:e}}_syncHighlight(){if(!this._calendar||!this._range)return;this._previewDate="",this._calendar.removeAttribute("data-range-preview"),this._calendar.highlightedRange=this._displayRange()}_revalidateRange(t){if(!this._fields||!this._range)return;let{start:e,end:s}=this._range,i=Boolean(e&&s&&_(s,e)<0),n=["start","end"];for(let r of n){let a=r==="end"?1:0,o=this._fields[a].input,l=r==="end"?this.messages.rangeOrderEnd:this.messages.rangeOrderStart;if(i&&r===t)o.setCustomValidity(l),this._orderTags.add(a);else if(this._orderTags.has(a))o.setCustomValidity(""),this._orderTags.delete(a)}}_revalidateTimeOrder(t){let[e,s]=this._timeFields,i=["start","end"],n=[e,s],r=e&&!e.matches(":disabled")?e.value.trim():"",a=s&&!s.matches(":disabled")?s.value.trim():"",o=Boolean(e&&s&&r&&a)&&Lt(r)&&Lt(a)&&ue(a,r)<0;for(let[l,c]of i.entries()){let h=n[l];if(!h)continue;let y=c==="end"?this.messages.rangeOrderEnd:this.messages.rangeOrderStart;if(o&&c===t)h.setCustomValidity(y),this._timeOrderOwned.add(h);else if(this._timeOrderOwned.has(h))h.setCustomValidity(""),this._timeOrderOwned.delete(h)}}_clearTimeOrderValidity(){for(let t of this._timeOrderOwned)t.setCustomValidity("");this._timeOrderOwned.clear()}_defer(t){let e=this._session;if(!e)return;setTimeout(G(e.signal,t),0)}_restoreDefault(){let t=this._field;if(!t)return;let e=t.restoreDefault();if(this._setValue(e,{emit:!1,format:!0}),this._calendar)if(this._value)this._calendar.display=p(this._value),this._calendar.focusedDate=this._value;else this._calendar.display=p(O()),this._calendar.focusedDate=O();this.validate()}_restoreRangeDefault(){if(!this._fields)return;let t=this._fields[0].restoreDefault(),e=this._fields[1].restoreDefault();if(this._setRange(t,e),this._calendar){let s=this._range?.start||O();this._calendar.display=p(s),this._calendar.focusedDate=s}this.validate()}_focusField(t){let e=t==="end"?1:0,s=this._fields?.[e]?.input;if(!s)return;this._suppressFocusOpen=!0,this._defer(()=>{s.focus(),this._suppressFocusOpen=!1})}_restoreFocus(){let t=this._returnFocus;if(this._returnFocus=null,!(t instanceof HTMLElement)||!t.isConnected||t.matches(":disabled"))return;this._suppressFocusOpen=!0,this._defer(()=>{t.focus(),this._suppressFocusOpen=!1})}_resolveRangeEndpoint(){if(!this._fields)return"";let t=this._lastFocusEndpoint||"start",e=t==="end"?1:0;if(P(this._fields[e].input))return t;let s=t==="end"?"start":"end",i=s==="end"?1:0;if(P(this._fields[i].input))return s;return""}async validate(){let t=this._session;if(this._rangeMode()){let i=this._fields;if(!i)return!0;for(let[n,r]of i.entries()){let a=await r.commit({moveDisplay:!1});if(!t||t.signal.aborted)return i.every((o)=>o.input.checkValidity());if(!r.isCommitCurrent(a.commitId))continue;if(a.status==="invalid")this._orderTags.delete(n);if(a.status==="ok"||a.status==="clear"){let o=n===1?"end":"start";this._setBound(o,a.value||"",{format:a.status==="ok"})}}return this._revalidateRange("start"),this._revalidateRange("end"),i.every((n)=>n.input.checkValidity())}let e=this._field?.input;if(!e){let i=this.hasAttribute("range")?this.querySelectorAll(":scope > input[data-range-start], :scope > input[data-range-end]"):this._input?[this._input]:[],n=this.querySelectorAll(":scope > input[type=time][data-time-start], :scope > input[type=time][data-time-end]");return[...i,...n].every((r)=>r instanceof HTMLInputElement&&r.checkValidity())}if(await this._commitText(!1,{force:!0,moveDisplay:!1}),!t||t.signal.aborted)return e.checkValidity()&&this._timeFields.every((i)=>i?.checkValidity()??!0);this._revalidateTimeOrder("start"),this._revalidateTimeOrder("end");let s=this._timeFields.every((i)=>i?.checkValidity()??!0);return e.checkValidity()&&s}show(t={}){let e=this._panel,s=this._calendar;if(!e||!s||!this._buttons.length||this._open)return;if(this._rangeMode()){let r=t.endpoint||this._resolveRangeEndpoint();if(!r)return;this._activateRangeEndpoint(r)}else{let r=this._input;if(!r||!P(r))return;let a=this._value||this._adapter().parse(r.value)||O();s.display=p(a),s.focusedDate=a,this._returnFocus=t.returnFocus instanceof HTMLElement?t.returnFocus:r}e.showPopover(),this._open=!0,this._setExpanded(!0);let i=this.coordinateSpace;e.style.position=i==="document"?"absolute":"fixed";let n=()=>le(this,e,{placement:"bottom-start",distance:4,shiftPadding:8,coordinateSpace:i});if(n(),this._stopTracking=de(this,e,n),t.moveFocus!==!1){let r=this._session;if(r)queueMicrotask(G(r.signal,()=>s.focusGrid()))}this.dispatchEvent(new Event("open",{bubbles:!0}))}_setExpanded(t){let e=t?"true":"false";this._input?.setAttribute("aria-expanded",e);for(let{button:s}of this._buttons)s.setAttribute("aria-expanded",e);for(let s of this._fields||[])s.input.setAttribute("aria-expanded",e)}hide(t=!1){if(!this._panel||!this._open)return;this._stopTracking?.(),this._stopTracking=null;try{this._panel.hidePopover()}catch{}if(this._open=!1,this._setExpanded(!1),this._supersedeActivations(),this._syncHighlight(),t)if(this._rangeMode()){let e=this._restoreFocusEndpoint();if(e)this._focusField(e)}else this._restoreFocus();this.dispatchEvent(new Event("close",{bubbles:!0}))}_restoreFocusEndpoint(){let t=this._range?.activeEndpoint||"";if(t){let e=t==="end"?1:0,s=this._fields?.[e];if(s&&P(s.input))return t}return this._resolveRangeEndpoint()}}function zt(){if(!customElements.get("date-calendar"))customElements.define("date-calendar",ut);if(!customElements.get("date-picker"))customElements.define("date-picker",Ot)}zt();var he="lekoala-date-picker-styles";if(!document.getElementById(he)){let t=document.createElement("style");t.id=he,t.textContent=Ht;let e=document.currentScript?.nonce;if(e)t.nonce=e;document.head.append(t)}zt();})();
@@ -78,10 +78,9 @@ export type RangeTransition = {
78
78
  * - activating through `start` commits `start`, moves the active endpoint to
79
79
  * `end` and leaves the popup open for the second selection.
80
80
  *
81
- * Each rule exists once, as a `project*()` projection; `activate()` and
82
- * `moveEndpoint()` only apply one. Hover, keyboard and drag previews read the
83
- * same projections, so a second copy of the interaction rules cannot drift
84
- * into the DOM layer.
81
+ * Each rule exists once, as a `project()` projection; `activate()` only
82
+ * applies one. Keyboard and pointer previews read the same projection, so a
83
+ * second copy of the interaction rules cannot drift into the DOM layer.
85
84
  *
86
85
  * Text entry is deliberately outside this machine: a typed pair may be
87
86
  * temporarily inverted and report a validation error. It is the coordinator's
@@ -114,34 +113,20 @@ export declare class DateRangeController {
114
113
  * @returns {RangeTransition}
115
114
  */
116
115
  project(date: string, editable?: (bound: "start" | "end") => boolean): RangeTransition;
117
- /**
118
- * Project a direct move of one bound (endpoint drag), without mutating.
119
- *
120
- * Only a complete, ordered pair offers two handles to grab, and a handle
121
- * never crosses the other one: the candidate is clamped to the opposite
122
- * bound, so the previewed band is exactly what a drop commits. Equality is
123
- * allowed (a one-day range).
124
- * @param {string} date
125
- * @param {"start" | "end"} endpoint
126
- * @param {(bound: "start" | "end") => boolean} [editable]
127
- * @returns {RangeTransition}
128
- */
129
- projectEndpoint(date: string, endpoint: "start" | "end", editable?: (bound: "start" | "end") => boolean): RangeTransition;
130
116
  /**
131
117
  * Displayable band a candidate date would produce, or `null` when there is
132
- * nothing to promise. Single source of truth for hover, keyboard and drag
133
- * previews: the projection rules with no mutation and no event.
118
+ * nothing to promise. Single source of truth for hover and keyboard previews:
119
+ * the projection rules with no mutation and no event.
134
120
  *
135
- * Without a drag handle a preview only speaks during range creation, when
136
- * exactly one bound is anchored and the other is still open. An empty range
137
- * has no anchor to project from, and a complete pair is not a promise in
138
- * progress — previewing it would repaint the committed band on every hover.
121
+ * A preview only speaks during range creation, when exactly one bound is
122
+ * anchored and the other is still open. An empty range has no anchor to
123
+ * project from, and a complete pair is not a promise in progress —
124
+ * previewing it would repaint the committed band on every hover.
139
125
  * @param {string} date
140
- * @param {"" | "start" | "end"} [endpoint] drag handle, empty for a normal pick
141
126
  * @param {(bound: "start" | "end") => boolean} [editable]
142
127
  * @returns {DateRange | null}
143
128
  */
144
- previewRange(date: string, endpoint?: "" | "start" | "end", editable?: (bound: "start" | "end") => boolean): DateRange | null;
129
+ previewRange(date: string, editable?: (bound: "start" | "end") => boolean): DateRange | null;
145
130
  /** @param {RangeTransition} transition @returns {RangeTransition} */
146
131
  _apply(transition: RangeTransition): RangeTransition;
147
132
  /**
@@ -151,14 +136,6 @@ export declare class DateRangeController {
151
136
  * @returns {RangeTransition}
152
137
  */
153
138
  activate(date: string, editable?: (bound: "start" | "end") => boolean): RangeTransition;
154
- /**
155
- * Apply a direct move of one bound (endpoint drag).
156
- * @param {string} date
157
- * @param {"start" | "end"} endpoint
158
- * @param {(bound: "start" | "end") => boolean} [editable]
159
- * @returns {RangeTransition}
160
- */
161
- moveEndpoint(date: string, endpoint: "start" | "end", editable?: (bound: "start" | "end") => boolean): RangeTransition;
162
139
  }
163
140
  /**
164
141
  * Link two date pickers without teaching either picker about its sibling.
@@ -1 +1 @@
1
- {"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/date-range.js"],"names":[],"mappings":"AAEI,YAAsC,SAAS,GAArC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,GAAG,EAAC,MAAM,CAAA;CAAC,CAAW;AAAnD,sDAAsD;AAEtD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAHzB;IAAC,KAAK,CAAC,EAAC,MAAM,CAAC;IAAC,GAAG,CAAC,EAAC,MAAM,CAAA;CAAC,GAAC,IAAI,GAAC,SAGT,GAFvB,SAAS,CAYrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAJvB,MAIuB,EAAE,KAAK,EAH9B,SAAS,GAAC,IAAI,GAAC,SAGe,GAF5B,EAAE,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,QAAQ,CAUlD;AAGE,YAAkB,eAAe,GACjC;IAA+C,MAAM,EAA1C,SAAS,GAAG,UAAU,GAAG,SAAS,CAC7C;;;;IAA4B,QAAQ,EAAzB,OAAO,GAAG,KAAK,CAC1B;;;;IAAgC,gBAAgB,EAArC,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAC9B;;;;IAAsB,KAAK,EAAhB,SAAS,CACpB;;;;IAAiC,cAAc,EAApC,EAAE,GAAG,OAAO,GAAG,KAAK,CAC/B;;;;IAAqB,KAAK,AAA1B,CACF,EADa,OAAO,CACpB;CAAA,CAAA;AARD;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,mBAAmB;IAE5B,mCAAmC;IAC9B,cAAc,EADR,EAAE,GAAG,OAAO,GAAG,KAAK;IAE1B,KAAK;IACL,GAAG;IAJV,cAKC;IAED,2BAA2B;IAC3B,IAAI,KAAK,IADK,SAAS,CAGtB;IAED,gEAAgE;IAChE,IAAI,QAAQ,YAEX;IAED,6CAA6C;IAC7C,KAAK,CAAC,QAAQ,EADF,EAAE,GAAG,OAAO,GAAG,KACb,QAEb;IAED,mEAAmE;IACnE,OAAO,CAAC,QAAQ,EADJ,OAAO,GAAG,KACN,GADgC,eAAe,CAS9D;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,EAJD,MAIC,EAAE,QAAQ,AAHnB,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGJ,GAFtB,eAAe,CAoE3B;IAED;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,IAAI,EALT,MAKS,EAAE,QAAQ,EAJnB,OAAO,GAAG,KAIS,EAAE,QAAQ,AAHrC,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGc,GAFxC,eAAe,CAe3B;IAED;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,IAAI,EALN,MAKM,EAAE,QAAQ,AAJxB,CACA,EADQ,EAAE,GAAG,OAAO,GAAG,KAIM,EAAE,QAAQ,AAHvC,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGgB,GAF1C,SAAS,GAAG,IAAI,CAY5B;IAED,qEAAqE;IACrE,MAAM,CAAC,UAAU,EADL,eACK,GADiC,eAAe,CAOhE;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAJF,MAIE,EAAE,QAAQ,AAHpB,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGH,GAFvB,eAAe,CAI3B;IAED;;;;;;OAMG;IACH,YAAY,CAAC,IAAI,EALN,MAKM,EAAE,QAAQ,EAJhB,OAAO,GAAG,KAIM,EAAE,QAAQ,AAHlC,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGW,GAFrC,eAAe,CAI3B;CACF;AAgBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAJxB,OAAO,kBAAkB,EAAE,iBAIH,EAAE,GAAG,EAH7B,OAAO,kBAAkB,EAAE,iBAGE,GAF3B,MAAM,IAAI,CAyBtB"}
1
+ {"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/date-range.js"],"names":[],"mappings":"AAEI,YAAsC,SAAS,GAArC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,GAAG,EAAC,MAAM,CAAA;CAAC,CAAW;AAAnD,sDAAsD;AAEtD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAHzB;IAAC,KAAK,CAAC,EAAC,MAAM,CAAC;IAAC,GAAG,CAAC,EAAC,MAAM,CAAA;CAAC,GAAC,IAAI,GAAC,SAGT,GAFvB,SAAS,CAYrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAJvB,MAIuB,EAAE,KAAK,EAH9B,SAAS,GAAC,IAAI,GAAC,SAGe,GAF5B,EAAE,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,QAAQ,CAUlD;AAGE,YAAkB,eAAe,GACjC;IAA+C,MAAM,EAA1C,SAAS,GAAG,UAAU,GAAG,SAAS,CAC7C;;;;IAA4B,QAAQ,EAAzB,OAAO,GAAG,KAAK,CAC1B;;;;IAAgC,gBAAgB,EAArC,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAC9B;;;;IAAsB,KAAK,EAAhB,SAAS,CACpB;;;;IAAiC,cAAc,EAApC,EAAE,GAAG,OAAO,GAAG,KAAK,CAC/B;;;;IAAqB,KAAK,AAA1B,CACF,EADa,OAAO,CACpB;CAAA,CAAA;AARD;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,mBAAmB;IAE5B,mCAAmC;IAC9B,cAAc,EADR,EAAE,GAAG,OAAO,GAAG,KAAK;IAE1B,KAAK;IACL,GAAG;IAJV,cAKC;IAED,2BAA2B;IAC3B,IAAI,KAAK,IADK,SAAS,CAGtB;IAED,gEAAgE;IAChE,IAAI,QAAQ,YAEX;IAED,6CAA6C;IAC7C,KAAK,CAAC,QAAQ,EADF,EAAE,GAAG,OAAO,GAAG,KACb,QAEb;IAED,mEAAmE;IACnE,OAAO,CAAC,QAAQ,EADJ,OAAO,GAAG,KACN,GADgC,eAAe,CAS9D;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,EAJD,MAIC,EAAE,QAAQ,AAHnB,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGJ,GAFtB,eAAe,CAoE3B;IAED;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,IAAI,EAJN,MAIM,EAAE,QAAQ,AAHxB,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGC,GAF3B,SAAS,GAAG,IAAI,CAU5B;IAED,qEAAqE;IACrE,MAAM,CAAC,UAAU,EADL,eACK,GADiC,eAAe,CAOhE;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAJF,MAIE,EAAE,QAAQ,AAHpB,CACA,EADQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,KAAK,OAGH,GAFvB,eAAe,CAI3B;CACF;AAgBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAJxB,OAAO,kBAAkB,EAAE,iBAIH,EAAE,GAAG,EAH7B,OAAO,kBAAkB,EAAE,iBAGE,GAF3B,MAAM,IAAI,CAyBtB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * One lifetime: a picker connection, a calendar connection or a field
3
+ * controller. The returned controller is the token an operation captures
4
+ * before it suspends.
5
+ * @returns {AbortController}
6
+ */
7
+ export declare function createSession(): AbortController;
8
+ /**
9
+ * Protect a callback with the signal captured now. The caller keeps the
10
+ * scheduling choice (`queueMicrotask` vs `setTimeout`), because focus behavior
11
+ * in Chromium depends on it.
12
+ * @param {AbortSignal} signal
13
+ * @param {() => void} callback
14
+ * @returns {() => void}
15
+ */
16
+ export declare function guard(signal: AbortSignal, callback: () => void): () => void;
17
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/session.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,aAAa,IAFhB,eAAe,CAI3B;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAJjB,WAIiB,EAAE,QAAQ,EAH3B,MAAM,IAGqB,GAFzB,MAAM,IAAI,CAMtB"}
@@ -42,7 +42,7 @@ Moving focus never changes selection. Each cell that actually receives focus dis
42
42
 
43
43
  A range preview projected onto the band is visual only: it never contributes a range start/end to a day's accessible name, so a proposal is never announced as a committed selection.
44
44
 
45
- Endpoint dragging is a pointer enhancement. Every adjustment it offers is also reachable from the keyboard: activating before or after a complete range moves the corresponding bound.
45
+ An application-owned pointer gesture that moves a range bound must end in the same `activateDate()` + `dateactivate` path as the keyboard: availability is checked and the activation is cancellable, so a pointer gesture cannot bypass the keyboard contract.
46
46
 
47
47
  ## Month/year controls
48
48