@pglejzer/datepicker-ui 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -13
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +10 -18
- package/dist/cjs/kit.cjs +1 -1
- package/dist/cjs/kit.d.cts +111 -19
- package/dist/cjs/shared.cjs +1 -1
- package/dist/cjs/shared.d.cts +145 -41
- package/dist/css/index.css +1 -1
- package/dist/css/main.css +1 -1
- package/dist/css/themes/theme-ai.css +1 -1
- package/dist/css/themes/theme-crane-straight.css +1 -1
- package/dist/css/themes/theme-crane.css +1 -1
- package/dist/css/themes/theme-cyberpunk.css +1 -1
- package/dist/css/themes/theme-glassmorphic.css +1 -1
- package/dist/css/themes/theme-m2.css +1 -1
- package/dist/css/themes/theme-m3-green.css +1 -1
- package/dist/css/themes/theme-pastel.css +1 -1
- package/dist/esm/index.d.ts +10 -14
- package/dist/esm/index.js +1 -1
- package/dist/esm/kit.d.ts +112 -19
- package/dist/esm/kit.js +1 -1
- package/dist/esm/shared.d.ts +140 -41
- package/dist/esm/shared.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/kit.js +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.DatepickerUI=t())})(this,function(){function e(e){queueMicrotask(()=>{throw e})}var t=class{store={};on(e,t,n){let r=this.listenersOf(e),i={handler:t},a=()=>{r.delete(i),n?.removeEventListener(`abort`,a)};return n?.aborted||(r.add(i),n?.addEventListener(`abort`,a,{once:!0})),a}once(e,t){let n=this.on(e,e=>{n(),t(e)});return n}off(e,t){let n=this.store[e];if(n){if(!t)n.clear();else for(let e of n)e.handler===t&&n.delete(e)}}emit(t,n){let r=this.store[t];if(!r)return;let i=[];for(let e of[...r])if(r.has(e))try{e.handler(n)}catch(e){i.push(e)}i.length>0&&e(i[0])}listenerCount(e){return this.store[e]?.size??0}clear(){this.store={}}listenersOf(e){let t=this.store[e];if(t)return t;let n=/* @__PURE__ */ new Set;return this.store[e]=n,n}};let n=/^(\d{4})-(\d{2})-(\d{2})$/;function r(e){return e%4==0&&e%100!=0||e%400==0}function i(e,t){return t===2?r(e)?29:28:t===4||t===6||t===9||t===11?30:31}function a(e,t,n){let r=t<=2?e-1:e,i=Math.floor(r/400),a=r-i*400,o=t>2?t-3:t+9,s=Math.floor((153*o+2)/5)+n-1,c=a*365+Math.floor(a/4)-Math.floor(a/100)+s;return i*146097+c-719468}function o(e){let t=e+719468,n=Math.floor(t/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),o=Math.floor((5*a+2)/153),s=a-Math.floor((153*o+2)/5)+1,c=o<10?o+3:o-9;return{year:i+n*400+ +(c<=2),month:c,day:s}}function s(e){switch((e%7+7)%7){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 5:return 5;default:return 6}}function c(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||e<1||e>9999||t<1||t>12?!1:n>=1&&n<=i(e,t)}function l(e,t,n){return c(e,t,n)?{year:e,month:t,day:n}:null}function u(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function d(e){let t=new Date(2e3,0,1);return t.setFullYear(e.year,e.month-1,e.day),t.setHours(0,0,0,0),t}function f(e){let t=n.exec(e);return t?l(Number(t[1]),Number(t[2]),Number(t[3])):null}function p(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function m(e,t){return e.year===t.year?e.month===t.month?e.day-t.day:e.month-t.month:e.year-t.year}function h(e,t){return e===null||t===null?!1:m(e,t)===0}function g(e,t){return o(a(e.year,e.month,e.day)+t)}function _(e,t){return a(t.year,t.month,t.day)-a(e.year,e.month,e.day)}function v(e,t){let n=e.year*12+(e.month-1)+t,r=Math.floor(n/12);return{year:r,month:n-r*12+1}}function y(e,t){return t.year*12+t.month-(e.year*12+e.month)}function b(e){return i(e.year,e.month)}function x(e){return s(a(e.year,e.month,e.day)+4)}function S(){return u(/* @__PURE__ */ new Date)}function C(e){return e===`today`?S():typeof e==`string`?f(e):Number.isNaN(e.getTime())?null:u(e)}function w(e){let t=a(e.year,e.month,e.day),n=(x(e)+6)%7+1,r=t+4-n,i=o(r).year,s=a(i,1,1);return Math.floor((r-s)/7)+1}let ee=e=>{let t=e.mode===`range`&&e.presets>0;if(e.surface===`modal`||e.fullscreen||e.precision!==`day`)return{months:1,presets:t?`row`:`none`};let n=336+(e.weekNumbers&&e.mode!==`range`?48:0),r=(e,t)=>e*n+(e-1)*24+24+(t?168:0)+32,i=t&&r(1,!0)<=e.width,a=1;for(let t=2;t<=e.months;t+=1)r(t,i)<=e.width&&(a=t);let o=`none`;return i?o=`column`:t&&(o=`row`),{months:a,presets:o}},T=(e,t,n)=>{if(n!==`day`)return!1;switch(e){case`single`:return t===`modal`;case`range`:return!0;case`multiple`:return!1}},E=e=>{switch(e){case`day`:return`days`;case`month`:return`month-grid`;case`year`:return`year-grid`}},D=(e,t)=>{let n=t!==`modal`;switch(e){case`day`:return`days`;case`month`:return n?`month-menu`:`month-grid`;case`year`:return n?`year-menu`:`year-grid`}},te=(e,t,n,r)=>t?`inline`:e===`auto`?n<600||r<480?`modal`:`docked`:e,ne=(e,t,n,r)=>e===`range`&&t===`modal`&&n<r;function re(e){let t=[...e].sort(m);return t.filter((e,n)=>n===0||m(t[n-1],e)!==0)}function O(e){switch(e){case`single`:return{mode:e,date:null};case`range`:return{mode:e,start:null,end:null};default:return{mode:e,dates:[]}}}function k(e){switch(e.mode){case`single`:return e.date?[e.date]:[];case`range`:return[e.start,e.end].filter(e=>e!==null);default:return e.dates}}function A(e){return k(e).length===0}function ie(e){return e.mode!==`range`||e.start===null==(e.end===null)}function ae(e,t){return e===null||t===null?e===t:m(e,t)===0}function oe(e,t){if(e.mode!==t.mode)return!1;let n=k(e),r=k(t);return n.length===r.length?e.mode===`range`&&t.mode===`range`?ae(e.start,t.start)&&ae(e.end,t.end):n.every((e,t)=>m(e,r[t])===0):!1}function se(e,t){return k(e).some(e=>h(e,t))}function ce(e,t){return e.mode!==`range`||e.start===null||e.end===null||m(e.start,e.end)>=0?null:h(e.start,t)?`start`:h(e.end,t)?`end`:m(t,e.start)>0&&m(t,e.end)<0?`in-range`:null}function j(e){return k(e).at(0)??null}function le(e,t){let n={};if((e.calendar||t.calendar)&&(n.calendar={...e.calendar,...t.calendar}),e.ui||t.ui){let r={...e.ui,...t.ui};(e.ui?.inline||t.ui?.inline)&&(r.inline={...e.ui?.inline,...t.ui?.inline}),(e.ui?.yearRange||t.ui?.yearRange)&&(r.yearRange={...e.ui?.yearRange,...t.ui?.yearRange}),n.ui=r}return(e.labels||t.labels)&&(n.labels={...e.labels,...t.labels}),(e.behavior||t.behavior)&&(n.behavior={...e.behavior,...t.behavior}),(e.callbacks||t.callbacks)&&(n.callbacks={...e.callbacks,...t.callbacks}),n}let ue=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]),de=/[]/g,fe=/^(d{1,2}|M{1,2}|yyyy|yy)([/. -])(d{1,2}|M{1,2}|yyyy|yy)\2(d{1,2}|M{1,2}|yyyy|yy)$/,pe=/^(M{1,2}|yyyy|yy)([/. -])(M{1,2}|yyyy|yy)$/,me=/* @__PURE__ */ new Map;function he(e){return e.startsWith(`d`)?`day`:e.startsWith(`M`)?`month`:`year`}function ge(e){let t=fe.exec(e);if(!t)return null;let n=[t[1],t[3],t[4]],r=n.map(he);return new Set(r).size===3?{order:r,separator:t.at(2)??`/`,padDay:n.includes(`dd`),padMonth:n.includes(`MM`),yearDigits:n.includes(`yy`)?2:4}:null}function _e(e){let t=pe.exec(e);if(!t)return null;let n=[t[1],t[3]],[r,i]=n.map(he);return r===i?null:{order:r===`month`?[`day`,`month`,`year`]:[`year`,`month`,`day`],separator:t.at(2)??`/`,padDay:!0,padMonth:n.includes(`MM`),yearDigits:n.includes(`yy`)?2:4}}function ve(e){return e!==`yyyy`&&e!==`yy`?null:{order:[`month`,`day`,`year`],separator:`/`,padDay:!0,padMonth:!0,yearDigits:e===`yy`?2:4}}function ye(e,t){let n=ge(e);if(n!==null||t===`day`)return n;let r=_e(e);return r!==null||t===`month`?r:ve(e)}function be(e,t=`day`){return e===`auto`||ye(e.trim(),t)!==null}function xe(e){let t={day:`2-digit`,month:`2-digit`,year:`numeric`,numberingSystem:`latn`,timeZone:`UTC`};try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(`en-US`,t)}}function Se(e){let t=xe(e).formatToParts(new Date(Date.UTC(2024,10,22,12))),n=[],r=``;for(let e of t)e.type===`day`||e.type===`month`||e.type===`year`?n.push(e.type):e.type===`literal`&&r===``&&(r=e.value.replace(de,``).trim());return{order:n.length===3?n:[`month`,`day`,`year`],separator:ue.has(r)?r:`/`,padDay:!0,padMonth:!0,yearDigits:4}}function Ce(e,t,n=`day`){let r=`${e}|${t}|${n}`,i=me.get(r);if(i)return i;let a=(e===`auto`?null:ye(e.trim(),n))??Se(t);return me.set(r,a),a}function we(e,t,n){switch(t){case`day`:return n.padDay?String(e.day).padStart(2,`0`):String(e.day);case`month`:return n.padMonth?String(e.month).padStart(2,`0`):String(e.month);default:return n.yearDigits===2?String(e.year%100).padStart(2,`0`):String(e.year).padStart(4,`0`)}}let Te={day:`dd`,month:`mm`,year:`yyyy`};function Ee(e){return{day:e.hintDay,month:e.hintMonth,year:e.hintYear}}function De(e,t=Te){return e.order.map(n=>n===`day`?t.day:n===`month`?t.month:e.yearDigits===2?t.year.slice(0,2):t.year).join(e.separator)}function Oe(e,t){return t.order.map(n=>we(e,n,t)).join(t.separator)}function M(){return typeof document<`u`}function ke(){return typeof window>`u`}let Ae=new Set(`AG AS BD BR BS BT BW BZ CA CO DM DO ET GT GU HK HN ID IL IN IS JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW`.split(` `)),je=new Set(`AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY`.split(` `)),Me=/* @__PURE__ */ new Set([`MV`]),Ne=/* @__PURE__ */ new Map,Pe=/* @__PURE__ */ new Map;function N(e,t){let n=Pe.get(t);if(n)return n.format(e);let r=new Intl.NumberFormat(t,{useGrouping:!1});return Pe.set(t,r),r.format(e)}function P(e,t){let n=`${e}|${JSON.stringify(t)}`,r=Ne.get(n);if(r)return r;let i=new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`});return Ne.set(n,i),i}function F(e,t,n){let r=new Date(Date.UTC(2e3,0,1,12));return r.setUTCFullYear(e,t-1,n),r}function Fe(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 5:return 5;case 6:return 6;default:return null}}function Ie(e){if(!(`getWeekInfo`in e))return null;let t=Reflect.get(e,`getWeekInfo`);if(typeof t!=`function`)return null;let n=Reflect.apply(t,e,[]);if(typeof n!=`object`||!n||!(`firstDay`in n))return null;let r=n.firstDay;return typeof r==`number`?Fe(r===7?0:r):null}function Le(e){return e===void 0?1:Ae.has(e)?0:je.has(e)?6:Me.has(e)?5:1}function Re(e){try{let t=new Intl.Locale(e),n=Ie(t);return n===null?Le(t.maximize().region):n}catch{return 1}}function ze(e){try{return Intl.getCanonicalLocales(e).length>0}catch{return!1}}let Be=e=>{let t=e?.trim();return!t||!ze(t)?null:t};function Ve(e){let t=Be(e);if(t!==null)return t;if(M()){let e=Be(document.documentElement.lang);if(e!==null)return e}if(typeof navigator<`u`){let e=Be(navigator.language);if(e!==null)return e}return`en-US`}function I(e,t){let n=P(e,{month:t});return Array.from({length:12},(e,t)=>n.format(F(2024,t+1,1)))}function He(e,t){let n=P(e,{weekday:t});return Array.from({length:7},(e,t)=>n.format(F(2024,1,7+t)))}function Ue(e,t){return P(t,{weekday:`short`,month:`short`,day:`numeric`}).format(F(e.year,e.month,e.day))}function We(e,t){return P(t,{month:`short`,day:`numeric`}).format(F(e.year,e.month,e.day))}function Ge(e,t,n){return P(n,{month:`short`,day:`numeric`}).formatRange(F(e.year,e.month,e.day),F(t.year,t.month,t.day))}function Ke(e,t){return P(t,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`}).format(F(e.year,e.month,e.day))}function qe(e,t){return P(t,{month:`long`,year:`numeric`}).format(F(e.year,e.month,1))}function Je(e,t,n){return e.year===t.year&&e.month===t.month?qe(e,n):P(n,{month:`long`,year:`numeric`}).formatRange(F(e.year,e.month,1),F(t.year,t.month,1))}function Ye(e,t,n,r){switch(t){case`day`:return r===`headline`?Ue(e,n):Ke(e,n);case`month`:return qe(e,n);default:return N(e.year,n)}}function Xe(e,t){switch(t){case`sunday`:return 0;case`monday`:return 1;case`saturday`:return 6;default:return Re(e)}}let L={title:`Select date`,monthTitle:`Select month`,yearTitle:`Select year`,noDate:`No date selected`,confirm:`OK`,cancel:`Cancel`,today:`Today`,clear:`Clear`,openCalendar:`Choose date`,previousMonth:`Previous month`,nextMonth:`Next month`,previousYear:`Previous year`,nextYear:`Next year`,chooseMonth:`Choose month`,chooseYear:`Choose year`,weekNumber:`Week`,invalidDate:`Enter a valid date`,unavailableDate:`This date is not available`,rangeTitle:`Select dates`,rangeStart:`Start`,rangeEnd:`End`,multipleSelected:`{count} selected`,save:`Save`,close:`Close`,switchToInput:`Switch to text input`,switchToCalendar:`Switch to calendar`,dateField:`Date`,startDateField:`Start date`,endDateField:`End date`,invalidRange:`End date must be on or after the start date`,beforeMinDate:`Enter a date on or after {date}`,afterMaxDate:`Enter a date on or before {date}`,presets:`Presets`,pageUpKey:`Page Up`,pageDownKey:`Page Down`,shiftKey:`Shift`,hintDay:`dd`,hintMonth:`mm`,hintYear:`yyyy`},R={calendar:{weekStart:`auto`,mode:`single`,precision:`day`,months:1,pageBy:`view`,presets:[]},ui:{displayMode:`auto`,inline:{enabled:!1},format:`auto`,theme:`basic`,colorScheme:`auto`,weekNumbers:!1,outsideDays:!1,fixedWeeks:!1,yearRange:{before:100,after:20},todayButton:!1,clearButton:!1,animation:!0,allowPageScroll:!1,fullscreen:!0,cssClass:``,swipe:!0,viewSwitch:!0,initialView:`calendar`,mask:!1,startView:`day`},labels:L,behavior:{closeOnSelect:!1,closeOnCancel:!0,commitOnChange:!1,ignoreOutsideClick:!1,returnFocus:!0}};function Ze(e,t){return e instanceof Date?e:typeof e!=`string`||e===`today`&&!t?null:e}function Qe(e,t,n,r){if(e===void 0)return null;let i=Ze(e,t),a=i===null?null:C(i);return a===null&&r.push({option:n,value:e}),a}function $e(e,t,n){return e===void 0?null:Array.isArray(e)?e.map(e=>Qe(e,!1,t,n)).filter(e=>e!==null):(n.push({option:t,value:e}),null)}function z(e,t,n,r,i){if(e===void 0)return n;let a=t(e);return a===void 0?(i.push({option:r,value:e}),n):a}let B=e=>typeof e==`boolean`?e:void 0,et=e=>typeof e==`string`?e:void 0,tt=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,nt=e=>typeof e==`number`&&Number.isInteger(e)&&e>=1?e:void 0,rt=e=>{if(typeof e==`function`)return t=>Reflect.apply(e,void 0,[t])},it=e=>{if(typeof e==`function`)return t=>Reflect.apply(e,void 0,[t])},at=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.entries(e),n={};for(let[e,r]of t){if(typeof r!=`string`)return;n[e]=r}return t.length>0?n:void 0},ot=e=>typeof HTMLElement<`u`&&e instanceof HTMLElement||typeof e==`string`&&e.length>0?e:void 0;function V(e){return t=>e.find(e=>e===t)}function st(e){return t=>typeof t==`string`&&be(t,e)?t:void 0}let ct=V([`auto`,`docked`,`modal`]),lt=V([`auto`,`light`,`dark`]),ut=V([`auto`,`sunday`,`monday`,`saturday`]),dt=V([`single`,`range`,`multiple`]),ft=V([`calendar`,`input`]),pt=V([`day`,`month`,`year`]),mt=V([`month`,`view`]),ht=V([`day`,`month`,`year`]),gt=V([`basic`,`m3-green`,`crane`,`crane-straight`,`m2`,`glassmorphic`,`pastel`,`ai`,`cyberpunk`,`blueprint`]);function _t(e){return e in L}function vt(e,t){let n={...L};for(let r of Object.keys(L))_t(r)&&r!==`multipleSelected`&&(n[r]=z(e?.[r],et,L[r],`labels.${r}`,t));return n.multipleSelected=z(e?.multipleSelected,at,L.multipleSelected,`labels.multipleSelected`,t),n}function yt(e,t){return e===void 0||e===!0?600:e===!1?0:z(e,nt,600,`ui.fullscreen`,t)}function bt(e,t){return e===void 0||e===!1?!1:e===!0?{selectable:!0}:typeof e==`object`&&e?{selectable:z(Reflect.get(e,`selectable`),B,!0,`ui.outsideDays.selectable`,t)}:(t.push({option:`ui.outsideDays`,value:e}),!1)}function xt(e,t){return e===void 0||e===!1?!1:e===!0?{clearInput:!0}:typeof e==`object`&&e?{clearInput:z(Reflect.get(e,`clearInput`),B,!0,`ui.clearButton.clearInput`,t)}:(t.push({option:`ui.clearButton`,value:e}),!1)}let St=`calendar.range.presets`;function Ct(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`label`),n=Reflect.get(e,`value`);return typeof t!=`string`||t===``?null:typeof n==`function`?{label:t,value:()=>Reflect.apply(n,void 0,[])}:typeof n==`object`&&n?{label:t,value:()=>n}:null}function wt(e,t){if(e===void 0)return R.calendar.presets;if(!Array.isArray(e))return t.push({option:St,value:e}),R.calendar.presets;let n=e,r=[];for(let e of n){let n=Ct(e);n===null?t.push({option:St,value:e}):r.push(n)}return r}function Tt(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6}function Et(e,t){let n=e?.trim();n&&!ze(n)&&t.push({option:`calendar.locale`,value:e})}function Dt(e,t){if(e===void 0)return[];if(!Array.isArray(e))return t.push({option:`calendar.disabledWeekdays`,value:e}),[];let n=e,r=[];for(let e of n)Tt(e)?r.includes(e)||r.push(e):t.push({option:`calendar.disabledWeekdays`,value:e});return r}function Ot(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`className`),n=Reflect.get(e,`badge`),r=Reflect.get(e,`label`);return{...typeof t==`string`?{className:t}:{},...typeof n==`boolean`?{badge:n}:{},...typeof r==`string`?{label:r}:{}}}function kt(e){return typeof e==`string`||typeof Node<`u`&&e instanceof Node?e:null}function At(t){return t===null?null:n=>{try{return kt(t(n))}catch(t){return e(t),null}}}function jt(t){return t===null?null:n=>{try{let e=t(n);return typeof e!=`string`||e.length===0?null:e}catch(t){return e(t),null}}}function Mt(e,t,n){let r=R.calendar,i=z(e,pt,r.precision,`calendar.precision`,n);return i!==`day`&&t!==`single`?(n.push({option:`calendar.precision`,value:e}),r.precision):i}function Nt(e,t){let n=z(e?.range?.minLength,nt,null,`calendar.range.minLength`,t),r=z(e?.range?.maxLength,nt,null,`calendar.range.maxLength`,t),i=z(e?.multiple?.max,nt,null,`calendar.multiple.max`,t);return n!==null&&r!==null&&n>r?(t.push({option:`calendar.range`,value:e?.range}),{minLength:n,maxLength:null,multipleMax:i}):{minLength:n,maxLength:r,multipleMax:i}}function Pt(e,t){let n=R.calendar;Et(e?.locale,t);let r=Ve(e?.locale),i=z(e?.weekStart,ut,n.weekStart,`calendar.weekStart`,t),a=z(e?.isDateDisabled,rt,null,`calendar.isDateDisabled`,t),o=z(e?.decorateDate,rt,null,`calendar.decorateDate`,t),s=z(e?.renderDate,rt,null,`calendar.renderDate`,t),c=z(e?.validate,it,null,`calendar.validate`,t),l=z(e?.mode,dt,n.mode,`calendar.mode`,t);return{locale:r,weekStart:Xe(r,i),minDate:Qe(e?.minDate,!0,`calendar.minDate`,t),maxDate:Qe(e?.maxDate,!0,`calendar.maxDate`,t),disabledDates:$e(e?.disabledDates,`calendar.disabledDates`,t)??[],enabledDates:$e(e?.enabledDates,`calendar.enabledDates`,t),mode:l,precision:Mt(e?.precision,l,t),months:z(e?.months,nt,n.months,`calendar.months`,t),pageBy:z(e?.pageBy,mt,n.pageBy,`calendar.pageBy`,t),limits:Nt(e,t),presets:wt(e?.range?.presets,t),isDateDisabled:a===null?null:e=>!!a(e),disabledWeekdays:Dt(e?.disabledWeekdays,t),decorateDate:o===null?null:e=>Ot(o(e)),renderDate:At(s),validate:jt(c)}}function Ft(e){let t=[],n=R,r=e?.calendar,i=e?.ui,a=e?.behavior,o=(e,n,r,i)=>z(e,n,r,i,t),s=Pt(r,t),{locale:c,precision:l}=s,u=o(i?.format,st(l),n.ui.format,`ui.format`),d=o(i?.footer,B,!1,`ui.footer`),f=a?.id;return{...s,displayMode:o(i?.displayMode,ct,n.ui.displayMode,`ui.displayMode`),inline:{enabled:o(i?.inline?.enabled,B,n.ui.inline.enabled,`ui.inline.enabled`),container:o(i?.inline?.container,ot,null,`ui.inline.container`)},pattern:Ce(u,c,l),theme:o(i?.theme,gt,n.ui.theme,`ui.theme`),colorScheme:o(i?.colorScheme,lt,n.ui.colorScheme,`ui.colorScheme`),toggleButton:o(i?.toggleButton,ot,null,`ui.toggleButton`),endInput:o(i?.endInput,ot,null,`ui.endInput`),weekNumbers:o(i?.weekNumbers,B,n.ui.weekNumbers,`ui.weekNumbers`),outsideDays:bt(i?.outsideDays,t),fixedWeeks:o(i?.fixedWeeks,B,n.ui.fixedWeeks,`ui.fixedWeeks`),yearRange:{before:o(i?.yearRange?.before,tt,n.ui.yearRange.before,`ui.yearRange.before`),after:o(i?.yearRange?.after,tt,n.ui.yearRange.after,`ui.yearRange.after`)},todayButton:o(i?.todayButton,B,n.ui.todayButton,`ui.todayButton`),clearButton:xt(i?.clearButton,t),footerExplicit:typeof i?.footer==`boolean`?d:null,animation:o(i?.animation,B,n.ui.animation,`ui.animation`),allowPageScroll:o(i?.allowPageScroll,B,n.ui.allowPageScroll,`ui.allowPageScroll`),fullscreenBelow:yt(i?.fullscreen,t),cssClass:o(i?.cssClass,et,n.ui.cssClass,`ui.cssClass`),appendTo:o(i?.appendTo,ot,null,`ui.appendTo`),swipe:o(i?.swipe,B,n.ui.swipe,`ui.swipe`),viewSwitch:o(i?.viewSwitch,B,n.ui.viewSwitch,`ui.viewSwitch`),initialView:o(i?.initialView,ft,n.ui.initialView,`ui.initialView`),mask:o(i?.mask,B,n.ui.mask,`ui.mask`),startView:o(i?.startView,ht,n.ui.startView,`ui.startView`),labels:vt(e?.labels,t),behavior:{closeOnSelect:o(a?.closeOnSelect,B,n.behavior.closeOnSelect,`behavior.closeOnSelect`),closeOnCancel:o(a?.closeOnCancel,B,n.behavior.closeOnCancel,`behavior.closeOnCancel`),commitOnChange:o(a?.commitOnChange,B,n.behavior.commitOnChange,`behavior.commitOnChange`),ignoreOutsideClick:o(a?.ignoreOutsideClick,B,n.behavior.ignoreOutsideClick,`behavior.ignoreOutsideClick`),returnFocus:o(a?.returnFocus,B,n.behavior.returnFocus,`behavior.returnFocus`),id:typeof f==`string`&&f.length>0?f:null},callbacks:{...e?.callbacks},issues:t}}let It=/[^\w-]/g,Lt=0;function Rt(e){return e.replace(It,`-`)}function zt(e){return{year:e.year,month:e.month}}var Bt=class{input;host;createdHost;instanceId;events=new t;raw;resolved;currentValue;currentDraft;currentView;currentFocus;currentPanel;currentMode=null;currentLayout={months:1,presets:`none`};currentActiveEnd=`start`;currentEndInput=null;activeEndControlled=!1;constructor(e,t,n,r){this.input=e,this.host=t,this.createdHost=n,this.raw=le({},r??{}),this.resolved=Ft(this.raw),Lt+=1;let i=this.resolved.behavior.id;this.instanceId=i===null?`dp-ui-${String(Lt)}`:Rt(i),this.currentPanel=E(this.resolved.precision),this.currentValue=O(this.resolved.mode),this.currentDraft=this.currentValue;let a=S();this.currentFocus=a,this.currentView=zt(a)}get options(){return this.resolved}get rawOptions(){return this.raw}setOptions(e){this.raw=le(this.raw,e),this.resolved=Ft(this.raw),this.events.emit(`change:options`,{})}get value(){return this.currentValue}setValue(e){this.currentValue=e,this.events.emit(`change:value`,{value:e})}get draft(){return this.currentDraft}setDraft(e){this.currentDraft=e,this.events.emit(`change:draft`,{draft:e})}get view(){return this.currentView}setView(e,t,n){let r=zt(e);this.currentView=r,this.events.emit(`change:view`,{view:r,delta:t,source:n})}get focus(){return this.currentFocus}setFocus(e){this.currentFocus=e,this.events.emit(`change:focus`,{focus:e})}get panel(){return this.currentPanel}setPanel(e){e!==this.currentPanel&&(this.currentPanel=e,this.events.emit(`change:panel`,{panel:e}))}get mode(){return this.currentMode}setMode(e){this.currentMode=e}get layout(){return this.currentLayout}setLayout(e){this.currentLayout=e}get activeEnd(){return this.currentActiveEnd}setActiveEnd(e){e!==this.currentActiveEnd&&(this.currentActiveEnd=e,this.events.emit(`change:active-end`,{end:e}))}controlActiveEnd(){this.activeEndControlled=!0}get followsActiveEnd(){return this.currentEndInput!==null||this.activeEndControlled}get endInput(){return this.currentEndInput}setEndInput(e){this.currentEndInput=e}resetSession(){let e=j(this.currentValue)??S(),t=zt(e);this.setPanel(E(this.resolved.precision)),this.setDraft(this.currentValue),this.setView(t,y(this.currentView,t),`api`),this.setFocus(e)}};let Vt=`dp-ui`,Ht=[`class`,`name`,`aria-invalid`,`aria-describedby`];function Ut(e){return typeof e==`string`?document.querySelector(e):e}function Wt(e){return e instanceof HTMLInputElement?e:e?.querySelector(`input`)??null}function Gt(e){let t=document.createElement(`div`);return t.className=Vt,e.before(t),t.append(e),t}function Kt(e){if(!M())throw Error(`DatepickerUI needs a document`);let t=Ut(e),n=Wt(t);if(n===null)throw Error(`DatepickerUI could not find an input element`);let r=n.parentElement;return r!==null&&(t!==n||r.classList.contains(Vt))?{input:n,host:r,createdHost:!1}:{input:n,host:Gt(n),createdHost:!0}}function qt(e){let{input:t,host:n,createdHost:r}=e,i=/* @__PURE__ */ new Map;for(let e of Ht)i.set(e,t.getAttribute(e));let a=n.classList.contains(Vt);return n.classList.add(Vt),{target:{input:t,host:n,createdHost:r},hostHadClass:a,inputAttributes:i}}function Jt(e){let{input:t,host:n,createdHost:r}=e.target;for(let[n,r]of e.inputAttributes)r===null?t.removeAttribute(n):t.setAttribute(n,r);r?t.parentNode===n?n.replaceWith(t):n.remove():e.hostHadClass||n.classList.remove(Vt)}function Yt(e,t,n,r){let i=y(e,t);return i>=0&&i<n?e:r===`month`?i<0?t:v(t,-(n-1)):v(e,Math.floor(i/n)*n)}function Xt(e,t,n){let r={year:t.year,month:t.month,day:Math.min(n,b(t))},{minDate:i,maxDate:a}=e.core.options;return i!==null&&m(r,i)<0?i:a!==null&&m(r,a)>0?a:r}function Zt(e,t,n){let{core:r,managers:i}=e,a=i.validation.clampView(t),o=y(r.view,a);return o!==0&&(r.setView(a,o,n),r.setFocus(Xt(e,a,r.focus.day))),a}function H(e,t,n){let{core:r,managers:i}=e,a={year:t.year,month:t.month},{months:o}=r.layout,s=i.validation.clampView(Yt(r.view,a,o,r.options.pageBy)),c=y(s,a);if(c<0||c>=o)return;let l=y(r.view,s);l!==0&&r.setView(s,l,n),r.setFocus(t)}let Qt=/[٠-٩۰-۹]/g,$t=/[]/g,en=/[\s./-]+/,tn=/^\d+$/,nn=/^\d{8}$/;function rn(e){let t=e.charCodeAt(0);return String(t-(t>=1776?1776:1632))}function an(e){return e.replace($t,``).replace(Qt,rn).trim()}function on(e,t){if(nn.test(e)){let n=[],r=0;for(let i of t){let t=i===`year`?4:2;n.push(e.slice(r,r+t)),r+=t}return n}let n=e.split(en).filter(e=>e!==``);return n.length!==3||!n.every(e=>tn.test(e))?null:n}function sn(e){let t=an(e).split(en).filter(e=>e!==``);return t.every(e=>tn.test(e))?t:null}function cn(e){if(e.length===4)return Number(e);if(e.length!==2)return null;let t=2e3+Number(e);return t<=S().year+20?t:1900+Number(e)}function ln(e,t){let n=on(an(e),t.order);if(n===null)return null;let r=0,i=0,a=0;for(let[e,o]of t.order.entries()){let t=n[e]??``;if(o===`year`)a=cn(t);else if(t.length>2)return null;else o===`day`?r=Number(t):i=Number(t)}return a===null?null:l(a,i,r)}let un=/^(\d{4})-(\d{2})$/,dn=/^\d{4}$/;function fn(e,t){switch(t){case`day`:return e;case`month`:return{year:e.year,month:e.month,day:1};default:return{year:e.year,month:1,day:1}}}function pn(e,t){let n=p(e);switch(t){case`day`:return n;case`month`:return n.slice(0,7);default:return n.slice(0,4)}}function mn(e,t){let n=f(e);if(n!==null||t===`day`)return n===null?null:fn(n,t);if(t===`month`){let t=un.exec(e);return t?l(Number(t[1]),Number(t[2]),1):null}return dn.test(e)?l(Number(e),1,1):null}function hn(e,t){return{...e,order:e.order.filter(e=>e===`year`||t===`month`&&e===`month`)}}function U(e,t,n){return n===`day`?Oe(e,t):Oe(e,hn(t,n))}function gn(e,t,n){return De(t===`day`?e:hn(e,t),n)}function _n(e,t,n){if(n===`day`)return ln(e,t);let{order:r}=hn(t,n),i=sn(e);if(i?.length!==r.length)return null;let a=1,o=null;for(let[e,t]of r.entries()){let n=i[e]??``;if(t===`year`)o=cn(n);else if(n.length>2)return null;else a=Number(n)}return o===null?null:l(o,a,1)}function vn(e,t,n){let r=_(e,t)+1;return n.minLength!==null&&r<n.minLength?!1:n.maxLength===null||r<=n.maxLength}function yn(e,t,n,r){let i=r;if(t.maxLength!==null){let n=g(e,t.maxLength-1);i=m(n,r)<0?n:r}for(let t=g(e,1);m(t,i)<=0;t=g(t,1))if(n(t))return t;return null}function bn(e,t,n,r){if(e.mode===`multiple`){let{multipleMax:n}=t,{dates:r}=e;return t=>n!==null&&r.length>=n&&!se(e,t)}if(e.mode!==`range`||e.start===null||e.end!==null)return()=>!1;let{start:i}=e,a=null,o=!1;return e=>m(e,i)<0?!1:m(e,r)>0||!vn(i,e,t)||(o||=(a=yn(i,t,n,r),!0),a!==null&&m(e,a)>=0)}function xn(e,t,n,r){if(!vn(e,t,n))return`range-length`;for(let n=e;m(n,t)<=0;n=g(n,1)){let e=r(n);if(e!==null)return e}return null}function Sn(e,t){for(let n of e){let e=t(n);if(e!==null)return e}return null}function Cn(e,t,n){switch(e.mode){case`single`:return e.date===null?null:n(e.date);case`range`:return e.start!==null&&e.end!==null?xn(e.start,e.end,t,n):e.start===null?null:n(e.start);default:return t.multipleMax!==null&&e.dates.length>t.multipleMax?`multiple-max`:Sn(e.dates,n)}}function wn(e,t,n){return Cn(e,t,e=>n(e)?`disabled`:null)===null}function Tn(e,t,n){return e.some(e=>m(e,t)===0)?e.filter(e=>m(e,t)!==0):n.multipleMax!==null&&e.length>=n.multipleMax?null:re([...e,t])}function En(e){return e.mode===`range`&&e.start!==null&&e.end===null?`end`:`start`}function Dn(e,t){return e.mode===`range`?t===`start`?{mode:`range`,start:null,end:null}:{mode:`range`,start:e.start,end:null}:e}function On(e,t,n,r){switch(e.mode){case`single`:return{mode:`single`,date:t};case`range`:return r===`start`||e.start===null||m(t,e.start)<0?{mode:`range`,start:t,end:null}:{mode:`range`,start:e.start,end:t};default:{let r=Tn(e.dates,t,n);return r===null?e:{mode:`multiple`,dates:r}}}}var kn=class{context;session;values;constructor(e,t,n){this.context=e,this.session=t,this.values=n}isOpen(){return this.session.active}select(e){let{core:t,managers:n}=this.context,r=fn(e,t.options.precision),i=t.followsActiveEnd?t.activeEnd:En(t.draft);if(!this.session.active||!n.validation.isSelectable(r,Dn(t.draft,i)))return;H(this.context,r,`button`);let a=On(t.draft,r,t.options.limits,i);t.setDraft(a),t.setActiveEnd(En(a)),this.announce(a,r),this.isOpen()&&this.autoCommit(a)}selectRange(e,t){let{core:n,managers:r}=this.context,{mode:i,limits:a}=n.options;if(!this.session.active||i!==`range`)return;let o={mode:`range`,start:e,end:t};Cn(o,a,e=>r.validation.unavailableReason(e))===null&&(n.setDraft(o),n.setActiveEnd(`start`),H(this.context,e,`api`),this.emitRangeEnd(e,t),this.isOpen()&&this.autoCommit(o))}typeDraft(e){let{core:t,managers:n}=this.context,{mode:r,limits:i}=t.options,a=e.mode===r&&wn(e,i,e=>n.validation.isDisabled(e));if(!this.session.active||!a)return;t.setDraft(e);let o=j(e);o!==null&&H(this.context,o,`api`)}announce(e,t){let{emitter:n}=this.context,{describe:r}=this.values;n.emit(`select:day`,{value:r(t),selected:se(e,t)}),e.mode===`range`&&(e.start===null||e.end===null?n.emit(`range:start`,{value:r(t)}):this.emitRangeEnd(e.start,e.end))}emitRangeEnd(e,t){let{describe:n}=this.values;this.context.emitter.emit(`range:end`,{start:n(e),end:n(t)})}autoCommit(e){if(e.mode===`range`&&e.end===null)return;let{closeOnSelect:t,commitOnChange:n}=this.context.core.options.behavior,r=t&&e.mode!==`multiple`;(r||n)&&this.values.commit(!0),r&&this.session.close()}},An=class{context;session;values;selector;constructor(e,t,n){this.context=e,this.session=t,this.values=n,this.selector=new kn(e,t,n)}isOpen(){return this.session.active}select(e){this.selector.select(e)}selectRange(e,t){this.selector.selectRange(e,t)}typeDraft(e){this.selector.typeDraft(e)}focusDate(e){this.session.active&&H(this.context,e,`keyboard`)}navigate(e,t){this.session.active&&Zt(this.context,v(this.context.core.view,e),t)}page(e,t){let{core:n}=this.context,r=n.options.pageBy===`view`?n.layout.months:1;this.navigate(e*r,t)}jumpTo(e,t){if(!this.session.active)return;let{core:n}=this.context,r=n.panel,i=Zt(this.context,e,t);t===`menu`&&(n.setPanel(E(n.options.precision)),this.announcePick(r,i))}showPanel(e){this.session.active&&this.context.core.setPanel(e)}confirm(){this.session.active&&ie(this.context.core.draft)&&(this.values.commit(!1),this.session.close())}cancel(e){if(!this.session.active)return;let{core:t,emitter:n}=this.context;n.emit(`cancel`,{reason:e}),this.isOpen()&&((t.options.behavior.closeOnCancel||e!==`button`)&&t.mode!==`inline`?this.session.close():t.setDraft(t.value))}today(){if(!this.session.active)return;let{core:e,managers:t}=this.context,n=S();t.validation.isSelectable(n,e.draft)?this.select(n):H(this.context,n,`button`)}clear(){if(!this.session.active)return;let{core:e}=this.context;e.setDraft(O(e.options.mode));let{clearButton:t}=e.options;t!==!1&&t.clearInput&&(this.values.commit(!1),this.session.close())}announcePick(e,t){let{emitter:n}=this.context;e===`month-menu`||e===`month-grid`?n.emit(`select:month`,{year:t.year,month:t.month}):(e===`year-menu`||e===`year-grid`)&&n.emit(`select:year`,{year:t.year})}},jn=class{context;subscriptions=[];constructor(e){this.context=e}bind(){for(let e of this.subscriptions)e();this.subscriptions=[];let{callbacks:e}=this.context.core.options;this.add(`open`,e.onOpen),this.add(`close`,e.onClose),this.add(`cancel`,e.onCancel),this.add(`confirm`,e.onConfirm),this.add(`update`,e.onUpdate),this.add(`error`,e.onError),this.add(`select:day`,e.onSelectDay),this.add(`select:month`,e.onSelectMonth),this.add(`select:year`,e.onSelectYear),this.add(`range:start`,e.onRangeStart),this.add(`range:end`,e.onRangeEnd),this.add(`navigate`,e.onNavigate)}add(e,t){t!==void 0&&this.subscriptions.push(this.context.emitter.on(e,t))}};function W(e,t){return e===null?null:typeof e==`string`?M()?t?.querySelector(e)??document.querySelector(e):null:e}function G(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n&&Object.entries(n).forEach(([e,t])=>{r.setAttribute(e,t)}),r}function Mn(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();n===`center`?e.scrollTop+=i.top-r.top-(r.height-i.height)/2:i.top<r.top?e.scrollTop+=i.top-r.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)}function Nn(e,t,n){let r=G(`button`,e,{type:`button`});return n?(r.setAttribute(`aria-label`,t),r.innerHTML=n):r.textContent=t,r}let Pn=[`class`,`name`,`aria-invalid`];function Fn(e){let{core:t,emitter:n}=e,{endInput:r,mode:i}=t.options;if(i!==`range`||r===null)return null;let a=W(r,t.host);return a instanceof HTMLInputElement&&a!==t.input?a:(n.emit(`error`,{code:`invalid-option`,message:`ui.endInput does not match an input element`,option:`ui.endInput`}),null)}function In(e){let t=/* @__PURE__ */ new Map;for(let n of Pn)t.set(n,e.getAttribute(n));return()=>{for(let[n,r]of t)r===null?e.removeAttribute(n):e.setAttribute(n,r)}}let Ln=[`calendar`,`ui`,`labels`,`behavior`,`callbacks`];function Rn(e){let t=[];for(let n of Ln){let r=e[n];if(r!==void 0)for(let e of Object.keys(r))t.push(`${n}.${e}`)}return t}function zn(e,t){return e.some(e=>t.option===e||t.option.startsWith(`${e}.`))}function Bn(e,t){for(let n of t)e.emitter.emit(`error`,{code:`invalid-option`,message:`Invalid value for option ${n.option}`,option:n.option})}var Vn=class{context;session;callbacks;triggers;constructor(e,t,n,r){this.context=e,this.session=t,this.callbacks=n,this.triggers=r}apply(e){let{core:t,emitter:n,status:r}=this.context;if(r.destroyed)return;let i=t.options;t.setOptions(e),t.options.mode!==i.mode&&this.resetSelection(),r.created&&this.reapply(i,e),n.emit(`update`,{options:e})}resetSelection(){let{core:e,managers:t,status:n}=this.context,r=O(e.options.mode);e.setValue(r),e.setDraft(r),n.created&&(t.input.write(r),t.form.sync())}reapply(e,t){let{core:n,managers:r}=this.context;this.callbacks.bind(),r.theme.applyHost(),this.triggers.bind(),A(n.value)||r.input.write(n.value),r.triggers.updateLabel(),this.refreshSurface(e);let i=Rn(t);Bn(this.context,n.options.issues.filter(e=>zn(i,e)))}refreshSurface(e){let{core:t,managers:n}=this.context,r=t.options;if(r.inline.enabled!==e.inline.enabled||r.inline.enabled&&r.inline.container!==e.inline.container){this.session.end(),r.inline.enabled&&this.session.mountInline();return}let i=t.mode;if(!this.session.active||i===null)return;let a=i===`inline`||r.displayMode===e.displayMode?i:this.session.pickMode();this.session.syncLayout(a),this.session.clampView(),a===i&&r.mode===e.mode?n.display.update():this.session.remount(a)}},Hn=class{context;session;callbacks;triggers;controller=new AbortController;hostSnapshot;restoreEndInput=null;constructor(e,t,n,r){this.context=e,this.session=t,this.callbacks=n,this.triggers=r,this.hostSnapshot=qt(e.core)}create(){let{core:e,managers:t,status:n}=this.context;if(n.created||n.destroyed)return;n.created=!0;let r=this.controller.signal;this.callbacks.bind(),t.theme.applyHost();let i=Fn(this.context);e.setEndInput(i),i!==null&&(this.restoreEndInput=In(i));let a=A(e.value)?t.input.readInitial():e.value;e.setValue(a),A(a)||t.input.write(a),t.form.bind(r),t.form.sync(),t.input.bind(r),this.triggers.bind(),t.triggers.updateLabel(),e.events.on(`change:value`,()=>{t.triggers.updateLabel()},r),e.options.inline.enabled&&this.session.mountInline(),Bn(this.context,e.options.issues)}destroy(e){let{core:t,emitter:n,managers:r,status:i}=this.context;i.destroyed||(i.destroyed=!0,this.session.teardown(),this.triggers.release(),this.controller.abort(),r.destroy(),e||(t.input.value=``,t.endInput!==null&&(t.endInput.value=``)),this.restoreEndInput?.(),this.restoreEndInput=null,t.setEndInput(null),Jt(this.hostSnapshot),t.events.clear(),n.clear())}},Un=class{tail=Promise.resolve();pending=0;stopped=!1;run(t){let n=async()=>{this.stopped||await t()},r=this.pending===0?n():this.tail.then(n);this.pending+=1;let i=r.catch(e).finally(()=>{--this.pending});return this.tail=i,i}stop(){this.stopped=!0}};function Wn(e){return e<0?-1:+(e>0)}var Gn=class{context;queue=new Un;controller=null;phase=`closed`;sessionId=0;closing=Promise.resolve();openedFrom=`start`;constructor(e){this.context=e}get active(){return this.phase===`open`}open(e,t=`start`){let{core:n,emitter:r,managers:i,status:a}=this.context;if(!a.created||a.destroyed||n.options.inline.enabled)return;if(this.phase===`open`){n.setActiveEnd(t);return}if(e!==`api`&&n.input.disabled)return;let o=this.pickMode();this.openedFrom=t,n.setActiveEnd(t),this.begin(o),i.triggers.setExpanded(!0),r.emit(`open`,{mode:o})}mountInline(){let{core:e,emitter:t}=this.context;W(e.options.inline.container)===null?t.emit(`error`,{code:`invalid-option`,message:`ui.inline.container does not match an element`,option:`ui.inline.container`}):(this.begin(`inline`),t.emit(`open`,{mode:`inline`}))}close(){return this.context.core.mode===`inline`?Promise.resolve():this.end()}end(){if(this.phase===`closing`)return this.closing;if(this.phase!==`open`)return Promise.resolve();let{core:e,emitter:t,managers:n}=this.context,r=e.mode,i=this.sessionId;this.phase=`closing`,this.stopListening(),n.triggers.setExpanded(!1);let a=this.queue.run(()=>n.display.unmount()).then(()=>{this.finish(i,r)});return this.closing=a,t.emit(`close`,{}),a}syncLayout(e){let{core:t}=this.context,n=t.options,r=window.innerWidth;if(e===`inline`){let e=W(n.inline.container)?.clientWidth??0;r=e>0?e:r}t.setLayout(ee({months:n.months,precision:n.precision,mode:n.mode,surface:e,fullscreen:ne(n.mode,e,window.innerWidth,n.fullscreenBelow),width:r,weekNumbers:n.weekNumbers,presets:n.presets.length}))}remount(e){let{core:t,managers:n}=this.context;this.syncLayout(e),t.setMode(e);let{mode:r,precision:i}=t.options;t.panel===`input`&&!T(r,e,i)&&t.setPanel(E(i)),this.queue.run(()=>n.display.unmount()),this.queue.run(()=>n.display.mount(e))}pickMode(){let{displayMode:e}=this.context.core.options;return te(e,!1,window.innerWidth,window.innerHeight)}clampView(){Zt(this.context,this.context.core.view,`api`)}teardown(){this.phase=`closed`,this.stopListening(),this.queue.stop()}begin(e){let{core:t,managers:n}=this.context;this.stopListening();let r=new AbortController;this.controller=r,this.sessionId+=1,this.phase=`open`,t.resetSession();let{initialView:i,mode:a,precision:o,startView:s}=t.options;i===`input`&&T(a,e,o)?t.setPanel(`input`):o===`day`&&a!==`range`&&s!==`day`&&t.setPanel(D(s,e)),this.syncLayout(e),this.clampView(),t.setMode(e),t.events.on(`change:view`,e=>{this.forwardNavigation(e)},r.signal),this.queue.run(()=>n.display.mount(e))}stopListening(){this.controller?.abort(),this.controller=null}finish(e,t){this.sessionId===e&&this.phase===`closing`&&(this.phase=`closed`,this.context.core.setMode(null),this.returnFocus(t))}returnFocus(e){let{core:t}=this.context;if(!t.options.behavior.returnFocus)return;let n=document.activeElement;(e===`modal`||n===null||n===document.body)&&((this.openedFrom===`end`?t.endInput:null)??t.input).focus({preventScroll:!0})}forwardNavigation(e){e.source!==`api`&&this.context.emitter.emit(`navigate`,{year:e.view.year,month:e.view.month,direction:Wn(e.delta),source:e.source})}},Kn=class{context;scope=null;constructor(e){this.context=e}bind(){this.release();let{core:e,managers:t}=this.context;if(e.options.inline.enabled)return;let n=new AbortController;this.scope=n,t.triggers.bind(n.signal)}release(){this.scope?.abort(),this.scope=null}};function qn(e,t){if(A(e))return null;switch(e.mode){case`single`:return e.date?t(e.date):null;case`range`:return e.start===null||e.end===null?null:{start:t(e.start),end:t(e.end)};default:return k(e).map(t)}}function Jn(e,t){if(typeof e==`string`)return mn(e,t);if(e instanceof Date){let n=C(e);return n===null?null:fn(n,t)}return null}function Yn(e){if(!(`start`in e&&`end`in e))return null;let t=Jn(e.start,`day`),n=Jn(e.end,`day`);return t===null||n===null||m(t,n)>0?null:{mode:`range`,start:t,end:n}}function Xn(e){let t=[];for(let n of e){let e=Jn(n,`day`);if(e===null)return null;t.push(e)}return{mode:`multiple`,dates:re(t)}}function Zn(e,t,n){if(e===null)return O(t);if(t===`multiple`)return Array.isArray(e)?Xn(e):null;if(t===`single`){let r=Jn(e,n);return r===null?null:{mode:t,date:r}}return typeof e==`object`&&!Array.isArray(e)&&!(e instanceof Date)?Yn(e):null}let Qn=[`start`,`end`];var $n=class{context;session;constructor(e,t){this.context=e,this.session=t}describe=e=>{let{pattern:t,precision:n}=this.context.core.options;return{value:pn(e,n),date:d(e),formatted:U(e,t,n)}};get(){return this.present(this.context.core.value)}set(e){let{core:t,emitter:n,managers:r,status:i}=this.context;if(i.destroyed)return;let a=Zn(e,t.options.mode,t.options.precision);a===null?n.emit(`error`,{code:`invalid-date`,message:`setValue() received a value that is not a valid date for calendar.mode`,input:typeof e==`string`?e:void 0}):(t.setValue(a),r.input.write(a),i.created&&r.form.sync(),this.follow(),this.validate(a))}setActiveEnd(e){let{core:t,status:n}=this.context,r=Qn;!n.destroyed&&t.options.mode===`range`&&r.includes(e)&&(t.controlActiveEnd(),t.setActiveEnd(e))}applyTyped(e){let{core:t,emitter:n,managers:r}=this.context,i=!oe(t.value,e);t.setValue(e),r.form.sync(),this.follow(),i&&n.emit(`confirm`,{value:this.present(e),autoCommit:!0}),this.validate(e)}commit(e){let{core:t,emitter:n,managers:r}=this.context,i=t.draft;t.setValue(i),r.input.write(i),r.form.sync(),r.form.dispatchCommit(),n.emit(`confirm`,{value:this.present(i),autoCommit:e}),this.validate(i)}validate(e){let{core:t,managers:n}=this.context,{validate:r}=t.options;if(r===null)return;let i=r(this.present(e));i!==null&&n.input.markInvalid(i)}present(e){return qn(e,this.describe)}follow(){if(!this.session.active)return;let{core:e}=this.context,t=e.value;e.setDraft(t);let n=j(t);n!==null&&H(this.context,n,`api`)}},er=class{status={created:!1,destroyed:!1};session;values;actions;instance;updates;constructor(e,t,n){let r={core:e,emitter:t,managers:n,status:this.status},i=new jn(r),a=new Kn(r);this.session=new Gn(r),this.values=new $n(r,this.session),this.actions=new An(r,this.session,this.values),this.instance=new Hn(r,this.session,i,a),this.updates=new Vn(r,this.session,i,a),n.connect(this)}get created(){return this.status.created}get destroyed(){return this.status.destroyed}create(){this.instance.create()}open(e,t){this.session.open(e,t)}close(){return this.session.close()}destroy(e){this.instance.destroy(e)}setOptions(e){this.updates.apply(e)}getValue(){return this.values.get()}setValue(e){this.values.set(e)}setActiveEnd(e){this.values.setActiveEnd(e)}applyTyped(e){this.values.applyTyped(e)}select(e){this.actions.select(e)}selectRange(e,t){this.actions.selectRange(e,t)}typeDraft(e){this.actions.typeDraft(e)}focusDate(e){this.actions.focusDate(e)}navigate(e,t){this.actions.navigate(e,t)}page(e,t){this.actions.page(e,t)}jumpTo(e,t){this.actions.jumpTo(e,t)}showPanel(e){this.actions.showPanel(e)}confirm(){this.actions.confirm()}cancel(e){this.actions.cancel(e)}today(){this.actions.today()}clear(){this.actions.clear()}};let tr=`dp-ui--pointer`,nr=[`Shift`,`Control`,`Alt`,`Meta`];function rr(){return ke()||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ir(e){return e?rr()?`reduced`:`full`:`none`}function ar(e,t){e.textContent=``,e.textContent=t}function or(e){let t=e.ownerDocument,n=()=>{e.classList.add(tr)},r=t=>{nr.includes(t.key)||e.classList.remove(tr)};return e.addEventListener(`pointerdown`,n,!0),t.addEventListener(`keydown`,r,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`keydown`,r,!0)}}let sr=`(prefers-color-scheme: dark)`,cr=/^(rgba?|color|oklch|oklab|lab|lch)\(([^)]*)\)$/,lr=/[\s,/]+/,ur=[`class`,`style`,`data-theme`,`data-color-scheme`],dr=e=>Math.min(1,Math.max(0,e)),fr=e=>{let t=dr(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},pr=(e,t,n)=>.2126*fr(e)+.7152*fr(t)+.0722*fr(n),mr=(e,t)=>{if(e===`none`)return 0;let n=parseFloat(e);return e.endsWith(`%`)?n/100*t:n},hr=(e,t)=>{let n=+(e===`color`);if(e===`color`&&t[0]!==`srgb`)return null;let r=mr(t[n]??``,e===`lab`||e===`lch`?100:1);switch(e){case`rgb`:case`rgba`:case`color`:{let r=e===`color`?1:255,[i=NaN,a=NaN,o=NaN]=[0,1,2].map(e=>mr(t[n+e]??``,r)/r);return pr(i,a,o)}case`oklab`:case`oklch`:return dr(r)**3;default:return dr((r+16)/116)**3}};function gr(e){let t=e.trim().toLowerCase();if(t===`transparent`)return{luminance:0,alpha:0};let n=cr.exec(t),r=n?.[1],i=n?.[2];if(r===void 0||i===void 0)return null;let a=i.split(lr).filter(e=>e!==``),o=r===`color`?4:3,s=a.length>o?mr(a[o],1):1,c=hr(r,a);return c===null||Number.isNaN(c)||Number.isNaN(s)?null:{luminance:c,alpha:dr(s)}}let _r=()=>{let e=getComputedStyle(document.documentElement).getPropertyValue(`color-scheme`);return e.includes(`dark`)?e.includes(`light`)?window.matchMedia(sr).matches?`dark`:`light`:`dark`:`light`};function vr(e){if(ke()||!M())return`light`;let t=e;for(;t!==null;){let e=gr(getComputedStyle(t).backgroundColor);if(e!==null&&e.alpha>=.5)return e.luminance<.179?`dark`:`light`;t=t.parentElement}return _r()}function yr(e){if(ke()||!M())return()=>void 0;let t=()=>{e()},n=new MutationObserver(t),r={attributes:!0,attributeFilter:ur};n.observe(document.documentElement,r),n.observe(document.body,r);let i=window.matchMedia(sr);return i.addEventListener(`change`,t),()=>{n.disconnect(),i.removeEventListener(`change`,t)}}let K={PAGER_SETTLE:350,DOCKED_HEIGHT:300,SELECT_FILL:150,HEADLINE_FADE:50,RIPPLE:450,SURFACE_ENTER:300,SURFACE_ENTER_FADE:100,SURFACE_ACTIONS_DELAY:150,SURFACE_EXIT:150,SCRIM_ENTER:150,SCRIM_EXIT:200,PANEL_FADE_OUT:100,PANEL_FADE_IN:200,WHEEL_SETTLE:90,VIEW_SWITCH:300,VIEW_SWITCH_FADE_OUT:75,VIEW_SWITCH_FADE_IN:150,REDUCED_FADE:150,SNAP_SCROLL_FALLBACK:700},q={DRAG_START_PX:6,COMMIT_FRACTION:.25,FLICK_VELOCITY:.4,VELOCITY_SAMPLES:5,MIN_SAMPLE_SPAN_MS:1},br={EMPHASIZED:`cubic-bezier(0.2, 0, 0, 1)`,EMPHASIZED_DECELERATE:`cubic-bezier(0.05, 0.7, 0.1, 1)`,EMPHASIZED_ACCELERATE:`cubic-bezier(0.3, 0, 0.8, 0.15)`},xr=e=>e.toLowerCase().replace(/_/g,`-`);function Sr(e,t){Object.entries(K).forEach(([n,r])=>{e.style.setProperty(`--dp-ui-motion-${xr(n)}`,`${String(t?r:0)}ms`)}),Object.entries(br).forEach(([t,n])=>{e.style.setProperty(`--dp-ui-easing-${xr(t)}`,n)})}let Cr=` – `,wr=/\s*[–—]\s*|\s+-\s+/,Tr=/[,;]/;function Er(e,t,n){return k(e).map(e=>U(e,t,n)).join(e.mode===`range`?Cr:`, `)}function Dr(e,t){let n=[];for(let r of e){let e=t(r);if(e===null)return null;n.push(e)}return n}function Or(e){if(e?.length!==2)return null;let[t,n]=e;return m(t,n)>0?null:{mode:`range`,start:t,end:n}}function kr(e,t,n,r,i){switch(t){case`single`:{let r=n(e);return r===null?null:{mode:t,date:r}}case`range`:return Or(Dr(e.split(r),n));default:{let r=Dr(e.split(i).filter(e=>e.trim()!==``),n);return r===null?null:{mode:t,dates:re(r)}}}}function Ar(e,t,n,r){let i=e.trim();return i===``?O(t):kr(i,t,e=>_n(e.trim(),n,r),wr,Tr)}function jr(e,t){return e.mode===`range`?e.start===null||e.end===null?``:`${pn(e.start,t)}/${pn(e.end,t)}`:k(e).map(e=>pn(e,t)).join(`,`)}function Mr(e,t,n){let r=e.trim();return r===``?O(t):kr(r,t,e=>mn(e.trim(),n),/\//,/,/)}function Nr(e,t,n){if(t===`range`)return e.rangeTitle;switch(n){case`month`:return e.monthTitle;case`year`:return e.yearTitle;case`day`:return e.title}}let Pr=/* @__PURE__ */ new Map,Fr=/* @__PURE__ */ new Map;function Ir(e){let t=Pr.get(e);if(t)return t;let n=new Intl.PluralRules(e);return Pr.set(e,n),n}function Lr(e){let t=Fr.get(e);if(t)return t;let n=new Intl.NumberFormat(e);return Fr.set(e,n),n}function Rr(e,t,n){return(typeof e==`string`?e:e[Ir(n).select(t)]??e.other??Object.values(e).at(0)??``).replaceAll(`{count}`,Lr(n).format(t))}function zr(e,t,n,r,i){switch(e.mode){case`single`:return e.date?Ye(e.date,i,n,`headline`):r.noDate;case`range`:{if(t===`input`&&e.start&&e.end)return Ge(e.start,e.end,n);let i=e.start?We(e.start,n):r.rangeStart,a=e.end?We(e.end,n):r.rangeEnd;return`${i}${Cr}${a}`}default:return e.dates.length===0?r.noDate:Rr(r.multipleSelected,e.dates.length,n)}}let Br=`dp-ui--ripple-pressed`,Vr=`dp-ui--ripple-active`,Hr=e=>e.getAttribute(`aria-disabled`)===`true`||e instanceof HTMLButtonElement&&e.disabled;function Ur(e,t,n){let r=e=>e instanceof Element?e.closest(t):null,i=e=>{r(e.target)?.classList.remove(Br)};e.addEventListener(`pointerdown`,t=>{let a=r(t.target);if(!a||!e.contains(a)||Hr(a)||t.pointerType===`mouse`&&t.button!==0)return;a.classList.remove(Vr);let{left:o,top:s,width:c,height:l}=a.getBoundingClientRect();a.style.setProperty(`--dp-ui-ripple-x`,`${String(t.clientX-o)}px`),a.style.setProperty(`--dp-ui-ripple-y`,`${String(t.clientY-s)}px`),a.style.setProperty(`--dp-ui-ripple-size`,`${String(Math.max(c,l)*2)}px`),a.style.setProperty(`--dp-ui-ripple-duration`,`${String(K.RIPPLE)}ms`),a.classList.add(Br),a.addEventListener(`pointerleave`,i,{once:!0,signal:n}),rr()||(requestAnimationFrame(()=>{a.classList.add(Vr)}),window.setTimeout(()=>{a.classList.remove(Vr)},K.RIPPLE))},{signal:n}),e.addEventListener(`pointerup`,i,{signal:n}),e.addEventListener(`pointercancel`,i,{signal:n})}let J={calendar:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Z"/></svg>`,pencil:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg>`,arrowDropDown:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M480-360 280-560h400L480-360Z"/></svg>`,keyboardArrowLeft:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"/></svg>`,keyboardArrowRight:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>`,check:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg>`},Wr=e=>{let t=t=>`${e.shiftKey}+${t}`;return{previousMonth:{keys:`PageUp`,display:e.pageUpKey},nextMonth:{keys:`PageDown`,display:e.pageDownKey},previousYear:{keys:`Shift+PageUp`,display:t(e.pageUpKey)},nextYear:{keys:`Shift+PageDown`,display:t(e.pageDownKey)},chooseMonth:{keys:`Shift+M`,display:t(`M`)},chooseYear:{keys:`Shift+Y`,display:t(`Y`)}}},Y=(e,t)=>`dp-ui-${e.replace(/[^\w-]/g,`-`)}-${t}`,Gr=(e,t,n)=>{n!==void 0&&(e.setAttribute(`title`,`${t} (${n.display})`),e.setAttribute(`aria-keyshortcuts`,n.keys))},Kr=(e,t)=>{let n=G(`span`);n.innerHTML=e;let r=n.firstElementChild;return r===null?null:(r.setAttribute(`class`,t),r.setAttribute(`aria-hidden`,`true`),r)},X=(e,t,n,r)=>{let i=Nn(`dp-ui__icon-button dp-ui__icon-button--${e}`,t,n);return i.firstElementChild?.setAttribute(`aria-hidden`,`true`),Gr(i,t,r),i},qr=(e,t,n)=>{let r=G(`button`,`dp-ui__menu-button dp-ui__menu-button--${e}`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":`false`,"aria-controls":n.controls});Gr(r,n.name,n.shortcut);let i=G(`span`,`dp-ui__menu-button-label`);r.append(i);let a=Kr(J.arrowDropDown,`dp-ui__menu-button-icon`);a!==null&&r.append(a);let o=(e,t=e)=>{i.textContent=e,r.setAttribute(`aria-label`,`${n.name}, ${t}`)};return o(t),{button:r,label:i,setText:o}},Jr=(e,t)=>Nn(`dp-ui__text-button dp-ui__text-button--${e}`,t),Yr=(e,t)=>{let n=X(`switch-view`,e.switchToInput,J.pencil);return{button:n,setInputView:r=>{n.innerHTML=r?J.calendar:J.pencil,n.firstElementChild?.setAttribute(`aria-hidden`,`true`),r?n.setAttribute(`aria-controls`,t):n.removeAttribute(`aria-controls`),n.setAttribute(`aria-label`,r?e.switchToCalendar:e.switchToInput)}}},Xr=(e,t)=>{e.querySelectorAll(`.dp-ui__text-button--confirm, .dp-ui__text-button--save`).forEach(e=>{e.disabled=!t})},Zr=e=>{let{labels:t}=e,n=G(`div`,`dp-ui__actions`);n.hidden=!e.visible;let r=G(`div`,`dp-ui__actions-start`);e.todayButton&&r.append(Jr(`today`,t.today)),e.clearButton&&r.append(Jr(`clear`,t.clear));let i=G(`div`,`dp-ui__actions-end`);return i.append(Jr(`cancel`,t.cancel),Jr(`confirm`,t.confirm)),n.append(r,i),n},Qr=[[`dp-ui__icon-button--prev-month`,{kind:`page`,direction:-1}],[`dp-ui__icon-button--next-month`,{kind:`page`,direction:1}],[`dp-ui__icon-button--prev-year`,{kind:`navigate`,delta:-12}],[`dp-ui__icon-button--next-year`,{kind:`navigate`,delta:12}],[`dp-ui__menu-button--month`,{kind:`panel`,panel:`month-menu`}],[`dp-ui__menu-button--year`,{kind:`panel`,panel:`year-menu`}],[`dp-ui__menu-button--year-grid`,{kind:`panel`,panel:`year-grid`}],[`dp-ui__text-button--today`,{kind:`today`}],[`dp-ui__text-button--clear`,{kind:`clear`}],[`dp-ui__text-button--cancel`,{kind:`cancel`}],[`dp-ui__text-button--confirm`,{kind:`confirm`}],[`dp-ui__text-button--save`,{kind:`confirm`}],[`dp-ui__icon-button--close`,{kind:`cancel`}],[`dp-ui__icon-button--switch-view`,{kind:`switch`}]],$r=e=>Qr.find(([t])=>e.classList.contains(t)),ei=e=>$r(e)?.[0]??null,ti=(e,t)=>{let{actions:n}=t;switch(e.kind){case`navigate`:n.navigate(e.delta,`button`);return;case`page`:n.page(e.direction,`button`);return;case`panel`:n.showPanel(t.panel()===e.panel?t.home:e.panel);return;case`switch`:n.showPanel(t.panel()===`input`?t.home:`input`);return;case`today`:n.today();return;case`clear`:n.clear();return;case`cancel`:n.cancel(`button`);return;case`confirm`:n.confirm()}},ni=(e,t,n)=>{e.addEventListener(`click`,e=>{let{target:t}=e,r=t instanceof Element?t.closest(`button`):null;if(r!==null){let e=$r(r);e&&ti(e[1],n);return}let i=n.cellAt(t);i!==null&&n.actions.select(i.date)},{signal:t})},ri=`dp-ui__container--menu-open`,ii=`dp-ui__container--input`,ai=`--dp-ui-visible-months`,oi=e=>e.closest(`.dp-ui__container`),si=(e,t)=>e!==t&&e!==`days`&&e!==`input`,ci=(e,t)=>{let n=t>1;e.classList.toggle(`dp-ui__container--multi-month`,n),n?e.style.setProperty(ai,String(t)):e.style.removeProperty(ai)},li=(e,t,n)=>{let r=t===`input`;e.classList.toggle(ii,r),ci(e,r?1:n)},ui=(e,t)=>{let n=G(`div`,`dp-ui__navigation-group dp-ui__navigation-group--${e}`);return n.append(...t),n},di=e=>{let{labels:t}=e,n=Wr(t),r=I(e.locale,`short`),i=I(e.locale,`long`),a=qr(`month`,``,{name:t.chooseMonth,controls:Y(e.instanceId,`month-menu`),shortcut:n.chooseMonth}),o=qr(`year`,``,{name:t.chooseYear,controls:Y(e.instanceId,`year-menu`),shortcut:n.chooseYear}),s=G(`div`,`dp-ui__header dp-ui__header--docked`),c=ui(`month`,[X(`prev-month`,t.previousMonth,J.keyboardArrowLeft,n.previousMonth),a.button,X(`next-month`,t.nextMonth,J.keyboardArrowRight,n.nextMonth)]);c.hidden=e.groups!==`both`,s.hidden=e.groups===`none`,s.append(c,ui(`year`,[X(`prev-year`,t.previousYear,J.keyboardArrowLeft,n.previousYear),o.button,X(`next-year`,t.nextYear,J.keyboardArrowRight,n.nextYear)]));let l=t=>{a.setText(r[t.month-1]??``,i[t.month-1]??``),o.setText(N(t.year,e.locale))},u=e=>{a.button.setAttribute(`aria-expanded`,String(e===`month-menu`)),o.button.setAttribute(`aria-expanded`,String(e===`year-menu`)),a.button.disabled=e===`year-menu`,o.button.disabled=e===`month-menu`};return l(e.view),u(e.home),{element:s,setView:l,setPanel:u}},fi=`dp-ui__headline--fading-out`,pi=(e,t)=>{let n=G(`div`,`dp-ui__headline`);n.textContent=e;let r=null,i=null,a=()=>{i!==null&&clearTimeout(i),i=null,r=null,n.classList.remove(fi)},o=()=>{let e=r;a(),e!==null&&(n.textContent=e)};return{element:n,setText:e=>{e!==(r??n.textContent)&&(t?(r=e,n.classList.add(fi),i??=setTimeout(o,K.HEADLINE_FADE)):(a(),n.textContent=e))},destroy:a}},mi=e=>{let{labels:t,switchView:n}=e,r=G(`div`,`dp-ui__header dp-ui__header--modal`),i=G(`div`,`dp-ui__supporting-text`);i.textContent=e.title;let a=pi(e.text,e.animate);r.append(i,a.element);let o=n===null?null:Yr(t,n.panelId);return o!==null&&r.append(o.button),{element:r,setText:e=>{a.setText(e)},setInputView:e=>{o?.setInputView(e)},destroy:()=>{a.destroy()}}},hi=(e,t,n,r)=>{let i=Wr(n),a=G(`div`,`dp-ui__navigation`);return a.append(qr(`year-grid`,qe(e,t),{name:n.chooseYear,controls:Y(r,`year-grid`),shortcut:i.chooseYear}).button,X(`prev-month`,n.previousMonth,J.keyboardArrowLeft,i.previousMonth),X(`next-month`,n.nextMonth,J.keyboardArrowRight,i.nextMonth)),a},gi=(e,t,n,r)=>{let i=G(`div`,`dp-ui__navigation dp-ui__navigation--month-grid`),a=Wr(n);return i.append(qr(`year-grid`,N(e.year,t),{name:n.chooseYear,controls:Y(r,`year-grid`),shortcut:a.chooseYear}).button,X(`prev-year`,n.previousYear,J.keyboardArrowLeft,a.previousYear),X(`next-year`,n.nextYear,J.keyboardArrowRight,a.nextYear)),i},_i=(e,t,n,r)=>{let i=G(`div`,`dp-ui__navigation dp-ui__navigation--year-grid`),{button:a}=qr(`year-grid`,qe(e,t),{name:n.chooseYear,controls:Y(r,`year-grid`)});return a.setAttribute(`aria-expanded`,`true`),i.append(a),i},vi=t=>{let{decorateDate:n}=t.options;return n===null?()=>null:t=>{try{return n(d(t))??null}catch(t){return e(t),null}}},yi=e=>{let{renderDate:t}=e.options;return t===null?()=>null:e=>t(d(e))},bi=(e,t,n)=>{let{options:r}=e;return{locale:r.locale,weekStart:r.weekStart,weekNumbers:r.weekNumbers,showOutside:n,outsideSelectable:r.outsideDays!==!1&&r.outsideDays.selectable,labels:{weekNumber:r.labels.weekNumber},rangeLabels:{start:r.labels.rangeStart,end:r.labels.rangeEnd},headingVisible:!1,weekdaysVisible:!0,multiselectable:e.draft.mode!==`single`,rangeRole:()=>null,decorate:vi(e),content:yi(e),isSelected:t=>se(e.draft,t),isDisabled:n=>!t.isSelectable(n,e.followsActiveEnd?Dn(e.draft,e.activeEnd):e.draft),today:S(),focus:e.focus}},xi=(e,t,n)=>{let r=e.layout.months>1,i=n===`docked`&&!r&&e.options.outsideDays!==!1,a=bi(e,t,i);return r?{...a,headingVisible:!0}:a},Si=(e,t)=>Je(t,v(t,e.layout.months-1),e.options.locale),Z=e=>zr(e.draft,e.panel===`input`?`input`:`calendar`,e.options.locale,e.options.labels,e.options.precision),Ci={days:null,input:null,"month-menu":`.dp-ui__menu-button--month`,"year-menu":`.dp-ui__menu-button--year`,"year-grid":`.dp-ui__menu-button--year-grid`,"month-grid":null},wi=e=>{switch(e){case`day`:return`both`;case`month`:return`year`;case`year`:return`none`}},Ti=e=>Ci[e],Ei=(e,t,n)=>{let{locale:r,labels:i,animation:a,viewSwitch:o,mode:s,precision:c}=e.options;if(t===`modal`){let t=o&&T(s,n,c),r=mi({labels:i,title:Nr(i,s,c),animate:a,text:Z(e),switchView:t?{panelId:Y(e.instanceId,`input`)}:null});return r.setInputView(e.panel===`input`),{element:r.element,docked:null,modal:r}}let l=di({instanceId:e.instanceId,locale:r,labels:i,view:e.view,groups:wi(c),home:E(c)});return{element:l.element,docked:l,modal:null}},Di=(e,t)=>{let n=v(e,t);return{year:n.year,month:n.month,day:Math.min(e.day,b(n))}},Oi=(e,t,n,r)=>{let i=t?12:1;switch(e){case`ArrowLeft`:return g(n,r?1:-1);case`ArrowRight`:return g(n,r?-1:1);case`ArrowUp`:return g(n,-7);case`ArrowDown`:return g(n,7);case`Home`:return{year:n.year,month:n.month,day:1};case`End`:return{...n,day:b(n)};case`PageUp`:return Di(n,-i);case`PageDown`:return Di(n,i);default:return null}},ki=e=>e.ctrlKey||e.altKey||e.metaKey,Ai=(e,t)=>{let n=e.toLowerCase();return t===`modal`?n===`y`?`year-grid`:null:n===`m`?`month-menu`:n===`y`?`year-menu`:null},ji=e=>{let{panel:t}=e.core;return e.layout===`docked`?e.home===`days`&&t===`days`:e.layout===`modal`&&t===e.home&&e.home!==`year-grid`},Mi=(e,t)=>{let{panel:n}=t.core;n!==t.home&&n!==`input`&&(e.preventDefault(),e.stopPropagation(),t.actions.showPanel(t.home))},Ni=(e,t)=>{if(!e.shiftKey||!ji(t))return!1;let n=Ai(e.key,t.layout);return n!==null&&(e.preventDefault(),t.actions.showPanel(n),!0)},Pi=(e,t,n)=>{e.preventDefault(),e.key===`Enter`&&n.layout===`modal`&&n.core.options.mode===`single`&&se(n.core.draft,t.date)?n.actions.confirm():n.actions.select(t.date)},Fi=(e,t,n)=>{if(e.key===`Enter`||e.key===` `){Pi(e,t,n);return}let r=Oi(e.key,e.shiftKey,t.date,n.isRtl());r!==null&&(e.preventDefault(),n.actions.focusDate(r))},Ii=(e,t,n)=>{e.addEventListener(`keydown`,e=>{if(e.defaultPrevented)return;if(e.key===`Escape`){Mi(e,n);return}if(ki(e)||Ni(e,n))return;let t=n.cellAt(e.target);t!==null&&Fi(e,t,n)},{signal:t})},Li=`dp-ui__ghost`,Ri=e=>Array.from(e.querySelectorAll(`*`)).filter(e=>e.closest(`.${Li}`)===null),zi=(e,t,n)=>{e.querySelectorAll(`.${Li}`).forEach(e=>{e.remove()}),e.removeAttribute(`popover`),e.removeAttribute(`style`),e.classList.remove(`dp-ui__container--morphing`),e.classList.add(Li),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``),e.removeAttribute(`id`),e.removeAttribute(`name`),e.querySelectorAll(`[id], [name]`).forEach(e=>{e.removeAttribute(`id`),e.removeAttribute(`name`)}),e.style.setProperty(`inline-size`,`${String(t)}px`),e.style.setProperty(`block-size`,`${String(n)}px`)},Bi=(e,t)=>{let n=Array.from(t.querySelectorAll(`*`));return Ri(e).flatMap((e,t)=>{let r=n.at(t);return r===void 0||e.scrollTop===0&&e.scrollLeft===0?[]:[{live:e,copy:r,top:e.scrollTop,left:e.scrollLeft}]})},Vi=({live:e,copy:t})=>{let n=e.getBoundingClientRect(),r=Array.from(t.children);Array.from(e.children).forEach((e,t)=>{let i=r.at(t),a=e.getBoundingClientRect();i===void 0||a.bottom>n.top&&a.top<n.bottom||(i.replaceChildren(),i instanceof HTMLElement&&i.style.setProperty(`block-size`,`${String(a.height)}px`))})},Hi=(e,t,n)=>{let r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return null;zi(r,t,n);let i=Bi(e,r);i.forEach(Vi);let a=null,o=()=>{if(a!==null){let e=a;a=null,e.cancel()}r.remove()};return{show:()=>{e.append(r),i.forEach(({copy:e,top:t,left:n})=>{e.scrollTop=t,e.scrollLeft=n}),typeof r.animate==`function`?(a=r.animate([{opacity:1},{opacity:0}],{duration:K.VIEW_SWITCH_FADE_OUT,easing:`linear`,fill:`forwards`}),a.finished.then(o,o)):o()},remove:o}},Ui=`dp-ui__container--morphing`,Wi=/* @__PURE__ */ new WeakMap,Gi=e=>{let t=e.getBoundingClientRect();return{width:t.width,height:t.height,radius:getComputedStyle(e).borderRadius}},Ki=(e,t)=>{if(t===null)return null;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:getComputedStyle(t).direction===`rtl`?n.right-r.right:r.left-n.left,y:r.top-n.top,height:r.height}},qi=e=>({width:`${String(e.width)}px`,height:`${String(e.height)}px`,borderRadius:e.radius}),Ji=(e,t,n)=>{if(n.height===0)return;let r=getComputedStyle(e).direction===`rtl`,i=(t.x-n.x)*(r?-1:1),a=t.y-n.y,o=t.height/n.height;if(i===0&&a===0&&o===1)return;let s=r?`top right`:`top left`;e.animate([{transform:`translate(${String(i)}px, ${String(a)}px) scale(${String(o)})`,transformOrigin:s},{transform:`none`,transformOrigin:s}],{duration:K.VIEW_SWITCH,easing:br.EMPHASIZED})},Yi=(e,t,n)=>{if(n===`none`||typeof e.animate!=`function`)return t(),null;if(n===`reduced`){let n=Gi(e),r=Hi(e,n.width,n.height);return t(),r?.show(),null}let r=e.querySelector(`.dp-ui__headline`),i=Gi(e),a=Ki(e,r),o=Hi(e,i.width,i.height);t();let s=Gi(e),c=Ki(e,r);e.classList.add(Ui);let l=e.animate([qi(i),qi(s)],{duration:K.VIEW_SWITCH,easing:br.EMPHASIZED});Wi.set(e,l),o?.show(),r!==null&&a!==null&&c!==null&&Ji(r,a,c);let u=()=>{o?.remove(),Wi.get(e)===l&&(Wi.delete(e),e.classList.remove(Ui))};return l.finished.then(u,u),l};function Xi(e){let t=e.describedById??`${e.id}-supporting`,n=G(`div`,`dp-ui__text-field`),r=G(`input`,`dp-ui__text-field-input`,{id:e.id,type:`text`,inputmode:`numeric`,autocomplete:`off`,placeholder:e.placeholder,tabindex:`0`,"aria-invalid":`false`,"aria-describedby":t});r.value=e.value;let i=G(`label`,`dp-ui__text-field-label`,{for:e.id});i.textContent=e.label;let a=G(`div`,`dp-ui__text-field-supporting`,{id:t,"aria-live":`polite`});return a.textContent=e.hint,n.append(r,i,a),{element:n,input:r,getValue:()=>r.value,setValue:e=>{r.value=e},setError:t=>{let i=t!==null;n.classList.toggle(`dp-ui__text-field--error`,i),r.setAttribute(`aria-invalid`,i?`true`:`false`);let o=t??e.hint;a.textContent!==o&&(a.textContent=o)}}}function Zi(e){return e.mode===`single`?e.date:null}function Qi(e){return e.mode===`single`?e.date===null:e.mode===`range`?e.start===null:e.dates.length===0}function $i(e){let{instanceId:t,draft:n,pattern:r,labels:i,rules:a}=e,o=G(`div`,`dp-ui__input-panel`,{"data-panel":`input`,id:Y(t,`input`)}),s=De(r,Ee(i)),c=(e,n,i)=>Xi({id:`${t}-input-${e}`,label:n,placeholder:s,hint:s,value:i?Oe(i,r):``}),l=n.mode===`range`,u=c(l?`start`:`date`,l?i.startDateField:i.dateField,n.mode===`range`?n.start:Zi(n)),d=l?c(`end`,i.endDateField,n.end):null,f=d?[u,d]:[u],p=t=>{let n=t.getValue().trim();if(n===``)return t.setError(null),{date:null,failed:!1};let o=ln(n,r);if(o===null)return t.setError(i.invalidDate),{date:null,failed:!0};let s=a.unavailableReason(o);return s===null?(t.setError(null),t.setValue(Oe(o,r)),{date:o,failed:!1}):(t.setError(e.messageFor(s)),{date:null,failed:!0})},h=()=>{let e=p(u);if(!d)return e.failed?null:{mode:`single`,date:e.date};let t=p(d),n=t.date,r=e.failed||t.failed;return e.date&&n&&m(n,e.date)<0&&(d.setError(i.invalidRange),n=null,r=!0),r?null:{mode:`range`,start:e.date,end:n}},g=t=>{let n=Cn(t,e.limits,e=>a.unavailableReason(e));return n===null||((d??u).setError(e.messageFor(n)),!1)};return f.forEach(t=>{t.input.addEventListener(`change`,()=>{let t=h();t&&g(t)&&e.onDraft(t)}),t.input.addEventListener(`keydown`,t=>{if(t.key!==`Enter`)return;t.preventDefault();let n=h();n&&g(n)&&ie(n)&&!Qi(n)&&(e.onDraft(n),e.onSubmit())})}),o.append(...f.map(e=>e.element)),o}function ea(e,t){let{labels:n,minDate:r,maxDate:i,pattern:a,precision:o}=t;return e===`min`&&r!==null?n.beforeMinDate.replace(`{date}`,U(r,a,o)):e===`max`&&i!==null?n.afterMaxDate.replace(`{date}`,U(i,a,o)):e===`range-length`?n.invalidRange:n.unavailableDate}let ta=e=>{let{core:t,actions:n,rules:r}=e,{pattern:i,labels:a,limits:o}=t.options;return[$i({instanceId:t.instanceId,draft:t.draft,pattern:i,labels:a,rules:r,limits:o,messageFor:e=>ea(e,t.options),onDraft:e=>{n.typeDraft(e)},onSubmit:()=>{n.confirm()}})]},na=`dp-ui__pager--dragging`,ra=e=>e instanceof Element&&e.closest(`button`)!==null,ia=(e,t)=>{e.push(t),e.length>q.VELOCITY_SAMPLES&&e.shift()},aa=e=>{let t=e.at(0),n=e.at(-1);return!t||!n?0:(n.x-t.x)/Math.max(q.MIN_SAMPLE_SPAN_MS,n.t-t.t)},oa=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},sa=(e,t)=>{e.hasPointerCapture(t)&&e.releasePointerCapture(t)},ca=(e,t,n)=>{let r=null,i=null,a=t=>{t.controller.abort(),r===t&&(r=null),t.dragging&&(e.classList.remove(na),sa(e,t.pointerId))},o=()=>{i?.abort();let t=new AbortController;i=t,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t.abort()},{capture:!0,signal:t.signal}),requestAnimationFrame(()=>{t.abort()})},s=t=>{n.onBegin(),t.dragging=!0,t.width=n.pageWidth(),oa(e,t.pointerId),e.classList.add(na)},c=(e,t)=>{if(t.pointerId!==e.pointerId)return;let r=t.clientX-e.startX;if(!e.dragging){if(Math.abs(r)<=q.DRAG_START_PX)return;s(e)}e.lastX=t.clientX,ia(e.samples,{x:t.clientX,t:t.timeStamp}),n.onMove(r,e.width)},l=(e,t,r)=>{t.pointerId===e.pointerId&&(a(e),e.dragging&&(r?n.onAbort():(o(),ia(e.samples,{x:e.lastX,t:t.timeStamp}),n.onRelease({dx:e.lastX-e.startX,velocity:aa(e.samples),width:e.width}))))};e.addEventListener(`pointerdown`,t=>{if(t.button!==0||!t.isPrimary||ra(t.target))return;let i=r;i&&(a(i),i.dragging&&n.onAbort());let o=new AbortController,s={pointerId:t.pointerId,startX:t.clientX,samples:[{x:t.clientX,t:t.timeStamp}],controller:o,lastX:t.clientX,width:0,dragging:!1};r=s;let u=e.ownerDocument,d={signal:o.signal};u.addEventListener(`pointermove`,e=>{c(s,e)},d),u.addEventListener(`pointerup`,e=>{l(s,e,!1)},d),u.addEventListener(`pointercancel`,e=>{l(s,e,!0)},d)},{signal:t});let u=()=>{r&&a(r)};return{isDragging:()=>r?.dragging===!0,cancel:u,dispose:()=>{u(),i?.abort(),i=null}}},la=(e,t)=>e.year===t.year&&e.month===t.month,ua=(e,t,n)=>{let r=null,i=e=>{let n=t(e);return n.classList.add(`dp-ui__page`),{view:e,element:n}},a=e=>{r?.forEach((t,n)=>{t.element.toggleAttribute(`inert`,n!==e)})},o=(e,t,n)=>{let r=e[t];if(la(r.view,n))return e;let a=i(n);return r.element.replaceWith(a.element),t===0?[a,e[1],e[2]]:[e[0],e[1],a]};return{show:t=>{let o=[i(v(t,-n)),i(t),i(v(t,n))];e.replaceChildren(...o.map(e=>e.element)),r=o,a(1)},centerView:()=>r?.[1].view??null,reveal:(e,t)=>{r&&(r=o(r,e,t),a(e))},recenter:e=>{if(!r)return;let t=r[e],o=i(v(t.view,-n)),s=i(v(t.view,n));r.forEach((t,n)=>{n!==e&&t.element.remove()}),t.element.before(o.element),t.element.after(s.element),r=[o,t,s],a(1)},clear:()=>{r=null}}},da=(e,t,n)=>{if(t<-q.FLICK_VELOCITY)return 1;if(t>q.FLICK_VELOCITY)return-1;let r=n*q.COMMIT_FRACTION;return e<-r?1:e>r?-1:0},fa=(e,t,n,r)=>{let i=da(e,t,n);return!r||i===0?i:i===1?-1:1},pa=(e,t)=>{let n=null,r=null,i=()=>typeof e.animate==`function`,a=()=>{let e=r;r=null,e?.cancel()},o=()=>{a();let e=n;e&&(n=null,e.complete(),e.animation.cancel())},s=()=>{a();let e=n;n=null,e?.animation.cancel()},c=()=>{let t=e.animate([{opacity:0},{opacity:1}],{duration:K.REDUCED_FADE,easing:`linear`});r=t;let n=()=>{r===t&&(r=null)};t.finished.then(n,n)};return{run:(r,s,l)=>{a();let u=ir(t);if(r===s||u===`none`||!i()){l();return}if(u===`reduced`){l(),c();return}let d=e.animate([{transform:r},{transform:s}],{duration:K.PAGER_SETTLE,easing:br.EMPHASIZED,fill:`forwards`}),f={animation:d,complete:l};n=f,d.finished.then(()=>{n===f&&o()},()=>void 0)},finish:o,cancel:s}},ma=(e,t)=>Math.min(t,Math.max(-t,e)),ha=(e,t)=>e.deltaMode===0?e.deltaX:Math.sign(e.deltaX)*t,ga=(e,t,n)=>{let r=null,i=0,a=()=>{r=null;let e=i;i=0,n.onSettle(e,n.pageWidth())};return e.addEventListener(`wheel`,e=>{if(Math.abs(e.deltaX)<=Math.abs(e.deltaY)||n.isBlocked())return;e.preventDefault();let t=n.pageWidth();r===null?n.onBegin():clearTimeout(r),i-=ha(e,t),n.onMove(ma(i,t),t),r=setTimeout(a,K.WHEEL_SETTLE)},{passive:!1,signal:t}),{cancel:()=>{r!==null&&clearTimeout(r),r=null,i=0}}},_a=`dp-ui__pager--swipe`,va=`--dp-ui-pager-height`;var ya=class{viewport;options;track;controller=new AbortController;previousTouchAction;strip;animator;drag=null;wheel=null;offset=0;revision=0;constructor(e,t){this.viewport=e,this.options=t,this.previousTouchAction=e.style.touchAction,this.track=G(`div`,`dp-ui__pager-track`),this.strip=ua(this.track,e=>t.renderPage(e),t.step??1),this.animator=pa(this.track,t.animate),e.classList.add(`dp-ui__pager`),e.append(this.track),t.swipe&&this.enableSwipe()}show(e){this.destroyed||(this.revision+=1,this.animator.cancel(),this.cancelGestures(),this.strip.show(e),this.rest(),this.fitHeight(e))}slide(e,t){if(this.destroyed)return;this.finish(),this.cancelGestures();let n=this.strip.centerView();if(!n){this.show(e);return}if(this.revision+=1,la(n,e)){this.settle();return}let r=t===1?2:0;this.strip.reveal(r,e),this.fitHeight(e);let i=this.pageWidth(),a=this.transformFor(1,this.offset,i);this.offset=0,this.animator.run(a,this.transformFor(r,0,i),()=>{this.strip.recenter(r),this.rest()})}finish(){this.animator.finish()}destroy(){this.destroyed||(this.controller.abort(),this.cancelGestures(),this.drag?.dispose(),this.animator.cancel(),this.track.remove(),this.strip.clear(),this.viewport.style.removeProperty(va),this.viewport.classList.remove(_a,na),this.options.swipe&&(this.viewport.style.touchAction=this.previousTouchAction))}get destroyed(){return this.controller.signal.aborted}enableSwipe(){let{signal:e}=this.controller;this.viewport.style.touchAction=`pan-y`,this.viewport.classList.add(_a),this.drag=ca(this.viewport,e,{pageWidth:()=>this.pageWidth(),onBegin:()=>{this.finish(),this.wheel?.cancel()},onMove:(e,t)=>{this.setOffset(e,t)},onRelease:({dx:e,velocity:t,width:n})=>{this.release(fa(e,t,n,this.options.rtl),`drag`)},onAbort:()=>{this.settle()}}),this.wheel=ga(this.viewport,e,{pageWidth:()=>this.pageWidth(),isBlocked:()=>this.drag?.isDragging()===!0,onBegin:()=>{this.finish()},onMove:(e,t)=>{this.setOffset(e,t)},onSettle:(e,t)=>{this.release(fa(e,0,t,this.options.rtl),`wheel`)}})}cancelGestures(){this.drag?.cancel(),this.wheel?.cancel()}release(e,t){if(e===0){this.settle();return}let n=this.revision;this.options.onCommit(e,t),this.revision===n&&!this.destroyed&&this.settle()}settle(){this.finish();let e=this.pageWidth(),t=this.transformFor(1,this.offset,e);this.offset=0,this.animator.run(t,this.transformFor(1,0,e),()=>{this.rest()})}fitHeight(e){this.options.fitHeight&&!this.viewport.hidden&&this.viewport.style.setProperty(va,`${String(this.options.pageHeight(e))}px`)}rest(){this.offset=0,this.track.style.removeProperty(`transform`),this.viewport.scrollLeft!==0&&(this.viewport.scrollLeft=0)}setOffset(e,t){this.offset=e,this.track.style.transform=this.transformFor(1,e,t)}transformFor(e,t,n){let r=this.options.rtl?1:-1;return`translateX(${String(r*e*n+t)}px)`}pageWidth(){let e=this.viewport.clientWidth;return e>0?e:360}};let ba=`dp-ui__date`,xa=`dp-ui__date--outside-month`,Sa=`data-decoration-label`,Ca=`data-content-label`,wa=`dp-ui__date-content`,Ta=`dp-ui__date--has-content`,Ea=`:scope > .${wa}`,Da=(e,t,n)=>n.isDisabled(e)||t&&!n.outsideSelectable,Oa=(e,t,n,r)=>[[`dp-ui__date--selected`,r.isSelected(e)],[`dp-ui__date--range-start`,n===`start`],[`dp-ui__date--range-end`,n===`end`],[`dp-ui__date--in-range`,n===`in-range`],[`dp-ui__date--today`,h(e,r.today)],[`dp-ui__date--disabled`,Da(e,t,r)],[xa,t]],ka=e=>{e.querySelector(Ea)?.remove(),e.classList.remove(Ta),e.removeAttribute(Ca)},Aa=(e,t,n)=>{let r=n.content(t);if(r===null){ka(e);return}let i=e.querySelector(Ea),a=(typeof r==`string`?r:r.textContent??``).trim();if(typeof r!=`string`||i===null||i.childElementCount!==0||i.textContent!==r){let t=G(`span`,wa);typeof r==`string`?t.textContent=r:t.appendChild(r),i===null?e.querySelector(`.dp-ui__date-indicator`)?.after(t):i.replaceWith(t)}e.classList.add(Ta),a===``?e.removeAttribute(Ca):e.setAttribute(Ca,a)},ja=(e,t)=>e===`start`?t.rangeLabels.start:e===`end`?t.rangeLabels.end:null,Ma=(e,t,n,r,i)=>[Ke(e,i.locale),ja(t,i),n,r].filter(e=>e!==null&&e!==``).join(`, `),Na=(e,t,n,r)=>{let i=r.rangeRole(t);Aa(e,t,r),Oa(t,n,i,r).forEach(([t,n])=>e.classList.toggle(t,n)),e.setAttribute(`aria-selected`,String(r.isSelected(t)||i!==null)),e.setAttribute(`aria-label`,Ma(t,i,e.getAttribute(Sa),e.getAttribute(Ca),r)),h(t,r.today)?e.setAttribute(`aria-current`,`date`):e.removeAttribute(`aria-current`),Da(t,n,r)?e.setAttribute(`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`);let a=!n&&h(t,r.focus);e.setAttribute(`tabindex`,a?`0`:`-1`)},Pa=(e,t)=>{if(t===null)return;let n=(t.className??``).split(/\s+/).filter(Boolean);e.classList.add(...n),t.label&&e.setAttribute(Sa,t.label),t.badge===!0&&e.appendChild(G(`span`,`dp-ui__date-badge`,{"aria-hidden":`true`}))},Fa=(e,t)=>{if(!e.inMonth&&!t.showOutside)return G(`td`,`${ba} dp-ui__date--empty`);let n=G(`td`,ba,{role:`gridcell`,"data-date":p(e.date)}),r=G(`span`,`dp-ui__date-indicator`);return r.textContent=N(e.date.day,t.locale),n.appendChild(r),Pa(n,t.decorate(e.date)),Na(n,e.date,!e.inMonth,t),n},Ia=`dp-ui__visually-hidden`,La=e=>{let t=G(`thead`),n=G(`tr`,e.weekdaysVisible?`dp-ui__weekdays`:`dp-ui__weekdays ${Ia}`);if(e.weekNumbers){let t=G(`th`,`dp-ui__week-number-header`,{scope:`col`});t.textContent=e.labels.weekNumber,n.appendChild(t)}let r=He(e.locale,`narrow`),i=He(e.locale,`long`);for(let t=0;t<7;t++){let a=(e.weekStart+t)%7,o=i[a]??``,s=G(`th`,`dp-ui__weekday`,{role:`columnheader`,scope:`col`,abbr:o,title:o});s.textContent=r[a]??``,n.appendChild(s)}return t.appendChild(n),t},Ra=(e,t)=>{let n=G(`table`,`dp-ui__month-grid`,{role:`grid`});t.multiselectable===!0&&n.setAttribute(`aria-multiselectable`,`true`);let r=G(`caption`,t.headingVisible?`dp-ui__month-subhead`:`dp-ui__month-heading ${Ia}`);r.textContent=qe(e.view,t.locale),n.appendChild(r),n.appendChild(La(t));let i=G(`tbody`);return e.weeks.forEach((n,r)=>{let a=G(`tr`,`dp-ui__week`);if(t.weekNumbers){let n=G(`th`,`dp-ui__week-number`,{scope:`row`}),i=e.weekNumbers.at(r);n.textContent=i===void 0?``:N(i,t.locale),a.appendChild(n)}n.forEach(e=>a.appendChild(Fa(e,t))),i.appendChild(a)}),n.appendChild(i),n},za=(e,t)=>{e.querySelectorAll(`td[data-date]`).forEach(e=>{let n=f(e.dataset.date??``);n!==null&&Na(e,n,e.classList.contains(xa),t)})},Ba=(e,t,n)=>{let r={year:e.year,month:e.month,day:1},i=(x(r)-t+7)%7,a=n?6:Math.ceil((i+b(e))/7),o=g(r,-i),s=(4-t+7)%7,c=[],l=[];for(let t=0;t<a;t++){let n=g(o,t*7),r=[];for(let t=0;t<7;t++){let i=g(n,t);r.push({date:i,inMonth:i.year===e.year&&i.month===e.month})}c.push(r),l.push(w(g(n,s)))}return{view:e,weeks:c,weekNumbers:l}},Va=`table.dp-ui__month-grid`,Ha=e=>{let{core:t,layout:n,gridContext:r}=e,{months:i}=t.layout,{showOutside:a,outsideSelectable:o,headingVisible:s}=r(),c=n===`modal`||a||t.options.fixedWeeks,l=n===`docked`,u=G(`div`,void 0,{"data-panel":`days`}),d=e=>Ba(e,t.options.weekStart,c),p=e=>Array.from({length:i},(t,n)=>v(e,n)),m=e=>{let t=r();if(i===1)return Ra(d(e),t);let n=G(`div`,`dp-ui__months`);return n.append(...p(e).map(e=>Ra(d(e),t))),n},h=e=>{let r=G(`div`);if(n===`modal`){let{locale:n,labels:i}=t.options;r.append(hi(e,n,i,t.instanceId))}return r.append(m(e)),r},g=e=>Math.max(...p(e).map(e=>d(e).weeks.length)),_=e=>{let t=g(e),n=u.querySelector(Va),r=n?.tHead?.getBoundingClientRect().height??0,i=(n?.tBodies.item(0)?.rows.item(0))?.getBoundingClientRect().height??0,a=s?n?.caption?.getBoundingClientRect().height??0:0;return r>0&&i>0?a+r+i*t:(t+(s?2:1))*48},y=new ya(u,{rtl:e.rtl,swipe:t.options.swipe,animate:t.options.animation,fitHeight:l,step:t.options.pageBy===`view`?i:1,renderPage:h,pageHeight:_,onCommit:(t,n)=>{e.onCommit(t,n)}}),b=()=>u.ownerDocument.activeElement,x=e=>{if(!(e instanceof Element))return null;let t=e.closest(`td.dp-ui__date[data-date]`);if(t===null||!u.contains(t)||t.classList.contains(`dp-ui__date--outside-month`)&&!o)return null;let n=f(t.getAttribute(`data-date`)??``);return n===null?null:{element:t,date:n}},S=()=>x(b())!==null,C=e=>u.querySelector(`.dp-ui__page:not([inert])`)?.querySelector(e)??null,w=e=>{let t=C(`td.dp-ui__date[tabindex="0"]`);return t!==null||!e?t:C(`td.dp-ui__date[data-date]:not(.dp-ui__date--outside-month)`)},ee=e=>{w(e)?.focus({preventScroll:!0})},T=()=>{let e=b();return e===null||!u.contains(e)?null:{buttonClass:ei(e)}},E=e=>{let{buttonClass:t}=e;((t===null?null:C(`.${t}`))??w(!0))?.focus({preventScroll:!0})},D=e=>{let t=T();e(),t!==null&&E(t)};return{element:u,present:(e,t)=>{D(()=>{t===0?y.show(e):y.slide(e,t>0?1:-1)})},finish:()=>{y.finish()},refresh:()=>{let e=r();u.querySelectorAll(Va).forEach(t=>{za(t,e)})},refit:()=>{if(!l||u.hidden)return;let e=`${String(_(t.view))}px`;u.style.getPropertyValue(`--dp-ui-pager-height`)!==e&&D(()=>{y.show(t.view)})},cellAt:x,focusCell:ee,cellHasFocus:S,find:C,destroy:()=>{y.destroy()}}},Ua=e=>{let t=document.createElement(`div`);t.className=e.className,t.setAttribute(`role`,`listbox`),t.setAttribute(`aria-label`,e.label);let n=[],r=e.focused>=0&&e.focused<e.items.length?e.focused:0,i=(e,r)=>{let i=n.at(Math.max(0,Math.min(n.length-1,r)));i&&(n.at(e)?.setAttribute(`tabindex`,`-1`),i.setAttribute(`tabindex`,`0`),i.focus({preventScroll:!0}),Mn(t,i,`nearest`))},a=e=>{let n=getComputedStyle(t).direction===`rtl`?-1:1;switch(e){case`ArrowRight`:return n;case`ArrowLeft`:return-n;case`ArrowDown`:return 3;case`ArrowUp`:return-3;default:return null}};return e.items.forEach((o,s)=>{let c=document.createElement(`button`);c.type=`button`,c.className=e.itemClass,c.setAttribute(`role`,`option`),c.setAttribute(`aria-selected`,o.selected?`true`:`false`),c.setAttribute(`aria-label`,o.name),c.setAttribute(`tabindex`,s===r?`0`:`-1`),o.selected&&c.classList.add(`${e.itemClass}--selected`),o.current&&c.classList.add(`${e.itemClass}--current`),o.disabled&&c.setAttribute(`aria-disabled`,`true`),c.textContent=o.label;let l=()=>{o.disabled||o.onPick()};c.addEventListener(`click`,l),c.addEventListener(`keydown`,e=>{let t=a(e.key);t===null?e.key===`Home`?(e.preventDefault(),i(s,0)):e.key===`End`?(e.preventDefault(),i(s,n.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l()):(e.preventDefault(),i(s,s+t))}),n.push(c),t.appendChild(c)}),requestAnimationFrame(()=>{let i=t.querySelector(`.${e.itemClass}--selected`)??n.at(r);i&&Mn(t,i,`center`)}),t},Wa=e=>{let t=I(e.locale,`short`),n=I(e.locale,`long`),r=N(e.year,e.locale);return Ua({className:`dp-ui__month-selection`,itemClass:`dp-ui__month-selection-item`,label:e.label,focused:e.focused-1,items:t.map((t,i)=>{let a=i+1;return{label:t,name:`${n[i]??t} ${r}`,selected:a===e.selected,current:e.current.year===e.year&&e.current.month===a,disabled:e.isDisabled(a),onPick:()=>{e.onPick(a)}}})})},Ga=e=>{let t=e.querySelector(`.dp-ui__menu-item--selected`);t&&Mn(e,t,`center`)},Ka=(e,t,n)=>{let r=e.at(Math.max(0,Math.min(e.length-1,n))),i=e.at(t);r&&(i?.setAttribute(`tabindex`,`-1`),r.setAttribute(`tabindex`,`0`),r.focus({preventScroll:!0}),r.parentElement&&Mn(r.parentElement,r,`nearest`))},qa=(e,t,n)=>{let r=document.createElement(`ul`);r.className=`dp-ui__menu dp-ui__menu--${e}`,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-label`,t);let i=n.some(e=>e.selected),a=n.map((e,t)=>{let n=document.createElement(`li`);n.className=`dp-ui__menu-item`,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,e.selected?`true`:`false`);let r=e.selected||!i&&t===0;if(n.setAttribute(`tabindex`,r?`0`:`-1`),e.selected){n.classList.add(`dp-ui__menu-item--selected`);let e=document.createElement(`span`);e.innerHTML=J.check;let t=e.firstElementChild;t&&(t.setAttribute(`class`,`dp-ui__menu-item-icon`),t.setAttribute(`aria-hidden`,`true`),n.appendChild(t))}e.disabled&&n.setAttribute(`aria-disabled`,`true`);let a=document.createElement(`span`);a.className=`dp-ui__menu-item-label`,a.textContent=e.label,n.appendChild(a);let s=()=>{e.disabled||e.onPick()};return n.addEventListener(`click`,s),n.addEventListener(`keydown`,e=>{e.key===`ArrowDown`?(e.preventDefault(),Ka(o,t,t+1)):e.key===`ArrowUp`?(e.preventDefault(),Ka(o,t,t-1)):e.key===`Home`?(e.preventDefault(),Ka(o,t,0)):e.key===`End`?(e.preventDefault(),Ka(o,t,o.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}),n}),o=a;return a.forEach(e=>r.appendChild(e)),requestAnimationFrame(()=>{Ga(r)}),r},Ja=e=>{let t=I(e.locale,`long`);return qa(`month`,e.label,t.map((t,n)=>{let r=n+1;return{label:t,selected:r===e.view.month,disabled:e.isMonthDisabled({year:e.view.year,month:r}),onPick:()=>{e.onPick(r)}}}))},Ya=e=>Ua({className:`dp-ui__year-selection`,itemClass:`dp-ui__year-selection-item`,label:e.label,focused:e.years.indexOf(e.focused),items:e.years.map(t=>{let n=N(t,e.locale);return{label:n,name:n,selected:t===e.selected,current:t===e.currentYear,disabled:!1,onPick:()=>{e.onPick(t)}}})}),Xa=e=>qa(`year`,e.label,e.years.map(t=>({label:N(t,e.locale),selected:t===e.view.year,disabled:!1,onPick:()=>{e.onPick(t)}}))),Za=e=>{let{min:t,max:n}=e.yearBounds(),r=[];for(let e=t;e<=n;e++)r.push(e);return r},Qa=(e,t)=>{let n=j(e.draft);return n?.year===t?n.month:null},$a=(e,t,n)=>(e.setAttribute(`data-panel`,t),e.id=Y(n,t),e),eo=(e,t)=>{let{core:n,rules:r}=t,{labels:i,locale:a}=n.options,o=n.view,{precision:s}=n.options,c=e=>{t.actions.jumpTo(e,`menu`)},l=e=>{c({year:e,month:n.view.month})};switch(e){case`month-menu`:return[$a(Ja({locale:a,view:o,label:i.chooseMonth,isMonthDisabled:e=>r.isMonthDisabled(e),onPick:e=>{c({year:n.view.year,month:e})}}),e,n.instanceId)];case`year-menu`:return[$a(Xa({view:o,years:Za(r),label:i.chooseYear,locale:a,onPick:l}),e,n.instanceId)];case`month-grid`:{let l=s===`month`,u=l?Qa(n,o.year):o.month,d=$a(Wa({year:o.year,selected:u,focused:u??o.month,current:S(),locale:a,label:i.chooseMonth,isDisabled:e=>r.isMonthDisabled({year:n.view.year,month:e}),onPick:e=>{l?t.actions.select({year:n.view.year,month:e,day:1}):c({year:n.view.year,month:e})}}),e,n.instanceId);return t.layout===`docked`?[d]:[gi(o,a,i,n.instanceId),d]}case`year-grid`:{let c=s===`year`,u=c?j(n.draft)?.year??null:o.year,d=$a(Ya({selected:u,focused:u??o.year,years:Za(r),currentYear:S().year,label:i.chooseYear,locale:a,onPick:c?e=>{t.actions.select({year:e,month:1,day:1})}:l}),e,n.instanceId);return t.layout===`docked`||c?[d]:[_i(o,a,i,n.instanceId),d]}}},to=`[role="option"]`,no=e=>{let{root:t,content:n,days:r}=e,i=`days`,a=[],o=null,s=()=>t.ownerDocument.activeElement,c=e=>{e===`days`?r.hidden=!0:(a.forEach(e=>{e.remove()}),a=[])},l=t=>{t===`days`?r.hidden=!1:(a=e.createParts(t),r.after(...a))},u=()=>{let e=o;e!==null&&(o=null,e.complete(),e.animations.forEach(e=>{e.cancel()}))},d=()=>{let e=o;o=null,e?.animations.forEach(e=>{e.cancel()})},f=(t,n,r)=>{let i=e.motion()===`none`?[]:t.filter(e=>!e.hidden&&typeof e.animate==`function`);if(i.length===0){r();return}let a=i.map(e=>e.animate([{opacity:1},{opacity:0}],{duration:n,easing:`linear`,fill:`forwards`})),s={animations:a,complete:r};o=s,Promise.all(a.map(e=>e.finished)).then(()=>{o===s&&u()},()=>void 0)},p=()=>{let e=r.getBoundingClientRect().height;e>0&&n.style.setProperty(`--dp-ui-panel-height`,`${String(e)}px`)},m=n=>{u();let o=i;if(n===o)return;o===`days`&&p();let d=t.contains(s()),m=n===`input`||o===`input`;i=n;let h=()=>{let t=()=>{c(o),l(n),e.onSwitched(n,o,d)};e.swap===void 0?t():e.swap(t,n,o)};m?h():f(o===`days`?[r]:a,K.PANEL_FADE_OUT,h)},h=e=>{d(),e!==i&&(c(i),i=e,l(e))},g=e=>{let t=e.closest(`[role="listbox"]`);return t===null?-1:Array.from(t.querySelectorAll(to)).indexOf(e)},_=e=>{for(let t of a){let n=e(t);if(n)return n}return null},v=(e,t)=>t>=0?_(e=>Array.from(e.querySelectorAll(to)).at(t)):e===null?null:_(t=>t.querySelector(`.${e}`));return{current:()=>i,settled:()=>o===null,mount:h,switchTo:m,rebuild:()=>{if(i===`days`||i===`input`||o!==null)return;let e=s(),t=e!==null&&a.some(t=>t.contains(e))?e:null,n=t===null?null:ei(t),r=t===null?-1:g(t),u=a.map(e=>e.scrollTop);c(i),l(i),a.forEach(e=>{e.setAttribute(`data-rebuilt`,``)}),requestAnimationFrame(()=>{a.forEach((e,t)=>{e.scrollTop=u.at(t)??e.scrollTop})}),t!==null&&v(n,r)?.focus({preventScroll:!0})},entry:()=>{for(let e of a){let t=e.querySelector(`[tabindex="0"]`);if(t!==null)return t}return null},destroy:d}},ro=e=>{let{root:t,core:n,actions:r,rules:i,mode:a,layout:o}=e,s=n.options,c=Ei(n,o,a),l=Ha({core:n,layout:o,rtl:e.rtl,gridContext:()=>xi(n,i,o),onCommit:(e,t)=>{r.page(e,t)}}),u=G(`div`,`dp-ui__content`);u.append(l.element);let d=no({root:t,content:u,days:l.element,motion:e.motion,createParts:e=>e===`input`?ta({core:n,actions:r,rules:i}):eo(e,{core:n,actions:r,rules:i,layout:o}),swap:(r,i,a)=>{let o=oi(t);o===null||i!==`input`&&a!==`input`?r():Yi(o,()=>{r(),li(o,i,n.layout.months)},e.motion())},onSwitched:e.onSwitched}),f=Zr({labels:s.labels,visible:s.footerExplicit??a!==`inline`,todayButton:s.todayButton,clearButton:s.clearButton!==!1}),p=G(`div`,`dp-ui__live-region dp-ui__visually-hidden`,{"aria-live":`polite`,"aria-atomic":`true`});return t.replaceChildren(c.element,u,f,p),{header:c,pages:l,panels:d,liveRegion:p}},io=[`.dp-ui__icon-button`,`.dp-ui__menu-button`,`.dp-ui__text-button`,`.dp-ui__date:not(.dp-ui__date--disabled) .dp-ui__date-indicator`,`.dp-ui__menu-item`,`.dp-ui__year-selection-item`,`.dp-ui__month-selection-item`].join(`, `),ao=e=>{let{core:t,actions:n,rules:r,mode:i}=e,a=i===`modal`?`modal`:`docked`,o=new AbortController,s=G(`div`,`dp-ui__calendar`),c,l=0,u=()=>s.closest(`.dp-ui__container--rtl`)!==null||getComputedStyle(t.input).direction===`rtl`,d=()=>oi(s),f=()=>E(t.options.precision),p=e=>c.pages.cellAt(e),m=(e,n=!0)=>{c.header.docked?.setPanel(e);let r=d();r!==null&&(r.classList.toggle(ri,si(e,f())),n&&li(r,e,t.layout.months))},h=e=>{e===null?c.pages.focusCell(!0):e.focus({preventScroll:!0})},g=e=>{let t=Ti(e);return t===null?null:c.header.element.querySelector(t)??c.pages.find(t)},_=(e,t,n)=>{e===`days`&&c.pages.refit(),n&&h(e===`days`?t===`input`?null:g(t):c.panels.entry())},v=()=>{c=ro({root:s,core:t,actions:n,rules:r,mode:i,layout:a,rtl:u(),motion:()=>ir(t.options.animation),onSwitched:_}),c.pages.present(t.view,0),c.panels.mount(t.panel),m(t.panel),c.header.modal?.setInputView(t.panel===`input`),Xr(s,ie(t.draft)),cancelAnimationFrame(l),l=requestAnimationFrame(()=>{l=0,m(c.panels.current()),c.pages.refit()})},y=()=>{c.panels.destroy(),c.pages.destroy(),c.header.modal?.destroy()},b=()=>{o.signal.aborted||(m(c.panels.current()),c.pages.refit(),h(c.panels.entry()))},x=(e,n,r)=>{c.header.docked?.setView(e);let i=r!==`api`&&c.panels.current()===`days`&&c.panels.settled();c.pages.present(e,i?n:0),c.panels.rebuild(),r!==`api`&&ar(c.liveRegion,Si(t,e))},S=()=>{let e=c.pages.cellHasFocus();c.pages.refresh(),e&&c.pages.focusCell(!1)},C=e=>{c.pages.finish(),m(e,!1),c.header.modal?.setInputView(e===`input`),c.header.modal?.setText(Z(t)),c.panels.switchTo(e)},w=()=>{c.pages.refresh(),c.panels.rebuild(),c.header.modal?.setText(Z(t)),Xr(s,ie(t.draft)),c.panels.current()===f()&&ar(c.liveRegion,Z(t))};return v(),(e=>{let{events:r}=t;r.on(`change:view`,e=>{x(e.view,e.delta,e.source)},e),r.on(`change:draft`,w,e),r.on(`change:focus`,S,e),r.on(`change:panel`,e=>{C(e.panel)},e),ni(s,e,{actions:n,panel:()=>t.panel,home:f(),cellAt:p}),Ii(s,e,{core:t,actions:n,layout:a,home:f(),cellAt:p,isRtl:u}),Ur(s,io,e)})(o.signal),{element:s,focusInitial:b,update:()=>{if(o.signal.aborted)return;let e=s.contains(s.ownerDocument.activeElement);y(),v(),e&&b()},destroy:()=>{if(o.signal.aborted)return;o.abort(),cancelAnimationFrame(l),y();let e=d();e!==null&&(e.classList.remove(ri,ii),ci(e,1)),s.remove()}}},oo=e=>({year:e.year,month:e.month}),so=e=>{let t=j(e.draft);return t===null?e.view:oo(t)},co=(e,t)=>{let{minDate:n,maxDate:r}=e.options,i=t.yearBounds(),a={year:i.min,month:1},o={year:i.max,month:12},s=n!==null&&y(a,n)>0,c=r!==null&&y(r,o)>0;return{first:s?oo(n):a,last:c?oo(r):o}},lo=(e,t)=>y(t.first,e)<0?t.first:y(e,t.last)<0?t.last:e,uo=e=>{let t=G(`div`,`dp-ui__top-bar`);return t.append(X(`close`,e.close,J.close),Jr(`save`,e.save)),t},fo=e=>{let{labels:t,switchView:n}=e,r=G(`div`,`dp-ui__header dp-ui__header--range`),i=e.fullscreen?uo(t):null;i!==null&&r.append(i);let a=G(`div`,`dp-ui__header-text`),o=G(`div`,`dp-ui__supporting-text`);o.textContent=t.rangeTitle;let s=pi(e.text,e.animate);a.append(o,s.element),r.append(a);let c=n===null?null:Yr(t,n.panelId);return c!==null&&r.append(c.button),{element:r,setText:e=>{s.setText(e)},setInputView:e=>{i!==null&&(i.hidden=e),c?.setInputView(e)},destroy:()=>{s.destroy()}}},po=(e,t)=>{let n=G(`div`,`dp-ui__weekdays-bar`,{"aria-hidden":`true`}),r=He(e,`narrow`);for(let e=0;e<7;e++){let i=G(`span`,`dp-ui__weekday`);i.textContent=r.at((t+e)%7)??``,n.append(i)}return n},mo=(e,t)=>t===`x`?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight,ho=(e,t)=>t===`x`?e.clientX:e.clientY,go=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},_o=(e,t,n)=>{t===`x`?e.scrollLeft+=n:e.scrollTop+=n},vo=(e,t,n=`x`,r={})=>{let i=null,a=0,o=0,s=0,c=!1;n===`x`&&e.addEventListener(`wheel`,t=>{mo(e,n)&&(Math.abs(t.deltaY)<=Math.abs(t.deltaX)||(t.preventDefault(),e.scrollLeft+=t.deltaY))},{signal:t,passive:!1}),e.addEventListener(`pointerdown`,t=>{t.pointerType===`mouse`&&t.button===0&&mo(e,n)&&(i=t.pointerId,a=ho(t,n),o=a,s=0,c=!1)},{signal:t}),e.addEventListener(`pointermove`,t=>{if(t.pointerId!==i)return;let r=ho(t,n);s=r-a,!(!c&&Math.abs(s)<q.DRAG_START_PX)&&(c||(c=!0,go(e,t.pointerId)),_o(e,n,o-r),o=r)},{signal:t}),e.addEventListener(`selectstart`,e=>{i!==null&&e.preventDefault()},{signal:t});let l=t=>{t.pointerId===i&&(i=null,e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId),c&&t.type===`pointerup`&&s!==0&&r.onDragEnd?.(s<0?1:-1))};e.addEventListener(`pointerup`,l,{signal:t}),e.addEventListener(`pointercancel`,l,{signal:t}),e.addEventListener(`click`,e=>{c&&(c=!1,e.stopPropagation(),e.preventDefault())},{signal:t,capture:!0})},yo=(e,t,n)=>({...bi(e,t,!1),outsideSelectable:!1,weekNumbers:!1,headingVisible:!0,weekdaysVisible:n,rangeRole:t=>ce(e.draft,t)}),bo=(e,t,n)=>Ra(Ba(n,e.options.weekStart,!1),yo(e,t,!1)),xo=`td.dp-ui__date[data-date]`,So=e=>{let{core:t,rules:n}=e,r=new AbortController,i=G(`div`,`dp-ui__month-list`),a=[],o=null,s=0,c=!1,l=0,u=(t,n)=>Array.from({length:n},(n,r)=>e.render(v(t,r))),d=t=>{if(o===null)return;let n=v(o,a.length),r=y(n,e.bounds().last)+1,s=Math.min(t,r);if(s<=0)return;let c=u(n,s);a.push(...c),i.append(...c)},f=t=>{if(o===null)return;let n=y(e.bounds().first,o),r=Math.min(t,n);if(r<=0)return;let s=v(o,-r),c=u(s,r),l=i.scrollTop,d=i.scrollHeight;o=s,a.unshift(...c),i.prepend(...c),i.scrollTop=l+i.scrollHeight-d},m=t=>{if(o===null)return;let n=lo(t,e.bounds());f(y(n,o)),d(y(v(o,a.length-1),n))},h=e=>{if(o===null)return null;let t=y(o,e);return t<0?null:a.at(t)??null},g=t=>{let n=lo(t,e.bounds());m(n);let r=h(n);if(r===null)return;let a=r.getBoundingClientRect().top-i.getBoundingClientRect().top;i.scrollTop+=a},_=()=>{i.scrollTop<i.clientHeight&&f(6),i.scrollHeight-i.scrollTop-i.clientHeight<i.clientHeight&&d(6)},b=e=>{let t=i.getBoundingClientRect().top,n=a.map(e=>({table:e,top:e.getBoundingClientRect().top-t,height:e.getBoundingClientRect().height})),r=Math.max(n.reduce((e,t,n)=>t.top<=1?n:e,0),0),o=n.at(r);if(o===void 0)return null;let s=o.height>0?Math.max(-o.top,0)/o.height:0,c=n.at(r+1)?.table??o.table;return e===1?s>q.COMMIT_FRACTION?c:o.table:s<1-q.COMMIT_FRACTION?o.table:c},x=()=>{c&&(window.clearTimeout(l),c=!1,_())},S=e=>{x(),_();let n=b(e);if(n===null)return;let r=n.getBoundingClientRect().top-i.getBoundingClientRect().top;ir(t.options.animation)===`full`?(c=!0,l=window.setTimeout(x,K.SNAP_SCROLL_FALLBACK),i.scrollTo({top:i.scrollTop+r,behavior:`smooth`})):i.scrollTop+=r},C=e=>{if(!(e instanceof Element))return null;let t=e.closest(xo);return t!==null&&i.contains(t)?t:null},w=e=>{m(oo(e));let t=i.querySelector(`${xo}[data-date="${p(e)}"]`);t!==null&&(t.focus({preventScroll:!0}),Mn(i,t,`nearest`))},ee=()=>{let e=yo(t,n,!1);a.forEach(t=>{za(t,e)})},T=e.bounds(),E=lo(so(t),T),D=lo(v(E,-2),T),te=y(D,lo(v(E,9),T))+1;return te>0&&(o=D,a.push(...u(D,te)),i.append(...a)),i.addEventListener(`scroll`,()=>{s===0&&(s=requestAnimationFrame(()=>{s=0,c||_()}))},{passive:!0,signal:r.signal}),i.addEventListener(`scrollend`,x,{signal:r.signal}),vo(i,r.signal,`y`,{onDragEnd:S}),{element:i,scrollToMonth:g,refresh:ee,cellAt:C,focusCell:w,ensureMonth:m,reveal:g,present:(e,t,n)=>{n===`api`?g(e):m(e)},destroy:()=>{r.abort(),cancelAnimationFrame(s),s=0,window.clearTimeout(l),c=!1}}},Co=e=>{let t=G(`div`,`dp-ui__navigation dp-ui__navigation--months`),n=Wr(e);return t.append(X(`prev-month`,e.previousMonth,J.keyboardArrowLeft,n.previousMonth),X(`next-month`,e.nextMonth,J.keyboardArrowRight,n.nextMonth)),t},wo=e=>{let{core:t,actions:n,rules:r}=e,i=Ha({core:t,layout:`docked`,rtl:e.rtl,gridContext:()=>yo(t,r,!0),onCommit:(e,t)=>{n.page(e,t)}});return{element:i.element,cellAt:e=>i.cellAt(e)?.element??null,focusCell:e=>{let t=i.find(`td.dp-ui__date[data-date][data-date="${p(e)}"]`);t===null?i.focusCell(!0):t.focus({preventScroll:!0})},refresh:()=>{i.refresh()},reveal:()=>{i.refit()},present:(e,t,n)=>{i.present(e,n===`api`?0:t)},destroy:()=>{i.destroy()}}};function To(t){let n;try{n=t.value()}catch(t){return e(t),null}let r=Zn(n,`range`,`day`);if(r?.mode!==`range`)return null;let{start:i,end:a}=r;return i===null||a===null?null:{start:i,end:a}}let Eo=e=>{let{core:t,actions:n,rules:r,signal:i}=e,{presets:a,labels:o,limits:s}=t.options,c=G(`div`,`dp-ui__presets`,{role:`group`,"aria-label":o.presets}),l=a.map(e=>{let t=G(`button`,`dp-ui__preset`,{type:`button`});return t.textContent=e.label,t}),u=l.map(()=>null);c.append(...l);let d=()=>{a.forEach((e,n)=>{let i=l[n],a=To(e);u[n]=a;let o=!1,c=!1;if(a!==null){let e={mode:`range`,...a};o=wn(e,s,e=>r.isDisabled(e)),c=oe(t.draft,e)}i.disabled=!o,i.setAttribute(`aria-pressed`,c?`true`:`false`)})};return c.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`button.dp-ui__preset`),r=l.findIndex(e=>e===t);if(r<0)return;let i=u[r];i!==null&&n.selectRange(i.start,i.end)},{signal:i}),vo(c,i),d(),{element:c,refresh:d,setHidden:e=>{c.hidden=e}}},Do=`dp-ui__container--range`,Oo=`dp-ui__container--fullscreen`,ko=`dp-ui__container--presets`,Ao=[Do,ko,Oo,ii],jo=(e,t)=>e.options.footerExplicit??t!==`inline`,Mo=(e,t)=>{let{core:n,actions:r,rules:i,rtl:a}=e,{labels:o,locale:s,weekStart:c}=n.options;if(n.layout.months>1){let e=wo({core:n,actions:r,rules:i,rtl:a});return t.append(Co(o),e.element),e}let l=So({core:n,rules:i,render:e=>bo(n,i,e),bounds:()=>co(n,i)});return t.append(po(s,c),l.element),l},No=e=>{let{root:t,core:n,actions:r,rules:i,mode:a,fullscreen:o,signal:s}=e,c=n.options,l=fo({labels:c.labels,animate:c.animation,text:Z(n),fullscreen:o,switchView:c.viewSwitch?{panelId:Y(n.instanceId,`input`)}:null}),u=G(`div`,`dp-ui__range`,{"data-panel":`days`}),d=Mo(e,u),f=no({root:t,content:t,days:u,motion:e.motion,createParts:e=>e===`input`?ta({core:n,actions:r,rules:i}):[],swap:e.swap,onSwitched:e.onSwitched}),p=Zr({labels:c.labels,visible:jo(n,a),todayButton:c.todayButton,clearButton:c.clearButton!==!1}),m=G(`div`,`dp-ui__live-region dp-ui__visually-hidden`,{"aria-live":`polite`,"aria-atomic":`true`}),h=n.layout.presets===`none`?null:Eo({core:n,actions:r,rules:i,signal:s}),g=n.layout.presets===`column`;return t.replaceChildren(l.element,...h===null?[]:[h.element],u,p,m),{header:l,days:d,panels:f,liveRegion:m,applyChrome:e=>{let r=e===`input`;l.setInputView(r),l.setText(Z(n)),h?.setHidden(r);let i=oi(t);i!==null&&(i.classList.add(Do),i.classList.toggle(ko,g),i.classList.toggle(Oo,o&&!r),li(i,e,n.layout.months))},refreshPresets:()=>{h?.refresh()}}},Po=[`.dp-ui__icon-button`,`.dp-ui__text-button`,`.dp-ui__preset`,`.dp-ui__date:not(.dp-ui__date--disabled) .dp-ui__date-indicator`].join(`, `),Fo=e=>e===`input`?`input`:`days`,Io=e=>{let{core:t,actions:n,rules:r,mode:i,fullscreen:a}=e,o=new AbortController,s=G(`div`,`dp-ui__calendar`),c,l=0,u=null,d=()=>ir(t.options.animation),p=()=>s.closest(`.dp-ui__container--rtl`)!==null||getComputedStyle(t.input).direction===`rtl`,m=e=>{let t=c.days.cellAt(e),n=f(t?.dataset.date??``);return t===null||n===null?null:{element:t,date:n}},h=()=>{let{draft:e,value:n}=t,r=A(e)&&A(n);Xr(s,ie(e)&&!r)},g=()=>{c.days.reveal(so(t))},_=(e,n,r)=>{e===`days`&&g(),r&&(e===`input`?c.panels.entry()?.focus({preventScroll:!0}):c.days.focusCell(t.focus))},v=(e,t)=>{let n=()=>{c.applyChrome(t),e()};u?.cancel(),u=null;let r=oi(s);r===null?n():u=Yi(r,n,d())},y=()=>{c=No({root:s,core:t,actions:n,rules:r,mode:i,fullscreen:a,rtl:p(),signal:o.signal,motion:d,swap:v,onSwitched:_}),c.days.present(t.view,0,`api`),c.panels.mount(Fo(t.panel)),c.applyChrome(c.panels.current()),h(),cancelAnimationFrame(l),l=requestAnimationFrame(()=>{l=0,c.applyChrome(c.panels.current()),c.panels.current()===`days`&&g()})},b=()=>{u?.cancel(),u=null,c.panels.destroy(),c.days.destroy(),c.header.destroy()},x=()=>{if(o.signal.aborted)return;cancelAnimationFrame(l),l=0;let e=c.panels.current();c.applyChrome(e),e===`input`?c.panels.entry()?.focus({preventScroll:!0}):(g(),c.days.focusCell(t.focus))},S=()=>{c.days.refresh(),c.refreshPresets(),c.header.setText(Z(t)),h(),c.panels.current()===`days`&&ar(c.liveRegion,Z(t))},C=()=>{let e=m(s.ownerDocument.activeElement)!==null;c.days.refresh(),e&&c.days.focusCell(t.focus)},w=(e,n,r)=>{let i=c.panels.current()===`days`&&c.panels.settled();c.days.present(e,i?n:0,r),r!==`api`&&t.layout.months>1&&ar(c.liveRegion,Si(t,e))};return y(),(e=>{let{events:r}=t;r.on(`change:view`,e=>{w(e.view,e.delta,e.source)},e),r.on(`change:draft`,S,e),r.on(`change:active-end`,()=>{c.days.refresh()},e),r.on(`change:value`,h,e),r.on(`change:focus`,C,e),r.on(`change:panel`,e=>{c.panels.switchTo(Fo(e.panel))},e),ni(s,e,{actions:n,panel:()=>t.panel,home:`days`,cellAt:m}),Ii(s,e,{core:t,actions:n,layout:`range`,home:`days`,cellAt:m,isRtl:p}),Ur(s,Po,e)})(o.signal),{element:s,focusInitial:x,update:()=>{if(o.signal.aborted)return;let e=s.contains(s.ownerDocument.activeElement);b(),y(),e&&x()},destroy:()=>{if(o.signal.aborted)return;o.abort(),cancelAnimationFrame(l),b();let e=oi(s);e!==null&&(e.classList.remove(...Ao),ci(e,1)),s.remove()}}},Lo=`--dp-ui-scrollbar-gap`,Ro=[`auto`,`scroll`],zo=0,Bo=[],Vo=``,Ho=e=>Ro.includes(window.getComputedStyle(e).overflowY);function Uo(e){let{style:t}=e,n=e.clientWidth,r=parseFloat(window.getComputedStyle(e).paddingRight)||0;Bo.push({element:e,overflow:t.overflow,paddingRight:t.paddingRight}),t.overflow=`hidden`;let i=Math.max(0,e.clientWidth-n);return i>0&&(t.paddingRight=`${String(r+i)}px`),i}function Wo(){if(zo===0){let{body:e,documentElement:t}=document,n=Ho(e)?Uo(e):0,r=Uo(t);Vo=t.style.getPropertyValue(Lo),t.style.setProperty(Lo,`${String(Math.max(n,r))}px`)}zo+=1}function Go(){if(zo===0||(--zo,zo>0))return;Bo.forEach(({element:e,overflow:t,paddingRight:n})=>{e.style.overflow=t,e.style.paddingRight=n});let e=document.documentElement;Vo?e.style.setProperty(Lo,Vo):e.style.removeProperty(Lo),Bo=[],Vo=``}function Ko(){if(!M())return()=>void 0;Wo();let e=!1;return()=>{e||(e=!0,Go())}}let qo=e=>{let t=getComputedStyle(e).getPropertyValue(`--dp-ui-motion-surface-exit`).trim();return t.endsWith(`ms`)&&parseFloat(t)===0};function Jo(e){if(qo(e))return Promise.resolve();if(typeof e.getAnimations!=`function`)return new Promise(e=>{setTimeout(e,K.SURFACE_EXIT)});let t=e.getAnimations({subtree:!0});return Promise.allSettled(t.map(e=>e.finished)).then(()=>void 0)}var Yo=class{root;body;dialog;controller=new AbortController;allowPageScroll;releaseScroll=null;openPromise=null;closePromise=null;pointerStartedOnBackdrop=!1;destroyed=!1;constructor(e){this.allowPageScroll=e.allowPageScroll,this.dialog=G(`dialog`,`dp-ui__dialog`,{"aria-label":e.label}),this.body=G(`div`,`dp-ui__container dp-ui__container--modal`),this.root=this.dialog,this.dialog.appendChild(this.body),e.parent.appendChild(this.dialog);let{signal:t}=this.controller;this.dialog.addEventListener(`cancel`,t=>{t.preventDefault(),!this.closePromise&&e.onCancel(`escape`)},{signal:t}),this.dialog.addEventListener(`pointerdown`,e=>{this.pointerStartedOnBackdrop=e.target===this.dialog},{signal:t}),this.dialog.addEventListener(`click`,t=>{let n=this.pointerStartedOnBackdrop&&t.target===this.dialog;this.pointerStartedOnBackdrop=!1,n&&!this.closePromise&&e.onCancel(`outside`)},{signal:t})}open(){return this.openPromise||(this.openPromise=Promise.resolve(),this.destroyed)||(this.allowPageScroll||(this.releaseScroll=Ko()),this.dialog.showModal()),this.openPromise}close(){return this.closePromise||=(this.dialog.open&&this.dialog.close(),Jo(this.dialog).then(()=>{this.unlock()})),this.closePromise}destroy(){this.destroyed||(this.destroyed=!0,this.controller.abort(),this.unlock(),this.dialog.remove())}unlock(){this.releaseScroll?.(),this.releaseScroll=null}},Xo=class{root;body;constructor(e){this.root=G(`div`,`dp-ui__container dp-ui__container--inline`,{role:`group`,"aria-label":e.label}),this.body=this.root,e.container.appendChild(this.root)}open(){return Promise.resolve()}close(){return Promise.resolve()}destroy(){this.root.remove()}};let Zo=`anchor-name`,Qo=e=>typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`position-try-fallbacks`,`flip-block`)&&typeof e.showPopover==`function`,$o=e=>`--dp-ui-anchor-${e.replace(/[^\w-]/g,`-`)}`,es=(e,t,n)=>{let{style:r}=t,i=r.getPropertyValue(Zo);return r.setProperty(Zo,n),e.style.setProperty(`--dp-ui-anchor-name`,n),e.setAttribute(`data-positioning`,`anchor`),()=>{i?r.setProperty(Zo,i):r.removeProperty(Zo)}},ts=(e,t,n)=>{let r=t.getBoundingClientRect(),i=e.offsetWidth;return n?r.right-i<0:r.left+i>e.ownerDocument.documentElement.clientWidth},ns=(e,t)=>{let n=e.getBoundingClientRect().top<t.getBoundingClientRect().top;e.setAttribute(`data-placement`,n?`top`:`bottom`)},rs=(e,t)=>Math.round(e*t)/t;function is({anchor:e,contentWidth:t,pickerHeight:n,minHeight:r,layoutWidth:i,viewport:a,tokens:o,request:s,rtl:c,pixelRatio:l}){let{gap:u,minWidth:d,maxWidth:f,edgeMargin:p}=o,{offsetLeft:m,offsetTop:h}=a,g=rs(Math.min(Math.max(e.width,d,t),f,i-2*p),l),_=h+p,v=e.top-u-_,y=h+a.height-p-e.bottom-u,b=(s===`auto`?n<=y||!(n<=v)&&y>=v?`bottom`:`top`:s)===`top`,x=b?v:y,S=x<Math.min(n,r)&&(b?y:v)>x?!b:b,C=S?`top`:`bottom`,w=S?v:y,ee=n>w?Math.max(w,0):null,T=ee??n,E=S?e.top-u-T:e.bottom+u,D=c?e.right-g:e.left,te=Math.max(Math.min(D,m+a.width-g-p),m+p);return{top:rs(Math.max(E,_),l),left:rs(te,l),width:g,placement:C,availableHeight:ee}}let as=`--dp-ui-popover-top`,os=`--dp-ui-popover-left`,ss=`--dp-ui-popover-available-height`,cs=(e,t,n)=>{e.style.setProperty(`max-width`,`var(--dp-ui-${t})`);let r=getComputedStyle(e).getPropertyValue(`max-width`),i=r.endsWith(`px`)?parseFloat(r):NaN;return i>=0?i:n},ls=e=>{let t=G(`div`);t.style.cssText=`position:absolute;visibility:hidden;pointer-events:none`,e.appendChild(t);let n={gap:cs(t,`popover-gap`,4),edgeMargin:cs(t,`popover-edge-margin`,4),minHeight:cs(t,`popover-min-height`,160)};return t.remove(),n},us=(e,t,n)=>{let r=null;return{enable:()=>{let{style:t}=e;t.setProperty(`position`,`fixed`),t.setProperty(`margin`,`0`),t.setProperty(`inset`,`auto`),t.setProperty(`top`,`var(${as})`),t.setProperty(`left`,`var(${os})`),e.setAttribute(`data-positioning`,`fallback`)},layout:()=>{r??=ls(e);let i=e.ownerDocument.documentElement;e.style.removeProperty(ss);let a=t.getBoundingClientRect(),o=e.offsetWidth,{top:s,left:c,placement:l,availableHeight:u}=is({anchor:{top:a.top,bottom:a.bottom,left:a.left,right:a.right,width:0},contentWidth:o,pickerHeight:e.offsetHeight,minHeight:r.minHeight,layoutWidth:i.clientWidth,viewport:window.visualViewport??{width:i.clientWidth,height:i.clientHeight,offsetLeft:0,offsetTop:0},tokens:{gap:r.gap,edgeMargin:r.edgeMargin,minWidth:0,maxWidth:o},request:`auto`,rtl:n,pixelRatio:window.devicePixelRatio||1});e.style.setProperty(as,`${String(s)}px`),e.style.setProperty(os,`${String(c)}px`),u!==null&&e.style.setProperty(ss,`${String(u)}px`),e.setAttribute(`data-placement`,l)}}},ds=e=>{document.addEventListener(`pointerdown`,t=>{if(e.isIgnored())return;let n=t.composedPath();e.inside.some(e=>n.includes(e))||e.onOutside()},{capture:!0,signal:e.signal})},fs=(e,t,n)=>{let r=new AbortController,{signal:i}=r,a=0,o=()=>{a===0&&(a=requestAnimationFrame(()=>{a=0,i.aborted||n()}))};if(window.addEventListener(`resize`,o,{signal:i}),window.addEventListener(`scroll`,t=>{let{target:n}=t;n instanceof Node&&e.contains(n)||o()},{capture:!0,signal:i}),window.visualViewport?.addEventListener(`resize`,o,{signal:i}),window.visualViewport?.addEventListener(`scroll`,o,{signal:i}),typeof ResizeObserver<`u`){let n=new ResizeObserver(o);n.observe(t),n.observe(e),i.addEventListener(`abort`,()=>{n.disconnect()})}return i.addEventListener(`abort`,()=>{cancelAnimationFrame(a),a=0}),()=>{r.abort()}};var ps=class{root;body;anchor;anchorName;rtl;fallback;controller=new AbortController;stopTracking=null;restoreAnchor=null;hasPopover;anchored=!1;openPromise=null;closePromise=null;destroyed=!1;constructor(e){this.anchor=e.anchor,this.rtl=e.rtl,this.anchorName=$o(e.instanceId),this.root=G(`div`,`dp-ui__container dp-ui__container--docked`,{role:`dialog`,"aria-modal":`false`,"aria-label":e.label,"data-placement":`bottom`}),this.body=this.root,this.fallback=us(this.root,this.anchor,e.rtl),this.hasPopover=typeof this.root.showPopover==`function`,this.hasPopover?this.root.setAttribute(`popover`,`manual`):this.root.style.display=`none`,e.host.appendChild(this.root);let{signal:t}=this.controller;ds({inside:[this.root,this.anchor,...e.inside],signal:t,isIgnored:()=>e.ignoreOutsideClick||this.closePromise!==null,onOutside:()=>{e.onOutside()}}),this.root.addEventListener(`keydown`,t=>{t.key!==`Escape`||t.defaultPrevented||this.closePromise||e.onEscape()},{signal:t})}open(){return this.openPromise||(this.openPromise=Promise.resolve(),this.destroyed)||(this.show(),this.update(),this.stopTracking=fs(this.root,this.anchor,()=>{this.update()})),this.openPromise}close(){return this.closePromise||=(this.endTracking(),this.hide(),Jo(this.root)),this.closePromise}destroy(){this.destroyed||(this.destroyed=!0,this.endTracking(),this.controller.abort(),this.restoreAnchor?.(),this.restoreAnchor=null,this.root.remove())}endTracking(){this.stopTracking?.(),this.stopTracking=null}show(){if(!this.hasPopover)this.root.style.removeProperty(`display`),this.enableFallback();else{try{this.root.showPopover()}catch{this.hasPopover=!1,this.root.removeAttribute(`popover`),this.enableFallback();return}Qo(this.root)?(this.restoreAnchor=es(this.root,this.anchor,this.anchorName),this.anchored=!0):this.enableFallback()}}hide(){if(!this.hasPopover)this.root.style.display=`none`;else try{this.root.hidePopover()}catch{this.root.removeAttribute(`popover`),this.hasPopover=!1,this.root.style.display=`none`}}enableFallback(){this.fallback.enable(),this.anchored=!1}update(){this.anchored&&ts(this.root,this.anchor,this.rtl)&&this.enableFallback(),this.anchored?ns(this.root,this.anchor):this.fallback.layout()}},ms=class{core;deps;mounted=null;generation=0;constructor(e,t,n){this.core=e,this.deps=n}get surface(){return this.mounted?.host.root??null}async mount(e){this.release();let t=this.createHost(e);if(t===null)return;let{core:n}=this,{options:r}=n,{actions:i,rules:a,theme:o}=this.deps,s=++this.generation;o.applyTo(t.root),Sr(t.root,r.animation);let c=ke()?1/0:window.innerWidth,l={core:n,actions:i,rules:a,mode:e,fullscreen:ne(r.mode,e,c,r.fullscreenBelow)},u=r.mode===`range`?Io(l):ao(l);this.mounted={mode:e,host:t,view:u,stopModality:or(t.root),stopSchemeWatch:e===`inline`?yr(()=>{o.applyTo(t.root)}):()=>void 0},t.body.append(u.element),await t.open(),s===this.generation&&e!==`inline`&&u.focusInitial()}async unmount(){let e=this.mounted;if(e===null)return;let t=++this.generation;await e.host.close(),t===this.generation&&this.mounted===e&&this.release()}update(){let e=this.mounted;e!==null&&(this.deps.theme.applyTo(e.host.root),Sr(e.host.root,this.core.options.animation),e.view.update())}destroy(){this.generation+=1,this.release()}release(){let e=this.mounted;e!==null&&(this.mounted=null,e.view.destroy(),e.host.destroy(),e.stopModality(),e.stopSchemeWatch())}createHost(e){let{core:t}=this,{options:n}=t,{actions:r}=this.deps,i=Nr(n.labels,n.mode,n.precision);if(e===`inline`){let e=W(n.inline.container);return e===null?null:new Xo({container:e,label:i})}return e===`modal`?new Yo({parent:W(n.appendTo)??t.host,label:i,allowPageScroll:n.allowPageScroll,onCancel:e=>{r.cancel(e)}}):new ps({host:t.host,anchor:t.input,instanceId:t.instanceId,rtl:getComputedStyle(t.input).direction===`rtl`,label:i,ignoreOutsideClick:n.behavior.ignoreOutsideClick,inside:t.endInput===null?[]:[t.endInput],onOutside:()=>{r.cancel(`outside`)},onEscape:()=>{r.cancel(`escape`)}})}},hs=class{core;fields=[];initial;constructor(e){this.core=e,this.initial=e.value}bind(e){let{input:t}=this.core;this.initial=this.core.value;let n=this.splitEnd();this.bindField(t,n===null?null:`start`),n!==null&&this.bindField(n,`end`),this.fields.length!==0&&t.form?.addEventListener(`reset`,()=>{setTimeout(()=>{this.handleReset()},0)},{signal:e})}sync(){for(let e of this.fields)e.hidden.value=this.valueOf(e.end)}dispatchCommit(){let{input:e}=this.core;e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}restore(){for(let e of this.fields)e.hidden.remove(),e.input.setAttribute(`name`,e.name);this.fields=[]}splitEnd(){return this.core.options.mode===`range`?this.core.endInput:null}bindField(e,t){let n=e.getAttribute(`name`);n!==null&&n!==``&&(e.removeAttribute(`name`),this.fields.push({input:e,name:n,hidden:this.createHidden(e,n),end:t}))}valueOf(e){let{value:t,options:n}=this.core;if(e===null||t.mode!==`range`)return jr(t,n.precision);let r=e===`start`?t.start:t.end;return r===null?``:pn(r,`day`)}createHidden(e,t){let n=e.ownerDocument.createElement(`input`);return n.type=`hidden`,n.name=t,n.classList.add(`dp-ui__form-value`),e.insertAdjacentElement(`afterend`,n),n}writeFields(e){let{core:t}=this,{pattern:n,precision:r}=t.options,i=this.splitEnd();if(i===null||e.mode!==`range`){t.input.value=Er(e,n,r);return}let a=e=>e===null?``:U(e,n,`day`);t.input.value=a(e.start),i.value=a(e.end)}handleReset(){let{core:e}=this,{mode:t}=e.options,n=this.initial.mode===t?this.initial:O(t);e.setValue(n),this.writeFields(n),this.sync()}};let gs=/^\d$/,_s=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]);function vs(e,t){return e===`year`?t.yearDigits:2}function ys(e,t){let{order:n}=t,r=n.map(e=>vs(e,t)),i=[``];for(let t of an(e)){let e=i.length-1,a=r[e]??0,o=i[e]??``;if(gs.test(t)){if(o.length>=a){if(i.length===n.length)break;i.push(t)}else i[e]=o+t}else _s.has(t)&&o!==``&&(i[e]=o.padStart(a,`0`),i.length<n.length&&i.push(``))}return i.filter(e=>e!==``).join(t.separator)}let bs=`aria-describedby`,xs=e=>(e.getAttribute(bs)??``).split(/\s+/).filter(e=>e!==``);function Ss(e,t,n,r){let i=G(`span`,`dp-ui__visually-hidden`,{id:n}),a=G(`span`,void 0,{"aria-live":`polite`}),o=G(`span`);return o.textContent=r,i.append(a,` `,o),t.append(i),e.setAttribute(bs,[...xs(e),n].join(` `)),{setHint:e=>{o.textContent!==e&&(o.textContent=e)},setError:e=>{let t=e??``;a.textContent!==t&&(a.textContent=t)},destroy:()=>{i.remove();let t=xs(e).filter(e=>e!==n);t.length===0?e.removeAttribute(bs):e.setAttribute(bs,t.join(` `))}}}let Cs=`dp-ui--error`;function ws(e,t,n){e.setAttribute(`aria-invalid`,`true`),t.classList.add(Cs),e.setCustomValidity(n)}function Ts(e,t){e.removeAttribute(`aria-invalid`),t.classList.remove(Cs),e.setCustomValidity(``)}function Es(e,t,n){let r=e.trim(),i=t.trim();if(r===``&&i===``)return{kind:`empty`};let a=r===``?null:ln(r,n);if(r!==``&&a===null)return{kind:`invalid`,field:`start`};let o=i===``?null:ln(i,n);return i!==``&&o===null?{kind:`invalid`,field:`end`}:a===null||o===null?{kind:`partial`}:m(a,o)>0?{kind:`reversed`}:{kind:`range`,start:a,end:o}}var Ds=class{core;emitter;deps;dirty=!1;constructor(e,t,n){this.core=e,this.emitter=t,this.deps=n}get end(){return this.core.options.mode===`range`?this.core.endInput:null}bind(e){let{end:t}=this;if(t!==null)for(let n of[this.core.input,t])n.addEventListener(`blur`,()=>{this.commit()},{signal:e}),n.addEventListener(`input`,()=>{this.dirty=!0,this.applyMask(n)},{signal:e}),n.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this.commit())},{signal:e})}write(e){let{end:t}=this;if(t===null)return;let n=e.mode===`range`?e:null;this.core.input.value=this.format(n?.start??null),t.value=this.format(n?.end??null),this.dirty=!1,this.clearError()}readInitial(){let{end:e}=this,t=O(`range`);if(e===null)return t;let n=this.readDate(this.core.input.value),r=this.readDate(e.value);return n===null||r===null||m(n,r)>0?t:{mode:`range`,start:n,end:r}}markInvalid(e){let{end:t}=this;if(t===null)return;let{input:n,host:r}=this.core;ws(n,r,e),ws(t,r,e),this.deps.describe(n,e),this.deps.describe(t,e),this.emitter.emit(`error`,{code:`invalid-value`,message:e})}clearError(){let{end:e}=this;if(e===null)return;let{input:t,host:n}=this.core;Ts(t,n),Ts(e,n),this.deps.describe(t,null),this.deps.describe(e,null)}format(e){return e===null?``:U(e,this.core.options.pattern,`day`)}readDate(e){let{pattern:t}=this.core.options,n=Mr(e,`single`,`day`)??Ar(e,`single`,t,`day`);return n?.mode===`single`?n.date:null}applyMask(e){let{options:t}=this.core;if(!t.mask)return;let n=ys(e.value,t.pattern);n!==e.value&&(e.value=n,e.setSelectionRange(n.length,n.length))}commit(){let{end:e}=this;if(e===null||!this.dirty)return;let{options:t,input:n}=this.core,r=Es(n.value,e.value,t.pattern);r.kind!==`partial`&&(r.kind===`empty`?this.settle(O(`range`)):r.kind===`invalid`?this.fail(r.field,`invalid-date`,t.labels.invalidDate):r.kind===`reversed`?this.fail(`end`,`invalid-date`,t.labels.invalidRange):this.commitRange(r.start,r.end))}commitRange(e,t){let{options:n}=this.core,r={mode:`range`,start:e,end:t},i=e=>this.deps.rules.unavailableReason(e),a=Cn(r,n.limits,i);if(a===null){this.settle(r);return}let o=i(e)===null?`end`:`start`;this.fail(o,`unavailable-date`,ea(a,n),a)}settle(e){this.write(e),this.deps.onTyped(e)}fail(e,t,n,r){let i=e===`start`?this.core.input:this.end;if(i===null)return;this.clearError(),ws(i,this.core.host,n),this.deps.describe(i,n);let a=i.value;r===void 0?this.emitter.emit(`error`,{code:t,message:n,input:a}):this.emitter.emit(`error`,{code:t,message:n,input:a,reason:r})}},Os=class{core;emitter;deps;split;descriptions=/* @__PURE__ */ new Map;constructor(e,t,n){this.core=e,this.emitter=t,this.deps=n,this.split=new Ds(e,t,{rules:n.rules,onTyped:e=>{n.onTyped(e)},describe:(e,t)=>{this.describe(e,t)}})}bind(e){if(this.describeFields(e),this.split.end!==null){this.split.bind(e);return}let{input:t}=this.core;t.addEventListener(`blur`,()=>{this.commit()},{signal:e}),t.addEventListener(`input`,()=>{this.applyMask()},{signal:e}),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this.commit())},{signal:e})}write(e){this.split.end===null?(this.core.input.value=Er(e,this.core.options.pattern,this.core.options.precision),this.clearError()):this.split.write(e)}readInitial(){if(this.split.end!==null)return this.split.readInitial();let{mode:e,pattern:t,precision:n}=this.core.options,r=this.core.input.value;return Mr(r,e,n)??Ar(r,e,t,n)??O(e)}evaluate(e){let{mode:t,pattern:n,limits:r,precision:i}=this.core.options,a=Ar(e,t,n,i);if(a===null)return{kind:`invalid`};if(A(a))return{kind:`empty`};let o=Cn(a,r,e=>this.deps.rules.unavailableReason(e));return o===null?{kind:`valid`,selection:a}:{kind:`unavailable`,selection:a,reason:o}}markInvalid(e){this.split.end===null?(this.showError(e),this.emitter.emit(`error`,{code:`invalid-value`,message:e})):this.split.markInvalid(e)}destroy(){this.clearError(),this.split.clearError(),this.descriptions.forEach(e=>{e.destroy()}),this.descriptions.clear()}describeFields(e){let{input:t,host:n,instanceId:r}=this.core,{end:i}=this.split,a=()=>{let{pattern:e,precision:t,labels:n}=this.core.options;return gn(e,t,Ee(n))},o=[[t,`input-description`]];i!==null&&o.push([i,`end-input-description`]);for(let[e,t]of o){let i=Y(r,t);this.descriptions.set(e,Ss(e,n,i,a()))}this.core.events.on(`change:options`,()=>{let e=a();this.descriptions.forEach(t=>{t.setHint(e)})},e)}describe(e,t){this.descriptions.get(e)?.setError(t)}applyMask(){let{input:e,options:t}=this.core;if(!t.mask||t.mode!==`single`||t.precision!==`day`)return;let n=ys(e.value,t.pattern);n!==e.value&&(e.value=n,e.setSelectionRange(n.length,n.length))}commit(){let e=this.core.input.value,t=this.evaluate(e);if(t.kind===`empty`)this.clearError(),this.deps.onTyped(O(this.core.options.mode));else if(t.kind===`valid`)this.write(t.selection),this.deps.onTyped(t.selection);else if(t.kind===`invalid`){let t=this.core.options.labels.invalidDate;this.showError(t),this.emitter.emit(`error`,{code:`invalid-date`,message:t,input:e})}else{let{reason:n}=t,r=ea(n,this.core.options);this.showError(r),this.emitter.emit(`error`,{code:`unavailable-date`,message:r,input:e,reason:n})}}showError(e){ws(this.core.input,this.core.host,e),this.describe(this.core.input,e)}clearError(){Ts(this.core.input,this.core.host),this.describe(this.core.input,null)}};let ks=`dp-ui__container`,As=/\s+/;function js(e){return e.split(As).filter(e=>e!==``)}var Ms=class{core;tokens=[];constructor(e){this.core=e}applyHost(){this.core.host.setAttribute(`data-theme`,this.core.options.theme)}applyTo(e){let{options:t,input:n}=this.core;e.setAttribute(`data-theme`,t.theme),e.setAttribute(`data-color-scheme`,t.colorScheme===`auto`?vr(this.core.host):t.colorScheme),e.classList.remove(...this.tokens),this.tokens=js(t.cssClass),e.classList.add(...this.tokens),(e.classList.contains(ks)?e:e.querySelector(`.${ks}`))?.classList.toggle(`dp-ui__container--rtl`,getComputedStyle(n).direction===`rtl`)}destroy(){this.core.host.removeAttribute(`data-theme`),this.tokens=[]}};let Ns=(e,t,n,r)=>{let i=k(e);return i.length===0?``:e.mode===`multiple`?Rr(n,i.length,t):i.map(e=>Ye(e,r,t,`long`)).join(Cr)},Ps=`dp-ui__input--active`;var Fs=class{core;deps;toggle=null;expanded=!1;release=null;constructor(e,t,n){this.core=e,this.deps=n}bind(e){if(this.releaseToggle(),this.core.options.inline.enabled||e.aborted)return;let{input:t}=this.core;this.bindField(t,`start`,e);let n=this.splitEnd();n!==null&&(this.bindField(n,`end`,e),this.core.events.on(`change:active-end`,()=>{this.markActive()},e)),this.bindToggle(e)}setExpanded(e){this.expanded=e,this.toggle?.setAttribute(`aria-expanded`,String(e)),this.markActive()}updateLabel(){if(this.toggle===null)return;let{labels:e,locale:t,precision:n}=this.core.options,r=Ns(this.core.value,t,e.multipleSelected,n),i=r===``?e.openCalendar:`${e.openCalendar}, ${r}`;this.toggle.setAttribute(`aria-label`,i)}destroy(){this.releaseToggle(),this.core.input.classList.remove(Ps),this.core.endInput?.classList.remove(Ps)}splitEnd(){return this.core.options.mode===`range`?this.core.endInput:null}bindField(e,t,n){let r=!1;e.addEventListener(`pointerdown`,()=>{r=!0},{signal:n}),e.addEventListener(`click`,()=>{let n=r;r=!1,(!this.expanded||n)&&this.request(`pointer`,t,e)},{signal:n}),e.addEventListener(`keydown`,n=>{n.altKey&&n.key===`ArrowDown`&&(n.preventDefault(),this.request(`keyboard`,t,e))},{signal:n})}markActive(){let e=this.splitEnd(),{input:t}=this.core;if(e===null){t.classList.remove(Ps);return}let n=this.expanded?this.core.activeEnd:null;t.classList.toggle(Ps,n===`start`),e.classList.toggle(Ps,n===`end`)}request(e,t,n=this.core.input){n.disabled||this.deps.open(e,t)}bindToggle(e){let t=W(this.core.options.toggleButton,this.core.host);if(t===null)return;let n=/* @__PURE__ */ new Map,r=(e,r)=>{n.has(e)||n.set(e,t.getAttribute(e)),t.setAttribute(e,r)};r(`aria-haspopup`,`dialog`),t.tagName!==`BUTTON`&&(r(`role`,`button`),r(`tabindex`,`0`),t.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.request(`toggle`,`start`))},{signal:e})),t.addEventListener(`click`,()=>{this.request(`toggle`,`start`)},{signal:e}),this.toggle=t,r(`aria-expanded`,String(this.expanded)),r(`aria-label`,this.core.options.labels.openCalendar),this.updateLabel();let i=()=>{e.removeEventListener(`abort`,i),n.forEach((e,n)=>{e===null?t.removeAttribute(n):t.setAttribute(n,e)}),this.toggle===t&&(this.toggle=null),this.release===i&&(this.release=null)};this.release=i,e.addEventListener(`abort`,i,{once:!0})}releaseToggle(){this.release?.()}};function Q(e){return e.year*12+e.month-1}var Is=class{core;emitter;lists=null;constructor(e,t){this.core=e,this.emitter=t}isDisabled(e){return this.unavailableReason(e)!==null}unavailableReason(e){switch(this.core.options.precision){case`day`:return this.dayReason(e);case`month`:return this.monthReason(e);case`year`:return this.yearReason(e.year)}}isSelectable(e,t){return!this.isDisabled(e)&&!this.guardFor(t)(e)}isMonthDisabled(e){let t=b(e),n=l(e.year,e.month,1),r=l(e.year,e.month,t);if(n===null||r===null)return!0;let{minDate:i,maxDate:a}=this.core.options,o=this.yearBounds();if(e.year<o.min||e.year>o.max||i!==null&&m(r,i)<0||a!==null&&m(n,a)>0)return!0;for(let n=1;n<=t;n+=1)if(this.dayReason({year:e.year,month:e.month,day:n})===null)return!1;return!0}yearBounds(){let{minDate:e,maxDate:t,yearRange:n}=this.core.options,r=S(),i=r.year-n.before,a=r.year+n.after;return{min:e===null?i:Math.max(i,e.year),max:t===null?a:Math.min(a,t.year)}}clampView(e){let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds(),i=r.min*12,a=r.max*12+11;t!==null&&(i=Math.max(i,Q(t))),n!==null&&(a=Math.min(a,Q(n)));let o=this.core.layout.months-1;o>0&&(a=Math.max(i,a-o));let s=Math.min(Math.max(Q(e),i),a),c=Math.floor(s/12);return{year:c,month:s-c*12+1}}destroy(){this.lists=null}monthReason(e){if(!this.isMonthDisabled(e))return null;let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds(),i=Q(e),a=r.min*12,o=r.max*12+11;return t!==null&&(a=Math.max(a,Q(t))),n!==null&&(o=Math.min(o,Q(n))),i<a?`min`:i>o?`max`:`disabled`}yearReason(e){let t=this.yearBounds();return e<t.min?`min`:e>t.max?`max`:null}dayReason(e){let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds();if(t!==null&&m(e,t)<0||e.year<r.min)return`min`;if(n!==null&&m(e,n)>0||e.year>r.max)return`max`;let i=this.getLists(),a=p(e);return i.disabled.has(a)||i.enabled!==null&&!i.enabled.has(a)?`disabled`:i.source.disabledWeekdays.includes(x(e))?`weekday`:this.isCallbackDisabled(e,i)?`disabled`:null}isCallbackDisabled(t,n){let{isDateDisabled:r}=n.source;if(r===null)return!1;let i=p(t),a=n.callbackResults.get(i);if(a!==void 0)return a;let o=!1;try{o=r(d(t))}catch(t){e(t)}return n.callbackResults.set(i,o),o}guardFor(e){let t=this.getLists(),n=t.guardDraft;if(t.guard!==null&&n!==null&&oe(n,e))return t.guard;let{maxDate:r,limits:i}=t.source,a={year:this.yearBounds().max,month:12,day:31};r!==null&&m(r,a)<0&&(a=r);let o=bn(e,i,e=>this.isDisabled(e),a);return t.guardDraft=e,t.guard=o,o}getLists(){let e=this.core.options;if(this.lists?.source===e)return this.lists;let t={source:e,disabled:new Set(e.disabledDates.map(p)),enabled:e.enabledDates===null?null:new Set(e.enabledDates.map(p)),callbackResults:/* @__PURE__ */ new Map,guardDraft:null,guard:null};return this.lists=t,t}},Ls=class{target=null;select=e=>{this.target?.select(e)};selectRange=(e,t)=>{this.target?.selectRange(e,t)};typeDraft=e=>{this.target?.typeDraft(e)};focusDate=e=>{this.target?.focusDate(e)};navigate=(e,t)=>{this.target?.navigate(e,t)};page=(e,t)=>{this.target?.page(e,t)};jumpTo=(e,t)=>{this.target?.jumpTo(e,t)};showPanel=e=>{this.target?.showPanel(e)};confirm=()=>{this.target?.confirm()};cancel=e=>{this.target?.cancel(e)};today=()=>{this.target?.today()};clear=()=>{this.target?.clear()};open=(e,t)=>{this.target?.open(e,t)};typed=e=>{this.target?.applyTyped(e)};connect(e){this.target=e}},Rs=class{validation;theme;display;input;triggers;form;relay=new Ls;constructor(e,t){this.validation=new Is(e,t),this.theme=new Ms(e),this.display=new ms(e,t,{actions:this.relay,rules:this.validation,theme:this.theme}),this.input=new Os(e,t,{rules:this.validation,onTyped:this.relay.typed}),this.triggers=new Fs(e,t,{open:this.relay.open}),this.form=new hs(e)}connect(e){this.relay.connect(e)}destroy(){this.relay.connect(null),this.display.destroy(),this.triggers.destroy(),this.input.destroy(),this.form.restore(),this.theme.destroy(),this.validation.destroy()}};let $=/* @__PURE__ */ new Map,zs=()=>void 0;return class{core;emitter;lifecycle;constructor(e,n){let r=Kt(e);this.emitter=new t,this.core=new Bt(r.input,r.host,r.createdHost,n),this.lifecycle=new er(this.core,this.emitter,new Rs(this.core,this.emitter)),$.set(this.core.instanceId,this)}create(){this.lifecycle.create()}open(){this.lifecycle.open(`api`)}close(){this.lifecycle.close()}destroy(e){this.lifecycle.destroy(e?.keepInputValue??!1),$.get(this.core.instanceId)===this&&$.delete(this.core.instanceId)}getValue(){return this.lifecycle.getValue()}setValue(e){this.lifecycle.setValue(e)}setActiveEnd(e){this.lifecycle.setActiveEnd(e)}setOptions(e){this.lifecycle.setOptions(e)}getElement(){return this.core.host}on(e,t){return this.lifecycle.destroyed?zs:this.emitter.on(e,t)}once(e,t){return this.lifecycle.destroyed?zs:this.emitter.once(e,t)}off(e,t){this.emitter.off(e,t)}get instanceId(){return this.core.instanceId}get options(){return this.core.rawOptions}get isInitialized(){return this.lifecycle.created}get isDestroyed(){return this.lifecycle.destroyed}static getById(e){return $.get(Rt(e))}static getAllInstances(){return[...$.values()]}static destroyAll(){for(let e of[...$.values()])e.destroy()}}});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.DatepickerUI=t())})(this,function(){function e(e){queueMicrotask(()=>{throw e})}var t=class{store={};on(e,t,n){let r=this.listenersOf(e),i={handler:t},a=()=>{r.delete(i),n?.removeEventListener(`abort`,a)};return n?.aborted||(r.add(i),n?.addEventListener(`abort`,a,{once:!0})),a}once(e,t){let n=this.on(e,e=>{n(),t(e)});return n}off(e,t){let n=this.store[e];if(n){if(!t)n.clear();else for(let e of n)e.handler===t&&n.delete(e)}}emit(t,n){let r=this.store[t];if(!r)return;let i=[];for(let e of[...r])if(r.has(e))try{e.handler(n)}catch(e){i.push(e)}i.length>0&&e(i[0])}listenerCount(e){return this.store[e]?.size??0}clear(){this.store={}}listenersOf(e){let t=this.store[e];if(t)return t;let n=/* @__PURE__ */ new Set;return this.store[e]=n,n}};let n=/^(\d{4})-(\d{2})-(\d{2})$/;function r(e){return e%4==0&&e%100!=0||e%400==0}function i(e,t){return t===2?r(e)?29:28:t===4||t===6||t===9||t===11?30:31}function a(e,t,n){let r=t<=2?e-1:e,i=Math.floor(r/400),a=r-i*400,o=t>2?t-3:t+9,s=Math.floor((153*o+2)/5)+n-1,c=a*365+Math.floor(a/4)-Math.floor(a/100)+s;return i*146097+c-719468}function o(e){let t=e+719468,n=Math.floor(t/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),o=Math.floor((5*a+2)/153),s=a-Math.floor((153*o+2)/5)+1,c=o<10?o+3:o-9;return{year:i+n*400+ +(c<=2),month:c,day:s}}function s(e){switch((e%7+7)%7){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 5:return 5;default:return 6}}function c(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||e<1||e>9999||t<1||t>12?!1:n>=1&&n<=i(e,t)}function l(e,t,n){return c(e,t,n)?{year:e,month:t,day:n}:null}function u(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function d(e){let t=new Date(2e3,0,1);return t.setFullYear(e.year,e.month-1,e.day),t.setHours(0,0,0,0),t}function f(e){let t=n.exec(e);return t?l(Number(t[1]),Number(t[2]),Number(t[3])):null}function p(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function m(e,t){return e.year===t.year?e.month===t.month?e.day-t.day:e.month-t.month:e.year-t.year}function h(e,t){return e===null||t===null?!1:m(e,t)===0}function g(e,t){return o(a(e.year,e.month,e.day)+t)}function _(e,t){return a(t.year,t.month,t.day)-a(e.year,e.month,e.day)}function v(e,t){let n=e.year*12+(e.month-1)+t,r=Math.floor(n/12);return{year:r,month:n-r*12+1}}function y(e,t){return t.year*12+t.month-(e.year*12+e.month)}function b(e){return i(e.year,e.month)}function x(e){return s(a(e.year,e.month,e.day)+4)}function S(){return u(/* @__PURE__ */ new Date)}function C(e){return e===`today`?S():typeof e==`string`?f(e):Number.isNaN(e.getTime())?null:u(e)}function w(e){let t=a(e.year,e.month,e.day),n=(x(e)+6)%7+1,r=t+4-n,i=o(r).year,s=a(i,1,1);return Math.floor((r-s)/7)+1}let T={headline:!0,navigation:`menus`,announceSelection:!0},ee=e=>{let t=e.mode===`range`&&e.presets>0;if(e.layout!==`docked`||e.precision!==`day`)return{months:1,presets:t?`row`:`none`};let n=336+(e.weekNumbers&&e.mode!==`range`?48:0),r=(e,t)=>e*n+(e-1)*24+24+(t?168:0)+32,i=t&&r(1,!0)<=e.width,a=1;for(let t=2;t<=e.months;t+=1)r(t,i)<=e.width&&(a=t);let o=`none`;return i?o=`column`:t&&(o=`row`),{months:a,presets:o}},E=(e,t,n)=>{if(n!==`day`)return!1;switch(e){case`single`:return t!==`docked`;case`range`:return!0;case`multiple`:return!1}},D=e=>{switch(e){case`day`:return`days`;case`month`:return`month-grid`;case`year`:return`year-grid`}},te=(e,t)=>{let n=t===`docked`;switch(e){case`day`:return`days`;case`month`:return n?`month-menu`:`month-grid`;case`year`:return n?`year-menu`:`year-grid`}},ne=(e,t,n,r)=>t?`inline`:e===`auto`?n<600||r<480?`modal`:`docked`:e,re=(e,t,n,r)=>e===`range`&&t===`modal`&&n<r,ie=(e,t,n)=>{let{mode:r,layout:i}=t;return i===`docked`?`docked`:i===`fullscreen`?r===`range`&&e!==`docked`?`fullscreen`:`modal`:e===`modal`?re(r,e,n,t.fullscreenBelow)?`fullscreen`:`modal`:i===`modal`?`modal`:`docked`},ae=(e,t)=>e===`inline`?t:T,oe=(e,t)=>e??t!==`inline`;function se(e){let t=[...e].sort(m);return t.filter((e,n)=>n===0||m(t[n-1],e)!==0)}function O(e){switch(e){case`single`:return{mode:e,date:null};case`range`:return{mode:e,start:null,end:null};default:return{mode:e,dates:[]}}}function k(e){switch(e.mode){case`single`:return e.date?[e.date]:[];case`range`:return[e.start,e.end].filter(e=>e!==null);default:return e.dates}}function A(e){return k(e).length===0}function j(e){return e.mode!==`range`||e.start===null==(e.end===null)}function ce(e,t){return e===null||t===null?e===t:m(e,t)===0}function M(e,t){if(e.mode!==t.mode)return!1;let n=k(e),r=k(t);return n.length===r.length?e.mode===`range`&&t.mode===`range`?ce(e.start,t.start)&&ce(e.end,t.end):n.every((e,t)=>m(e,r[t])===0):!1}function le(e,t){return k(e).some(e=>h(e,t))}function ue(e,t){return e.mode!==`range`||e.start===null||e.end===null||m(e.start,e.end)>=0?null:h(e.start,t)?`start`:h(e.end,t)?`end`:m(t,e.start)>0&&m(t,e.end)<0?`in-range`:null}function de(e,t){return e.mode===`range`&&e.start!==null&&e.end===null&&h(e.start,t)?`start`:ue(e,t)}function N(e){return k(e).at(0)??null}function fe(e,t){let n={};if((e.calendar||t.calendar)&&(n.calendar={...e.calendar,...t.calendar}),e.ui||t.ui){let r={...e.ui,...t.ui};(e.ui?.inline||t.ui?.inline)&&(r.inline={...e.ui?.inline,...t.ui?.inline}),(e.ui?.yearRange||t.ui?.yearRange)&&(r.yearRange={...e.ui?.yearRange,...t.ui?.yearRange}),n.ui=r}return(e.labels||t.labels)&&(n.labels={...e.labels,...t.labels}),(e.behavior||t.behavior)&&(n.behavior={...e.behavior,...t.behavior}),(e.callbacks||t.callbacks)&&(n.callbacks={...e.callbacks,...t.callbacks}),n}let pe=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]),me=/[]/g,he=/^(d{1,2}|M{1,2}|yyyy|yy)([/. -])(d{1,2}|M{1,2}|yyyy|yy)\2(d{1,2}|M{1,2}|yyyy|yy)$/,ge=/^(M{1,2}|yyyy|yy)([/. -])(M{1,2}|yyyy|yy)$/,_e=/* @__PURE__ */ new Map;function ve(e){return e.startsWith(`d`)?`day`:e.startsWith(`M`)?`month`:`year`}function ye(e){let t=he.exec(e);if(!t)return null;let n=[t[1],t[3],t[4]],r=n.map(ve);return new Set(r).size===3?{order:r,separator:t.at(2)??`/`,padDay:n.includes(`dd`),padMonth:n.includes(`MM`),yearDigits:n.includes(`yy`)?2:4}:null}function be(e){let t=ge.exec(e);if(!t)return null;let n=[t[1],t[3]],[r,i]=n.map(ve);return r===i?null:{order:r===`month`?[`day`,`month`,`year`]:[`year`,`month`,`day`],separator:t.at(2)??`/`,padDay:!0,padMonth:n.includes(`MM`),yearDigits:n.includes(`yy`)?2:4}}function xe(e){return e!==`yyyy`&&e!==`yy`?null:{order:[`month`,`day`,`year`],separator:`/`,padDay:!0,padMonth:!0,yearDigits:e===`yy`?2:4}}function Se(e,t){let n=ye(e);if(n!==null||t===`day`)return n;let r=be(e);return r!==null||t===`month`?r:xe(e)}function Ce(e,t=`day`){return e===`auto`||Se(e.trim(),t)!==null}function we(e){let t={day:`2-digit`,month:`2-digit`,year:`numeric`,numberingSystem:`latn`,timeZone:`UTC`};try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(`en-US`,t)}}function Te(e){let t=we(e).formatToParts(new Date(Date.UTC(2024,10,22,12))),n=[],r=``;for(let e of t)e.type===`day`||e.type===`month`||e.type===`year`?n.push(e.type):e.type===`literal`&&r===``&&(r=e.value.replace(me,``).trim());return{order:n.length===3?n:[`month`,`day`,`year`],separator:pe.has(r)?r:`/`,padDay:!0,padMonth:!0,yearDigits:4}}function Ee(e,t,n=`day`){let r=`${e}|${t}|${n}`,i=_e.get(r);if(i)return i;let a=(e===`auto`?null:Se(e.trim(),n))??Te(t);return _e.set(r,a),a}function De(e,t,n){switch(t){case`day`:return n.padDay?String(e.day).padStart(2,`0`):String(e.day);case`month`:return n.padMonth?String(e.month).padStart(2,`0`):String(e.month);default:return n.yearDigits===2?String(e.year%100).padStart(2,`0`):String(e.year).padStart(4,`0`)}}let Oe={day:`dd`,month:`mm`,year:`yyyy`};function ke(e){return{day:e.hintDay,month:e.hintMonth,year:e.hintYear}}function Ae(e,t=Oe){return e.order.map(n=>n===`day`?t.day:n===`month`?t.month:e.yearDigits===2?t.year.slice(0,2):t.year).join(e.separator)}function je(e,t){return t.order.map(n=>De(e,n,t)).join(t.separator)}function P(){return typeof document<`u`}function Me(){return typeof window>`u`}let Ne=new Set(`AG AS BD BR BS BT BW BZ CA CO DM DO ET GT GU HK HN ID IL IN IS JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW`.split(` `)),Pe=new Set(`AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY`.split(` `)),Fe=/* @__PURE__ */ new Set([`MV`]),Ie=/* @__PURE__ */ new Map,Le=/* @__PURE__ */ new Map;function F(e,t){let n=Le.get(t);if(n)return n.format(e);let r=new Intl.NumberFormat(t,{useGrouping:!1});return Le.set(t,r),r.format(e)}function I(e,t){let n=`${e}|${JSON.stringify(t)}`,r=Ie.get(n);if(r)return r;let i=new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`});return Ie.set(n,i),i}function L(e,t,n){let r=new Date(Date.UTC(2e3,0,1,12));return r.setUTCFullYear(e,t-1,n),r}function Re(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 5:return 5;case 6:return 6;default:return null}}function ze(e){if(!(`getWeekInfo`in e))return null;let t=Reflect.get(e,`getWeekInfo`);if(typeof t!=`function`)return null;let n=Reflect.apply(t,e,[]);if(typeof n!=`object`||!n||!(`firstDay`in n))return null;let r=n.firstDay;return typeof r==`number`?Re(r===7?0:r):null}function Be(e){return e===void 0?1:Ne.has(e)?0:Pe.has(e)?6:Fe.has(e)?5:1}function Ve(e){try{let t=new Intl.Locale(e),n=ze(t);return n===null?Be(t.maximize().region):n}catch{return 1}}function He(e){try{return Intl.getCanonicalLocales(e).length>0}catch{return!1}}let Ue=e=>{let t=e?.trim();return!t||!He(t)?null:t};function We(e){let t=Ue(e);if(t!==null)return t;if(P()){let e=Ue(document.documentElement.lang);if(e!==null)return e}if(typeof navigator<`u`){let e=Ue(navigator.language);if(e!==null)return e}return`en-US`}function Ge(e,t){let n=I(e,{month:t});return Array.from({length:12},(e,t)=>n.format(L(2024,t+1,1)))}function Ke(e,t){let n=I(e,{weekday:t});return Array.from({length:7},(e,t)=>n.format(L(2024,1,7+t)))}function qe(e,t){return I(t,{weekday:`short`,month:`short`,day:`numeric`}).format(L(e.year,e.month,e.day))}function Je(e,t){return I(t,{month:`short`,day:`numeric`}).format(L(e.year,e.month,e.day))}function Ye(e,t,n){return I(n,{month:`short`,day:`numeric`}).formatRange(L(e.year,e.month,e.day),L(t.year,t.month,t.day))}function Xe(e,t,n={}){let r={weekday:`long`,month:`long`,day:`numeric`};return I(t,n.year===!1?r:{...r,year:`numeric`}).format(L(e.year,e.month,e.day))}function R(e,t){return I(t,{month:`long`,year:`numeric`}).format(L(e.year,e.month,1))}function Ze(e,t,n){return e.year===t.year&&e.month===t.month?R(e,n):I(n,{month:`long`,year:`numeric`}).formatRange(L(e.year,e.month,1),L(t.year,t.month,1))}function Qe(e,t,n,r){switch(t){case`day`:return r===`headline`?qe(e,n):Xe(e,n);case`month`:return R(e,n);default:return F(e.year,n)}}function $e(e,t){switch(t){case`sunday`:return 0;case`monday`:return 1;case`saturday`:return 6;default:return Ve(e)}}let z={title:`Select date`,monthTitle:`Select month`,yearTitle:`Select year`,noDate:`No date selected`,confirm:`OK`,cancel:`Cancel`,today:`Today`,clear:`Clear`,openCalendar:`Choose date`,previousMonth:`Previous month`,nextMonth:`Next month`,previousYear:`Previous year`,nextYear:`Next year`,chooseMonth:`Choose month`,chooseYear:`Choose year`,weekNumber:`Week`,invalidDate:`Enter a valid date`,unavailableDate:`This date is not available`,rangeTitle:`Select dates`,rangeStart:`Start`,rangeEnd:`End`,inRange:`In range`,multipleSelected:`{count} selected`,save:`Save`,close:`Close`,switchToInput:`Switch to text input`,switchToCalendar:`Switch to calendar`,dateField:`Date`,startDateField:`Start date`,endDateField:`End date`,invalidRange:`End date must be on or after the start date`,beforeMinDate:`Enter a date on or after {date}`,afterMaxDate:`Enter a date on or before {date}`,presets:`Presets`,pageUpKey:`Page Up`,pageDownKey:`Page Down`,shiftKey:`Shift`,hintDay:`dd`,hintMonth:`mm`,hintYear:`yyyy`},et={calendar:{weekStart:`auto`,mode:`single`,precision:`day`,months:1,pageBy:`view`,presets:[]},ui:{displayMode:`auto`,layout:`auto`,inline:{enabled:!1,headline:!0,navigation:`menus`,announceSelection:!0},format:`auto`,theme:`basic`,colorScheme:`auto`,weekNumbers:!1,outsideDays:!1,fixedWeeks:!1,yearRange:{before:100,after:20},todayButton:!1,clearButton:!1,animation:!0,allowPageScroll:!1,fullscreen:!0,cssClass:``,swipe:!0,viewSwitch:!0,initialView:`calendar`,mask:!1,startView:`day`},labels:z,behavior:{closeOnSelect:!1,closeOnCancel:!0,commitOnChange:!1,ignoreOutsideClick:!1,returnFocus:!0}},tt=/[٠-٩۰-۹]/g,nt=/[]/g,rt=/^[]$/,it=/[\s./-]+/,at=/^\d+$/,ot=/^\d{8}$/;function st(e){let t=e.charCodeAt(0);return String(t-(t>=1776?1776:1632))}function ct(e){return e.replace(tt,st)}function lt(e){return e.replace(nt,``).replace(tt,st).trim()}function ut(e,t){if(ot.test(e)){let n=[],r=0;for(let i of t){let t=i===`year`?4:2;n.push(e.slice(r,r+t)),r+=t}return n}let n=e.split(it).filter(e=>e!==``);return n.length!==3||!n.every(e=>at.test(e))?null:n}function dt(e){let t=lt(e).split(it).filter(e=>e!==``);return t.every(e=>at.test(e))?t:null}function ft(e){if(e.length===4)return Number(e);if(e.length!==2)return null;let t=2e3+Number(e);return t<=S().year+20?t:1900+Number(e)}function pt(e,t){let n=ut(lt(e),t.order);if(n===null)return null;let r=0,i=0,a=0;for(let[e,o]of t.order.entries()){let t=n[e]??``;if(o===`year`)a=ft(t);else if(t.length>2)return null;else o===`day`?r=Number(t):i=Number(t)}return a===null?null:l(a,i,r)}let mt=/^(\d{4})-(\d{2})$/,ht=/^\d{4}$/;function gt(e,t){switch(t){case`day`:return e;case`month`:return{year:e.year,month:e.month,day:1};default:return{year:e.year,month:1,day:1}}}function _t(e,t){let n=p(e);switch(t){case`day`:return n;case`month`:return n.slice(0,7);default:return n.slice(0,4)}}function vt(e,t){let n=f(e);if(n!==null||t===`day`)return n===null?null:gt(n,t);if(t===`month`){let t=mt.exec(e);return t?l(Number(t[1]),Number(t[2]),1):null}return ht.test(e)?l(Number(e),1,1):null}function yt(e,t){return{...e,order:e.order.filter(e=>e===`year`||t===`month`&&e===`month`)}}function B(e,t,n){return n===`day`?je(e,t):je(e,yt(t,n))}function bt(e,t,n){return Ae(t===`day`?e:yt(e,t),n)}function xt(e,t,n){if(n===`day`)return pt(e,t);let{order:r}=yt(t,n),i=dt(e);if(i?.length!==r.length)return null;let a=1,o=null;for(let[e,t]of r.entries()){let n=i[e]??``;if(t===`year`)o=ft(n);else if(n.length>2)return null;else a=Number(n)}return o===null?null:l(o,a,1)}function St(e,t){if(A(e))return null;switch(e.mode){case`single`:return e.date?t(e.date):null;case`range`:return e.start===null||e.end===null?null:{start:t(e.start),end:t(e.end)};default:return k(e).map(t)}}function Ct(e,t){if(e===`today`)return gt(S(),t);if(typeof e==`string`)return vt(e,t);if(e instanceof Date){let n=C(e);return n===null?null:gt(n,t)}return null}function wt(e){if(!(`start`in e&&`end`in e))return null;let t=Ct(e.start,`day`),n=Ct(e.end,`day`);return t===null||n===null||m(t,n)>0?null:{mode:`range`,start:t,end:n}}function Tt(e){let t=[];for(let n of e){let e=Ct(n,`day`);if(e===null)return null;t.push(e)}return{mode:`multiple`,dates:se(t)}}function V(e,t,n){if(e===null)return O(t);if(t===`multiple`)return Array.isArray(e)?Tt(e):null;if(t===`single`){let r=Ct(e,n);return r===null?null:{mode:t,date:r}}return typeof e==`object`&&!Array.isArray(e)&&!(e instanceof Date)?wt(e):null}function Et(e,t){return e instanceof Date?e:typeof e!=`string`||e===`today`&&!t?null:e}function Dt(e,t,n,r){if(e===void 0)return null;let i=Et(e,t),a=i===null?null:C(i);return a===null&&r.push({option:n,value:e}),a}function Ot(e,t,n,r){return e==null?null:V(e,t,n)===null?(r.push({option:`calendar.defaultValue`,value:e}),null):()=>V(e,t,n)}function kt(e,t,n){return e===void 0?null:Array.isArray(e)?e.map(e=>Dt(e,!1,t,n)).filter(e=>e!==null):(n.push({option:t,value:e}),null)}function H(e,t,n,r,i){if(e===void 0)return n;let a=t(e);return a===void 0?(i.push({option:r,value:e}),n):a}let U=e=>typeof e==`boolean`?e:void 0,At=e=>typeof e==`string`?e:void 0,jt=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,Mt=e=>typeof e==`number`&&Number.isInteger(e)&&e>=1?e:void 0,Nt=e=>{if(typeof e==`function`)return t=>Reflect.apply(e,void 0,[t])},Pt=e=>{if(typeof e==`function`)return t=>Reflect.apply(e,void 0,[t])},Ft=e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.entries(e),n={};for(let[e,r]of t){if(typeof r!=`string`)return;n[e]=r}return t.length>0?n:void 0},It=e=>typeof HTMLElement<`u`&&e instanceof HTMLElement||typeof e==`string`&&e.length>0?e:void 0;function W(e){return t=>e.find(e=>e===t)}function Lt(e){return t=>typeof t==`string`&&Ce(t,e)?t:void 0}let Rt=W([`auto`,`docked`,`modal`]),zt=W([`auto`,`light`,`dark`]),Bt=W([`auto`,`sunday`,`monday`,`saturday`]),Vt=W([`single`,`range`,`multiple`]),Ht=W([`calendar`,`input`]),Ut=W([`day`,`month`,`year`]),Wt=W([`month`,`view`]),Gt=W([`day`,`month`,`year`]),Kt=W([`auto`,`docked`,`modal`,`fullscreen`]),qt=W([`menus`,`caption`]),Jt=W([`basic`,`m3-green`,`crane`,`crane-straight`,`m2`,`glassmorphic`,`pastel`,`ai`,`cyberpunk`,`blueprint`]);function Yt(e){return e in z}function Xt(e,t){let n={...z};for(let r of Object.keys(z))Yt(r)&&r!==`multipleSelected`&&(n[r]=H(e?.[r],At,z[r],`labels.${r}`,t));return n.multipleSelected=H(e?.multipleSelected,Ft,z.multipleSelected,`labels.multipleSelected`,t),n}function Zt(e,t){return e===void 0||e===!0?600:e===!1?0:H(e,Mt,600,`ui.fullscreen`,t)}function Qt(e,t){return e===void 0||e===!1?!1:e===!0?{selectable:!0}:typeof e==`object`&&e?{selectable:H(Reflect.get(e,`selectable`),U,!0,`ui.outsideDays.selectable`,t)}:(t.push({option:`ui.outsideDays`,value:e}),!1)}function $t(e,t){return e===void 0||e===!1?!1:e===!0?{clearInput:!0}:typeof e==`object`&&e?{clearInput:H(Reflect.get(e,`clearInput`),U,!0,`ui.clearButton.clearInput`,t)}:(t.push({option:`ui.clearButton`,value:e}),!1)}let en=`calendar.range.presets`;function tn(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`label`),n=Reflect.get(e,`value`);return typeof t!=`string`||t===``?null:typeof n==`function`?{label:t,value:()=>Reflect.apply(n,void 0,[])}:typeof n==`object`&&n?{label:t,value:()=>n}:null}function nn(e,t){if(e===void 0)return et.calendar.presets;if(!Array.isArray(e))return t.push({option:en,value:e}),et.calendar.presets;let n=e,r=[];for(let e of n){let n=tn(e);n===null?t.push({option:en,value:e}):r.push(n)}return r}function rn(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6}function an(e,t){let n=e?.trim();n&&!He(n)&&t.push({option:`calendar.locale`,value:e})}function on(e,t){if(e===void 0)return[];if(!Array.isArray(e))return t.push({option:`calendar.disabledWeekdays`,value:e}),[];let n=e,r=[];for(let e of n)rn(e)?r.includes(e)||r.push(e):t.push({option:`calendar.disabledWeekdays`,value:e});return r}function sn(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`className`),n=Reflect.get(e,`badge`),r=Reflect.get(e,`label`);return{...typeof t==`string`?{className:t}:{},...typeof n==`boolean`?{badge:n}:{},...typeof r==`string`?{label:r}:{}}}function cn(e){return typeof e==`string`||typeof Node<`u`&&e instanceof Node?e:null}function ln(t){return t===null?null:n=>{try{return cn(t(n))}catch(t){return e(t),null}}}function un(t){return t===null?null:n=>{try{let e=t(n);return typeof e!=`string`||e.length===0?null:e}catch(t){return e(t),null}}}function dn(e,t,n){let r=et.calendar,i=H(e,Ut,r.precision,`calendar.precision`,n);return i!==`day`&&t!==`single`?(n.push({option:`calendar.precision`,value:e}),r.precision):i}function fn(e,t){let n=H(e?.range?.minLength,Mt,null,`calendar.range.minLength`,t),r=H(e?.range?.maxLength,Mt,null,`calendar.range.maxLength`,t),i=H(e?.multiple?.max,Mt,null,`calendar.multiple.max`,t);return n!==null&&r!==null&&n>r?(t.push({option:`calendar.range`,value:e?.range}),{minLength:n,maxLength:null,multipleMax:i}):{minLength:n,maxLength:r,multipleMax:i}}function pn(e,t){let n=et.calendar;an(e?.locale,t);let r=We(e?.locale),i=H(e?.weekStart,Bt,n.weekStart,`calendar.weekStart`,t),a=H(e?.isDateDisabled,Nt,null,`calendar.isDateDisabled`,t),o=H(e?.decorateDate,Nt,null,`calendar.decorateDate`,t),s=H(e?.renderDate,Nt,null,`calendar.renderDate`,t),c=H(e?.validate,Pt,null,`calendar.validate`,t),l=H(e?.mode,Vt,n.mode,`calendar.mode`,t),u=dn(e?.precision,l,t);return{locale:r,weekStart:$e(r,i),minDate:Dt(e?.minDate,!0,`calendar.minDate`,t),maxDate:Dt(e?.maxDate,!0,`calendar.maxDate`,t),disabledDates:kt(e?.disabledDates,`calendar.disabledDates`,t)??[],enabledDates:kt(e?.enabledDates,`calendar.enabledDates`,t),mode:l,precision:u,defaultValue:Ot(e?.defaultValue,l,u,t),months:H(e?.months,Mt,n.months,`calendar.months`,t),pageBy:H(e?.pageBy,Wt,n.pageBy,`calendar.pageBy`,t),limits:fn(e,t),presets:nn(e?.range?.presets,t),isDateDisabled:a===null?null:e=>!!a(e),disabledWeekdays:on(e?.disabledWeekdays,t),decorateDate:o===null?null:e=>sn(o(e)),renderDate:ln(s),validate:un(c)}}function mn(e){let t=[],n=et,r=e?.calendar,i=e?.ui,a=e?.behavior,o=(e,n,r,i)=>H(e,n,r,i,t),s=pn(r,t),{locale:c,precision:l}=s,u=o(i?.format,Lt(l),n.ui.format,`ui.format`),d=o(i?.footer,U,!1,`ui.footer`),f=a?.id;return{...s,displayMode:o(i?.displayMode,Rt,n.ui.displayMode,`ui.displayMode`),layout:o(i?.layout,Kt,n.ui.layout,`ui.layout`),inline:{enabled:o(i?.inline?.enabled,U,n.ui.inline.enabled,`ui.inline.enabled`),container:o(i?.inline?.container,It,null,`ui.inline.container`),headline:o(i?.inline?.headline,U,n.ui.inline.headline,`ui.inline.headline`),navigation:o(i?.inline?.navigation,qt,n.ui.inline.navigation,`ui.inline.navigation`),announceSelection:o(i?.inline?.announceSelection,U,n.ui.inline.announceSelection,`ui.inline.announceSelection`)},pattern:Ee(u,c,l),theme:o(i?.theme,Jt,n.ui.theme,`ui.theme`),colorScheme:o(i?.colorScheme,zt,n.ui.colorScheme,`ui.colorScheme`),toggleButton:o(i?.toggleButton,It,null,`ui.toggleButton`),endInput:o(i?.endInput,It,null,`ui.endInput`),weekNumbers:o(i?.weekNumbers,U,n.ui.weekNumbers,`ui.weekNumbers`),outsideDays:Qt(i?.outsideDays,t),fixedWeeks:o(i?.fixedWeeks,U,n.ui.fixedWeeks,`ui.fixedWeeks`),yearRange:{before:o(i?.yearRange?.before,jt,n.ui.yearRange.before,`ui.yearRange.before`),after:o(i?.yearRange?.after,jt,n.ui.yearRange.after,`ui.yearRange.after`)},todayButton:o(i?.todayButton,U,n.ui.todayButton,`ui.todayButton`),clearButton:$t(i?.clearButton,t),footerExplicit:typeof i?.footer==`boolean`?d:null,animation:o(i?.animation,U,n.ui.animation,`ui.animation`),allowPageScroll:o(i?.allowPageScroll,U,n.ui.allowPageScroll,`ui.allowPageScroll`),fullscreenBelow:Zt(i?.fullscreen,t),cssClass:o(i?.cssClass,At,n.ui.cssClass,`ui.cssClass`),appendTo:o(i?.appendTo,It,null,`ui.appendTo`),swipe:o(i?.swipe,U,n.ui.swipe,`ui.swipe`),viewSwitch:o(i?.viewSwitch,U,n.ui.viewSwitch,`ui.viewSwitch`),initialView:o(i?.initialView,Ht,n.ui.initialView,`ui.initialView`),mask:o(i?.mask,U,n.ui.mask,`ui.mask`),startView:o(i?.startView,Gt,n.ui.startView,`ui.startView`),labels:Xt(e?.labels,t),behavior:{closeOnSelect:o(a?.closeOnSelect,U,n.behavior.closeOnSelect,`behavior.closeOnSelect`),closeOnCancel:o(a?.closeOnCancel,U,n.behavior.closeOnCancel,`behavior.closeOnCancel`),commitOnChange:o(a?.commitOnChange,U,n.behavior.commitOnChange,`behavior.commitOnChange`),ignoreOutsideClick:o(a?.ignoreOutsideClick,U,n.behavior.ignoreOutsideClick,`behavior.ignoreOutsideClick`),returnFocus:o(a?.returnFocus,U,n.behavior.returnFocus,`behavior.returnFocus`),id:typeof f==`string`&&f.length>0?f:null},callbacks:{...e?.callbacks},issues:t}}let hn=/[^\w-]/g,gn=0;function _n(e){return e.replace(hn,`-`)}function vn(e){return{year:e.year,month:e.month}}var yn=class{input;host;createdHost;instanceId;events=new t;raw;resolved;currentValue;currentDraft;currentView;currentFocus;currentPanel;currentMode=null;currentCalendarLayout=`docked`;currentLayout={months:1,presets:`none`};currentListSpan=null;currentActiveEnd=`start`;currentEndInput=null;activeEndControlled=!1;constructor(e,t,n,r){this.input=e,this.host=t,this.createdHost=n,this.raw=fe({},r??{}),this.resolved=mn(this.raw),gn+=1;let i=this.resolved.behavior.id;this.instanceId=i===null?`dp-ui-${String(gn)}`:_n(i),this.currentPanel=D(this.resolved.precision),this.currentValue=O(this.resolved.mode),this.currentDraft=this.currentValue;let a=S();this.currentFocus=a,this.currentView=vn(a)}get options(){return this.resolved}get rawOptions(){return this.raw}setOptions(e){this.raw=fe(this.raw,e),this.resolved=mn(this.raw),this.events.emit(`change:options`,{})}get value(){return this.currentValue}setValue(e){this.currentValue=e,this.events.emit(`change:value`,{value:e})}get draft(){return this.currentDraft}setDraft(e){this.currentDraft=e,this.events.emit(`change:draft`,{draft:e})}get view(){return this.currentView}setView(e,t,n){let r=vn(e);this.currentView=r,this.events.emit(`change:view`,{view:r,delta:t,source:n})}get focus(){return this.currentFocus}setFocus(e){this.currentFocus=e,this.events.emit(`change:focus`,{focus:e})}get panel(){return this.currentPanel}setPanel(e){e!==this.currentPanel&&(this.currentPanel=e,this.events.emit(`change:panel`,{panel:e}))}get mode(){return this.currentMode}setMode(e){this.currentMode=e}get calendarLayout(){return this.currentCalendarLayout}setCalendarLayout(e){this.currentCalendarLayout=e}get layout(){return this.currentLayout}setLayout(e){this.currentLayout=e}get listSpan(){return this.currentListSpan}setListSpan(e){this.currentListSpan=e}get activeEnd(){return this.currentActiveEnd}setActiveEnd(e){e!==this.currentActiveEnd&&(this.currentActiveEnd=e,this.events.emit(`change:active-end`,{end:e}))}controlActiveEnd(){this.activeEndControlled=!0}get followsActiveEnd(){return this.currentEndInput!==null||this.activeEndControlled}get endInput(){return this.currentEndInput}setEndInput(e){this.currentEndInput=e}resetSession(){let e=N(this.currentValue)??S(),t=vn(e);this.currentListSpan=null,this.setPanel(D(this.resolved.precision)),this.setDraft(this.currentValue),this.setView(t,y(this.currentView,t),`api`),this.setFocus(e)}};let bn=`dp-ui`,xn=[`class`,`name`,`aria-invalid`,`aria-describedby`];function Sn(e){return typeof e==`string`?document.querySelector(e):e}function Cn(e){return e instanceof HTMLInputElement?e:e?.querySelector(`input`)??null}function wn(e){let t=document.createElement(`div`);return t.className=bn,e.before(t),t.append(e),t}function Tn(e){if(!P())throw Error(`DatepickerUI needs a document`);let t=Sn(e),n=Cn(t);if(n===null)throw Error(`DatepickerUI could not find an input element`);let r=n.parentElement;return r!==null&&(t!==n||r.classList.contains(bn))?{input:n,host:r,createdHost:!1}:{input:n,host:wn(n),createdHost:!0}}function En(e){let{input:t,host:n,createdHost:r}=e,i=/* @__PURE__ */ new Map;for(let e of xn)i.set(e,t.getAttribute(e));let a=n.classList.contains(bn);return n.classList.add(bn),{target:{input:t,host:n,createdHost:r},hostHadClass:a,inputAttributes:i}}function Dn(e){let{input:t,host:n,createdHost:r}=e.target;for(let[n,r]of e.inputAttributes)r===null?t.removeAttribute(n):t.setAttribute(n,r);r?t.parentNode===n?n.replaceWith(t):n.remove():e.hostHadClass||n.classList.remove(bn)}function On(e,t,n,r){let i=y(e,t);return i>=0&&i<n?e:r===`month`?i<0?t:v(t,-(n-1)):v(e,Math.floor(i/n)*n)}function kn(e,t){let{core:n,managers:r}=e,{minDate:i,maxDate:a}=n.options,o=r.validation.yearBounds(),s={year:o.min,month:1,day:1},c={year:o.max,month:12,day:31},l=i!==null&&m(i,s)>0?i:s,u=a!==null&&m(a,c)<0?a:c;return m(t,l)<0?l:m(t,u)>0?u:t}function An(e,t,n){return kn(e,{year:t.year,month:t.month,day:Math.min(n,b(t))})}function jn(e,t,n){let{core:r,managers:i}=e,a=i.validation.clampView(t),o=y(r.view,a);return o!==0&&(r.setView(a,o,n),r.setFocus(An(e,a,r.focus.day))),a}function G(e,t,n){let{core:r,managers:i}=e,a={year:t.year,month:t.month},{months:o}=r.layout,s=i.validation.clampView(On(r.view,a,o,r.options.pageBy)),c=y(s,a);if(c<0||c>=o)return;let l=y(r.view,s);l!==0&&r.setView(s,l,n),r.setFocus(t)}function Mn(e,t,n){let r=_(e,t)+1;return n.minLength!==null&&r<n.minLength?!1:n.maxLength===null||r<=n.maxLength}function Nn(e,t,n,r){let i=r;if(t.maxLength!==null){let n=g(e,t.maxLength-1);i=m(n,r)<0?n:r}for(let t=g(e,1);m(t,i)<=0;t=g(t,1))if(n(t))return t;return null}function Pn(e,t,n,r){if(e.mode===`multiple`){let{multipleMax:n}=t,{dates:r}=e;return t=>n!==null&&r.length>=n&&!le(e,t)}if(e.mode!==`range`||e.start===null||e.end!==null)return()=>!1;let{start:i}=e,a=null,o=!1;return e=>m(e,i)<0?!1:m(e,r)>0||!Mn(i,e,t)||(o||=(a=Nn(i,t,n,r),!0),a!==null&&m(e,a)>=0)}function Fn(e,t,n,r){if(!Mn(e,t,n))return`range-length`;for(let n=e;m(n,t)<=0;n=g(n,1)){let e=r(n);if(e!==null)return e}return null}function In(e,t){for(let n of e){let e=t(n);if(e!==null)return e}return null}function Ln(e,t,n){switch(e.mode){case`single`:return e.date===null?null:n(e.date);case`range`:return e.start!==null&&e.end!==null?Fn(e.start,e.end,t,n):e.start===null?null:n(e.start);default:return t.multipleMax!==null&&e.dates.length>t.multipleMax?`multiple-max`:In(e.dates,n)}}function Rn(e,t,n){return Ln(e,t,e=>n(e)?`disabled`:null)===null}function zn(e,t,n){return e.some(e=>m(e,t)===0)?e.filter(e=>m(e,t)!==0):n.multipleMax!==null&&e.length>=n.multipleMax?null:se([...e,t])}function Bn(e){return e.mode===`range`&&e.start!==null&&e.end===null?`end`:`start`}function Vn(e,t){return e.mode===`range`?t===`start`?{mode:`range`,start:null,end:null}:{mode:`range`,start:e.start,end:null}:e}function Hn(e,t,n,r){switch(e.mode){case`single`:return{mode:`single`,date:t};case`range`:return r===`start`||e.start===null||m(t,e.start)<0?{mode:`range`,start:t,end:null}:{mode:`range`,start:e.start,end:t};default:{let r=zn(e.dates,t,n);return r===null?e:{mode:`multiple`,dates:r}}}}var Un=class{context;session;values;constructor(e,t,n){this.context=e,this.session=t,this.values=n}isOpen(){return this.session.active}select(e){let{core:t,managers:n}=this.context,r=gt(e,t.options.precision),i=t.followsActiveEnd?t.activeEnd:Bn(t.draft);if(!this.session.active||!n.validation.isSelectable(r,Vn(t.draft,i)))return;G(this.context,r,`button`);let a=Hn(t.draft,r,t.options.limits,i);t.setDraft(a),t.setActiveEnd(Bn(a)),this.announce(a,r),this.isOpen()&&this.autoCommit(a)}selectRange(e,t){let{core:n,managers:r}=this.context,{mode:i,limits:a}=n.options;if(!this.session.active||i!==`range`)return;let o={mode:`range`,start:e,end:t};Ln(o,a,e=>r.validation.unavailableReason(e))===null&&(n.setDraft(o),n.setActiveEnd(`start`),G(this.context,e,`api`),this.emitRangeEnd(e,t),this.isOpen()&&this.autoCommit(o))}typeDraft(e){if(!this.acceptTyped(e))return;let{commitOnChange:t}=this.context.core.options.behavior;t&&j(e)&&this.values.commit(!0)}submitDraft(){let{core:e}=this.context,t=e.draft,n=e.options.behavior.closeOnSelect&&t.mode!==`multiple`;this.session.active&&n&&j(t)&&(M(e.value,t)||this.values.commit(!0),this.session.close())}acceptTyped(e){let{core:t,managers:n}=this.context,{mode:r,limits:i}=t.options,a=e.mode===r&&Rn(e,i,e=>n.validation.isDisabled(e));if(!this.session.active||!a||M(t.draft,e))return!1;t.setDraft(e);let o=N(e);return o!==null&&G(this.context,o,`api`),this.announceTyped(e),!0}announceTyped(e){let{emitter:t}=this.context,{describe:n}=this.values;e.mode===`single`?e.date!==null&&t.emit(`select:day`,{value:n(e.date),selected:!0}):e.mode===`range`&&e.start!==null&&(e.end===null?t.emit(`range:start`,{value:n(e.start)}):this.emitRangeEnd(e.start,e.end))}announce(e,t){let{emitter:n}=this.context,{describe:r}=this.values;n.emit(`select:day`,{value:r(t),selected:le(e,t)}),e.mode===`range`&&(e.start===null||e.end===null?n.emit(`range:start`,{value:r(t)}):this.emitRangeEnd(e.start,e.end))}emitRangeEnd(e,t){let{describe:n}=this.values;this.context.emitter.emit(`range:end`,{start:n(e),end:n(t)})}autoCommit(e){if(e.mode===`range`&&e.end===null)return;let{closeOnSelect:t,commitOnChange:n}=this.context.core.options.behavior,r=t&&e.mode!==`multiple`;(r||n)&&this.values.commit(!0),r&&this.session.close()}},Wn=class{context;session;values;selector;constructor(e,t,n){this.context=e,this.session=t,this.values=n,this.selector=new Un(e,t,n)}isOpen(){return this.session.active}select(e){this.selector.select(e)}selectRange(e,t){this.selector.selectRange(e,t)}typeDraft(e){this.selector.typeDraft(e)}submitDraft(){this.selector.submitDraft()}focusDate(e){this.session.active&&G(this.context,e,`keyboard`)}navigate(e,t){this.session.active&&jn(this.context,v(this.context.core.view,e),t)}page(e,t){let{core:n}=this.context,r=n.options.pageBy===`view`?n.layout.months:1;this.navigate(e*r,t)}jumpTo(e,t){if(!this.session.active)return;let{core:n}=this.context,r=n.panel,i=jn(this.context,e,t);t===`menu`&&(n.setPanel(D(n.options.precision)),this.announcePick(r,i))}showPanel(e){this.session.active&&this.context.core.setPanel(e)}confirm(){this.session.active&&j(this.context.core.draft)&&(this.values.commit(!1),this.session.close())}cancel(e){if(!this.session.active)return;let{core:t,emitter:n}=this.context;n.emit(`cancel`,{reason:e}),this.isOpen()&&((t.options.behavior.closeOnCancel||e!==`button`)&&t.mode!==`inline`?this.session.close():t.setDraft(t.value))}today(){if(!this.session.active)return;let{core:e,managers:t}=this.context,n=S();t.validation.isSelectable(n,e.draft)?this.select(n):G(this.context,n,`button`)}clear(){if(!this.session.active)return;let{core:e}=this.context,{clearButton:t}=e.options,n=t!==!1&&t.clearInput,r=this.values.clearedSelection(n);r!==null&&(this.values.emitClear(r),!this.isOpen())||(e.setDraft(O(e.options.mode)),n&&(this.values.commit(!1),this.session.close()))}announcePick(e,t){let{emitter:n}=this.context;e===`month-menu`||e===`month-grid`?n.emit(`select:month`,{year:t.year,month:t.month}):(e===`year-menu`||e===`year-grid`)&&n.emit(`select:year`,{year:t.year})}},Gn=class{context;subscriptions=[];constructor(e){this.context=e}bind(){for(let e of this.subscriptions)e();this.subscriptions=[];let{callbacks:e}=this.context.core.options;this.add(`open`,e.onOpen),this.add(`close`,e.onClose),this.add(`cancel`,e.onCancel),this.add(`confirm`,e.onConfirm),this.add(`update`,e.onUpdate),this.add(`error`,e.onError),this.add(`select:day`,e.onSelectDay),this.add(`select:month`,e.onSelectMonth),this.add(`select:year`,e.onSelectYear),this.add(`range:start`,e.onRangeStart),this.add(`range:end`,e.onRangeEnd),this.add(`navigate`,e.onNavigate),this.add(`switch:view`,e.onSwitchView),this.add(`clear`,e.onClear)}add(e,t){t!==void 0&&this.subscriptions.push(this.context.emitter.on(e,t))}};function K(e,t){return e===null?null:typeof e==`string`?P()?t?.querySelector(e)??document.querySelector(e):null:e}function q(e,t,n){let r=document.createElement(e);return t&&(r.className=t),n&&Object.entries(n).forEach(([e,t])=>{r.setAttribute(e,t)}),r}function Kn(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();n===`center`?e.scrollTop+=i.top-r.top-(r.height-i.height)/2:i.top<r.top?e.scrollTop+=i.top-r.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)}function qn(e,t,n){let r=q(`button`,e,{type:`button`});return n?(r.setAttribute(`aria-label`,t),r.innerHTML=n):r.textContent=t,r}let Jn=[`class`,`name`,`aria-invalid`];function Yn(e){let{core:t,emitter:n}=e,{endInput:r,mode:i}=t.options;if(i!==`range`||r===null)return null;let a=K(r,t.host);return a instanceof HTMLInputElement&&a!==t.input?a:(n.emit(`error`,{code:`invalid-option`,message:`ui.endInput does not match an input element`,option:`ui.endInput`}),null)}function Xn(e){let t=/* @__PURE__ */ new Map;for(let n of Jn)t.set(n,e.getAttribute(n));return()=>{for(let[n,r]of t)r===null?e.removeAttribute(n):e.setAttribute(n,r)}}let Zn=[`calendar`,`ui`,`labels`,`behavior`,`callbacks`];function Qn(e){let t=[];for(let n of Zn){let r=e[n];if(r!==void 0)for(let e of Object.keys(r))t.push(`${n}.${e}`)}return t}function $n(e,t){return e.some(e=>t.option===e||t.option.startsWith(`${e}.`))}function er(e,t){for(let n of t)e.emitter.emit(`error`,{code:`invalid-option`,message:`Invalid value for option ${n.option}`,option:n.option})}var tr=class{context;session;callbacks;triggers;constructor(e,t,n,r){this.context=e,this.session=t,this.callbacks=n,this.triggers=r}apply(e){let{core:t,emitter:n,status:r}=this.context;if(r.destroyed)return;let i=t.options;t.setOptions(e),t.options.mode!==i.mode&&this.resetSelection(),r.created&&this.reapply(i,e),n.emit(`update`,{options:e})}resetSelection(){let{core:e,managers:t,status:n}=this.context,r=O(e.options.mode);e.setValue(r),e.setDraft(r),n.created&&(t.input.write(r),t.form.sync())}reapply(e,t){let{core:n,managers:r}=this.context;this.callbacks.bind(),r.theme.applyHost(),this.triggers.bind(),A(n.value)||r.input.write(n.value),r.triggers.updateLabel(),this.refreshSurface(e);let i=Qn(t);er(this.context,n.options.issues.filter(e=>$n(i,e)))}refreshSurface(e){let{core:t}=this.context,n=t.options;if(n.inline.enabled!==e.inline.enabled||n.inline.enabled&&n.inline.container!==e.inline.container){this.session.end(),n.inline.enabled&&this.session.mountInline();return}let r=t.mode;if(!this.session.active||r===null)return;let i=r===`inline`||n.displayMode===e.displayMode?r:this.session.pickMode();i!==r||n.mode!==e.mode||n.layout!==e.layout?this.session.remount(i):this.session.refresh(i,`api`)}},nr=class{context;session;callbacks;triggers;controller=new AbortController;hostSnapshot;restoreEndInput=null;constructor(e,t,n,r){this.context=e,this.session=t,this.callbacks=n,this.triggers=r,this.hostSnapshot=En(e.core)}create(){let{core:e,managers:t,status:n}=this.context;if(n.created||n.destroyed)return;n.created=!0;let r=this.controller.signal;this.callbacks.bind(),t.theme.applyHost();let i=Yn(this.context);e.setEndInput(i),i!==null&&(this.restoreEndInput=Xn(i));let a=this.initialSelection();e.setValue(a),A(a)||t.input.write(a),t.form.bind(r),t.form.sync(),t.input.bind(r),this.triggers.bind(),t.triggers.updateLabel(),e.events.on(`change:value`,()=>{t.triggers.updateLabel()},r),e.options.inline.enabled&&this.session.mountInline(),er(this.context,e.options.issues)}initialSelection(){let{core:e,managers:t}=this.context;if(!A(e.value))return e.value;let n=t.input.readInitial();return A(n)?e.options.defaultValue?.()??n:n}destroy(e){let{core:t,emitter:n,managers:r,status:i}=this.context;i.destroyed||(i.destroyed=!0,this.session.teardown(),this.triggers.release(),this.controller.abort(),r.destroy(),e||(t.input.value=``,t.endInput!==null&&(t.endInput.value=``)),this.restoreEndInput?.(),this.restoreEndInput=null,t.setEndInput(null),Dn(this.hostSnapshot),t.events.clear(),n.clear())}},rr=class{tail=Promise.resolve();pending=0;stopped=!1;run(t){let n=async()=>{this.stopped||await t()},r=this.pending===0?n():this.tail.then(n);this.pending+=1;let i=r.catch(e).finally(()=>{--this.pending});return this.tail=i,i}stop(){this.stopped=!0}},ir=class{context;views;visible;queue=new rr;controller=null;phase=`closed`;sessionId=0;mounts=0;closing=Promise.resolve();openedFrom=`start`;mountSource=`open`;constructor(e,t,n){this.context=e,this.views=t,this.visible=n}get active(){return this.phase===`open`}open(e,t=`start`){let{core:n,emitter:r,managers:i,status:a}=this.context;if(!a.created||a.destroyed||n.options.inline.enabled)return;if(this.phase===`open`){n.setActiveEnd(t);return}if(e!==`api`&&n.input.disabled)return;let o=this.pickMode();this.openedFrom=t,n.setActiveEnd(t),this.begin(o),i.triggers.setExpanded(!0),r.emit(`open`,{mode:n.mode??o})}fallBackToModal(){this.active&&this.context.core.mode===`docked`&&(this.stopListening(),this.adoptMode(`modal`),this.listen(),this.mount(`modal`,this.mountSource))}mountInline(){let{core:e,emitter:t}=this.context;K(e.options.inline.container)===null?t.emit(`error`,{code:`invalid-option`,message:`ui.inline.container does not match an element`,option:`ui.inline.container`}):(this.begin(`inline`),t.emit(`open`,{mode:`inline`}))}close(){return this.context.core.mode===`inline`?Promise.resolve():this.end()}end(){if(this.phase===`closing`)return this.closing;if(this.phase!==`open`)return Promise.resolve();let{core:e,emitter:t,managers:n}=this.context,r=e.mode,i=this.sessionId;this.phase=`closing`,this.stopListening(),this.visible.reset(),n.triggers.setExpanded(!1);let a=this.queue.run(()=>n.display.unmount()).then(()=>{this.finish(i,r)});return this.closing=a,t.emit(`close`,{}),a}syncLayout(e){let{core:t}=this.context,n=t.options,r=window.innerWidth;if(e===`inline`){let e=K(n.inline.container)?.clientWidth??0;r=e>0?e:r}t.setLayout(ee({months:n.months,precision:n.precision,mode:n.mode,layout:t.calendarLayout,width:r,weekNumbers:n.weekNumbers,presets:n.presets.length}))}remount(e){let{core:t,managers:n}=this.context;this.visible.pause(),this.decideLayout(e),this.syncLayout(e),this.clampView(),t.setMode(e),this.views.dropUnsupported(),this.queue.run(()=>n.display.unmount()),this.mount(e,`api`)}refresh(e,t){let{core:n,managers:r}=this.context;this.visible.hold(t,()=>{this.syncLayout(e),this.clampView(),n.setListSpan(null),r.display.update()})}pickMode(){let{displayMode:e}=this.context.core.options;return ne(e,!1,window.innerWidth,window.innerHeight)}clampView(){jn(this.context,this.context.core.view,`api`)}teardown(){this.phase=`closed`,this.stopListening(),this.visible.reset(),this.queue.stop()}begin(e){this.stopListening(),this.sessionId+=1,this.phase=`open`,this.visible.reset(),this.context.core.resetSession(),this.adoptMode(e),this.listen(),this.mount(e,`open`)}adoptMode(e){let{core:t}=this.context;this.decideLayout(e),t.setPanel(this.views.opening(e)),this.syncLayout(e),this.clampView(),t.setMode(e)}listen(){let e=new AbortController;this.controller=e,this.views.bind(e.signal),this.visible.bind(e.signal),window.addEventListener(`resize`,()=>{this.relayout()},{signal:e.signal})}mount(e,t){let{core:n,managers:r}=this.context;this.mounts+=1,this.mountSource=t;let i=this.mounts;this.queue.run(()=>(n.setListSpan(null),r.display.mount(e))).then(()=>{i===this.mounts&&this.active&&this.visible.resume(t)})}decideLayout(e){let{core:t}=this.context;t.setCalendarLayout(ie(e,t.options,window.innerWidth))}relayout(){let{core:e}=this.context,t=e.mode;if(t===null)return;let n=e.layout;this.syncLayout(t);let r=e.layout;(r.months!==n.months||r.presets!==n.presets)&&this.refresh(t,`resize`)}stopListening(){this.controller?.abort(),this.controller=null}finish(e,t){this.sessionId===e&&this.phase===`closing`&&(this.phase=`closed`,this.context.core.setMode(null),this.returnFocus(t))}returnFocus(e){let{core:t}=this.context;if(!t.options.behavior.returnFocus)return;let n=document.activeElement;(e===`modal`||n===null||n===document.body)&&((this.openedFrom===`end`?t.endInput:null)??t.input).focus({preventScroll:!0})}},ar=class{context;scope=null;constructor(e){this.context=e}bind(){this.release();let{core:e,managers:t}=this.context;if(e.options.inline.enabled)return;let n=new AbortController;this.scope=n,t.triggers.bind(n.signal)}release(){this.scope?.abort(),this.scope=null}};let or=[`start`,`end`];var sr=class{context;session;visible;constructor(e,t,n){this.context=e,this.session=t,this.visible=n}describe=e=>{let{pattern:t,precision:n}=this.context.core.options;return{value:_t(e,n),date:d(e),formatted:B(e,t,n)}};get(){return this.present(this.context.core.value)}set(e){let{core:t,emitter:n,managers:r,status:i}=this.context;if(i.destroyed)return;let a=V(e,t.options.mode,t.options.precision);a===null?n.emit(`error`,{code:`invalid-date`,message:`setValue() received a value that is not a valid date for calendar.mode`,input:typeof e==`string`?e:void 0}):(t.setValue(a),r.input.write(a),i.created&&r.form.sync(),this.follow(),this.validate(a))}isSelectable(e){let{core:t,managers:n}=this.context,{mode:r,precision:i,limits:a}=t.options,o=V(e,r===`single`||typeof e==`string`||e instanceof Date?`single`:r,i);return o===null||A(o)?!1:Rn(o,a,e=>n.validation.isDisabled(e))}clear(){let{core:e,managers:t,status:n}=this.context,r=this.clearedSelection(!0);if(n.destroyed||r===null)return;let i=O(e.options.mode);e.setValue(i),this.session.active&&e.setDraft(i),t.input.write(i),n.created&&(t.form.sync(),t.form.dispatchCommit()),this.emitClear(r),this.validate(i)}clearedSelection(e){let{core:t}=this.context;return e&&!A(t.value)?t.value:this.session.active&&!A(t.draft)?t.draft:null}emitClear(e){this.context.emitter.emit(`clear`,{previousValue:this.present(e)})}setActiveEnd(e){let{core:t,status:n}=this.context,r=or;!n.destroyed&&t.options.mode===`range`&&r.includes(e)&&(t.controlActiveEnd(),t.setActiveEnd(e))}applyTyped(e){let{core:t,emitter:n,managers:r}=this.context,i=!M(t.value,e),a=M(t.draft,e);t.setValue(e),r.form.sync(),(i||!a)&&this.follow(),i&&n.emit(`confirm`,{value:this.present(e),autoCommit:!0}),this.validate(e)}commit(e){let{core:t,emitter:n,managers:r}=this.context,i=t.draft;t.setValue(i),r.input.write(i),r.form.sync(),r.form.dispatchCommit(),n.emit(`confirm`,{value:this.present(i),autoCommit:e}),this.validate(i)}validate(e){let{core:t,managers:n}=this.context,{validate:r}=t.options;if(r===null)return;let i=r(this.present(e));i!==null&&n.input.markInvalid(i)}present(e){return St(e,this.describe)}follow(){if(!this.session.active)return;let{core:e}=this.context,t=e.value;e.setDraft(t);let n=N(t);n!==null&&this.visible.hold(`api`,()=>{G(this.context,n,`api`)})}};let cr=e=>e===`input`?`input`:`calendar`;var lr=class{context;isShown;visible;constructor(e,t,n){this.context=e,this.isShown=t,this.visible=n}get(){return this.isShown()?cr(this.context.core.panel):`calendar`}set(e){let{core:t}=this.context;this.isShown()&&this.hasInputView()&&t.setPanel(e===`input`?`input`:D(t.options.precision))}goTo(e){let t=V(e,`single`,`day`),n=t===null?null:N(t);n===null?this.context.emitter.emit(`error`,{code:`invalid-date`,message:`goTo() received a value that is not a valid date`,input:typeof e==`string`?e:void 0}):this.isShown()&&this.visible.hold(`api`,()=>{G(this.context,kn(this.context,n),`api`)})}bind(e){let{core:t,emitter:n}=this.context,r=cr(t.panel);t.events.on(`change:panel`,({panel:e})=>{let t=cr(e);t!==r&&(r=t,n.emit(`switch:view`,{view:t}))},e)}opening(e){let{core:t}=this.context,{initialView:n,inline:r,mode:i,precision:a,startView:o}=t.options;if(n===`input`&&this.hasInputView())return`input`;let s=ae(e,r).navigation===`caption`;return a!==`day`||i===`range`||s?D(a):te(o,t.calendarLayout)}dropUnsupported(){let{core:e}=this.context;e.panel===`input`&&!this.hasInputView()&&e.setPanel(D(e.options.precision))}hasInputView(){let{core:e}=this.context,{mode:t,precision:n}=e.options;return E(t,e.calendarLayout,n)}};let ur=(e,t)=>({from:{year:e.year,month:e.month,day:1},to:{year:t.year,month:t.month,day:b(t)}}),dr=(e,t,n)=>{let r={year:e.year,month:e.month,day:1},i=(x(r)-t+7)%7,a=n?6:Math.ceil((i+b(e))/7),o=g(r,-i);return{from:o,to:g(o,a*7-1)}},fr=e=>{let t=e.layout===`docked`&&e.months<=1&&e.outsideDays;return{outsideDays:t,fixedWeeks:e.layout!==`docked`&&!e.inline||t||e.fixedWeeks}},pr=e=>{let{view:t,listSpan:n,yearBounds:r}=e;return n===null?e.precision===`year`?ur({year:r.min,month:1},{year:r.max,month:12}):e.precision===`month`?ur({year:t.year,month:1},{year:t.year,month:12}):e.months>1?ur(t,v(t,e.months-1)):e.outsideDays?dr(t,e.weekStart,e.fixedWeeks):ur(t,t):ur(n.first,n.last)};function mr(e){return e<0?-1:+(e>0)}var hr=class{context;isShown;last=null;live=!1;constructor(e,t){this.context=e,this.isShown=t}current(){if(!this.isShown())return null;let{from:e,to:t}=this.compute();return{from:this.describe(e),to:this.describe(t)}}bind(e){this.context.core.events.on(`change:view`,({source:e})=>{this.report(e)},e)}hold(e,t){let n=this.live;this.live=!1;try{t()}finally{this.live=n}this.report(e)}pause(){this.live=!1}resume(e){this.live=!0,this.report(this.last===null?`open`:e)}reset(){this.last=null,this.live=!1}renderedMonths(e,t){this.context.core.setListSpan({first:e,last:t}),this.report(`scroll`)}report(e){if(!this.live)return;let{core:t,emitter:n}=this.context,{from:r,to:i}=this.compute(),a={view:t.view,from:p(r),to:p(i)},o=this.last;if(o?.from===a.from&&o.to===a.to)return;this.last=a;let s=o===null?0:y(o.view,a.view);n.emit(`navigate`,{year:a.view.year,month:a.view.month,direction:mr(s),source:e,from:this.describe(r),to:this.describe(i)})}compute(){let{core:e,managers:t}=this.context,{options:n,layout:r}=e,i=fr({layout:e.calendarLayout,inline:e.mode===`inline`,months:r.months,outsideDays:n.mode!==`range`&&n.outsideDays!==!1,fixedWeeks:n.fixedWeeks});return pr({view:e.view,months:r.months,precision:n.precision,weekStart:n.weekStart,fixedWeeks:i.fixedWeeks,outsideDays:i.outsideDays,yearBounds:t.validation.yearBounds(),listSpan:e.listSpan})}describe(e){return{value:p(e),date:d(e),formatted:B(e,this.context.core.options.pattern,`day`)}}},gr=class{status={created:!1,destroyed:!1};visible;views;session;values;actions;instance;updates;constructor(e,t,n){let r={core:e,emitter:t,managers:n,status:this.status},i=new Gn(r),a=new ar(r),o=()=>this.session.active;this.visible=new hr(r,o),this.views=new lr(r,o,this.visible),this.session=new ir(r,this.views,this.visible),this.values=new sr(r,this.session,this.visible),this.actions=new Wn(r,this.session,this.values),this.instance=new nr(r,this.session,i,a),this.updates=new tr(r,this.session,i,a),n.connect(this)}get created(){return this.status.created}get destroyed(){return this.status.destroyed}create(){this.instance.create()}open(e,t){this.session.open(e,t)}close(){return this.session.close()}destroy(e){this.instance.destroy(e)}setOptions(e){this.updates.apply(e)}getValue(){return this.values.get()}setValue(e){this.values.set(e)}setActiveEnd(e){this.values.setActiveEnd(e)}setView(e){this.views.set(e)}getView(){return this.views.get()}getVisibleRange(){return this.visible.current()}goTo(e){this.views.goTo(e)}isSelectable(e){return this.values.isSelectable(e)}clearValue(){this.values.clear()}applyTyped(e){this.values.applyTyped(e)}fallBackToModal(){this.session.fallBackToModal()}select(e){this.actions.select(e)}selectRange(e,t){this.actions.selectRange(e,t)}typeDraft(e){this.actions.typeDraft(e)}submitDraft(){this.actions.submitDraft()}focusDate(e){this.actions.focusDate(e)}navigate(e,t){this.actions.navigate(e,t)}page(e,t){this.actions.page(e,t)}jumpTo(e,t){this.actions.jumpTo(e,t)}showPanel(e){this.actions.showPanel(e)}confirm(){this.actions.confirm()}cancel(e){this.actions.cancel(e)}today(){this.actions.today()}clear(){this.actions.clear()}renderedMonths(e,t){this.visible.renderedMonths(e,t)}};let _r=`dp-ui--pointer`,vr=[`Shift`,`Control`,`Alt`,`Meta`];function yr(){return Me()||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function br(e){return e?yr()?`reduced`:`full`:`none`}function xr(e,t){e.textContent=``,e.textContent=t}function Sr(e){let t=e.ownerDocument,n=()=>{e.classList.add(_r)},r=t=>{vr.includes(t.key)||e.classList.remove(_r)};return e.addEventListener(`pointerdown`,n,!0),t.addEventListener(`keydown`,r,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`keydown`,r,!0)}}let Cr=`(prefers-color-scheme: dark)`,wr=/^(rgba?|color|oklch|oklab|lab|lch)\(([^)]*)\)$/,Tr=/[\s,/]+/,Er=[`class`,`style`,`data-theme`,`data-color-scheme`],Dr=e=>Math.min(1,Math.max(0,e)),Or=e=>{let t=Dr(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},kr=(e,t,n)=>.2126*Or(e)+.7152*Or(t)+.0722*Or(n),Ar=(e,t)=>{if(e===`none`)return 0;let n=parseFloat(e);return e.endsWith(`%`)?n/100*t:n},jr=(e,t)=>{let n=+(e===`color`);if(e===`color`&&t[0]!==`srgb`)return null;let r=Ar(t[n]??``,e===`lab`||e===`lch`?100:1);switch(e){case`rgb`:case`rgba`:case`color`:{let r=e===`color`?1:255,[i=NaN,a=NaN,o=NaN]=[0,1,2].map(e=>Ar(t[n+e]??``,r)/r);return kr(i,a,o)}case`oklab`:case`oklch`:return Dr(r)**3;default:return Dr((r+16)/116)**3}};function Mr(e){let t=e.trim().toLowerCase();if(t===`transparent`)return{luminance:0,alpha:0};let n=wr.exec(t),r=n?.[1],i=n?.[2];if(r===void 0||i===void 0)return null;let a=i.split(Tr).filter(e=>e!==``),o=r===`color`?4:3,s=a.length>o?Ar(a[o],1):1,c=jr(r,a);return c===null||Number.isNaN(c)||Number.isNaN(s)?null:{luminance:c,alpha:Dr(s)}}let Nr=()=>{let e=getComputedStyle(document.documentElement).getPropertyValue(`color-scheme`);return e.includes(`dark`)?e.includes(`light`)?window.matchMedia(Cr).matches?`dark`:`light`:`dark`:`light`};function Pr(e){if(Me()||!P())return`light`;let t=e;for(;t!==null;){let e=Mr(getComputedStyle(t).backgroundColor);if(e!==null&&e.alpha>=.5)return e.luminance<.179?`dark`:`light`;t=t.parentElement}return Nr()}function Fr(e){if(Me()||!P())return()=>void 0;let t=()=>{e()},n=new MutationObserver(t),r={attributes:!0,attributeFilter:Er};n.observe(document.documentElement,r),n.observe(document.body,r);let i=window.matchMedia(Cr);return i.addEventListener(`change`,t),()=>{n.disconnect(),i.removeEventListener(`change`,t)}}let J={PAGER_SETTLE:350,DOCKED_HEIGHT:300,SELECT_FILL:150,HEADLINE_FADE:50,RIPPLE:450,SURFACE_ENTER:300,SURFACE_ENTER_FADE:100,SURFACE_ACTIONS_DELAY:150,SURFACE_EXIT:150,SCRIM_ENTER:150,SCRIM_EXIT:200,PANEL_FADE_OUT:100,PANEL_FADE_IN:200,WHEEL_SETTLE:90,VIEW_SWITCH:300,VIEW_SWITCH_FADE_OUT:75,VIEW_SWITCH_FADE_IN:150,REDUCED_FADE:150,SNAP_SCROLL_FALLBACK:700},Y={DRAG_START_PX:6,COMMIT_FRACTION:.25,FLICK_VELOCITY:.4,VELOCITY_SAMPLES:5,MIN_SAMPLE_SPAN_MS:1},Ir={EMPHASIZED:`cubic-bezier(0.2, 0, 0, 1)`,EMPHASIZED_DECELERATE:`cubic-bezier(0.05, 0.7, 0.1, 1)`,EMPHASIZED_ACCELERATE:`cubic-bezier(0.3, 0, 0.8, 0.15)`},Lr=e=>e.toLowerCase().replace(/_/g,`-`);function Rr(e,t){Object.entries(J).forEach(([n,r])=>{e.style.setProperty(`--dp-ui-motion-${Lr(n)}`,`${String(t?r:0)}ms`)}),Object.entries(Ir).forEach(([t,n])=>{e.style.setProperty(`--dp-ui-easing-${Lr(t)}`,n)})}let zr=` – `,Br=/\s*[–—]\s*|\s+-\s+/,Vr=/[,;]/;function Hr(e){let t=e.split(Br);if(t.length!==2)return null;let[n,r]=t;return[n,r]}function Ur(e,t,n){return k(e).map(e=>B(e,t,n)).join(e.mode===`range`?zr:`, `)}function Wr(e,t){let n=[];for(let r of e){let e=t(r);if(e===null)return null;n.push(e)}return n}function Gr(e){if(e?.length!==2)return null;let[t,n]=e;return m(t,n)>0?null:{mode:`range`,start:t,end:n}}function Kr(e,t,n,r,i){switch(t){case`single`:{let r=n(e);return r===null?null:{mode:t,date:r}}case`range`:{let t=r(e);return t===null?null:Gr(Wr(t,n))}default:{let r=Wr(e.split(i).filter(e=>e.trim()!==``),n);return r===null?null:{mode:t,dates:se(r)}}}}function qr(e,t,n,r){let i=e.trim();return i===``?O(t):Kr(i,t,e=>xt(e.trim(),n,r),Hr,Vr)}function Jr(e,t){return e.mode===`range`?e.start===null||e.end===null?``:`${_t(e.start,t)}/${_t(e.end,t)}`:k(e).map(e=>_t(e,t)).join(`,`)}function Yr(e,t,n){let r=e.trim();return r===``?O(t):Kr(r,t,e=>vt(e.trim(),n),e=>e.split(`/`),/,/)}function Xr(e,t,n){if(t===`range`)return e.rangeTitle;switch(n){case`month`:return e.monthTitle;case`year`:return e.yearTitle;case`day`:return e.title}}let Zr=/* @__PURE__ */ new Map,Qr=/* @__PURE__ */ new Map;function $r(e){let t=Zr.get(e);if(t)return t;let n=new Intl.PluralRules(e);return Zr.set(e,n),n}function ei(e){let t=Qr.get(e);if(t)return t;let n=new Intl.NumberFormat(e);return Qr.set(e,n),n}function ti(e,t,n){return(typeof e==`string`?e:e[$r(n).select(t)]??e.other??Object.values(e).at(0)??``).replaceAll(`{count}`,ei(n).format(t))}function ni(e,t,n,r,i){switch(e.mode){case`single`:return e.date?Qe(e.date,i,n,`headline`):r.noDate;case`range`:{if(t===`input`&&e.start&&e.end)return Ye(e.start,e.end,n);let i=e.start?Je(e.start,n):r.rangeStart,a=e.end?Je(e.end,n):r.rangeEnd;return`${i}${zr}${a}`}default:return e.dates.length===0?r.noDate:ti(r.multipleSelected,e.dates.length,n)}}function ri(e,t){let n=Math.max(e.getBoundingClientRect().height,e.scrollHeight),{top:r,bottom:i}=t.getBoundingClientRect(),a=window.innerHeight-i-8,o=r-8;return n<=Math.max(a,o)}let ii=`dp-ui--ripple-pressed`,ai=`dp-ui--ripple-active`,oi=e=>e.getAttribute(`aria-disabled`)===`true`||e instanceof HTMLButtonElement&&e.disabled;function si(e,t,n){let r=e=>e instanceof Element?e.closest(t):null,i=e=>{r(e.target)?.classList.remove(ii)};e.addEventListener(`pointerdown`,t=>{let a=r(t.target);if(!a||!e.contains(a)||oi(a)||t.pointerType===`mouse`&&t.button!==0)return;a.classList.remove(ai);let{left:o,top:s,width:c,height:l}=a.getBoundingClientRect();a.style.setProperty(`--dp-ui-ripple-x`,`${String(t.clientX-o)}px`),a.style.setProperty(`--dp-ui-ripple-y`,`${String(t.clientY-s)}px`),a.style.setProperty(`--dp-ui-ripple-size`,`${String(Math.max(c,l)*2)}px`),a.style.setProperty(`--dp-ui-ripple-duration`,`${String(J.RIPPLE)}ms`),a.classList.add(ii),a.addEventListener(`pointerleave`,i,{once:!0,signal:n}),yr()||(requestAnimationFrame(()=>{a.classList.add(ai)}),window.setTimeout(()=>{a.classList.remove(ai)},J.RIPPLE))},{signal:n}),e.addEventListener(`pointerup`,i,{signal:n}),e.addEventListener(`pointercancel`,i,{signal:n})}let X={calendar:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Z"/></svg>`,pencil:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"/></svg>`,arrowDropDown:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M480-360 280-560h400L480-360Z"/></svg>`,keyboardArrowLeft:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"/></svg>`,keyboardArrowRight:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>`,check:`<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg>`},ci=e=>{let t=t=>`${e.shiftKey}+${t}`;return{previousMonth:{keys:`PageUp`,display:e.pageUpKey},nextMonth:{keys:`PageDown`,display:e.pageDownKey},previousYear:{keys:`Shift+PageUp`,display:t(e.pageUpKey)},nextYear:{keys:`Shift+PageDown`,display:t(e.pageDownKey)},chooseMonth:{keys:`Shift+M`,display:t(`M`)},chooseYear:{keys:`Shift+Y`,display:t(`Y`)}}},Z=(e,t)=>`dp-ui-${e.replace(/[^\w-]/g,`-`)}-${t}`,li=(e,t,n)=>{n!==void 0&&(e.setAttribute(`title`,`${t} (${n.display})`),e.setAttribute(`aria-keyshortcuts`,n.keys))},ui=(e,t)=>{let n=q(`span`);n.innerHTML=e;let r=n.firstElementChild;return r===null?null:(r.setAttribute(`class`,t),r.setAttribute(`aria-hidden`,`true`),r)},Q=(e,t,n,r)=>{let i=qn(`dp-ui__icon-button dp-ui__icon-button--${e}`,t,n);return i.firstElementChild?.setAttribute(`aria-hidden`,`true`),li(i,t,r),i},di=(e,t,n)=>{let r=q(`button`,`dp-ui__menu-button dp-ui__menu-button--${e}`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":`false`,"aria-controls":n.controls});li(r,n.name,n.shortcut);let i=q(`span`,`dp-ui__menu-button-label`);r.append(i);let a=ui(X.arrowDropDown,`dp-ui__menu-button-icon`);a!==null&&r.append(a);let o=(e,t=e)=>{i.textContent=e,r.setAttribute(`aria-label`,`${n.name}, ${t}`)};return o(t),{button:r,label:i,setText:o}},fi=(e,t)=>qn(`dp-ui__text-button dp-ui__text-button--${e}`,t),pi=(e,t)=>{let n=Q(`switch-view`,e.switchToInput,X.pencil);return{button:n,setInputView:r=>{n.innerHTML=r?X.calendar:X.pencil,n.firstElementChild?.setAttribute(`aria-hidden`,`true`),r?n.setAttribute(`aria-controls`,t):n.removeAttribute(`aria-controls`),n.setAttribute(`aria-label`,r?e.switchToCalendar:e.switchToInput)}}},mi=(e,t)=>{e.querySelectorAll(`.dp-ui__text-button--confirm, .dp-ui__text-button--save`).forEach(e=>{e.disabled=!t})},hi=e=>{let{labels:t}=e,n=q(`div`,`dp-ui__actions`);n.hidden=!e.visible;let r=q(`div`,`dp-ui__actions-start`);e.todayButton&&r.append(fi(`today`,t.today)),e.clearButton&&r.append(fi(`clear`,t.clear));let i=q(`div`,`dp-ui__actions-end`);return i.append(fi(`cancel`,t.cancel),fi(`confirm`,t.confirm)),n.append(r,i),n},gi=[[`dp-ui__icon-button--prev-month`,{kind:`page`,direction:-1}],[`dp-ui__icon-button--next-month`,{kind:`page`,direction:1}],[`dp-ui__icon-button--prev-year`,{kind:`navigate`,delta:-12}],[`dp-ui__icon-button--next-year`,{kind:`navigate`,delta:12}],[`dp-ui__menu-button--month`,{kind:`panel`,panel:`month-menu`}],[`dp-ui__menu-button--year`,{kind:`panel`,panel:`year-menu`}],[`dp-ui__menu-button--year-grid`,{kind:`panel`,panel:`year-grid`}],[`dp-ui__text-button--today`,{kind:`today`}],[`dp-ui__text-button--clear`,{kind:`clear`}],[`dp-ui__text-button--cancel`,{kind:`cancel`}],[`dp-ui__text-button--confirm`,{kind:`confirm`}],[`dp-ui__text-button--save`,{kind:`confirm`}],[`dp-ui__icon-button--close`,{kind:`cancel`}],[`dp-ui__icon-button--switch-view`,{kind:`switch`}]],_i=e=>gi.find(([t])=>e.classList.contains(t)),vi=e=>_i(e)?.[0]??null,yi=(e,t)=>{let{actions:n}=t;switch(e.kind){case`navigate`:n.navigate(e.delta,`button`);return;case`page`:n.page(e.direction,`button`);return;case`panel`:n.showPanel(t.panel()===e.panel?t.home:e.panel);return;case`switch`:n.showPanel(t.panel()===`input`?t.home:`input`);return;case`today`:n.today();return;case`clear`:n.clear();return;case`cancel`:n.cancel(`button`);return;case`confirm`:n.confirm()}},bi=(e,t,n)=>{e.addEventListener(`click`,e=>{let{target:t}=e,r=t instanceof Element?t.closest(`button`):null;if(r!==null){let e=_i(r);e&&yi(e[1],n);return}let i=n.cellAt(t);i!==null&&n.actions.select(i.date)},{signal:t})},xi=`dp-ui__container--menu-open`,Si=`dp-ui__container--input`,Ci=`--dp-ui-visible-months`,wi=e=>e.closest(`.dp-ui__container`),Ti=(e,t)=>e!==t&&e!==`days`&&e!==`input`,Ei=(e,t)=>{let n=t>1;e.classList.toggle(`dp-ui__container--multi-month`,n),n?e.style.setProperty(Ci,String(t)):e.style.removeProperty(Ci)},Di=(e,t,n)=>{let r=t===`input`;e.classList.toggle(Si,r),Ei(e,r?1:n)},Oi=e=>{let{locale:t,labels:n}=e,r=ci(n),i=q(`div`,`dp-ui__navigation dp-ui__navigation--caption`),a=q(`span`,`dp-ui__caption`);a.hidden=e.arrowsOnly,i.append(a,Q(`prev-month`,n.previousMonth,X.keyboardArrowLeft,r.previousMonth),Q(`next-month`,n.nextMonth,X.keyboardArrowRight,r.nextMonth));let o=e=>{a.textContent=R(e,t)};return o(e.view),{element:i,setView:o}},ki=(e,t)=>{let n=q(`div`,`dp-ui__navigation-group dp-ui__navigation-group--${e}`);return n.append(...t),n},Ai=e=>{let{labels:t}=e,n=ci(t),r=Ge(e.locale,`short`),i=Ge(e.locale,`long`),a=di(`month`,``,{name:t.chooseMonth,controls:Z(e.instanceId,`month-menu`),shortcut:n.chooseMonth}),o=di(`year`,``,{name:t.chooseYear,controls:Z(e.instanceId,`year-menu`),shortcut:n.chooseYear}),s=q(`div`,`dp-ui__header dp-ui__header--docked`),c=ki(`month`,[Q(`prev-month`,t.previousMonth,X.keyboardArrowLeft,n.previousMonth),a.button,Q(`next-month`,t.nextMonth,X.keyboardArrowRight,n.nextMonth)]);c.hidden=e.groups!==`both`,s.hidden=e.groups===`none`,s.append(c,ki(`year`,[Q(`prev-year`,t.previousYear,X.keyboardArrowLeft,n.previousYear),o.button,Q(`next-year`,t.nextYear,X.keyboardArrowRight,n.nextYear)]));let l=t=>{a.setText(r[t.month-1]??``,i[t.month-1]??``),o.setText(F(t.year,e.locale))},u=e=>{a.button.setAttribute(`aria-expanded`,String(e===`month-menu`)),o.button.setAttribute(`aria-expanded`,String(e===`year-menu`)),a.button.disabled=e===`year-menu`,o.button.disabled=e===`month-menu`};return l(e.view),u(e.home),{element:s,setView:l,setPanel:u}},ji=`dp-ui__headline--fading-out`,Mi=(e,t)=>{let n=q(`div`,`dp-ui__headline`);n.textContent=e;let r=null,i=null,a=()=>{i!==null&&clearTimeout(i),i=null,r=null,n.classList.remove(ji)},o=()=>{let e=r;a(),e!==null&&(n.textContent=e)};return{element:n,setText:e=>{e!==(r??n.textContent)&&(t?(r=e,n.classList.add(ji),i??=setTimeout(o,J.HEADLINE_FADE)):(a(),n.textContent=e))},destroy:a}},Ni=e=>{let{labels:t,switchView:n}=e,r=q(`div`,`dp-ui__header dp-ui__header--modal`),i=q(`div`,`dp-ui__supporting-text`);i.textContent=e.title;let a=Mi(e.text,e.animate);r.append(i,a.element);let o=n===null?null:pi(t,n.panelId);return o!==null&&r.append(o.button),{element:r,setText:e=>{a.setText(e)},setInputView:e=>{o?.setInputView(e)},destroy:()=>{a.destroy()}}},Pi=(e,t,n,r,i)=>{if(i)return Oi({locale:t,labels:n,view:e,arrowsOnly:!1}).element;let a=ci(n),o=q(`div`,`dp-ui__navigation`);return o.append(di(`year-grid`,R(e,t),{name:n.chooseYear,controls:Z(r,`year-grid`),shortcut:a.chooseYear}).button,Q(`prev-month`,n.previousMonth,X.keyboardArrowLeft,a.previousMonth),Q(`next-month`,n.nextMonth,X.keyboardArrowRight,a.nextMonth)),o},Fi=(e,t,n,r)=>{let i=q(`div`,`dp-ui__navigation dp-ui__navigation--month-grid`),a=ci(n);return i.append(di(`year-grid`,F(e.year,t),{name:n.chooseYear,controls:Z(r,`year-grid`),shortcut:a.chooseYear}).button,Q(`prev-year`,n.previousYear,X.keyboardArrowLeft,a.previousYear),Q(`next-year`,n.nextYear,X.keyboardArrowRight,a.nextYear)),i},Ii=(e,t,n,r)=>{let i=q(`div`,`dp-ui__navigation dp-ui__navigation--year-grid`),{button:a}=di(`year-grid`,R(e,t),{name:n.chooseYear,controls:Z(r,`year-grid`)});return a.setAttribute(`aria-expanded`,`true`),i.append(a),i},Li=t=>{let{decorateDate:n}=t.options;return n===null?()=>null:t=>{try{return n(d(t))??null}catch(t){return e(t),null}}},Ri=e=>{let{renderDate:t}=e.options;return t===null?()=>null:e=>t(d(e))},zi=(e,t,n)=>{let{options:r}=e;return{locale:r.locale,weekStart:r.weekStart,weekNumbers:r.weekNumbers,showOutside:n,outsideSelectable:r.outsideDays!==!1&&r.outsideDays.selectable,labels:{weekNumber:r.labels.weekNumber},rangeLabels:{start:r.labels.rangeStart,end:r.labels.rangeEnd,inRange:r.labels.inRange},headingVisible:!1,weekdaysVisible:!0,multiselectable:e.draft.mode!==`single`,rangeRole:()=>null,labelRole:()=>null,decorate:Li(e),content:Ri(e),isSelected:t=>le(e.draft,t),isDisabled:n=>!t.isSelectable(n,e.followsActiveEnd?Vn(e.draft,e.activeEnd):e.draft),today:S(),focus:e.focus}},Bi=(e,t,n)=>{let r=e.layout.months>1,i=n===`docked`&&!r&&e.options.outsideDays!==!1,a=zi(e,t,i);return r?{...a,headingVisible:!0}:a},Vi=(e,t)=>Ze(t,v(t,e.layout.months-1),e.options.locale),$=e=>ni(e.draft,e.panel===`input`?`input`:`calendar`,e.options.locale,e.options.labels,e.options.precision),Hi={element:null,docked:null,modal:null,caption:null},Ui={days:null,input:null,"month-menu":`.dp-ui__menu-button--month`,"year-menu":`.dp-ui__menu-button--year`,"year-grid":`.dp-ui__menu-button--year-grid`,"month-grid":null},Wi=e=>{switch(e){case`day`:return`both`;case`month`:return`year`;case`year`:return`none`}},Gi=e=>Ui[e],Ki=(e,t)=>e.options.precision===`day`&&ae(t,e.options.inline).navigation===`caption`,qi=(e,t,n)=>{let{locale:r,labels:i,animation:a,viewSwitch:o,mode:s,precision:c}=e.options;if(t===`modal`){if(!ae(n,e.options.inline).headline)return Hi;let t=o&&E(s,e.calendarLayout,c),r=Ni({labels:i,title:Xr(i,s,c),animate:a,text:$(e),switchView:t?{panelId:Z(e.instanceId,`input`)}:null});return r.setInputView(e.panel===`input`),{element:r.element,docked:null,modal:r,caption:null}}if(Ki(e,n)){let t=Oi({locale:r,labels:i,view:e.view,arrowsOnly:e.layout.months>1});return{element:t.element,docked:null,modal:null,caption:t}}let l=Ai({instanceId:e.instanceId,locale:r,labels:i,view:e.view,groups:Wi(c),home:D(c)});return{element:l.element,docked:l,modal:null,caption:null}},Ji=(e,t)=>{let n=v(e,t);return{year:n.year,month:n.month,day:Math.min(e.day,b(n))}},Yi=(e,t,n,r)=>{let i=t?12:1;switch(e){case`ArrowLeft`:return g(n,r?1:-1);case`ArrowRight`:return g(n,r?-1:1);case`ArrowUp`:return g(n,-7);case`ArrowDown`:return g(n,7);case`Home`:return{year:n.year,month:n.month,day:1};case`End`:return{...n,day:b(n)};case`PageUp`:return Ji(n,-i);case`PageDown`:return Ji(n,i);default:return null}},Xi=e=>e.ctrlKey||e.altKey||e.metaKey,Zi=(e,t)=>{let n=e.toLowerCase();return t===`modal`?n===`y`?`year-grid`:null:n===`m`?`month-menu`:n===`y`?`year-menu`:null},Qi=e=>{let{panel:t}=e.core;return e.caption()?!1:e.layout===`docked`?e.home===`days`&&t===`days`:e.layout===`modal`&&t===e.home&&e.home!==`year-grid`},$i=(e,t)=>{let{panel:n}=t.core;n!==t.home&&n!==`input`&&(e.preventDefault(),e.stopPropagation(),t.actions.showPanel(t.home))},ea=(e,t)=>{if(!e.shiftKey||!Qi(t))return!1;let n=Zi(e.key,t.layout);return n!==null&&(e.preventDefault(),t.actions.showPanel(n),!0)},ta=(e,t,n)=>{e.preventDefault(),e.key===`Enter`&&n.layout===`modal`&&n.core.options.mode===`single`&&oe(n.core.options.footerExplicit,n.core.mode)&&le(n.core.draft,t.date)?n.actions.confirm():n.actions.select(t.date)},na=(e,t,n)=>{if(e.key===`Enter`||e.key===` `){ta(e,t,n);return}let r=Yi(e.key,e.shiftKey,t.date,n.isRtl());r!==null&&(e.preventDefault(),n.actions.focusDate(r))},ra=(e,t,n)=>{e.addEventListener(`keydown`,e=>{if(e.defaultPrevented)return;if(e.key===`Escape`){$i(e,n);return}if(Xi(e)||ea(e,n))return;let t=n.cellAt(e.target);t!==null&&na(e,t,n)},{signal:t})},ia=`dp-ui__ghost`,aa=e=>Array.from(e.querySelectorAll(`*`)).filter(e=>e.closest(`.${ia}`)===null),oa=(e,t,n)=>{e.querySelectorAll(`.${ia}`).forEach(e=>{e.remove()}),e.removeAttribute(`popover`),e.removeAttribute(`style`),e.classList.remove(`dp-ui__container--morphing`),e.classList.add(ia),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``),e.removeAttribute(`id`),e.removeAttribute(`name`),e.querySelectorAll(`[id], [name]`).forEach(e=>{e.removeAttribute(`id`),e.removeAttribute(`name`)}),e.style.setProperty(`inline-size`,`${String(t)}px`),e.style.setProperty(`block-size`,`${String(n)}px`)},sa=(e,t)=>{let n=Array.from(t.querySelectorAll(`*`));return aa(e).flatMap((e,t)=>{let r=n.at(t);return r===void 0||e.scrollTop===0&&e.scrollLeft===0?[]:[{live:e,copy:r,top:e.scrollTop,left:e.scrollLeft}]})},ca=({live:e,copy:t})=>{let n=e.getBoundingClientRect(),r=Array.from(t.children);Array.from(e.children).forEach((e,t)=>{let i=r.at(t),a=e.getBoundingClientRect();i===void 0||a.bottom>n.top&&a.top<n.bottom||(i.replaceChildren(),i instanceof HTMLElement&&i.style.setProperty(`block-size`,`${String(a.height)}px`))})},la=(e,t,n)=>{let r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return null;oa(r,t,n);let i=sa(e,r);i.forEach(ca);let a=null,o=()=>{if(a!==null){let e=a;a=null,e.cancel()}r.remove()};return{show:()=>{e.append(r),i.forEach(({copy:e,top:t,left:n})=>{e.scrollTop=t,e.scrollLeft=n}),typeof r.animate==`function`?(a=r.animate([{opacity:1},{opacity:0}],{duration:J.VIEW_SWITCH_FADE_OUT,easing:`linear`,fill:`forwards`}),a.finished.then(o,o)):o()},remove:o}},ua=`dp-ui__container--morphing`,da=/* @__PURE__ */ new WeakMap,fa=e=>{let t=e.getBoundingClientRect();return{width:t.width,height:t.height,radius:getComputedStyle(e).borderRadius}},pa=(e,t)=>{if(t===null)return null;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:getComputedStyle(t).direction===`rtl`?n.right-r.right:r.left-n.left,y:r.top-n.top,height:r.height}},ma=e=>({width:`${String(e.width)}px`,height:`${String(e.height)}px`,borderRadius:e.radius}),ha=(e,t,n)=>{if(n.height===0)return;let r=getComputedStyle(e).direction===`rtl`,i=(t.x-n.x)*(r?-1:1),a=t.y-n.y,o=t.height/n.height;if(i===0&&a===0&&o===1)return;let s=r?`top right`:`top left`;e.animate([{transform:`translate(${String(i)}px, ${String(a)}px) scale(${String(o)})`,transformOrigin:s},{transform:`none`,transformOrigin:s}],{duration:J.VIEW_SWITCH,easing:Ir.EMPHASIZED})},ga=(e,t,n)=>{if(n===`none`||typeof e.animate!=`function`)return t(),null;if(n===`reduced`){let n=fa(e),r=la(e,n.width,n.height);return t(),r?.show(),null}let r=e.querySelector(`.dp-ui__headline`),i=fa(e),a=pa(e,r),o=la(e,i.width,i.height);t();let s=fa(e),c=pa(e,r);e.classList.add(ua);let l=e.animate([ma(i),ma(s)],{duration:J.VIEW_SWITCH,easing:Ir.EMPHASIZED});da.set(e,l),o?.show(),r!==null&&a!==null&&c!==null&&ha(r,a,c);let u=()=>{o?.remove(),da.get(e)===l&&(da.delete(e),e.classList.remove(ua))};return l.finished.then(u,u),l},_a=/^\d$/,va=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]);function ya(e,t){return e===`year`?t.yearDigits:2}function ba(e,t){let{order:n}=t,r=n.map(e=>ya(e,t)),i=[``],a=0;for(let t=0;t<e.length;t++){let o=e.charAt(t);if(rt.test(o))continue;let s=ct(o),c=i.length-1,l=r[c]??0,u=i[c]??``,d=i.length===n.length;if(_a.test(s)){if(u.length>=l){if(d)break;i.push(s)}else i[c]=u+s;a=t+1}else if(va.has(s)){if(u===``)continue;if(d)break;i[c]=u.padStart(l,`0`),i.push(``),a=t+1}}return{groups:i,end:a}}function xa(e,t){return ba(e,t).groups.filter(e=>e!==``).join(t.separator)}function Sa(e,t){let n=xa(e.value,t);n!==e.value&&(e.value=n,e.setSelectionRange(n.length,n.length))}function Ca(e){let t=e.describedById??`${e.id}-supporting`,n=q(`div`,`dp-ui__text-field`),r=q(`input`,`dp-ui__text-field-input`,{id:e.id,type:`text`,inputmode:`numeric`,autocomplete:`off`,placeholder:e.placeholder,tabindex:`0`,"aria-invalid":`false`,"aria-describedby":t});r.value=e.value;let i=q(`label`,`dp-ui__text-field-label`,{for:e.id});i.textContent=e.label;let a=q(`div`,`dp-ui__text-field-supporting`,{id:t,"aria-live":`polite`});return a.textContent=e.hint,n.append(r,i,a),{element:n,input:r,getValue:()=>r.value,setValue:e=>{r.value=e},setError:t=>{let i=t!==null;n.classList.toggle(`dp-ui__text-field--error`,i),r.setAttribute(`aria-invalid`,i?`true`:`false`);let o=t??e.hint;a.textContent!==o&&(a.textContent=o)}}}function wa(e){return e.mode===`single`?e.date:null}function Ta(e){return e.mode===`single`?e.date===null:e.mode===`range`?e.start===null:e.dates.length===0}function Ea(e){let{instanceId:t,draft:n,pattern:r,labels:i,rules:a}=e,o=q(`div`,`dp-ui__input-panel`,{"data-panel":`input`,id:Z(t,`input`)}),s=Ae(r,ke(i)),c=(e,n,i)=>Ca({id:`${t}-input-${e}`,label:n,placeholder:s,hint:s,value:i?je(i,r):``}),l=n.mode===`range`,u=c(l?`start`:`date`,l?i.startDateField:i.dateField,n.mode===`range`?n.start:wa(n)),d=l?c(`end`,i.endDateField,n.end):null,f=d?[u,d]:[u],p=t=>{let n=t.getValue().trim();if(n===``)return t.setError(null),{date:null,failed:!1};let o=pt(n,r);if(o===null)return t.setError(i.invalidDate),{date:null,failed:!0};let s=a.unavailableReason(o);return s===null?(t.setError(null),t.setValue(je(o,r)),{date:o,failed:!1}):(t.setError(e.messageFor(s)),{date:null,failed:!0})},h=()=>{let e=p(u);if(!d)return e.failed?null:{mode:`single`,date:e.date};let t=p(d),n=t.date,r=e.failed||t.failed;return e.date&&n&&m(n,e.date)<0&&(d.setError(i.invalidRange),n=null,r=!0),r?null:{mode:`range`,start:e.date,end:n}},g=t=>{let n=Ln(t,e.limits,e=>a.unavailableReason(e));return n===null||((d??u).setError(e.messageFor(n)),!1)};return f.forEach(t=>{t.input.addEventListener(`input`,()=>{Sa(t.input,r)}),t.input.addEventListener(`change`,()=>{let t=h();t&&g(t)&&e.onDraft(t)}),t.input.addEventListener(`keydown`,t=>{if(t.key!==`Enter`)return;t.preventDefault();let n=h();n&&g(n)&&j(n)&&!Ta(n)&&(e.onDraft(n),e.onSubmit())})}),o.append(...f.map(e=>e.element)),o}function Da(e,t){let{labels:n,minDate:r,maxDate:i,pattern:a,precision:o}=t;return e===`min`&&r!==null?n.beforeMinDate.replace(`{date}`,B(r,a,o)):e===`max`&&i!==null?n.afterMaxDate.replace(`{date}`,B(i,a,o)):e===`range-length`?n.invalidRange:n.unavailableDate}let Oa=e=>{let{core:t,actions:n,rules:r}=e,{pattern:i,labels:a,limits:o}=t.options;return[Ea({instanceId:t.instanceId,draft:t.draft,pattern:i,labels:a,rules:r,limits:o,messageFor:e=>Da(e,t.options),onDraft:e=>{n.typeDraft(e)},onSubmit:()=>{oe(t.options.footerExplicit,t.mode)?n.confirm():n.submitDraft()}})]},ka=`dp-ui__pager--dragging`,Aa=e=>e instanceof Element&&e.closest(`button`)!==null,ja=(e,t)=>{e.push(t),e.length>Y.VELOCITY_SAMPLES&&e.shift()},Ma=e=>{let t=e.at(0),n=e.at(-1);return!t||!n?0:(n.x-t.x)/Math.max(Y.MIN_SAMPLE_SPAN_MS,n.t-t.t)},Na=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},Pa=(e,t)=>{e.hasPointerCapture(t)&&e.releasePointerCapture(t)},Fa=(e,t,n)=>{let r=null,i=null,a=t=>{t.controller.abort(),r===t&&(r=null),t.dragging&&(e.classList.remove(ka),Pa(e,t.pointerId))},o=()=>{i?.abort();let t=new AbortController;i=t,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),t.abort()},{capture:!0,signal:t.signal}),requestAnimationFrame(()=>{t.abort()})},s=t=>{n.onBegin(),t.dragging=!0,t.width=n.pageWidth(),Na(e,t.pointerId),e.classList.add(ka)},c=(e,t)=>{if(t.pointerId!==e.pointerId)return;let r=t.clientX-e.startX;if(!e.dragging){if(Math.abs(r)<=Y.DRAG_START_PX)return;s(e)}e.lastX=t.clientX,ja(e.samples,{x:t.clientX,t:t.timeStamp}),n.onMove(r,e.width)},l=(e,t,r)=>{t.pointerId===e.pointerId&&(a(e),e.dragging&&(r?n.onAbort():(o(),ja(e.samples,{x:e.lastX,t:t.timeStamp}),n.onRelease({dx:e.lastX-e.startX,velocity:Ma(e.samples),width:e.width}))))};e.addEventListener(`pointerdown`,t=>{if(t.button!==0||!t.isPrimary||Aa(t.target))return;let i=r;i&&(a(i),i.dragging&&n.onAbort());let o=new AbortController,s={pointerId:t.pointerId,startX:t.clientX,samples:[{x:t.clientX,t:t.timeStamp}],controller:o,lastX:t.clientX,width:0,dragging:!1};r=s;let u=e.ownerDocument,d={signal:o.signal};u.addEventListener(`pointermove`,e=>{c(s,e)},d),u.addEventListener(`pointerup`,e=>{l(s,e,!1)},d),u.addEventListener(`pointercancel`,e=>{l(s,e,!0)},d)},{signal:t});let u=()=>{r&&a(r)};return{isDragging:()=>r?.dragging===!0,cancel:u,dispose:()=>{u(),i?.abort(),i=null}}},Ia=(e,t)=>e.year===t.year&&e.month===t.month,La=(e,t,n,r)=>{let i=null,a=e=>{let n=t(e);return n.classList.add(`dp-ui__page`),{key:e,element:n}},o=e=>{i?.forEach((t,n)=>{t.element.toggleAttribute(`inert`,n!==e)})},s=(e,t,n)=>{let i=e[t];if(r(i.key,n))return e;let o=a(n);return i.element.replaceWith(o.element),t===0?[o,e[1],e[2]]:[e[0],e[1],o]};return{show:t=>{let r=[a(n(t,-1)),a(t),a(n(t,1))];e.replaceChildren(...r.map(e=>e.element)),i=r,o(1)},centerKey:()=>i?.[1].key??null,reveal:(e,t)=>{i&&(i=s(i,e,t),o(e))},recenter:e=>{if(!i)return;let t=i[e],r=a(n(t.key,-1)),s=a(n(t.key,1));i.forEach((t,n)=>{n!==e&&t.element.remove()}),t.element.before(r.element),t.element.after(s.element),i=[r,t,s],o(1)},clear:()=>{i=null}}},Ra=(e,t,n)=>{if(t<-Y.FLICK_VELOCITY)return 1;if(t>Y.FLICK_VELOCITY)return-1;let r=n*Y.COMMIT_FRACTION;return e<-r?1:e>r?-1:0},za=(e,t,n,r)=>{let i=Ra(e,t,n);return!r||i===0?i:i===1?-1:1},Ba=(e,t)=>{let n=null,r=null,i=()=>typeof e.animate==`function`,a=()=>{let e=r;r=null,e?.cancel()},o=()=>{a();let e=n;e&&(n=null,e.complete(),e.animation.cancel())},s=()=>{a();let e=n;n=null,e?.animation.cancel()},c=()=>{let t=e.animate([{opacity:0},{opacity:1}],{duration:J.REDUCED_FADE,easing:`linear`});r=t;let n=()=>{r===t&&(r=null)};t.finished.then(n,n)};return{run:(r,s,l)=>{a();let u=br(t);if(r===s||u===`none`||!i()){l();return}if(u===`reduced`){l(),c();return}let d=e.animate([{transform:r},{transform:s}],{duration:J.PAGER_SETTLE,easing:Ir.EMPHASIZED,fill:`forwards`}),f={animation:d,complete:l};n=f,d.finished.then(()=>{n===f&&o()},()=>void 0)},finish:o,cancel:s}},Va=(e,t)=>Math.min(t,Math.max(-t,e)),Ha=(e,t)=>e.deltaMode===0?e.deltaX:Math.sign(e.deltaX)*t,Ua=(e,t,n)=>{let r=null,i=0,a=()=>{r=null;let e=i;i=0,n.onSettle(e,n.pageWidth())};return e.addEventListener(`wheel`,e=>{if(Math.abs(e.deltaX)<=Math.abs(e.deltaY)||n.isBlocked())return;e.preventDefault();let t=n.pageWidth();r===null?n.onBegin():clearTimeout(r),i-=Ha(e,t),n.onMove(Va(i,t),t),r=setTimeout(a,J.WHEEL_SETTLE)},{passive:!1,signal:t}),{cancel:()=>{r!==null&&clearTimeout(r),r=null,i=0}}},Wa=`dp-ui__pager--swipe`,Ga=`--dp-ui-pager-height`;var Ka=class{viewport;options;track;controller=new AbortController;previousTouchAction;strip;animator;drag=null;wheel=null;resizeObserver=null;observedWidth=-1;offset=0;revision=0;constructor(e,t){this.viewport=e,this.options=t,this.previousTouchAction=e.style.touchAction,this.track=q(`div`,`dp-ui__pager-track`),this.strip=La(this.track,e=>t.renderPage(e),(e,n)=>t.step(e,n),(e,n)=>t.isSame(e,n)),this.animator=Ba(this.track,t.animate),e.classList.add(`dp-ui__pager`),e.append(this.track),t.swipe&&this.enableSwipe(),this.observeWidth()}show(e){this.destroyed||(this.revision+=1,this.animator.cancel(),this.cancelGestures(),this.strip.show(e),this.rest(),this.fitHeight(e))}slide(e,t){if(this.destroyed)return;this.finish(),this.cancelGestures();let n=this.strip.centerKey();if(n===null){this.show(e);return}if(this.revision+=1,this.options.isSame(n,e)){this.settle();return}let r=t===1?2:0;this.strip.reveal(r,e),this.fitHeight(e);let i=this.pageWidth(),a=this.transformFor(1,this.offset,i);this.offset=0,this.animator.run(a,this.transformFor(r,0,i),()=>{this.strip.recenter(r),this.rest()})}finish(){this.animator.finish()}destroy(){this.destroyed||(this.controller.abort(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.cancelGestures(),this.drag?.dispose(),this.animator.cancel(),this.track.remove(),this.strip.clear(),this.viewport.style.removeProperty(Ga),this.viewport.classList.remove(Wa,ka),this.options.swipe&&(this.viewport.style.touchAction=this.previousTouchAction))}get destroyed(){return this.controller.signal.aborted}enableSwipe(){let{signal:e}=this.controller;this.viewport.style.touchAction=`pan-y`,this.viewport.classList.add(Wa),this.drag=Fa(this.viewport,e,{pageWidth:()=>this.pageWidth(),onBegin:()=>{this.finish(),this.wheel?.cancel()},onMove:(e,t)=>{this.setOffset(e,t)},onRelease:({dx:e,velocity:t,width:n})=>{this.release(za(e,t,n,this.options.rtl),`drag`)},onAbort:()=>{this.settle()}}),this.wheel=Ua(this.viewport,e,{pageWidth:()=>this.pageWidth(),isBlocked:()=>this.drag?.isDragging()===!0,onBegin:()=>{this.finish()},onMove:(e,t)=>{this.setOffset(e,t)},onSettle:(e,t)=>{this.release(za(e,0,t,this.options.rtl),`wheel`)}})}observeWidth(){this.options.fitHeight===!0&&typeof ResizeObserver<`u`&&(this.resizeObserver=new ResizeObserver(e=>{let t=e.at(-1);if(t===void 0||this.destroyed)return;let n=t.contentRect.width;if(n===this.observedWidth)return;this.observedWidth=n;let r=this.strip.centerKey();r!==null&&this.fitHeight(r)}),this.resizeObserver.observe(this.viewport))}cancelGestures(){this.drag?.cancel(),this.wheel?.cancel()}release(e,t){if(e===0){this.settle();return}let n=this.revision;this.options.onCommit(e,t),this.revision===n&&!this.destroyed&&this.settle()}settle(){this.finish();let e=this.pageWidth(),t=this.transformFor(1,this.offset,e);this.offset=0,this.animator.run(t,this.transformFor(1,0,e),()=>{this.rest()})}fitHeight(e){if(this.options.fitHeight!==!0||this.viewport.hidden)return;let t=this.options.pageHeight?.(e);t!==void 0&&this.viewport.style.setProperty(Ga,`${String(t)}px`)}rest(){this.offset=0,this.track.style.removeProperty(`transform`),this.viewport.scrollLeft!==0&&(this.viewport.scrollLeft=0)}setOffset(e,t){this.offset=e,this.track.style.transform=this.transformFor(1,e,t)}transformFor(e,t,n){let r=this.options.rtl?1:-1;return`translateX(${String(r*e*n+t)}px)`}pageWidth(){let e=this.viewport.clientWidth;return e>0?e:360}};let qa=`dp-ui__date`,Ja=`dp-ui__date--outside-month`,Ya=`data-decoration-label`,Xa=`data-content-label`,Za=`dp-ui__date-content`,Qa=`dp-ui__date--has-content`,$a=`:scope > .${Za}`,eo=(e,t,n)=>n.isDisabled(e)||t&&!n.outsideSelectable,to=(e,t,n,r)=>[[`dp-ui__date--selected`,r.isSelected(e)],[`dp-ui__date--range-start`,n===`start`],[`dp-ui__date--range-end`,n===`end`],[`dp-ui__date--in-range`,n===`in-range`],[`dp-ui__date--today`,h(e,r.today)],[`dp-ui__date--disabled`,eo(e,t,r)],[Ja,t]],no=e=>{e.querySelector($a)?.remove(),e.classList.remove(Qa),e.removeAttribute(Xa)},ro=(e,t,n)=>{let r=n.content(t);if(r===null){no(e);return}let i=e.querySelector($a),a=(typeof r==`string`?r:r.textContent??``).trim();if(typeof r!=`string`||i===null||i.childElementCount!==0||i.textContent!==r){let t=q(`span`,Za);typeof r==`string`?t.textContent=r:t.appendChild(r),i===null?e.querySelector(`.dp-ui__date-indicator`)?.after(t):i.replaceWith(t)}e.classList.add(Qa),a===``?e.removeAttribute(Xa):e.setAttribute(Xa,a)},io=(e,t)=>e===`start`?t.rangeLabels.start:e===`end`?t.rangeLabels.end:e===`in-range`?t.rangeLabels.inRange:null,ao=(e,t,n,r,i)=>[Xe(e,i.locale),io(t,i),n,r].filter(e=>e!==null&&e!==``).join(`, `),oo=(e,t,n,r)=>{let i=r.rangeRole(t);ro(e,t,r),to(t,n,i,r).forEach(([t,n])=>e.classList.toggle(t,n)),e.setAttribute(`aria-selected`,String(r.isSelected(t)||i!==null)),e.setAttribute(`aria-label`,ao(t,r.labelRole(t),e.getAttribute(Ya),e.getAttribute(Xa),r)),h(t,r.today)?e.setAttribute(`aria-current`,`date`):e.removeAttribute(`aria-current`),eo(t,n,r)?e.setAttribute(`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`);let a=!n&&h(t,r.focus);e.setAttribute(`tabindex`,a?`0`:`-1`)},so=(e,t)=>{if(t===null)return;let n=(t.className??``).split(/\s+/).filter(Boolean);e.classList.add(...n),t.label&&e.setAttribute(Ya,t.label),t.badge===!0&&e.appendChild(q(`span`,`dp-ui__date-badge`,{"aria-hidden":`true`}))},co=(e,t)=>{if(!e.inMonth&&!t.showOutside)return q(`td`,`${qa} dp-ui__date--empty`);let n=q(`td`,qa,{role:`gridcell`,"data-date":p(e.date)}),r=q(`span`,`dp-ui__date-indicator`);return r.textContent=F(e.date.day,t.locale),n.appendChild(r),so(n,t.decorate(e.date)),oo(n,e.date,!e.inMonth,t),n},lo=`dp-ui__visually-hidden`,uo=e=>{let t=q(`thead`),n=q(`tr`,e.weekdaysVisible?`dp-ui__weekdays`:`dp-ui__weekdays ${lo}`);if(e.weekNumbers){let t=q(`th`,`dp-ui__week-number-header`,{scope:`col`});t.textContent=e.labels.weekNumber,n.appendChild(t)}let r=Ke(e.locale,`narrow`),i=Ke(e.locale,`long`);for(let t=0;t<7;t++){let a=(e.weekStart+t)%7,o=i[a]??``,s=q(`th`,`dp-ui__weekday`,{role:`columnheader`,scope:`col`,abbr:o,title:o});s.textContent=r[a]??``,n.appendChild(s)}return t.appendChild(n),t},fo=(e,t)=>{let n=q(`table`,`dp-ui__month-grid`,{role:`grid`});t.multiselectable===!0&&n.setAttribute(`aria-multiselectable`,`true`);let r=q(`caption`,t.headingVisible?`dp-ui__month-subhead`:`dp-ui__month-heading ${lo}`);r.textContent=R(e.view,t.locale),n.appendChild(r),n.appendChild(uo(t));let i=q(`tbody`);return e.weeks.forEach((n,r)=>{let a=q(`tr`,`dp-ui__week`);if(t.weekNumbers){let n=q(`th`,`dp-ui__week-number`,{scope:`row`}),i=e.weekNumbers.at(r);n.textContent=i===void 0?``:F(i,t.locale),a.appendChild(n)}n.forEach(e=>a.appendChild(co(e,t))),i.appendChild(a)}),n.appendChild(i),n},po=(e,t)=>{e.querySelectorAll(`td[data-date]`).forEach(e=>{let n=f(e.dataset.date??``);n!==null&&oo(e,n,e.classList.contains(Ja),t)})},mo=(e,t,n)=>{let r={year:e.year,month:e.month,day:1},i=(x(r)-t+7)%7,a=n?6:Math.ceil((i+b(e))/7),o=g(r,-i),s=(4-t+7)%7,c=[],l=[];for(let t=0;t<a;t++){let n=g(o,t*7),r=[];for(let t=0;t<7;t++){let i=g(n,t);r.push({date:i,inMonth:i.year===e.year&&i.month===e.month})}c.push(r),l.push(w(g(n,s)))}return{view:e,weeks:c,weekNumbers:l}},ho=`table.dp-ui__month-grid`,go=(e,t)=>{e.style.setProperty(`transition`,`none`),t(),e.getBoundingClientRect(),e.style.removeProperty(`transition`)},_o=e=>{let{core:t,layout:n,surface:r,gridContext:i}=e,{months:a}=t.layout,{outsideSelectable:o,headingVisible:s}=i(),c=r===`inline`,{fixedWeeks:l}=fr({layout:n===`modal`?`modal`:`docked`,inline:c,months:a,outsideDays:t.options.outsideDays!==!1,fixedWeeks:t.options.fixedWeeks}),u=n===`docked`||c,d=r!==void 0&&Ki(t,r),p=q(`div`,void 0,{"data-panel":`days`}),m=e=>p.querySelector(`.dp-ui__page:not([inert])`)?.querySelector(e)??null,h=e=>mo(e,t.options.weekStart,l),g=e=>Array.from({length:a},(t,n)=>v(e,n)),_=e=>{let t=i();if(a===1)return fo(h(e),t);let n=q(`div`,`dp-ui__months`);return n.append(...g(e).map(e=>fo(h(e),t))),n},y=e=>{let r=q(`div`);if(n===`modal`){let{locale:n,labels:i}=t.options;r.append(Pi(e,n,i,t.instanceId,d))}return r.append(_(e)),r},b=e=>Math.max(...g(e).map(e=>h(e).weeks.length)),x=e=>{let t=b(e),n=m(`.dp-ui__navigation`)?.getBoundingClientRect().height??0,r=p.querySelector(ho),i=r?.tHead?.getBoundingClientRect().height??0,a=(r?.tBodies.item(0)?.rows.item(0))?.getBoundingClientRect().height??0,o=s?r?.caption?.getBoundingClientRect().height??0:0;return i>0&&a>0?n+o+i+a*t:n+(t+(s?2:1))*48},S=t.options.pageBy===`view`?a:1,C=new Ka(p,{rtl:e.rtl,swipe:t.options.swipe,animate:t.options.animation,fitHeight:u,step:(e,t)=>v(e,t*S),isSame:Ia,renderPage:y,pageHeight:x,onCommit:(t,n)=>{e.onCommit(t,n)}}),w=()=>p.ownerDocument.activeElement,T=e=>{if(!(e instanceof Element))return null;let t=e.closest(`td.dp-ui__date[data-date]`);if(t===null||!p.contains(t)||t.classList.contains(`dp-ui__date--outside-month`)&&!o)return null;let n=f(t.getAttribute(`data-date`)??``);return n===null?null:{element:t,date:n}},ee=()=>T(w())!==null,E=e=>{let t=m(`td.dp-ui__date[tabindex="0"]`);return t!==null||!e?t:m(`td.dp-ui__date[data-date]:not(.dp-ui__date--outside-month)`)},D=e=>{E(e)?.focus({preventScroll:!0})},te=()=>{let e=w();return e===null||!p.contains(e)?null:{buttonClass:vi(e)}},ne=e=>{let{buttonClass:t}=e;((t===null?null:m(`.${t}`))??E(!0))?.focus({preventScroll:!0})},re=e=>{let t=te();e(),t!==null&&ne(t)};return{element:p,present:(e,t)=>{re(()=>{t===0?C.show(e):C.slide(e,t>0?1:-1)})},finish:()=>{C.finish()},refresh:()=>{let e=i();p.querySelectorAll(ho).forEach(t=>{po(t,e)})},refit:()=>{if(!u||p.hidden)return;let e=`${String(x(t.view))}px`;p.style.getPropertyValue(`--dp-ui-pager-height`)!==e&&re(()=>{go(p,()=>{C.show(t.view)})})},cellAt:T,focusCell:D,cellHasFocus:ee,find:m,destroy:()=>{C.destroy()}}},vo=e=>{let t=document.createElement(`div`);t.className=e.className,t.setAttribute(`role`,`listbox`),t.setAttribute(`aria-label`,e.label);let n=[],r=e.focused>=0&&e.focused<e.items.length?e.focused:0,i=(e,r)=>{let i=n.at(Math.max(0,Math.min(n.length-1,r)));i&&(n.at(e)?.setAttribute(`tabindex`,`-1`),i.setAttribute(`tabindex`,`0`),i.focus({preventScroll:!0}),Kn(t,i,`nearest`))},a=e=>{let n=getComputedStyle(t).direction===`rtl`?-1:1;switch(e){case`ArrowRight`:return n;case`ArrowLeft`:return-n;case`ArrowDown`:return 3;case`ArrowUp`:return-3;default:return null}};return e.items.forEach((o,s)=>{let c=document.createElement(`button`);c.type=`button`,c.className=e.itemClass,c.setAttribute(`role`,`option`),c.setAttribute(`aria-selected`,o.selected?`true`:`false`),c.setAttribute(`aria-label`,o.name),c.setAttribute(`tabindex`,s===r?`0`:`-1`),o.selected&&c.classList.add(`${e.itemClass}--selected`),o.current&&c.classList.add(`${e.itemClass}--current`),o.disabled&&c.setAttribute(`aria-disabled`,`true`),c.textContent=o.label;let l=()=>{o.disabled||o.onPick()};c.addEventListener(`click`,l),c.addEventListener(`keydown`,e=>{let t=a(e.key);t===null?e.key===`Home`?(e.preventDefault(),i(s,0)):e.key===`End`?(e.preventDefault(),i(s,n.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l()):(e.preventDefault(),i(s,s+t))}),n.push(c),t.appendChild(c)}),requestAnimationFrame(()=>{let i=t.querySelector(`.${e.itemClass}--selected`)??n.at(r);i&&Kn(t,i,`center`)}),t},yo=e=>{let t=Ge(e.locale,`short`),n=Ge(e.locale,`long`),r=F(e.year,e.locale);return vo({className:`dp-ui__month-selection`,itemClass:`dp-ui__month-selection-item`,label:e.label,focused:e.focused-1,items:t.map((t,i)=>{let a=i+1;return{label:t,name:`${n[i]??t} ${r}`,selected:a===e.selected,current:e.current.year===e.year&&e.current.month===a,disabled:e.isDisabled(a),onPick:()=>{e.onPick(a)}}})})},bo=e=>{let t=e.querySelector(`.dp-ui__menu-item--selected`);t&&Kn(e,t,`center`)},xo=(e,t,n)=>{let r=e.at(Math.max(0,Math.min(e.length-1,n))),i=e.at(t);r&&(i?.setAttribute(`tabindex`,`-1`),r.setAttribute(`tabindex`,`0`),r.focus({preventScroll:!0}),r.parentElement&&Kn(r.parentElement,r,`nearest`))},So=(e,t,n)=>{let r=document.createElement(`ul`);r.className=`dp-ui__menu dp-ui__menu--${e}`,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-label`,t);let i=n.some(e=>e.selected),a=n.map((e,t)=>{let n=document.createElement(`li`);n.className=`dp-ui__menu-item`,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,e.selected?`true`:`false`);let r=e.selected||!i&&t===0;if(n.setAttribute(`tabindex`,r?`0`:`-1`),e.selected){n.classList.add(`dp-ui__menu-item--selected`);let e=document.createElement(`span`);e.innerHTML=X.check;let t=e.firstElementChild;t&&(t.setAttribute(`class`,`dp-ui__menu-item-icon`),t.setAttribute(`aria-hidden`,`true`),n.appendChild(t))}e.disabled&&n.setAttribute(`aria-disabled`,`true`);let a=document.createElement(`span`);a.className=`dp-ui__menu-item-label`,a.textContent=e.label,n.appendChild(a);let s=()=>{e.disabled||e.onPick()};return n.addEventListener(`click`,s),n.addEventListener(`keydown`,e=>{e.key===`ArrowDown`?(e.preventDefault(),xo(o,t,t+1)):e.key===`ArrowUp`?(e.preventDefault(),xo(o,t,t-1)):e.key===`Home`?(e.preventDefault(),xo(o,t,0)):e.key===`End`?(e.preventDefault(),xo(o,t,o.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}),n}),o=a;return a.forEach(e=>r.appendChild(e)),requestAnimationFrame(()=>{bo(r)}),r},Co=e=>{let t=Ge(e.locale,`long`);return So(`month`,e.label,t.map((t,n)=>{let r=n+1;return{label:t,selected:r===e.view.month,disabled:e.isMonthDisabled({year:e.view.year,month:r}),onPick:()=>{e.onPick(r)}}}))},wo=e=>vo({className:`dp-ui__year-selection`,itemClass:`dp-ui__year-selection-item`,label:e.label,focused:e.years.indexOf(e.focused),items:e.years.map(t=>{let n=F(t,e.locale);return{label:n,name:n,selected:t===e.selected,current:t===e.currentYear,disabled:!1,onPick:()=>{e.onPick(t)}}})}),To=e=>So(`year`,e.label,e.years.map(t=>({label:F(t,e.locale),selected:t===e.view.year,disabled:!1,onPick:()=>{e.onPick(t)}}))),Eo=e=>{let{min:t,max:n}=e.yearBounds(),r=[];for(let e=t;e<=n;e++)r.push(e);return r},Do=(e,t)=>{let n=N(e.draft);return n?.year===t?n.month:null},Oo=(e,t,n)=>(e.setAttribute(`data-panel`,t),e.id=Z(n,t),e),ko=(e,t)=>{let{core:n,rules:r}=t,{labels:i,locale:a}=n.options,o=n.view,{precision:s}=n.options,c=e=>{t.actions.jumpTo(e,`menu`)},l=e=>{c({year:e,month:n.view.month})};switch(e){case`month-menu`:return[Oo(Co({locale:a,view:o,label:i.chooseMonth,isMonthDisabled:e=>r.isMonthDisabled(e),onPick:e=>{c({year:n.view.year,month:e})}}),e,n.instanceId)];case`year-menu`:return[Oo(To({view:o,years:Eo(r),label:i.chooseYear,locale:a,onPick:l}),e,n.instanceId)];case`month-grid`:{let l=s===`month`,u=l?Do(n,o.year):o.month,d=Oo(yo({year:o.year,selected:u,focused:u??o.month,current:S(),locale:a,label:i.chooseMonth,isDisabled:e=>r.isMonthDisabled({year:n.view.year,month:e}),onPick:e=>{l?t.actions.select({year:n.view.year,month:e,day:1}):c({year:n.view.year,month:e})}}),e,n.instanceId);return t.layout===`docked`?[d]:[Fi(o,a,i,n.instanceId),d]}case`year-grid`:{let c=s===`year`,u=c?N(n.draft)?.year??null:o.year,d=Oo(wo({selected:u,focused:u??o.year,years:Eo(r),currentYear:S().year,label:i.chooseYear,locale:a,onPick:c?e=>{t.actions.select({year:e,month:1,day:1})}:l}),e,n.instanceId);return t.layout===`docked`||c?[d]:[Ii(o,a,i,n.instanceId),d]}}},Ao=`[role="option"]`,jo=`data-rebuilt`,Mo=e=>{let{root:t,content:n,days:r}=e,i=`days`,a=[],o=null,s=()=>t.ownerDocument.activeElement,c=e=>{e===`days`?r.hidden=!0:(a.forEach(e=>{e.remove()}),a=[])},l=t=>{t===`days`?(r.hidden=!1,r.removeAttribute(jo)):(a=e.createParts(t),r.after(...a))},u=()=>{let e=o;e!==null&&(o=null,e.complete(),e.animations.forEach(e=>{e.cancel()}))},d=()=>{let e=o;o=null,e?.animations.forEach(e=>{e.cancel()})},f=(t,n,r)=>{let i=e.motion()===`none`?[]:t.filter(e=>!e.hidden&&typeof e.animate==`function`);if(i.length===0){r();return}let a=i.map(e=>e.animate([{opacity:1},{opacity:0}],{duration:n,easing:`linear`,fill:`forwards`})),s={animations:a,complete:r};o=s,Promise.all(a.map(e=>e.finished)).then(()=>{o===s&&u()},()=>void 0)},p=()=>{let e=r.getBoundingClientRect().height;e>0&&n.style.setProperty(`--dp-ui-panel-height`,`${String(e)}px`)},m=n=>{u();let o=i;if(n===o)return;o===`days`&&p();let d=t.contains(s()),m=n===`input`||o===`input`;i=n;let h=()=>{let t=()=>{c(o),l(n),e.onSwitched(n,o,d)};e.swap===void 0?t():e.swap(t,n,o)};m?h():f(o===`days`?[r]:a,J.PANEL_FADE_OUT,h)},h=(e,t)=>{d(),e!==i&&(c(i),i=e,l(e),t?.rebuilt===!0&&a.forEach(e=>{e.setAttribute(jo,``)}))},g=e=>{let t=e.closest(`[role="listbox"]`);return t===null?-1:Array.from(t.querySelectorAll(Ao)).indexOf(e)},_=e=>{for(let t of a){let n=e(t);if(n)return n}return null},v=(e,t)=>t>=0?_(e=>Array.from(e.querySelectorAll(Ao)).at(t)):e===null?null:_(t=>t.querySelector(`.${e}`));return{current:()=>i,settled:()=>o===null,mount:h,switchTo:m,rebuild:()=>{if(i===`days`||i===`input`||o!==null)return;let e=s(),t=e!==null&&a.some(t=>t.contains(e))?e:null,n=t===null?null:vi(t),r=t===null?-1:g(t),u=a.map(e=>e.scrollTop);c(i),l(i),a.forEach(e=>{e.setAttribute(jo,``)}),requestAnimationFrame(()=>{a.forEach((e,t)=>{e.scrollTop=u.at(t)??e.scrollTop})}),t!==null&&v(n,r)?.focus({preventScroll:!0})},entry:()=>{for(let e of a){let t=e.querySelector(`[tabindex="0"]`);if(t!==null)return t}return null},destroy:d}},No=e=>{let{root:t,core:n,actions:r,rules:i,mode:a,layout:o}=e,s=n.options,c=qi(n,o,a),l=_o({core:n,layout:o,surface:a,rtl:e.rtl,gridContext:()=>Bi(n,i,o),onCommit:(e,t)=>{r.page(e,t)}}),u=q(`div`,`dp-ui__content`);u.append(l.element);let d=Mo({root:t,content:u,days:l.element,motion:e.motion,createParts:e=>e===`input`?Oa({core:n,actions:r,rules:i}):ko(e,{core:n,actions:r,rules:i,layout:o}),swap:(r,i,a)=>{let o=wi(t);o===null||i!==`input`&&a!==`input`?r():ga(o,()=>{r(),Di(o,i,n.layout.months)},e.motion())},onSwitched:e.onSwitched}),f=hi({labels:s.labels,visible:oe(s.footerExplicit,a),todayButton:s.todayButton,clearButton:s.clearButton!==!1}),p=q(`div`,`dp-ui__live-region dp-ui__visually-hidden`,{"aria-live":`polite`,"aria-atomic":`true`});return t.replaceChildren(...c.element===null?[]:[c.element],u,f,p),{header:c,pages:l,panels:d,liveRegion:p}},Po=[`drag`,`wheel`,`button`,`keyboard`,`menu`],Fo=e=>Po.includes(e),Io=(e,t)=>{e.classList.toggle(`dp-ui__calendar--modal`,t===`modal`)},Lo=e=>{let{core:t,actions:n,rules:r,mode:i}=e,a=t.calendarLayout===`docked`?`docked`:`modal`,o=new AbortController,s=q(`div`,`dp-ui__calendar`),c,l=0,u=()=>s.closest(`.dp-ui__container--rtl`)!==null||getComputedStyle(t.input).direction===`rtl`,d=()=>wi(s),f=()=>D(t.options.precision),p=e=>c.pages.cellAt(e),m=(e,n=!0)=>{c.header.docked?.setPanel(e);let r=d();r!==null&&(r.classList.toggle(xi,Ti(e,f())),n&&Di(r,e,t.layout.months))},h=e=>{e===null?c.pages.focusCell(!0):e.focus({preventScroll:!0})},g=e=>{let t=Gi(e);return t===null?null:c.header.element?.querySelector(t)??c.pages.find(t)},_=(e,t,n)=>{e===`days`&&c.pages.refit(),n&&h(e===`days`?t===`input`?null:g(t):c.panels.entry())},v=(e=!1)=>{Io(s,a),c=No({root:s,core:t,actions:n,rules:r,mode:i,layout:a,rtl:u(),motion:()=>br(t.options.animation),onSwitched:_}),c.pages.present(t.view,0),c.panels.mount(t.panel,{rebuilt:e}),e&&c.pages.element.setAttribute(`data-rebuilt`,``),m(t.panel),c.header.modal?.setInputView(t.panel===`input`),mi(s,j(t.draft)),cancelAnimationFrame(l),l=requestAnimationFrame(()=>{l=0,m(c.panels.current()),c.pages.refit()})},y=()=>{c.panels.destroy(),c.pages.destroy(),c.header.modal?.destroy()},b=()=>{o.signal.aborted||(m(c.panels.current()),c.pages.refit())},x=()=>{o.signal.aborted||(b(),h(c.panels.entry()))},S=(e,n,r)=>{c.header.docked?.setView(e),c.header.caption?.setView(e);let i=Fo(r),a=i&&c.panels.current()===`days`&&c.panels.settled();c.pages.present(e,a?n:0),c.panels.rebuild(),i&&xr(c.liveRegion,Vi(t,e))},C=()=>{let e=c.pages.cellHasFocus();c.pages.refresh(),e&&c.pages.focusCell(!1)},w=e=>{c.pages.finish(),m(e,!1),c.header.modal?.setInputView(e===`input`),c.header.modal?.setText($(t)),c.panels.switchTo(e)},T=()=>{c.pages.refresh(),c.panels.rebuild(),c.header.modal?.setText($(t)),mi(s,j(t.draft));let{announceSelection:e}=ae(i,t.options.inline);e&&c.panels.current()===f()&&xr(c.liveRegion,$(t))};return v(),(e=>{let{events:r}=t;r.on(`change:view`,e=>{S(e.view,e.delta,e.source)},e),r.on(`change:draft`,T,e),r.on(`change:focus`,C,e),r.on(`change:panel`,e=>{w(e.panel)},e),bi(s,e,{actions:n,panel:()=>t.panel,home:f(),cellAt:p}),ra(s,e,{core:t,actions:n,layout:a,home:f(),caption:()=>Ki(t,i),cellAt:p,isRtl:u}),si(s,`.dp-ui__icon-button, .dp-ui__menu-button, .dp-ui__text-button, .dp-ui__date:not(.dp-ui__date--disabled) .dp-ui__date-indicator, .dp-ui__menu-item, .dp-ui__year-selection-item, .dp-ui__month-selection-item`,e)})(o.signal),{element:s,focusInitial:x,fit:b,update:()=>{if(o.signal.aborted)return;let e=s.contains(s.ownerDocument.activeElement);y(),v(!0),e&&x()},destroy:()=>{if(o.signal.aborted)return;o.abort(),cancelAnimationFrame(l),y();let e=d();e!==null&&(e.classList.remove(xi,Si),Ei(e,1)),s.remove()}}},Ro=e=>({year:e.year,month:e.month}),zo=e=>{let t=N(e.draft);return t===null?e.view:Ro(t)},Bo=(e,t)=>{let{minDate:n,maxDate:r}=e.options,i=t.yearBounds(),a={year:i.min,month:1},o={year:i.max,month:12},s=n!==null&&y(a,n)>0,c=r!==null&&y(r,o)>0;return{first:s?Ro(n):a,last:c?Ro(r):o}},Vo=(e,t)=>y(t.first,e)<0?t.first:y(e,t.last)<0?t.last:e,Ho=e=>{let t=q(`div`,`dp-ui__top-bar`);return t.append(Q(`close`,e.close,X.close),fi(`save`,e.save)),t},Uo=e=>{let{labels:t,switchView:n}=e,r=q(`div`,`dp-ui__header-text`),i=q(`div`,`dp-ui__supporting-text`);i.textContent=t.rangeTitle;let a=Mi(e.text,e.animate);r.append(i,a.element);let o=n===null?null:pi(t,n.panelId);return{nodes:o===null?[r]:[r,o.button],headline:a,switchButton:o}},Wo=e=>{if(e.length===0)return null;let t=q(`div`,`dp-ui__header dp-ui__header--range`);return t.append(...e),t},Go=e=>{let t=e.fullscreen?Ho(e.labels):null,n=e.headline?Uo(e):null,r=Wo([...t===null?[]:[t],...n===null?[]:n.nodes]);return{element:r,setText:e=>{n?.headline.setText(e)},setInputView:e=>{t!==null&&(t.hidden=e),r!==null&&n===null&&(r.hidden=e),n?.switchButton?.setInputView(e)},destroy:()=>{n?.headline.destroy()}}},Ko=(e,t)=>{let n=q(`div`,`dp-ui__weekdays-bar`,{"aria-hidden":`true`}),r=Ke(e,`narrow`);for(let e=0;e<7;e++){let i=q(`span`,`dp-ui__weekday`);i.textContent=r.at((t+e)%7)??``,n.append(i)}return n},qo=(e,t)=>t===`x`?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight,Jo=(e,t)=>t===`x`?e.clientX:e.clientY,Yo=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},Xo=(e,t,n)=>{t===`x`?e.scrollLeft+=n:e.scrollTop+=n},Zo=(e,t,n=`x`,r={})=>{let i=null,a=0,o=0,s=0,c=!1;n===`x`&&e.addEventListener(`wheel`,t=>{qo(e,n)&&(Math.abs(t.deltaY)<=Math.abs(t.deltaX)||(t.preventDefault(),e.scrollLeft+=t.deltaY))},{signal:t,passive:!1}),e.addEventListener(`pointerdown`,t=>{t.pointerType===`mouse`&&t.button===0&&qo(e,n)&&(i=t.pointerId,a=Jo(t,n),o=a,s=0,c=!1)},{signal:t}),e.addEventListener(`pointermove`,t=>{if(t.pointerId!==i)return;let r=Jo(t,n);s=r-a,!c&&Math.abs(s)<Y.DRAG_START_PX||(c||(c=!0,Yo(e,t.pointerId)),Xo(e,n,o-r),o=r)},{signal:t}),e.addEventListener(`selectstart`,e=>{i!==null&&e.preventDefault()},{signal:t});let l=t=>{t.pointerId===i&&(i=null,e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId),c&&t.type===`pointerup`&&s!==0&&r.onDragEnd?.(s<0?1:-1))};e.addEventListener(`pointerup`,l,{signal:t}),e.addEventListener(`pointercancel`,l,{signal:t}),e.addEventListener(`click`,e=>{c&&(c=!1,e.stopPropagation(),e.preventDefault())},{signal:t,capture:!0})},Qo=(e,t,n)=>({...zi(e,t,!1),outsideSelectable:!1,weekNumbers:!1,headingVisible:!0,weekdaysVisible:n,rangeRole:t=>ue(e.draft,t),labelRole:t=>de(e.draft,t)}),$o=(e,t,n)=>fo(mo(n,e.options.weekStart,!1),Qo(e,t,!1)),es=`td.dp-ui__date[data-date]`,ts=e=>{let{core:t,rules:n}=e,r=new AbortController,i=q(`div`,`dp-ui__month-list`),a=[],o=null,s=0,c=!1,l=0,u=(t,n)=>Array.from({length:n},(n,r)=>e.render(v(t,r))),d=()=>{o!==null&&e.onRendered(o,v(o,a.length-1))},f=t=>{if(o===null)return;let n=v(o,a.length),r=y(n,e.bounds().last)+1,s=Math.min(t,r);if(s<=0)return;let c=u(n,s);a.push(...c),i.append(...c),d()},m=t=>{if(o===null)return;let n=y(e.bounds().first,o),r=Math.min(t,n);if(r<=0)return;let s=v(o,-r),c=u(s,r),l=i.scrollTop,f=i.scrollHeight;o=s,a.unshift(...c),i.prepend(...c),i.scrollTop=l+i.scrollHeight-f,d()},h=t=>{if(o===null)return;let n=Vo(t,e.bounds());m(y(n,o)),f(y(v(o,a.length-1),n))},g=e=>{if(o===null)return null;let t=y(o,e);return t<0?null:a.at(t)??null},_=t=>{let n=Vo(t,e.bounds());h(n);let r=g(n);if(r===null)return;let a=r.getBoundingClientRect().top-i.getBoundingClientRect().top;i.scrollTop+=a},b=()=>{i.scrollTop<i.clientHeight&&m(6),i.scrollHeight-i.scrollTop-i.clientHeight<i.clientHeight&&f(6)},x=e=>{let t=i.getBoundingClientRect().top,n=a.map(e=>({table:e,top:e.getBoundingClientRect().top-t,height:e.getBoundingClientRect().height})),r=Math.max(n.reduce((e,t,n)=>t.top<=1?n:e,0),0),o=n.at(r);if(o===void 0)return null;let s=o.height>0?Math.max(-o.top,0)/o.height:0,c=n.at(r+1)?.table??o.table;return e===1?s>Y.COMMIT_FRACTION?c:o.table:s<1-Y.COMMIT_FRACTION?o.table:c},S=()=>{c&&(window.clearTimeout(l),c=!1,b())},C=e=>{S(),b();let n=x(e);if(n===null)return;let r=n.getBoundingClientRect().top-i.getBoundingClientRect().top;br(t.options.animation)===`full`?(c=!0,l=window.setTimeout(S,J.SNAP_SCROLL_FALLBACK),i.scrollTo({top:i.scrollTop+r,behavior:`smooth`})):i.scrollTop+=r},w=e=>{if(!(e instanceof Element))return null;let t=e.closest(es);return t!==null&&i.contains(t)?t:null},T=e=>{h(Ro(e));let t=i.querySelector(`${es}[data-date="${p(e)}"]`);t!==null&&(t.focus({preventScroll:!0}),Kn(i,t,`nearest`))},ee=()=>{let e=Qo(t,n,!1);a.forEach(t=>{po(t,e)})},E=e.bounds(),D=Vo(zo(t),E),te=Vo(v(D,-2),E),ne=y(te,Vo(v(D,9),E))+1;ne>0&&(o=te,a.push(...u(te,ne)),i.append(...a),d()),i.addEventListener(`scroll`,()=>{s===0&&(s=requestAnimationFrame(()=>{s=0,c||b()}))},{passive:!0,signal:r.signal}),i.addEventListener(`scrollend`,S,{signal:r.signal}),Zo(i,r.signal,`y`,{onDragEnd:C});let re=null;if(typeof ResizeObserver<`u`){let t=0;re=new ResizeObserver(n=>{let i=n.at(-1);if(i===void 0||r.signal.aborted)return;let a=i.contentRect.height,o=t===0;t=a,o&&a>0&&e.onShown()}),re.observe(i)}return{element:i,scrollToMonth:_,refresh:ee,cellAt:w,focusCell:T,ensureMonth:h,reveal:_,present:(e,t,n)=>{Fo(n)?h(e):_(e)},destroy:()=>{r.abort(),re?.disconnect(),cancelAnimationFrame(s),s=0,window.clearTimeout(l),c=!1}}},ns=e=>{let t=q(`div`,`dp-ui__navigation dp-ui__navigation--months`),n=ci(e);return t.append(Q(`prev-month`,e.previousMonth,X.keyboardArrowLeft,n.previousMonth),Q(`next-month`,e.nextMonth,X.keyboardArrowRight,n.nextMonth)),t},rs=e=>{let{core:t,actions:n,rules:r}=e,i=_o({core:t,layout:`docked`,rtl:e.rtl,gridContext:()=>Qo(t,r,!0),onCommit:(e,t)=>{n.page(e,t)}});return{element:i.element,cellAt:e=>i.cellAt(e)?.element??null,focusCell:e=>{let t=i.find(`td.dp-ui__date[data-date][data-date="${p(e)}"]`);t===null?i.focusCell(!0):t.focus({preventScroll:!0})},refresh:()=>{i.refresh()},reveal:()=>{i.refit()},present:(e,t,n)=>{i.present(e,n===`api`?0:t)},destroy:()=>{i.destroy()}}};function is(t){let n;try{n=t.value()}catch(t){return e(t),null}let r=V(n,`range`,`day`);if(r?.mode!==`range`)return null;let{start:i,end:a}=r;return i===null||a===null?null:{start:i,end:a}}let as=e=>{let{core:t,actions:n,rules:r,signal:i,column:a}=e,{presets:o,labels:s,limits:c}=t.options,l=q(`div`,a?`dp-ui__presets dp-ui__presets--column`:`dp-ui__presets`,{role:`group`,"aria-label":s.presets}),u=o.map(e=>{let t=q(`button`,`dp-ui__preset`,{type:`button`});return t.textContent=e.label,t}),d=u.map(()=>null);l.append(...u);let f=()=>{o.forEach((e,n)=>{let i=u[n],a=is(e);d[n]=a;let o=!1,s=!1;if(a!==null){let e={mode:`range`,...a};o=Rn(e,c,e=>r.isDisabled(e)),s=M(t.draft,e)}i.disabled=!o,i.setAttribute(`aria-pressed`,s?`true`:`false`)})};return l.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`button.dp-ui__preset`),r=u.findIndex(e=>e===t);if(r<0)return;let i=d[r];i!==null&&n.selectRange(i.start,i.end)},{signal:i}),Zo(l,i),f(),{element:l,refresh:f,setHidden:e=>{l.hidden=e}}},os=`dp-ui__container--range`,ss=`dp-ui__container--fullscreen`,cs=`dp-ui__container--presets`,ls=[os,cs,ss,Si],us=(e,t)=>{let{core:n,actions:r,rules:i,rtl:a}=e,{labels:o,locale:s,weekStart:c}=n.options;if(n.layout.months>1){let e=rs({core:n,actions:r,rules:i,rtl:a});return t.append(ns(o),e.element),e}let l=ts({core:n,rules:i,render:e=>$o(n,i,e),bounds:()=>Bo(n,i),onRendered:(e,t)=>{r.renderedMonths(e,t)},onShown:e.reveal});return t.append(Ko(s,c),l.element),l},ds=e=>{let{root:t,core:n,actions:r,rules:i,mode:a,fullscreen:o,signal:s}=e,c=n.options,l=Go({labels:c.labels,animate:c.animation,text:$(n),fullscreen:o,headline:ae(a,c.inline).headline,switchView:c.viewSwitch?{panelId:Z(n.instanceId,`input`)}:null}),u=q(`div`,`dp-ui__range`,{"data-panel":`days`}),d=us(e,u),f=Mo({root:t,content:t,days:u,motion:e.motion,createParts:e=>e===`input`?Oa({core:n,actions:r,rules:i}):[],swap:e.swap,onSwitched:e.onSwitched}),p=hi({labels:c.labels,visible:oe(n.options.footerExplicit,a),todayButton:c.todayButton,clearButton:c.clearButton!==!1}),m=q(`div`,`dp-ui__live-region dp-ui__visually-hidden`,{"aria-live":`polite`,"aria-atomic":`true`}),h=n.layout.presets===`column`,g=n.layout.presets===`none`?null:as({core:n,actions:r,rules:i,signal:s,column:h});return t.replaceChildren(...l.element===null?[]:[l.element],...g===null?[]:[g.element],u,p,m),{header:l,days:d,panels:f,liveRegion:m,applyChrome:e=>{let r=e===`input`;l.setInputView(r),l.setText($(n)),g?.setHidden(r);let i=wi(t);i!==null&&(i.classList.add(os),i.classList.toggle(cs,h),i.classList.toggle(ss,o&&!r),Di(i,e,n.layout.months))},refreshPresets:()=>{g?.refresh()}}},fs=(e,t)=>{e.classList.toggle(`dp-ui__calendar--modal`,t)},ps=e=>e===`input`?`input`:`days`,ms=e=>{let{core:t,actions:n,rules:r,mode:i,fullscreen:a}=e,o=t.calendarLayout!==`docked`,s=new AbortController,c=q(`div`,`dp-ui__calendar`),l,u=0,d=null,p=()=>br(t.options.animation),m=()=>c.closest(`.dp-ui__container--rtl`)!==null||getComputedStyle(t.input).direction===`rtl`,h=e=>{let t=l.days.cellAt(e),n=f(t?.dataset.date??``);return t===null||n===null?null:{element:t,date:n}},g=()=>{let{draft:e,value:n}=t,r=A(e)&&A(n);mi(c,j(e)&&!r)},_=()=>{l.days.reveal(zo(t))},v=(e,n,r)=>{e===`days`&&_(),r&&(e===`input`?l.panels.entry()?.focus({preventScroll:!0}):l.days.focusCell(t.focus))},y=(e,t)=>{let n=()=>{l.applyChrome(t),e()};d?.cancel(),d=null;let r=wi(c);r===null?n():d=ga(r,n,p())},b=()=>{fs(c,o),l=ds({root:c,core:t,actions:n,rules:r,mode:i,fullscreen:a,rtl:m(),signal:s.signal,motion:p,reveal:_,swap:y,onSwitched:v}),l.days.present(t.view,0,`api`),l.panels.mount(ps(t.panel)),l.applyChrome(l.panels.current()),g(),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{u=0,l.applyChrome(l.panels.current()),l.panels.current()===`days`&&_()})},x=()=>{d?.cancel(),d=null,l.panels.destroy(),l.days.destroy(),l.header.destroy()},S=()=>{if(s.signal.aborted)return;let e=l.panels.current();l.applyChrome(e),e===`days`&&_()},C=()=>{s.signal.aborted||(cancelAnimationFrame(u),u=0,S(),l.panels.current()===`input`?l.panels.entry()?.focus({preventScroll:!0}):l.days.focusCell(t.focus))},w=()=>{l.days.refresh(),l.refreshPresets(),l.header.setText($(t)),g();let{announceSelection:e}=ae(i,t.options.inline);e&&l.panels.current()===`days`&&xr(l.liveRegion,$(t))},T=()=>{let e=h(c.ownerDocument.activeElement)!==null;l.days.refresh(),e&&l.days.focusCell(t.focus)},ee=(e,n,r)=>{let i=l.panels.current()===`days`&&l.panels.settled();l.days.present(e,i?n:0,r),Fo(r)&&t.layout.months>1&&xr(l.liveRegion,Vi(t,e))};return b(),(e=>{let{events:r}=t;r.on(`change:view`,e=>{ee(e.view,e.delta,e.source)},e),r.on(`change:draft`,w,e),r.on(`change:active-end`,()=>{l.days.refresh()},e),r.on(`change:value`,g,e),r.on(`change:focus`,T,e),r.on(`change:panel`,e=>{l.panels.switchTo(ps(e.panel))},e),bi(c,e,{actions:n,panel:()=>t.panel,home:`days`,cellAt:h}),ra(c,e,{core:t,actions:n,layout:`range`,home:`days`,caption:()=>!1,cellAt:h,isRtl:m}),si(c,`.dp-ui__icon-button, .dp-ui__text-button, .dp-ui__preset, .dp-ui__date:not(.dp-ui__date--disabled) .dp-ui__date-indicator`,e)})(s.signal),{element:c,focusInitial:C,fit:S,update:()=>{if(s.signal.aborted)return;let e=c.contains(c.ownerDocument.activeElement);x(),b(),e&&C()},destroy:()=>{if(s.signal.aborted)return;s.abort(),cancelAnimationFrame(u),x();let e=wi(c);e!==null&&(e.classList.remove(...ls),Ei(e,1)),c.remove()}}},hs=`--dp-ui-scrollbar-gap`,gs=[`auto`,`scroll`],_s=0,vs=[],ys=``,bs=e=>gs.includes(window.getComputedStyle(e).overflowY);function xs(e){let{style:t}=e,n=e.clientWidth,r=parseFloat(window.getComputedStyle(e).paddingRight)||0;vs.push({element:e,overflow:t.overflow,paddingRight:t.paddingRight}),t.overflow=`hidden`;let i=Math.max(0,e.clientWidth-n);return i>0&&(t.paddingRight=`${String(r+i)}px`),i}function Ss(){if(_s===0){let{body:e,documentElement:t}=document,n=bs(e)?xs(e):0,r=xs(t);ys=t.style.getPropertyValue(hs),t.style.setProperty(hs,`${String(Math.max(n,r))}px`)}_s+=1}function Cs(){if(_s===0||(--_s,_s>0))return;vs.forEach(({element:e,overflow:t,paddingRight:n})=>{e.style.overflow=t,e.style.paddingRight=n});let e=document.documentElement;ys?e.style.setProperty(hs,ys):e.style.removeProperty(hs),vs=[],ys=``}function ws(){if(!P())return()=>void 0;Ss();let e=!1;return()=>{e||(e=!0,Cs())}}let Ts=e=>{let t=getComputedStyle(e).getPropertyValue(`--dp-ui-motion-surface-exit`).trim();return t.endsWith(`ms`)&&parseFloat(t)===0};function Es(e,t,n){n!==void 0&&n!==``?(e.setAttribute(`aria-labelledby`,n),e.removeAttribute(`aria-label`)):(e.setAttribute(`aria-label`,t),e.removeAttribute(`aria-labelledby`))}function Ds(e){if(Ts(e))return Promise.resolve();if(typeof e.getAnimations!=`function`)return new Promise(e=>{setTimeout(e,J.SURFACE_EXIT)});let t=e.getAnimations({subtree:!0});return Promise.allSettled(t.map(e=>e.finished)).then(()=>void 0)}var Os=class{root;body;dialog;controller=new AbortController;allowPageScroll;releaseScroll=null;openPromise=null;closePromise=null;pointerStartedOnBackdrop=!1;destroyed=!1;constructor(e){this.allowPageScroll=e.allowPageScroll,this.dialog=q(`dialog`,`dp-ui__dialog`),Es(this.dialog,e.label,e.labelledBy),this.body=q(`div`,`dp-ui__container dp-ui__container--modal`),this.root=this.dialog,this.dialog.appendChild(this.body),e.parent.appendChild(this.dialog);let{signal:t}=this.controller;this.dialog.addEventListener(`cancel`,t=>{t.preventDefault(),this.closePromise||e.onCancel(`escape`)},{signal:t}),this.dialog.addEventListener(`pointerdown`,e=>{this.pointerStartedOnBackdrop=e.target===this.dialog},{signal:t}),this.dialog.addEventListener(`click`,t=>{let n=this.pointerStartedOnBackdrop&&t.target===this.dialog;this.pointerStartedOnBackdrop=!1,n&&!this.closePromise&&e.onCancel(`outside`)},{signal:t})}open(){return this.openPromise||(this.openPromise=Promise.resolve(),this.destroyed)||(this.allowPageScroll||(this.releaseScroll=ws()),this.dialog.showModal()),this.openPromise}close(){return this.closePromise||=(this.dialog.open&&this.dialog.close(),Ds(this.dialog).then(()=>{this.unlock()})),this.closePromise}destroy(){this.destroyed||(this.destroyed=!0,this.controller.abort(),this.unlock(),this.dialog.remove())}setLabel(e,t){Es(this.dialog,e,t)}unlock(){this.releaseScroll?.(),this.releaseScroll=null}},ks=class{root;body;constructor(e){this.root=q(`div`,`dp-ui__container dp-ui__container--inline`,{role:`group`}),Es(this.root,e.label,e.labelledBy),this.body=this.root,e.container.appendChild(this.root)}open(){return Promise.resolve()}close(){return Promise.resolve()}destroy(){this.root.remove()}setLabel(e,t){Es(this.root,e,t)}};let As=`anchor-name`,js=e=>typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`position-try-fallbacks`,`flip-block`)&&typeof e.showPopover==`function`,Ms=e=>`--dp-ui-anchor-${e.replace(/[^\w-]/g,`-`)}`,Ns=(e,t,n)=>{let{style:r}=t,i=r.getPropertyValue(As);return r.setProperty(As,n),e.style.setProperty(`--dp-ui-anchor-name`,n),e.setAttribute(`data-positioning`,`anchor`),()=>{i?r.setProperty(As,i):r.removeProperty(As)}},Ps=e=>{let{left:t,right:n}=e.getBoundingClientRect(),r=e.ownerDocument.documentElement.clientWidth;return t<-.5||n>r+.5},Fs=(e,t)=>{let n=e.getBoundingClientRect().top<t.getBoundingClientRect().top;e.setAttribute(`data-placement`,n?`top`:`bottom`)},Is=(e,t)=>Math.round(e*t)/t;function Ls({anchor:e,contentWidth:t,pickerHeight:n,minHeight:r,layoutWidth:i,viewport:a,tokens:o,request:s,rtl:c,pixelRatio:l}){let{gap:u,minWidth:d,maxWidth:f,edgeMargin:p}=o,{offsetLeft:m,offsetTop:h}=a,g=Is(Math.min(Math.max(e.width,d,t),f,i-2*p),l),_=h+p,v=e.top-u-_,y=h+a.height-p-e.bottom-u,b=(s===`auto`?n<=y||!(n<=v)&&y>=v?`bottom`:`top`:s)===`top`,x=b?v:y,S=x<Math.min(n,r)&&(b?y:v)>x?!b:b,C=S?`top`:`bottom`,w=S?v:y,T=n>w?Math.max(w,0):null,ee=T??n,E=S?e.top-u-ee:e.bottom+u,D=c?e.right-g:e.left,te=Math.max(Math.min(D,m+a.width-g-p),m+p);return{top:Is(Math.max(E,_),l),left:Is(te,l),width:g,placement:C,availableHeight:T}}let Rs=`--dp-ui-popover-top`,zs=`--dp-ui-popover-left`,Bs=`--dp-ui-popover-available-height`,Vs=(e,t,n)=>{e.style.setProperty(`max-width`,`var(--dp-ui-${t})`);let r=getComputedStyle(e).getPropertyValue(`max-width`),i=r.endsWith(`px`)?parseFloat(r):NaN;return i>=0?i:n},Hs=e=>{let t=q(`div`);t.style.cssText=`position:absolute;visibility:hidden;pointer-events:none`,e.appendChild(t);let n={gap:Vs(t,`popover-gap`,4),edgeMargin:Vs(t,`popover-edge-margin`,4),minHeight:Vs(t,`popover-min-height`,160)};return t.remove(),n},Us=(e,t,n)=>{let r=null;return{enable:()=>{let{style:t}=e;t.setProperty(`position`,`fixed`),t.setProperty(`margin`,`0`),t.setProperty(`inset`,`auto`),t.setProperty(`top`,`var(${Rs})`),t.setProperty(`left`,`var(${zs})`),e.setAttribute(`data-positioning`,`fallback`)},layout:()=>{r??=Hs(e);let i=e.ownerDocument.documentElement;e.style.removeProperty(Bs);let a=t.getBoundingClientRect(),o=e.offsetWidth,{top:s,left:c,placement:l,availableHeight:u}=Ls({anchor:{top:a.top,bottom:a.bottom,left:a.left,right:a.right,width:0},contentWidth:o,pickerHeight:e.offsetHeight,minHeight:r.minHeight,layoutWidth:i.clientWidth,viewport:window.visualViewport??{width:i.clientWidth,height:i.clientHeight,offsetLeft:0,offsetTop:0},tokens:{gap:r.gap,edgeMargin:r.edgeMargin,minWidth:0,maxWidth:o},request:`auto`,rtl:n,pixelRatio:window.devicePixelRatio||1});e.style.setProperty(Rs,`${String(s)}px`),e.style.setProperty(zs,`${String(c)}px`),u!==null&&e.style.setProperty(Bs,`${String(u)}px`),e.setAttribute(`data-placement`,l)}}},Ws=e=>{document.addEventListener(`pointerdown`,t=>{if(e.isIgnored())return;let n=t.composedPath();e.inside.some(e=>n.includes(e))||e.onOutside()},{capture:!0,signal:e.signal})},Gs=(e,t,n)=>{let r=new AbortController,{signal:i}=r,a=0,o=()=>{a===0&&(a=requestAnimationFrame(()=>{a=0,i.aborted||n()}))};if(window.addEventListener(`resize`,o,{signal:i}),window.addEventListener(`scroll`,t=>{let{target:n}=t;n instanceof Node&&e.contains(n)||o()},{capture:!0,signal:i}),window.visualViewport?.addEventListener(`resize`,o,{signal:i}),window.visualViewport?.addEventListener(`scroll`,o,{signal:i}),typeof ResizeObserver<`u`){let n=new ResizeObserver(o);n.observe(t),n.observe(e),i.addEventListener(`abort`,()=>{n.disconnect()})}return i.addEventListener(`abort`,()=>{cancelAnimationFrame(a),a=0}),()=>{r.abort()}};var Ks=class{root;body;anchor;anchorName;fallback;controller=new AbortController;stopTracking=null;restoreAnchor=null;hasPopover;anchored=!1;openPromise=null;closePromise=null;destroyed=!1;constructor(e){this.anchor=e.anchor,this.anchorName=Ms(e.instanceId),this.root=q(`div`,`dp-ui__container dp-ui__container--docked`,{role:`dialog`,"aria-modal":`false`,"data-placement":`bottom`}),Es(this.root,e.label,e.labelledBy),this.body=this.root,this.fallback=Us(this.root,this.anchor,e.rtl),this.hasPopover=typeof this.root.showPopover==`function`,this.hasPopover?this.root.setAttribute(`popover`,`manual`):this.root.style.display=`none`,e.host.appendChild(this.root);let{signal:t}=this.controller;Ws({inside:[this.root,this.anchor,...e.inside],signal:t,isIgnored:()=>e.ignoreOutsideClick||this.closePromise!==null,onOutside:()=>{e.onOutside()}}),this.root.addEventListener(`keydown`,t=>{t.key!==`Escape`||t.defaultPrevented||this.closePromise||e.onEscape()},{signal:t})}open(){return this.openPromise||(this.openPromise=Promise.resolve(),this.destroyed)||(this.show(),this.update(),this.stopTracking=Gs(this.root,this.anchor,()=>{this.update()})),this.openPromise}close(){return this.closePromise||=(this.endTracking(),this.hide(),Ds(this.root)),this.closePromise}destroy(){this.destroyed||(this.destroyed=!0,this.endTracking(),this.controller.abort(),this.restoreAnchor?.(),this.restoreAnchor=null,this.root.remove())}setLabel(e,t){Es(this.root,e,t)}endTracking(){this.stopTracking?.(),this.stopTracking=null}show(){if(!this.hasPopover)this.root.style.removeProperty(`display`),this.enableFallback();else{try{this.root.showPopover()}catch{this.hasPopover=!1,this.root.removeAttribute(`popover`),this.enableFallback();return}js(this.root)?(this.restoreAnchor=Ns(this.root,this.anchor,this.anchorName),this.anchored=!0):this.enableFallback()}}hide(){if(!this.hasPopover)this.root.style.display=`none`;else try{this.root.hidePopover()}catch{this.root.removeAttribute(`popover`),this.hasPopover=!1,this.root.style.display=`none`}}enableFallback(){this.fallback.enable(),this.anchored=!1}update(){this.anchored&&Ps(this.root)&&this.enableFallback(),this.anchored?Fs(this.root,this.anchor):this.fallback.layout()}},qs=class{core;deps;mounted=null;generation=0;constructor(e,t,n){this.core=e,this.deps=n}get surface(){return this.mounted?.host.root??null}async mount(e){this.release();let t=this.createHost(e);if(t===null)return;let{core:n}=this,{options:r}=n,{actions:i,rules:a,theme:o}=this.deps,s=++this.generation;o.applyTo(t.root),Rr(t.root,r.animation);let c={core:n,actions:i,rules:a,mode:e,fullscreen:n.calendarLayout===`fullscreen`},l=r.mode===`range`?ms(c):Lo(c);this.mounted={mode:e,host:t,view:l,stopModality:Sr(t.root),stopSchemeWatch:e===`inline`?Fr(()=>{o.applyTo(t.root)}):()=>void 0},t.body.append(l.element);let u=t.open();l.fit(),this.overflows(e,t)?(this.release(),this.deps.overflow()):(await u,s===this.generation&&e!==`inline`&&l.focusInitial())}async unmount(){let e=this.mounted;if(e===null)return;let t=++this.generation;await e.host.close(),t===this.generation&&this.mounted===e&&this.release()}update(){let e=this.mounted;e!==null&&(this.deps.theme.applyTo(e.host.root),e.host.setLabel(this.label()),Rr(e.host.root,this.core.options.animation),e.view.update())}label(){let{labels:e,mode:t,precision:n}=this.core.options;return Xr(e,t,n)}destroy(){this.generation+=1,this.release()}overflows(e,t){return e===`docked`&&this.core.options.displayMode===`auto`&&!ri(t.root,this.core.input)}release(){let e=this.mounted;e!==null&&(this.mounted=null,e.view.destroy(),e.host.destroy(),e.stopModality(),e.stopSchemeWatch())}createHost(e){let{core:t}=this,{options:n}=t,{actions:r}=this.deps,i=this.label();if(e===`inline`){let e=K(n.inline.container);return e===null?null:new ks({container:e,label:i})}return e===`modal`?new Os({parent:K(n.appendTo)??t.host,label:i,allowPageScroll:n.allowPageScroll,onCancel:e=>{r.cancel(e)}}):new Ks({host:t.host,anchor:t.input,instanceId:t.instanceId,rtl:getComputedStyle(t.input).direction===`rtl`,label:i,ignoreOutsideClick:n.behavior.ignoreOutsideClick,inside:[...t.endInput===null?[]:[t.endInput],...this.deps.inside()],onOutside:()=>{r.cancel(`outside`)},onEscape:()=>{r.cancel(`escape`)}})}},Js=class{core;fields=[];initial;constructor(e){this.core=e,this.initial=e.value}bind(e){let{input:t}=this.core;this.initial=this.core.value;let n=this.splitEnd();this.bindField(t,n===null?null:`start`),n!==null&&this.bindField(n,`end`),this.fields.length!==0&&t.form?.addEventListener(`reset`,()=>{setTimeout(()=>{this.handleReset()},0)},{signal:e})}sync(){for(let e of this.fields)e.hidden.value=this.valueOf(e.end)}dispatchCommit(){let{input:e}=this.core;e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}restore(){for(let e of this.fields)e.hidden.remove(),e.input.setAttribute(`name`,e.name);this.fields=[]}splitEnd(){return this.core.options.mode===`range`?this.core.endInput:null}bindField(e,t){let n=e.getAttribute(`name`);n!==null&&n!==``&&(e.removeAttribute(`name`),this.fields.push({input:e,name:n,hidden:this.createHidden(e,n),end:t}))}valueOf(e){let{value:t,options:n}=this.core;if(e===null||t.mode!==`range`)return Jr(t,n.precision);let r=e===`start`?t.start:t.end;return r===null?``:_t(r,`day`)}createHidden(e,t){let n=e.ownerDocument.createElement(`input`);return n.type=`hidden`,n.name=t,n.classList.add(`dp-ui__form-value`),e.insertAdjacentElement(`afterend`,n),n}writeFields(e){let{core:t}=this,{pattern:n,precision:r}=t.options,i=this.splitEnd();if(i===null||e.mode!==`range`){t.input.value=Ur(e,n,r);return}let a=e=>e===null?``:B(e,n,`day`);t.input.value=a(e.start),i.value=a(e.end)}handleReset(){let{core:e}=this,{mode:t}=e.options,n=this.initial.mode===t?this.initial:O(t);e.setValue(n),this.writeFields(n),this.sync()}};let Ys=`aria-describedby`,Xs=e=>(e.getAttribute(Ys)??``).split(/\s+/).filter(e=>e!==``);function Zs(e,t,n,r){let i=q(`span`,`dp-ui__visually-hidden`,{id:n}),a=q(`span`,void 0,{"aria-live":`polite`}),o=q(`span`);return o.textContent=r,i.append(a,` `,o),t.append(i),e.setAttribute(Ys,[...Xs(e),n].join(` `)),{setHint:e=>{o.textContent!==e&&(o.textContent=e)},setError:e=>{let t=e??``;a.textContent!==t&&(a.textContent=t)},destroy:()=>{i.remove();let t=Xs(e).filter(e=>e!==n);t.length===0?e.removeAttribute(Ys):e.setAttribute(Ys,t.join(` `))}}}let Qs=`dp-ui--error`;function $s(e,t,n){e.setAttribute(`aria-invalid`,`true`),t.classList.add(Qs),e.setCustomValidity(n)}function ec(e,t){e.removeAttribute(`aria-invalid`),t.classList.remove(Qs),e.setCustomValidity(``)}function tc(e,t,n){let r=e.trim(),i=t.trim();if(r===``&&i===``)return{kind:`empty`};let a=r===``?null:pt(r,n);if(r!==``&&a===null)return{kind:`invalid`,field:`start`};let o=i===``?null:pt(i,n);return i!==``&&o===null?{kind:`invalid`,field:`end`}:a===null||o===null?{kind:`partial`}:m(a,o)>0?{kind:`reversed`}:{kind:`range`,start:a,end:o}}var nc=class{core;emitter;deps;dirty=!1;constructor(e,t,n){this.core=e,this.emitter=t,this.deps=n}get end(){return this.core.options.mode===`range`?this.core.endInput:null}bind(e){let{end:t}=this;if(t!==null)for(let n of[this.core.input,t])n.addEventListener(`blur`,()=>{this.commit()},{signal:e}),n.addEventListener(`input`,()=>{this.dirty=!0,this.applyMask(n)},{signal:e}),n.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this.commit())},{signal:e})}write(e){let{end:t}=this;if(t===null)return;let n=e.mode===`range`?e:null;this.core.input.value=this.format(n?.start??null),t.value=this.format(n?.end??null),this.dirty=!1,this.clearError()}readInitial(){let{end:e}=this,t=O(`range`);if(e===null)return t;let n=this.readDate(this.core.input.value),r=this.readDate(e.value);return n===null||r===null||m(n,r)>0?t:{mode:`range`,start:n,end:r}}markInvalid(e){let{end:t}=this;if(t===null)return;let{input:n,host:r}=this.core;$s(n,r,e),$s(t,r,e),this.deps.describe(n,e),this.deps.describe(t,e),this.emitter.emit(`error`,{code:`invalid-value`,message:e})}clearError(){let{end:e}=this;if(e===null)return;let{input:t,host:n}=this.core;ec(t,n),ec(e,n),this.deps.describe(t,null),this.deps.describe(e,null)}format(e){return e===null?``:B(e,this.core.options.pattern,`day`)}readDate(e){let{pattern:t}=this.core.options,n=Yr(e,`single`,`day`)??qr(e,`single`,t,`day`);return n?.mode===`single`?n.date:null}applyMask(e){let{options:t}=this.core;t.mask&&Sa(e,t.pattern)}commit(){let{end:e}=this;if(e===null||!this.dirty)return;let{options:t,input:n}=this.core,r=tc(n.value,e.value,t.pattern);r.kind!==`partial`&&(r.kind===`empty`?this.settle(O(`range`)):r.kind===`invalid`?this.fail(r.field,`invalid-date`,t.labels.invalidDate):r.kind===`reversed`?this.fail(`end`,`invalid-date`,t.labels.invalidRange):this.commitRange(r.start,r.end))}commitRange(e,t){let{options:n}=this.core,r={mode:`range`,start:e,end:t},i=e=>this.deps.rules.unavailableReason(e),a=Ln(r,n.limits,i);if(a===null){this.settle(r);return}let o=i(e)===null?`end`:`start`;this.fail(o,`unavailable-date`,Da(a,n),a)}settle(e){this.write(e),this.deps.onTyped(e)}fail(e,t,n,r){let i=e===`start`?this.core.input:this.end;if(i===null)return;this.clearError(),$s(i,this.core.host,n),this.deps.describe(i,n);let a=i.value;r===void 0?this.emitter.emit(`error`,{code:t,message:n,input:a}):this.emitter.emit(`error`,{code:t,message:n,input:a,reason:r})}},rc=class{core;emitter;deps;split;descriptions=/* @__PURE__ */ new Map;constructor(e,t,n){this.core=e,this.emitter=t,this.deps=n,this.split=new nc(e,t,{rules:n.rules,onTyped:e=>{n.onTyped(e)},describe:(e,t)=>{this.describe(e,t)}})}bind(e){if(this.describeFields(e),this.split.end!==null){this.split.bind(e);return}let{input:t}=this.core;t.addEventListener(`blur`,()=>{this.commit()},{signal:e}),t.addEventListener(`input`,()=>{this.applyMask()},{signal:e}),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this.commit())},{signal:e})}write(e){this.split.end===null?(this.core.input.value=Ur(e,this.core.options.pattern,this.core.options.precision),this.clearError()):this.split.write(e)}readInitial(){if(this.split.end!==null)return this.split.readInitial();let{mode:e,pattern:t,precision:n}=this.core.options,r=this.core.input.value;return Yr(r,e,n)??qr(r,e,t,n)??O(e)}evaluate(e){let{mode:t,pattern:n,limits:r,precision:i}=this.core.options,a=qr(e,t,n,i);if(a===null)return{kind:`invalid`};if(A(a))return{kind:`empty`};let o=Ln(a,r,e=>this.deps.rules.unavailableReason(e));return o===null?{kind:`valid`,selection:a}:{kind:`unavailable`,selection:a,reason:o}}markInvalid(e){this.split.end===null?(this.showError(e),this.emitter.emit(`error`,{code:`invalid-value`,message:e})):this.split.markInvalid(e)}destroy(){this.clearError(),this.split.clearError(),this.descriptions.forEach(e=>{e.destroy()}),this.descriptions.clear()}describeFields(e){let{input:t,host:n,instanceId:r}=this.core,{end:i}=this.split,a=()=>{let{pattern:e,precision:t,labels:n}=this.core.options;return bt(e,t,ke(n))},o=[[t,`input-description`]];i!==null&&o.push([i,`end-input-description`]);for(let[e,t]of o){let i=Z(r,t);this.descriptions.set(e,Zs(e,n,i,a()))}this.core.events.on(`change:options`,()=>{let e=a();this.descriptions.forEach(t=>{t.setHint(e)})},e)}describe(e,t){this.descriptions.get(e)?.setError(t)}applyMask(){let{input:e,options:t}=this.core;t.mask&&t.mode===`single`&&t.precision===`day`&&Sa(e,t.pattern)}commit(){let e=this.core.input.value,t=this.evaluate(e);if(t.kind===`empty`)this.clearError(),this.deps.onTyped(O(this.core.options.mode));else if(t.kind===`valid`)this.write(t.selection),this.deps.onTyped(t.selection);else if(t.kind===`invalid`){let t=this.core.options.labels.invalidDate;this.showError(t),this.emitter.emit(`error`,{code:`invalid-date`,message:t,input:e})}else{let{reason:n}=t,r=Da(n,this.core.options);this.showError(r),this.emitter.emit(`error`,{code:`unavailable-date`,message:r,input:e,reason:n})}}showError(e){$s(this.core.input,this.core.host,e),this.describe(this.core.input,e)}clearError(){ec(this.core.input,this.core.host),this.describe(this.core.input,null)}};let ic=`dp-ui__container`,ac=/\s+/,oc=/* @__PURE__ */ new WeakMap;function sc(e){return e.split(ac).filter(e=>e!==``)}function cc(e,t){e.setAttribute(`data-theme`,t.theme),e.setAttribute(`data-color-scheme`,t.colorScheme),e.classList.remove(...oc.get(e)??[]);let n=sc(t.className??``);e.classList.add(...n),oc.set(e,n),(e.classList.contains(ic)?e:e.querySelector(`.${ic}`))?.classList.toggle(`dp-ui__container--rtl`,t.rtl??!1)}var lc=class{core;constructor(e){this.core=e}applyHost(){this.core.host.setAttribute(`data-theme`,this.core.options.theme)}applyTo(e){let{options:t,input:n,host:r}=this.core;cc(e,{theme:t.theme,colorScheme:t.colorScheme===`auto`?Pr(r):t.colorScheme,className:t.cssClass,rtl:getComputedStyle(n).direction===`rtl`})}destroy(){this.core.host.removeAttribute(`data-theme`)}};let uc=(e,t,n,r)=>{let i=k(e);return i.length===0?``:e.mode===`multiple`?ti(n,i.length,t):i.map(e=>Qe(e,r,t,`long`)).join(zr)},dc=`dp-ui__input--active`;var fc=class{core;deps;toggle=null;expanded=!1;release=null;constructor(e,t,n){this.core=e,this.deps=n}get toggleElement(){return this.toggle}bind(e){if(this.releaseToggle(),this.core.options.inline.enabled||e.aborted)return;let{input:t}=this.core;this.bindField(t,`start`,e);let n=this.splitEnd();n!==null&&(this.bindField(n,`end`,e),this.core.events.on(`change:active-end`,()=>{this.markActive()},e)),this.bindToggle(e)}setExpanded(e){this.expanded=e,this.toggle?.setAttribute(`aria-expanded`,String(e)),this.markActive()}updateLabel(){if(this.toggle===null)return;let{labels:e,locale:t,precision:n}=this.core.options,r=uc(this.core.value,t,e.multipleSelected,n),i=r===``?e.openCalendar:`${e.openCalendar}, ${r}`;this.toggle.setAttribute(`aria-label`,i)}destroy(){this.releaseToggle(),this.core.input.classList.remove(dc),this.core.endInput?.classList.remove(dc)}splitEnd(){return this.core.options.mode===`range`?this.core.endInput:null}bindField(e,t,n){let r=!1;e.addEventListener(`pointerdown`,()=>{r=!0},{signal:n}),e.addEventListener(`click`,()=>{let n=r;r=!1,(!this.expanded||n)&&this.request(`pointer`,t,e)},{signal:n}),e.addEventListener(`keydown`,n=>{n.altKey&&n.key===`ArrowDown`&&(n.preventDefault(),this.request(`keyboard`,t,e))},{signal:n})}markActive(){let e=this.splitEnd(),{input:t}=this.core;if(e===null){t.classList.remove(dc);return}let n=this.expanded?this.core.activeEnd:null;t.classList.toggle(dc,n===`start`),e.classList.toggle(dc,n===`end`)}request(e,t,n=this.core.input){n.disabled||this.deps.open(e,t)}activateToggle(){this.expanded?this.deps.dismiss():this.request(`toggle`,`start`)}bindToggle(e){let t=K(this.core.options.toggleButton,this.core.host);if(t===null)return;let n=/* @__PURE__ */ new Map,r=(e,r)=>{n.has(e)||n.set(e,t.getAttribute(e)),t.setAttribute(e,r)};r(`aria-haspopup`,`dialog`),t.tagName!==`BUTTON`&&(r(`role`,`button`),r(`tabindex`,`0`),t.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.activateToggle())},{signal:e})),t.addEventListener(`click`,()=>{this.activateToggle()},{signal:e}),this.toggle=t,r(`aria-expanded`,String(this.expanded)),r(`aria-label`,this.core.options.labels.openCalendar),this.updateLabel();let i=()=>{e.removeEventListener(`abort`,i),n.forEach((e,n)=>{e===null?t.removeAttribute(n):t.setAttribute(n,e)}),this.toggle===t&&(this.toggle=null),this.release===i&&(this.release=null)};this.release=i,e.addEventListener(`abort`,i,{once:!0})}releaseToggle(){this.release?.()}};function pc(e){return e.year*12+e.month-1}var mc=class{core;emitter;lists=null;constructor(e,t){this.core=e,this.emitter=t}isDisabled(e){return this.unavailableReason(e)!==null}unavailableReason(e){switch(this.core.options.precision){case`day`:return this.dayReason(e);case`month`:return this.monthReason(e);case`year`:return this.yearReason(e.year)}}isSelectable(e,t){return!this.isDisabled(e)&&!this.guardFor(t)(e)}isMonthDisabled(e){let t=b(e),n=l(e.year,e.month,1),r=l(e.year,e.month,t);if(n===null||r===null)return!0;let{minDate:i,maxDate:a}=this.core.options,o=this.yearBounds();if(e.year<o.min||e.year>o.max||i!==null&&m(r,i)<0||a!==null&&m(n,a)>0)return!0;for(let n=1;n<=t;n+=1)if(this.dayReason({year:e.year,month:e.month,day:n})===null)return!1;return!0}yearBounds(){let{minDate:e,maxDate:t,yearRange:n}=this.core.options,r=S(),i=r.year-n.before,a=r.year+n.after;return{min:e===null?i:Math.max(i,e.year),max:t===null?a:Math.min(a,t.year)}}clampView(e){let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds(),i=r.min*12,a=r.max*12+11;t!==null&&(i=Math.max(i,pc(t))),n!==null&&(a=Math.min(a,pc(n)));let o=this.core.layout.months-1;o>0&&(a=Math.max(i,a-o));let s=Math.min(Math.max(pc(e),i),a),c=Math.floor(s/12);return{year:c,month:s-c*12+1}}destroy(){this.lists=null}monthReason(e){if(!this.isMonthDisabled(e))return null;let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds(),i=pc(e),a=r.min*12,o=r.max*12+11;return t!==null&&(a=Math.max(a,pc(t))),n!==null&&(o=Math.min(o,pc(n))),i<a?`min`:i>o?`max`:`disabled`}yearReason(e){let t=this.yearBounds();return e<t.min?`min`:e>t.max?`max`:null}dayReason(e){let{minDate:t,maxDate:n}=this.core.options,r=this.yearBounds();if(t!==null&&m(e,t)<0||e.year<r.min)return`min`;if(n!==null&&m(e,n)>0||e.year>r.max)return`max`;let i=this.getLists(),a=p(e);return i.disabled.has(a)||i.enabled!==null&&!i.enabled.has(a)?`disabled`:i.source.disabledWeekdays.includes(x(e))?`weekday`:this.isCallbackDisabled(e,i)?`disabled`:null}isCallbackDisabled(t,n){let{isDateDisabled:r}=n.source;if(r===null)return!1;let i=p(t),a=n.callbackResults.get(i);if(a!==void 0)return a;let o=!1;try{o=r(d(t))}catch(t){e(t)}return n.callbackResults.set(i,o),o}guardFor(e){let t=this.getLists(),n=t.guardDraft;if(t.guard!==null&&n!==null&&M(n,e))return t.guard;let{maxDate:r,limits:i}=t.source,a={year:this.yearBounds().max,month:12,day:31};r!==null&&m(r,a)<0&&(a=r);let o=Pn(e,i,e=>this.isDisabled(e),a);return t.guardDraft=e,t.guard=o,o}getLists(){let e=this.core.options;if(this.lists?.source===e)return this.lists;let t={source:e,disabled:new Set(e.disabledDates.map(p)),enabled:e.enabledDates===null?null:new Set(e.enabledDates.map(p)),callbackResults:/* @__PURE__ */ new Map,guardDraft:null,guard:null};return this.lists=t,t}},hc=class{target=null;select=e=>{this.target?.select(e)};selectRange=(e,t)=>{this.target?.selectRange(e,t)};typeDraft=e=>{this.target?.typeDraft(e)};submitDraft=()=>{this.target?.submitDraft()};focusDate=e=>{this.target?.focusDate(e)};navigate=(e,t)=>{this.target?.navigate(e,t)};page=(e,t)=>{this.target?.page(e,t)};jumpTo=(e,t)=>{this.target?.jumpTo(e,t)};showPanel=e=>{this.target?.showPanel(e)};confirm=()=>{this.target?.confirm()};cancel=e=>{this.target?.cancel(e)};today=()=>{this.target?.today()};clear=()=>{this.target?.clear()};renderedMonths=(e,t)=>{this.target?.renderedMonths(e,t)};open=(e,t)=>{this.target?.open(e,t)};typed=e=>{this.target?.applyTyped(e)};overflow=()=>{this.target?.fallBackToModal()};connect(e){this.target=e}},gc=class{validation;theme;display;input;triggers;form;relay=new hc;constructor(e,t){this.validation=new mc(e,t),this.theme=new lc(e),this.display=new qs(e,t,{actions:this.relay,rules:this.validation,theme:this.theme,inside:()=>{let e=this.triggers.toggleElement;return e===null?[]:[e]},overflow:this.relay.overflow}),this.input=new rc(e,t,{rules:this.validation,onTyped:this.relay.typed}),this.triggers=new fc(e,t,{open:this.relay.open,dismiss:()=>{this.relay.cancel(`toggle`)}}),this.form=new Js(e)}connect(e){this.relay.connect(e)}destroy(){this.relay.connect(null),this.display.destroy(),this.triggers.destroy(),this.input.destroy(),this.form.restore(),this.theme.destroy(),this.validation.destroy()}};let _c=/* @__PURE__ */ new Map,vc=()=>void 0;return class{core;emitter;lifecycle;constructor(e,n){let r=Tn(e);this.emitter=new t,this.core=new yn(r.input,r.host,r.createdHost,n),this.lifecycle=new gr(this.core,this.emitter,new gc(this.core,this.emitter)),_c.set(this.core.instanceId,this)}create(){this.lifecycle.create()}open(){this.lifecycle.open(`api`)}close(){this.lifecycle.close()}destroy(e){this.lifecycle.destroy(e?.keepInputValue??!1),_c.get(this.core.instanceId)===this&&_c.delete(this.core.instanceId)}getValue(){return this.lifecycle.getValue()}setValue(e){this.lifecycle.setValue(e)}setActiveEnd(e){this.lifecycle.setActiveEnd(e)}setView(e){this.lifecycle.setView(e)}getView(){return this.lifecycle.getView()}getVisibleRange(){return this.lifecycle.getVisibleRange()}goTo(e){this.lifecycle.goTo(e)}isSelectable(e){return this.lifecycle.isSelectable(e)}clear(){this.lifecycle.clearValue()}setOptions(e){this.lifecycle.setOptions(e)}getElement(){return this.core.host}on(e,t){return this.lifecycle.destroyed?vc:this.emitter.on(e,t)}once(e,t){return this.lifecycle.destroyed?vc:this.emitter.once(e,t)}off(e,t){this.emitter.off(e,t)}get instanceId(){return this.core.instanceId}get options(){return this.core.rawOptions}get isInitialized(){return this.lifecycle.created}get isDestroyed(){return this.lifecycle.destroyed}static getById(e){return _c.get(_n(e))}static getAllInstances(){return[..._c.values()]}static destroyAll(){for(let e of[..._c.values()])e.destroy()}}});
|