@pglejzer/datepicker-ui 0.0.1 → 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/LICENSE +21 -0
- package/README.md +245 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.d.cts +66 -0
- package/dist/cjs/kit.cjs +1 -0
- package/dist/cjs/kit.d.cts +193 -0
- package/dist/cjs/shared.cjs +1 -0
- package/dist/cjs/shared.d.cts +858 -0
- package/dist/css/index.css +1 -0
- package/dist/css/main.css +1 -0
- package/dist/css/themes/theme-ai.css +1 -0
- package/dist/css/themes/theme-blueprint.css +1 -0
- package/dist/css/themes/theme-crane-straight.css +1 -0
- package/dist/css/themes/theme-crane.css +1 -0
- package/dist/css/themes/theme-cyberpunk.css +1 -0
- package/dist/css/themes/theme-glassmorphic.css +1 -0
- package/dist/css/themes/theme-m2.css +1 -0
- package/dist/css/themes/theme-m3-green.css +1 -0
- package/dist/css/themes/theme-pastel.css +1 -0
- package/dist/esm/index.d.ts +70 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/kit.d.ts +194 -0
- package/dist/esm/kit.js +1 -0
- package/dist/esm/shared.d.ts +853 -0
- package/dist/esm/shared.js +1 -0
- package/dist/umd/index.js +1 -0
- package/dist/umd/kit.js +1 -0
- package/package.json +78 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`dp-ui-`,t=/^(\d{4})-(\d{2})-(\d{2})$/;function n(e){return e%4==0&&e%100!=0||e%400==0}function r(e,t){return t===2?n(e)?29:28:t===4||t===6||t===9||t===11?30:31}function i(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 a(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 o(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 s(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<=r(e,t)}function c(e,t,n){return s(e,t,n)?{year:e,month:t,day:n}:null}function l(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function u(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 d(e){let n=t.exec(e);return n?c(Number(n[1]),Number(n[2]),Number(n[3])):null}function f(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function p(e,t){return e.year===t.year?e.month===t.month?e.day-t.day:e.month-t.month:e.year-t.year}function m(e,t){return e===null||t===null?!1:p(e,t)===0}function h(e,t){return a(i(e.year,e.month,e.day)+t)}function g(e,t){return i(t.year,t.month,t.day)-i(e.year,e.month,e.day)}function _(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 v(e,t){return t.year*12+t.month-(e.year*12+e.month)}function y(e){return r(e.year,e.month)}function b(e){return o(i(e.year,e.month,e.day)+4)}function x(){return l(/* @__PURE__ */ new Date)}function S(e){return e===`today`?x():typeof e==`string`?d(e):Number.isNaN(e.getTime())?null:l(e)}function ee(e){let t=i(e.year,e.month,e.day),n=(b(e)+6)%7+1,r=t+4-n,o=a(r).year,s=i(o,1,1);return Math.floor((r-s)/7)+1}const C={headline:!0,navigation:`menus`,announceSelection:!0},w=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}},te=(e,t,n)=>{if(n!==`day`)return!1;switch(e){case`single`:return t!==`docked`;case`range`:return!0;case`multiple`:return!1}},ne=e=>{switch(e){case`day`:return`days`;case`month`:return`month-grid`;case`year`:return`year-grid`}},re=(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`}},ie=(e,t,n,r)=>t?`inline`:e===`auto`?n<600||r<480?`modal`:`docked`:e,ae=(e,t,n,r)=>e===`range`&&t===`modal`&&n<r,oe=(e,t,n)=>{let{mode:r,layout:i}=t;return i===`docked`?`docked`:i===`fullscreen`?r===`range`&&e!==`docked`?`fullscreen`:`modal`:e===`modal`?ae(r,e,n,t.fullscreenBelow)?`fullscreen`:`modal`:i===`modal`?`modal`:`docked`},se=(e,t)=>e===`inline`?t:C,ce=(e,t)=>e??t!==`inline`;function le(e){let t=[...e].sort(p);return t.filter((e,n)=>n===0||p(t[n-1],e)!==0)}function T(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 E(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 ue(e){return E(e).length===0}function de(e){return e.mode!==`range`||e.start===null==(e.end===null)}function fe(e,t){return e===null||t===null?e===t:p(e,t)===0}function pe(e,t){if(e.mode!==t.mode)return!1;let n=E(e),r=E(t);return n.length===r.length?e.mode===`range`&&t.mode===`range`?fe(e.start,t.start)&&fe(e.end,t.end):n.every((e,t)=>p(e,r[t])===0):!1}function me(e,t){return E(e).some(e=>m(e,t))}function he(e,t){return e.mode!==`range`||e.start===null||e.end===null||p(e.start,e.end)>=0?null:m(e.start,t)?`start`:m(e.end,t)?`end`:p(t,e.start)>0&&p(t,e.end)<0?`in-range`:null}function ge(e,t){return e.mode===`range`&&e.start!==null&&e.end===null&&m(e.start,t)?`start`:he(e,t)}function _e(e){return E(e).at(0)??null}const ve=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]),ye=/[]/g,be=/^(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)$/,xe=/^(M{1,2}|yyyy|yy)([/. -])(M{1,2}|yyyy|yy)$/,Se=/* @__PURE__ */ new Map;function Ce(e){return e.startsWith(`d`)?`day`:e.startsWith(`M`)?`month`:`year`}function we(e){let t=be.exec(e);if(!t)return null;let n=[t[1],t[3],t[4]],r=n.map(Ce);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 Te(e){let t=xe.exec(e);if(!t)return null;let n=[t[1],t[3]],[r,i]=n.map(Ce);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 Ee(e){return e!==`yyyy`&&e!==`yy`?null:{order:[`month`,`day`,`year`],separator:`/`,padDay:!0,padMonth:!0,yearDigits:e===`yy`?2:4}}function De(e,t){let n=we(e);if(n!==null||t===`day`)return n;let r=Te(e);return r!==null||t===`month`?r:Ee(e)}function Oe(e,t=`day`){return e===`auto`||De(e.trim(),t)!==null}function ke(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 Ae(e){let t=ke(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(ye,``).trim());return{order:n.length===3?n:[`month`,`day`,`year`],separator:ve.has(r)?r:`/`,padDay:!0,padMonth:!0,yearDigits:4}}function je(e,t,n=`day`){let r=`${e}|${t}|${n}`,i=Se.get(r);if(i)return i;let a=(e===`auto`?null:De(e.trim(),n))??Ae(t);return Se.set(r,a),a}function Me(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`)}}const Ne={day:`dd`,month:`mm`,year:`yyyy`};function Pe(e){return{day:e.hintDay,month:e.hintMonth,year:e.hintYear}}function Fe(e,t=Ne){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 D(e,t){return t.order.map(n=>Me(e,n,t)).join(t.separator)}function O(){return typeof document<`u`}function k(){return typeof window>`u`}const Ie=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(` `)),Le=new Set(`AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY`.split(` `)),Re=/* @__PURE__ */ new Set([`MV`]),ze=/* @__PURE__ */ new Map,Be=/* @__PURE__ */ new Map;function Ve(e,t){let n=Be.get(t);if(n)return n.format(e);let r=new Intl.NumberFormat(t,{useGrouping:!1});return Be.set(t,r),r.format(e)}function A(e,t){let n=`${e}|${JSON.stringify(t)}`,r=ze.get(n);if(r)return r;let i=new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`});return ze.set(n,i),i}function j(e,t,n){let r=new Date(Date.UTC(2e3,0,1,12));return r.setUTCFullYear(e,t-1,n),r}function He(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 Ue(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`?He(r===7?0:r):null}function We(e){return e===void 0?1:Ie.has(e)?0:Le.has(e)?6:Re.has(e)?5:1}function Ge(e){try{let t=new Intl.Locale(e),n=Ue(t);return n===null?We(t.maximize().region):n}catch{return 1}}function Ke(e){try{return Intl.getCanonicalLocales(e).length>0}catch{return!1}}const M=e=>{let t=e?.trim();return!t||!Ke(t)?null:t};function qe(e){let t=M(e);if(t!==null)return t;if(O()){let e=M(document.documentElement.lang);if(e!==null)return e}if(typeof navigator<`u`){let e=M(navigator.language);if(e!==null)return e}return`en-US`}function Je(e,t){let n=A(e,{month:t});return Array.from({length:12},(e,t)=>n.format(j(2024,t+1,1)))}function Ye(e,t){let n=A(e,{weekday:t});return Array.from({length:7},(e,t)=>n.format(j(2024,1,7+t)))}function Xe(e,t){return A(t,{weekday:`short`,month:`short`,day:`numeric`}).format(j(e.year,e.month,e.day))}function Ze(e,t){return A(t,{month:`short`,day:`numeric`}).format(j(e.year,e.month,e.day))}function Qe(e,t,n){return A(n,{month:`short`,day:`numeric`}).formatRange(j(e.year,e.month,e.day),j(t.year,t.month,t.day))}function $e(e,t,n={}){let r={weekday:`long`,month:`long`,day:`numeric`};return A(t,n.year===!1?r:{...r,year:`numeric`}).format(j(e.year,e.month,e.day))}function N(e,t){return A(t,{month:`long`,year:`numeric`}).format(j(e.year,e.month,1))}function et(e,t,n){return e.year===t.year&&e.month===t.month?N(e,n):A(n,{month:`long`,year:`numeric`}).formatRange(j(e.year,e.month,1),j(t.year,t.month,1))}function tt(e,t,n,r){switch(t){case`day`:return r===`headline`?Xe(e,n):$e(e,n);case`month`:return N(e,n);default:return Ve(e.year,n)}}function nt(e,t){switch(t){case`sunday`:return 0;case`monday`:return 1;case`saturday`:return 6;default:return Ge(e)}}const rt=/[٠-٩۰-۹]/g,it=/[]/g,at=/^[]$/,ot=/[\s./-]+/,st=/^\d+$/,ct=/^\d{8}$/;function lt(e){let t=e.charCodeAt(0);return String(t-(t>=1776?1776:1632))}function ut(e){return e.replace(rt,lt)}function P(e){return e.replace(it,``).replace(rt,lt).trim()}function dt(e,t){if(ct.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(ot).filter(e=>e!==``);return n.length!==3||!n.every(e=>st.test(e))?null:n}function ft(e){let t=P(e).split(ot).filter(e=>e!==``);return t.every(e=>st.test(e))?t:null}function pt(e){if(e.length===4)return Number(e);if(e.length!==2)return null;let t=2e3+Number(e);return t<=x().year+20?t:1900+Number(e)}function mt(e,t){let n=dt(P(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=pt(t);else if(t.length>2)return null;else o===`day`?r=Number(t):i=Number(t)}return a===null?null:c(a,i,r)}const ht=/^(\d{4})-(\d{2})$/,gt=/^\d{4}$/;function _t(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 F(e,t){let n=f(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=d(e);if(n!==null||t===`day`)return n===null?null:_t(n,t);if(t===`month`){let t=ht.exec(e);return t?c(Number(t[1]),Number(t[2]),1):null}return gt.test(e)?c(Number(e),1,1):null}function I(e,t){return{...e,order:e.order.filter(e=>e===`year`||t===`month`&&e===`month`)}}function yt(e,t,n){return n===`day`?D(e,t):D(e,I(t,n))}function bt(e,t,n){return Fe(t===`day`?e:I(e,t),n)}function xt(e,t,n){if(n===`day`)return mt(e,t);let{order:r}=I(t,n),i=ft(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=pt(n);else if(n.length>2)return null;else a=Number(n)}return o===null?null:c(o,a,1)}function St(e,t){return e===null?null:typeof e==`string`?O()?t?.querySelector(e)??document.querySelector(e):null:e}function L(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 Ct(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 wt(e,t,n){let r=L(`button`,e,{type:`button`});return n?(r.setAttribute(`aria-label`,t),r.innerHTML=n):r.textContent=t,r}const Tt=`dp-ui--pointer`,Et=[`Shift`,`Control`,`Alt`,`Meta`];function Dt(){return k()||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Ot(e){return e?Dt()?`reduced`:`full`:`none`}function kt(e,t){e.textContent=``,e.textContent=t}function At(e){let t=e.ownerDocument,n=()=>{e.classList.add(Tt)},r=t=>{Et.includes(t.key)||e.classList.remove(Tt)};return e.addEventListener(`pointerdown`,n,!0),t.addEventListener(`keydown`,r,!0),()=>{e.removeEventListener(`pointerdown`,n,!0),t.removeEventListener(`keydown`,r,!0)}}const jt=`(prefers-color-scheme: dark)`,Mt=/^(rgba?|color|oklch|oklab|lab|lch)\(([^)]*)\)$/,Nt=/[\s,/]+/,Pt=[`class`,`style`,`data-theme`,`data-color-scheme`],R=e=>Math.min(1,Math.max(0,e)),z=e=>{let t=R(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},Ft=(e,t,n)=>.2126*z(e)+.7152*z(t)+.0722*z(n),B=(e,t)=>{if(e===`none`)return 0;let n=parseFloat(e);return e.endsWith(`%`)?n/100*t:n},It=(e,t)=>{let n=+(e===`color`);if(e===`color`&&t[0]!==`srgb`)return null;let r=B(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=>B(t[n+e]??``,r)/r);return Ft(i,a,o)}case`oklab`:case`oklch`:return R(r)**3;default:return R((r+16)/116)**3}};function Lt(e){let t=e.trim().toLowerCase();if(t===`transparent`)return{luminance:0,alpha:0};let n=Mt.exec(t),r=n?.[1],i=n?.[2];if(r===void 0||i===void 0)return null;let a=i.split(Nt).filter(e=>e!==``),o=r===`color`?4:3,s=a.length>o?B(a[o],1):1,c=It(r,a);return c===null||Number.isNaN(c)||Number.isNaN(s)?null:{luminance:c,alpha:R(s)}}const Rt=()=>{let e=getComputedStyle(document.documentElement).getPropertyValue(`color-scheme`);return e.includes(`dark`)?e.includes(`light`)?window.matchMedia(jt).matches?`dark`:`light`:`dark`:`light`};function zt(e){if(k()||!O())return`light`;let t=e;for(;t!==null;){let e=Lt(getComputedStyle(t).backgroundColor);if(e!==null&&e.alpha>=.5)return e.luminance<.179?`dark`:`light`;t=t.parentElement}return Rt()}function Bt(e){if(k()||!O())return()=>void 0;let t=()=>{e()},n=new MutationObserver(t),r={attributes:!0,attributeFilter:Pt};n.observe(document.documentElement,r),n.observe(document.body,r);let i=window.matchMedia(jt);return i.addEventListener(`change`,t),()=>{n.disconnect(),i.removeEventListener(`change`,t)}}const V={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},H={DRAG_START_PX:6,COMMIT_FRACTION:.25,FLICK_VELOCITY:.4,VELOCITY_SAMPLES:5,MIN_SAMPLE_SPAN_MS:1},Vt={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)`},Ht=` – `,Ut=/\s*[–—]\s*|\s+-\s+/,Wt=/[,;]/;function Gt(e){let t=e.split(Ut);if(t.length!==2)return null;let[n,r]=t;return[n,r]}function Kt(e,t,n){return E(e).map(e=>yt(e,t,n)).join(e.mode===`range`?Ht:`, `)}function qt(e,t){let n=[];for(let r of e){let e=t(r);if(e===null)return null;n.push(e)}return n}function Jt(e){if(e?.length!==2)return null;let[t,n]=e;return p(t,n)>0?null:{mode:`range`,start:t,end:n}}function Yt(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:Jt(qt(t,n))}default:{let r=qt(e.split(i).filter(e=>e.trim()!==``),n);return r===null?null:{mode:t,dates:le(r)}}}}function Xt(e,t,n,r){let i=e.trim();return i===``?T(t):Yt(i,t,e=>xt(e.trim(),n,r),Gt,Wt)}function Zt(e,t){return e.mode===`range`?e.start===null||e.end===null?``:`${F(e.start,t)}/${F(e.end,t)}`:E(e).map(e=>F(e,t)).join(`,`)}function Qt(e,t,n){let r=e.trim();return r===``?T(t):Yt(r,t,e=>vt(e.trim(),n),e=>e.split(`/`),/,/)}function $t(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)}const U={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>`},en=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`)}}},tn=(e,t)=>`dp-ui-${e.replace(/[^\w-]/g,`-`)}-${t}`,nn=(e,t,n)=>{n!==void 0&&(e.setAttribute(`title`,`${t} (${n.display})`),e.setAttribute(`aria-keyshortcuts`,n.keys))},rn=(e,t)=>{let n=L(`span`);n.innerHTML=e;let r=n.firstElementChild;return r===null?null:(r.setAttribute(`class`,t),r.setAttribute(`aria-hidden`,`true`),r)},an=(e,t,n,r)=>{let i=wt(`dp-ui__icon-button dp-ui__icon-button--${e}`,t,n);return i.firstElementChild?.setAttribute(`aria-hidden`,`true`),nn(i,t,r),i},on=(e,t,n)=>{let r=L(`button`,`dp-ui__menu-button dp-ui__menu-button--${e}`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":`false`,"aria-controls":n.controls});nn(r,n.name,n.shortcut);let i=L(`span`,`dp-ui__menu-button-label`);r.append(i);let a=rn(U.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}},sn=(e,t)=>wt(`dp-ui__text-button dp-ui__text-button--${e}`,t),cn=(e,t)=>{let n=an(`switch-view`,e.switchToInput,U.pencil);return{button:n,setInputView:r=>{n.innerHTML=r?U.calendar:U.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)}}},ln=/^\d$/,un=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]);function dn(e,t){return e===`year`?t.yearDigits:2}function W(e,t){let{order:n}=t,r=n.map(e=>dn(e,t)),i=[``],a=0;for(let t=0;t<e.length;t++){let o=e.charAt(t);if(at.test(o))continue;let s=ut(o),c=i.length-1,l=r[c]??0,u=i[c]??``,d=i.length===n.length;if(ln.test(s)){if(u.length>=l){if(d)break;i.push(s)}else i[c]=u+s;a=t+1}else if(un.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 fn(e,t){return W(e,t).groups.filter(e=>e!==``).join(t.separator)}function pn(e,t){return W(e,t).end}function mn(e,t){let{groups:n}=W(e,t),r=t.order.at(-1),i=n.at(-1);return r===void 0||i===void 0||n.length!==t.order.length?!1:i.length===dn(r,t)}function hn(e,t){let n=fn(e.value,t);n!==e.value&&(e.value=n,e.setSelectionRange(n.length,n.length))}const G=`dp-ui__pager--dragging`,gn=e=>e instanceof Element&&e.closest(`button`)!==null,_n=(e,t)=>{e.push(t),e.length>H.VELOCITY_SAMPLES&&e.shift()},vn=e=>{let t=e.at(0),n=e.at(-1);return!t||!n?0:(n.x-t.x)/Math.max(H.MIN_SAMPLE_SPAN_MS,n.t-t.t)},yn=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},bn=(e,t)=>{e.hasPointerCapture(t)&&e.releasePointerCapture(t)},xn=(e,t,n)=>{let r=null,i=null,a=t=>{t.controller.abort(),r===t&&(r=null),t.dragging&&(e.classList.remove(G),bn(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(),yn(e,t.pointerId),e.classList.add(G)},c=(e,t)=>{if(t.pointerId!==e.pointerId)return;let r=t.clientX-e.startX;if(!e.dragging){if(Math.abs(r)<=H.DRAG_START_PX)return;s(e)}e.lastX=t.clientX,_n(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(),_n(e.samples,{x:e.lastX,t:t.timeStamp}),n.onRelease({dx:e.lastX-e.startX,velocity:vn(e.samples),width:e.width}))))};e.addEventListener(`pointerdown`,t=>{if(t.button!==0||!t.isPrimary||gn(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}}},Sn=(e,t)=>e.year===t.year&&e.month===t.month,Cn=(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}}},wn=(e,t,n)=>{if(t<-H.FLICK_VELOCITY)return 1;if(t>H.FLICK_VELOCITY)return-1;let r=n*H.COMMIT_FRACTION;return e<-r?1:e>r?-1:0},Tn=(e,t,n,r)=>{let i=wn(e,t,n);return!r||i===0?i:i===1?-1:1},En=(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:V.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=Ot(t);if(r===s||u===`none`||!i()){l();return}if(u===`reduced`){l(),c();return}let d=e.animate([{transform:r},{transform:s}],{duration:V.PAGER_SETTLE,easing:Vt.EMPHASIZED,fill:`forwards`}),f={animation:d,complete:l};n=f,d.finished.then(()=>{n===f&&o()},()=>void 0)},finish:o,cancel:s}},Dn=(e,t)=>Math.min(t,Math.max(-t,e)),On=(e,t)=>e.deltaMode===0?e.deltaX:Math.sign(e.deltaX)*t,kn=(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-=On(e,t),n.onMove(Dn(i,t),t),r=setTimeout(a,V.WHEEL_SETTLE)},{passive:!1,signal:t}),{cancel:()=>{r!==null&&clearTimeout(r),r=null,i=0}}},An=`dp-ui__pager--swipe`,jn=`--dp-ui-pager-height`;var Mn=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=L(`div`,`dp-ui__pager-track`),this.strip=Cn(this.track,e=>t.renderPage(e),(e,n)=>t.step(e,n),(e,n)=>t.isSame(e,n)),this.animator=En(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(jn),this.viewport.classList.remove(An,G),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(An),this.drag=xn(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(Tn(e,t,n,this.options.rtl),`drag`)},onAbort:()=>{this.settle()}}),this.wheel=kn(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(Tn(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(jn,`${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}};const K=`--dp-ui-scrollbar-gap`,Nn=[`auto`,`scroll`];let q=0,J=[],Y=``;const Pn=e=>Nn.includes(window.getComputedStyle(e).overflowY);function Fn(e){let{style:t}=e,n=e.clientWidth,r=parseFloat(window.getComputedStyle(e).paddingRight)||0;J.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 In(){if(q===0){let{body:e,documentElement:t}=document,n=Pn(e)?Fn(e):0,r=Fn(t);Y=t.style.getPropertyValue(K),t.style.setProperty(K,`${String(Math.max(n,r))}px`)}q+=1}function Ln(){if(q===0||(--q,q>0))return;J.forEach(({element:e,overflow:t,paddingRight:n})=>{e.style.overflow=t,e.style.paddingRight=n});let e=document.documentElement;Y?e.style.setProperty(K,Y):e.style.removeProperty(K),J=[],Y=``}function Rn(){if(!O())return()=>void 0;In();let e=!1;return()=>{e||(e=!0,Ln())}}const zn=e=>{let t=getComputedStyle(e).getPropertyValue(`--dp-ui-motion-surface-exit`).trim();return t.endsWith(`ms`)&&parseFloat(t)===0};function X(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 Z(e){if(zn(e))return Promise.resolve();if(typeof e.getAnimations!=`function`)return new Promise(e=>{setTimeout(e,V.SURFACE_EXIT)});let t=e.getAnimations({subtree:!0});return Promise.allSettled(t.map(e=>e.finished)).then(()=>void 0)}var Bn=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=L(`dialog`,`dp-ui__dialog`),X(this.dialog,e.label,e.labelledBy),this.body=L(`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=Rn()),this.dialog.showModal()),this.openPromise}close(){return this.closePromise||=(this.dialog.open&&this.dialog.close(),Z(this.dialog).then(()=>{this.unlock()})),this.closePromise}destroy(){this.destroyed||(this.destroyed=!0,this.controller.abort(),this.unlock(),this.dialog.remove())}setLabel(e,t){X(this.dialog,e,t)}unlock(){this.releaseScroll?.(),this.releaseScroll=null}},Vn=class{root;body;constructor(e){this.root=L(`div`,`dp-ui__container dp-ui__container--inline`,{role:`group`}),X(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){X(this.root,e,t)}};const Q=`anchor-name`,Hn=e=>typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`position-try-fallbacks`,`flip-block`)&&typeof e.showPopover==`function`,Un=e=>`--dp-ui-anchor-${e.replace(/[^\w-]/g,`-`)}`,Wn=(e,t,n)=>{let{style:r}=t,i=r.getPropertyValue(Q);return r.setProperty(Q,n),e.style.setProperty(`--dp-ui-anchor-name`,n),e.setAttribute(`data-positioning`,`anchor`),()=>{i?r.setProperty(Q,i):r.removeProperty(Q)}},Gn=e=>{let{left:t,right:n}=e.getBoundingClientRect(),r=e.ownerDocument.documentElement.clientWidth;return t<-.5||n>r+.5},Kn=(e,t)=>{let n=e.getBoundingClientRect().top<t.getBoundingClientRect().top;e.setAttribute(`data-placement`,n?`top`:`bottom`)},qn=(e,t)=>Math.round(e*t)/t;function Jn({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=qn(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,ee=S?`top`:`bottom`,C=S?v:y,w=n>C?Math.max(C,0):null,te=w??n,ne=S?e.top-u-te:e.bottom+u,re=c?e.right-g:e.left,ie=Math.max(Math.min(re,m+a.width-g-p),m+p);return{top:qn(Math.max(ne,_),l),left:qn(ie,l),width:g,placement:ee,availableHeight:w}}const Yn=`--dp-ui-popover-top`,Xn=`--dp-ui-popover-left`,Zn=`--dp-ui-popover-available-height`,$=(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},Qn=e=>{let t=L(`div`);t.style.cssText=`position:absolute;visibility:hidden;pointer-events:none`,e.appendChild(t);let n={gap:$(t,`popover-gap`,4),edgeMargin:$(t,`popover-edge-margin`,4),minHeight:$(t,`popover-min-height`,160)};return t.remove(),n},$n=(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(${Yn})`),t.setProperty(`left`,`var(${Xn})`),e.setAttribute(`data-positioning`,`fallback`)},layout:()=>{r??=Qn(e);let i=e.ownerDocument.documentElement;e.style.removeProperty(Zn);let a=t.getBoundingClientRect(),o=e.offsetWidth,{top:s,left:c,placement:l,availableHeight:u}=Jn({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(Yn,`${String(s)}px`),e.style.setProperty(Xn,`${String(c)}px`),u!==null&&e.style.setProperty(Zn,`${String(u)}px`),e.setAttribute(`data-placement`,l)}}},er=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})},tr=(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 nr=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=Un(e.instanceId),this.root=L(`div`,`dp-ui__container dp-ui__container--docked`,{role:`dialog`,"aria-modal":`false`,"data-placement":`bottom`}),X(this.root,e.label,e.labelledBy),this.body=this.root,this.fallback=$n(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;er({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=tr(this.root,this.anchor,()=>{this.update()})),this.openPromise}close(){return this.closePromise||=(this.endTracking(),this.hide(),Z(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){X(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}Hn(this.root)?(this.restoreAnchor=Wn(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&&Gn(this.root)&&this.enableFallback(),this.anchored?Kn(this.root,this.anchor):this.fallback.layout()}};const rr=`dp-ui__container`,ir=/\s+/,ar=/* @__PURE__ */ new WeakMap;function or(e){return e.split(ir).filter(e=>e!==``)}function sr(e,t){e.setAttribute(`data-theme`,t.theme),e.setAttribute(`data-color-scheme`,t.colorScheme),e.classList.remove(...ar.get(e)??[]);let n=or(t.className??``);e.classList.add(...n),ar.set(e,n),(e.classList.contains(rr)?e:e.querySelector(`.${rr}`))?.classList.toggle(`dp-ui__container--rtl`,t.rtl??!1)}export{Je as $,Bt as A,p as At,vt as B,f as Bt,Qt as C,ie as Ct,H as D,te as Dt,Vt as E,re as Et,L as F,d as Ft,$e as G,F as H,x as Ht,St as I,m as It,Ve as J,et as K,Ct as L,ee as Lt,Ot as M,b as Mt,Dt as N,g as Nt,V as O,h as Ot,At as P,y as Pt,Ke as Q,yt as R,v as Rt,Xt as S,ae as St,Gt as T,ce as Tt,P as U,e as Ut,bt as V,S as Vt,mt as W,Ze as X,tt as Y,Qe as Z,en as _,E as _t,Z as a,Fe as at,Ht as b,ne as bt,mn as c,je as ct,hn as d,de as dt,qe as et,an as f,me as ft,tn as g,pe as gt,sn as h,he as ht,Bn as i,D as it,kt as j,c as jt,zt as k,_ as kt,pn as l,_e as lt,cn as m,ge as mt,nr as n,Ye as nt,Mn as o,Pe as ot,on as p,ue as pt,N as q,Vn as r,O as rt,Sn as s,Oe as st,sr as t,nt as tt,fn as u,T as ut,U as v,le as vt,Zt as w,w as wt,Kt as x,se as xt,$t as y,oe as yt,_t as z,u as zt};
|
|
@@ -0,0 +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 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()}}});
|
package/dist/umd/kit.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.DatepickerUIKit={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(){return typeof document<`u`}function n(){return typeof window>`u`}let r=`--dp-ui-scrollbar-gap`,i=[`auto`,`scroll`],a=0,o=[],s=``,c=e=>i.includes(window.getComputedStyle(e).overflowY);function l(e){let{style:t}=e,n=e.clientWidth,r=parseFloat(window.getComputedStyle(e).paddingRight)||0;o.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 u(){if(a===0){let{body:e,documentElement:t}=document,n=c(e)?l(e):0,i=l(t);s=t.style.getPropertyValue(r),t.style.setProperty(r,`${String(Math.max(n,i))}px`)}a+=1}function d(){if(a===0||(--a,a>0))return;o.forEach(({element:e,overflow:t,paddingRight:n})=>{e.style.overflow=t,e.style.paddingRight=n});let e=document.documentElement;s?e.style.setProperty(r,s):e.style.removeProperty(r),o=[],s=``}function f(){if(!t())return()=>void 0;u();let e=!1;return()=>{e||(e=!0,d())}}function p(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 m(e,t,n){let r=p(`button`,e,{type:`button`});return n?(r.setAttribute(`aria-label`,t),r.innerHTML=n):r.textContent=t,r}let h={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},g={DRAG_START_PX:6,COMMIT_FRACTION:.25,FLICK_VELOCITY:.4,VELOCITY_SAMPLES:5,MIN_SAMPLE_SPAN_MS:1},_={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)`},v=e=>{let t=getComputedStyle(e).getPropertyValue(`--dp-ui-motion-surface-exit`).trim();return t.endsWith(`ms`)&&parseFloat(t)===0};function y(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 b(e){if(v(e))return Promise.resolve();if(typeof e.getAnimations!=`function`)return new Promise(e=>{setTimeout(e,h.SURFACE_EXIT)});let t=e.getAnimations({subtree:!0});return Promise.allSettled(t.map(e=>e.finished)).then(()=>void 0)}var x=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=p(`dialog`,`dp-ui__dialog`),y(this.dialog,e.label,e.labelledBy),this.body=p(`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=f()),this.dialog.showModal()),this.openPromise}close(){return this.closePromise||=(this.dialog.open&&this.dialog.close(),b(this.dialog).then(()=>{this.unlock()})),this.closePromise}destroy(){this.destroyed||(this.destroyed=!0,this.controller.abort(),this.unlock(),this.dialog.remove())}setLabel(e,t){y(this.dialog,e,t)}unlock(){this.releaseScroll?.(),this.releaseScroll=null}},S=class{root;body;constructor(e){this.root=p(`div`,`dp-ui__container dp-ui__container--inline`,{role:`group`}),y(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){y(this.root,e,t)}};let C=`anchor-name`,w=e=>typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`position-try-fallbacks`,`flip-block`)&&typeof e.showPopover==`function`,T=e=>`--dp-ui-anchor-${e.replace(/[^\w-]/g,`-`)}`,E=(e,t,n)=>{let{style:r}=t,i=r.getPropertyValue(C);return r.setProperty(C,n),e.style.setProperty(`--dp-ui-anchor-name`,n),e.setAttribute(`data-positioning`,`anchor`),()=>{i?r.setProperty(C,i):r.removeProperty(C)}},D=e=>{let{left:t,right:n}=e.getBoundingClientRect(),r=e.ownerDocument.documentElement.clientWidth;return t<-.5||n>r+.5},O=(e,t)=>{let n=e.getBoundingClientRect().top<t.getBoundingClientRect().top;e.setAttribute(`data-placement`,n?`top`:`bottom`)},k=(e,t)=>Math.round(e*t)/t;function A({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=k(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,E=T??n,D=S?e.top-u-E:e.bottom+u,O=c?e.right-g:e.left,A=Math.max(Math.min(O,m+a.width-g-p),m+p);return{top:k(Math.max(D,_),l),left:k(A,l),width:g,placement:C,availableHeight:T}}let j=`--dp-ui-popover-top`,M=`--dp-ui-popover-left`,N=`--dp-ui-popover-available-height`,P=(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},ee=e=>{let t=p(`div`);t.style.cssText=`position:absolute;visibility:hidden;pointer-events:none`,e.appendChild(t);let n={gap:P(t,`popover-gap`,4),edgeMargin:P(t,`popover-edge-margin`,4),minHeight:P(t,`popover-min-height`,160)};return t.remove(),n},te=(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(${j})`),t.setProperty(`left`,`var(${M})`),e.setAttribute(`data-positioning`,`fallback`)},layout:()=>{r??=ee(e);let i=e.ownerDocument.documentElement;e.style.removeProperty(N);let a=t.getBoundingClientRect(),o=e.offsetWidth,{top:s,left:c,placement:l,availableHeight:u}=A({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(j,`${String(s)}px`),e.style.setProperty(M,`${String(c)}px`),u!==null&&e.style.setProperty(N,`${String(u)}px`),e.setAttribute(`data-placement`,l)}}},ne=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})},re=(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 ie=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=T(e.instanceId),this.root=p(`div`,`dp-ui__container dp-ui__container--docked`,{role:`dialog`,"aria-modal":`false`,"data-placement":`bottom`}),y(this.root,e.label,e.labelledBy),this.body=this.root,this.fallback=te(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;ne({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=re(this.root,this.anchor,()=>{this.update()})),this.openPromise}close(){return this.closePromise||=(this.endTracking(),this.hide(),b(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){y(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}w(this.root)?(this.restoreAnchor=E(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&&D(this.root)&&this.enableFallback(),this.anchored?O(this.root,this.anchor):this.fallback.layout()}};let ae=(e,t)=>m(`dp-ui__text-button dp-ui__text-button--${e}`,t),F=`dp-ui__pager--dragging`,oe=e=>e instanceof Element&&e.closest(`button`)!==null,I=(e,t)=>{e.push(t),e.length>g.VELOCITY_SAMPLES&&e.shift()},se=e=>{let t=e.at(0),n=e.at(-1);return!t||!n?0:(n.x-t.x)/Math.max(g.MIN_SAMPLE_SPAN_MS,n.t-t.t)},ce=(e,t)=>{try{e.setPointerCapture(t)}catch{return}},le=(e,t)=>{e.hasPointerCapture(t)&&e.releasePointerCapture(t)},ue=(e,t,n)=>{let r=null,i=null,a=t=>{t.controller.abort(),r===t&&(r=null),t.dragging&&(e.classList.remove(F),le(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(),ce(e,t.pointerId),e.classList.add(F)},c=(e,t)=>{if(t.pointerId!==e.pointerId)return;let r=t.clientX-e.startX;if(!e.dragging){if(Math.abs(r)<=g.DRAG_START_PX)return;s(e)}e.lastX=t.clientX,I(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(),I(e.samples,{x:e.lastX,t:t.timeStamp}),n.onRelease({dx:e.lastX-e.startX,velocity:se(e.samples),width:e.width}))))};e.addEventListener(`pointerdown`,t=>{if(t.button!==0||!t.isPrimary||oe(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}}},de=(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}}},fe=(e,t,n)=>{if(t<-g.FLICK_VELOCITY)return 1;if(t>g.FLICK_VELOCITY)return-1;let r=n*g.COMMIT_FRACTION;return e<-r?1:e>r?-1:0},L=(e,t,n,r)=>{let i=fe(e,t,n);return!r||i===0?i:i===1?-1:1};function pe(){return n()||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function me(e){return e?pe()?`reduced`:`full`:`none`}let he=(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:h.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=me(t);if(r===s||u===`none`||!i()){l();return}if(u===`reduced`){l(),c();return}let d=e.animate([{transform:r},{transform:s}],{duration:h.PAGER_SETTLE,easing:_.EMPHASIZED,fill:`forwards`}),f={animation:d,complete:l};n=f,d.finished.then(()=>{n===f&&o()},()=>void 0)},finish:o,cancel:s}},ge=(e,t)=>Math.min(t,Math.max(-t,e)),_e=(e,t)=>e.deltaMode===0?e.deltaX:Math.sign(e.deltaX)*t,ve=(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-=_e(e,t),n.onMove(ge(i,t),t),r=setTimeout(a,h.WHEEL_SETTLE)},{passive:!1,signal:t}),{cancel:()=>{r!==null&&clearTimeout(r),r=null,i=0}}},R=`dp-ui__pager--swipe`,z=`--dp-ui-pager-height`;var ye=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=p(`div`,`dp-ui__pager-track`),this.strip=de(this.track,e=>t.renderPage(e),(e,n)=>t.step(e,n),(e,n)=>t.isSame(e,n)),this.animator=he(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(z),this.viewport.classList.remove(R,F),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(R),this.drag=ue(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(L(e,t,n,this.options.rtl),`drag`)},onAbort:()=>{this.settle()}}),this.wheel=ve(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(L(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(z,`${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 be=(e,t,n,r)=>t?`inline`:e===`auto`?n<600||r<480?`modal`:`docked`:e,xe=(e,t,n,r)=>e===`range`&&t===`modal`&&n<r;function Se(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 B=`(prefers-color-scheme: dark)`,Ce=/^(rgba?|color|oklch|oklab|lab|lch)\(([^)]*)\)$/,we=/[\s,/]+/,Te=[`class`,`style`,`data-theme`,`data-color-scheme`],V=e=>Math.min(1,Math.max(0,e)),H=e=>{let t=V(e);return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},Ee=(e,t,n)=>.2126*H(e)+.7152*H(t)+.0722*H(n),U=(e,t)=>{if(e===`none`)return 0;let n=parseFloat(e);return e.endsWith(`%`)?n/100*t:n},De=(e,t)=>{let n=+(e===`color`);if(e===`color`&&t[0]!==`srgb`)return null;let r=U(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=>U(t[n+e]??``,r)/r);return Ee(i,a,o)}case`oklab`:case`oklch`:return V(r)**3;default:return V((r+16)/116)**3}};function Oe(e){let t=e.trim().toLowerCase();if(t===`transparent`)return{luminance:0,alpha:0};let n=Ce.exec(t),r=n?.[1],i=n?.[2];if(r===void 0||i===void 0)return null;let a=i.split(we).filter(e=>e!==``),o=r===`color`?4:3,s=a.length>o?U(a[o],1):1,c=De(r,a);return c===null||Number.isNaN(c)||Number.isNaN(s)?null:{luminance:c,alpha:V(s)}}let ke=()=>{let e=getComputedStyle(document.documentElement).getPropertyValue(`color-scheme`);return e.includes(`dark`)?e.includes(`light`)?window.matchMedia(B).matches?`dark`:`light`:`dark`:`light`};function Ae(e){if(n()||!t())return`light`;let r=e;for(;r!==null;){let e=Oe(getComputedStyle(r).backgroundColor);if(e!==null&&e.alpha>=.5)return e.luminance<.179?`dark`:`light`;r=r.parentElement}return ke()}function je(e){if(n()||!t())return()=>void 0;let r=()=>{e()},i=new MutationObserver(r),a={attributes:!0,attributeFilter:Te};i.observe(document.documentElement,a),i.observe(document.body,a);let o=window.matchMedia(B);return o.addEventListener(`change`,r),()=>{i.disconnect(),o.removeEventListener(`change`,r)}}let W=`dp-ui__container`,Me=/\s+/,G=/* @__PURE__ */ new WeakMap;function Ne(e){return e.split(Me).filter(e=>e!==``)}function Pe(e,t){e.setAttribute(`data-theme`,t.theme),e.setAttribute(`data-color-scheme`,t.colorScheme),e.classList.remove(...G.get(e)??[]);let n=Ne(t.className??``);e.classList.add(...n),G.set(e,n),(e.classList.contains(W)?e:e.querySelector(`.${W}`))?.classList.toggle(`dp-ui__container--rtl`,t.rtl??!1)}let Fe=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]),Ie=/[]/g,Le=/^(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)$/,Re=/^(M{1,2}|yyyy|yy)([/. -])(M{1,2}|yyyy|yy)$/,K=/* @__PURE__ */ new Map;function q(e){return e.startsWith(`d`)?`day`:e.startsWith(`M`)?`month`:`year`}function ze(e){let t=Le.exec(e);if(!t)return null;let n=[t[1],t[3],t[4]],r=n.map(q);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=Re.exec(e);if(!t)return null;let n=[t[1],t[3]],[r,i]=n.map(q);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 He(e,t){let n=ze(e);if(n!==null||t===`day`)return n;let r=Be(e);return r!==null||t===`month`?r:Ve(e)}function Ue(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 We(e){let t=Ue(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(Ie,``).trim());return{order:n.length===3?n:[`month`,`day`,`year`],separator:Fe.has(r)?r:`/`,padDay:!0,padMonth:!0,yearDigits:4}}function Ge(e,t,n=`day`){let r=`${e}|${t}|${n}`,i=K.get(r);if(i)return i;let a=(e===`auto`?null:He(e.trim(),n))??We(t);return K.set(r,a),a}function Ke(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 qe={day:`dd`,month:`mm`,year:`yyyy`};function Je(e,t=qe){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 Ye(e,t){return t.order.map(n=>Ke(e,n,t)).join(t.separator)}let Xe=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(` `)),Ze=new Set(`AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY`.split(` `)),Qe=/* @__PURE__ */ new Set([`MV`]),J=/* @__PURE__ */ new Map;function Y(e,t){let n=`${e}|${JSON.stringify(t)}`,r=J.get(n);if(r)return r;let i=new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`});return J.set(n,i),i}function X(e,t,n){let r=new Date(Date.UTC(2e3,0,1,12));return r.setUTCFullYear(e,t-1,n),r}function $e(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 et(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`?$e(r===7?0:r):null}function tt(e){return e===void 0?1:Xe.has(e)?0:Ze.has(e)?6:Qe.has(e)?5:1}function nt(e){try{let t=new Intl.Locale(e),n=et(t);return n===null?tt(t.maximize().region):n}catch{return 1}}function rt(e,t){let n=Y(e,{weekday:t});return Array.from({length:7},(e,t)=>n.format(X(2024,1,7+t)))}function it(e,t,n={}){let r={weekday:`long`,month:`long`,day:`numeric`};return Y(t,n.year===!1?r:{...r,year:`numeric`}).format(X(e.year,e.month,e.day))}function at(e,t){return Y(t,{month:`long`,year:`numeric`}).format(X(e.year,e.month,1))}function ot(e,t){switch(t){case`sunday`:return 0;case`monday`:return 1;case`saturday`:return 6;default:return nt(e)}}function st(e){return e%4==0&&e%100!=0||e%400==0}function ct(e,t){return t===2?st(e)?29:28:t===4||t===6||t===9||t===11?30:31}function lt(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<=ct(e,t)}function ut(e,t,n){return lt(e,t,n)?{year:e,month:t,day:n}:null}function dt(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function ft(){return dt(/* @__PURE__ */ new Date)}let Z=/[٠-٩۰-۹]/g,pt=/[]/g,mt=/^[]$/,ht=/[\s./-]+/,gt=/^\d+$/,_t=/^\d{8}$/;function vt(e){let t=e.charCodeAt(0);return String(t-(t>=1776?1776:1632))}function yt(e){return e.replace(Z,vt)}function bt(e){return e.replace(pt,``).replace(Z,vt).trim()}function xt(e,t){if(_t.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(ht).filter(e=>e!==``);return n.length!==3||!n.every(e=>gt.test(e))?null:n}function St(e){if(e.length===4)return Number(e);if(e.length!==2)return null;let t=2e3+Number(e);return t<=ft().year+20?t:1900+Number(e)}function Ct(e,t){let n=xt(bt(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=St(t);else if(t.length>2)return null;else o===`day`?r=Number(t):i=Number(t)}return a===null?null:ut(a,i,r)}let wt=/^\d$/,Tt=/* @__PURE__ */ new Set([`/`,`.`,`-`,` `]);function Q(e,t){return e===`year`?t.yearDigits:2}function $(e,t){let{order:n}=t,r=n.map(e=>Q(e,t)),i=[``],a=0;for(let t=0;t<e.length;t++){let o=e.charAt(t);if(mt.test(o))continue;let s=yt(o),c=i.length-1,l=r[c]??0,u=i[c]??``,d=i.length===n.length;if(wt.test(s)){if(u.length>=l){if(d)break;i.push(s)}else i[c]=u+s;a=t+1}else if(Tt.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 Et(e,t){return $(e,t).groups.filter(e=>e!==``).join(t.separator)}function Dt(e,t){return $(e,t).end}function Ot(e,t){let{groups:n}=$(e,t),r=t.order.at(-1),i=n.at(-1);return r===void 0||i===void 0||n.length!==t.order.length?!1:i.length===Q(r,t)}let kt=/\s*[–—]\s*|\s+-\s+/;function At(e){let t=e.split(kt);if(t.length!==2)return null;let[n,r]=t;return[n,r]}e.DialogHost=x,e.InlineHost=S,e.Pager=ye,e.PopoverHost=ie,e.RANGE_SEPARATOR=` – `,e.applyTheme=Pe,e.createTextButton=ae,e.detectColorScheme=Ae,e.fitsViewport=Se,e.formatDate=Ye,e.formatFullDate=it,e.formatHint=Je,e.formatMonthYear=at,e.isDateTextComplete=Ot,e.isFullscreenRange=xe,e.leadingDateLength=Dt,e.maskDateText=Et,e.normalizeDigits=bt,e.parseDate=Ct,e.resolvePattern=Ge,e.resolveSurfaceMode=be,e.resolveWeekStart=ot,e.splitRangeText=At,e.waitForExit=b,e.watchColorScheme=je,e.weekdayNames=rt});
|
package/package.json
CHANGED
|
@@ -1,28 +1,87 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pglejzer/datepicker-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "datepicker-ui is a customizable date selection library built with TypeScript, designed to work seamlessly alongside timepicker-ui. Based on Google's Material Design, lightweight, themeable, and framework agnostic.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cjs/index.cjs",
|
|
7
|
+
"module": "./dist/esm/index.js",
|
|
8
|
+
"types": "./dist/esm/index.d.ts",
|
|
9
|
+
"typesVersions": {
|
|
10
|
+
"*": {
|
|
11
|
+
"kit": [
|
|
12
|
+
"./dist/esm/kit.d.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"style": "./dist/css/index.css",
|
|
17
|
+
"unpkg": "./dist/umd/index.js",
|
|
18
|
+
"jsdelivr": "./dist/umd/index.js",
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"**/*.css"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/pglejzer/datepicker-ui.git"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/esm/index.d.ts",
|
|
35
|
+
"default": "./dist/esm/index.js"
|
|
36
|
+
},
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/cjs/index.d.cts",
|
|
39
|
+
"default": "./dist/cjs/index.cjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"./kit": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/esm/kit.d.ts",
|
|
45
|
+
"default": "./dist/esm/kit.js"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/cjs/kit.d.cts",
|
|
49
|
+
"default": "./dist/cjs/kit.cjs"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"./main.css": "./dist/css/main.css",
|
|
53
|
+
"./index.css": "./dist/css/index.css",
|
|
54
|
+
"./theme-crane.css": "./dist/css/themes/theme-crane.css",
|
|
55
|
+
"./theme-crane-straight.css": "./dist/css/themes/theme-crane-straight.css",
|
|
56
|
+
"./theme-m2.css": "./dist/css/themes/theme-m2.css",
|
|
57
|
+
"./theme-m3-green.css": "./dist/css/themes/theme-m3-green.css",
|
|
58
|
+
"./theme-glassmorphic.css": "./dist/css/themes/theme-glassmorphic.css",
|
|
59
|
+
"./theme-pastel.css": "./dist/css/themes/theme-pastel.css",
|
|
60
|
+
"./theme-ai.css": "./dist/css/themes/theme-ai.css",
|
|
61
|
+
"./theme-cyberpunk.css": "./dist/css/themes/theme-cyberpunk.css",
|
|
62
|
+
"./theme-blueprint.css": "./dist/css/themes/theme-blueprint.css",
|
|
63
|
+
"./package.json": "./package.json"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
67
|
+
},
|
|
7
68
|
"keywords": [
|
|
8
|
-
"angular",
|
|
9
|
-
"calendar",
|
|
10
|
-
"css",
|
|
11
|
-
"customizable",
|
|
12
|
-
"date-picker",
|
|
13
|
-
"date-selection",
|
|
14
|
-
"datepicker",
|
|
15
|
-
"design",
|
|
16
|
-
"javascript",
|
|
17
|
-
"lightweight",
|
|
18
69
|
"material-design",
|
|
19
70
|
"material",
|
|
20
|
-
"
|
|
21
|
-
"svelte",
|
|
22
|
-
"themeable",
|
|
23
|
-
"typescript",
|
|
71
|
+
"design",
|
|
24
72
|
"ui",
|
|
73
|
+
"css",
|
|
74
|
+
"javascript",
|
|
25
75
|
"vanillajs",
|
|
26
|
-
"
|
|
27
|
-
|
|
76
|
+
"typescript",
|
|
77
|
+
"date-picker",
|
|
78
|
+
"datepicker",
|
|
79
|
+
"calendar"
|
|
80
|
+
],
|
|
81
|
+
"author": "Piotr Glejzer (@pglejzer)",
|
|
82
|
+
"license": "MIT",
|
|
83
|
+
"bugs": {
|
|
84
|
+
"url": "https://github.com/pglejzer/datepicker-ui/issues"
|
|
85
|
+
},
|
|
86
|
+
"homepage": "https://github.com/pglejzer/datepicker-ui#readme"
|
|
28
87
|
}
|