@lekoala/date-picker 0.1.1 → 0.3.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 +1 @@
1
- :where(date-calendar,date-picker){--dp-bg:Canvas;--dp-fg:CanvasText;--dp-muted:color-mix(in srgb,CanvasText 58%,Canvas);--dp-border:color-mix(in srgb,CanvasText 22%,Canvas);--dp-hover:color-mix(in srgb,CanvasText 7%,Canvas);--dp-accent:Highlight;--dp-accent-fg:HighlightText;--dp-radius:.5rem;--dp-day-size:2.75rem;--dp-gap:.25rem;color:var(--dp-fg);font:inherit}.dp-visually-hidden{position:absolute!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important;border:0!important;block-size:1px!important;inline-size:1px!important;margin:-1px!important;padding: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)auto auto auto;align-items: center;gap:var(--dp-gap);margin-block-end:.4rem}.dp-calendar-header .dp-prev{margin-inline-start:calc(var(--dp-gap)*2.5)}.dp-calendar-header :where(button,select,input){border:1px solid var(--dp-border);border-radius:calc(var(--dp-radius)*.75);background:var(--dp-bg);color:var(--dp-fg);font:inherit;min-block-size:2.25rem}.dp-calendar-header select,.dp-calendar-header input{min-inline-size:0;padding-inline-start:.45rem;padding-inline-end:.45rem}.dp-month-select{inline-size:100%}.dp-year-input{inline-size:5.5rem}.dp-nav{display:grid;cursor:pointer;place-items: center;inline-size:2.25rem;padding:0;font-size:1.35rem;line-height:1}.dp-nav svg{display:block;pointer-events:none;block-size:1rem;inline-size:1rem}.dp-picker-button:disabled{cursor:not-allowed;opacity:.45}.dp-calendar-header :where(button,select,input):disabled{cursor:not-allowed;opacity:.45}.dp-nav:hover:not(:disabled),.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 .25rem;table-layout:fixed}.dp-grid :where(th,td){box-sizing:border-box;inline-size:var(--dp-day-size);block-size:var(--dp-day-size);text-align:center;padding:0}.dp-grid thead th{color:var(--dp-muted);block-size:1.6rem;font-size:.72rem;font-weight:600}.dp-day{position:relative;border-radius:calc(var(--dp-radius)*.75);cursor:pointer;outline:none;vertical-align:middle;border:1px solid #0000;font-size:.875rem}.dp-day:focus-visible{outline:2px solid var(--dp-accent);outline-offset:1px;z-index:1}.dp-day[data-selected=true]{background:var(--dp-accent);color:var(--dp-accent-fg)}.dp-day[data-today=true]:not([data-selected=true]){border-color:var(--dp-accent)}.dp-day[data-outside-month=true]{color:var(--dp-muted)}.dp-day[data-disabled=true]{cursor:not-allowed;opacity:.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]{background:color-mix(in srgb,var(--dp-accent)18%,var(--dp-bg));border-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:-webkit-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:-moz-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:is([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:-webkit-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day:-moz-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day:is([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-in-range=true]:first-of-type:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius)}.dp-day[data-in-range=true]:first-of-type:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius)}.dp-day[data-in-range=true]:first-of-type:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius)}.dp-day[data-in-range=true]:first-of-type:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius)}.dp-day[data-in-range=true]:first-of-type:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius)}.dp-day[data-in-range=true]:first-of-type:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius)}.dp-day[data-in-range=true]:last-of-type:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius)}.dp-day[data-in-range=true]:last-of-type:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius)}.dp-day[data-in-range=true]:last-of-type:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius)}.dp-day[data-in-range=true]:last-of-type:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius)}.dp-day[data-in-range=true]:last-of-type:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius)}.dp-day[data-in-range=true]:last-of-type:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius)}.dp-day-number{display:block;font-variant-numeric:tabular-nums}.dp-day-extra{position:absolute;display:flex;pointer-events:none;justify-content:center;gap:2px;min-block-size:.35rem;font-size:.55rem;line-height:1;bottom:1px;left:2px;right:2px}.dp-week-number,.dp-week-heading{color:var(--dp-muted);font-size:.65rem;font-weight:500;inline-size:1.6rem!important}date-picker{position:relative;display:inline-grid;grid-template-columns:minmax(0,1fr)auto;align-items:stretch;max-inline-size:100%}date-picker>input:not([type=hidden]){grid-column:1;min-inline-size:0}date-picker[range]>input:not([type=hidden]){grid-column:1}date-picker[range]>input[data-range-start]{grid-row:1}date-picker[range]>input[data-range-end]{grid-row:2}.dp-picker-button{grid-column:2;border:1px solid var(--dp-border);background:var(--dp-bg);color:var(--dp-fg);font:inherit;cursor:pointer;border-inline-start:0;min-inline-size:2.5rem}.dp-picker-button:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius);border-bottom-left-radius:0}.dp-picker-button:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius);border-bottom-left-radius:0}.dp-picker-button:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-top-right-radius:var(--dp-radius);border-bottom-right-radius:var(--dp-radius);border-bottom-left-radius:0}.dp-picker-button:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius);border-bottom-right-radius:0}.dp-picker-button:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius);border-bottom-right-radius:0}.dp-picker-button:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-top-left-radius:var(--dp-radius);border-bottom-left-radius:var(--dp-radius);border-bottom-right-radius:0}date-picker[range]>.dp-picker-button{grid-row:1/span 2}.dp-picker-panel[popover]{position:fixed;border:1px solid var(--dp-border);border-radius:var(--dp-radius);background:var(--dp-bg);color:var(--dp-fg);max-block-size:var(--available-height,90svh);overflow:auto;max-inline-size:calc(100vi - 1rem);margin:0;padding:.65rem;inset:auto;box-shadow:0 .5rem 1.5rem #00000029}.dp-picker-panel:not(:popover-open){display:none}@media (forced-colors:active){.dp-day[data-selected=true],.dp-day[data-range-start=true],.dp-day[data-range-end=true]{color:canvastext;background-color:canvas;border:2px solid highlight;font-weight:700}.dp-day[data-in-range=true]{color:canvastext}.dp-day[data-in-range=true]:after{content:"";position:absolute;background-color:highlight;block-size:1px;bottom:4px;left:3px;right:3px}.dp-day[data-selected=true]:before{content:"";position:absolute;border-radius:calc(var(--dp-radius)*.5);pointer-events:none;border:1px solid canvastext;inset:3px}.dp-day[data-today=true]{border-color:highlight}.dp-day-extra{color:canvastext;forced-color-adjust:none}.dp-day[data-disabled=true],.dp-picker-button:disabled{opacity:1;color:graytext}.dp-calendar-header :where(button,select,input):disabled{opacity:1;color:graytext}}
1
+ :where(date-calendar,date-picker){--dp-bg:#fff;--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-radius:.5rem;--dp-day-size:2.75rem;--dp-gap:.375rem;--dp-header-control-size:2.25rem;--dp-header-block-gap:.75rem;--dp-row-gap:.375rem;--dp-picker-button-size:2.5rem;--dp-year-inline-size:5.5rem;--dp-day-radius:calc(var(--dp-radius)*.75);color:var(--dp-fg);font:inherit}.dp-visually-hidden{position:absolute!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important;border:0!important;block-size:1px!important;inline-size:1px!important;margin:-1px!important;padding: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)auto 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:auto minmax(0,1fr)auto auto}.dp-calendar-header :where(button,select,input){min-block-size:var(--dp-header-control-size);box-sizing:border-box;border:1px solid var(--dp-border);border-radius:calc(var(--dp-radius)*.75);background:var(--dp-bg);color:var(--dp-fg);font:inherit;padding-block-start:.15rem;padding-block-end:.15rem;line-height:1.2}.dp-calendar-header input{min-inline-size:0;padding-inline-start:.45rem;padding-inline-end:.45rem}.dp-month-select{overflow:hidden;text-overflow:ellipsis;appearance:none;background-image:linear-gradient(45deg,#0000 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,#0000 50%);background-position:calc(100% - .9rem),calc(100% - .65rem);background-repeat:no-repeat;background-size:.3rem .3rem;inline-size:100%;min-inline-size:0;padding-inline-start:.45rem;padding-inline-end:2rem}[dir=rtl] .dp-month-select,html[dir=rtl] .dp-month-select{background-position:.9rem,.65rem}.dp-year-input{inline-size:var(--dp-year-inline-size)}.dp-nav{display:grid;inline-size:var(--dp-header-control-size);cursor:pointer;place-items: center;padding:0;font-size:1.35rem;line-height:1}.dp-nav svg{display:block;pointer-events:none;block-size:1rem;inline-size:1rem}[dir=rtl] .dp-nav svg,html[dir=rtl] .dp-nav svg{transform:scaleX(-1)}.dp-picker-button:disabled{cursor:not-allowed;opacity:.45}.dp-calendar-header :where(button,select,input):disabled{cursor:not-allowed;opacity:.45}.dp-nav:hover:not(:disabled){background:var(--dp-hover)}.dp-calendar-header :where(button,select,input):focus-visible{outline:none;border-color:var(--dp-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--dp-accent)22%,transparent)}.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);text-align:center;padding:0}.dp-grid thead th{color:var(--dp-muted);block-size:1.5rem;font-size:.72rem;font-weight:500}.dp-day{position:relative;border-radius:var(--dp-day-radius);cursor:pointer;outline:none;vertical-align:middle;border:1px solid #0000;font-size:.875rem}.dp-day:focus-visible{outline:2px solid var(--dp-accent);outline-offset:-2px}.dp-day:-webkit-any([data-selected=true],[data-range-start=true],[data-range-end=true]):focus-visible{outline-color:var(--dp-accent-fg)}.dp-day:-moz-any([data-selected=true],[data-range-start=true],[data-range-end=true]):focus-visible{outline-color:var(--dp-accent-fg)}.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(:-webkit-any([data-selected=true],[data-range-start=true],[data-range-end=true])){border-color:var(--dp-accent)}.dp-day[data-today=true]:not(:-moz-any([data-selected=true],[data-range-start=true],[data-range-end=true])){border-color:var(--dp-accent)}.dp-day[data-today=true]:not(:is([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:.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]{background:color-mix(in srgb,var(--dp-accent)18%,var(--dp-bg));border-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day[data-range-start=true]:has(+[data-in-range=true],+[data-range-end=true]):is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:-webkit-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:-moz-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:is([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:0;border-bottom-left-radius:0}.dp-day:-webkit-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day:-moz-any([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day:is([data-in-range=true],[data-range-start=true])+.dp-day[data-range-end=true]:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:0;border-bottom-right-radius:0}.dp-day[data-in-range=true]:first-of-type:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--dp-day-radius);border-bottom-left-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:first-of-type:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--dp-day-radius);border-bottom-left-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:first-of-type:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-left-radius:var(--dp-day-radius);border-bottom-left-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:first-of-type:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--dp-day-radius);border-bottom-right-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:first-of-type:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--dp-day-radius);border-bottom-right-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:first-of-type:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-right-radius:var(--dp-day-radius);border-bottom-right-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:last-of-type:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--dp-day-radius);border-bottom-right-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:last-of-type:not(:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--dp-day-radius);border-bottom-right-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:last-of-type:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){border-top-right-radius:var(--dp-day-radius);border-bottom-right-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:last-of-type:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--dp-day-radius);border-bottom-left-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:last-of-type:-moz-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--dp-day-radius);border-bottom-left-radius:var(--dp-day-radius)}.dp-day[data-in-range=true]:last-of-type:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){border-top-left-radius:var(--dp-day-radius);border-bottom-left-radius:var(--dp-day-radius)}.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;display:flex;pointer-events:none;justify-content:center;gap:2px;min-block-size:.35rem;font-size:.55rem;line-height:1;bottom:1px;left:2px;right:2px}.dp-week-number,.dp-week-heading{color:var(--dp-muted);font-size:.65rem;font-weight:500;inline-size:1.6rem!important}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]):focus-visible{border-color:var(--dp-accent);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--dp-accent)20%,transparent)}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) + .5rem)}.dp-picker-button{display:grid;grid-column:1;grid-row:1;inline-size:var(--dp-picker-button-size);color:var(--dp-fg);font:inherit;cursor:pointer;background:0 0;border:0;place-self:stretch end;place-items: center;min-inline-size:0}.dp-picker-button:focus-visible{outline:2px solid var(--dp-accent);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;border:1px solid var(--dp-border);border-radius:var(--dp-radius);background:var(--dp-bg);color:var(--dp-fg);max-block-size:var(--available-height,90svh);overflow:auto;max-inline-size:calc(100vi - 1rem);margin:0;padding:.875rem 1rem;inset:auto;box-shadow:0 .5rem 1.5rem #0f172a1f}.dp-picker-panel:not(:popover-open){display:none}@media (forced-colors:active){.dp-month-select,[dir=rtl] .dp-month-select{appearance:auto;background-image:none;padding-inline-start:.45rem;padding-inline-end:.45rem}.dp-day:-webkit-any([data-selected=true],[data-range-start=true],[data-range-end=true]){color:canvastext;background-color:canvas;border:2px solid highlight}.dp-day:-moz-any([data-selected=true],[data-range-start=true],[data-range-end=true]){color:canvastext;background-color:canvas;border:2px solid highlight}.dp-day:is([data-selected=true],[data-range-start=true],[data-range-end=true]){color:canvastext;background-color:canvas;border:2px solid highlight}.dp-day[data-in-range=true]{color:canvastext}.dp-day[data-in-range=true]:after{content:"";position:absolute;background-color:highlight;block-size:1px;bottom:4px;left:3px;right:3px}.dp-day[data-today=true]{border-color:highlight}.dp-day-extra{color:canvastext;forced-color-adjust:none}}
@@ -1,17 +1,17 @@
1
- /*** @lekoala/date-picker v0.1.1 - https://github.com/lekoala/date-picker ***/
2
- (()=>{var{defineProperty:st,getOwnPropertyNames:It,getOwnPropertyDescriptor:Rt}=Object,Ot=Object.prototype.hasOwnProperty;function Bt(t){return this[t]}var Ht=(t)=>{var e=(ut??=new WeakMap).get(t),s;if(e)return e;if(e=st({},"__esModule",{value:!0}),t&&typeof t==="object"||typeof t==="function"){for(var i of It(t))if(!Ot.call(e,i))st(e,i,{get:Bt.bind(t,i),enumerable:!(s=Rt(t,i))||s.enumerable})}return ut.set(t,e),e},ut;var Vt=(t)=>t;function Pt(t,e){this[t]=Vt.bind(null,e)}var Nt=(t,e)=>{for(var s in e)st(t,s,{get:e[s],enumerable:!0,configurable:!0,set:Pt.bind(e,s)})};var ye={};Nt(ye,{defineDatePicker:()=>$t});var Ut=/^(\d{4})-(\d{2})-(\d{2})$/,Yt=/^(\d{4})-(\d{2})$/;function Wt(t){return t%4===0&&(t%100!==0||t%400===0)}function X(t,e){if(e===2)return Wt(t)?29:28;return[4,6,9,11].includes(e)?30:31}function I(t){let e=Ut.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>X(s,i))return null;return{year:s,month:i,day:n}}function d(t){return I(t)!==null}function f(t){let e=String(t||""),s=Yt.exec(e);if(s){let n=Number(s[2]);if(n>=1&&n<=12)return`${s[1]}-${String(n).padStart(2,"0")}`}let i=I(e);if(!i)throw TypeError(`Invalid civil date/month: ${t}`);return`${String(i.year).padStart(4,"0")}-${String(i.month).padStart(2,"0")}`}function N(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 J(t){let e=new Date(0);return e.setUTCHours(12,0,0,0),e.setUTCFullYear(t.year,t.month-1,t.day),e}function zt(t){return N(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate())}function U(t){let e=I(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return J(e)}function w(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=I(t);if(!s||!Number.isInteger(e))throw TypeError("addDays() expects a date and integer amount");let i=J(s);return i.setUTCDate(i.getUTCDate()+e),zt(i)}function Q(t,e){let s=I(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,X(n,a));return N(n,a,o)}function ht(t,e){let s=I(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,X(i,s.month));return N(i,s.month,n)}function P(t,e){let s=`${f(t)}-01`;return f(Q(s,e))}function Kt(t){return`${f(t)}-01`}function jt(t){let e=I(`${f(t)}-01`);if(!e)throw TypeError(`Invalid month: ${t}`);return N(e.year,e.month,X(e.year,e.month))}function qt(t){let e=I(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return J(e).getUTCDay()}function j(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 tt(t,e=1){let s=(qt(t)-j(e)+7)%7;return F(t,-s)}function it(t,e=1){return F(tt(t,e),6)}function ft(t,e={}){let s=e.firstDay??1,i=tt(Kt(t),s),n=it(jt(t),s),r=[],a=i;while(w(a,n)<=0){let o=[];for(let c=0;c<7;c++)o.push(F(a,c));r.push(o),a=F(a,7)}return r}function pt(t,e="",s=""){if(!d(t))throw TypeError(`Invalid civil date: ${t}`);if(e&&w(t,e)<0)return e;if(s&&w(t,s)>0)return s;return t}function R(){let t=new Date;return N(t.getFullYear(),t.getMonth()+1,t.getDate())}function mt(t){let e=I(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);let s=J(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 nt{constructor(t={}){let e=R();this.firstDay=j(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?f(t.display):f(this.focused)}setValue(t){if(t&&!d(t))throw TypeError(`Invalid value: ${t}`);return this.value=t||"",this.value}setDisplay(t){let e=f(t),s=Number(this.focused.slice(8,10))||1,i=Q(`${e}-01`,0),n=F(i,Math.max(0,s-1));return this.focused=f(n)===e?n:F(`${P(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=f(t);return this.focused}moveFocusDays(t){return this.setFocused(F(this.focused,t))}moveFocusMonths(t){return this.setFocused(Q(this.focused,t))}moveFocusYears(t){return this.setFocused(ht(this.focused,t))}focusWeekStart(){return this.setFocused(tt(this.focused,this.firstDay))}focusWeekEnd(){return this.setFocused(it(this.focused,this.firstDay))}navigateMonth(t){let e=P(this.display,t);return this.setDisplay(e),this.display}}function et(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&&w(s,e)<0)throw TypeError("highlightedRange must be ordered; start must be on or before end");return{start:e,end:s}}function _t(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&&w(t,s)>=0&&w(t,i)<=0)return"in";return""}class rt{constructor(){this.activeEndpoint="",this.start="",this.end=""}get range(){return{start:this.start,end:this.end}}get complete(){return Boolean(this.start&&this.end&&w(this.end,this.start)>=0)}focus(t){this.activeEndpoint=t}activate(t,e=()=>!0){if(!d(t))throw TypeError(`Invalid range activation: ${t}`);if(this.complete&&(w(t,this.start)<0||w(t,this.end)>0)){let s=w(t,this.start)<0?"start":"end";if(!e(s))return{status:"refused",endpoint:s};return this[s]=t,this.activeEndpoint=s,{status:"complete",endpoint:s}}if(this.activeEndpoint==="end"){if(this.start&&w(t,this.start)<0)return{status:"refused",endpoint:"end"};if(!e("end"))return{status:"refused",endpoint:"end"};return this.end=t,{status:this.start?"complete":"pending",endpoint:"end"}}if(!e("start"))return{status:"refused",endpoint:"start"};if(this.start=t,!e("end"))return{status:"pending",endpoint:"start",close:!0};return this.activeEndpoint="end",{status:"pending",endpoint:"start"}}}var yt=/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g;function H(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 Gt(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){let s=String(t||"").replace(yt,"").trim();for(let[i,n]of Gt(e))s=s.split(i).join(n);return s}function W(t,e=""){let s=H(e);return new Intl.DateTimeFormat(s,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(U(t))}function bt(t,e=""){let s=H(e);return new Intl.DateTimeFormat(s,{calendar:"gregory",year:"numeric",month:"long",timeZone:"UTC"}).format(U(`${t.slice(0,7)}-15`))}function vt(t="",e="long"){let s=H(t),i=new Intl.DateTimeFormat(s,{calendar:"gregory",month:e,timeZone:"UTC"});return Array.from({length:12},(n,r)=>i.format(U(`2026-${String(r+1).padStart(2,"0")}-15`)))}function at(t="",e=1,s="short"){let i=H(t),n=new Intl.DateTimeFormat(i,{calendar:"gregory",weekday:s,timeZone:"UTC"}),r=j(e),a=U("2026-01-04");return Array.from({length:7},(o,c)=>{let l=new Date(a);return l.setUTCDate(a.getUTCDate()+(r+c)%7),n.format(l)})}function Zt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(t=""){let e=H(t),s=new Intl.DateTimeFormat(e,{calendar:"gregory",year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC"}),i=U("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).replace(/\s+/g," ");return Zt(h).replace(/\\ /g,"\\s*")}).join(""),c=new RegExp(`^\\s*${o}\\s*$`);return{locale:e,placeholder:a,format(l){if(!d(l))return"";return s.format(U(l))},parse(l){let h=gt(l,e);if(d(h))return h;let E=c.exec(h);if(!E)return"";let _={};if(r.forEach((b,k)=>{_[b]=Number(E[k+1])}),!_.year||!_.month||!_.day)return"";try{return N(_.year,_.month,_.day)}catch{return""}}}}var Xt={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"},Jt={...Xt};function z(){return{...Jt}}function wt(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}var Qt=0;function C(t){return String(t).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function te(t){let e=Number(t);if(e===7)return 0;return Number.isInteger(e)&&e>=0&&e<=6?e:1}function ee(t){return Number(t.slice(0,4))}function se(t){switch(t){case"single":return' data-range-start="true" data-range-end="true"';case"start":return' data-range-start="true"';case"end":return' data-range-end="true"';case"in":return' data-in-range="true"';default:return""}}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 G extends HTMLElement{static observedAttributes=["value","display","min","max","first-day","locale","fixed-weeks","show-week-numbers","selection"];constructor(){super();this._id=`date-calendar-${++Qt}`,this._model=new nt,this._connected=!1,this._rendering=!1,this._source=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._messages=z(),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._connected=!0,this.addEventListener("click",this._onClick),this.addEventListener("change",this._onChange),this.addEventListener("keydown",this._onKeyDown),this.addEventListener("focusin",this._onFocusIn),this._syncModel(),this.render()}disconnectedCallback(){this._connected=!1,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(){if(!this._connected||this._rendering)return;this._syncModel(),this.render()}get locale(){return H(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 te(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 highlightedRange(){return{...this._highlightedRange}}set highlightedRange(t){let e=et(t);if(e.start===this._highlightedRange.start&&e.end===this._highlightedRange.end)return;if(this._highlightedRange=e,this._connected)this.render()}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 messages(){return this._messages}set messages(t){if(this._messages={...z(),...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(s)}catch{}else if(this._model.value)this._model.display=f(this._model.value),this._model.focused=this._model.value;if(this._model.focused=this._clamp(this._model.focused),!this.getAttribute("display"))this._model.display=f(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){return pt(t,this.min,this.max)}_weeks(t=this.display){let e=ft(t,{firstDay:this.firstDay});if(!this.fixedWeeks||e.length>=6)return e;let s=e[e.length-1]?.[6]||"";while(e.length<6&&s){let i=[];for(let n=1;n<=7;n++)i.push(F(s,n));e.push(i),s=i[6]}return e}_focusTargetKey(t){if(t.matches(".dp-month-select, .dp-year-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&&w(t,this.min)<0||this.max&&w(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(f(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 c=await o(s,{signal:n.signal});if(n.signal.aborted)return"cancelled";for(let[l,h]of wt(c))this._sourceStates.set(l,h);if(this._loadedRanges.add(i),this.dispatchEvent(new CustomEvent("dateloadend",{detail:s,bubbles:!0})),e&&this._connected&&f(this.display)===f(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(t),this._model.focused=this._clamp(this._model.focused),this._model.display=f(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(P(this.display,-1))}nextMonth(){return this._setDisplay(P(this.display,1))}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)queueMicrotask(()=>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()}_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}focusGrid(){let t=this.querySelector(`.dp-day[data-date="${CSS.escape(this.focusedDate)}"]`);if(t instanceof HTMLElement)t.focus()}async _activate(t){let e=await this.ensureDate(t),s=this.getDateState(t);if(!e||s.disabled)return this.dispatchEvent(new CustomEvent("dateinvalid",{detail:{date:t,state:s},bubbles:!0})),!1;if(!this.dispatchEvent(new CustomEvent("dateactivate",{detail:{date:t,state:s},bubbles:!0,cancelable:!0})))return!1;if(this.selection==="single"){let n=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(f(t)===this.display)this._moveSelectionDom(n,t);else this.render()}else if(this._connected){if(f(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();this._activate(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 HTMLSelectElement&&e.matches(".dp-year-select")){this._setDisplay(`${e.value}-${this.display.slice(5,7)}`);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))this._model.focused=s}_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._activate(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=ee(s),n=Number(s.slice(5,7)),r=vt(e,"long"),a=at(e,this.firstDay,"short"),o=at(e,this.firstDay,"long"),c=this._weeks(),l=R(),h=`${this._id}-heading`,E=`${this._id}-grid`,_=this.min?f(this.min):"",b=this.max?f(this.max):"",k=Boolean(_&&P(s,-1)<_),S=Boolean(b&&P(s,1)>b),D=this.min?` min="${Number(this.min.slice(0,4))}"`:"",g=this.max?` max="${Number(this.max.slice(0,4))}"`:"",m=this.showWeekNumbers&&this.firstDay===1,A=m?`<th scope="col" class="dp-week-heading" abbr="${C(this._messages.week)}">#</th>`:"",v=r.map((x,M)=>{let p=M+1,u=`${String(i).padStart(4,"0")}-${String(p).padStart(2,"0")}`,y=_&&u<_||b&&u>b;return`<option value="${String(p).padStart(2,"0")}"${p===n?" selected":""}${y?" disabled":""}>${C(x)}</option>`}).join(""),V=a.map((x,M)=>`<th scope="col" abbr="${C(o[M])}">${C(x.replace(".",""))}</th>`).join(""),Y=c.map((x)=>{let M=m?`<th scope="row" class="dp-week-number">${mt(x[0])}</th>`:"",p=x.map((u)=>{let y=this.getDateState(u),T=f(u)!==s,L=this.value===u,K=this.focusedDate===u,lt=u===l,dt=_t(u,this._highlightedRange),ct=ie(dt),Lt=typeof y.description==="string"?y.description:"",Ft=[W(u,e),Lt,ct?this._messages[ct]:"",y.disabled?this._messages.unavailable:""].filter(Boolean).join(". ");return`<td class="dp-day" data-date="${u}"${T?' data-outside-month="true"':""}${lt?' data-today="true" aria-current="date"':""}${L?' data-selected="true" aria-selected="true"':""}${se(dt)}${y.disabled?' data-disabled="true" aria-disabled="true"':""} tabindex="${K?"0":"-1"}" aria-label="${C(Ft)}"><span class="dp-day-number" aria-hidden="true">${Number(u.slice(8,10))}</span><span class="dp-day-extra" aria-hidden="true"></span></td>`}).join("");return`<tr>${M}${p}</tr>`}).join(""),O=document.activeElement,B=O instanceof HTMLElement&&this.contains(O)?this._focusTargetKey(O):"";if(this._rendering=!0,this.innerHTML=`
1
+ /*** @lekoala/date-picker v0.3.0 - https://github.com/lekoala/date-picker ***/
2
+ (()=>{var{defineProperty:rt,getOwnPropertyNames:Yt,getOwnPropertyDescriptor:Ut}=Object,Wt=Object.prototype.hasOwnProperty;function zt(t){return this[t]}var Kt=(t)=>{var e=(_t??=new WeakMap).get(t),s;if(e)return e;if(e=rt({},"__esModule",{value:!0}),t&&typeof t==="object"||typeof t==="function"){for(var i of Yt(t))if(!Wt.call(e,i))rt(e,i,{get:zt.bind(t,i),enumerable:!(s=Ut(t,i))||s.enumerable})}return _t.set(t,e),e},_t;var qt=(t)=>t;function jt(t,e){this[t]=qt.bind(null,e)}var Gt=(t,e)=>{for(var s in e)rt(t,s,{get:e[s],enumerable:!0,configurable:!0,set:jt.bind(e,s)})};var Te={};Gt(Te,{defineDatePicker:()=>Bt});var Zt=/^(\d{4})-(\d{2})-(\d{2})$/,Xt=/^(\d{4})-(\d{2})$/;function Jt(t){return t%4===0&&(t%100!==0||t%400===0)}function tt(t,e){if(e===2)return Jt(t)?29:28;return[4,6,9,11].includes(e)?30:31}function I(t){let e=Zt.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>tt(s,i))return null;return{year:s,month:i,day:n}}function c(t){return I(t)!==null}function f(t){let e=String(t||""),s=Xt.exec(e);if(s){let n=Number(s[2]);if(n>=1&&n<=12)return`${s[1]}-${String(n).padStart(2,"0")}`}let i=I(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 et(t){let e=new Date(0);return e.setUTCHours(12,0,0,0),e.setUTCFullYear(t.year,t.month-1,t.day),e}function Qt(t){return U(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate())}function N(t){let e=I(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return et(e)}function w(t,e){if(!c(t)||!c(e))throw TypeError("compareDates() expects YYYY-MM-DD values");return t===e?0:t<e?-1:1}function L(t,e){let s=I(t);if(!s||!Number.isInteger(e))throw TypeError("addDays() expects a date and integer amount");let i=et(s);return i.setUTCDate(i.getUTCDate()+e),Qt(i)}function st(t,e){let s=I(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,tt(n,a));return U(n,a,o)}function gt(t,e){let s=I(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,tt(i,s.month));return U(i,s.month,n)}function P(t,e){let s=`${f(t)}-01`;return f(st(s,e))}function te(t){return`${f(t)}-01`}function ee(t){let e=I(`${f(t)}-01`);if(!e)throw TypeError(`Invalid month: ${t}`);return U(e.year,e.month,tt(e.year,e.month))}function se(t){let e=I(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);return et(e).getUTCDay()}function j(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 it(t,e=1){let s=(se(t)-j(e)+7)%7;return L(t,-s)}function at(t,e=1){return L(it(t,e),6)}function yt(t,e={}){let s=e.firstDay??1,i=it(te(t),s),n=at(ee(t),s),r=[],a=i;while(w(a,n)<=0){let o=[];for(let l=0;l<7;l++)o.push(L(a,l));r.push(o),a=L(a,7)}return r}function bt(t,e="",s=""){if(!c(t))throw TypeError(`Invalid civil date: ${t}`);if(e&&w(t,e)<0)return e;if(s&&w(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=I(t);if(!e)throw TypeError(`Invalid civil date: ${t}`);let s=et(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 ot{constructor(t={}){let e=O();this.firstDay=j(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?f(t.display):f(this.focused)}setValue(t){if(t&&!c(t))throw TypeError(`Invalid value: ${t}`);return this.value=t||"",this.value}setDisplay(t){let e=f(t),s=Number(this.focused.slice(8,10))||1,i=st(`${e}-01`,0),n=L(i,Math.max(0,s-1));return this.focused=f(n)===e?n:L(`${P(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=f(t);return this.focused}moveFocusDays(t){return this.setFocused(L(this.focused,t))}moveFocusMonths(t){return this.setFocused(st(this.focused,t))}moveFocusYears(t){return this.setFocused(gt(this.focused,t))}focusWeekStart(){return this.setFocused(it(this.focused,this.firstDay))}focusWeekEnd(){return this.setFocused(at(this.focused,this.firstDay))}navigateMonth(t){let e=P(this.display,t);return this.setDisplay(e),this.display}}function nt(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&&w(s,e)<0)throw TypeError("highlightedRange must be ordered; start must be on or before end");return{start:e,end:s}}function wt(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&&w(t,s)>=0&&w(t,i)<=0)return"in";return""}class dt{constructor(){this.activeEndpoint="",this.start="",this.end=""}get range(){return{start:this.start,end:this.end}}get complete(){return Boolean(this.start&&this.end&&w(this.end,this.start)>=0)}focus(t){this.activeEndpoint=t}activate(t,e=()=>!0){if(!c(t))throw TypeError(`Invalid range activation: ${t}`);if(this.complete&&(w(t,this.start)<0||w(t,this.end)>0)){let s=w(t,this.start)<0?"start":"end";if(!e(s))return{status:"refused",endpoint:s};return this[s]=t,this.activeEndpoint=s,{status:"complete",endpoint:s}}if(this.activeEndpoint==="end"){if(this.start&&w(t,this.start)<0)return{status:"refused",endpoint:"end"};if(!e("end"))return{status:"refused",endpoint:"end"};return this.end=t,{status:this.start?"complete":"pending",endpoint:"end"}}if(!e("start"))return{status:"refused",endpoint:"start"};if(this.start=t,!e("end"))return{status:"pending",endpoint:"start",close:!0};return this.activeEndpoint="end",{status:"pending",endpoint:"start"}}}var xt=/[\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/g;function R(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 ie(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 Dt(t,e){let s=String(t||"").replace(xt,"").trim();for(let[i,n]of ie(e))s=s.split(i).join(n);return s}function G(t,e=""){let s=R(e);return new Intl.DateTimeFormat(s,{calendar:"gregory",weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"UTC"}).format(N(t))}function Et(t,e=""){let s=R(e);return new Intl.DateTimeFormat(s,{calendar:"gregory",year:"numeric",month:"long",timeZone:"UTC"}).format(N(`${t.slice(0,7)}-15`))}function kt(t=""){let e=R(t);try{let s=new Intl.DateTimeFormat(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 Ct(t="",e="long"){let s=R(t),i=new Intl.DateTimeFormat(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 lt(t="",e=1,s="short"){let i=R(t),n=new Intl.DateTimeFormat(i,{calendar:"gregory",weekday:s,timeZone:"UTC"}),r=j(e),a=N("2026-01-04");return Array.from({length:7},(o,l)=>{let d=new Date(a);return d.setUTCDate(a.getUTCDate()+(r+l)%7),n.format(d)})}function ne(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(t=""){let e=R(t),s=new Intl.DateTimeFormat(e,{calendar:"gregory",year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC"}),i=N("2006-11-22"),n=s.formatToParts(i).filter((d)=>d.type!=="literal"||d.value),r=n.filter((d)=>["day","month","year"].includes(d.type)).map((d)=>d.type),a=n.map((d)=>{if(d.type==="day")return"DD";if(d.type==="month")return"MM";if(d.type==="year")return"YYYY";return d.value.replace(xt,"")}).join(""),o=n.map((d)=>{if(d.type==="day"||d.type==="month")return"(\\d{1,2})";if(d.type==="year")return"(\\d{4})";let u=Dt(d.value,e).replace(/\s+/g," ");return ne(u).replace(/\\ /g,"\\s*")}).join(""),l=new RegExp(`^\\s*${o}\\s*$`);return{locale:e,placeholder:a,format(d){if(!c(d))return"";return s.format(N(d))},parse(d){let u=Dt(d,e);if(c(u))return u;let T=l.exec(u);if(!T)return"";let p={};if(r.forEach((b,k)=>{p[b]=Number(T[k+1])}),!p.year||!p.month||!p.day)return"";try{return U(p.year,p.month,p.day)}catch{return""}}}}var re={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"},ae={...re};function z(){return{...ae}}function Tt(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}var oe=0;function A(t){return String(t).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function de(t){let e=Number(t);if(e===7)return 0;return Number.isInteger(e)&&e>=0&&e<=6?e:1}function le(t){return Number(t.slice(0,4))}function ce(t){switch(t){case"single":return' data-range-start="true" data-range-end="true"';case"start":return' data-range-start="true"';case"end":return' data-range-end="true"';case"in":return' data-in-range="true"';default:return""}}function ue(t){if(t==="single")return"rangeSingle";if(t==="start")return"rangeStart";if(t==="end")return"rangeEnd";if(t==="in")return"rangeInRange";return""}class X extends HTMLElement{static observedAttributes=["value","display","min","max","first-day","locale","fixed-weeks","show-week-numbers","selection","month-format"];constructor(){super();this._id=`date-calendar-${++oe}`,this._model=new ot,this._connected=!1,this._rendering=!1,this._source=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._messages=z(),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._connected=!0,this.addEventListener("click",this._onClick),this.addEventListener("change",this._onChange),this.addEventListener("keydown",this._onKeyDown),this.addEventListener("focusin",this._onFocusIn),this._syncModel(),this.render()}disconnectedCallback(){this._connected=!1,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(){if(!this._connected||this._rendering)return;this._syncModel(),this.render()}get locale(){return R(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 de(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=nt(t);if(e.start===this._highlightedRange.start&&e.end===this._highlightedRange.end)return;if(this._highlightedRange=e,this._connected)this.render()}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 messages(){return this._messages}set messages(t){if(this._messages={...z(),...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(s)}catch{}else if(this._model.value)this._model.display=f(this._model.value),this._model.focused=this._model.value;if(this._model.focused=this._clamp(this._model.focused),!this.getAttribute("display"))this._model.display=f(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){return bt(t,this.min,this.max)}_weeks(t=this.display){let e=yt(t,{firstDay:this.firstDay});if(!this.fixedWeeks||e.length>=6)return e;let s=e[e.length-1]?.[6]||"";while(e.length<6&&s){let i=[];for(let n=1;n<=7;n++)i.push(L(s,n));e.push(i),s=i[6]}return e}_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&&w(t,this.min)<0||this.max&&w(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(f(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[d,u]of Tt(l))this._sourceStates.set(d,u);if(this._loadedRanges.add(i),this.dispatchEvent(new CustomEvent("dateloadend",{detail:s,bubbles:!0})),e&&this._connected&&f(this.display)===f(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(t),this._model.focused=this._clamp(this._model.focused),this._model.display=f(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(P(this.display,-1))}nextMonth(){return this._setDisplay(P(this.display,1))}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)queueMicrotask(()=>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()}_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}focusGrid(){let t=this.querySelector(`.dp-day[data-date="${CSS.escape(this.focusedDate)}"]`);if(t instanceof HTMLElement)t.focus()}async _activate(t){let e=await this.ensureDate(t),s=this.getDateState(t);if(!e||s.disabled)return this.dispatchEvent(new CustomEvent("dateinvalid",{detail:{date:t,state:s},bubbles:!0})),!1;if(!this.dispatchEvent(new CustomEvent("dateactivate",{detail:{date:t,state:s},bubbles:!0,cancelable:!0})))return!1;if(this.selection==="single"){let n=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(f(t)===this.display)this._moveSelectionDom(n,t);else this.render()}else if(this._connected){if(f(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();this._activate(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))this._model.focused=s}_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._activate(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=le(s),n=Number(s.slice(5,7)),r=Ct(e,this.monthFormat),a=lt(e,this.firstDay,"short"),o=lt(e,this.firstDay,"long"),l=this._weeks(),d=O(),u=`${this._id}-heading`,T=`${this._id}-grid`,p=this.min?f(this.min):"",b=this.max?f(this.max):"",k=Boolean(p&&P(s,-1)<p),S=Boolean(b&&P(s,1)>b),D=this.min?` min="${Number(this.min.slice(0,4))}"`:"",g=this.max?` max="${Number(this.max.slice(0,4))}"`:"",_=this.showWeekNumbers&&this.firstDay===1,C=_?`<th scope="col" class="dp-week-heading" abbr="${A(this._messages.week)}">#</th>`:"",v=r.map((x,E)=>{let m=E+1,h=`${String(i).padStart(4,"0")}-${String(m).padStart(2,"0")}`,y=p&&h<p||b&&h>b;return`<option value="${String(m).padStart(2,"0")}"${m===n?" selected":""}${y?" disabled":""}>${A(x)}</option>`}).join(""),B=a.map((x,E)=>`<th scope="col" abbr="${A(o[E])}">${A(x.replace(".",""))}</th>`).join(""),W=l.map((x)=>{let E=_?`<th scope="row" class="dp-week-number">${vt(x[0])}</th>`:"",m=x.map((h)=>{let y=this.getDateState(h),M=f(h)!==s,F=this.value===h,q=this.focusedDate===h,ft=h===d,mt=wt(h,this._highlightedRange),pt=ue(mt),Nt=typeof y.description==="string"?y.description:"",Pt=[G(h,e),Nt,pt?this._messages[pt]:"",y.disabled?this._messages.unavailable:""].filter(Boolean).join(". ");return`<td class="dp-day" data-date="${h}"${M?' data-outside-month="true"':""}${ft?' data-today="true" aria-current="date"':""}${F?' data-selected="true" aria-selected="true"':""}${ce(mt)}${y.disabled?' data-disabled="true" aria-disabled="true"':""} tabindex="${q?"0":"-1"}" aria-label="${A(Pt)}"><span class="dp-day-number" aria-hidden="true">${Number(h.slice(8,10))}</span><span class="dp-day-extra" aria-hidden="true"></span></td>`}).join("");return`<tr>${E}${m}</tr>`}).join(""),V=document.activeElement,H=V instanceof HTMLElement&&this.contains(V)?this._focusTargetKey(V):"",K=kt(e)[0]==="year";this.toggleAttribute("data-year-first",K);let Y=`<label class="dp-visually-hidden" for="${this._id}-month">${A(this._messages.month)}</label>
3
+ <select id="${this._id}-month" class="dp-month-select" aria-label="${A(this._messages.month)}">${v}</select>`,Q=`<label class="dp-visually-hidden" for="${this._id}-year">${A(this._messages.year)}</label>
4
+ <input id="${this._id}-year" class="dp-year-input" type="number" inputmode="numeric" value="${i}"${D}${g} aria-label="${A(this._messages.year)}">`;if(this._rendering=!0,this.innerHTML=`
3
5
  <div class="dp-calendar-shell">
4
6
  <div class="dp-calendar-header">
5
- <label class="dp-visually-hidden" for="${this._id}-month">${C(this._messages.month)}</label>
6
- <select id="${this._id}-month" class="dp-month-select" aria-label="${C(this._messages.month)}">${v}</select>
7
- <label class="dp-visually-hidden" for="${this._id}-year">${C(this._messages.year)}</label>
8
- <input id="${this._id}-year" class="dp-year-input" type="number" inputmode="numeric" value="${i}"${D}${g} aria-label="${C(this._messages.year)}">
9
- <button type="button" class="dp-nav dp-prev" data-calendar-action="previous" aria-label="${C(this._messages.previousMonth)}"${k?" 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="m10 4-4 4 4 4"/></svg></button>
10
- <button type="button" class="dp-nav dp-next" data-calendar-action="next" aria-label="${C(this._messages.nextMonth)}"${S?" 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="m6 4 4 4-4 4"/></svg></button>
7
+ ${K?Q:Y}
8
+ ${K?Y:Q}
9
+ <button type="button" class="dp-nav dp-prev" data-calendar-action="previous" aria-label="${A(this._messages.previousMonth)}"${k?" 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="m10 4-4 4 4 4"/></svg></button>
10
+ <button type="button" class="dp-nav dp-next" data-calendar-action="next" aria-label="${A(this._messages.nextMonth)}"${S?" 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="m6 4 4 4-4 4"/></svg></button>
11
11
  </div>
12
- <h2 id="${h}" class="dp-calendar-heading dp-visually-hidden" aria-live="polite">${C(bt(`${s}-15`,e))}</h2>
13
- <table id="${E}" class="dp-grid" role="grid" aria-labelledby="${h}">
14
- <thead><tr>${A}${V}</tr></thead>
15
- <tbody>${Y}</tbody>
12
+ <h2 id="${u}" class="dp-calendar-heading dp-visually-hidden" aria-live="polite">${A(Et(`${s}-15`,e))}</h2>
13
+ <table id="${T}" class="dp-grid" role="grid" aria-labelledby="${u}">
14
+ <thead><tr>${C}${B}</tr></thead>
15
+ <tbody>${W}</tbody>
16
16
  </table>
17
- </div>`,this._rendering=!1,B)queueMicrotask(()=>{let x=this.querySelector(B);if(x instanceof HTMLElement)x.focus()});if(this._renderDay)for(let x of this.querySelectorAll(".dp-day[data-date]")){if(!(x instanceof HTMLTableCellElement))continue;let M=x.dataset.date||"",p=x.querySelector(".dp-day-extra");if(!(p instanceof HTMLElement))continue;let u=this._renderDay(M,this.getDateState(M));if(u instanceof Node)p.append(u);else if(u!==void 0&&u!==null)p.textContent=String(u)}if(t)this._loadDisplay(s)}}function Ct(t){return t==="top"||t==="bottom"?"x":"y"}function ne(t){let[e,s=null]=t.split("-");return{side:e,align:s,crossAxis:Ct(e)}}function re(t){return{top:"bottom",bottom:"top",left:"right",right:"left"}[t]||t}function ae(t,e,s,i,n,r){let a=Ct(s),o=t.x+t.width/2-e.width/2,c=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:c};break;case"left":h={x:t.x-e.width-r,y:c};break;default:h={x:t.x,y:t.y}}if(i==="start"||i==="end"){let E=(n&&a==="x"?-1:1)*(i==="end"?1:-1);h[a]+=l*E}return h}function oe(t,e,s,i){return Math.max(s-t,0)+Math.max(t+e-i,0)}function le(t){let e="dir"in t?t.dir:"";if(e==="rtl")return!0;if(e==="ltr")return!1;let s=t.ownerDocument?.defaultView;if(s?.CSS?.supports?.("selector(:dir(rtl))")&&typeof t.matches==="function")return t.matches(":dir(rtl)");return Boolean(s?.Element&&t instanceof s.Element&&s.getComputedStyle(t).direction==="rtl")}var de=25;function ce(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,c=t.compatMode==="BackCompat"?a-s.clientWidth:s.clientWidth-s.getBoundingClientRect().width;if(c>0&&c<=de){let l=e.getComputedStyle?.(s).scrollbarGutter;if(l&&l!=="auto")a-=c}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():ce(t.ownerDocument)}function Dt(t,e,s,i,n){let r=s+n,a=i-e-n,o=a>=r,c=o?r:s,l=o?a:i-e;return Math.max(c,Math.min(t,l))}function xt(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 he(t,e){return t.right<e.x||t.left>e.right||t.bottom<e.y||t.top>e.bottom}function fe(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 pe(t){if(t.hidden)return!1;if(typeof t.checkVisibility==="function")return t.checkVisibility();return t.getClientRects().length>0}function St(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 Et=new WeakMap,kt={scroll:0,resize:1,"element-resize":2};function me(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 c(D,g){let m=i.get(D);if(m===void 0||kt[g]>kt[m])i.set(D,g)}function l(){if(r)return;r=!0,e.requestAnimationFrame(()=>{let D=[...i];i.clear(),r=!1;for(let[g,m]of D){if(!s.has(g)||!g.floating.isConnected)continue;g.callback({type:m})}})}function h(D){for(let g of s)c(g,D);l()}function E(D){if(!n)return null;let g=new Set,m=new n((V)=>{let Y=!1;for(let O of V)if(g.has(O.target))Y=!0;else g.add(O.target);if(!Y)return;c(D,"element-resize"),l()}),{reference:A,floating:v}=D;if(A)m.observe(A);if(v!==A)m.observe(v);return m}let _=()=>h("scroll"),b=()=>h("resize");function k(){if(a)return;t.addEventListener("scroll",_,{passive:!0,capture:!0}),e.addEventListener("resize",b,{passive:!0}),o?.addEventListener("scroll",_,{passive:!0}),o?.addEventListener("resize",b,{passive:!0}),a=!0}function S(){if(!a)return;t.removeEventListener("scroll",_,{capture:!0}),e.removeEventListener("resize",b),o?.removeEventListener("scroll",_),o?.removeEventListener("resize",b),a=!1}return{add(D,g,m){let A={reference:D,floating:g,callback:m};s.add(A),k();let v=E(A),V=!1;return()=>{if(V)return;if(V=!0,s.delete(A),i.delete(A),v?.disconnect(),s.size===0)S()}}}}function _e(t){let e=t.ownerDocument,s=Et.get(e);if(!s)s=me(e),Et.set(e,s);return s}function Mt(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 _e(e).add(t,e,s)}function At(t,e,s){if(!pe(e))return null;let i=s.placement||"bottom-start",n=s.distance||0,r=s.flip!==!1,a=s.shift!==!1,o=s.shiftPadding??4,{side:c,align:l,crossAxis:h}=ne(i),E=l?le(t):!1,_=t.getClientRects(),b=c==="bottom"?_[_.length-1]:_[0];if(!b)return null;let k=ue(t,s);if(!k||he(b,k))return null;let S=St(e),D={x:{size:S.width,start:k.x,end:k.right},y:{size:S.height,start:k.y,end:k.bottom}},g=(p,u)=>ae(b,S,p,u,E,n),m=(p,u)=>{let{size:y,start:T,end:L}=D[u];return oe(p,y,T+o,L-o)},A=(p,u)=>{let{size:y,start:T,end:L}=D[u];return m(a?Dt(p,y,T,L,o):p,u)},v=g(c,l);if(r){let p=h==="x"?"y":"x",u=m(v[p],p);if(u>0){let y=re(c),T=g(y,l),L=m(T[p],p);if(L<u)c=y,v=T,u=L}if(p==="x"&&u>0){let y=g("top",l),T=g("bottom",l),L=m(T.y,"y")<m(y.y,"y"),K=L?T:y;if(m(K.y,"y")+A(K.x,"x")<u+A(v.y,"y"))c=L?"bottom":"top",h="x",v=K}}if(h==="x"&&a&&l){let p=m(v.x,"x");if(p>0){let u=l==="end"?"start":"end",y=g(c,u);if(m(y.x,"x")<p)l=u,v=y}}if(a){let{size:p,start:u,end:y}=D[h];v[h]=Dt(v[h],p,u,y,o)}let V=xt(b.x+b.width/2,v.x,S.width),Y=xt(b.y+b.height/2,v.y,S.height),O=`${fe(b,c,k,n,o)}px`,{style:B}=e,x=B.getPropertyValue("--available-height")!==O;B.left=`${v.x}px`,B.top=`${v.y}px`,B.setProperty("--arrow-x",`${V}%`),B.setProperty("--arrow-y",`${Y}%`),B.setProperty("--available-height",O);let M=l?`${c}-${l}`:c;return e.dataset.placement=M,{width:S.width,height:S.height,roomChanged:x,placement:M}}function Tt(t,e,s={}){let i=At(t,e,s);if(!i)return!1;if(i.roomChanged){let n=St(e);if(n.width!==i.width||n.height!==i.height)At(t,e,{...s,placement:i.placement,flip:!1})}return!0}class Z{constructor(t,e={}){this.input=t,this.messages=e.messages||{},this.adapter=q(e.locale||""),this.hidden=null,this.canonical="",this._dirty=!1,this._commitId=0,this._originalName=t.getAttribute("name")||"",this._attributeObserver=null,this.onAttributesChanged=null,this.confirm=null}setLocale(t){this.adapter=q(t||"")}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.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;if(this._dirty=!0,this.dirty(),this.hidden)this.hidden.value="";let e=t.value.trim();if(!e){t.setCustomValidity("");return}let s=this.canonical?this.adapter.format(this.canonical):"";t.setCustomValidity(e===s?"":this.messages.invalidDate)}async commit(){let t=this.input,e=++this._commitId,s=t.value.trim();if(!s){if(e!==this._commitId)return{status:"stale"};return t.setCustomValidity(""),{status:"clear",value:""}}let i=this.adapter.parse(s);if(!i){if(e!==this._commitId)return{status:"stale"};if(this.hidden)this.hidden.value="";return t.setCustomValidity(this.messages.invalidDate),{status:"invalid"}}if(this.confirm){let n=await this.confirm(i);if(e!==this._commitId)return{status:"stale"};if(!n?.ok){if(this.hidden)this.hidden.value="";return t.setCustomValidity(n?.message||this.messages.unavailableDate),{status:"invalid"}}}return{status:"ok",value:i}}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._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=0;class ot extends HTMLElement{static observedAttributes=["value","locale","min","max","open-on-focus"];constructor(){super();this._id=`date-picker-${++ge}`,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._lastFocusEndpoint="",this._rangeCommitId=0,this._pendingIntents=new Map,this._button=null,this._panel=null,this._calendar=null,this._originalDescribedBy="",this._rangeOriginalDescribedBy=["",""],this._formatHint=null,this._generatedPlaceholder=!1,this._controller=null,this._stopTracking=null,this._open=!1,this._suppressFocusOpen=!1,this._messages=z(),this._source=null,this._dateState=null,this._renderDay=null,this._isDateDisabled=null}_rangeMode(){return this.hasAttribute("range")&&Boolean(this._range)}connectedCallback(){if(this._connected)return;if(this.hasAttribute("range")){this._connectRange();return}this._connectSingle()}_connectSingle(){let t=this.querySelector(":scope > input:not([type=hidden])");if(!(t instanceof HTMLInputElement)){console.warn("<date-picker> expects a direct child text input");return}this._connected=!0,this._input=t,this._field=new Z(t,{messages:this._messages,locale:this.locale}),this._field.onAttributesChanged=()=>this._syncInputState(),this._field.confirm=(i)=>this._confirmDate(i),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;if(t.getAttribute("value")==null&&t.defaultValue==="")t.defaultValue=t.value}_connectRange(){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 Z(t,{messages:this._messages,locale:this.locale}),new Z(e,{messages:this._messages,locale:this.locale})],this._range=new rt,this._rangeOriginalDescribedBy=[t.getAttribute("aria-describedby")||"",e.getAttribute("aria-describedby")||""];for(let r of this._fields)r.onAttributesChanged=()=>this._syncRangeFields(),r.confirm=(a)=>this._confirmDate(a),r.setupFormValue();this._build(e),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);if(this._setRange(i||"",n||"",{emit:!1}),t.value.trim()&&!d(i))t.setCustomValidity(this._messages.invalidDate);if(e.value.trim()&&!d(n))e.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;if(t.getAttribute("value")==null&&t.defaultValue==="")t.defaultValue=t.value;if(e.getAttribute("value")==null&&e.defaultValue==="")e.defaultValue=e.value}disconnectedCallback(){if(this._connected=!1,this.hide(!1),this._controller?.abort(),this._controller=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,this._button?.remove(),this._panel?.remove(),this._formatHint?.remove(),this._button=null,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._connected||this._reflecting||e===s)return;if(t==="value"){if(this._rangeMode())return;if(!s||d(s))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._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}=et(t);this._setRange(e,s)}get locale(){return H(this.getAttribute("locale")||"")}set locale(t){if(t)this.setAttribute("locale",t);else this.removeAttribute("locale")}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 messages(){return this._messages}set messages(t){if(this._messages={...z(),...t||{}},this._calendar)this._calendar.messages=this._messages;for(let e of this._fields||[])e.setMessages(this._messages);this._field?.setMessages(this._messages),this._refreshButtonLabel(),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()}_adapter(){return this._field?.adapter??this._fields?.[0]?.adapter??q(this.locale)}_setupFormValue(){this._field?.setupFormValue()}_syncInputState(){let t=this._input;if(!t)return;if(this._field?.syncInputState(),this._button)this._button.disabled=t.disabled||t.readOnly;if(this._open&&(t.disabled||t.readOnly))this.hide(!1)}_syncRangeFields(){if(!this._fields)return;for(let s of this._fields)s.syncInputState();let t=this._range?.activeEndpoint==="end"?1:0,e=this._fields.every((s)=>s.input.disabled||s.input.readOnly);if(this._button)this._button.disabled=e;if(this._open&&(this._fields[t]?.input.disabled||this._fields[t]?.input.readOnly))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)}}_build(t){let e=t||this._input;if(!e)return;let s=`${this._id}-panel`,i=`${this._id}-format`,n=document.createElement("button");n.type="button",n.className="dp-picker-button",n.setAttribute("aria-haspopup","dialog"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls",s),n.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>';let r=document.createElement("div");r.id=s,r.className="dp-picker-panel",r.setAttribute("popover","manual"),r.setAttribute("role","dialog"),r.setAttribute("aria-label",this._messages.calendar);let a=new G;a.selection="none",a.fixedWeeks=!0,r.append(a);let o=document.createElement("span");if(o.id=i,o.className="dp-visually-hidden",e.insertAdjacentElement("afterend",n),n.insertAdjacentElement("afterend",r),r.insertAdjacentElement("afterend",o),this._button=n,this._panel=r,this._calendar=a,this._formatHint=o,!this._rangeMode()){this._originalDescribedBy=e.getAttribute("aria-describedby")||"";let c=[this._originalDescribedBy,i].filter(Boolean).join(" ");e.setAttribute("aria-describedby",c),e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",s)}this._refreshLocale(),this._refreshButtonLabel()}_bind(){let t=this._input,e=this._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}),e.addEventListener("click",(r)=>{if(this._open){if(r.detail===0){setTimeout(()=>this._calendar?.focusGrid(),0);return}this.hide(!1);return}this.show()},{signal:n}),s.addEventListener("dateactivate",(r)=>{let a=r,o=a.detail?.date;if(!d(o))return;queueMicrotask(()=>{if(a.defaultPrevented||!this._connected)return;if(this._input?.disabled||this._input?.readOnly)return;this._field?.dirty(),this._setValue(o,{emit:!0,format:!0}),this.hide(!1),this._focusInput()})},{signal:n}),s.addEventListener("dateloadend",()=>void this.validate(),{signal:n}),this.ownerDocument.addEventListener("pointerdown",(r)=>{if(!this._open||r.composedPath().includes(this))return;this.hide(!1)},{capture:!0,signal:n}),this.ownerDocument.addEventListener("reset",(r)=>{let a=r.target;if(a instanceof HTMLFormElement&&this._input&&a===this._input.form)this.hide(!1),queueMicrotask(()=>{if(!r.defaultPrevented)this._restoreDefault()})},{capture:!0,signal:n}),this.addEventListener("keydown",(r)=>this._onEscape(r),{signal:n})}_bindRange(){let t=this._button,e=this._calendar;if(!this._fields||!t||!e)return;let s=new AbortController;this._controller=s;let{signal:i}=s;for(let[n,r]of this._fields.entries()){let a=n===1?"end":"start";r.input.addEventListener("input",()=>r.handleInput(),{signal:i}),r.input.addEventListener("change",()=>void this._commitFieldText(a),{signal:i}),r.input.addEventListener("blur",()=>void this._commitFieldText(a),{signal:i}),r.input.addEventListener("focus",(o)=>this._onFieldFocus(a,o),{signal:i}),r.input.addEventListener("keydown",(o)=>this._onFieldKeyDown(a,o),{signal:i})}t.addEventListener("click",(n)=>{if(this._open){if(n.detail===0){setTimeout(()=>this._calendar?.focusGrid(),0);return}this.hide(!1);return}this.show()},{signal:i}),e.addEventListener("click",(n)=>this._captureGridIntent(n),{capture:!0,signal:i}),e.addEventListener("keydown",(n)=>this._captureGridIntent(n),{capture:!0,signal:i}),e.addEventListener("dateactivate",(n)=>{let r=n,a=r.detail?.date;if(!d(a))return;queueMicrotask(()=>{if(r.defaultPrevented||!this._connected||!this._range)return;let o=this._pendingIntents.get(a);if(o===void 0||o!==this._rangeCommitId)return;this._pendingIntents.delete(a);let c=this._range.activate(a,(l)=>{let h=l==="end"?1:0,E=this._fields?.[h];return E!=null&&!E.input.disabled&&!E.input.readOnly});if(c.status==="refused"){this._calendar?.dispatchEvent(new CustomEvent("dateinvalid",{detail:{date:a,state:this._calendar.getDateState(a)},bubbles:!0}));return}if(this._setBound(c.endpoint,a,{emit:!0,user:!0}),c.close||c.status==="complete")this.hide(!1),this._focusField(c.endpoint)})},{signal:i}),e.addEventListener("dateloadend",()=>void this.validate(),{signal:i}),this.ownerDocument.addEventListener("pointerdown",(n)=>{if(!this._open||n.composedPath().includes(this))return;this.hide(!1)},{capture:!0,signal:i}),this.ownerDocument.addEventListener("reset",(n)=>{let r=n.target;if(r instanceof HTMLFormElement&&this._fields&&r===this._fields[0].input.form)this.hide(!1),queueMicrotask(()=>{if(!n.defaultPrevented)this._restoreRangeDefault()})},{capture:!0,signal:i}),this.addEventListener("keydown",(n)=>this._onEscape(n),{signal:i})}_onFieldKeyDown(t,e){if(e.key==="ArrowDown"||e.altKey&&e.key==="ArrowDown"){if(e.preventDefault(),this._rangeMode()&&t)this._lastFocusEndpoint=t,this._range?.focus(t);if(this._open)setTimeout(()=>this._calendar?.focusGrid(),0);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._rangeCommitId++,this._pendingIntents.clear();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)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._pendingIntents.set(s,++this._rangeCommitId)}_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.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._generatedPlaceholder)i.input.placeholder=i.placeholder,this._generatedPlaceholder=!0;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._generatedPlaceholder)e.input.placeholder=e.placeholder,this._generatedPlaceholder=!0;if(this._value)e.input.value=e.format(this._value);this._refreshButtonLabel()}_refreshButtonLabel(){if(!this._button)return;if(this._rangeMode()){this._refreshRangeButtonLabel();return}let t=this._value?this._messages.changeDate:this._messages.chooseDate,e=this._value?`, ${W(this._value,this.locale)}`:"";this._button.setAttribute("aria-label",`${t}${e}`)}_refreshRangeButtonLabel(){if(!this._button||!this._range)return;let{start:t,end:e}=this._range,s=Boolean(t&&e),i=s?this._messages.changeDate:this._messages.chooseDate,n=s?`, ${W(t,this.locale)} – ${W(e,this.locale)}`:"";this._button.setAttribute("aria-label",`${i}${n}`)}_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)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){let e=this._calendar;if(!e)return{ok:!0};let s=f(t);if(e.display!==s)e.display=s;let i=await e.ensureDate(t),n=e.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();if(i.status==="stale"||i.status==="invalid")return!1;return this._setValue(i.value||"",{emit:t,format:i.status==="ok"}),!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(n.status==="stale")return!1;if(n.status==="invalid")return this._orderTags.delete(s),!1;return this._setBound(t,n.value||"",{emit:!0,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&&(r.input.disabled||r.input.readOnly))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 c=o!==a;if(c){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),c}_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}))}_syncHighlight(){if(!this._calendar||!this._range)return;let{start:t,end:e}=this._range;if(!t){this._calendar.highlightedRange={start:"",end:""};return}if(e&&w(e,t)<0)this._calendar.highlightedRange={start:t,end:""};else this._calendar.highlightedRange={start:t,end:e}}_revalidateRange(t){if(!this._fields||!this._range)return;let{start:e,end:s}=this._range,i=Boolean(e&&s&&w(s,e)<0),n=["start","end"];for(let r of n){let a=r==="end"?1:0,o=this._fields[a].input,c=r==="end"?this._messages.rangeOrderEnd:this._messages.rangeOrderStart;if(i&&r===t)o.setCustomValidity(c),this._orderTags.add(a);else if(this._orderTags.has(a))o.setCustomValidity(""),this._orderTags.delete(a)}}_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=f(this._value),this._calendar.focusedDate=this._value;else this._calendar.display=f(R()),this._calendar.focusedDate=R();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||R();this._calendar.display=f(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,setTimeout(()=>{s.focus(),this._suppressFocusOpen=!1},0)}_focusInput(){this._suppressFocusOpen=!0,setTimeout(()=>{this._input?.focus(),this._suppressFocusOpen=!1},0)}_resolveRangeEndpoint(){if(!this._fields)return"";let t=this._lastFocusEndpoint||"start",e=t==="end"?1:0;if(!this._fields[e].input.disabled&&!this._fields[e].input.readOnly)return t;let s=t==="end"?"start":"end",i=s==="end"?1:0;if(!this._fields[i].input.disabled&&!this._fields[i].input.readOnly)return s;return""}async validate(){if(this._rangeMode()){let e=this._fields;if(!e)return!0;for(let[s,i]of e.entries()){let n=await i.commit();if(n.status==="ok"||n.status==="clear"){let r=s===1?"end":"start";this._setBound(r,n.value||"",{format:n.status==="ok"})}}return this._revalidateRange("start"),this._revalidateRange("end"),e.every((s)=>s.input.checkValidity())}let t=this._field?.input;if(!t)return!0;if(!t.value.trim())return t.setCustomValidity(""),t.checkValidity();return await this._commitText(!1,{force:!0}),t.checkValidity()}show(t={}){let e=this._panel,s=this._calendar,i=this._button;if(!e||!s||!i||this._open)return;if(this._rangeMode()){let r=this._resolveRangeEndpoint();if(!r)return;this._range?.focus(r),this._rangeCommitId++,this._pendingIntents.clear();let a=this._boundCanonical(r)||R();s.display=f(a),s.focusedDate=a,this._lastFocusEndpoint=r}else{let r=this._input;if(!r||r.disabled||r.readOnly)return;let a=this._value||this._adapter().parse(r.value)||R();s.display=f(a),s.focusedDate=a}e.showPopover(),this._open=!0,this._setExpanded(!0);let n=()=>Tt(this,e,{placement:"bottom-start",distance:4,shiftPadding:8});if(n(),this._stopTracking=Mt(this,e,n),t.moveFocus!==!1)queueMicrotask(()=>s.focusGrid());this.dispatchEvent(new Event("open",{bubbles:!0}))}_setExpanded(t){let e=t?"true":"false";this._input?.setAttribute("aria-expanded",e),this._button?.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._rangeCommitId++,this._pendingIntents.clear(),t)if(this._rangeMode()){let e=this._restoreFocusEndpoint();if(e)this._focusField(e)}else this._focusInput();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&&!s.input.disabled&&!s.input.readOnly)return t}return this._resolveRangeEndpoint()}}function $t(){if(!customElements.get("date-calendar"))customElements.define("date-calendar",G);if(!customElements.get("date-picker"))customElements.define("date-picker",ot)}$t();})();
17
+ </div>`,this._rendering=!1,H)queueMicrotask(()=>{let x=H;if(x.startsWith(".dp-day[data-date="))x=`.dp-day[data-date="${CSS.escape(this._model.focused)}"]`;let E=this.querySelector(x);if(E instanceof HTMLElement)E.focus()});if(this._renderDay)for(let x of this.querySelectorAll(".dp-day[data-date]")){if(!(x instanceof HTMLTableCellElement))continue;let E=x.dataset.date||"",m=x.querySelector(".dp-day-extra");if(!(m instanceof HTMLElement))continue;let h=this._renderDay(E,this.getDateState(E));if(h instanceof Node)m.append(h);else if(h!==void 0&&h!==null)m.textContent=String(h)}if(t)this._loadDisplay(s)}}function Lt(t){return t==="top"||t==="bottom"?"x":"y"}function he(t){let[e,s=null]=t.split("-");return{side:e,align:s,crossAxis:Lt(e)}}function fe(t){return{top:"bottom",bottom:"top",left:"right",right:"left"}[t]||t}function me(t,e,s,i,n,r){let a=Lt(s),o=t.x+t.width/2-e.width/2,l=t.y+t.height/2-e.height/2,d=t[a==="x"?"width":"height"]/2-e[a==="x"?"width":"height"]/2,u;switch(s){case"top":u={x:o,y:t.y-e.height-r};break;case"bottom":u={x:o,y:t.y+t.height+r};break;case"right":u={x:t.x+t.width+r,y:l};break;case"left":u={x:t.x-e.width-r,y:l};break;default:u={x:t.x,y:t.y}}if(i==="start"||i==="end"){let T=(n&&a==="x"?-1:1)*(i==="end"?1:-1);u[a]+=d*T}return u}function pe(t,e,s,i){return Math.max(s-t,0)+Math.max(t+e-i,0)}function _e(t){let e="dir"in t?t.dir:"";if(e==="rtl")return!0;if(e==="ltr")return!1;let s=t.ownerDocument?.defaultView;if(s?.CSS?.supports?.("selector(:dir(rtl))")&&typeof t.matches==="function")return t.matches(":dir(rtl)");return Boolean(s?.Element&&t instanceof s.Element&&s.getComputedStyle(t).direction==="rtl")}var ge=25;function ye(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<=ge){let d=e.getComputedStyle?.(s).scrollbarGutter;if(d&&d!=="auto")a-=l}return{x:n,y:r,width:a,height:o,right:n+a,bottom:r+o}}function be(t,e){return e.scope?e.scope.getBoundingClientRect():ye(t.ownerDocument)}function At(t,e,s,i,n){let r=s+n,a=i-e-n,o=a>=r,l=o?r:s,d=o?a:i-e;return Math.max(l,Math.min(t,d))}function St(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 ve(t,e){return t.right<e.x||t.left>e.right||t.bottom<e.y||t.top>e.bottom}function we(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 De(t){if(t.hidden)return!1;if(typeof t.checkVisibility==="function")return t.checkVisibility();return t.getClientRects().length>0}function It(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 Mt=new WeakMap,Ft={scroll:0,resize:1,"element-resize":2};function xe(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(D,g){let _=i.get(D);if(_===void 0||Ft[g]>Ft[_])i.set(D,g)}function d(){if(r)return;r=!0,e.requestAnimationFrame(()=>{let D=[...i];i.clear(),r=!1;for(let[g,_]of D){if(!s.has(g)||!g.floating.isConnected)continue;g.callback({type:_})}})}function u(D){for(let g of s)l(g,D);d()}function T(D){if(!n)return null;let g=new Set,_=new n((B)=>{let W=!1;for(let V of B)if(g.has(V.target))W=!0;else g.add(V.target);if(!W)return;l(D,"element-resize"),d()}),{reference:C,floating:v}=D;if(C)_.observe(C);if(v!==C)_.observe(v);return _}let p=()=>u("scroll"),b=()=>u("resize");function k(){if(a)return;t.addEventListener("scroll",p,{passive:!0,capture:!0}),e.addEventListener("resize",b,{passive:!0}),o?.addEventListener("scroll",p,{passive:!0}),o?.addEventListener("resize",b,{passive:!0}),a=!0}function S(){if(!a)return;t.removeEventListener("scroll",p,{capture:!0}),e.removeEventListener("resize",b),o?.removeEventListener("scroll",p),o?.removeEventListener("resize",b),a=!1}return{add(D,g,_){let C={reference:D,floating:g,callback:_};s.add(C),k();let v=T(C),B=!1;return()=>{if(B)return;if(B=!0,s.delete(C),i.delete(C),v?.disconnect(),s.size===0)S()}}}}function Ee(t){let e=t.ownerDocument,s=Mt.get(e);if(!s)s=xe(e),Mt.set(e,s);return s}function Ot(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 Ee(e).add(t,e,s)}function $t(t,e,s){if(!De(e))return null;let i=s.placement||"bottom-start",n=s.distance||0,r=s.flip!==!1,a=s.shift!==!1,o=s.shiftPadding??4,{side:l,align:d,crossAxis:u}=he(i),T=d?_e(t):!1,p=t.getClientRects(),b=l==="bottom"?p[p.length-1]:p[0];if(!b)return null;let k=be(t,s);if(!k||ve(b,k))return null;let S=It(e),D={x:{size:S.width,start:k.x,end:k.right},y:{size:S.height,start:k.y,end:k.bottom}},g=(m,h)=>me(b,S,m,h,T,n),_=(m,h)=>{let{size:y,start:M,end:F}=D[h];return pe(m,y,M+o,F-o)},C=(m,h)=>{let{size:y,start:M,end:F}=D[h];return _(a?At(m,y,M,F,o):m,h)},v=g(l,d);if(r){let m=u==="x"?"y":"x",h=_(v[m],m);if(h>0){let y=fe(l),M=g(y,d),F=_(M[m],m);if(F<h)l=y,v=M,h=F}if(m==="x"&&h>0){let y=g("top",d),M=g("bottom",d),F=_(M.y,"y")<_(y.y,"y"),q=F?M:y;if(_(q.y,"y")+C(q.x,"x")<h+C(v.y,"y"))l=F?"bottom":"top",u="x",v=q}}if(u==="x"&&a&&d){let m=_(v.x,"x");if(m>0){let h=d==="end"?"start":"end",y=g(l,h);if(_(y.x,"x")<m)d=h,v=y}}if(a){let{size:m,start:h,end:y}=D[u];v[u]=At(v[u],m,h,y,o)}let B=St(b.x+b.width/2,v.x,S.width),W=St(b.y+b.height/2,v.y,S.height),V=`${we(b,l,k,n,o)}px`,{style:H}=e,K=H.getPropertyValue("--available-height")!==V,Y=s.coordinateSpace==="document"?t.ownerDocument.defaultView:null,Q=Y?Y.scrollX:0,x=Y?Y.scrollY:0;H.left=`${v.x+Q}px`,H.top=`${v.y+x}px`,H.setProperty("--arrow-x",`${B}%`),H.setProperty("--arrow-y",`${W}%`),H.setProperty("--available-height",V);let E=d?`${l}-${d}`:l;return e.dataset.placement=E,{width:S.width,height:S.height,roomChanged:K,placement:E}}function Rt(t,e,s={}){let i=$t(t,e,s);if(!i)return!1;if(i.roomChanged){let n=It(e);if(n.width!==i.width||n.height!==i.height)$t(t,e,{...s,placement:i.placement,flip:!1})}return!0}class J{constructor(t,e={}){this.input=t,this.messages=e.messages||{},this.adapter=Z(e.locale||""),this.hidden=null,this.canonical="",this._dirty=!1,this._commitId=0,this._originalName=t.getAttribute("name")||"",this._attributeObserver=null,this.onAttributesChanged=null,this.confirm=null}setLocale(t){this.adapter=Z(t||"")}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.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(e===s?"":this.messages.invalidDate)}async commit(){let t=this.input,e=++this._commitId,s=t.value.trim();if(!s){if(e!==this._commitId)return{status:"stale"};return t.setCustomValidity(""),{status:"clear",value:""}}let i=this.adapter.parse(s);if(!i){if(e!==this._commitId)return{status:"stale"};if(this.hidden)this.hidden.value="";return t.setCustomValidity(this.messages.invalidDate),{status:"invalid"}}if(this.confirm){let n=await this.confirm(i);if(e!==this._commitId)return{status:"stale"};if(!n?.ok){if(this.hidden)this.hidden.value="";return t.setCustomValidity(n?.message||this.messages.unavailableDate),{status:"invalid"}}}return{status:"ok",value:i}}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._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 ke=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/;function ct(t){let e=ke.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 ut(t){return ct(t)!==null}function Vt(t){return((t.hour*60+t.minute)*60+t.second)*1000+t.millisecond}function Ht(t,e){let s=ct(t),i=ct(e);if(!s||!i)throw TypeError("compareTimes() expects HH:MM values");let n=Vt(s)-Vt(i);return n===0?0:n<0?-1:1}var Ce=0;class ht extends HTMLElement{static observedAttributes=["value","locale","min","max","open-on-focus","month-format"];constructor(){super();this._id=`date-picker-${++Ce}`,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._rangeCommitId=0,this._pendingIntents=new Map,this._buttons=[],this._returnFocus=null,this._panel=null,this._calendar=null,this._originalDescribedBy="",this._rangeOriginalDescribedBy=["",""],this._formatHint=null,this._generatedPlaceholder=!1,this._controller=null,this._stopTracking=null,this._open=!1,this._suppressFocusOpen=!1,this._messages=z(),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.hasAttribute("range")){this._connectRange();return}this._connectSingle()}_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 J(t,{messages:this._messages,locale:this.locale}),this._field.onAttributesChanged=()=>this._syncInputState(),this._field.confirm=(i)=>this._confirmDate(i),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;if(t.getAttribute("value")==null&&t.defaultValue==="")t.defaultValue=t.value}_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 J(t,{messages:this._messages,locale:this.locale}),new J(e,{messages:this._messages,locale:this.locale})],this._range=new dt,this._rangeOriginalDescribedBy=[t.getAttribute("aria-describedby")||"",e.getAttribute("aria-describedby")||""];for(let r of this._fields)r.onAttributesChanged=()=>this._syncRangeFields(),r.confirm=(a)=>this._confirmDate(a),r.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);if(this._setRange(i||"",n||"",{emit:!1}),t.value.trim()&&!c(i))t.setCustomValidity(this._messages.invalidDate);if(e.value.trim()&&!c(n))e.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;if(t.getAttribute("value")==null&&t.defaultValue==="")t.defaultValue=t.value;if(e.getAttribute("value")==null&&e.defaultValue==="")e.defaultValue=e.value}disconnectedCallback(){if(this._connected=!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._connected||this._reflecting||e===s)return;if(t==="value"){if(this._rangeMode())return;if(!s||c(s))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._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}=nt(t);this._setRange(e,s)}get locale(){return R(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 messages(){return this._messages}set messages(t){if(this._messages={...z(),...t||{}},this._calendar)this._calendar.messages=this._messages;for(let e of this._fields||[])e.setMessages(this._messages);this._field?.setMessages(this._messages),this._refreshButtonLabel(),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??Z(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&&(t.disabled||t.readOnly))this.hide(!1)}_syncRangeFields(){if(!this._fields)return;for(let e of this._fields)e.syncInputState();for(let{button:e,endpoint:s}of this._buttons){let i=s==="end"?1:0,n=this._fields[i];e.disabled=Boolean(n?.input.disabled||n?.input.readOnly)}let t=this._range?.activeEndpoint==="end"?1:0;if(this._open&&(this._fields[t]?.input.disabled||this._fields[t]?.input.readOnly))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 d=this._createTrigger(l);return o.insertAdjacentElement("afterend",d),{button:d,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 X;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()}_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){setTimeout(()=>this._calendar?.focusGrid(),0);return}this.hide(!1);return}this.show({returnFocus:e})},{signal:n}),e.addEventListener("keydown",(r)=>this._onTriggerKeyDown("",r),{signal:n}),s.addEventListener("dateactivate",(r)=>{let a=r,o=a.detail?.date;if(!c(o))return;queueMicrotask(()=>{if(a.defaultPrevented||!this._connected)return;if(this._input?.disabled||this._input?.readOnly)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.ownerDocument.addEventListener("pointerdown",(r)=>{if(!this._open||r.composedPath().includes(this))return;this.hide(!1)},{capture:!0,signal:n}),this.ownerDocument.addEventListener("reset",(r)=>{let a=r.target;if(a instanceof HTMLFormElement&&this._input&&a===this._input.form)this.hide(!1),queueMicrotask(()=>{if(!r.defaultPrevented)this._restoreDefault()})},{capture:!0,signal:n}),this.addEventListener("keydown",(r)=>this._onEscape(r),{signal:n})}_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",()=>n.handleInput(),{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(!c(r))return;queueMicrotask(()=>{if(n.defaultPrevented||!this._connected||!this._range)return;let a=this._pendingIntents.get(r);if(a===void 0||a!==this._rangeCommitId)return;this._pendingIntents.delete(r);let o=this._range.activate(r,(l)=>{let d=l==="end"?1:0,u=this._fields?.[d];return u!=null&&!u.input.disabled&&!u.input.readOnly});if(o.status==="refused"){this._calendar?.dispatchEvent(new CustomEvent("dateinvalid",{detail:{date:r,state:this._calendar.getDateState(r)},bubbles:!0}));return}if(this._setBound(o.endpoint,r,{emit:!0,user:!0}),o.close||o.status==="complete")this.hide(!1),this._focusField(o.endpoint)})},{signal:s}),t.addEventListener("dateloadend",()=>void this.validate(),{signal:s}),this.ownerDocument.addEventListener("pointerdown",(i)=>{if(!this._open||i.composedPath().includes(this))return;this.hide(!1)},{capture:!0,signal:s}),this.ownerDocument.addEventListener("reset",(i)=>{let n=i.target;if(n instanceof HTMLFormElement&&this._fields&&n===this._fields[0].input.form)this.hide(!1),queueMicrotask(()=>{if(!i.defaultPrevented)this._restoreRangeDefault()})},{capture:!0,signal:s}),this.addEventListener("keydown",(i)=>this._onEscape(i),{signal:s})}_activateRangeEndpoint(t){let e=this._calendar;if(!this._range||!e)return;this._range.focus(t),this._rangeCommitId++,this._pendingIntents.clear(),this._lastFocusEndpoint=t;let s=this._boundCanonical(t)||O();e.display=f(s),e.focusedDate=s}_onRangeTriggerClick(t,e){if(!this._open){this.show({endpoint:t});return}if(e.detail===0){this._activateRangeEndpoint(t),setTimeout(()=>this._calendar?.focusGrid(),0);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);setTimeout(()=>this._calendar?.focusGrid(),0);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)setTimeout(()=>this._calendar?.focusGrid(),0);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._rangeCommitId++,this._pendingIntents.clear();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)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(!c(s))return;this._pendingIntents.clear(),this._pendingIntents.set(s,++this._rangeCommitId)}_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.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._generatedPlaceholder)i.input.placeholder=i.placeholder,this._generatedPlaceholder=!0;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._generatedPlaceholder)e.input.placeholder=e.placeholder,this._generatedPlaceholder=!0;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?`, ${G(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?`, ${G(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)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){let e=this._calendar;if(!e)return{ok:!0};let s=f(t);if(e.display!==s)e.display=s;let i=await e.ensureDate(t),n=e.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();if(i.status==="stale"||i.status==="invalid")return!1;return this._setValue(i.value||"",{emit:t,format:i.status==="ok"}),!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(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&&(r.input.disabled||r.input.readOnly))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}))}_syncHighlight(){if(!this._calendar||!this._range)return;let{start:t,end:e}=this._range;if(!t){this._calendar.highlightedRange={start:"",end:""};return}if(e&&w(e,t)<0)this._calendar.highlightedRange={start:t,end:""};else this._calendar.highlightedRange={start:t,end:e}}_revalidateRange(t){if(!this._fields||!this._range)return;let{start:e,end:s}=this._range,i=Boolean(e&&s&&w(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.disabled?e.value.trim():"",a=s&&!s.disabled?s.value.trim():"",o=Boolean(e&&s&&r&&a)&&ut(r)&&ut(a)&&Ht(a,r)<0;for(let[l,d]of i.entries()){let u=n[l];if(!u)continue;let T=d==="end"?this._messages.rangeOrderEnd:this._messages.rangeOrderStart;if(o&&d===t)u.setCustomValidity(T),this._timeOrderOwned.add(u);else if(this._timeOrderOwned.has(u))u.setCustomValidity(""),this._timeOrderOwned.delete(u)}}_clearTimeOrderValidity(){for(let t of this._timeOrderOwned)t.setCustomValidity("");this._timeOrderOwned.clear()}_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=f(this._value),this._calendar.focusedDate=this._value;else this._calendar.display=f(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=f(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,setTimeout(()=>{s.focus(),this._suppressFocusOpen=!1},0)}_restoreFocus(){let t=this._returnFocus;if(this._returnFocus=null,!(t instanceof HTMLElement)||!t.isConnected||t.matches(":disabled"))return;this._suppressFocusOpen=!0,setTimeout(()=>{t.focus(),this._suppressFocusOpen=!1},0)}_resolveRangeEndpoint(){if(!this._fields)return"";let t=this._lastFocusEndpoint||"start",e=t==="end"?1:0;if(!this._fields[e].input.disabled&&!this._fields[e].input.readOnly)return t;let s=t==="end"?"start":"end",i=s==="end"?1:0;if(!this._fields[i].input.disabled&&!this._fields[i].input.readOnly)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();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)return!0;if(!t.value.trim())t.setCustomValidity("");else await this._commitText(!1,{force:!0});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||r.disabled||r.readOnly)return;let a=this._value||this._adapter().parse(r.value)||O();s.display=f(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=()=>Rt(this,e,{placement:"bottom-start",distance:4,shiftPadding:8,coordinateSpace:i});if(n(),this._stopTracking=Ot(this,e,n),t.moveFocus!==!1)queueMicrotask(()=>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._rangeCommitId++,this._pendingIntents.clear(),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&&!s.input.disabled&&!s.input.readOnly)return t}return this._resolveRangeEndpoint()}}function Bt(){if(!customElements.get("date-calendar"))customElements.define("date-calendar",X);if(!customElements.get("date-picker"))customElements.define("date-picker",ht)}Bt();})();