@reachweb/alpine-calendar 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -160,6 +160,7 @@ All options are passed via `x-data="calendar({ ... })"`.
160
160
  | `display` | `'inline' \| 'popup'` | `'inline'` | Inline calendar or popup with input |
161
161
  | `format` | `string` | `'DD/MM/YYYY'` | Date format (tokens: `DD`, `MM`, `YYYY`, `D`, `M`, `YY`) |
162
162
  | `months` | `number` | `1` | Months to display (1=single, 2=dual side-by-side, 3+=scrollable) |
163
+ | `mobileMonths` | `number` | — | Months to show on mobile (<640px). Only used when `months` is `2`. |
163
164
  | `firstDay` | `0–6` | `1` | First day of week (0=Sun, 1=Mon, ...) |
164
165
  | `mask` | `boolean` | `true` | Enable input masking |
165
166
  | `value` | `string` | — | Initial value (ISO or formatted string) |
@@ -401,6 +402,9 @@ All classes use the `.rc-` prefix:
401
402
  | `.rc-month-grid` / `.rc-month` | Month picker |
402
403
  | `.rc-year-grid` / `.rc-year` | Year picker |
403
404
  | `.rc-months--dual` | Two-month side-by-side layout |
405
+ | `.rc-nav--dual-hidden` | Hidden nav arrow in dual-month layout (prev on 2nd month) |
406
+ | `.rc-nav--dual-next-first` | Next arrow on 1st month (hidden on desktop, visible on mobile) |
407
+ | `.rc-nav--dual-next-last` | Next arrow on 2nd month (visible on desktop, hidden on mobile) |
404
408
  | `.rc-popup-overlay` | Popup backdrop |
405
409
  | `.rc-popup-header` / `.rc-popup-header__close` | Popup close header bar |
406
410
  | `.rc-calendar--wizard` | Wizard mode container |
@@ -559,10 +563,21 @@ A sticky header tracks the currently visible month as you scroll. Default scroll
559
563
 
560
564
  - **Mobile (<640px):** Popup renders as a centered fullscreen overlay. Touch-friendly targets (min 44px).
561
565
  - **Desktop (>=640px):** Popup renders as a centered modal with scale-in animation.
562
- - **Two months:** Side-by-side on desktop, stacked on mobile.
566
+ - **Two months:** Side-by-side on desktop, stacked on mobile. Both nav arrows appear on the top month when stacked.
567
+ - **`mobileMonths`:** Show fewer months on mobile (e.g., `mobileMonths: 1` with `months: 2` displays a single month on narrow viewports).
563
568
  - **Scrollable (3+ months):** Smooth scroll with `-webkit-overflow-scrolling: touch`.
564
569
  - **`prefers-reduced-motion`:** All animations are disabled.
565
570
 
571
+ ### Mobile Months
572
+
573
+ When using `months: 2`, the calendar shows two months side-by-side on desktop and stacks them vertically on mobile. Set `mobileMonths: 1` to show only a single month on mobile instead:
574
+
575
+ ```html
576
+ <div x-data="calendar({ mode: 'range', months: 2, mobileMonths: 1 })"></div>
577
+ ```
578
+
579
+ The calendar listens for viewport changes at the 640px breakpoint and switches between the desktop and mobile month counts automatically. Selection is preserved across viewport changes.
580
+
566
581
  ## Accessibility
567
582
 
568
583
  The calendar targets WCAG 2.1 AA compliance:
@@ -1,2 +1,2 @@
1
- !function(){"use strict";class e{constructor(e,t,s){this.year=e,this.month=t,this.day=s}static today(t){const s=new Date;return t?e.fromNativeDate(s,t):new e(s.getFullYear(),s.getMonth()+1,s.getDate())}static fromNativeDate(t,s){if(s){const a=new Intl.DateTimeFormat("en-US",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(t);let i=0,n=0,r=0;for(const e of a)"year"===e.type?i=Number(e.value):"month"===e.type?n=Number(e.value):"day"===e.type&&(r=Number(e.value));return new e(i,n,r)}return new e(t.getFullYear(),t.getMonth()+1,t.getDate())}static fromISO(s){const a=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s);if(!a)return null;const i=Number(a[1]),n=Number(a[2]),r=Number(a[3]);return n<1||n>12||r<1||r>t(i,n)?null:new e(i,n,r)}toNativeDate(){return new Date(this.year,this.month-1,this.day)}toISO(){return`${String(this.year).padStart(4,"0")}-${String(this.month).padStart(2,"0")}-${String(this.day).padStart(2,"0")}`}toKey(){return this.toISO()}isSame(e){return this.year===e.year&&this.month===e.month&&this.day===e.day}isBefore(e){return this.year!==e.year?this.year<e.year:this.month!==e.month?this.month<e.month:this.day<e.day}isAfter(e){return this.year!==e.year?this.year>e.year:this.month!==e.month?this.month>e.month:this.day>e.day}isBetween(e,t){return!this.isBefore(e)&&!this.isAfter(t)}diffDays(e){const t=Date.UTC(this.year,this.month-1,this.day),s=Date.UTC(e.year,e.month-1,e.day);return Math.round((s-t)/864e5)}addDays(t){const s=this.toNativeDate();return s.setDate(s.getDate()+t),e.fromNativeDate(s)}addMonths(s){let a=this.month-1+s;const i=this.year+Math.floor(a/12);a=(a%12+12)%12;const n=t(i,a+1),r=Math.min(this.day,n);return new e(i,a+1,r)}addYears(s){const a=t(this.year+s,this.month),i=Math.min(this.day,a);return new e(this.year+s,this.month,i)}startOfMonth(){return new e(this.year,this.month,1)}endOfMonth(){return new e(this.year,this.month,t(this.year,this.month))}format(e,t){const s=this.toNativeDate();return new Intl.DateTimeFormat(t,e).format(s)}}function t(e,t){return new Date(e,t,0).getDate()}function s(e){const t=new Date(Date.UTC(e.year,e.month-1,e.day)),s=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-s);const a=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-a.getTime())/864e5+1)/7)}function a(e){return{disabledKeys:e.disabledDates?new Set(e.disabledDates.map(e=>e.toKey())):void 0,disabledDays:e.disabledDaysOfWeek?new Set(e.disabledDaysOfWeek):void 0,enabledKeys:e.enabledDates?new Set(e.enabledDates.map(e=>e.toKey())):void 0,enabledDays:e.enabledDaysOfWeek?new Set(e.enabledDaysOfWeek):void 0,disabledMonths:e.disabledMonths?new Set(e.disabledMonths):void 0,enabledMonths:e.enabledMonths?new Set(e.enabledMonths):void 0,disabledYears:e.disabledYears?new Set(e.disabledYears):void 0,enabledYears:e.enabledYears?new Set(e.enabledYears):void 0}}function i(e,t,s,a){if(t&&e.isBefore(t))return!0;if(s&&e.isAfter(s))return!0;if(a.enabledKeys&&a.enabledKeys.has(e.toKey()))return!1;if(a.enabledYears&&!a.enabledYears.has(e.year))return!0;if(a.disabledYears&&a.disabledYears.has(e.year))return!0;if(a.enabledMonths&&!a.enabledMonths.has(e.month))return!0;if(a.disabledMonths&&a.disabledMonths.has(e.month))return!0;const i=void 0!==a.enabledDays||void 0!==a.disabledDays?e.toNativeDate().getDay():-1;return!(!a.enabledDays||a.enabledDays.has(i))||(!(!a.disabledKeys||!a.disabledKeys.has(e.toKey()))||!(!a.disabledDays||!a.disabledDays.has(i)))}function n(e,t){return e.from&&e.to?t.isBetween(e.from,e.to):!!e.recurringMonths&&e.recurringMonths.has(t.month)}function r(e,t){let s;for(const a of e)n(a,t)&&(!s||a.priority>s.priority)&&(s=a);return s}function l(e){const{minDate:t,maxDate:s,rules:n}=e,l=a(e),o=null==n?void 0:n.map((e,t)=>({from:e.from,to:e.to,recurringMonths:e.months?new Set(e.months):void 0,minDate:e.minDate,maxDate:e.maxDate,minRange:e.minRange,maxRange:e.maxRange,sets:a(e),hasMinDate:void 0!==e.minDate,hasMaxDate:void 0!==e.maxDate,priority:e.priority??0,originalIndex:t}));return o&&0!==o.length?e=>{const a=r(o,e);if(!a)return i(e,t,s,l);return i(e,a.hasMinDate?a.minDate:t,a.hasMaxDate?a.maxDate:s,{disabledKeys:void 0!==a.sets.disabledKeys?a.sets.disabledKeys:l.disabledKeys,disabledDays:void 0!==a.sets.disabledDays?a.sets.disabledDays:l.disabledDays,enabledKeys:void 0!==a.sets.enabledKeys?a.sets.enabledKeys:l.enabledKeys,enabledDays:void 0!==a.sets.enabledDays?a.sets.enabledDays:l.enabledDays,disabledMonths:void 0!==a.sets.disabledMonths?a.sets.disabledMonths:l.disabledMonths,enabledMonths:void 0!==a.sets.enabledMonths?a.sets.enabledMonths:l.enabledMonths,disabledYears:void 0!==a.sets.disabledYears?a.sets.disabledYears:l.disabledYears,enabledYears:void 0!==a.sets.enabledYears?a.sets.enabledYears:l.enabledYears})}:e=>i(e,t,s,l)}function o(e){const{minRange:t,maxRange:s,rules:i}=e;if(void 0===t&&void 0===s&&(!i||i.every(e=>void 0===e.minRange&&void 0===e.maxRange)))return()=>!0;const n=null==i?void 0:i.map((e,t)=>({from:e.from,to:e.to,recurringMonths:e.months?new Set(e.months):void 0,minDate:e.minDate,maxDate:e.maxDate,minRange:e.minRange,maxRange:e.maxRange,sets:a(e),hasMinDate:void 0!==e.minDate,hasMaxDate:void 0!==e.maxDate,priority:e.priority??0,originalIndex:t}));return(e,a)=>{let i=t,l=s;if(n){const t=r(n,e);t&&(void 0!==t.minRange&&(i=t.minRange),void 0!==t.maxRange&&(l=t.maxRange))}const o=e.diffDays(a)+1;return!(void 0!==i&&o<i)&&!(void 0!==l&&o>l)}}function d(t){const{minDate:s,maxDate:a}=t,i=t.disabledMonths?new Set(t.disabledMonths):void 0,n=t.enabledMonths?new Set(t.enabledMonths):void 0,r=t.disabledYears?new Set(t.disabledYears):void 0,l=t.enabledYears?new Set(t.enabledYears):void 0;return(t,o)=>{if(s){if(new e(t,o,1).endOfMonth().isBefore(s))return!0}if(a){if(new e(t,o,1).isAfter(a))return!0}return!(!l||l.has(t))||(!(!r||!r.has(t))||(!(!n||n.has(o))||!(!i||!i.has(o))))}}function h(t){const{minDate:s,maxDate:a}=t,i=t.disabledYears?new Set(t.disabledYears):void 0,n=t.enabledYears?new Set(t.enabledYears):void 0;return t=>{if(s){if(new e(t,12,31).isBefore(s))return!0}if(a){if(new e(t,1,1).isAfter(a))return!0}return!(!n||n.has(t))||!(!i||!i.has(t))}}const c={beforeMinDate:"Before the earliest available date",afterMaxDate:"After the latest available date",disabledDate:"This date is not available",disabledDayOfWeek:"This day of the week is not available",disabledMonth:"This month is not available",disabledYear:"This year is not available",notEnabledDate:"This date is not available",notEnabledDayOfWeek:"This day of the week is not available",notEnabledMonth:"This month is not available",notEnabledYear:"This year is not available"};function u(e,t,s,a,i){const n=[];if(t&&e.isBefore(t))return n.push(i.beforeMinDate),n;if(s&&e.isAfter(s))return n.push(i.afterMaxDate),n;if(a.enabledKeys&&a.enabledKeys.has(e.toKey()))return n;if(a.enabledYears&&!a.enabledYears.has(e.year))return n.push(i.notEnabledYear),n;if(a.disabledYears&&a.disabledYears.has(e.year))return n.push(i.disabledYear),n;if(a.enabledMonths&&!a.enabledMonths.has(e.month))return n.push(i.notEnabledMonth),n;if(a.disabledMonths&&a.disabledMonths.has(e.month))return n.push(i.disabledMonth),n;const r=void 0!==a.enabledDays||void 0!==a.disabledDays?e.toNativeDate().getDay():-1;return a.enabledDays&&!a.enabledDays.has(r)&&n.push(i.notEnabledDayOfWeek),a.disabledKeys&&a.disabledKeys.has(e.toKey())&&n.push(i.disabledDate),a.disabledDays&&a.disabledDays.has(r)&&n.push(i.disabledDayOfWeek),n}function m(e,t){const{minDate:s,maxDate:i,rules:n}=e,l={...c,...t},o=a(e),d=null==n?void 0:n.map((e,t)=>({from:e.from,to:e.to,recurringMonths:e.months?new Set(e.months):void 0,minDate:e.minDate,maxDate:e.maxDate,minRange:e.minRange,maxRange:e.maxRange,sets:a(e),hasMinDate:void 0!==e.minDate,hasMaxDate:void 0!==e.maxDate,priority:e.priority??0,originalIndex:t}));return d&&0!==d.length?e=>{const t=r(d,e);if(!t)return u(e,s,i,o,l);return u(e,t.hasMinDate?t.minDate:s,t.hasMaxDate?t.maxDate:i,{disabledKeys:void 0!==t.sets.disabledKeys?t.sets.disabledKeys:o.disabledKeys,disabledDays:void 0!==t.sets.disabledDays?t.sets.disabledDays:o.disabledDays,enabledKeys:void 0!==t.sets.enabledKeys?t.sets.enabledKeys:o.enabledKeys,enabledDays:void 0!==t.sets.enabledDays?t.sets.enabledDays:o.enabledDays,disabledMonths:void 0!==t.sets.disabledMonths?t.sets.disabledMonths:o.disabledMonths,enabledMonths:void 0!==t.sets.enabledMonths?t.sets.enabledMonths:o.enabledMonths,disabledYears:void 0!==t.sets.disabledYears?t.sets.disabledYears:o.disabledYears,enabledYears:void 0!==t.sets.enabledYears?t.sets.enabledYears:o.enabledYears},l)}:e=>u(e,s,i,o,l)}function y(t,a,i=1,n,r){const l=n??e.today(),o=r??(()=>!1),d=new e(t,a,1),h=(d.toNativeDate().getDay()-i+7)%7,c=d.addDays(-h),u=[],m=[];for(let e=0;e<6;e++){const i=[];for(let s=0;s<7;s++){const n=7*e+s,r=c.addDays(n);i.push({date:r,isCurrentMonth:r.month===a&&r.year===t,isToday:r.isSame(l),isDisabled:o(r)})}const n=i[0];n&&m.push(s(n.date)),u.push(i)}return{year:t,month:a,rows:u,weekNumbers:m}}class b{constructor(e){this.selected=null,this.selected=e??null}isSelected(e){return null!==this.selected&&this.selected.isSame(e)}toggle(e){null!==this.selected&&this.selected.isSame(e)?this.selected=null:this.selected=e}clear(){this.selected=null}toArray(){return null!==this.selected?[this.selected]:[]}toValue(){return null!==this.selected?this.selected.toISO():""}getSelected(){return this.selected}}class f{constructor(e){if(this.keys=new Set,e)for(const t of e)this.keys.add(t.toKey())}isSelected(e){return this.keys.has(e.toKey())}toggle(e){const t=e.toKey();this.keys.has(t)?this.keys.delete(t):this.keys.add(t)}clear(){this.keys.clear()}toArray(){return[...this.keys].sort().map(t=>e.fromISO(t))}toValue(){return[...this.keys].sort().join(", ")}get count(){return this.keys.size}}class p{constructor(e,t){this.start=null,this.end=null,this.start=e??null,this.end=t??null}isSelected(e){return!(null===this.start||!this.start.isSame(e))||!(null===this.end||!this.end.isSame(e))}toggle(e){null===this.start?this.start=e:null===this.end?e.isBefore(this.start)?(this.end=this.start,this.start=e):e.isSame(this.start)?this.start=null:this.end=e:(this.start=e,this.end=null)}setRange(e,t){this.start=e,this.end=t}clear(){this.start=null,this.end=null}toArray(){return null===this.start?[]:null===this.end?[this.start]:[this.start,this.end]}toValue(){return null===this.start?"":null===this.end?this.start.toISO():`${this.start.toISO()} – ${this.end.toISO()}`}isInRange(e,t){if(null!==this.start&&null!==this.end)return e.isBetween(this.start,this.end);if(null!==this.start&&void 0!==t){const s=this.start.isBefore(t)?this.start:t,a=this.start.isBefore(t)?t:this.start;return e.isBetween(s,a)}return!1}getStart(){return this.start}getEnd(){return this.end}isPartial(){return null!==this.start&&null===this.end}isComplete(){return null!==this.start&&null!==this.end}}const v={YYYY:e=>String(e.year).padStart(4,"0"),YY:e=>String(e.year%100).padStart(2,"0"),MM:e=>String(e.month).padStart(2,"0"),M:e=>String(e.month),DD:e=>String(e.day).padStart(2,"0"),D:e=>String(e.day)},g=Object.keys(v).sort((e,t)=>t.length-e.length);function D(e,t){let s=t,a="";for(;s.length>0;){let t=!1;for(const i of g)if(s.startsWith(i)){const n=v[i];if(n){a+=n(e),s=s.slice(i.length),t=!0;break}}t||(a+=s[0],s=s.slice(1))}return a}const _={YYYY:{pattern:"(\\d{4})",extract:e=>Number(e)},YY:{pattern:"(\\d{2})",extract:e=>2e3+Number(e)},MM:{pattern:"(\\d{1,2})",extract:e=>Number(e)},M:{pattern:"(\\d{1,2})",extract:e=>Number(e)},DD:{pattern:"(\\d{1,2})",extract:e=>Number(e)},D:{pattern:"(\\d{1,2})",extract:e=>Number(e)}},w=Object.keys(_).sort((e,t)=>t.length-e.length);function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(s,a){const i=s.trim();if(""===i)return null;const{regex:n,extractors:r}=function(e){let t=e,s="^";const a=[];let i=1;for(;t.length>0;){let e=!1;for(const n of w)if(t.startsWith(n)){const r=_[n];if(r){s+=r.pattern,a.push({token:n,index:i}),i++,t=t.slice(n.length),e=!0;break}}e||(s+=x(t[0]),t=t.slice(1))}return s+="$",{regex:new RegExp(s),extractors:a}}(a),l=n.exec(i);if(!l)return null;let o=0,d=0,h=0;for(const{token:e,index:t}of r){const s=l[t];if(void 0===s)return null;const a=_[e];if(!a)return null;const i=a.extract(s);"YYYY"===e||"YY"===e?o=i:"MM"===e||"M"===e?d=i:"DD"!==e&&"D"!==e||(h=i)}return function(e,s,a){return!(s<1||s>12||a<1||a>t(e,s)||e<1)}(o,d,h)?new e(o,d,h):null}function M(t,s){const a=t.trim();if(""===a)return null;const i=[" – "," — "," - "];for(const n of i){const t=a.indexOf(n);if(-1!==t){const i=a.slice(0,t),r=a.slice(t+n.length),l=S(i,s)??e.fromISO(i.trim()),o=S(r,s)??e.fromISO(r.trim());if(l&&o)return[l,o]}}return null}function k(t,s){const a=t.trim();if(""===a)return[];const i=a.split(","),n=[];for(const r of i){const t=S(r,s)??e.fromISO(r.trim());t&&n.push(t)}return n}const Y={YYYY:4,YY:2,MM:2,M:2,DD:2,D:2},R=Object.keys(Y).sort((e,t)=>t.length-e.length);function O(e){return e.replace(/\D/g,"")}function z(e){let t=0;for(const s of e)s>="0"&&s<="9"&&t++;return t}function I(e,t){let s="",a=0;for(const i of t)if("digit"===i.type){if(a>=e.length)break;s+=e[a],a++}else{if(!(a>0))break;s+=i.char}return s}function $(e,t,s){if(s<=0)return 0;let a=0;for(let i=0;i<e.length&&i<t.length;i++){const n=t[i];if(n&&"digit"===n.type&&(a++,a===s)){let s=i+1;for(;s<t.length&&s<e.length;){const e=t[s];if(!e||"literal"!==e.type)break;s++}return s}}return e.length}function E(e){const t=function(e){const t=[];let s=e;for(;s.length>0;){let e=!1;for(const a of R)if(s.startsWith(a)){const i=Y[a];if(void 0===i)continue;for(let e=0;e<i;e++)t.push({type:"digit",char:"9"});s=s.slice(a.length),e=!0;break}e||(t.push({type:"literal",char:s[0]}),s=s.slice(1))}return t}(e),s=t.filter(e=>"digit"===e.type).length,a=t.map(e=>"digit"===e.type?"9":e.char).join("");return{apply:e=>I(O(e).slice(0,s),t),get pattern(){return a},get format(){return e},get length(){return t.length},get slots(){return t},get maxDigits(){return s}}}function A(e,t){const s=E(t),a=function(e){const{slots:t,maxDigits:s}=e;return{onInput:function(e){const a=e.target,i=a.value,n=a.selectionStart??i.length,r=z(i.slice(0,n)),l=I(O(i).slice(0,s),t);a.value=l;const o=$(l,t,r);a.setSelectionRange(o,o)},onKeyDown:function(e){const s=e.target,a=s.selectionStart??0;if(a===(s.selectionEnd??a)){if("Backspace"===e.key&&a>0){const i=a<=t.length?t[a-1]:void 0;if(i&&"literal"===i.type){e.preventDefault();let i=a-1;for(;i>0;){const e=t[i-1];if(!e||"literal"!==e.type)break;i--}if(i>0){const e=O(s.value),a=z(s.value.slice(0,i));if(a>0){const i=I(e.slice(0,a-1)+e.slice(a),t);s.value=i;const n=$(i,t,a-1);s.setSelectionRange(n,n)}}}}if("Delete"===e.key&&a<s.value.length){const i=a<t.length?t[a]:void 0;if(i&&"literal"===i.type){e.preventDefault();let i=a+1;for(;i<t.length;){const e=t[i];if(!e||"literal"!==e.type)break;i++}if(i<s.value.length){const e=O(s.value),a=z(s.value.slice(0,i)),n=I(e.slice(0,a)+e.slice(a+1),t);s.value=n;const r=$(n,t,a);s.setSelectionRange(r,r)}}}}},onPaste:function(e){var a;e.preventDefault();const i=e.target,n=O((null==(a=e.clipboardData)?void 0:a.getData("text"))??"");if(0===n.length)return;const r=i.selectionStart??0,l=i.selectionEnd??r,o=O(i.value),d=z(i.value.slice(0,r)),h=z(i.value.slice(r,l)),c=I((o.slice(0,d)+n+o.slice(d+h)).slice(0,s),t);i.value=c;const u=Math.min(d+n.length,s),m=$(c,t,u);i.setSelectionRange(m,m)}}}(s);return e.addEventListener("input",a.onInput),e.addEventListener("keydown",a.onKeyDown),e.addEventListener("paste",a.onPaste),e.value&&(e.value=s.apply(e.value)),()=>{e.removeEventListener("input",a.onInput),e.removeEventListener("keydown",a.onKeyDown),e.removeEventListener("paste",a.onPaste)}}function C(e){return null==e?()=>{}:"function"==typeof e?e:t=>e[t.toISO()]}function N(e){return Array.from({length:6},(t,s)=>function(e,t){return`<div class="${t?"rc-row rc-row--week-numbers":"rc-row"}" x-show="mg.rows.length > ${e}">\n ${t?`<div class="rc-week-number" x-text="mg.weekNumbers[${e}]"></div>`:""}<template x-for="cell in (mg.rows[${e}] || [])" :key="cell.date.toISO()">\n <div :class="dayClasses(cell)" :style="dayStyle(cell)" :id="'day-' + cell.date.toISO()" :aria-selected="isSelected(cell.date)" :aria-disabled="cell.isDisabled" :title="dayTitle(cell)" role="option" tabindex="-1" @click="!cell.isDisabled && selectDate(cell.date)" @mouseenter="hoverDate = cell.date" @mouseleave="hoverDate = null"><span class="rc-day__number" x-text="cell.date.day"></span><template x-if="dayMeta(cell)?.label"><span class="rc-day__label" x-text="dayMeta(cell).label"></span></template><template x-if="dayMeta(cell)?.availability === 'available' && !dayMeta(cell)?.label"><span class="rc-day__dot" aria-hidden="true"></span></template></div>\n </template>\n </div>`}(s,e)).join("\n ")}function T(e){const{display:t,isDualMonth:s,isWizard:a,hasName:i,showWeekNumbers:n,hasPresets:r,isScrollable:l,scrollHeight:o}=e,d="popup"===t,h=a?"rc-calendar rc-calendar--wizard":"rc-calendar",c=a?"Birth date wizard":"Calendar",u=[];d&&u.push(function(e){return`<div class="rc-popup-header">\n ${e?'<span class="rc-popup-header__title" x-text="wizardStepLabel"></span>':'<span class="rc-popup-header__title">Select Date</span>'}\n <button class="rc-popup-header__close" @click="close()" aria-label="Close calendar"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="4" y1="4" x2="12" y2="12"/><line x1="12" y1="4" x2="4" y2="12"/></svg></button>\n</div>`}(a)),a&&u.push('<div class="rc-wizard-steps">\n <template x-for="step in wizardTotalSteps" :key="step">\n <div class="rc-wizard-step" :class="{ \'rc-wizard-step--active\': wizardStep === step, \'rc-wizard-step--done\': wizardStep > step }"></div>\n </template>\n</div>\n<div class="rc-wizard-label" x-text="wizardStepLabel"></div>\n<template x-if="wizardStep > 1">\n <button class="rc-wizard-back" @click="wizardBack()" aria-label="Go back">&#8249; Back</button>\n</template>'),u.push('<template x-if="view === \'years\'">\n <div class="rc-view-enter">\n <div class="rc-header">\n <button class="rc-header__nav" @click="prev()" :disabled="!canGoPrev" aria-label="Previous decade">&#8249;</button>\n <span class="rc-header__label" x-text="decadeLabel"></span>\n <button class="rc-header__nav" @click="next()" :disabled="!canGoNext" aria-label="Next decade">&#8250;</button>\n </div>\n <div class="rc-year-grid" role="group" :aria-label="decadeLabel">\n <template x-for="cell in yearGrid.flat()" :key="cell.year">\n <div :class="yearClasses(cell)" :aria-disabled="cell.isDisabled" tabindex="-1" @click="!cell.isDisabled && selectYear(cell.year)" x-text="cell.label"></div>\n </template>\n </div>\n </div>\n</template>'),u.push('<template x-if="view === \'months\'">\n <div class="rc-view-enter">\n <div class="rc-header">\n <button class="rc-header__nav" @click="prev()" :disabled="!canGoPrev" aria-label="Previous year">&#8249;</button>\n <button class="rc-header__label" @click="setView(\'years\')" aria-label="Change view" x-text="yearLabel"></button>\n <button class="rc-header__nav" @click="next()" :disabled="!canGoNext" aria-label="Next year">&#8250;</button>\n </div>\n <div class="rc-month-grid" role="group" :aria-label="yearLabel">\n <template x-for="cell in monthGrid.flat()" :key="cell.month">\n <div :class="monthClasses(cell)" :aria-disabled="cell.isDisabled" tabindex="-1" @click="!cell.isDisabled && selectMonth(cell.month)" x-text="cell.label"></div>\n </template>\n </div>\n </div>\n</template>'),l?u.push(function(e,t){return`<template x-if="view === 'days'">\n <div>\n <div class="rc-header rc-header--scroll-sticky">\n <span class="rc-header__label rc-header__label--scroll" x-text="scrollHeaderLabel"></span>\n </div>\n ${e?'<div class="rc-weekdays rc-weekdays--week-numbers">\n <span class="rc-weekday rc-week-label"></span>\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>':'<div class="rc-weekdays">\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>'}\n <div class="rc-months rc-months--scroll" style="max-height: ${t}px">\n <template x-for="(mg, gi) in grid" :key="mg.year + '-' + mg.month">\n <div :data-month-id="'month-' + mg.year + '-' + mg.month">\n <div class="rc-header rc-header--scroll" x-show="gi > 0">\n <span class="rc-header__label rc-header__label--scroll" x-text="monthYearLabel(gi)"></span>\n </div>\n <div class=${e?'"rc-grid rc-grid--week-numbers"':'"rc-grid"'} role="listbox" :aria-label="monthYearLabel(gi)">\n ${N(e)}\n </div>\n </div>\n </template>\n </div>\n </div>\n</template>`}(n,o)):u.push(function(e,t){return`<template x-if="view === 'days'">\n <div class="rc-months${e?"":" rc-view-enter"}"${e?" :class=\"{ 'rc-months--dual': monthCount === 2 }\"":""}>\n <template x-for="(mg, gi) in grid" :key="mg.year + '-' + mg.month">\n <div>\n <div class="rc-header">\n <button class="rc-header__nav" @click="prev()" :disabled="!canGoPrev" aria-label="Previous month"${e?" :style=\"gi > 0 ? 'visibility:hidden' : ''\"":""}>&#8249;</button>\n <button class="rc-header__label" @click="setView('months')" aria-label="Change view" x-text="monthYearLabel(gi)"></button>\n <button class="rc-header__nav" @click="next()" :disabled="!canGoNext" aria-label="Next month"${e?" :style=\"gi < grid.length - 1 ? 'visibility:hidden' : ''\"":""}>&#8250;</button>\n </div>\n ${t?'<div class="rc-weekdays rc-weekdays--week-numbers">\n <span class="rc-weekday rc-week-label"></span>\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>':'<div class="rc-weekdays">\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>'}\n <div class="rc-grid-wrapper">\n <div class=${t?'"rc-grid rc-grid--week-numbers"':'"rc-grid"'} :class="{ 'rc-grid--slide-next': _navDirection === 'next', 'rc-grid--slide-prev': _navDirection === 'prev' }" @animationend="_navDirection = ''" role="listbox" :aria-label="monthYearLabel(gi)">\n ${N(t)}\n </div>\n </div>\n </div>\n </template>\n </div>\n</template>`}(s,n)),r&&u.push('<div class="rc-presets" role="group" aria-label="Quick select">\n <template x-for="(preset, pi) in presets" :key="pi">\n <button class="rc-preset" @click="applyPreset(pi)" x-text="preset.label"></button>\n </template>\n</div>'),a&&u.push('<div class="rc-wizard-summary" x-show="wizardSummary" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 transform translate-y-1" x-transition:enter-end="opacity-100 transform translate-y-0" x-text="wizardSummary"></div>'),i&&u.push('<template x-if="inputName">\n <template x-for="val in hiddenInputValues" :key="val">\n <input type="hidden" :name="inputName" :value="val">\n </template>\n</template>');const m=`<div class="${h}" @keydown="handleKeydown($event)" tabindex="0" :aria-activedescendant="focusedDateISO ? 'day-' + focusedDateISO : null" role="application" aria-label="${c}">\n<div class="rc-sr-only" role="status" aria-live="polite" aria-atomic="true" x-text="_statusMessage"></div>\n${u.join("\n")}\n</div>`;return d?`<div x-ref="popup" x-show="isOpen" :style="popupStyle" class="rc-popup-overlay" @click.self="close()" role="dialog" aria-modal="true" :aria-label="popupAriaLabel" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0">\n${m}\n</div>`:m}function L(t){return e.fromISO(t)}function K(t){return t.map(t=>e.fromISO(t)).filter(e=>null!==e)}function V(t,s){const a={};if(t.minDate){const s=e.fromISO(t.minDate);s&&(a.minDate=s)}if(t.maxDate){const s=e.fromISO(t.maxDate);s&&(a.maxDate=s)}if(t.disabledDates&&(a.disabledDates=K(t.disabledDates)),t.disabledDaysOfWeek&&(a.disabledDaysOfWeek=t.disabledDaysOfWeek),t.enabledDates&&(a.enabledDates=K(t.enabledDates)),t.enabledDaysOfWeek&&(a.enabledDaysOfWeek=t.enabledDaysOfWeek),t.disabledMonths&&(a.disabledMonths=t.disabledMonths),t.enabledMonths&&(a.enabledMonths=t.enabledMonths),t.disabledYears&&(a.disabledYears=t.disabledYears),t.enabledYears&&(a.enabledYears=t.enabledYears),void 0!==t.minRange&&(a.minRange=t.minRange),void 0!==t.maxRange&&(a.maxRange=t.maxRange),t.rules){const e=t.rules.map(e=>function(e){const t=e.from?L(e.from):null,s=e.to?L(e.to):null,a=null!==t&&null!==s,i=Array.isArray(e.months)&&e.months.length>0;if(!a&&!i)return null;const n={};if(a&&(n.from=t,n.to=s),i&&(n.months=e.months),void 0!==e.priority&&(n.priority=e.priority),e.minDate){const t=L(e.minDate);t&&(n.minDate=t)}if(e.maxDate){const t=L(e.maxDate);t&&(n.maxDate=t)}return e.disabledDates&&(n.disabledDates=K(e.disabledDates)),e.disabledDaysOfWeek&&(n.disabledDaysOfWeek=e.disabledDaysOfWeek),e.enabledDates&&(n.enabledDates=K(e.enabledDates)),e.enabledDaysOfWeek&&(n.enabledDaysOfWeek=e.enabledDaysOfWeek),e.disabledMonths&&(n.disabledMonths=e.disabledMonths),e.enabledMonths&&(n.enabledMonths=e.enabledMonths),e.disabledYears&&(n.disabledYears=e.disabledYears),e.enabledYears&&(n.enabledYears=e.enabledYears),void 0!==e.minRange&&(n.minRange=e.minRange),void 0!==e.maxRange&&(n.maxRange=e.maxRange),n}(e)).filter(e=>null!==e);e.length>0&&(a.rules=e)}return{isDisabledDate:l(a),isRangeValid:o(a),isMonthDisabled:d(a),isYearDisabled:h(a),getDisabledReasons:m(a,s)}}const F=["minDate","maxDate","disabledDates","disabledDaysOfWeek","enabledDates","enabledDaysOfWeek","disabledMonths","enabledMonths","disabledYears","enabledYears","minRange","maxRange","rules"];function W(e){const t={};for(const s of F)void 0!==e[s]&&(t[s]=e[s]);return t}function B(t={},s){!function(t){const s=e=>console.warn(`[reach-calendar] ${e}`);if(void 0!==t.months&&(t.months<1||!Number.isInteger(t.months))&&s(`months must be a positive integer, got: ${t.months}`),t.wizard&&t.months&&t.months>=3&&s("months >= 3 (scrollable) is not compatible with wizard mode; using months: 1"),void 0!==t.firstDay&&(t.firstDay<0||t.firstDay>6)&&s(`firstDay must be 0-6, got: ${t.firstDay}`),t.minDate&&!e.fromISO(t.minDate)&&s(`invalid minDate: "${t.minDate}"`),t.maxDate&&!e.fromISO(t.maxDate)&&s(`invalid maxDate: "${t.maxDate}"`),t.minDate&&t.maxDate){const a=e.fromISO(t.minDate),i=e.fromISO(t.maxDate);a&&i&&a.isAfter(i)&&s(`minDate "${t.minDate}" is after maxDate "${t.maxDate}"`)}if(void 0!==t.minRange&&void 0!==t.maxRange&&t.minRange>t.maxRange&&s(`minRange (${t.minRange}) exceeds maxRange (${t.maxRange})`),t.wizard&&t.mode&&"single"!==t.mode&&s(`wizard mode is designed for single selection; mode "${t.mode}" may not work as expected`),t.timezone)try{Intl.DateTimeFormat(void 0,{timeZone:t.timezone})}catch{s(`invalid timezone: "${t.timezone}"`)}}(t);const a=t.mode??"single",i=t.display??"inline",n=t.format??"DD/MM/YYYY",r=t.firstDay??1;let l=t.timezone;if(l)try{Intl.DateTimeFormat(void 0,{timeZone:l})}catch{l=void 0}const o=t.wizard??!1,d=t.months??1,h=o&&d>=3?1:d,c=h>=3,u=t.scrollHeight??400,m=!!o,v=!0===o?"full":!1===o?"none":o,g="none"===v?0:"full"===v?3:2,_="full"===v||"year-month"===v?"years":"month-day"===v?"months":"days",w=t.mask??!0,x=t.showWeekNumbers??!1,Y=t.presets??[],R=t.name??"",O=t.inputId??null,z=t.inputRef??"rc-input",I=t.locale,$=t.closeOnSelect??!0,E=t.beforeSelect??null,N=t.constraintMessages,L=V(t,N),K=C(t.dateMetadata);const B="multiple"===a?new f:"range"===a?new p:new b,G=e=>{var t;return L.isDisabledDate(e)||"unavailable"===(null==(t=K(e))?void 0:t.availability)};if(t.value)if("single"===a){const s=S(t.value,n)??e.fromISO(t.value);s&&!G(s)&&B.toggle(s)}else if("range"===a){const e=M(t.value,n);if(e){let[t,s]=e;if(s.isBefore(t)){const e=t;t=s,s=e}G(t)||G(s)||!L.isRangeValid(t,s)||(B.toggle(t),B.toggle(s))}}else if("multiple"===a){const e=k(t.value,n);for(const t of e)G(t)||B.toggle(t)}const P=e.today(l),H=B.toArray(),U=H.length>0?H[0]:P,j="full"===v||"year-month"===v?new e(P.year-30,P.month,P.day):U;function q(e){const t=e.toArray();if(0===t.length)return"";const s=t[0];return"range"===a&&2===t.length?function(e,t,s){return`${D(e,s)} – ${D(t,s)}`}(s,t[1],n):"multiple"===a?function(e,t){return 0===e.length?"":e.map(e=>D(e,t)).join(", ")}(t,n):D(s,n)}return{mode:a,display:i,format:n,monthCount:h,firstDay:r,wizard:m,wizardMode:v,wizardTotalSteps:g,showWeekNumbers:x,presets:Y,inputName:R,month:j.month,year:j.year,view:m?_:"days",isOpen:"inline"===i,grid:[],monthGrid:[],yearGrid:[],inputValue:q(B),popupStyle:"popup"===i?"position:fixed;inset:0;z-index:50;":"",focusedDate:null,hoverDate:null,wizardStep:m?1:0,_wizardYear:null,_wizardMonth:null,_wizardDay:null,_navDirection:"",_selection:B,_today:P,_constraintConfig:W(t),_isDisabledDate:L.isDisabledDate,_isRangeValid:L.isRangeValid,_isMonthDisabled:L.isMonthDisabled,_isYearDisabled:L.isYearDisabled,_getDisabledReasons:L.getDisabledReasons,_inputEl:null,_detachInput:null,_syncing:!1,_suppressFocusOpen:!1,_Alpine:s??null,_autoRendered:!1,_popupOverlayEl:null,isScrollable:c,_scrollHeight:u,_scrollContainerEl:null,_scrollObserver:null,_scrollVisibleIndex:0,_selectionRev:0,_getDateMeta:K,_metadataRev:0,_isEffectivelyDisabled(e){var t;return!!this._isDisabledDate(e)||"unavailable"===(null==(t=this._getDateMeta(e))?void 0:t.availability)},_statusMessage:"",get selectedDates(){return this._selection.toArray()},get formattedValue(){return q(this._selection)},get hiddenInputValues(){return this._selection.toArray().map(e=>e.toISO())},get focusedDateISO(){return this.focusedDate?this.focusedDate.toISO():""},get inputId(){return O},get inputAriaLabel(){return"range"===a?"Select date range":"multiple"===a?"Select dates":m?"Select birth date":"Select date"},get popupAriaLabel(){return m?"Birth date wizard":"range"===a?"Date range picker":"Date picker"},get wizardStepLabel(){return this.wizard?"full"===v?1===this.wizardStep?"Select Year":2===this.wizardStep?"Select Month":"Select Day":"year-month"===v?1===this.wizardStep?"Select Year":"Select Month":"month-day"===v?1===this.wizardStep?"Select Month":"Select Day":"":""},get wizardSummary(){if(!m)return"";const t=[];if(null!==this._wizardYear&&t.push(String(this._wizardYear)),null!==this._wizardMonth){const s=new e(this._wizardYear??this.year,this._wizardMonth,1);t.push(s.format({month:"long"},I))}return null!==this._wizardDay&&t.push(String(this._wizardDay)),t.join(" · ")},get weekdayHeaders(){const e=[],t=new Date(2026,0,4);for(let s=0;s<7;s++){const a=(this.firstDay+s)%7,i=new Date(t);i.setDate(t.getDate()+a),e.push(new Intl.DateTimeFormat(I,{weekday:"short"}).format(i))}return e},init(){var e;const s=this.$el;if(!(null!==s.querySelector(".rc-calendar"))&&!1!==t.template&&(null==(e=this._Alpine)?void 0:e.initTree)){const e=document.createRange().createContextualFragment(T({display:this.display,isDualMonth:2===this.monthCount,isWizard:"none"!==this.wizardMode,hasName:!!this.inputName,showWeekNumbers:this.showWeekNumbers,hasPresets:this.presets.length>0,isScrollable:this.isScrollable,scrollHeight:this._scrollHeight})),t=Array.from(e.children).filter(e=>e instanceof HTMLElement);s.appendChild(e);for(const s of t)this._Alpine.initTree(s);if(this._autoRendered=!0,"popup"===i){const e=s.querySelector(".rc-popup-overlay");e&&(document.body.appendChild(e),this._popupOverlayEl=e)}}this._rebuildGrid(),this._rebuildMonthGrid(),this._rebuildYearGrid(),this.$watch("month",()=>{this._rebuildGrid(),this._emitNavigate(),this._announceNavigation(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})}),this.$watch("year",()=>{this._rebuildGrid(),this._rebuildMonthGrid(),this._rebuildYearGrid(),this._emitNavigate(),this._announceNavigation(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})}),this.$watch("view",()=>{this._emitViewChange(),this._announceViewChange()}),this.$nextTick(()=>{const e=this.$refs;e&&e[z]&&e[z]instanceof HTMLInputElement?this.bindInput(e[z]):"popup"===this.display&&console.warn(`[reach-calendar] Popup mode requires an <input x-ref="${z}"> inside the component container.`),this.isScrollable&&this._initScrollListener()})},destroy(){var e,t;if(this._scrollObserver&&(this._scrollObserver.disconnect(),this._scrollObserver=null),this._scrollContainerEl=null,this._detachInput&&(this._detachInput(),this._detachInput=null),this._inputEl=null,this._popupOverlayEl&&(this._popupOverlayEl.remove(),this._popupOverlayEl=null),this._autoRendered){const s=this.$el;null==(e=s.querySelector(".rc-popup-overlay"))||e.remove(),null==(t=s.querySelector(".rc-calendar"))||t.remove(),this._autoRendered=!1}},_rebuildGrid(){this.grid=function(e,t,s,a=1,i,n){const r=[];for(let l=0;l<s;l++){let s=t+l,o=e;for(;s>12;)s-=12,o++;r.push(y(o,s,a,i,n))}return r}(this.year,this.month,this.monthCount,this.firstDay,this._today,e=>this._isEffectivelyDisabled(e))},_rebuildMonthGrid(){this.monthGrid=function(t,s,a,i){const n=s??e.today(),r=i??(()=>!1),l=[];for(let o=0;o<3;o++){const s=[];for(let i=0;i<4;i++){const l=4*o+i+1,d=new e(t,l,1);s.push({month:l,year:t,label:d.format({month:"short"},a),isCurrentMonth:n.month===l&&n.year===t,isDisabled:r(t,l)})}l.push(s)}return l}(this.year,this._today,I,this._isMonthDisabled)},_rebuildYearGrid(){this.yearGrid=function(t,s,a){const i=s??e.today(),n=a??(()=>!1),r=12*Math.floor(t/12),l=[];for(let e=0;e<3;e++){const t=[];for(let s=0;s<4;s++){const a=r+4*e+s;t.push({year:a,label:String(a),isCurrentYear:i.year===a,isDisabled:n(a)})}l.push(t)}return l}(this.year,this._today,this._isYearDisabled)},dayGridItems(e){const t=[];for(let s=0;s<e.rows.length;s++){const a=e.rows[s];if(!a||0===a.length)continue;const i=a[0];t.push({isWeekNumber:!0,weekNumber:e.weekNumbers[s]??0,cell:i,key:`wn-${s}`});for(const e of a)t.push({isWeekNumber:!1,weekNumber:0,cell:e,key:e.date.toISO()})}return t},get yearLabel(){return String(this.year)},get decadeLabel(){const e=12*Math.floor(this.year/12);return`${e} – ${e+11}`},get canGoPrev(){if("days"===this.view){if(this.isScrollable)return!1;const t=new e(this.year,this.month,1).addMonths(-1);return!this._isMonthDisabled(t.year,t.month)}if("months"===this.view)return!this._isYearDisabled(this.year-1);if("years"===this.view){const e=12*Math.floor(this.year/12);for(let t=e-12;t<e;t++)if(!this._isYearDisabled(t))return!0;return!1}return!0},get canGoNext(){if("days"===this.view){if(this.isScrollable)return!1;const t=new e(this.year,this.month,1).addMonths(1);return!this._isMonthDisabled(t.year,t.month)}if("months"===this.view)return!this._isYearDisabled(this.year+1);if("years"===this.view){const e=12*Math.floor(this.year/12);for(let t=e+12;t<e+24;t++)if(!this._isYearDisabled(t))return!0;return!1}return!0},yearClasses(e){const t=this.year===e.year&&"months"===this.view;return{"rc-year":!0,"rc-year--current":e.isCurrentYear,"rc-year--selected":t,"rc-year--disabled":e.isDisabled}},monthClasses(e){const t=this.month===e.month&&"days"===this.view;return{"rc-month":!0,"rc-month--current":e.isCurrentMonth,"rc-month--selected":t,"rc-month--disabled":e.isDisabled}},monthYearLabel(t){const s=this.grid[t];if(!s)return"";return new e(s.year,s.month,1).format({month:"long",year:"numeric"},I)},dayClasses(e){this._selectionRev,this._metadataRev;const t=e.date,s=this.isSelected(t),i=this.isRangeStart(t),n=this.isRangeEnd(t),r=this.isInRange(t,this.hoverDate??void 0),l=!e.isCurrentMonth;let o=!1;"range"!==a||null===this.hoverDate||e.isDisabled||s||!this._selection.isPartial()||(o=!this.isDateSelectableForRange(t));const d=this._getDateMeta(t),h=!!(null==d?void 0:d.label),c="available"===(null==d?void 0:d.availability),u="unavailable"===(null==d?void 0:d.availability),m={"rc-day":!0,"rc-day--today":e.isToday,"rc-day--selected":s,"rc-day--range-start":i,"rc-day--range-end":n,"rc-day--in-range":r&&!i&&!n,"rc-day--disabled":e.isDisabled,"rc-day--other-month":l,"rc-day--hidden":l&&this.monthCount>1,"rc-day--focused":null!==this.focusedDate&&this.focusedDate.isSame(t),"rc-day--range-invalid":o,"rc-day--available":c,"rc-day--unavailable":u,"rc-day--has-label":h};if(null==d?void 0:d.cssClass)for(const a of d.cssClass.split(/\s+/))a&&(m[a]=!0);return m},dayTitle(e){this._metadataRev;const t=this._getDateMeta(e.date),s=[];if(e.isDisabled){const a=this._getDisabledReasons(e.date);a.length>0?s.push(a.join("; ")):"unavailable"===(null==t?void 0:t.availability)&&s.push("Unavailable")}return(null==t?void 0:t.label)&&s.push(t.label),s.join(" — ")},dayMeta(e){return this._metadataRev,this._getDateMeta(e.date)},dayStyle(e){this._metadataRev;const t=this._getDateMeta(e.date);return(null==t?void 0:t.color)?`--color-calendar-day-meta: ${t.color};`:""},bindInput(e){this._detachInput&&(this._detachInput(),this._detachInput=null),this._inputEl=e,e.value=this.inputValue,w&&(this._detachInput=A(e,n),this.inputValue=e.value);const t=()=>{this._syncing||(this.inputValue=e.value)};e.addEventListener("input",t);const s=()=>this.handleFocus(),a=()=>this.handleBlur();e.addEventListener("focus",s),e.addEventListener("blur",a),"popup"===i&&(e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded",String(this.isOpen)),e.setAttribute("autocomplete","off"),O&&!e.id&&(e.id=O),e.getAttribute("aria-label")||e.setAttribute("aria-label",this.inputAriaLabel));const r=this._detachInput;this._detachInput=()=>{null==r||r(),e.removeEventListener("input",t),e.removeEventListener("focus",s),e.removeEventListener("blur",a),"popup"===i&&(e.removeAttribute("role"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("autocomplete"))},e.placeholder||(e.placeholder=n.toLowerCase())},handleInput(e){const t=e.target;this.inputValue=t.value},handleFocus(){this._suppressFocusOpen?this._suppressFocusOpen=!1:this.open()},handleBlur(){const t=this._inputEl?this._inputEl.value:this.inputValue;if(!t.trim())return this._selection.toArray().length>0&&(this._selection.clear(),this._selectionRev++,this._emitChange()),void this._syncInputFromSelection();let s=!1;if("single"===a){const a=S(t,n)??e.fromISO(t);a&&!this._isEffectivelyDisabled(a)&&(this._selection.clear(),this._selection.toggle(a),this.month=a.month,this.year=a.year,s=!0)}else if("range"===a){const e=M(t,n);if(e){let[t,a]=e;if(a.isBefore(t)){const e=t;t=a,a=e}this._isEffectivelyDisabled(t)||this._isEffectivelyDisabled(a)||!this._isRangeValid(t,a)||(this._selection.clear(),this._selection.toggle(t),this._selection.toggle(a),this.month=t.month,this.year=t.year,s=!0)}}else if("multiple"===a){const e=k(t,n).filter(e=>!this._isEffectivelyDisabled(e));if(e.length>0){this._selection.clear();for(const s of e)this._selection.toggle(s);const t=e[0];this.month=t.month,this.year=t.year,s=!0}}s&&(this._selectionRev++,this._emitChange()),this._syncInputFromSelection()},_syncInputFromSelection(){this._syncing=!0,this.inputValue=this.formattedValue,this._inputEl&&(this._inputEl.value=this.inputValue),this._syncing=!1},_announce(e){this._statusMessage="",this.$nextTick(()=>{this._statusMessage=e})},_announceNavigation(){if("days"===this.view)if(this.monthCount>1&&!this.isScrollable){const e=[];for(let t=0;t<this.grid.length;t++)e.push(this.monthYearLabel(t));this._announce(e.join(" – "))}else this._announce(this.monthYearLabel(0));else"months"===this.view?this._announce("Year: "+this.year):"years"===this.view&&this._announce("Decade: "+this.decadeLabel)},_announceViewChange(){"days"===this.view?this._announce(this.monthYearLabel(0)):"months"===this.view?this._announce("Select month, "+this.year):"years"===this.view&&this._announce("Select year, "+this.decadeLabel)},_emitChange(){this.$dispatch("calendar:change",{value:this._selection.toValue(),dates:this._selection.toArray().map(e=>e.toISO()),formatted:this.formattedValue})},_emitNavigate(){this.$dispatch("calendar:navigate",{year:this.year,month:this.month,view:this.view})},_emitViewChange(){this.$dispatch("calendar:view-change",{view:this.view,year:this.year,month:this.month})},prev(){if(this._navDirection="prev","days"===this.view){if(this.isScrollable)return;const t=new e(this.year,this.month,1).addMonths(-1);this.month=t.month,this.year=t.year}else"months"===this.view?this.year--:"years"===this.view&&(this.year-=12)},next(){if(this._navDirection="next","days"===this.view){if(this.isScrollable)return;const t=new e(this.year,this.month,1).addMonths(1);this.month=t.month,this.year=t.year}else"months"===this.view?this.year++:"years"===this.view&&(this.year+=12)},goToToday(){this.month=this._today.month,this.year=this._today.year,this.view="days"},selectDate(t){const s="string"==typeof t?e.fromISO(t):t;if(!s)return;if(this._isEffectivelyDisabled(s))return;if("range"===a){const e=this._selection,t=e.getStart();if(e.isPartial()&&t&&!s.isSame(t)){let e=t,a=s;if(a.isBefore(e)){const t=e;e=a,a=t}if(!this._isRangeValid(e,a))return}}if(E){const e=this._selection.isSelected(s)?"deselect":"select";if(!1===E(s,{mode:a,selectedDates:this._selection.toArray(),action:e}))return}const n=this._selection.isSelected(s),r="range"===a&&this._selection.isPartial();this._selection.toggle(s),m&&(this._wizardDay=s.day),this._selectionRev++,this._emitChange(),this._syncInputFromSelection();const l=s.format({weekday:"long",month:"long",day:"numeric",year:"numeric"},I);if("single"===a)this._announce(l+" selected");else if("multiple"===a){const e=this._selection.toArray().length;n?this._announce(l+" deselected. "+e+" dates selected"):this._announce(l+" selected. "+e+" dates selected")}else if("range"===a){const e=this._selection;if(e.isPartial())this._announce("Range start: "+l+". Select end date");else if(r){const t=e.toArray();if(2===t.length){const e=t[0].format({weekday:"long",month:"long",day:"numeric",year:"numeric"},I),s=t[1].format({weekday:"long",month:"long",day:"numeric",year:"numeric"},I);this._announce("Range: "+e+" to "+s)}}}if($&&"popup"===i&&this.isOpen){("single"===a||"range"===a&&!this._selection.isPartial()||"multiple"===a)&&this.close()}},isSelected(e){return this._selection.isSelected(e)},isInRange(e,t){return"range"===a&&this._selection.isInRange(e,t)},isRangeStart(e){if("range"!==a)return!1;const t=this._selection.getStart();return null!==t&&e.isSame(t)},isRangeEnd(e){if("range"!==a)return!1;const t=this._selection.getEnd();return null!==t&&e.isSame(t)},isDateSelectableForRange(e){if("range"!==a)return!1;if(this._isEffectivelyDisabled(e))return!1;const t=this._selection;if(!t.isPartial())return!0;const s=t.getStart();if(!s)return!0;if(e.isSame(s))return!0;let i=s,n=e;if(n.isBefore(i)){const e=i;i=n,n=e}return this._isRangeValid(i,n)},getDisabledReason(t){const s="string"==typeof t?e.fromISO(t):t;return s?this._getDisabledReasons(s):[]},clearSelection(){this._selection.clear(),this._selectionRev++,this._emitChange(),this._syncInputFromSelection(),this._announce("Selection cleared")},setValue(t){this._selection.clear();const s=[];if("string"==typeof t){const a=e.fromISO(t)??S(t,n);a&&!this._isEffectivelyDisabled(a)&&s.push(a)}else if(Array.isArray(t))for(const a of t){const t="string"==typeof a?e.fromISO(a)??S(a,n):a;t&&!this._isEffectivelyDisabled(t)&&s.push(t)}else t instanceof e&&(this._isEffectivelyDisabled(t)||s.push(t));if("range"===a&&2===s.length){let[e,t]=s;if(t.isBefore(e)){const s=e;e=t,t=s}if(!this._isRangeValid(e,t))return this._selectionRev++,this._emitChange(),void this._syncInputFromSelection();this._selection.setRange(e,t)}else for(const e of s)this._selection.toggle(e);const i=this._selection.toArray();if(i.length>0){const e=i[0];this.month=e.month,this.year=e.year}this._selectionRev++,this._emitChange(),this._syncInputFromSelection()},clear(){this.clearSelection()},goTo(e,t){this.year=e,void 0!==t&&(this.month=t),this.view="days",this.isScrollable&&(this._rebuildGrid(),this.$nextTick(()=>{this._rebindScrollObserver(),this._scrollToMonth(e,t??this.month)}))},getSelection(){return[...this._selection.toArray()]},applyPreset(e){const t=this.presets[e];if(!t)return;const[s,i]=t.value();"single"===a?this.setValue(s):this.setValue([s,i]),"popup"===this.display&&$&&this.close()},updateConstraints(e){const t={...this._constraintConfig};for(const a of F)a in e&&(t[a]=e[a]);this._constraintConfig=t;const s=V(t,N);this._isDisabledDate=s.isDisabledDate,this._isRangeValid=s.isRangeValid,this._isMonthDisabled=s.isMonthDisabled,this._isYearDisabled=s.isYearDisabled,this._getDisabledReasons=s.getDisabledReasons,this._rebuildGrid(),this._rebuildMonthGrid(),this._rebuildYearGrid(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})},updateDateMetadata(e){this._getDateMeta=C(e),this._metadataRev++,this._rebuildGrid(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})},setView(e){this.view=e},selectMonth(t){if(!this._isMonthDisabled(this.year,t)){if(this.month=t,this._wizardMonth=t,"year-month"===v)return this.wizardStep=g,void this.selectDate(new e(this.year,t,1));this.view="days",m&&(this.wizardStep="month-day"===v?2:3)}},selectYear(e){this._isYearDisabled(e)||(this.year=e,this._wizardYear=e,this.view="months",this.wizard&&(this.wizardStep=2))},wizardBack(){this.wizard&&("full"===v?3===this.wizardStep?(this.wizardStep=2,this.view="months",this._wizardMonth=null,this._wizardDay=null):2===this.wizardStep&&(this.wizardStep=1,this.view="years",this._wizardYear=null,this._wizardMonth=null):"year-month"===v?2===this.wizardStep&&(this.wizardStep=1,this.view="years",this._wizardYear=null,this._wizardMonth=null):"month-day"===v&&2===this.wizardStep&&(this.wizardStep=1,this.view="months",this._wizardMonth=null))},open(){var e;"popup"===this.display&&(m&&(this.wizardStep=1,this.view=_,this._wizardYear=null,this._wizardMonth=null,this._wizardDay=null,"month-day"!==v&&(this.year=this._today.year-30,this._rebuildYearGrid())),this.isOpen=!0,null==(e=this._inputEl)||e.setAttribute("aria-expanded","true"),this.$dispatch("calendar:open"),this.$nextTick(()=>{}))},close(){var e;"popup"===this.display&&(this.isOpen=!1,null==(e=this._inputEl)||e.setAttribute("aria-expanded","false"),this.$dispatch("calendar:close"))},toggle(){this.isOpen?this.close():this.open()},handleKeydown(t){if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),this.wizard&&this.wizardStep>1?void this.wizardBack():"months"===this.view||"years"===this.view?void(this.view="days"):void("popup"===i&&this.isOpen&&(this.close(),this._inputEl&&(this._suppressFocusOpen=!0,this._inputEl.focus())));if("days"===this.view)switch(t.key){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":case"PageDown":case"PageUp":case"Home":case"End":if(t.preventDefault(),!this.focusedDate){const t=this._selection.toArray();t.length>0?this.focusedDate=t[0]:this.focusedDate=new e(this.year,this.month,1)}return void("ArrowRight"===t.key?this._moveFocus(1):"ArrowLeft"===t.key?this._moveFocus(-1):"ArrowDown"===t.key?this._moveFocus(7):"ArrowUp"===t.key?this._moveFocus(-7):"PageDown"===t.key?this._moveFocusByMonths(t.shiftKey?12:1):"PageUp"===t.key?this._moveFocusByMonths(t.shiftKey?-12:-1):"Home"===t.key?this._setFocusedDate(new e(this.year,this.month,1)):"End"===t.key&&this._setFocusedDate(new e(this.year,this.month,1).endOfMonth()));case"Enter":case" ":return void(this.focusedDate&&(t.preventDefault(),this.selectDate(this.focusedDate)))}},_moveFocus(e){if(!this.focusedDate)return;let t=this.focusedDate.addDays(e),s=0;for(;this._isEffectivelyDisabled(t)&&s<31;)t=t.addDays(e>0?1:-1),s++;this._isEffectivelyDisabled(t)||this._setFocusedDate(t)},_moveFocusByMonths(e){if(!this.focusedDate)return;const t=this.focusedDate.addMonths(e);this._setFocusedDate(t)},_setFocusedDate(e){this.focusedDate=e,this.isScrollable?this.$nextTick(()=>{this._scrollToMonth(e.year,e.month)}):e.month===this.month&&e.year===this.year||(this.month=e.month,this.year=e.year)},get scrollHeaderLabel(){if(!this.isScrollable)return"";const t=this.grid[this._scrollVisibleIndex];if(!t)return"";return new e(t.year,t.month,1).format({month:"long",year:"numeric"},I)},_initScrollListener(){if("undefined"==typeof IntersectionObserver)return;const e=this.$el.querySelector(".rc-months--scroll");if(!e)return;this._scrollContainerEl=e;const t=e.querySelectorAll("[data-month-id]");if(0===t.length)return;const s=new Map;t.forEach((e,t)=>s.set(e,t));const a=new Set,i=new IntersectionObserver(e=>{for(const t of e){const e=s.get(t.target);void 0!==e&&(t.isIntersecting?a.add(e):a.delete(e))}if(a.size>0){const e=Math.min(...a);this._scrollVisibleIndex!==e&&(this._scrollVisibleIndex=e)}},{root:e,rootMargin:"0px 0px -90% 0px",threshold:0});t.forEach(e=>i.observe(e)),this._scrollObserver=i},_rebindScrollObserver(){this._scrollObserver&&(this._scrollObserver.disconnect(),this._scrollObserver=null),this._initScrollListener()},_scrollToMonth(e,t){if(!this._scrollContainerEl)return;const s=this._scrollContainerEl.querySelector(`[data-month-id="month-${e}-${t}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"start"})}}}let G={};function P(e){e.data("calendar",(t={})=>B({...G,...t},e))}P.defaults=e=>{G={...G,...e}},P.getDefaults=()=>({...G}),P.resetDefaults=()=>{G={}};let H=!1;function U(){H||window.Alpine&&(window.Alpine.plugin(P),H=!0)}window.Alpine&&U(),document.addEventListener("alpine:init",()=>{U()})}();
1
+ !function(){"use strict";class e{constructor(e,t,s){this.year=e,this.month=t,this.day=s}static today(t){const s=new Date;return t?e.fromNativeDate(s,t):new e(s.getFullYear(),s.getMonth()+1,s.getDate())}static fromNativeDate(t,s){if(s){const a=new Intl.DateTimeFormat("en-US",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(t);let i=0,n=0,r=0;for(const e of a)"year"===e.type?i=Number(e.value):"month"===e.type?n=Number(e.value):"day"===e.type&&(r=Number(e.value));return new e(i,n,r)}return new e(t.getFullYear(),t.getMonth()+1,t.getDate())}static fromISO(s){const a=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s);if(!a)return null;const i=Number(a[1]),n=Number(a[2]),r=Number(a[3]);return n<1||n>12||r<1||r>t(i,n)?null:new e(i,n,r)}toNativeDate(){return new Date(this.year,this.month-1,this.day)}toISO(){return`${String(this.year).padStart(4,"0")}-${String(this.month).padStart(2,"0")}-${String(this.day).padStart(2,"0")}`}toKey(){return this.toISO()}isSame(e){return this.year===e.year&&this.month===e.month&&this.day===e.day}isBefore(e){return this.year!==e.year?this.year<e.year:this.month!==e.month?this.month<e.month:this.day<e.day}isAfter(e){return this.year!==e.year?this.year>e.year:this.month!==e.month?this.month>e.month:this.day>e.day}isBetween(e,t){return!this.isBefore(e)&&!this.isAfter(t)}diffDays(e){const t=Date.UTC(this.year,this.month-1,this.day),s=Date.UTC(e.year,e.month-1,e.day);return Math.round((s-t)/864e5)}addDays(t){const s=this.toNativeDate();return s.setDate(s.getDate()+t),e.fromNativeDate(s)}addMonths(s){let a=this.month-1+s;const i=this.year+Math.floor(a/12);a=(a%12+12)%12;const n=t(i,a+1),r=Math.min(this.day,n);return new e(i,a+1,r)}addYears(s){const a=t(this.year+s,this.month),i=Math.min(this.day,a);return new e(this.year+s,this.month,i)}startOfMonth(){return new e(this.year,this.month,1)}endOfMonth(){return new e(this.year,this.month,t(this.year,this.month))}format(e,t){const s=this.toNativeDate();return new Intl.DateTimeFormat(t,e).format(s)}}function t(e,t){return new Date(e,t,0).getDate()}function s(e){const t=new Date(Date.UTC(e.year,e.month-1,e.day)),s=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-s);const a=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-a.getTime())/864e5+1)/7)}function a(e){return{disabledKeys:e.disabledDates?new Set(e.disabledDates.map(e=>e.toKey())):void 0,disabledDays:e.disabledDaysOfWeek?new Set(e.disabledDaysOfWeek):void 0,enabledKeys:e.enabledDates?new Set(e.enabledDates.map(e=>e.toKey())):void 0,enabledDays:e.enabledDaysOfWeek?new Set(e.enabledDaysOfWeek):void 0,disabledMonths:e.disabledMonths?new Set(e.disabledMonths):void 0,enabledMonths:e.enabledMonths?new Set(e.enabledMonths):void 0,disabledYears:e.disabledYears?new Set(e.disabledYears):void 0,enabledYears:e.enabledYears?new Set(e.enabledYears):void 0}}function i(e,t,s,a){if(t&&e.isBefore(t))return!0;if(s&&e.isAfter(s))return!0;if(a.enabledKeys&&a.enabledKeys.has(e.toKey()))return!1;if(a.enabledYears&&!a.enabledYears.has(e.year))return!0;if(a.disabledYears&&a.disabledYears.has(e.year))return!0;if(a.enabledMonths&&!a.enabledMonths.has(e.month))return!0;if(a.disabledMonths&&a.disabledMonths.has(e.month))return!0;const i=void 0!==a.enabledDays||void 0!==a.disabledDays?e.toNativeDate().getDay():-1;return!(!a.enabledDays||a.enabledDays.has(i))||(!(!a.disabledKeys||!a.disabledKeys.has(e.toKey()))||!(!a.disabledDays||!a.disabledDays.has(i)))}function n(e,t){return e.from&&e.to?t.isBetween(e.from,e.to):!!e.recurringMonths&&e.recurringMonths.has(t.month)}function r(e,t){let s;for(const a of e)n(a,t)&&(!s||a.priority>s.priority)&&(s=a);return s}function l(e){const{minDate:t,maxDate:s,rules:n}=e,l=a(e),o=null==n?void 0:n.map((e,t)=>({from:e.from,to:e.to,recurringMonths:e.months?new Set(e.months):void 0,minDate:e.minDate,maxDate:e.maxDate,minRange:e.minRange,maxRange:e.maxRange,sets:a(e),hasMinDate:void 0!==e.minDate,hasMaxDate:void 0!==e.maxDate,priority:e.priority??0,originalIndex:t}));return o&&0!==o.length?e=>{const a=r(o,e);if(!a)return i(e,t,s,l);return i(e,a.hasMinDate?a.minDate:t,a.hasMaxDate?a.maxDate:s,{disabledKeys:void 0!==a.sets.disabledKeys?a.sets.disabledKeys:l.disabledKeys,disabledDays:void 0!==a.sets.disabledDays?a.sets.disabledDays:l.disabledDays,enabledKeys:void 0!==a.sets.enabledKeys?a.sets.enabledKeys:l.enabledKeys,enabledDays:void 0!==a.sets.enabledDays?a.sets.enabledDays:l.enabledDays,disabledMonths:void 0!==a.sets.disabledMonths?a.sets.disabledMonths:l.disabledMonths,enabledMonths:void 0!==a.sets.enabledMonths?a.sets.enabledMonths:l.enabledMonths,disabledYears:void 0!==a.sets.disabledYears?a.sets.disabledYears:l.disabledYears,enabledYears:void 0!==a.sets.enabledYears?a.sets.enabledYears:l.enabledYears})}:e=>i(e,t,s,l)}function o(e){const{minRange:t,maxRange:s,rules:i}=e;if(void 0===t&&void 0===s&&(!i||i.every(e=>void 0===e.minRange&&void 0===e.maxRange)))return()=>!0;const n=null==i?void 0:i.map((e,t)=>({from:e.from,to:e.to,recurringMonths:e.months?new Set(e.months):void 0,minDate:e.minDate,maxDate:e.maxDate,minRange:e.minRange,maxRange:e.maxRange,sets:a(e),hasMinDate:void 0!==e.minDate,hasMaxDate:void 0!==e.maxDate,priority:e.priority??0,originalIndex:t}));return(e,a)=>{let i=t,l=s;if(n){const t=r(n,e);t&&(void 0!==t.minRange&&(i=t.minRange),void 0!==t.maxRange&&(l=t.maxRange))}const o=e.diffDays(a)+1;return!(void 0!==i&&o<i)&&!(void 0!==l&&o>l)}}function d(t){const{minDate:s,maxDate:a}=t,i=t.disabledMonths?new Set(t.disabledMonths):void 0,n=t.enabledMonths?new Set(t.enabledMonths):void 0,r=t.disabledYears?new Set(t.disabledYears):void 0,l=t.enabledYears?new Set(t.enabledYears):void 0;return(t,o)=>{if(s){if(new e(t,o,1).endOfMonth().isBefore(s))return!0}if(a){if(new e(t,o,1).isAfter(a))return!0}return!(!l||l.has(t))||(!(!r||!r.has(t))||(!(!n||n.has(o))||!(!i||!i.has(o))))}}function h(t){const{minDate:s,maxDate:a}=t,i=t.disabledYears?new Set(t.disabledYears):void 0,n=t.enabledYears?new Set(t.enabledYears):void 0;return t=>{if(s){if(new e(t,12,31).isBefore(s))return!0}if(a){if(new e(t,1,1).isAfter(a))return!0}return!(!n||n.has(t))||!(!i||!i.has(t))}}const c={beforeMinDate:"Before the earliest available date",afterMaxDate:"After the latest available date",disabledDate:"This date is not available",disabledDayOfWeek:"This day of the week is not available",disabledMonth:"This month is not available",disabledYear:"This year is not available",notEnabledDate:"This date is not available",notEnabledDayOfWeek:"This day of the week is not available",notEnabledMonth:"This month is not available",notEnabledYear:"This year is not available"};function u(e,t,s,a,i){const n=[];if(t&&e.isBefore(t))return n.push(i.beforeMinDate),n;if(s&&e.isAfter(s))return n.push(i.afterMaxDate),n;if(a.enabledKeys&&a.enabledKeys.has(e.toKey()))return n;if(a.enabledYears&&!a.enabledYears.has(e.year))return n.push(i.notEnabledYear),n;if(a.disabledYears&&a.disabledYears.has(e.year))return n.push(i.disabledYear),n;if(a.enabledMonths&&!a.enabledMonths.has(e.month))return n.push(i.notEnabledMonth),n;if(a.disabledMonths&&a.disabledMonths.has(e.month))return n.push(i.disabledMonth),n;const r=void 0!==a.enabledDays||void 0!==a.disabledDays?e.toNativeDate().getDay():-1;return a.enabledDays&&!a.enabledDays.has(r)&&n.push(i.notEnabledDayOfWeek),a.disabledKeys&&a.disabledKeys.has(e.toKey())&&n.push(i.disabledDate),a.disabledDays&&a.disabledDays.has(r)&&n.push(i.disabledDayOfWeek),n}function m(e,t){const{minDate:s,maxDate:i,rules:n}=e,l={...c,...t},o=a(e),d=null==n?void 0:n.map((e,t)=>({from:e.from,to:e.to,recurringMonths:e.months?new Set(e.months):void 0,minDate:e.minDate,maxDate:e.maxDate,minRange:e.minRange,maxRange:e.maxRange,sets:a(e),hasMinDate:void 0!==e.minDate,hasMaxDate:void 0!==e.maxDate,priority:e.priority??0,originalIndex:t}));return d&&0!==d.length?e=>{const t=r(d,e);if(!t)return u(e,s,i,o,l);return u(e,t.hasMinDate?t.minDate:s,t.hasMaxDate?t.maxDate:i,{disabledKeys:void 0!==t.sets.disabledKeys?t.sets.disabledKeys:o.disabledKeys,disabledDays:void 0!==t.sets.disabledDays?t.sets.disabledDays:o.disabledDays,enabledKeys:void 0!==t.sets.enabledKeys?t.sets.enabledKeys:o.enabledKeys,enabledDays:void 0!==t.sets.enabledDays?t.sets.enabledDays:o.enabledDays,disabledMonths:void 0!==t.sets.disabledMonths?t.sets.disabledMonths:o.disabledMonths,enabledMonths:void 0!==t.sets.enabledMonths?t.sets.enabledMonths:o.enabledMonths,disabledYears:void 0!==t.sets.disabledYears?t.sets.disabledYears:o.disabledYears,enabledYears:void 0!==t.sets.enabledYears?t.sets.enabledYears:o.enabledYears},l)}:e=>u(e,s,i,o,l)}function y(t,a,i=1,n,r){const l=n??e.today(),o=r??(()=>!1),d=new e(t,a,1),h=(d.toNativeDate().getDay()-i+7)%7,c=d.addDays(-h),u=[],m=[];for(let e=0;e<6;e++){const i=[];for(let s=0;s<7;s++){const n=7*e+s,r=c.addDays(n);i.push({date:r,isCurrentMonth:r.month===a&&r.year===t,isToday:r.isSame(l),isDisabled:o(r)})}const n=i[0];n&&m.push(s(n.date)),u.push(i)}return{year:t,month:a,rows:u,weekNumbers:m}}class b{constructor(e){this.selected=null,this.selected=e??null}isSelected(e){return null!==this.selected&&this.selected.isSame(e)}toggle(e){null!==this.selected&&this.selected.isSame(e)?this.selected=null:this.selected=e}clear(){this.selected=null}toArray(){return null!==this.selected?[this.selected]:[]}toValue(){return null!==this.selected?this.selected.toISO():""}getSelected(){return this.selected}}class f{constructor(e){if(this.keys=new Set,e)for(const t of e)this.keys.add(t.toKey())}isSelected(e){return this.keys.has(e.toKey())}toggle(e){const t=e.toKey();this.keys.has(t)?this.keys.delete(t):this.keys.add(t)}clear(){this.keys.clear()}toArray(){return[...this.keys].sort().map(t=>e.fromISO(t))}toValue(){return[...this.keys].sort().join(", ")}get count(){return this.keys.size}}class p{constructor(e,t){this.start=null,this.end=null,this.start=e??null,this.end=t??null}isSelected(e){return!(null===this.start||!this.start.isSame(e))||!(null===this.end||!this.end.isSame(e))}toggle(e){null===this.start?this.start=e:null===this.end?e.isBefore(this.start)?(this.end=this.start,this.start=e):e.isSame(this.start)?this.start=null:this.end=e:(this.start=e,this.end=null)}setRange(e,t){this.start=e,this.end=t}clear(){this.start=null,this.end=null}toArray(){return null===this.start?[]:null===this.end?[this.start]:[this.start,this.end]}toValue(){return null===this.start?"":null===this.end?this.start.toISO():`${this.start.toISO()} – ${this.end.toISO()}`}isInRange(e,t){if(null!==this.start&&null!==this.end)return e.isBetween(this.start,this.end);if(null!==this.start&&void 0!==t){const s=this.start.isBefore(t)?this.start:t,a=this.start.isBefore(t)?t:this.start;return e.isBetween(s,a)}return!1}getStart(){return this.start}getEnd(){return this.end}isPartial(){return null!==this.start&&null===this.end}isComplete(){return null!==this.start&&null!==this.end}}const v={YYYY:e=>String(e.year).padStart(4,"0"),YY:e=>String(e.year%100).padStart(2,"0"),MM:e=>String(e.month).padStart(2,"0"),M:e=>String(e.month),DD:e=>String(e.day).padStart(2,"0"),D:e=>String(e.day)},g=Object.keys(v).sort((e,t)=>t.length-e.length);function D(e,t){let s=t,a="";for(;s.length>0;){let t=!1;for(const i of g)if(s.startsWith(i)){const n=v[i];if(n){a+=n(e),s=s.slice(i.length),t=!0;break}}t||(a+=s[0],s=s.slice(1))}return a}const _={YYYY:{pattern:"(\\d{4})",extract:e=>Number(e)},YY:{pattern:"(\\d{2})",extract:e=>2e3+Number(e)},MM:{pattern:"(\\d{1,2})",extract:e=>Number(e)},M:{pattern:"(\\d{1,2})",extract:e=>Number(e)},DD:{pattern:"(\\d{1,2})",extract:e=>Number(e)},D:{pattern:"(\\d{1,2})",extract:e=>Number(e)}},w=Object.keys(_).sort((e,t)=>t.length-e.length);function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(s,a){const i=s.trim();if(""===i)return null;const{regex:n,extractors:r}=function(e){let t=e,s="^";const a=[];let i=1;for(;t.length>0;){let e=!1;for(const n of w)if(t.startsWith(n)){const r=_[n];if(r){s+=r.pattern,a.push({token:n,index:i}),i++,t=t.slice(n.length),e=!0;break}}e||(s+=x(t[0]),t=t.slice(1))}return s+="$",{regex:new RegExp(s),extractors:a}}(a),l=n.exec(i);if(!l)return null;let o=0,d=0,h=0;for(const{token:e,index:t}of r){const s=l[t];if(void 0===s)return null;const a=_[e];if(!a)return null;const i=a.extract(s);"YYYY"===e||"YY"===e?o=i:"MM"===e||"M"===e?d=i:"DD"!==e&&"D"!==e||(h=i)}return function(e,s,a){return!(s<1||s>12||a<1||a>t(e,s)||e<1)}(o,d,h)?new e(o,d,h):null}function M(t,s){const a=t.trim();if(""===a)return null;const i=[" – "," — "," - "];for(const n of i){const t=a.indexOf(n);if(-1!==t){const i=a.slice(0,t),r=a.slice(t+n.length),l=S(i,s)??e.fromISO(i.trim()),o=S(r,s)??e.fromISO(r.trim());if(l&&o)return[l,o]}}return null}function k(t,s){const a=t.trim();if(""===a)return[];const i=a.split(","),n=[];for(const r of i){const t=S(r,s)??e.fromISO(r.trim());t&&n.push(t)}return n}const Y={YYYY:4,YY:2,MM:2,M:2,DD:2,D:2},R=Object.keys(Y).sort((e,t)=>t.length-e.length);function O(e){return e.replace(/\D/g,"")}function z(e){let t=0;for(const s of e)s>="0"&&s<="9"&&t++;return t}function I(e,t){let s="",a=0;for(const i of t)if("digit"===i.type){if(a>=e.length)break;s+=e[a],a++}else{if(!(a>0))break;s+=i.char}return s}function $(e,t,s){if(s<=0)return 0;let a=0;for(let i=0;i<e.length&&i<t.length;i++){const n=t[i];if(n&&"digit"===n.type&&(a++,a===s)){let s=i+1;for(;s<t.length&&s<e.length;){const e=t[s];if(!e||"literal"!==e.type)break;s++}return s}}return e.length}function E(e){const t=function(e){const t=[];let s=e;for(;s.length>0;){let e=!1;for(const a of R)if(s.startsWith(a)){const i=Y[a];if(void 0===i)continue;for(let e=0;e<i;e++)t.push({type:"digit",char:"9"});s=s.slice(a.length),e=!0;break}e||(t.push({type:"literal",char:s[0]}),s=s.slice(1))}return t}(e),s=t.filter(e=>"digit"===e.type).length,a=t.map(e=>"digit"===e.type?"9":e.char).join("");return{apply:e=>I(O(e).slice(0,s),t),get pattern(){return a},get format(){return e},get length(){return t.length},get slots(){return t},get maxDigits(){return s}}}function C(e,t){const s=E(t),a=function(e){const{slots:t,maxDigits:s}=e;return{onInput:function(e){const a=e.target,i=a.value,n=a.selectionStart??i.length,r=z(i.slice(0,n)),l=I(O(i).slice(0,s),t);a.value=l;const o=$(l,t,r);a.setSelectionRange(o,o)},onKeyDown:function(e){const s=e.target,a=s.selectionStart??0;if(a===(s.selectionEnd??a)){if("Backspace"===e.key&&a>0){const i=a<=t.length?t[a-1]:void 0;if(i&&"literal"===i.type){e.preventDefault();let i=a-1;for(;i>0;){const e=t[i-1];if(!e||"literal"!==e.type)break;i--}if(i>0){const e=O(s.value),a=z(s.value.slice(0,i));if(a>0){const i=I(e.slice(0,a-1)+e.slice(a),t);s.value=i;const n=$(i,t,a-1);s.setSelectionRange(n,n)}}}}if("Delete"===e.key&&a<s.value.length){const i=a<t.length?t[a]:void 0;if(i&&"literal"===i.type){e.preventDefault();let i=a+1;for(;i<t.length;){const e=t[i];if(!e||"literal"!==e.type)break;i++}if(i<s.value.length){const e=O(s.value),a=z(s.value.slice(0,i)),n=I(e.slice(0,a)+e.slice(a+1),t);s.value=n;const r=$(n,t,a);s.setSelectionRange(r,r)}}}}},onPaste:function(e){var a;e.preventDefault();const i=e.target,n=O((null==(a=e.clipboardData)?void 0:a.getData("text"))??"");if(0===n.length)return;const r=i.selectionStart??0,l=i.selectionEnd??r,o=O(i.value),d=z(i.value.slice(0,r)),h=z(i.value.slice(r,l)),c=I((o.slice(0,d)+n+o.slice(d+h)).slice(0,s),t);i.value=c;const u=Math.min(d+n.length,s),m=$(c,t,u);i.setSelectionRange(m,m)}}}(s);return e.addEventListener("input",a.onInput),e.addEventListener("keydown",a.onKeyDown),e.addEventListener("paste",a.onPaste),e.value&&(e.value=s.apply(e.value)),()=>{e.removeEventListener("input",a.onInput),e.removeEventListener("keydown",a.onKeyDown),e.removeEventListener("paste",a.onPaste)}}function A(e){return null==e?()=>{}:"function"==typeof e?e:t=>e[t.toISO()]}function N(e){return Array.from({length:6},(t,s)=>function(e,t){return`<div class="${t?"rc-row rc-row--week-numbers":"rc-row"}" x-show="mg.rows.length > ${e}">\n ${t?`<div class="rc-week-number" x-text="mg.weekNumbers[${e}]"></div>`:""}<template x-for="cell in (mg.rows[${e}] || [])" :key="cell.date.toISO()">\n <div :class="dayClasses(cell)" :style="dayStyle(cell)" :id="'day-' + cell.date.toISO()" :aria-selected="isSelected(cell.date)" :aria-disabled="cell.isDisabled" :title="dayTitle(cell)" role="option" tabindex="-1" @click="!cell.isDisabled && selectDate(cell.date)" @mouseenter="hoverDate = cell.date" @mouseleave="hoverDate = null"><span class="rc-day__number" x-text="cell.date.day"></span><template x-if="dayMeta(cell)?.label"><span class="rc-day__label" x-text="dayMeta(cell).label"></span></template><template x-if="dayMeta(cell)?.availability === 'available' && !dayMeta(cell)?.label"><span class="rc-day__dot" aria-hidden="true"></span></template></div>\n </template>\n </div>`}(s,e)).join("\n ")}function T(e){const{display:t,isDualMonth:s,isWizard:a,hasName:i,showWeekNumbers:n,hasPresets:r,isScrollable:l,scrollHeight:o}=e,d="popup"===t,h=a?"rc-calendar rc-calendar--wizard":"rc-calendar",c=a?"Birth date wizard":"Calendar",u=[];d&&u.push(function(e){return`<div class="rc-popup-header">\n ${e?'<span class="rc-popup-header__title" x-text="wizardStepLabel"></span>':'<span class="rc-popup-header__title">Select Date</span>'}\n <button class="rc-popup-header__close" @click="close()" aria-label="Close calendar"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="4" y1="4" x2="12" y2="12"/><line x1="12" y1="4" x2="4" y2="12"/></svg></button>\n</div>`}(a)),a&&u.push('<div class="rc-wizard-steps">\n <template x-for="step in wizardTotalSteps" :key="step">\n <div class="rc-wizard-step" :class="{ \'rc-wizard-step--active\': wizardStep === step, \'rc-wizard-step--done\': wizardStep > step }"></div>\n </template>\n</div>\n<div class="rc-wizard-label" x-text="wizardStepLabel"></div>\n<template x-if="wizardStep > 1">\n <button class="rc-wizard-back" @click="wizardBack()" aria-label="Go back">&#8249; Back</button>\n</template>'),u.push('<template x-if="view === \'years\'">\n <div class="rc-view-enter">\n <div class="rc-header">\n <button class="rc-header__nav" @click="prev()" :disabled="!canGoPrev" aria-label="Previous decade">&#8249;</button>\n <span class="rc-header__label" x-text="decadeLabel"></span>\n <button class="rc-header__nav" @click="next()" :disabled="!canGoNext" aria-label="Next decade">&#8250;</button>\n </div>\n <div class="rc-year-grid" role="group" :aria-label="decadeLabel">\n <template x-for="cell in yearGrid.flat()" :key="cell.year">\n <div :class="yearClasses(cell)" :aria-disabled="cell.isDisabled" tabindex="-1" @click="!cell.isDisabled && selectYear(cell.year)" x-text="cell.label"></div>\n </template>\n </div>\n </div>\n</template>'),u.push('<template x-if="view === \'months\'">\n <div class="rc-view-enter">\n <div class="rc-header">\n <button class="rc-header__nav" @click="prev()" :disabled="!canGoPrev" aria-label="Previous year">&#8249;</button>\n <button class="rc-header__label" @click="setView(\'years\')" aria-label="Change view" x-text="yearLabel"></button>\n <button class="rc-header__nav" @click="next()" :disabled="!canGoNext" aria-label="Next year">&#8250;</button>\n </div>\n <div class="rc-month-grid" role="group" :aria-label="yearLabel">\n <template x-for="cell in monthGrid.flat()" :key="cell.month">\n <div :class="monthClasses(cell)" :aria-disabled="cell.isDisabled" tabindex="-1" @click="!cell.isDisabled && selectMonth(cell.month)" x-text="cell.label"></div>\n </template>\n </div>\n </div>\n</template>'),l?u.push(function(e,t){return`<template x-if="view === 'days'">\n <div>\n <div class="rc-header rc-header--scroll-sticky">\n <span class="rc-header__label rc-header__label--scroll" x-text="scrollHeaderLabel"></span>\n </div>\n ${e?'<div class="rc-weekdays rc-weekdays--week-numbers">\n <span class="rc-weekday rc-week-label"></span>\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>':'<div class="rc-weekdays">\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>'}\n <div class="rc-months rc-months--scroll" style="max-height: ${t}px">\n <template x-for="(mg, gi) in grid" :key="mg.year + '-' + mg.month">\n <div :data-month-id="'month-' + mg.year + '-' + mg.month">\n <div class="rc-header rc-header--scroll" x-show="gi > 0">\n <span class="rc-header__label rc-header__label--scroll" x-text="monthYearLabel(gi)"></span>\n </div>\n <div class=${e?'"rc-grid rc-grid--week-numbers"':'"rc-grid"'} role="listbox" :aria-label="monthYearLabel(gi)">\n ${N(e)}\n </div>\n </div>\n </template>\n </div>\n </div>\n</template>`}(n,o)):u.push(function(e,t){return`<template x-if="view === 'days'">\n <div class="rc-months${e?"":" rc-view-enter"}"${e?" :class=\"{ 'rc-months--dual': monthCount === 2 }\"":""}>\n <template x-for="(mg, gi) in grid" :key="mg.year + '-' + mg.month">\n <div>\n <div class="rc-header">\n <button class="rc-header__nav" @click="prev()" :disabled="!canGoPrev" aria-label="Previous month"${e?" :class=\"{ 'rc-nav--dual-hidden': gi > 0 }\"":""}>&#8249;</button>\n <button class="rc-header__label" @click="setView('months')" aria-label="Change view" x-text="monthYearLabel(gi)"></button>\n <button class="rc-header__nav" @click="next()" :disabled="!canGoNext" aria-label="Next month"${e?" :class=\"{ 'rc-nav--dual-next-first': gi === 0, 'rc-nav--dual-next-last': gi > 0 }\"":""}>&#8250;</button>\n </div>\n ${t?'<div class="rc-weekdays rc-weekdays--week-numbers">\n <span class="rc-weekday rc-week-label"></span>\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>':'<div class="rc-weekdays">\n <template x-for="wd in weekdayHeaders" :key="wd">\n <span class="rc-weekday" x-text="wd"></span>\n </template>\n </div>'}\n <div class="rc-grid-wrapper">\n <div class=${t?'"rc-grid rc-grid--week-numbers"':'"rc-grid"'} :class="{ 'rc-grid--slide-next': _navDirection === 'next', 'rc-grid--slide-prev': _navDirection === 'prev' }" @animationend="_navDirection = ''" role="listbox" :aria-label="monthYearLabel(gi)">\n ${N(t)}\n </div>\n </div>\n </div>\n </template>\n </div>\n</template>`}(s,n)),r&&u.push('<div class="rc-presets" role="group" aria-label="Quick select">\n <template x-for="(preset, pi) in presets" :key="pi">\n <button class="rc-preset" @click="applyPreset(pi)" x-text="preset.label"></button>\n </template>\n</div>'),a&&u.push('<div class="rc-wizard-summary" x-show="wizardSummary" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 transform translate-y-1" x-transition:enter-end="opacity-100 transform translate-y-0" x-text="wizardSummary"></div>'),i&&u.push('<template x-if="inputName">\n <template x-for="val in hiddenInputValues" :key="val">\n <input type="hidden" :name="inputName" :value="val">\n </template>\n</template>');const m=`<div class="${h}" @keydown="handleKeydown($event)" tabindex="0" :aria-activedescendant="focusedDateISO ? 'day-' + focusedDateISO : null" role="application" aria-label="${c}">\n<div class="rc-sr-only" role="status" aria-live="polite" aria-atomic="true" x-text="_statusMessage"></div>\n${u.join("\n")}\n</div>`;return d?`<div x-ref="popup" x-show="isOpen" :style="popupStyle" class="rc-popup-overlay" @click.self="close()" role="dialog" aria-modal="true" :aria-label="popupAriaLabel" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0">\n${m}\n</div>`:m}function L(t){return e.fromISO(t)}function K(t){return t.map(t=>e.fromISO(t)).filter(e=>null!==e)}function V(t,s){const a={};if(t.minDate){const s=e.fromISO(t.minDate);s&&(a.minDate=s)}if(t.maxDate){const s=e.fromISO(t.maxDate);s&&(a.maxDate=s)}if(t.disabledDates&&(a.disabledDates=K(t.disabledDates)),t.disabledDaysOfWeek&&(a.disabledDaysOfWeek=t.disabledDaysOfWeek),t.enabledDates&&(a.enabledDates=K(t.enabledDates)),t.enabledDaysOfWeek&&(a.enabledDaysOfWeek=t.enabledDaysOfWeek),t.disabledMonths&&(a.disabledMonths=t.disabledMonths),t.enabledMonths&&(a.enabledMonths=t.enabledMonths),t.disabledYears&&(a.disabledYears=t.disabledYears),t.enabledYears&&(a.enabledYears=t.enabledYears),void 0!==t.minRange&&(a.minRange=t.minRange),void 0!==t.maxRange&&(a.maxRange=t.maxRange),t.rules){const e=t.rules.map(e=>function(e){const t=e.from?L(e.from):null,s=e.to?L(e.to):null,a=null!==t&&null!==s,i=Array.isArray(e.months)&&e.months.length>0;if(!a&&!i)return null;const n={};if(a&&(n.from=t,n.to=s),i&&(n.months=e.months),void 0!==e.priority&&(n.priority=e.priority),e.minDate){const t=L(e.minDate);t&&(n.minDate=t)}if(e.maxDate){const t=L(e.maxDate);t&&(n.maxDate=t)}return e.disabledDates&&(n.disabledDates=K(e.disabledDates)),e.disabledDaysOfWeek&&(n.disabledDaysOfWeek=e.disabledDaysOfWeek),e.enabledDates&&(n.enabledDates=K(e.enabledDates)),e.enabledDaysOfWeek&&(n.enabledDaysOfWeek=e.enabledDaysOfWeek),e.disabledMonths&&(n.disabledMonths=e.disabledMonths),e.enabledMonths&&(n.enabledMonths=e.enabledMonths),e.disabledYears&&(n.disabledYears=e.disabledYears),e.enabledYears&&(n.enabledYears=e.enabledYears),void 0!==e.minRange&&(n.minRange=e.minRange),void 0!==e.maxRange&&(n.maxRange=e.maxRange),n}(e)).filter(e=>null!==e);e.length>0&&(a.rules=e)}return{isDisabledDate:l(a),isRangeValid:o(a),isMonthDisabled:d(a),isYearDisabled:h(a),getDisabledReasons:m(a,s)}}const F=["minDate","maxDate","disabledDates","disabledDaysOfWeek","enabledDates","enabledDaysOfWeek","disabledMonths","enabledMonths","disabledYears","enabledYears","minRange","maxRange","rules"];function W(e){const t={};for(const s of F)void 0!==e[s]&&(t[s]=e[s]);return t}function G(t={},s){!function(t){const s=e=>console.warn(`[reach-calendar] ${e}`);if(void 0!==t.months&&(t.months<1||!Number.isInteger(t.months))&&s(`months must be a positive integer, got: ${t.months}`),void 0!==t.mobileMonths){(t.mobileMonths<1||!Number.isInteger(t.mobileMonths))&&s(`mobileMonths must be a positive integer, got: ${t.mobileMonths}`);const e=t.months??1;t.mobileMonths>=e&&s(`mobileMonths (${t.mobileMonths}) should be less than months (${e})`),2!==e&&s(`mobileMonths is only supported when months is 2; current months: ${e}`)}if(t.wizard&&t.months&&t.months>=3&&s("months >= 3 (scrollable) is not compatible with wizard mode; using months: 1"),void 0!==t.firstDay&&(t.firstDay<0||t.firstDay>6)&&s(`firstDay must be 0-6, got: ${t.firstDay}`),t.minDate&&!e.fromISO(t.minDate)&&s(`invalid minDate: "${t.minDate}"`),t.maxDate&&!e.fromISO(t.maxDate)&&s(`invalid maxDate: "${t.maxDate}"`),t.minDate&&t.maxDate){const a=e.fromISO(t.minDate),i=e.fromISO(t.maxDate);a&&i&&a.isAfter(i)&&s(`minDate "${t.minDate}" is after maxDate "${t.maxDate}"`)}if(void 0!==t.minRange&&void 0!==t.maxRange&&t.minRange>t.maxRange&&s(`minRange (${t.minRange}) exceeds maxRange (${t.maxRange})`),t.wizard&&t.mode&&"single"!==t.mode&&s(`wizard mode is designed for single selection; mode "${t.mode}" may not work as expected`),t.timezone)try{Intl.DateTimeFormat(void 0,{timeZone:t.timezone})}catch{s(`invalid timezone: "${t.timezone}"`)}}(t);const a=t.mode??"single",i=t.display??"inline",n=t.format??"DD/MM/YYYY",r=t.firstDay??1;let l=t.timezone;if(l)try{Intl.DateTimeFormat(void 0,{timeZone:l})}catch{l=void 0}const o=t.wizard??!1,d=t.months??1,h=o&&d>=3?1:d,c=h>=3,u=2===h&&void 0!==t.mobileMonths,m=u?Math.max(1,Math.min(t.mobileMonths,h)):h,v=u&&m!==h&&"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(max-width: 639px)"):null,g=(null==v?void 0:v.matches)?m:h,_=t.scrollHeight??400,w=!!o,x=!0===o?"full":!1===o?"none":o,Y="none"===x?0:"full"===x?3:2,R="full"===x||"year-month"===x?"years":"month-day"===x?"months":"days",O=t.mask??!0,z=t.showWeekNumbers??!1,I=t.presets??[],$=t.name??"",E=t.inputId??null,N=t.inputRef??"rc-input",L=t.locale,K=t.closeOnSelect??!0,G=t.beforeSelect??null,B=t.constraintMessages,P=V(t,B),H=A(t.dateMetadata);const U="multiple"===a?new f:"range"===a?new p:new b,j=e=>{var t;return P.isDisabledDate(e)||"unavailable"===(null==(t=H(e))?void 0:t.availability)};if(t.value)if("single"===a){const s=S(t.value,n)??e.fromISO(t.value);s&&!j(s)&&U.toggle(s)}else if("range"===a){const e=M(t.value,n);if(e){let[t,s]=e;if(s.isBefore(t)){const e=t;t=s,s=e}j(t)||j(s)||!P.isRangeValid(t,s)||(U.toggle(t),U.toggle(s))}}else if("multiple"===a){const e=k(t.value,n);for(const t of e)j(t)||U.toggle(t)}const q=e.today(l),Q=U.toArray(),Z=Q.length>0?Q[0]:q,J="full"===x||"year-month"===x?new e(q.year-30,q.month,q.day):Z;function X(e){const t=e.toArray();if(0===t.length)return"";const s=t[0];return"range"===a&&2===t.length?function(e,t,s){return`${D(e,s)} – ${D(t,s)}`}(s,t[1],n):"multiple"===a?function(e,t){return 0===e.length?"":e.map(e=>D(e,t)).join(", ")}(t,n):D(s,n)}return{mode:a,display:i,format:n,monthCount:g,firstDay:r,wizard:w,wizardMode:x,wizardTotalSteps:Y,showWeekNumbers:z,presets:I,inputName:$,_mediaQueryCleanup:null,month:J.month,year:J.year,view:w?R:"days",isOpen:"inline"===i,grid:[],monthGrid:[],yearGrid:[],inputValue:X(U),popupStyle:"popup"===i?"position:fixed;inset:0;z-index:50;":"",focusedDate:null,hoverDate:null,wizardStep:w?1:0,_wizardYear:null,_wizardMonth:null,_wizardDay:null,_navDirection:"",_selection:U,_today:q,_constraintConfig:W(t),_isDisabledDate:P.isDisabledDate,_isRangeValid:P.isRangeValid,_isMonthDisabled:P.isMonthDisabled,_isYearDisabled:P.isYearDisabled,_getDisabledReasons:P.getDisabledReasons,_inputEl:null,_detachInput:null,_syncing:!1,_suppressFocusOpen:!1,_Alpine:s??null,_autoRendered:!1,_popupOverlayEl:null,isScrollable:c,_scrollHeight:_,_scrollContainerEl:null,_scrollObserver:null,_scrollVisibleIndex:0,_selectionRev:0,_getDateMeta:H,_metadataRev:0,_isEffectivelyDisabled(e){var t;return!!this._isDisabledDate(e)||"unavailable"===(null==(t=this._getDateMeta(e))?void 0:t.availability)},_statusMessage:"",get selectedDates(){return this._selection.toArray()},get formattedValue(){return X(this._selection)},get hiddenInputValues(){return this._selection.toArray().map(e=>e.toISO())},get focusedDateISO(){return this.focusedDate?this.focusedDate.toISO():""},get inputId(){return E},get inputAriaLabel(){return"range"===a?"Select date range":"multiple"===a?"Select dates":w?"Select birth date":"Select date"},get popupAriaLabel(){return w?"Birth date wizard":"range"===a?"Date range picker":"Date picker"},get wizardStepLabel(){return this.wizard?"full"===x?1===this.wizardStep?"Select Year":2===this.wizardStep?"Select Month":"Select Day":"year-month"===x?1===this.wizardStep?"Select Year":"Select Month":"month-day"===x?1===this.wizardStep?"Select Month":"Select Day":"":""},get wizardSummary(){if(!w)return"";const t=[];if(null!==this._wizardYear&&t.push(String(this._wizardYear)),null!==this._wizardMonth){const s=new e(this._wizardYear??this.year,this._wizardMonth,1);t.push(s.format({month:"long"},L))}return null!==this._wizardDay&&t.push(String(this._wizardDay)),t.join(" · ")},get weekdayHeaders(){const e=[],t=new Date(2026,0,4);for(let s=0;s<7;s++){const a=(this.firstDay+s)%7,i=new Date(t);i.setDate(t.getDate()+a),e.push(new Intl.DateTimeFormat(L,{weekday:"short"}).format(i))}return e},init(){var e;const s=this.$el;if(!(null!==s.querySelector(".rc-calendar"))&&!1!==t.template&&(null==(e=this._Alpine)?void 0:e.initTree)){const e=document.createRange().createContextualFragment(T({display:this.display,isDualMonth:2===h,isWizard:"none"!==this.wizardMode,hasName:!!this.inputName,showWeekNumbers:this.showWeekNumbers,hasPresets:this.presets.length>0,isScrollable:this.isScrollable,scrollHeight:this._scrollHeight})),t=Array.from(e.children).filter(e=>e instanceof HTMLElement);s.appendChild(e);for(const s of t)this._Alpine.initTree(s);if(this._autoRendered=!0,"popup"===i){const e=s.querySelector(".rc-popup-overlay");e&&(document.body.appendChild(e),this._popupOverlayEl=e)}}if(this._rebuildGrid(),this._rebuildMonthGrid(),this._rebuildYearGrid(),this.$watch("month",()=>{this._rebuildGrid(),this._emitNavigate(),this._announceNavigation(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})}),this.$watch("year",()=>{this._rebuildGrid(),this._rebuildMonthGrid(),this._rebuildYearGrid(),this._emitNavigate(),this._announceNavigation(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})}),this.$watch("view",()=>{this._emitViewChange(),this._announceViewChange()}),this.$nextTick(()=>{const e=this.$refs;e&&e[N]&&e[N]instanceof HTMLInputElement?this.bindInput(e[N]):"popup"===this.display&&console.warn(`[reach-calendar] Popup mode requires an <input x-ref="${N}"> inside the component container.`),this.isScrollable&&this._initScrollListener()}),v){const e=e=>{const t=e.matches?m:h;t!==this.monthCount&&(this.monthCount=t,this._rebuildGrid())};v.addEventListener("change",e),this._mediaQueryCleanup=()=>{v.removeEventListener("change",e)}}},destroy(){var e,t;if(this._mediaQueryCleanup&&(this._mediaQueryCleanup(),this._mediaQueryCleanup=null),this._scrollObserver&&(this._scrollObserver.disconnect(),this._scrollObserver=null),this._scrollContainerEl=null,this._detachInput&&(this._detachInput(),this._detachInput=null),this._inputEl=null,this._popupOverlayEl&&(this._popupOverlayEl.remove(),this._popupOverlayEl=null),this._autoRendered){const s=this.$el;null==(e=s.querySelector(".rc-popup-overlay"))||e.remove(),null==(t=s.querySelector(".rc-calendar"))||t.remove(),this._autoRendered=!1}},_rebuildGrid(){this.grid=function(e,t,s,a=1,i,n){const r=[];for(let l=0;l<s;l++){let s=t+l,o=e;for(;s>12;)s-=12,o++;r.push(y(o,s,a,i,n))}return r}(this.year,this.month,this.monthCount,this.firstDay,this._today,e=>this._isEffectivelyDisabled(e))},_rebuildMonthGrid(){this.monthGrid=function(t,s,a,i){const n=s??e.today(),r=i??(()=>!1),l=[];for(let o=0;o<3;o++){const s=[];for(let i=0;i<4;i++){const l=4*o+i+1,d=new e(t,l,1);s.push({month:l,year:t,label:d.format({month:"short"},a),isCurrentMonth:n.month===l&&n.year===t,isDisabled:r(t,l)})}l.push(s)}return l}(this.year,this._today,L,this._isMonthDisabled)},_rebuildYearGrid(){this.yearGrid=function(t,s,a){const i=s??e.today(),n=a??(()=>!1),r=12*Math.floor(t/12),l=[];for(let e=0;e<3;e++){const t=[];for(let s=0;s<4;s++){const a=r+4*e+s;t.push({year:a,label:String(a),isCurrentYear:i.year===a,isDisabled:n(a)})}l.push(t)}return l}(this.year,this._today,this._isYearDisabled)},dayGridItems(e){const t=[];for(let s=0;s<e.rows.length;s++){const a=e.rows[s];if(!a||0===a.length)continue;const i=a[0];t.push({isWeekNumber:!0,weekNumber:e.weekNumbers[s]??0,cell:i,key:`wn-${s}`});for(const e of a)t.push({isWeekNumber:!1,weekNumber:0,cell:e,key:e.date.toISO()})}return t},get yearLabel(){return String(this.year)},get decadeLabel(){const e=12*Math.floor(this.year/12);return`${e} – ${e+11}`},get canGoPrev(){if("days"===this.view){if(this.isScrollable)return!1;const t=new e(this.year,this.month,1).addMonths(-1);return!this._isMonthDisabled(t.year,t.month)}if("months"===this.view)return!this._isYearDisabled(this.year-1);if("years"===this.view){const e=12*Math.floor(this.year/12);for(let t=e-12;t<e;t++)if(!this._isYearDisabled(t))return!0;return!1}return!0},get canGoNext(){if("days"===this.view){if(this.isScrollable)return!1;const t=new e(this.year,this.month,1).addMonths(1);return!this._isMonthDisabled(t.year,t.month)}if("months"===this.view)return!this._isYearDisabled(this.year+1);if("years"===this.view){const e=12*Math.floor(this.year/12);for(let t=e+12;t<e+24;t++)if(!this._isYearDisabled(t))return!0;return!1}return!0},yearClasses(e){const t=this.year===e.year&&"months"===this.view;return{"rc-year":!0,"rc-year--current":e.isCurrentYear,"rc-year--selected":t,"rc-year--disabled":e.isDisabled}},monthClasses(e){const t=this.month===e.month&&"days"===this.view;return{"rc-month":!0,"rc-month--current":e.isCurrentMonth,"rc-month--selected":t,"rc-month--disabled":e.isDisabled}},monthYearLabel(t){const s=this.grid[t];if(!s)return"";return new e(s.year,s.month,1).format({month:"long",year:"numeric"},L)},dayClasses(e){this._selectionRev,this._metadataRev;const t=e.date,s=this.isSelected(t),i=this.isRangeStart(t),n=this.isRangeEnd(t),r=this.isInRange(t,this.hoverDate??void 0),l=!e.isCurrentMonth;let o=!1;"range"!==a||null===this.hoverDate||e.isDisabled||s||!this._selection.isPartial()||(o=!this.isDateSelectableForRange(t));const d=this._getDateMeta(t),h=!!(null==d?void 0:d.label),c="available"===(null==d?void 0:d.availability),u="unavailable"===(null==d?void 0:d.availability),m={"rc-day":!0,"rc-day--today":e.isToday,"rc-day--selected":s,"rc-day--range-start":i,"rc-day--range-end":n,"rc-day--in-range":r&&!i&&!n,"rc-day--disabled":e.isDisabled,"rc-day--other-month":l,"rc-day--hidden":l&&this.monthCount>1,"rc-day--focused":null!==this.focusedDate&&this.focusedDate.isSame(t),"rc-day--range-invalid":o,"rc-day--available":c,"rc-day--unavailable":u,"rc-day--has-label":h};if(null==d?void 0:d.cssClass)for(const a of d.cssClass.split(/\s+/))a&&(m[a]=!0);return m},dayTitle(e){this._metadataRev;const t=this._getDateMeta(e.date),s=[];if(e.isDisabled){const a=this._getDisabledReasons(e.date);a.length>0?s.push(a.join("; ")):"unavailable"===(null==t?void 0:t.availability)&&s.push("Unavailable")}return(null==t?void 0:t.label)&&s.push(t.label),s.join(" — ")},dayMeta(e){return this._metadataRev,this._getDateMeta(e.date)},dayStyle(e){this._metadataRev;const t=this._getDateMeta(e.date);return(null==t?void 0:t.color)?`--color-calendar-day-meta: ${t.color};`:""},bindInput(e){this._detachInput&&(this._detachInput(),this._detachInput=null),this._inputEl=e,e.value=this.inputValue,O&&(this._detachInput=C(e,n),this.inputValue=e.value);const t=()=>{this._syncing||(this.inputValue=e.value)};e.addEventListener("input",t);const s=()=>this.handleFocus(),a=()=>this.handleBlur();e.addEventListener("focus",s),e.addEventListener("blur",a),"popup"===i&&(e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded",String(this.isOpen)),e.setAttribute("autocomplete","off"),E&&!e.id&&(e.id=E),e.getAttribute("aria-label")||e.setAttribute("aria-label",this.inputAriaLabel));const r=this._detachInput;this._detachInput=()=>{null==r||r(),e.removeEventListener("input",t),e.removeEventListener("focus",s),e.removeEventListener("blur",a),"popup"===i&&(e.removeAttribute("role"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("autocomplete"))},e.placeholder||(e.placeholder=n.toLowerCase())},handleInput(e){const t=e.target;this.inputValue=t.value},handleFocus(){this._suppressFocusOpen?this._suppressFocusOpen=!1:this.open()},handleBlur(){const t=this._inputEl?this._inputEl.value:this.inputValue;if(!t.trim())return this._selection.toArray().length>0&&(this._selection.clear(),this._selectionRev++,this._emitChange()),void this._syncInputFromSelection();let s=!1;if("single"===a){const a=S(t,n)??e.fromISO(t);a&&!this._isEffectivelyDisabled(a)&&(this._selection.clear(),this._selection.toggle(a),this.month=a.month,this.year=a.year,s=!0)}else if("range"===a){const e=M(t,n);if(e){let[t,a]=e;if(a.isBefore(t)){const e=t;t=a,a=e}this._isEffectivelyDisabled(t)||this._isEffectivelyDisabled(a)||!this._isRangeValid(t,a)||(this._selection.clear(),this._selection.toggle(t),this._selection.toggle(a),this.month=t.month,this.year=t.year,s=!0)}}else if("multiple"===a){const e=k(t,n).filter(e=>!this._isEffectivelyDisabled(e));if(e.length>0){this._selection.clear();for(const s of e)this._selection.toggle(s);const t=e[0];this.month=t.month,this.year=t.year,s=!0}}s&&(this._selectionRev++,this._emitChange()),this._syncInputFromSelection()},_syncInputFromSelection(){this._syncing=!0,this.inputValue=this.formattedValue,this._inputEl&&(this._inputEl.value=this.inputValue),this._syncing=!1},_announce(e){this._statusMessage="",this.$nextTick(()=>{this._statusMessage=e})},_announceNavigation(){if("days"===this.view)if(this.monthCount>1&&!this.isScrollable){const e=[];for(let t=0;t<this.grid.length;t++)e.push(this.monthYearLabel(t));this._announce(e.join(" – "))}else this._announce(this.monthYearLabel(0));else"months"===this.view?this._announce("Year: "+this.year):"years"===this.view&&this._announce("Decade: "+this.decadeLabel)},_announceViewChange(){"days"===this.view?this._announce(this.monthYearLabel(0)):"months"===this.view?this._announce("Select month, "+this.year):"years"===this.view&&this._announce("Select year, "+this.decadeLabel)},_emitChange(){this.$dispatch("calendar:change",{value:this._selection.toValue(),dates:this._selection.toArray().map(e=>e.toISO()),formatted:this.formattedValue})},_emitNavigate(){this.$dispatch("calendar:navigate",{year:this.year,month:this.month,view:this.view})},_emitViewChange(){this.$dispatch("calendar:view-change",{view:this.view,year:this.year,month:this.month})},prev(){if(this._navDirection="prev","days"===this.view){if(this.isScrollable)return;const t=new e(this.year,this.month,1).addMonths(-1);this.month=t.month,this.year=t.year}else"months"===this.view?this.year--:"years"===this.view&&(this.year-=12)},next(){if(this._navDirection="next","days"===this.view){if(this.isScrollable)return;const t=new e(this.year,this.month,1).addMonths(1);this.month=t.month,this.year=t.year}else"months"===this.view?this.year++:"years"===this.view&&(this.year+=12)},goToToday(){this.month=this._today.month,this.year=this._today.year,this.view="days"},selectDate(t){const s="string"==typeof t?e.fromISO(t):t;if(!s)return;if(this._isEffectivelyDisabled(s))return;if("range"===a){const e=this._selection,t=e.getStart();if(e.isPartial()&&t&&!s.isSame(t)){let e=t,a=s;if(a.isBefore(e)){const t=e;e=a,a=t}if(!this._isRangeValid(e,a))return}}if(G){const e=this._selection.isSelected(s)?"deselect":"select";if(!1===G(s,{mode:a,selectedDates:this._selection.toArray(),action:e}))return}const n=this._selection.isSelected(s),r="range"===a&&this._selection.isPartial();this._selection.toggle(s),w&&(this._wizardDay=s.day),this._selectionRev++,this._emitChange(),this._syncInputFromSelection();const l=s.format({weekday:"long",month:"long",day:"numeric",year:"numeric"},L);if("single"===a)this._announce(l+" selected");else if("multiple"===a){const e=this._selection.toArray().length;n?this._announce(l+" deselected. "+e+" dates selected"):this._announce(l+" selected. "+e+" dates selected")}else if("range"===a){const e=this._selection;if(e.isPartial())this._announce("Range start: "+l+". Select end date");else if(r){const t=e.toArray();if(2===t.length){const e=t[0].format({weekday:"long",month:"long",day:"numeric",year:"numeric"},L),s=t[1].format({weekday:"long",month:"long",day:"numeric",year:"numeric"},L);this._announce("Range: "+e+" to "+s)}}}if(K&&"popup"===i&&this.isOpen){("single"===a||"range"===a&&!this._selection.isPartial()||"multiple"===a)&&this.close()}},isSelected(e){return this._selection.isSelected(e)},isInRange(e,t){return"range"===a&&this._selection.isInRange(e,t)},isRangeStart(e){if("range"!==a)return!1;const t=this._selection.getStart();return null!==t&&e.isSame(t)},isRangeEnd(e){if("range"!==a)return!1;const t=this._selection.getEnd();return null!==t&&e.isSame(t)},isDateSelectableForRange(e){if("range"!==a)return!1;if(this._isEffectivelyDisabled(e))return!1;const t=this._selection;if(!t.isPartial())return!0;const s=t.getStart();if(!s)return!0;if(e.isSame(s))return!0;let i=s,n=e;if(n.isBefore(i)){const e=i;i=n,n=e}return this._isRangeValid(i,n)},getDisabledReason(t){const s="string"==typeof t?e.fromISO(t):t;return s?this._getDisabledReasons(s):[]},clearSelection(){this._selection.clear(),this._selectionRev++,this._emitChange(),this._syncInputFromSelection(),this._announce("Selection cleared")},setValue(t){this._selection.clear();const s=[];if("string"==typeof t){const a=e.fromISO(t)??S(t,n);a&&!this._isEffectivelyDisabled(a)&&s.push(a)}else if(Array.isArray(t))for(const a of t){const t="string"==typeof a?e.fromISO(a)??S(a,n):a;t&&!this._isEffectivelyDisabled(t)&&s.push(t)}else t instanceof e&&(this._isEffectivelyDisabled(t)||s.push(t));if("range"===a&&2===s.length){let[e,t]=s;if(t.isBefore(e)){const s=e;e=t,t=s}if(!this._isRangeValid(e,t))return this._selectionRev++,this._emitChange(),void this._syncInputFromSelection();this._selection.setRange(e,t)}else for(const e of s)this._selection.toggle(e);const i=this._selection.toArray();if(i.length>0){const e=i[0];this.month=e.month,this.year=e.year}this._selectionRev++,this._emitChange(),this._syncInputFromSelection()},clear(){this.clearSelection()},goTo(e,t){this.year=e,void 0!==t&&(this.month=t),this.view="days",this.isScrollable&&(this._rebuildGrid(),this.$nextTick(()=>{this._rebindScrollObserver(),this._scrollToMonth(e,t??this.month)}))},getSelection(){return[...this._selection.toArray()]},applyPreset(e){const t=this.presets[e];if(!t)return;const[s,i]=t.value();"single"===a?this.setValue(s):this.setValue([s,i]),"popup"===this.display&&K&&this.close()},updateConstraints(e){const t={...this._constraintConfig};for(const a of F)a in e&&(t[a]=e[a]);this._constraintConfig=t;const s=V(t,B);this._isDisabledDate=s.isDisabledDate,this._isRangeValid=s.isRangeValid,this._isMonthDisabled=s.isMonthDisabled,this._isYearDisabled=s.isYearDisabled,this._getDisabledReasons=s.getDisabledReasons,this._rebuildGrid(),this._rebuildMonthGrid(),this._rebuildYearGrid(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})},updateDateMetadata(e){this._getDateMeta=A(e),this._metadataRev++,this._rebuildGrid(),this.isScrollable&&this.$nextTick(()=>{this._rebindScrollObserver()})},setView(e){this.view=e},selectMonth(t){if(!this._isMonthDisabled(this.year,t)){if(this.month=t,this._wizardMonth=t,"year-month"===x)return this.wizardStep=Y,void this.selectDate(new e(this.year,t,1));this.view="days",w&&(this.wizardStep="month-day"===x?2:3)}},selectYear(e){this._isYearDisabled(e)||(this.year=e,this._wizardYear=e,this.view="months",this.wizard&&(this.wizardStep=2))},wizardBack(){this.wizard&&("full"===x?3===this.wizardStep?(this.wizardStep=2,this.view="months",this._wizardMonth=null,this._wizardDay=null):2===this.wizardStep&&(this.wizardStep=1,this.view="years",this._wizardYear=null,this._wizardMonth=null):"year-month"===x?2===this.wizardStep&&(this.wizardStep=1,this.view="years",this._wizardYear=null,this._wizardMonth=null):"month-day"===x&&2===this.wizardStep&&(this.wizardStep=1,this.view="months",this._wizardMonth=null))},open(){var e;"popup"===this.display&&(w&&(this.wizardStep=1,this.view=R,this._wizardYear=null,this._wizardMonth=null,this._wizardDay=null,"month-day"!==x&&(this.year=this._today.year-30,this._rebuildYearGrid())),this.isOpen=!0,null==(e=this._inputEl)||e.setAttribute("aria-expanded","true"),this.$dispatch("calendar:open"),this.$nextTick(()=>{}))},close(){var e;"popup"===this.display&&(this.isOpen=!1,null==(e=this._inputEl)||e.setAttribute("aria-expanded","false"),this.$dispatch("calendar:close"))},toggle(){this.isOpen?this.close():this.open()},handleKeydown(t){if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),this.wizard&&this.wizardStep>1?void this.wizardBack():"months"===this.view||"years"===this.view?void(this.view="days"):void("popup"===i&&this.isOpen&&(this.close(),this._inputEl&&(this._suppressFocusOpen=!0,this._inputEl.focus())));if("days"===this.view)switch(t.key){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":case"PageDown":case"PageUp":case"Home":case"End":if(t.preventDefault(),!this.focusedDate){const t=this._selection.toArray();t.length>0?this.focusedDate=t[0]:this.focusedDate=new e(this.year,this.month,1)}return void("ArrowRight"===t.key?this._moveFocus(1):"ArrowLeft"===t.key?this._moveFocus(-1):"ArrowDown"===t.key?this._moveFocus(7):"ArrowUp"===t.key?this._moveFocus(-7):"PageDown"===t.key?this._moveFocusByMonths(t.shiftKey?12:1):"PageUp"===t.key?this._moveFocusByMonths(t.shiftKey?-12:-1):"Home"===t.key?this._setFocusedDate(new e(this.year,this.month,1)):"End"===t.key&&this._setFocusedDate(new e(this.year,this.month,1).endOfMonth()));case"Enter":case" ":return void(this.focusedDate&&(t.preventDefault(),this.selectDate(this.focusedDate)))}},_moveFocus(e){if(!this.focusedDate)return;let t=this.focusedDate.addDays(e),s=0;for(;this._isEffectivelyDisabled(t)&&s<31;)t=t.addDays(e>0?1:-1),s++;this._isEffectivelyDisabled(t)||this._setFocusedDate(t)},_moveFocusByMonths(e){if(!this.focusedDate)return;const t=this.focusedDate.addMonths(e);this._setFocusedDate(t)},_setFocusedDate(e){this.focusedDate=e,this.isScrollable?this.$nextTick(()=>{this._scrollToMonth(e.year,e.month)}):e.month===this.month&&e.year===this.year||(this.month=e.month,this.year=e.year)},get scrollHeaderLabel(){if(!this.isScrollable)return"";const t=this.grid[this._scrollVisibleIndex];if(!t)return"";return new e(t.year,t.month,1).format({month:"long",year:"numeric"},L)},_initScrollListener(){if("undefined"==typeof IntersectionObserver)return;const e=this.$el.querySelector(".rc-months--scroll");if(!e)return;this._scrollContainerEl=e;const t=e.querySelectorAll("[data-month-id]");if(0===t.length)return;const s=new Map;t.forEach((e,t)=>s.set(e,t));const a=new Set,i=new IntersectionObserver(e=>{for(const t of e){const e=s.get(t.target);void 0!==e&&(t.isIntersecting?a.add(e):a.delete(e))}if(a.size>0){const e=Math.min(...a);this._scrollVisibleIndex!==e&&(this._scrollVisibleIndex=e)}},{root:e,rootMargin:"0px 0px -90% 0px",threshold:0});t.forEach(e=>i.observe(e)),this._scrollObserver=i},_rebindScrollObserver(){this._scrollObserver&&(this._scrollObserver.disconnect(),this._scrollObserver=null),this._initScrollListener()},_scrollToMonth(e,t){if(!this._scrollContainerEl)return;const s=this._scrollContainerEl.querySelector(`[data-month-id="month-${e}-${t}"]`);s&&s.scrollIntoView({behavior:"smooth",block:"start"})}}}let B={};function P(e){e.data("calendar",(t={})=>G({...B,...t},e))}P.defaults=e=>{B={...B,...e}},P.getDefaults=()=>({...B}),P.resetDefaults=()=>{B={}};let H=!1;function U(){H||window.Alpine&&(window.Alpine.plugin(P),H=!0)}window.Alpine&&U(),document.addEventListener("alpine:init",()=>{U()})}();
2
2
  //# sourceMappingURL=alpine-calendar.cdn.js.map