@oslokommune/punkt-elements 12.36.1 → 12.36.2
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/CHANGELOG.md +17 -0
- package/dist/calendar-CYY42kN4.cjs +108 -0
- package/dist/{calendar-TIvtqxqG.js → calendar-KDcOWD6V.js} +69 -65
- package/dist/{datepicker-CCfdUb_7.js → datepicker-CpkTwszH.js} +1 -1
- package/dist/{datepicker-Q0nruAkS.cjs → datepicker-cR9MtXOh.cjs} +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +3 -3
- package/package.json +2 -2
- package/dist/calendar-AvUDikdn.cjs +0 -108
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [12.36.2](https://github.com/oslokommune/punkt/compare/12.36.1...12.36.2) (2025-04-30)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [12.36.1](https://github.com/oslokommune/punkt/compare/12.36.0...12.36.1) (2025-04-29)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";const lt=require("./class-map-DCyaICmy.cjs"),o=require("./element-BSypUpzA.cjs"),A=require("./state-B5KCNjEd.cjs");require("./icon-BnKGwYjj.cjs");const tt=6048e5,ut=864e5,ht=36e5,j=Symbol.for("constructDateFrom");function D(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&j in n?n[j](t):n instanceof Date?new n.constructor(t):new Date(t)}function k(n,t){return D(t||n,n)}function q(n,t,e){const r=k(n,e==null?void 0:e.in);return isNaN(t)?D(n,NaN):(t&&r.setDate(r.getDate()+t),r)}function dt(n,t,e){return D(n,+k(n)+t)}function et(n,t,e){return dt(n,t*ht)}let ft={};function _(){return ft}function Y(n,t){var c,l,u,f;const e=_(),r=(t==null?void 0:t.weekStartsOn)??((l=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((f=(u=e.locale)==null?void 0:u.options)==null?void 0:f.weekStartsOn)??0,a=k(n,t==null?void 0:t.in),s=a.getDay(),i=(s<r?7:0)+s-r;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function F(n,t){return Y(n,{...t,weekStartsOn:1})}function nt(n,t){const e=k(n,t==null?void 0:t.in),r=e.getFullYear(),a=D(e,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const s=F(a),i=D(e,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const c=F(i);return e.getTime()>=s.getTime()?r+1:e.getTime()>=c.getTime()?r:r-1}function Q(n){const t=k(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function rt(n,...t){const e=D.bind(null,t.find(r=>typeof r=="object"));return t.map(e)}function z(n,t){const e=k(n,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function mt(n,t,e){const[r,a]=rt(e==null?void 0:e.in,n,t),s=z(r),i=z(a),c=+s-Q(s),l=+i-Q(i);return Math.round((c-l)/ut)}function gt(n,t){const e=nt(n,t),r=D(n,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),F(r)}function yt(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function wt(n){return!(!yt(n)&&typeof n!="number"||isNaN(+k(n)))}function pt(n,t){const e=k(n,t==null?void 0:t.in);return e.setHours(23,59,59,999),e}function bt(n,t){const[e,r]=rt(n,t.start,t.end);return{start:e,end:r}}function L(n,t){const{start:e,end:r}=bt(t==null?void 0:t.in,n);let a=+e>+r;const s=a?+e:+r,i=a?r:e;i.setHours(0,0,0,0);let c=1;const l=[];for(;+i<=s;)l.push(D(e,i)),i.setDate(i.getDate()+c),i.setHours(0,0,0,0);return a?l.reverse():l}function kt(n,t){const e=k(n,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const vt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Dt=(n,t,e)=>{let r;const a=vt[n];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+r:r+" ago":r};function R(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const St={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Mt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},xt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Pt={date:R({formats:St,defaultWidth:"full"}),time:R({formats:Mt,defaultWidth:"full"}),dateTime:R({formats:xt,defaultWidth:"full"})},Tt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ot=(n,t,e,r)=>Tt[n];function $(n){return(t,e)=>{const r=e!=null&&e.context?String(e.context):"standalone";let a;if(r==="formatting"&&n.formattingValues){const i=n.defaultFormattingWidth||n.defaultWidth,c=e!=null&&e.width?String(e.width):i;a=n.formattingValues[c]||n.formattingValues[i]}else{const i=n.defaultWidth,c=e!=null&&e.width?String(e.width):n.defaultWidth;a=n.values[c]||n.values[i]}const s=n.argumentCallback?n.argumentCallback(t):t;return a[s]}}const Ct={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Et={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Wt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Nt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Yt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},At=(n,t)=>{const e=Number(n),r=e%100;if(r>20||r<10)switch(r%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},Ht={ordinalNumber:At,era:$({values:Ct,defaultWidth:"wide"}),quarter:$({values:$t,defaultWidth:"wide",argumentCallback:n=>n-1}),month:$({values:Et,defaultWidth:"wide"}),day:$({values:Wt,defaultWidth:"wide"}),dayPeriod:$({values:Nt,defaultWidth:"wide",formattingValues:Yt,defaultFormattingWidth:"wide"})};function E(n){return(t,e={})=>{const r=e.width,a=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],s=t.match(a);if(!s)return null;const i=s[0],c=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(c)?_t(c,p=>p.test(i)):Ft(c,p=>p.test(i));let u;u=n.valueCallback?n.valueCallback(l):l,u=e.valueCallback?e.valueCallback(u):u;const f=t.slice(i.length);return{value:u,rest:f}}}function Ft(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function _t(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function It(n){return(t,e={})=>{const r=t.match(n.matchPattern);if(!r)return null;const a=r[0],s=t.match(n.parsePattern);if(!s)return null;let i=n.valueCallback?n.valueCallback(s[0]):s[0];i=e.valueCallback?e.valueCallback(i):i;const c=t.slice(a.length);return{value:i,rest:c}}}const qt=/^(\d+)(th|st|nd|rd)?/i,Lt=/\d+/i,Rt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ut={any:[/^b/i,/^(a|c)/i]},zt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Bt={any:[/1/i,/2/i,/3/i,/4/i]},jt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Qt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Gt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Xt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Vt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Jt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Kt={ordinalNumber:It({matchPattern:qt,parsePattern:Lt,valueCallback:n=>parseInt(n,10)}),era:E({matchPatterns:Rt,defaultMatchWidth:"wide",parsePatterns:Ut,defaultParseWidth:"any"}),quarter:E({matchPatterns:zt,defaultMatchWidth:"wide",parsePatterns:Bt,defaultParseWidth:"any",valueCallback:n=>n+1}),month:E({matchPatterns:jt,defaultMatchWidth:"wide",parsePatterns:Qt,defaultParseWidth:"any"}),day:E({matchPatterns:Gt,defaultMatchWidth:"wide",parsePatterns:Xt,defaultParseWidth:"any"}),dayPeriod:E({matchPatterns:Vt,defaultMatchWidth:"any",parsePatterns:Jt,defaultParseWidth:"any"})},Zt={code:"en-US",formatDistance:Dt,formatLong:Pt,formatRelative:Ot,localize:Ht,match:Kt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function te(n,t){const e=k(n,t==null?void 0:t.in);return mt(e,kt(e))+1}function ee(n,t){const e=k(n,t==null?void 0:t.in),r=+F(e)-+gt(e);return Math.round(r/tt)+1}function at(n,t){var f,p,b,m;const e=k(n,t==null?void 0:t.in),r=e.getFullYear(),a=_(),s=(t==null?void 0:t.firstWeekContainsDate)??((p=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??a.firstWeekContainsDate??((m=(b=a.locale)==null?void 0:b.options)==null?void 0:m.firstWeekContainsDate)??1,i=D((t==null?void 0:t.in)||n,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const c=Y(i,t),l=D((t==null?void 0:t.in)||n,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const u=Y(l,t);return+e>=+c?r+1:+e>=+u?r:r-1}function ne(n,t){var c,l,u,f;const e=_(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((f=(u=e.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??1,a=at(n,t),s=D((t==null?void 0:t.in)||n,0);return s.setFullYear(a,0,r),s.setHours(0,0,0,0),Y(s,t)}function st(n,t){const e=k(n,t==null?void 0:t.in),r=+Y(e,t)-+ne(e,t);return Math.round(r/tt)+1}function h(n,t){const e=n<0?"-":"",r=Math.abs(n).toString().padStart(t,"0");return e+r}const x={y(n,t){const e=n.getFullYear(),r=e>0?e:1-e;return h(t==="yy"?r%100:r,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):h(e+1,2)},d(n,t){return h(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return h(n.getHours()%12||12,t.length)},H(n,t){return h(n.getHours(),t.length)},m(n,t){return h(n.getMinutes(),t.length)},s(n,t){return h(n.getSeconds(),t.length)},S(n,t){const e=t.length,r=n.getMilliseconds(),a=Math.trunc(r*Math.pow(10,e-3));return h(a,t.length)}},C={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},G={G:function(n,t,e){const r=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(r,{width:"abbreviated"});case"GGGGG":return e.era(r,{width:"narrow"});case"GGGG":default:return e.era(r,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const r=n.getFullYear(),a=r>0?r:1-r;return e.ordinalNumber(a,{unit:"year"})}return x.y(n,t)},Y:function(n,t,e,r){const a=at(n,r),s=a>0?a:1-a;if(t==="YY"){const i=s%100;return h(i,2)}return t==="Yo"?e.ordinalNumber(s,{unit:"year"}):h(s,t.length)},R:function(n,t){const e=nt(n);return h(e,t.length)},u:function(n,t){const e=n.getFullYear();return h(e,t.length)},Q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return h(r,2);case"Qo":return e.ordinalNumber(r,{unit:"quarter"});case"QQQ":return e.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return h(r,2);case"qo":return e.ordinalNumber(r,{unit:"quarter"});case"qqq":return e.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,t,e){const r=n.getMonth();switch(t){case"M":case"MM":return x.M(n,t);case"Mo":return e.ordinalNumber(r+1,{unit:"month"});case"MMM":return e.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(r,{width:"wide",context:"formatting"})}},L:function(n,t,e){const r=n.getMonth();switch(t){case"L":return String(r+1);case"LL":return h(r+1,2);case"Lo":return e.ordinalNumber(r+1,{unit:"month"});case"LLL":return e.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(r,{width:"wide",context:"standalone"})}},w:function(n,t,e,r){const a=st(n,r);return t==="wo"?e.ordinalNumber(a,{unit:"week"}):h(a,t.length)},I:function(n,t,e){const r=ee(n);return t==="Io"?e.ordinalNumber(r,{unit:"week"}):h(r,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):x.d(n,t)},D:function(n,t,e){const r=te(n);return t==="Do"?e.ordinalNumber(r,{unit:"dayOfYear"}):h(r,t.length)},E:function(n,t,e){const r=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(r,{width:"short",context:"formatting"});case"EEEE":default:return e.day(r,{width:"wide",context:"formatting"})}},e:function(n,t,e,r){const a=n.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return h(s,2);case"eo":return e.ordinalNumber(s,{unit:"day"});case"eee":return e.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(a,{width:"short",context:"formatting"});case"eeee":default:return e.day(a,{width:"wide",context:"formatting"})}},c:function(n,t,e,r){const a=n.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return h(s,t.length);case"co":return e.ordinalNumber(s,{unit:"day"});case"ccc":return e.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(a,{width:"narrow",context:"standalone"});case"cccccc":return e.day(a,{width:"short",context:"standalone"});case"cccc":default:return e.day(a,{width:"wide",context:"standalone"})}},i:function(n,t,e){const r=n.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return h(a,t.length);case"io":return e.ordinalNumber(a,{unit:"day"});case"iii":return e.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(r,{width:"short",context:"formatting"});case"iiii":default:return e.day(r,{width:"wide",context:"formatting"})}},a:function(n,t,e){const a=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(n,t,e){const r=n.getHours();let a;switch(r===12?a=C.noon:r===0?a=C.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(n,t,e){const r=n.getHours();let a;switch(r>=17?a=C.evening:r>=12?a=C.afternoon:r>=4?a=C.morning:a=C.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let r=n.getHours()%12;return r===0&&(r=12),e.ordinalNumber(r,{unit:"hour"})}return x.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):x.H(n,t)},K:function(n,t,e){const r=n.getHours()%12;return t==="Ko"?e.ordinalNumber(r,{unit:"hour"}):h(r,t.length)},k:function(n,t,e){let r=n.getHours();return r===0&&(r=24),t==="ko"?e.ordinalNumber(r,{unit:"hour"}):h(r,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):x.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):x.s(n,t)},S:function(n,t){return x.S(n,t)},X:function(n,t,e){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return V(r);case"XXXX":case"XX":return O(r);case"XXXXX":case"XXX":default:return O(r,":")}},x:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"x":return V(r);case"xxxx":case"xx":return O(r);case"xxxxx":case"xxx":default:return O(r,":")}},O:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+X(r,":");case"OOOO":default:return"GMT"+O(r,":")}},z:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+X(r,":");case"zzzz":default:return"GMT"+O(r,":")}},t:function(n,t,e){const r=Math.trunc(+n/1e3);return h(r,t.length)},T:function(n,t,e){return h(+n,t.length)}};function X(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=Math.trunc(r/60),s=r%60;return s===0?e+String(a):e+String(a)+t+h(s,2)}function V(n,t){return n%60===0?(n>0?"-":"+")+h(Math.abs(n)/60,2):O(n,t)}function O(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=h(Math.trunc(r/60),2),s=h(r%60,2);return e+a+t+s}const J=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},it=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},re=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],r=e[1],a=e[2];if(!a)return J(n,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",J(r,t)).replace("{{time}}",it(a,t))},ae={p:it,P:re},se=/^D+$/,ie=/^Y+$/,oe=["D","DD","YY","YYYY"];function ce(n){return se.test(n)}function le(n){return ie.test(n)}function ue(n,t,e){const r=he(n,t,e);if(console.warn(r),oe.includes(n))throw new RangeError(r)}function he(n,t,e){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${r} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const de=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,me=/^'([^]*?)'?$/,ge=/''/g,ye=/[a-zA-Z]/;function we(n,t,e){var f,p,b,m;const r=_(),a=r.locale??Zt,s=r.firstWeekContainsDate??((p=(f=r.locale)==null?void 0:f.options)==null?void 0:p.firstWeekContainsDate)??1,i=r.weekStartsOn??((m=(b=r.locale)==null?void 0:b.options)==null?void 0:m.weekStartsOn)??0,c=k(n,e==null?void 0:e.in);if(!wt(c))throw new RangeError("Invalid time value");let l=t.match(fe).map(g=>{const v=g[0];if(v==="p"||v==="P"){const I=ae[v];return I(g,a.formatLong)}return g}).join("").match(de).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const v=g[0];if(v==="'")return{isToken:!1,value:pe(g)};if(G[v])return{isToken:!0,value:g};if(v.match(ye))throw new RangeError("Format string contains an unescaped latin alphabet character `"+v+"`");return{isToken:!1,value:g}});a.localize.preprocessor&&(l=a.localize.preprocessor(c,l));const u={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return l.map(g=>{if(!g.isToken)return g.value;const v=g.value;(le(v)||ce(v))&&ue(v,t,String(n));const I=G[v[0]];return I(c,v,a.localize,u)}).join("")}function pe(n){const t=n.match(me);return t?t[1].replace(ge,"'"):n}function be(n,t){const e=k(n,t==null?void 0:t.in).getDay();return e===0?7:e}function ke(n,t,e){const r=k(n,e==null?void 0:e.in);return r.setHours(t),r}const U={},W={};function N(n,t){try{const r=(U[n]||(U[n]=new Intl.DateTimeFormat("en-GB",{timeZone:n,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return r in W?W[r]:K(r,r.split(":"))}catch{if(n in W)return W[n];const e=n==null?void 0:n.match(ve);return e?K(n,e.slice(1)):NaN}}const ve=/([+-]\d\d):?(\d\d)?/;function K(n,t){const e=+t[0],r=+(t[1]||0);return W[n]=e>0?e*60+r:e*60-r}class S extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(N(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),ot(this),B(this)):this.setTime(Date.now())}static tz(t,...e){return e.length?new S(...e,t):new S(Date.now(),t)}withTimeZone(t){return new S(+this,t)}getTimezoneOffset(){return-N(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),B(this),+this}[Symbol.for("constructDateFrom")](t){return new S(+new Date(t),this.timeZone)}}const Z=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!Z.test(n))return;const t=n.replace(Z,"$1UTC");S.prototype[t]&&(n.startsWith("get")?S.prototype[n]=function(){return this.internal[t]()}:(S.prototype[n]=function(){return Date.prototype[t].apply(this.internal,arguments),De(this),+this},S.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),B(this),+this}))});function B(n){n.internal.setTime(+n),n.internal.setUTCMinutes(n.internal.getUTCMinutes()-n.getTimezoneOffset())}function De(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),ot(n)}function ot(n){const t=N(n.timeZone,n),e=new Date(+n);e.setUTCHours(e.getUTCHours()-1);const r=-new Date(+n).getTimezoneOffset(),a=-new Date(+e).getTimezoneOffset(),s=r-a,i=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();s&&i&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+s);const c=r-t;c&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+c);const l=N(n.timeZone,n),f=-new Date(+n).getTimezoneOffset()-l,p=l!==t,b=f-c;if(p&&b){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+b);const m=N(n.timeZone,n),g=l-m;g&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+g),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+g))}}class M extends S{static tz(t,...e){return e.length?new M(...e,t):new M(Date.now(),t)}toISOString(){const[t,e,r]=this.tzComponents(),a=`${t}${e}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,e,r,a]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${e} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[e,r,a]=this.tzComponents();return`${t} GMT${e}${r}${a} (${Se(this.timeZone,this)})`}toLocaleString(t,e){return Date.prototype.toLocaleString.call(this,t,{...e,timeZone:(e==null?void 0:e.timeZone)||this.timeZone})}toLocaleDateString(t,e){return Date.prototype.toLocaleDateString.call(this,t,{...e,timeZone:(e==null?void 0:e.timeZone)||this.timeZone})}toLocaleTimeString(t,e){return Date.prototype.toLocaleTimeString.call(this,t,{...e,timeZone:(e==null?void 0:e.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),e=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[e,r,a]}withTimeZone(t){return new M(+this,t)}[Symbol.for("constructDateFrom")](t){return new M(+new Date(t),this.timeZone)}}function Se(n,t){return new Intl.DateTimeFormat("en-GB",{timeZone:n,timeZoneName:"long"}).format(t).slice(12)}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const w=n=>n.toISOString().split("T")[0],Me=n=>{if(!n)return null;const t=et(new M(n,window.pktTz),12);return isNaN(t.getTime())?null:t},xe=(n,t)=>{const e=y(n);return isNaN(e.getTime())?"":we(e,t)},y=(n="",t)=>{const e=n===""||!n?new Date:n;return t?new M(t==="end"?pt(e):z(e),window.pktTz):ke(new M(e.toString(),window.pktTz),12)},P=(n,t,e=1)=>et(new M(n,t,e,window.pktTz),12),Pe=n=>new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:window.pktTz}).format(n),ct=n=>{if(Array.isArray(n))return n;if(typeof n=="string")return n.split(",")},Te=n=>n?new Date(n):null,Oe=n=>{if(typeof n=="string")return n.split(",").map(t=>new Date(t));if(Array.isArray(n))return n.map(t=>new Date(t))},H={csvToArray:ct,stringToDate:Te,stringsToDate:Oe},Ce={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},T={props:Ce};var $e=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,d=(n,t,e,r)=>{for(var a=r>1?void 0:r?Ee(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(a=(r?i(t,e,a):i(a))||a);return r&&a&&$e(t,e,a),a};exports.PktCalendar=class extends o.PktElement{constructor(){super(...arguments),this.multiple=T.props.multiple.default,this.maxMultiple=T.props.maxMultiple.default,this.range=T.props.range.default,this.weeknumbers=T.props.weeknumbers.default,this.withcontrols=T.props.withcontrols.default,this.selected=[],this.earliest=T.props.earliest.default,this.latest=T.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.year=0,this.month=0,this.week=0,this.rangeHovered=null,this.inRange={},this.focusedDate=null,this.selectableDates=[],this.currentmonthtouched=!1,this.tabIndexSet=0}connectedCallback(){super.connectedCallback()}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}attributeChangedCallback(t,e,r){t==="selected"&&r&&this.convertSelected(),super.attributeChangedCallback(t,e,r)}updated(t){super.updated(t),t.has("selected")&&this.convertSelected()}firstUpdated(t){this.addEventListener("keydown",this.handleKeydown)}convertSelected(){if(typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=this.selected.map(t=>y(t)),this.range&&this.selected.length===2){const t=L({start:y(this.selected[0]),end:y(this.selected[1])});if(this.inRange={},Array.isArray(t)&&t.length){const e={};for(let r=0;r<t.length;r++)e[w(t[r])]=this.isInRange(t[r]);this.inRange=e}}this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched){this.currentmonthtouched=!0;return}this.selected.length&&this.selected[0]!==""?this.currentmonth=y(this.selected[this.selected.length-1]):this.currentmonth===null&&(this.currentmonth=y()),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(t){switch(t.key){case"ArrowLeft":this.handleArrowKey(t,-1);break;case"ArrowRight":this.handleArrowKey(t,1);break;case"ArrowUp":this.handleArrowKey(t,-7);break;case"ArrowDown":this.handleArrowKey(t,7);break}}handleArrowKey(t,e){var s,i,c;if(((s=t.target)==null?void 0:s.nodeName)==="INPUT"||((i=t.target)==null?void 0:i.nodeName)==="SELECT"||((c=t.target)==null?void 0:c.nodeName)==="BUTTON")return;t.preventDefault(),this.focusedDate||this.focusOnCurrentDate();const r=this.focusedDate?y(this.focusedDate):P(this.year,this.month,1);let a=q(r,e);if(a){let l=this.querySelector(`div[data-date="${w(a)}"]`);if(l instanceof HTMLDivElement){if(l.dataset.disabled){a=q(a,e);let u=this.querySelector(`div[data-date="${w(a)}"]`);for(;u&&u instanceof HTMLDivElement&&u.dataset.disabled;)a=q(a,e),u=this.querySelector(`div[data-date="${w(a)}"]`);l=u}l instanceof HTMLDivElement&&!l.dataset.disabled&&(this.focusedDate=w(a),l.focus())}}}render(){return o.x`
|
|
2
|
+
<div
|
|
3
|
+
class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":o.E}"
|
|
4
|
+
@focusout=${this.closeEvent}
|
|
5
|
+
@keydown=${t=>{t.key==="Escape"&&(t.preventDefault(),this.close())}}
|
|
6
|
+
>
|
|
7
|
+
<nav class="pkt-cal-month-nav">
|
|
8
|
+
<div>
|
|
9
|
+
<button
|
|
10
|
+
type="button"
|
|
11
|
+
@click=${this.isPrevMonthAllowed()&&this.prevMonth}
|
|
12
|
+
@keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isNextMonthAllowed()&&this.prevMonth())}}
|
|
13
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isPrevMonthAllowed()?"":"pkt-hide"}"
|
|
14
|
+
.data-disabled=${this.isPrevMonthAllowed()?o.E:"disabled"}
|
|
15
|
+
?aria-disabled=${!this.isPrevMonthAllowed()}
|
|
16
|
+
tabindex=${this.isPrevMonthAllowed()?"0":"-1"}
|
|
17
|
+
>
|
|
18
|
+
<pkt-icon class="pkt-btn__icon" name="chevron-thin-left"></pkt-icon>
|
|
19
|
+
<span class="pkt-btn__text">${this.prevMonthString}</span>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
${this.renderMonthNav()}
|
|
23
|
+
<div>
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
@click=${this.isNextMonthAllowed()&&this.nextMonth}
|
|
27
|
+
@keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isNextMonthAllowed()&&this.nextMonth())}}
|
|
28
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isNextMonthAllowed()?"":"pkt-hide"}"
|
|
29
|
+
.data-disabled=${this.isNextMonthAllowed()?o.E:"disabled"}
|
|
30
|
+
?aria-disabled=${!this.isNextMonthAllowed()}
|
|
31
|
+
tabindex=${this.isNextMonthAllowed()?"0":"-1"}
|
|
32
|
+
>
|
|
33
|
+
<pkt-icon class="pkt-btn__icon" name="chevron-thin-right"></pkt-icon>
|
|
34
|
+
<span class="pkt-btn__text">${this.nextMonthString}</span>
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
</nav>
|
|
38
|
+
<table
|
|
39
|
+
class="pkt-cal-days pkt-txt-12-medium"
|
|
40
|
+
role="grid"
|
|
41
|
+
?aria-multiselectable=${this.range||this.multiple}
|
|
42
|
+
>
|
|
43
|
+
<thead>
|
|
44
|
+
${this.renderDayNames()}
|
|
45
|
+
</thead>
|
|
46
|
+
<tbody>
|
|
47
|
+
${this.renderCalendarBody()}
|
|
48
|
+
</tbody>
|
|
49
|
+
</table>
|
|
50
|
+
</div>
|
|
51
|
+
`}renderDayNames(){const t=[];this.weeknumbers&&t.push(o.x`<th><div>${this.weekString}</div></th>`);for(let e=0;e<this.dayStrings.length;e++)t.push(o.x`<th><div aria-label="${this.dayStringsLong[e]}">${this.dayStrings[e]}</div></th>`);return o.x`<tr class="pkt-cal-week-row">
|
|
52
|
+
${t}
|
|
53
|
+
</tr>`}renderMonthNav(){let t=[];return this.withcontrols?t.push(o.x`<div class="pkt-cal-month-picker">
|
|
54
|
+
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
55
|
+
<select
|
|
56
|
+
aria-label="${this.strings.dates.month}"
|
|
57
|
+
class="pkt-input pkt-input-compact"
|
|
58
|
+
id="${this.id}-monthnav"
|
|
59
|
+
@change=${e=>{e.stopImmediatePropagation(),this.changeMonth(this.year,e.target.value)}}
|
|
60
|
+
>
|
|
61
|
+
${this.monthStrings.map((e,r)=>o.x`<option value=${r} ?selected=${this.month===r}>${e}</option>`)}
|
|
62
|
+
</select>
|
|
63
|
+
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
64
|
+
<input
|
|
65
|
+
aria-label="${this.strings.dates.year}"
|
|
66
|
+
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
67
|
+
id="${this.id}-yearnav"
|
|
68
|
+
type="number"
|
|
69
|
+
size="4"
|
|
70
|
+
placeholder="0000"
|
|
71
|
+
@change=${e=>{e.stopImmediatePropagation(),this.changeMonth(e.target.value,this.month)}}
|
|
72
|
+
.value=${this.year}
|
|
73
|
+
/>
|
|
74
|
+
</div> `):t.push(o.x`<div class="pkt-txt-16-medium" aria-live="polite">
|
|
75
|
+
${this.monthStrings[this.month]} ${this.year}
|
|
76
|
+
</div>`),t}renderDayView(t,e,r){var b;const a=P(this.year,this.month,t),s=w(a),i=s===w(e),c=this.selected.includes(s),l=Pe(a),u=this.isExcluded(r,a)||!c&&this.multiple&&this.maxMultiple>0&&this.selected.length>=this.maxMultiple,f=this.focusedDate?this.focusedDate===s&&!u?"0":"-1":!u&&this.tabIndexSet===0||this.tabIndexSet===t?"0":"-1";f==="0"&&(this.tabIndexSet=t),this.selectableDates.push({currentDateISO:s,isDisabled:u,tabindex:f});const p={"pkt-cal-today":i,"pkt-cal-selected":c,"pkt-cal-in-range":this.inRange[s],"pkt-cal-excluded":this.isExcluded(r,a),"pkt-cal-in-range-first":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&s===this.selected[0],"pkt-cal-in-range-last":this.range&&this.selected.length===2&&s===this.selected[1],"pkt-cal-range-hover":this.rangeHovered!==null&&s===w(this.rangeHovered)};return o.x`<td class=${lt.e(p)}>
|
|
77
|
+
<div
|
|
78
|
+
?aria-selected=${c}
|
|
79
|
+
role="gridcell"
|
|
80
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
81
|
+
@mouseover=${()=>this.range&&!this.isExcluded(r,a)&&this.handleRangeHover(a)}
|
|
82
|
+
@focus=${()=>{this.range&&!this.isExcluded(r,a)&&this.handleRangeHover(a),this.focusedDate=s}}
|
|
83
|
+
aria-label="${l}"
|
|
84
|
+
tabindex=${(b=this.selectableDates.find(m=>m.currentDateISO===s))==null?void 0:b.tabindex}
|
|
85
|
+
data-disabled=${u?"disabled":o.E}
|
|
86
|
+
data-date=${s}
|
|
87
|
+
@keydown=${m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),this.handleDateSelect(a))}}
|
|
88
|
+
@click=${m=>{u||(m.preventDefault(),this.handleDateSelect(a))}}
|
|
89
|
+
>
|
|
90
|
+
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
91
|
+
</div>
|
|
92
|
+
</td>`}renderCalendarBody(){const t=y(),e=P(this.year,this.month,1),r=P(this.year,this.month+1,0),a=(e.getDay()+6)%7,s=r.getDate(),i=Math.ceil((s+a)/7),l=P(this.year,this.month,0).getDate();let u=1;this.week=st(P(this.year,this.month,1));const f=[];for(let p=0;p<i;p++){const b=[];this.weeknumbers&&b.push(o.x`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let m=1;m<8;m++)if(p===0&&m<a+1){const g=l-(a-m);b.push(o.x`<td class="pkt-cal-other">
|
|
93
|
+
<div
|
|
94
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
95
|
+
data-disabled="disabled"
|
|
96
|
+
>
|
|
97
|
+
<span class="pkt-btn__text pkt-txt-14-light">${g}</span>
|
|
98
|
+
</div>
|
|
99
|
+
</td>`)}else u>s?(b.push(o.x`<td class="pkt-cal-other">
|
|
100
|
+
<div
|
|
101
|
+
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
102
|
+
data-disabled="disabled"
|
|
103
|
+
>
|
|
104
|
+
<span class="pkt-btn__text pkt-txt-14-light">${u-s}</span>
|
|
105
|
+
</div>
|
|
106
|
+
</td>`),u++):(b.push(this.renderDayView(u,t,m)),u++);f.push(o.x`<tr class="pkt-cal-week-row" role="row">
|
|
107
|
+
${b}
|
|
108
|
+
</tr>`)}return f}isExcluded(t,e){return this.excludeweekdays.includes(t.toString())||this.earliest&&y(e,"end")<y(this.earliest,"start")||this.latest&&y(e,"start")>y(this.latest,"end")?!0:this.excludedates.some(r=>typeof r=="string"?r===w(e):r.toDateString()===e.toDateString())}isPrevMonthAllowed(){const t=P(this.year,this.month,0);return!(this.earliest&&y(this.earliest)>t)}prevMonth(){const t=this.month===0?11:this.month-1,e=this.month===0?this.year-1:this.year;this.changeMonth(e,t)}isNextMonthAllowed(){const t=P(this.month===11?this.year+1:this.year,this.month===11?0:this.month+1,1);return!(this.latest&&y(this.latest)<t)}nextMonth(){const t=this.month===11?0:this.month+1,e=this.month===11?this.year+1:this.year;this.changeMonth(e,t)}changeMonth(t,e){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof e=="string"?parseInt(e):e,this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}isInRange(t){if(this.range&&this.selected.length===2){if(t>y(this.selected[0])&&t<y(this.selected[1]))return!0}else if(this.range&&this.selected.length===1&&this.rangeHovered&&t>y(this.selected[0])&&t<this.rangeHovered)return!0;return!1}isRangeAllowed(t){let e=!0;if(this._selected.length===1){const r=L({start:this._selected[0],end:t});if(Array.isArray(r)&&r.length)for(let a=0;a<r.length;a++)this.excludedates.forEach(s=>{s>this._selected[0]&&s<t&&(e=!1)}),this.excludeweekdays.includes(be(r[a]).toString())&&(e=!1)}return e}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(t){this.selected.includes(w(t))||(this.selected=[...this.selected,w(t)],this._selected=[...this._selected,t],this.range&&this.selected.length===2&&this.close())}removeFromSelected(t){if(this.selected.length===1)this.emptySelected();else{const e=this.selected.indexOf(w(t)),r=[...this.selected],a=[...this._selected];r.splice(e,1),a.splice(e,1),this.selected=r,this._selected=a}}toggleSelected(t){const e=w(t);this.selected.includes(e)?this.removeFromSelected(t):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(t)}handleRangeSelect(t){const e=w(t);return this.selected.includes(e)?this.selected.indexOf(e)===0?this.emptySelected():this.removeFromSelected(t):this.selected.length>1?(this.emptySelected(),this.addToSelected(t)):(this.selected.length===1&&!this.isRangeAllowed(t)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>t&&this.emptySelected(),this.addToSelected(t)),Promise.resolve()}handleRangeHover(t){if(this.range&&this._selected.length===1&&this.isRangeAllowed(t)&&this._selected[0]<t){this.rangeHovered=t,this.inRange={};const e=L({start:this._selected[0],end:t});if(Array.isArray(e)&&e.length)for(let r=0;r<e.length;r++)this.inRange[w(e[r])]=this.isInRange(e[r])}else this.rangeHovered=null}handleDateSelect(t){if(t)return this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(w(t))?this.emptySelected():(this.emptySelected(),this.addToSelected(t)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const t=w(y()),e=this.querySelector(`div[data-date="${t}"]`);if(e instanceof HTMLDivElement)this.focusedDate=t,e.focus();else{const r=this.selectableDates.find(a=>!a.isDisabled);if(r){const a=this.querySelector(`div[data-date="${r.currentDateISO}"]`);a instanceof HTMLDivElement&&(this.focusedDate=r.currentDateISO,a.focus())}}}closeEvent(t){!this.contains(t.relatedTarget)&&!t.target.classList.contains("pkt-hide")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};d([o.n({type:Boolean})],exports.PktCalendar.prototype,"multiple",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"maxMultiple",2);d([o.n({type:Boolean})],exports.PktCalendar.prototype,"range",2);d([o.n({type:Boolean})],exports.PktCalendar.prototype,"weeknumbers",2);d([o.n({type:Boolean})],exports.PktCalendar.prototype,"withcontrols",2);d([o.n({converter:H.csvToArray})],exports.PktCalendar.prototype,"selected",2);d([o.n({type:String})],exports.PktCalendar.prototype,"earliest",2);d([o.n({type:String})],exports.PktCalendar.prototype,"latest",2);d([o.n({converter:H.stringsToDate})],exports.PktCalendar.prototype,"excludedates",2);d([o.n({converter:H.csvToArray})],exports.PktCalendar.prototype,"excludeweekdays",2);d([o.n({converter:H.stringToDate})],exports.PktCalendar.prototype,"currentmonth",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"dayStrings",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"dayStringsLong",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"monthStrings",2);d([o.n({type:String})],exports.PktCalendar.prototype,"weekString",2);d([o.n({type:String})],exports.PktCalendar.prototype,"prevMonthString",2);d([o.n({type:String})],exports.PktCalendar.prototype,"nextMonthString",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"_selected",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"year",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"month",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"week",2);d([o.n({type:Date})],exports.PktCalendar.prototype,"rangeHovered",2);d([A.r()],exports.PktCalendar.prototype,"inRange",2);d([A.r()],exports.PktCalendar.prototype,"focusedDate",2);d([A.r()],exports.PktCalendar.prototype,"selectableDates",2);d([A.r()],exports.PktCalendar.prototype,"currentmonthtouched",2);d([A.r()],exports.PktCalendar.prototype,"tabIndexSet",2);exports.PktCalendar=d([o.t("pkt-calendar")],exports.PktCalendar);exports.converters=H;exports.csvToArray=ct;exports.formatISODate=w;exports.fromISOToDate=Me;exports.fromISOtoLocal=xe;exports.newDate=y;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { e as ht } from "./class-map-KyMqi0fa.js";
|
|
2
2
|
import { P as dt, E as _, x as D, n as m, a as ft } from "./element-DjjF_tEh.js";
|
|
3
|
-
import { r as
|
|
3
|
+
import { r as F } from "./state-BtbpSrdV.js";
|
|
4
4
|
import "./icon-Beoxup8E.js";
|
|
5
|
-
const
|
|
5
|
+
const rt = 6048e5, mt = 864e5, gt = 36e5, X = Symbol.for("constructDateFrom");
|
|
6
6
|
function S(t, e) {
|
|
7
|
-
return typeof t == "function" ? t(e) : t && typeof t == "object" &&
|
|
7
|
+
return typeof t == "function" ? t(e) : t && typeof t == "object" && X in t ? t[X](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
8
8
|
}
|
|
9
9
|
function k(t, e) {
|
|
10
10
|
return S(e || t, t);
|
|
@@ -16,20 +16,20 @@ function U(t, e, n) {
|
|
|
16
16
|
function yt(t, e, n) {
|
|
17
17
|
return S(t, +k(t) + e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function at(t, e, n) {
|
|
20
20
|
return yt(t, e * gt);
|
|
21
21
|
}
|
|
22
22
|
let pt = {};
|
|
23
23
|
function q() {
|
|
24
24
|
return pt;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function H(t, e) {
|
|
27
27
|
var c, o, d, g;
|
|
28
28
|
const n = q(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((o = (c = e == null ? void 0 : e.locale) == null ? void 0 : c.options) == null ? void 0 : o.weekStartsOn) ?? n.weekStartsOn ?? ((g = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : g.weekStartsOn) ?? 0, a = k(t, e == null ? void 0 : e.in), s = a.getDay(), i = (s < r ? 7 : 0) + s - r;
|
|
29
29
|
return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
|
|
30
30
|
}
|
|
31
31
|
function I(t, e) {
|
|
32
|
-
return
|
|
32
|
+
return H(t, { ...e, weekStartsOn: 1 });
|
|
33
33
|
}
|
|
34
34
|
function st(t, e) {
|
|
35
35
|
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = S(n, 0);
|
|
@@ -39,7 +39,7 @@ function st(t, e) {
|
|
|
39
39
|
const c = I(i);
|
|
40
40
|
return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= c.getTime() ? r : r - 1;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function V(t) {
|
|
43
43
|
const e = k(t), n = new Date(
|
|
44
44
|
Date.UTC(
|
|
45
45
|
e.getFullYear(),
|
|
@@ -69,7 +69,7 @@ function wt(t, e, n) {
|
|
|
69
69
|
n == null ? void 0 : n.in,
|
|
70
70
|
t,
|
|
71
71
|
e
|
|
72
|
-
), s = Q(r), i = Q(a), c = +s -
|
|
72
|
+
), s = Q(r), i = Q(a), c = +s - V(s), o = +i - V(i);
|
|
73
73
|
return Math.round((c - o) / mt);
|
|
74
74
|
}
|
|
75
75
|
function bt(t, e) {
|
|
@@ -267,7 +267,7 @@ const Nt = {
|
|
|
267
267
|
"November",
|
|
268
268
|
"December"
|
|
269
269
|
]
|
|
270
|
-
},
|
|
270
|
+
}, Ht = {
|
|
271
271
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
272
272
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
273
273
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -280,7 +280,7 @@ const Nt = {
|
|
|
280
280
|
"Friday",
|
|
281
281
|
"Saturday"
|
|
282
282
|
]
|
|
283
|
-
},
|
|
283
|
+
}, Ft = {
|
|
284
284
|
narrow: {
|
|
285
285
|
am: "a",
|
|
286
286
|
pm: "p",
|
|
@@ -370,11 +370,11 @@ const Nt = {
|
|
|
370
370
|
defaultWidth: "wide"
|
|
371
371
|
}),
|
|
372
372
|
day: W({
|
|
373
|
-
values:
|
|
373
|
+
values: Ht,
|
|
374
374
|
defaultWidth: "wide"
|
|
375
375
|
}),
|
|
376
376
|
dayPeriod: W({
|
|
377
|
-
values:
|
|
377
|
+
values: Ft,
|
|
378
378
|
defaultWidth: "wide",
|
|
379
379
|
formattingValues: _t,
|
|
380
380
|
defaultFormattingWidth: "wide"
|
|
@@ -542,25 +542,25 @@ function ae(t, e) {
|
|
|
542
542
|
}
|
|
543
543
|
function se(t, e) {
|
|
544
544
|
const n = k(t, e == null ? void 0 : e.in), r = +I(n) - +bt(n);
|
|
545
|
-
return Math.round(r /
|
|
545
|
+
return Math.round(r / rt) + 1;
|
|
546
546
|
}
|
|
547
547
|
function ot(t, e) {
|
|
548
548
|
var g, y, f, x;
|
|
549
549
|
const n = k(t, e == null ? void 0 : e.in), r = n.getFullYear(), a = q(), s = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((y = (g = e == null ? void 0 : e.locale) == null ? void 0 : g.options) == null ? void 0 : y.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((x = (f = a.locale) == null ? void 0 : f.options) == null ? void 0 : x.firstWeekContainsDate) ?? 1, i = S((e == null ? void 0 : e.in) || t, 0);
|
|
550
550
|
i.setFullYear(r + 1, 0, s), i.setHours(0, 0, 0, 0);
|
|
551
|
-
const c =
|
|
551
|
+
const c = H(i, e), o = S((e == null ? void 0 : e.in) || t, 0);
|
|
552
552
|
o.setFullYear(r, 0, s), o.setHours(0, 0, 0, 0);
|
|
553
|
-
const d =
|
|
553
|
+
const d = H(o, e);
|
|
554
554
|
return +n >= +c ? r + 1 : +n >= +d ? r : r - 1;
|
|
555
555
|
}
|
|
556
556
|
function ie(t, e) {
|
|
557
557
|
var c, o, d, g;
|
|
558
558
|
const n = q(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((o = (c = e == null ? void 0 : e.locale) == null ? void 0 : c.options) == null ? void 0 : o.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((g = (d = n.locale) == null ? void 0 : d.options) == null ? void 0 : g.firstWeekContainsDate) ?? 1, a = ot(t, e), s = S((e == null ? void 0 : e.in) || t, 0);
|
|
559
|
-
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0),
|
|
559
|
+
return s.setFullYear(a, 0, r), s.setHours(0, 0, 0, 0), H(s, e);
|
|
560
560
|
}
|
|
561
561
|
function ct(t, e) {
|
|
562
|
-
const n = k(t, e == null ? void 0 : e.in), r = +
|
|
563
|
-
return Math.round(r /
|
|
562
|
+
const n = k(t, e == null ? void 0 : e.in), r = +H(n, e) - +ie(n, e);
|
|
563
|
+
return Math.round(r / rt) + 1;
|
|
564
564
|
}
|
|
565
565
|
function l(t, e) {
|
|
566
566
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
@@ -627,7 +627,7 @@ const O = {
|
|
|
627
627
|
afternoon: "afternoon",
|
|
628
628
|
evening: "evening",
|
|
629
629
|
night: "night"
|
|
630
|
-
},
|
|
630
|
+
}, J = {
|
|
631
631
|
// Era
|
|
632
632
|
G: function(t, e, n) {
|
|
633
633
|
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
@@ -1053,7 +1053,7 @@ const O = {
|
|
|
1053
1053
|
return "Z";
|
|
1054
1054
|
switch (e) {
|
|
1055
1055
|
case "X":
|
|
1056
|
-
return
|
|
1056
|
+
return Z(r);
|
|
1057
1057
|
case "XXXX":
|
|
1058
1058
|
case "XX":
|
|
1059
1059
|
return $(r);
|
|
@@ -1068,7 +1068,7 @@ const O = {
|
|
|
1068
1068
|
const r = t.getTimezoneOffset();
|
|
1069
1069
|
switch (e) {
|
|
1070
1070
|
case "x":
|
|
1071
|
-
return
|
|
1071
|
+
return Z(r);
|
|
1072
1072
|
case "xxxx":
|
|
1073
1073
|
case "xx":
|
|
1074
1074
|
return $(r);
|
|
@@ -1085,7 +1085,7 @@ const O = {
|
|
|
1085
1085
|
case "O":
|
|
1086
1086
|
case "OO":
|
|
1087
1087
|
case "OOO":
|
|
1088
|
-
return "GMT" +
|
|
1088
|
+
return "GMT" + K(r, ":");
|
|
1089
1089
|
case "OOOO":
|
|
1090
1090
|
default:
|
|
1091
1091
|
return "GMT" + $(r, ":");
|
|
@@ -1098,7 +1098,7 @@ const O = {
|
|
|
1098
1098
|
case "z":
|
|
1099
1099
|
case "zz":
|
|
1100
1100
|
case "zzz":
|
|
1101
|
-
return "GMT" +
|
|
1101
|
+
return "GMT" + K(r, ":");
|
|
1102
1102
|
case "zzzz":
|
|
1103
1103
|
default:
|
|
1104
1104
|
return "GMT" + $(r, ":");
|
|
@@ -1114,18 +1114,18 @@ const O = {
|
|
|
1114
1114
|
return l(+t, e.length);
|
|
1115
1115
|
}
|
|
1116
1116
|
};
|
|
1117
|
-
function
|
|
1117
|
+
function K(t, e = "") {
|
|
1118
1118
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = Math.trunc(r / 60), s = r % 60;
|
|
1119
1119
|
return s === 0 ? n + String(a) : n + String(a) + e + l(s, 2);
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1121
|
+
function Z(t, e) {
|
|
1122
1122
|
return t % 60 === 0 ? (t > 0 ? "-" : "+") + l(Math.abs(t) / 60, 2) : $(t, e);
|
|
1123
1123
|
}
|
|
1124
1124
|
function $(t, e = "") {
|
|
1125
1125
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), a = l(Math.trunc(r / 60), 2), s = l(r % 60, 2);
|
|
1126
1126
|
return n + a + e + s;
|
|
1127
1127
|
}
|
|
1128
|
-
const
|
|
1128
|
+
const tt = (t, e) => {
|
|
1129
1129
|
switch (t) {
|
|
1130
1130
|
case "P":
|
|
1131
1131
|
return e.date({ width: "short" });
|
|
@@ -1152,7 +1152,7 @@ const et = (t, e) => {
|
|
|
1152
1152
|
}, oe = (t, e) => {
|
|
1153
1153
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
|
|
1154
1154
|
if (!a)
|
|
1155
|
-
return
|
|
1155
|
+
return tt(t, e);
|
|
1156
1156
|
let s;
|
|
1157
1157
|
switch (r) {
|
|
1158
1158
|
case "P":
|
|
@@ -1169,7 +1169,7 @@ const et = (t, e) => {
|
|
|
1169
1169
|
s = e.dateTime({ width: "full" });
|
|
1170
1170
|
break;
|
|
1171
1171
|
}
|
|
1172
|
-
return s.replace("{{date}}",
|
|
1172
|
+
return s.replace("{{date}}", tt(r, e)).replace("{{time}}", lt(a, e));
|
|
1173
1173
|
}, ce = {
|
|
1174
1174
|
p: lt,
|
|
1175
1175
|
P: oe
|
|
@@ -1207,7 +1207,7 @@ function ve(t, e, n) {
|
|
|
1207
1207
|
const v = w[0];
|
|
1208
1208
|
if (v === "'")
|
|
1209
1209
|
return { isToken: !1, value: De(w) };
|
|
1210
|
-
if (
|
|
1210
|
+
if (J[v])
|
|
1211
1211
|
return { isToken: !0, value: w };
|
|
1212
1212
|
if (v.match(ke))
|
|
1213
1213
|
throw new RangeError(
|
|
@@ -1225,7 +1225,7 @@ function ve(t, e, n) {
|
|
|
1225
1225
|
if (!w.isToken) return w.value;
|
|
1226
1226
|
const v = w.value;
|
|
1227
1227
|
(fe(v) || de(v)) && me(v, e, String(t));
|
|
1228
|
-
const R =
|
|
1228
|
+
const R = J[v[0]];
|
|
1229
1229
|
return R(c, v, a.localize, d);
|
|
1230
1230
|
}).join("");
|
|
1231
1231
|
}
|
|
@@ -1237,6 +1237,10 @@ function Se(t, e) {
|
|
|
1237
1237
|
const n = k(t, e == null ? void 0 : e.in).getDay();
|
|
1238
1238
|
return n === 0 ? 7 : n;
|
|
1239
1239
|
}
|
|
1240
|
+
function Me(t, e, n) {
|
|
1241
|
+
const r = k(t, n == null ? void 0 : n.in);
|
|
1242
|
+
return r.setHours(e), r;
|
|
1243
|
+
}
|
|
1240
1244
|
const j = {}, Y = {};
|
|
1241
1245
|
function A(t, e) {
|
|
1242
1246
|
try {
|
|
@@ -1245,15 +1249,15 @@ function A(t, e) {
|
|
|
1245
1249
|
hour: "numeric",
|
|
1246
1250
|
timeZoneName: "longOffset"
|
|
1247
1251
|
}).format))(e).split("GMT")[1] || "";
|
|
1248
|
-
return r in Y ? Y[r] :
|
|
1252
|
+
return r in Y ? Y[r] : et(r, r.split(":"));
|
|
1249
1253
|
} catch {
|
|
1250
1254
|
if (t in Y) return Y[t];
|
|
1251
|
-
const n = t == null ? void 0 : t.match(
|
|
1252
|
-
return n ?
|
|
1255
|
+
const n = t == null ? void 0 : t.match(xe);
|
|
1256
|
+
return n ? et(t, n.slice(1)) : NaN;
|
|
1253
1257
|
}
|
|
1254
1258
|
}
|
|
1255
|
-
const
|
|
1256
|
-
function
|
|
1259
|
+
const xe = /([+-]\d\d):?(\d\d)?/;
|
|
1260
|
+
function et(t, e) {
|
|
1257
1261
|
const n = +e[0], r = +(e[1] || 0);
|
|
1258
1262
|
return Y[t] = n > 0 ? n * 60 + r : n * 60 - r;
|
|
1259
1263
|
}
|
|
@@ -1285,14 +1289,14 @@ class M extends Date {
|
|
|
1285
1289
|
}
|
|
1286
1290
|
//#endregion
|
|
1287
1291
|
}
|
|
1288
|
-
const
|
|
1292
|
+
const nt = /^(get|set)(?!UTC)/;
|
|
1289
1293
|
Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
1290
|
-
if (!
|
|
1291
|
-
const e = t.replace(
|
|
1294
|
+
if (!nt.test(t)) return;
|
|
1295
|
+
const e = t.replace(nt, "$1UTC");
|
|
1292
1296
|
M.prototype[e] && (t.startsWith("get") ? M.prototype[t] = function() {
|
|
1293
1297
|
return this.internal[e]();
|
|
1294
1298
|
} : (M.prototype[t] = function() {
|
|
1295
|
-
return Date.prototype[e].apply(this.internal, arguments),
|
|
1299
|
+
return Date.prototype[e].apply(this.internal, arguments), Te(this), +this;
|
|
1296
1300
|
}, M.prototype[e] = function() {
|
|
1297
1301
|
return Date.prototype[e].apply(this, arguments), G(this), +this;
|
|
1298
1302
|
}));
|
|
@@ -1300,7 +1304,7 @@ Object.getOwnPropertyNames(Date.prototype).forEach((t) => {
|
|
|
1300
1304
|
function G(t) {
|
|
1301
1305
|
t.internal.setTime(+t), t.internal.setUTCMinutes(t.internal.getUTCMinutes() - t.getTimezoneOffset());
|
|
1302
1306
|
}
|
|
1303
|
-
function
|
|
1307
|
+
function Te(t) {
|
|
1304
1308
|
Date.prototype.setFullYear.call(t, t.internal.getUTCFullYear(), t.internal.getUTCMonth(), t.internal.getUTCDate()), Date.prototype.setHours.call(t, t.internal.getUTCHours(), t.internal.getUTCMinutes(), t.internal.getUTCSeconds(), t.internal.getUTCMilliseconds()), ut(t);
|
|
1305
1309
|
}
|
|
1306
1310
|
function ut(t) {
|
|
@@ -1337,7 +1341,7 @@ class T extends M {
|
|
|
1337
1341
|
}
|
|
1338
1342
|
toTimeString() {
|
|
1339
1343
|
const e = this.internal.toUTCString().split(" ")[4], [n, r, a] = this.tzComponents();
|
|
1340
|
-
return `${e} GMT${n}${r}${a} (${
|
|
1344
|
+
return `${e} GMT${n}${r}${a} (${Oe(this.timeZone, this)})`;
|
|
1341
1345
|
}
|
|
1342
1346
|
toLocaleString(e, n) {
|
|
1343
1347
|
return Date.prototype.toLocaleString.call(this, e, {
|
|
@@ -1373,19 +1377,19 @@ class T extends M {
|
|
|
1373
1377
|
}
|
|
1374
1378
|
//#endregion
|
|
1375
1379
|
}
|
|
1376
|
-
function
|
|
1380
|
+
function Oe(t, e) {
|
|
1377
1381
|
return new Intl.DateTimeFormat("en-GB", {
|
|
1378
1382
|
timeZone: t,
|
|
1379
1383
|
timeZoneName: "long"
|
|
1380
1384
|
}).format(e).slice(12);
|
|
1381
1385
|
}
|
|
1382
1386
|
window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz;
|
|
1383
|
-
const b = (t) => t.toISOString().split("T")[0],
|
|
1387
|
+
const b = (t) => t.toISOString().split("T")[0], Ie = (t) => {
|
|
1384
1388
|
if (!t)
|
|
1385
1389
|
return null;
|
|
1386
|
-
const e =
|
|
1390
|
+
const e = at(new T(t, window.pktTz), 12);
|
|
1387
1391
|
return isNaN(e.getTime()) ? null : e;
|
|
1388
|
-
},
|
|
1392
|
+
}, qe = (t, e) => {
|
|
1389
1393
|
const n = p(t);
|
|
1390
1394
|
return isNaN(n.getTime()) ? "" : ve(n, e);
|
|
1391
1395
|
}, p = (t = "", e) => {
|
|
@@ -1393,20 +1397,20 @@ const b = (t) => t.toISOString().split("T")[0], _e = (t) => {
|
|
|
1393
1397
|
return e ? new T(
|
|
1394
1398
|
e === "end" ? Dt(n) : Q(n),
|
|
1395
1399
|
window.pktTz
|
|
1396
|
-
) :
|
|
1397
|
-
}, P = (t, e, n = 1) =>
|
|
1400
|
+
) : Me(new T(n.toString(), window.pktTz), 12);
|
|
1401
|
+
}, P = (t, e, n = 1) => at(new T(t, e, n, window.pktTz), 12), Pe = (t) => new Intl.DateTimeFormat("no", { dateStyle: "full", timeZone: window.pktTz }).format(t), Ce = (t) => {
|
|
1398
1402
|
if (Array.isArray(t)) return t;
|
|
1399
1403
|
if (typeof t == "string") return t.split(",");
|
|
1400
|
-
},
|
|
1404
|
+
}, $e = (t) => t ? new Date(t) : null, Ee = (t) => {
|
|
1401
1405
|
if (typeof t == "string")
|
|
1402
1406
|
return t.split(",").map((e) => new Date(e));
|
|
1403
1407
|
if (Array.isArray(t))
|
|
1404
1408
|
return t.map((e) => new Date(e));
|
|
1405
1409
|
}, L = {
|
|
1406
|
-
csvToArray:
|
|
1407
|
-
stringToDate:
|
|
1408
|
-
stringsToDate:
|
|
1409
|
-
},
|
|
1410
|
+
csvToArray: Ce,
|
|
1411
|
+
stringToDate: $e,
|
|
1412
|
+
stringsToDate: Ee
|
|
1413
|
+
}, We = {
|
|
1410
1414
|
earliest: {
|
|
1411
1415
|
default: null
|
|
1412
1416
|
},
|
|
@@ -1429,12 +1433,12 @@ const b = (t) => t.toISOString().split("T")[0], _e = (t) => {
|
|
|
1429
1433
|
default: !1
|
|
1430
1434
|
}
|
|
1431
1435
|
}, C = {
|
|
1432
|
-
props:
|
|
1436
|
+
props: We
|
|
1433
1437
|
};
|
|
1434
|
-
var
|
|
1435
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
1438
|
+
var Ne = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, h = (t, e, n, r) => {
|
|
1439
|
+
for (var a = r > 1 ? void 0 : r ? Ye(e, n) : e, s = t.length - 1, i; s >= 0; s--)
|
|
1436
1440
|
(i = t[s]) && (a = (r ? i(e, n, a) : i(a)) || a);
|
|
1437
|
-
return r && a &&
|
|
1441
|
+
return r && a && Ne(e, n, a), a;
|
|
1438
1442
|
};
|
|
1439
1443
|
let u = class extends dt {
|
|
1440
1444
|
constructor() {
|
|
@@ -1628,7 +1632,7 @@ let u = class extends dt {
|
|
|
1628
1632
|
}
|
|
1629
1633
|
renderDayView(t, e, n) {
|
|
1630
1634
|
var y;
|
|
1631
|
-
const r = P(this.year, this.month, t), a = b(r), s = a === b(e), i = this.selected.includes(a), c =
|
|
1635
|
+
const r = P(this.year, this.month, t), a = b(r), s = a === b(e), i = this.selected.includes(a), c = Pe(r), o = this.isExcluded(n, r) || !i && this.multiple && this.maxMultiple > 0 && this.selected.length >= this.maxMultiple, d = this.focusedDate ? this.focusedDate === a && !o ? "0" : "-1" : !o && this.tabIndexSet === 0 || this.tabIndexSet === t ? "0" : "-1";
|
|
1632
1636
|
d === "0" && (this.tabIndexSet = t), this.selectableDates.push({ currentDateISO: a, isDisabled: o, tabindex: d });
|
|
1633
1637
|
const g = {
|
|
1634
1638
|
"pkt-cal-today": s,
|
|
@@ -1889,19 +1893,19 @@ h([
|
|
|
1889
1893
|
m({ type: Date })
|
|
1890
1894
|
], u.prototype, "rangeHovered", 2);
|
|
1891
1895
|
h([
|
|
1892
|
-
|
|
1896
|
+
F()
|
|
1893
1897
|
], u.prototype, "inRange", 2);
|
|
1894
1898
|
h([
|
|
1895
|
-
|
|
1899
|
+
F()
|
|
1896
1900
|
], u.prototype, "focusedDate", 2);
|
|
1897
1901
|
h([
|
|
1898
|
-
|
|
1902
|
+
F()
|
|
1899
1903
|
], u.prototype, "selectableDates", 2);
|
|
1900
1904
|
h([
|
|
1901
|
-
|
|
1905
|
+
F()
|
|
1902
1906
|
], u.prototype, "currentmonthtouched", 2);
|
|
1903
1907
|
h([
|
|
1904
|
-
|
|
1908
|
+
F()
|
|
1905
1909
|
], u.prototype, "tabIndexSet", 2);
|
|
1906
1910
|
u = h([
|
|
1907
1911
|
ft("pkt-calendar")
|
|
@@ -1909,9 +1913,9 @@ u = h([
|
|
|
1909
1913
|
export {
|
|
1910
1914
|
u as P,
|
|
1911
1915
|
b as a,
|
|
1912
|
-
|
|
1913
|
-
|
|
1916
|
+
qe as b,
|
|
1917
|
+
Ce as c,
|
|
1914
1918
|
L as d,
|
|
1915
|
-
|
|
1919
|
+
Ie as f,
|
|
1916
1920
|
p as n
|
|
1917
1921
|
};
|
|
@@ -2,7 +2,7 @@ import { e as f } from "./class-map-KyMqi0fa.js";
|
|
|
2
2
|
import { o } from "./if-defined-BErSJCeJ.js";
|
|
3
3
|
import { x as p, E as m, n as r, a as w } from "./element-DjjF_tEh.js";
|
|
4
4
|
import { r as b } from "./state-BtbpSrdV.js";
|
|
5
|
-
import { n as $, f as v, a as R, b as y, d as x } from "./calendar-
|
|
5
|
+
import { n as $, f as v, a as R, b as y, d as x } from "./calendar-KDcOWD6V.js";
|
|
6
6
|
import { P as C } from "./input-element-Bic-t96S.js";
|
|
7
7
|
import { e as g, n as u } from "./ref-iIffqQAI.js";
|
|
8
8
|
import { c as _ } from "./repeat-D4kMediE.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const d=require("./class-map-DCyaICmy.cjs"),u=require("./if-defined-a3sotaUr.cjs"),s=require("./element-BSypUpzA.cjs"),k=require("./state-B5KCNjEd.cjs"),h=require("./calendar-
|
|
1
|
+
"use strict";const d=require("./class-map-DCyaICmy.cjs"),u=require("./if-defined-a3sotaUr.cjs"),s=require("./element-BSypUpzA.cjs"),k=require("./state-B5KCNjEd.cjs"),h=require("./calendar-CYY42kN4.cjs"),m=require("./input-element-C9ma8cdz.cjs"),r=require("./ref-BvbyvXRH.cjs"),v=require("./repeat-BnuruAat.cjs");require("./icon-BnKGwYjj.cjs");require("./input-wrapper-Cn929YTV.cjs");require("./tag-CgkUxA5D.cjs");const $=require("./pkt-slot-controller-plQxXRvV.cjs"),y={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},o={props:y};var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var n=i>1?void 0:i?b(t,e):t,a=c.length-1,p;a>=0;a--)(p=c[a])&&(n=(i?p(t,e,n):p(n))||n);return i&&n&&x(t,e,n),n};const g=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends m.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=o.props.dateformat.default,this.multiple=o.props.multiple.default,this.maxlength=null,this.range=o.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=o.props.weeknumbers.default,this.withcontrols=o.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=t=>{const e=t.target;if(!e.value)return;const i=this.min?h.newDate(this.min):null,n=this.max?h.newDate(this.max):null,a=h.newDate(e.value.split(",")[0]);a&&!isNaN(a.getTime())&&(!i||a>=i)&&(!n||a<=n)&&this.calRef.value&&this.calRef.value.handleDateSelect(a),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var n,a;(n=this.inputRef)!=null&&n.value&&((a=this.btnRef)!=null&&a.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||o.props.min.default,this.max=this.max||o.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await g(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,e,i){if(t==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==e&&this.valueChanged(i,e)}t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,t.get("value"))}super.updated(t)}renderInput(){return s.x`
|
|
2
2
|
<input
|
|
3
3
|
class="${d.e(this.inputClasses)}"
|
|
4
4
|
.type=${this.inputType}
|
package/dist/pkt-calendar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-CYY42kN4.cjs"),t=e.PktCalendar;Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});exports.default=t;
|
package/dist/pkt-calendar.js
CHANGED
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-cR9MtXOh.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
|
package/dist/pkt-datepicker.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./alert-DWIElKEZ.cjs"),l=require("./accordionitem-cvsySqgK.cjs"),P=require("./backlink-HHM21crL.cjs"),b=require("./button-BNdVIhUp.cjs"),p=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./alert-DWIElKEZ.cjs"),l=require("./accordionitem-cvsySqgK.cjs"),P=require("./backlink-HHM21crL.cjs"),b=require("./button-BNdVIhUp.cjs"),p=require("./calendar-CYY42kN4.cjs"),m=require("./card-BDcr3PII.cjs"),g=require("./combobox-D9NKnao2.cjs"),h=require("./checkbox-CqatE-eX.cjs"),t=require("./element-BSypUpzA.cjs"),f=require("./pkt-slot-controller-plQxXRvV.cjs"),s=require("./ref-BvbyvXRH.cjs"),y=require("./class-map-DCyaICmy.cjs"),O=require("./datepicker-cR9MtXOh.cjs"),j=require("./helptext-CCnYxYA9.cjs"),q=require("./heading-CP3NaeWE.cjs"),x=require("./icon-BnKGwYjj.cjs"),C=require("./input-wrapper-Cn929YTV.cjs"),v=require("./link-CnibgS3c.cjs"),S=require("./linkcard-DPGX1kb1.cjs"),$=require("./loader-BN4q8pSl.cjs"),L=require("./messagebox-BWJr42m9.cjs"),_=require("./modal-cPcTJriW.cjs"),A=require("./progressbar-DiRfScnB.cjs"),d=require("./radiobutton-CIW0FvT8.cjs"),B=require("./tag-CgkUxA5D.cjs"),T=require("./textarea-qX4Inr1X.cjs"),I=require("./textinput-BlsgLNwW.cjs"),M=require("./select-BJziJVde.cjs");var R=Object.defineProperty,H=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?H(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&R(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new f.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${y.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { P as A } from "./alert-B5lVS6Qs.js";
|
|
|
2
2
|
import { P as B, a as E } from "./accordionitem-Db-3WiJS.js";
|
|
3
3
|
import { P as O } from "./backlink-hvyJmwrO.js";
|
|
4
4
|
import { P as T } from "./button-B6uRE7uT.js";
|
|
5
|
-
import { c as f } from "./calendar-
|
|
6
|
-
import { P as D } from "./calendar-
|
|
5
|
+
import { c as f } from "./calendar-KDcOWD6V.js";
|
|
6
|
+
import { P as D } from "./calendar-KDcOWD6V.js";
|
|
7
7
|
import { P as G } from "./card-B5zTEmH1.js";
|
|
8
8
|
import { P as K } from "./combobox-CELUAZxF.js";
|
|
9
9
|
import { P as U } from "./checkbox-CyYfA2fu.js";
|
|
@@ -11,7 +11,7 @@ import { P as h, t as k, x as P, n, a as c } from "./element-DjjF_tEh.js";
|
|
|
11
11
|
import { P as x } from "./pkt-slot-controller-DFrc5O93.js";
|
|
12
12
|
import { e as m, n as d } from "./ref-iIffqQAI.js";
|
|
13
13
|
import { e as u } from "./class-map-KyMqi0fa.js";
|
|
14
|
-
import { P as q } from "./datepicker-
|
|
14
|
+
import { P as q } from "./datepicker-CpkTwszH.js";
|
|
15
15
|
import { P as F } from "./helptext-BLHAJ1aC.js";
|
|
16
16
|
import { P as Q } from "./heading-BkC05ohM.js";
|
|
17
17
|
import { P as X } from "./icon-Beoxup8E.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.36.
|
|
3
|
+
"version": "12.36.2",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
58
58
|
},
|
|
59
59
|
"license": "MIT",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "1e3fb63fe624f75fea89a821a5ce09505c62d71a"
|
|
61
61
|
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";const lt=require("./class-map-DCyaICmy.cjs"),o=require("./element-BSypUpzA.cjs"),A=require("./state-B5KCNjEd.cjs");require("./icon-BnKGwYjj.cjs");const et=6048e5,ut=864e5,ht=36e5,Q=Symbol.for("constructDateFrom");function D(n,t){return typeof n=="function"?n(t):n&&typeof n=="object"&&Q in n?n[Q](t):n instanceof Date?new n.constructor(t):new Date(t)}function k(n,t){return D(t||n,n)}function q(n,t,e){const r=k(n,e==null?void 0:e.in);return isNaN(t)?D(n,NaN):(t&&r.setDate(r.getDate()+t),r)}function dt(n,t,e){return D(n,+k(n)+t)}function j(n,t,e){return dt(n,t*ht)}let ft={};function _(){return ft}function Y(n,t){var c,l,u,f;const e=_(),r=(t==null?void 0:t.weekStartsOn)??((l=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((f=(u=e.locale)==null?void 0:u.options)==null?void 0:f.weekStartsOn)??0,a=k(n,t==null?void 0:t.in),s=a.getDay(),i=(s<r?7:0)+s-r;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function H(n,t){return Y(n,{...t,weekStartsOn:1})}function nt(n,t){const e=k(n,t==null?void 0:t.in),r=e.getFullYear(),a=D(e,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const s=H(a),i=D(e,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const c=H(i);return e.getTime()>=s.getTime()?r+1:e.getTime()>=c.getTime()?r:r-1}function G(n){const t=k(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function rt(n,...t){const e=D.bind(null,t.find(r=>typeof r=="object"));return t.map(e)}function z(n,t){const e=k(n,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function mt(n,t,e){const[r,a]=rt(e==null?void 0:e.in,n,t),s=z(r),i=z(a),c=+s-G(s),l=+i-G(i);return Math.round((c-l)/ut)}function gt(n,t){const e=nt(n,t),r=D(n,0);return r.setFullYear(e,0,4),r.setHours(0,0,0,0),H(r)}function yt(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function pt(n){return!(!yt(n)&&typeof n!="number"||isNaN(+k(n)))}function wt(n,t){const e=k(n,t==null?void 0:t.in);return e.setHours(23,59,59,999),e}function bt(n,t){const[e,r]=rt(n,t.start,t.end);return{start:e,end:r}}function L(n,t){const{start:e,end:r}=bt(t==null?void 0:t.in,n);let a=+e>+r;const s=a?+e:+r,i=a?r:e;i.setHours(0,0,0,0);let c=1;const l=[];for(;+i<=s;)l.push(D(e,i)),i.setDate(i.getDate()+c),i.setHours(0,0,0,0);return a?l.reverse():l}function kt(n,t){const e=k(n,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const vt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Dt=(n,t,e)=>{let r;const a=vt[n];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+r:r+" ago":r};function R(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const St={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Mt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},xt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Pt={date:R({formats:St,defaultWidth:"full"}),time:R({formats:Mt,defaultWidth:"full"}),dateTime:R({formats:xt,defaultWidth:"full"})},Tt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ot=(n,t,e,r)=>Tt[n];function $(n){return(t,e)=>{const r=e!=null&&e.context?String(e.context):"standalone";let a;if(r==="formatting"&&n.formattingValues){const i=n.defaultFormattingWidth||n.defaultWidth,c=e!=null&&e.width?String(e.width):i;a=n.formattingValues[c]||n.formattingValues[i]}else{const i=n.defaultWidth,c=e!=null&&e.width?String(e.width):n.defaultWidth;a=n.values[c]||n.values[i]}const s=n.argumentCallback?n.argumentCallback(t):t;return a[s]}}const Ct={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Et={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Wt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Nt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Yt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},At=(n,t)=>{const e=Number(n),r=e%100;if(r>20||r<10)switch(r%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},Ft={ordinalNumber:At,era:$({values:Ct,defaultWidth:"wide"}),quarter:$({values:$t,defaultWidth:"wide",argumentCallback:n=>n-1}),month:$({values:Et,defaultWidth:"wide"}),day:$({values:Wt,defaultWidth:"wide"}),dayPeriod:$({values:Nt,defaultWidth:"wide",formattingValues:Yt,defaultFormattingWidth:"wide"})};function E(n){return(t,e={})=>{const r=e.width,a=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],s=t.match(a);if(!s)return null;const i=s[0],c=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(c)?_t(c,w=>w.test(i)):Ht(c,w=>w.test(i));let u;u=n.valueCallback?n.valueCallback(l):l,u=e.valueCallback?e.valueCallback(u):u;const f=t.slice(i.length);return{value:u,rest:f}}}function Ht(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function _t(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function It(n){return(t,e={})=>{const r=t.match(n.matchPattern);if(!r)return null;const a=r[0],s=t.match(n.parsePattern);if(!s)return null;let i=n.valueCallback?n.valueCallback(s[0]):s[0];i=e.valueCallback?e.valueCallback(i):i;const c=t.slice(a.length);return{value:i,rest:c}}}const qt=/^(\d+)(th|st|nd|rd)?/i,Lt=/\d+/i,Rt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ut={any:[/^b/i,/^(a|c)/i]},zt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Bt={any:[/1/i,/2/i,/3/i,/4/i]},jt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Qt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Gt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Xt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Vt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Jt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Kt={ordinalNumber:It({matchPattern:qt,parsePattern:Lt,valueCallback:n=>parseInt(n,10)}),era:E({matchPatterns:Rt,defaultMatchWidth:"wide",parsePatterns:Ut,defaultParseWidth:"any"}),quarter:E({matchPatterns:zt,defaultMatchWidth:"wide",parsePatterns:Bt,defaultParseWidth:"any",valueCallback:n=>n+1}),month:E({matchPatterns:jt,defaultMatchWidth:"wide",parsePatterns:Qt,defaultParseWidth:"any"}),day:E({matchPatterns:Gt,defaultMatchWidth:"wide",parsePatterns:Xt,defaultParseWidth:"any"}),dayPeriod:E({matchPatterns:Vt,defaultMatchWidth:"any",parsePatterns:Jt,defaultParseWidth:"any"})},Zt={code:"en-US",formatDistance:Dt,formatLong:Pt,formatRelative:Ot,localize:Ft,match:Kt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function te(n,t){const e=k(n,t==null?void 0:t.in);return mt(e,kt(e))+1}function ee(n,t){const e=k(n,t==null?void 0:t.in),r=+H(e)-+gt(e);return Math.round(r/et)+1}function at(n,t){var f,w,b,m;const e=k(n,t==null?void 0:t.in),r=e.getFullYear(),a=_(),s=(t==null?void 0:t.firstWeekContainsDate)??((w=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:w.firstWeekContainsDate)??a.firstWeekContainsDate??((m=(b=a.locale)==null?void 0:b.options)==null?void 0:m.firstWeekContainsDate)??1,i=D((t==null?void 0:t.in)||n,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const c=Y(i,t),l=D((t==null?void 0:t.in)||n,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const u=Y(l,t);return+e>=+c?r+1:+e>=+u?r:r-1}function ne(n,t){var c,l,u,f;const e=_(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((f=(u=e.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??1,a=at(n,t),s=D((t==null?void 0:t.in)||n,0);return s.setFullYear(a,0,r),s.setHours(0,0,0,0),Y(s,t)}function st(n,t){const e=k(n,t==null?void 0:t.in),r=+Y(e,t)-+ne(e,t);return Math.round(r/et)+1}function h(n,t){const e=n<0?"-":"",r=Math.abs(n).toString().padStart(t,"0");return e+r}const x={y(n,t){const e=n.getFullYear(),r=e>0?e:1-e;return h(t==="yy"?r%100:r,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):h(e+1,2)},d(n,t){return h(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return h(n.getHours()%12||12,t.length)},H(n,t){return h(n.getHours(),t.length)},m(n,t){return h(n.getMinutes(),t.length)},s(n,t){return h(n.getSeconds(),t.length)},S(n,t){const e=t.length,r=n.getMilliseconds(),a=Math.trunc(r*Math.pow(10,e-3));return h(a,t.length)}},C={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},X={G:function(n,t,e){const r=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(r,{width:"abbreviated"});case"GGGGG":return e.era(r,{width:"narrow"});case"GGGG":default:return e.era(r,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const r=n.getFullYear(),a=r>0?r:1-r;return e.ordinalNumber(a,{unit:"year"})}return x.y(n,t)},Y:function(n,t,e,r){const a=at(n,r),s=a>0?a:1-a;if(t==="YY"){const i=s%100;return h(i,2)}return t==="Yo"?e.ordinalNumber(s,{unit:"year"}):h(s,t.length)},R:function(n,t){const e=nt(n);return h(e,t.length)},u:function(n,t){const e=n.getFullYear();return h(e,t.length)},Q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return h(r,2);case"Qo":return e.ordinalNumber(r,{unit:"quarter"});case"QQQ":return e.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return h(r,2);case"qo":return e.ordinalNumber(r,{unit:"quarter"});case"qqq":return e.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,t,e){const r=n.getMonth();switch(t){case"M":case"MM":return x.M(n,t);case"Mo":return e.ordinalNumber(r+1,{unit:"month"});case"MMM":return e.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(r,{width:"wide",context:"formatting"})}},L:function(n,t,e){const r=n.getMonth();switch(t){case"L":return String(r+1);case"LL":return h(r+1,2);case"Lo":return e.ordinalNumber(r+1,{unit:"month"});case"LLL":return e.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(r,{width:"wide",context:"standalone"})}},w:function(n,t,e,r){const a=st(n,r);return t==="wo"?e.ordinalNumber(a,{unit:"week"}):h(a,t.length)},I:function(n,t,e){const r=ee(n);return t==="Io"?e.ordinalNumber(r,{unit:"week"}):h(r,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):x.d(n,t)},D:function(n,t,e){const r=te(n);return t==="Do"?e.ordinalNumber(r,{unit:"dayOfYear"}):h(r,t.length)},E:function(n,t,e){const r=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(r,{width:"short",context:"formatting"});case"EEEE":default:return e.day(r,{width:"wide",context:"formatting"})}},e:function(n,t,e,r){const a=n.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return h(s,2);case"eo":return e.ordinalNumber(s,{unit:"day"});case"eee":return e.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(a,{width:"short",context:"formatting"});case"eeee":default:return e.day(a,{width:"wide",context:"formatting"})}},c:function(n,t,e,r){const a=n.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return h(s,t.length);case"co":return e.ordinalNumber(s,{unit:"day"});case"ccc":return e.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(a,{width:"narrow",context:"standalone"});case"cccccc":return e.day(a,{width:"short",context:"standalone"});case"cccc":default:return e.day(a,{width:"wide",context:"standalone"})}},i:function(n,t,e){const r=n.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return h(a,t.length);case"io":return e.ordinalNumber(a,{unit:"day"});case"iii":return e.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(r,{width:"short",context:"formatting"});case"iiii":default:return e.day(r,{width:"wide",context:"formatting"})}},a:function(n,t,e){const a=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(n,t,e){const r=n.getHours();let a;switch(r===12?a=C.noon:r===0?a=C.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(n,t,e){const r=n.getHours();let a;switch(r>=17?a=C.evening:r>=12?a=C.afternoon:r>=4?a=C.morning:a=C.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let r=n.getHours()%12;return r===0&&(r=12),e.ordinalNumber(r,{unit:"hour"})}return x.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):x.H(n,t)},K:function(n,t,e){const r=n.getHours()%12;return t==="Ko"?e.ordinalNumber(r,{unit:"hour"}):h(r,t.length)},k:function(n,t,e){let r=n.getHours();return r===0&&(r=24),t==="ko"?e.ordinalNumber(r,{unit:"hour"}):h(r,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):x.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):x.s(n,t)},S:function(n,t){return x.S(n,t)},X:function(n,t,e){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return J(r);case"XXXX":case"XX":return O(r);case"XXXXX":case"XXX":default:return O(r,":")}},x:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"x":return J(r);case"xxxx":case"xx":return O(r);case"xxxxx":case"xxx":default:return O(r,":")}},O:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+V(r,":");case"OOOO":default:return"GMT"+O(r,":")}},z:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+V(r,":");case"zzzz":default:return"GMT"+O(r,":")}},t:function(n,t,e){const r=Math.trunc(+n/1e3);return h(r,t.length)},T:function(n,t,e){return h(+n,t.length)}};function V(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=Math.trunc(r/60),s=r%60;return s===0?e+String(a):e+String(a)+t+h(s,2)}function J(n,t){return n%60===0?(n>0?"-":"+")+h(Math.abs(n)/60,2):O(n,t)}function O(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=h(Math.trunc(r/60),2),s=h(r%60,2);return e+a+t+s}const K=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},it=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},re=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],r=e[1],a=e[2];if(!a)return K(n,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",K(r,t)).replace("{{time}}",it(a,t))},ae={p:it,P:re},se=/^D+$/,ie=/^Y+$/,oe=["D","DD","YY","YYYY"];function ce(n){return se.test(n)}function le(n){return ie.test(n)}function ue(n,t,e){const r=he(n,t,e);if(console.warn(r),oe.includes(n))throw new RangeError(r)}function he(n,t,e){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${r} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const de=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,me=/^'([^]*?)'?$/,ge=/''/g,ye=/[a-zA-Z]/;function pe(n,t,e){var f,w,b,m;const r=_(),a=r.locale??Zt,s=r.firstWeekContainsDate??((w=(f=r.locale)==null?void 0:f.options)==null?void 0:w.firstWeekContainsDate)??1,i=r.weekStartsOn??((m=(b=r.locale)==null?void 0:b.options)==null?void 0:m.weekStartsOn)??0,c=k(n,e==null?void 0:e.in);if(!pt(c))throw new RangeError("Invalid time value");let l=t.match(fe).map(g=>{const v=g[0];if(v==="p"||v==="P"){const I=ae[v];return I(g,a.formatLong)}return g}).join("").match(de).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const v=g[0];if(v==="'")return{isToken:!1,value:we(g)};if(X[v])return{isToken:!0,value:g};if(v.match(ye))throw new RangeError("Format string contains an unescaped latin alphabet character `"+v+"`");return{isToken:!1,value:g}});a.localize.preprocessor&&(l=a.localize.preprocessor(c,l));const u={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return l.map(g=>{if(!g.isToken)return g.value;const v=g.value;(le(v)||ce(v))&&ue(v,t,String(n));const I=X[v[0]];return I(c,v,a.localize,u)}).join("")}function we(n){const t=n.match(me);return t?t[1].replace(ge,"'"):n}function be(n,t){const e=k(n,t==null?void 0:t.in).getDay();return e===0?7:e}const U={},W={};function N(n,t){try{const r=(U[n]||(U[n]=new Intl.DateTimeFormat("en-GB",{timeZone:n,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return r in W?W[r]:Z(r,r.split(":"))}catch{if(n in W)return W[n];const e=n==null?void 0:n.match(ke);return e?Z(n,e.slice(1)):NaN}}const ke=/([+-]\d\d):?(\d\d)?/;function Z(n,t){const e=+t[0],r=+(t[1]||0);return W[n]=e>0?e*60+r:e*60-r}class S extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(N(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),ot(this),B(this)):this.setTime(Date.now())}static tz(t,...e){return e.length?new S(...e,t):new S(Date.now(),t)}withTimeZone(t){return new S(+this,t)}getTimezoneOffset(){return-N(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),B(this),+this}[Symbol.for("constructDateFrom")](t){return new S(+new Date(t),this.timeZone)}}const tt=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!tt.test(n))return;const t=n.replace(tt,"$1UTC");S.prototype[t]&&(n.startsWith("get")?S.prototype[n]=function(){return this.internal[t]()}:(S.prototype[n]=function(){return Date.prototype[t].apply(this.internal,arguments),ve(this),+this},S.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),B(this),+this}))});function B(n){n.internal.setTime(+n),n.internal.setUTCMinutes(n.internal.getUTCMinutes()-n.getTimezoneOffset())}function ve(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),ot(n)}function ot(n){const t=N(n.timeZone,n),e=new Date(+n);e.setUTCHours(e.getUTCHours()-1);const r=-new Date(+n).getTimezoneOffset(),a=-new Date(+e).getTimezoneOffset(),s=r-a,i=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();s&&i&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+s);const c=r-t;c&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+c);const l=N(n.timeZone,n),f=-new Date(+n).getTimezoneOffset()-l,w=l!==t,b=f-c;if(w&&b){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+b);const m=N(n.timeZone,n),g=l-m;g&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+g),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+g))}}class M extends S{static tz(t,...e){return e.length?new M(...e,t):new M(Date.now(),t)}toISOString(){const[t,e,r]=this.tzComponents(),a=`${t}${e}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,e,r,a]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${e} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[e,r,a]=this.tzComponents();return`${t} GMT${e}${r}${a} (${De(this.timeZone,this)})`}toLocaleString(t,e){return Date.prototype.toLocaleString.call(this,t,{...e,timeZone:(e==null?void 0:e.timeZone)||this.timeZone})}toLocaleDateString(t,e){return Date.prototype.toLocaleDateString.call(this,t,{...e,timeZone:(e==null?void 0:e.timeZone)||this.timeZone})}toLocaleTimeString(t,e){return Date.prototype.toLocaleTimeString.call(this,t,{...e,timeZone:(e==null?void 0:e.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),e=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[e,r,a]}withTimeZone(t){return new M(+this,t)}[Symbol.for("constructDateFrom")](t){return new M(+new Date(t),this.timeZone)}}function De(n,t){return new Intl.DateTimeFormat("en-GB",{timeZone:n,timeZoneName:"long"}).format(t).slice(12)}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const p=n=>n.toISOString().split("T")[0],Se=n=>{if(!n)return null;const t=j(new M(n,window.pktTz),12);return isNaN(t.getTime())?null:t},Me=(n,t)=>{const e=y(n);return isNaN(e.getTime())?"":pe(e,t)},y=(n="",t)=>{const e=n===""||!n?new Date:n;return t?new M(t==="end"?wt(e):z(e),window.pktTz):j(new M(e.toString(),window.pktTz),12)},P=(n,t,e=1)=>j(new M(n,t,e,window.pktTz),12),xe=n=>new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:window.pktTz}).format(n),ct=n=>{if(Array.isArray(n))return n;if(typeof n=="string")return n.split(",")},Pe=n=>n?new Date(n):null,Te=n=>{if(typeof n=="string")return n.split(",").map(t=>new Date(t));if(Array.isArray(n))return n.map(t=>new Date(t))},F={csvToArray:ct,stringToDate:Pe,stringsToDate:Te},Oe={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},T={props:Oe};var Ce=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,d=(n,t,e,r)=>{for(var a=r>1?void 0:r?$e(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(a=(r?i(t,e,a):i(a))||a);return r&&a&&Ce(t,e,a),a};exports.PktCalendar=class extends o.PktElement{constructor(){super(...arguments),this.multiple=T.props.multiple.default,this.maxMultiple=T.props.maxMultiple.default,this.range=T.props.range.default,this.weeknumbers=T.props.weeknumbers.default,this.withcontrols=T.props.withcontrols.default,this.selected=[],this.earliest=T.props.earliest.default,this.latest=T.props.latest.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.dayStrings=this.strings.dates.daysShort,this.dayStringsLong=this.strings.dates.days,this.monthStrings=this.strings.dates.months,this.weekString=this.strings.dates.week,this.prevMonthString=this.strings.dates.prevMonth,this.nextMonthString=this.strings.dates.nextMonth,this._selected=[],this.year=0,this.month=0,this.week=0,this.rangeHovered=null,this.inRange={},this.focusedDate=null,this.selectableDates=[],this.currentmonthtouched=!1,this.tabIndexSet=0}connectedCallback(){super.connectedCallback()}disconnectedCallback(){this.removeEventListener("keydown",this.handleKeydown),super.disconnectedCallback()}attributeChangedCallback(t,e,r){t==="selected"&&r&&this.convertSelected(),super.attributeChangedCallback(t,e,r)}updated(t){super.updated(t),t.has("selected")&&this.convertSelected()}firstUpdated(t){this.addEventListener("keydown",this.handleKeydown)}convertSelected(){if(typeof this.selected=="string"&&(this.selected=this.selected.split(",")),this.selected.length===1&&this.selected[0]===""&&(this.selected=[]),this._selected=this.selected.map(t=>y(t)),this.range&&this.selected.length===2){const t=L({start:y(this.selected[0]),end:y(this.selected[1])});if(this.inRange={},Array.isArray(t)&&t.length){const e={};for(let r=0;r<t.length;r++)e[p(t[r])]=this.isInRange(t[r]);this.inRange=e}}this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched){this.currentmonthtouched=!0;return}this.selected.length&&this.selected[0]!==""?this.currentmonth=y(this.selected[this.selected.length-1]):this.currentmonth===null&&(this.currentmonth=y()),this.year=this.currentmonth.getFullYear(),this.month=this.currentmonth.getMonth()}handleKeydown(t){switch(t.key){case"ArrowLeft":this.handleArrowKey(t,-1);break;case"ArrowRight":this.handleArrowKey(t,1);break;case"ArrowUp":this.handleArrowKey(t,-7);break;case"ArrowDown":this.handleArrowKey(t,7);break}}handleArrowKey(t,e){var s,i,c;if(((s=t.target)==null?void 0:s.nodeName)==="INPUT"||((i=t.target)==null?void 0:i.nodeName)==="SELECT"||((c=t.target)==null?void 0:c.nodeName)==="BUTTON")return;t.preventDefault(),this.focusedDate||this.focusOnCurrentDate();const r=this.focusedDate?y(this.focusedDate):P(this.year,this.month,1);let a=q(r,e);if(a){let l=this.querySelector(`div[data-date="${p(a)}"]`);if(l instanceof HTMLDivElement){if(l.dataset.disabled){a=q(a,e);let u=this.querySelector(`div[data-date="${p(a)}"]`);for(;u&&u instanceof HTMLDivElement&&u.dataset.disabled;)a=q(a,e),u=this.querySelector(`div[data-date="${p(a)}"]`);l=u}l instanceof HTMLDivElement&&!l.dataset.disabled&&(this.focusedDate=p(a),l.focus())}}}render(){return o.x`
|
|
2
|
-
<div
|
|
3
|
-
class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":o.E}"
|
|
4
|
-
@focusout=${this.closeEvent}
|
|
5
|
-
@keydown=${t=>{t.key==="Escape"&&(t.preventDefault(),this.close())}}
|
|
6
|
-
>
|
|
7
|
-
<nav class="pkt-cal-month-nav">
|
|
8
|
-
<div>
|
|
9
|
-
<button
|
|
10
|
-
type="button"
|
|
11
|
-
@click=${this.isPrevMonthAllowed()&&this.prevMonth}
|
|
12
|
-
@keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isNextMonthAllowed()&&this.prevMonth())}}
|
|
13
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isPrevMonthAllowed()?"":"pkt-hide"}"
|
|
14
|
-
.data-disabled=${this.isPrevMonthAllowed()?o.E:"disabled"}
|
|
15
|
-
?aria-disabled=${!this.isPrevMonthAllowed()}
|
|
16
|
-
tabindex=${this.isPrevMonthAllowed()?"0":"-1"}
|
|
17
|
-
>
|
|
18
|
-
<pkt-icon class="pkt-btn__icon" name="chevron-thin-left"></pkt-icon>
|
|
19
|
-
<span class="pkt-btn__text">${this.prevMonthString}</span>
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
${this.renderMonthNav()}
|
|
23
|
-
<div>
|
|
24
|
-
<button
|
|
25
|
-
type="button"
|
|
26
|
-
@click=${this.isNextMonthAllowed()&&this.nextMonth}
|
|
27
|
-
@keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isNextMonthAllowed()&&this.nextMonth())}}
|
|
28
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only ${this.isNextMonthAllowed()?"":"pkt-hide"}"
|
|
29
|
-
.data-disabled=${this.isNextMonthAllowed()?o.E:"disabled"}
|
|
30
|
-
?aria-disabled=${!this.isNextMonthAllowed()}
|
|
31
|
-
tabindex=${this.isNextMonthAllowed()?"0":"-1"}
|
|
32
|
-
>
|
|
33
|
-
<pkt-icon class="pkt-btn__icon" name="chevron-thin-right"></pkt-icon>
|
|
34
|
-
<span class="pkt-btn__text">${this.nextMonthString}</span>
|
|
35
|
-
</button>
|
|
36
|
-
</div>
|
|
37
|
-
</nav>
|
|
38
|
-
<table
|
|
39
|
-
class="pkt-cal-days pkt-txt-12-medium"
|
|
40
|
-
role="grid"
|
|
41
|
-
?aria-multiselectable=${this.range||this.multiple}
|
|
42
|
-
>
|
|
43
|
-
<thead>
|
|
44
|
-
${this.renderDayNames()}
|
|
45
|
-
</thead>
|
|
46
|
-
<tbody>
|
|
47
|
-
${this.renderCalendarBody()}
|
|
48
|
-
</tbody>
|
|
49
|
-
</table>
|
|
50
|
-
</div>
|
|
51
|
-
`}renderDayNames(){const t=[];this.weeknumbers&&t.push(o.x`<th><div>${this.weekString}</div></th>`);for(let e=0;e<this.dayStrings.length;e++)t.push(o.x`<th><div aria-label="${this.dayStringsLong[e]}">${this.dayStrings[e]}</div></th>`);return o.x`<tr class="pkt-cal-week-row">
|
|
52
|
-
${t}
|
|
53
|
-
</tr>`}renderMonthNav(){let t=[];return this.withcontrols?t.push(o.x`<div class="pkt-cal-month-picker">
|
|
54
|
-
<label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
|
|
55
|
-
<select
|
|
56
|
-
aria-label="${this.strings.dates.month}"
|
|
57
|
-
class="pkt-input pkt-input-compact"
|
|
58
|
-
id="${this.id}-monthnav"
|
|
59
|
-
@change=${e=>{e.stopImmediatePropagation(),this.changeMonth(this.year,e.target.value)}}
|
|
60
|
-
>
|
|
61
|
-
${this.monthStrings.map((e,r)=>o.x`<option value=${r} ?selected=${this.month===r}>${e}</option>`)}
|
|
62
|
-
</select>
|
|
63
|
-
<label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
|
|
64
|
-
<input
|
|
65
|
-
aria-label="${this.strings.dates.year}"
|
|
66
|
-
class="pkt-input pkt-cal-input-year pkt-input-compact"
|
|
67
|
-
id="${this.id}-yearnav"
|
|
68
|
-
type="number"
|
|
69
|
-
size="4"
|
|
70
|
-
placeholder="0000"
|
|
71
|
-
@change=${e=>{e.stopImmediatePropagation(),this.changeMonth(e.target.value,this.month)}}
|
|
72
|
-
.value=${this.year}
|
|
73
|
-
/>
|
|
74
|
-
</div> `):t.push(o.x`<div class="pkt-txt-16-medium" aria-live="polite">
|
|
75
|
-
${this.monthStrings[this.month]} ${this.year}
|
|
76
|
-
</div>`),t}renderDayView(t,e,r){var b;const a=P(this.year,this.month,t),s=p(a),i=s===p(e),c=this.selected.includes(s),l=xe(a),u=this.isExcluded(r,a)||!c&&this.multiple&&this.maxMultiple>0&&this.selected.length>=this.maxMultiple,f=this.focusedDate?this.focusedDate===s&&!u?"0":"-1":!u&&this.tabIndexSet===0||this.tabIndexSet===t?"0":"-1";f==="0"&&(this.tabIndexSet=t),this.selectableDates.push({currentDateISO:s,isDisabled:u,tabindex:f});const w={"pkt-cal-today":i,"pkt-cal-selected":c,"pkt-cal-in-range":this.inRange[s],"pkt-cal-excluded":this.isExcluded(r,a),"pkt-cal-in-range-first":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&s===this.selected[0],"pkt-cal-in-range-last":this.range&&this.selected.length===2&&s===this.selected[1],"pkt-cal-range-hover":this.rangeHovered!==null&&s===p(this.rangeHovered)};return o.x`<td class=${lt.e(w)}>
|
|
77
|
-
<div
|
|
78
|
-
?aria-selected=${c}
|
|
79
|
-
role="gridcell"
|
|
80
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
81
|
-
@mouseover=${()=>this.range&&!this.isExcluded(r,a)&&this.handleRangeHover(a)}
|
|
82
|
-
@focus=${()=>{this.range&&!this.isExcluded(r,a)&&this.handleRangeHover(a),this.focusedDate=s}}
|
|
83
|
-
aria-label="${l}"
|
|
84
|
-
tabindex=${(b=this.selectableDates.find(m=>m.currentDateISO===s))==null?void 0:b.tabindex}
|
|
85
|
-
data-disabled=${u?"disabled":o.E}
|
|
86
|
-
data-date=${s}
|
|
87
|
-
@keydown=${m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),this.handleDateSelect(a))}}
|
|
88
|
-
@click=${m=>{u||(m.preventDefault(),this.handleDateSelect(a))}}
|
|
89
|
-
>
|
|
90
|
-
<span class="pkt-btn__text pkt-txt-14-light">${t}</span>
|
|
91
|
-
</div>
|
|
92
|
-
</td>`}renderCalendarBody(){const t=y(),e=P(this.year,this.month,1),r=P(this.year,this.month+1,0),a=(e.getDay()+6)%7,s=r.getDate(),i=Math.ceil((s+a)/7),l=P(this.year,this.month,0).getDate();let u=1;this.week=st(P(this.year,this.month,1));const f=[];for(let w=0;w<i;w++){const b=[];this.weeknumbers&&b.push(o.x`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let m=1;m<8;m++)if(w===0&&m<a+1){const g=l-(a-m);b.push(o.x`<td class="pkt-cal-other">
|
|
93
|
-
<div
|
|
94
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
95
|
-
data-disabled="disabled"
|
|
96
|
-
>
|
|
97
|
-
<span class="pkt-btn__text pkt-txt-14-light">${g}</span>
|
|
98
|
-
</div>
|
|
99
|
-
</td>`)}else u>s?(b.push(o.x`<td class="pkt-cal-other">
|
|
100
|
-
<div
|
|
101
|
-
class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
|
|
102
|
-
data-disabled="disabled"
|
|
103
|
-
>
|
|
104
|
-
<span class="pkt-btn__text pkt-txt-14-light">${u-s}</span>
|
|
105
|
-
</div>
|
|
106
|
-
</td>`),u++):(b.push(this.renderDayView(u,t,m)),u++);f.push(o.x`<tr class="pkt-cal-week-row" role="row">
|
|
107
|
-
${b}
|
|
108
|
-
</tr>`)}return f}isExcluded(t,e){return this.excludeweekdays.includes(t.toString())||this.earliest&&y(e,"end")<y(this.earliest,"start")||this.latest&&y(e,"start")>y(this.latest,"end")?!0:this.excludedates.some(r=>typeof r=="string"?r===p(e):r.toDateString()===e.toDateString())}isPrevMonthAllowed(){const t=P(this.year,this.month,0);return!(this.earliest&&y(this.earliest)>t)}prevMonth(){const t=this.month===0?11:this.month-1,e=this.month===0?this.year-1:this.year;this.changeMonth(e,t)}isNextMonthAllowed(){const t=P(this.month===11?this.year+1:this.year,this.month===11?0:this.month+1,1);return!(this.latest&&y(this.latest)<t)}nextMonth(){const t=this.month===11?0:this.month+1,e=this.month===11?this.year+1:this.year;this.changeMonth(e,t)}changeMonth(t,e){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof e=="string"?parseInt(e):e,this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}isInRange(t){if(this.range&&this.selected.length===2){if(t>y(this.selected[0])&&t<y(this.selected[1]))return!0}else if(this.range&&this.selected.length===1&&this.rangeHovered&&t>y(this.selected[0])&&t<this.rangeHovered)return!0;return!1}isRangeAllowed(t){let e=!0;if(this._selected.length===1){const r=L({start:this._selected[0],end:t});if(Array.isArray(r)&&r.length)for(let a=0;a<r.length;a++)this.excludedates.forEach(s=>{s>this._selected[0]&&s<t&&(e=!1)}),this.excludeweekdays.includes(be(r[a]).toString())&&(e=!1)}return e}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(t){this.selected.includes(p(t))||(this.selected=[...this.selected,p(t)],this._selected=[...this._selected,t],this.range&&this.selected.length===2&&this.close())}removeFromSelected(t){if(this.selected.length===1)this.emptySelected();else{const e=this.selected.indexOf(p(t)),r=[...this.selected],a=[...this._selected];r.splice(e,1),a.splice(e,1),this.selected=r,this._selected=a}}toggleSelected(t){const e=p(t);this.selected.includes(e)?this.removeFromSelected(t):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(t)}handleRangeSelect(t){const e=p(t);return this.selected.includes(e)?this.selected.indexOf(e)===0?this.emptySelected():this.removeFromSelected(t):this.selected.length>1?(this.emptySelected(),this.addToSelected(t)):(this.selected.length===1&&!this.isRangeAllowed(t)&&this.emptySelected(),this.selected.length===1&&this._selected[0]>t&&this.emptySelected(),this.addToSelected(t)),Promise.resolve()}handleRangeHover(t){if(this.range&&this._selected.length===1&&this.isRangeAllowed(t)&&this._selected[0]<t){this.rangeHovered=t,this.inRange={};const e=L({start:this._selected[0],end:t});if(Array.isArray(e)&&e.length)for(let r=0;r<e.length;r++)this.inRange[p(e[r])]=this.isInRange(e[r])}else this.rangeHovered=null}handleDateSelect(t){if(t)return this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(p(t))?this.emptySelected():(this.emptySelected(),this.addToSelected(t)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0})),Promise.resolve()}focusOnCurrentDate(){const t=p(y()),e=this.querySelector(`div[data-date="${t}"]`);if(e instanceof HTMLDivElement)this.focusedDate=t,e.focus();else{const r=this.selectableDates.find(a=>!a.isDisabled);if(r){const a=this.querySelector(`div[data-date="${r.currentDateISO}"]`);a instanceof HTMLDivElement&&(this.focusedDate=r.currentDateISO,a.focus())}}}closeEvent(t){!this.contains(t.relatedTarget)&&!t.target.classList.contains("pkt-hide")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};d([o.n({type:Boolean})],exports.PktCalendar.prototype,"multiple",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"maxMultiple",2);d([o.n({type:Boolean})],exports.PktCalendar.prototype,"range",2);d([o.n({type:Boolean})],exports.PktCalendar.prototype,"weeknumbers",2);d([o.n({type:Boolean})],exports.PktCalendar.prototype,"withcontrols",2);d([o.n({converter:F.csvToArray})],exports.PktCalendar.prototype,"selected",2);d([o.n({type:String})],exports.PktCalendar.prototype,"earliest",2);d([o.n({type:String})],exports.PktCalendar.prototype,"latest",2);d([o.n({converter:F.stringsToDate})],exports.PktCalendar.prototype,"excludedates",2);d([o.n({converter:F.csvToArray})],exports.PktCalendar.prototype,"excludeweekdays",2);d([o.n({converter:F.stringToDate})],exports.PktCalendar.prototype,"currentmonth",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"dayStrings",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"dayStringsLong",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"monthStrings",2);d([o.n({type:String})],exports.PktCalendar.prototype,"weekString",2);d([o.n({type:String})],exports.PktCalendar.prototype,"prevMonthString",2);d([o.n({type:String})],exports.PktCalendar.prototype,"nextMonthString",2);d([o.n({type:Array})],exports.PktCalendar.prototype,"_selected",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"year",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"month",2);d([o.n({type:Number})],exports.PktCalendar.prototype,"week",2);d([o.n({type:Date})],exports.PktCalendar.prototype,"rangeHovered",2);d([A.r()],exports.PktCalendar.prototype,"inRange",2);d([A.r()],exports.PktCalendar.prototype,"focusedDate",2);d([A.r()],exports.PktCalendar.prototype,"selectableDates",2);d([A.r()],exports.PktCalendar.prototype,"currentmonthtouched",2);d([A.r()],exports.PktCalendar.prototype,"tabIndexSet",2);exports.PktCalendar=d([o.t("pkt-calendar")],exports.PktCalendar);exports.converters=F;exports.csvToArray=ct;exports.formatISODate=p;exports.fromISOToDate=Se;exports.fromISOtoLocal=Me;exports.newDate=y;
|