@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
1 lines • 27.7 kB
JavaScript
var e=365.2425,t=6048e5,n=864e5,r=3600*24;r*7,r*e/12*3;var i=Symbol.for(`constructDateFrom`);function a(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&i in e?e[i](t):e instanceof Date?new e.constructor(t):new Date(t)}function o(e,t){return a(t||e,e)}var s={};function c(){return s}function l(e,t){let n=c(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=o(e,t?.in),a=i.getDay(),s=(a<r?7:0)+a-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function u(e,t){return l(e,{...t,weekStartsOn:1})}function d(e,t){let n=o(e,t?.in),r=n.getFullYear(),i=a(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let s=u(i),c=a(n,0);c.setFullYear(r,0,4),c.setHours(0,0,0,0);let l=u(c);return n.getTime()>=s.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function f(e){let t=o(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function p(e,...t){let n=a.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function m(e,t){let n=o(e,t?.in);return n.setHours(0,0,0,0),n}function h(e,t,r){let[i,a]=p(r?.in,e,t),o=m(i),s=m(a),c=+o-f(o),l=+s-f(s);return Math.round((c-l)/n)}function ee(e,t){let n=d(e,t),r=a(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),u(r)}function te(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function ne(e){return!(!te(e)&&typeof e!=`number`||isNaN(+o(e)))}function re(e,t){let n=o(e,t?.in);return n.setHours(23,59,59,999),n}function ie(e,t){let n=o(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var ae={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`}},oe=(e,t,n)=>{let r,i=ae[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function g(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var se={date:g({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:g({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:g({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},ce={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},le=(e,t,n,r)=>ce[e];function _(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var ue={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:_({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:_({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:_({values:{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`]},defaultWidth:`wide`}),day:_({values:{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`]},defaultWidth:`wide`}),dayPeriod:_({values:{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`}},defaultWidth:`wide`,formattingValues:{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`}},defaultFormattingWidth:`wide`})};function v(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?fe(s,e=>e.test(o)):de(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function de(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function fe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function pe(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var me={code:`en-US`,formatDistance:oe,formatLong:se,formatRelative:le,localize:ue,match:{ordinalNumber:pe({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:v({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:v({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:v({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),day:v({matchPatterns:{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},defaultMatchWidth:`wide`,parsePatterns:{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]},defaultParseWidth:`any`}),dayPeriod:v({matchPatterns:{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},defaultMatchWidth:`any`,parsePatterns:{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}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function he(e,t){let n=o(e,t?.in);return h(n,ie(n))+1}function ge(e,n){let r=o(e,n?.in),i=u(r)-+ee(r);return Math.round(i/t)+1}function y(e,t){let n=o(e,t?.in),r=n.getFullYear(),i=c(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,u=a(t?.in||e,0);u.setFullYear(r+1,0,s),u.setHours(0,0,0,0);let d=l(u,t),f=a(t?.in||e,0);f.setFullYear(r,0,s),f.setHours(0,0,0,0);let p=l(f,t);return+n>=+d?r+1:+n>=+p?r:r-1}function _e(e,t){let n=c(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=y(e,t),o=a(t?.in||e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),l(o,t)}function b(e,n){let r=o(e,n?.in),i=l(r,n)-+_e(r,n);return Math.round(i/t)+1}function x(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var S={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return x(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):x(n+1,2)},d(e,t){return x(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return x(e.getHours()%12||12,t.length)},H(e,t){return x(e.getHours(),t.length)},m(e,t){return x(e.getMinutes(),t.length)},s(e,t){return x(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return x(Math.trunc(r*10**(n-3)),t.length)}},C={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},w={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return S.y(e,t)},Y:function(e,t,n,r){let i=y(e,r),a=i>0?i:1-i;return t===`YY`?x(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):x(a,t.length)},R:function(e,t){return x(d(e),t.length)},u:function(e,t){return x(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return x(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return x(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return S.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return x(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=b(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):x(i,t.length)},I:function(e,t,n){let r=ge(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):x(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):S.d(e,t)},D:function(e,t,n){let r=he(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):x(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return x(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return x(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return x(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?C.noon:r===0?C.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?C.evening:r>=12?C.afternoon:r>=4?C.morning:C.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return S.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):S.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):x(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):x(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):S.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):S.s(e,t)},S:function(e,t){return S.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return E(r);case`XXXX`:case`XX`:return D(r);default:return D(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return E(r);case`xxxx`:case`xx`:return D(r);default:return D(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+T(r,`:`);default:return`GMT`+D(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+T(r,`:`);default:return`GMT`+D(r,`:`)}},t:function(e,t,n){return x(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return x(+e,t.length)}};function T(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+x(a,2)}function E(e,t){return e%60==0?(e>0?`-`:`+`)+x(Math.abs(e)/60,2):D(e,t)}function D(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=x(Math.trunc(r/60),2),a=x(r%60,2);return n+i+t+a}var O=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},k=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},A={p:k,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return O(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,O(r,t)).replace(`{{time}}`,k(i,t))}},j=/^D+$/,M=/^Y+$/,N=[`D`,`DD`,`YY`,`YYYY`];function P(e){return j.test(e)}function F(e){return M.test(e)}function I(e,t,n){let r=ve(e,t,n);if(console.warn(r),N.includes(e))throw RangeError(r)}function ve(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var ye=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,be=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xe=/^'([^]*?)'?$/,Se=/''/g,Ce=/[a-zA-Z]/;function we(e,t,n){let r=c(),i=n?.locale??r.locale??me,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=o(e,n?.in);if(!ne(l))throw RangeError(`Invalid time value`);let u=t.match(be).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=A[t];return n(e,i.formatLong)}return e}).join(``).match(ye).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Te(e)};if(w[t])return{isToken:!0,value:e};if(t.match(Ce))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(u=i.localize.preprocessor(l,u));let d={firstWeekContainsDate:a,weekStartsOn:s,locale:i};return u.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&F(a)||!n?.useAdditionalDayOfYearTokens&&P(a))&&I(a,t,String(e));let o=w[a[0]];return o(l,a,i.localize,d)}).join(``)}function Te(e){let t=e.match(xe);return t?t[1].replace(Se,`'`):e}function Ee(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var De={},L={};function R(e,t){try{let n=(De[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in L?L[n]:z(n,n.split(`:`))}catch{if(e in L)return L[e];let t=e?.match(Oe);return t?z(e,t.slice(1)):NaN}}var Oe=/([+-]\d\d):?(\d\d)?/;function z(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return L[e]=n*60+r>0?n*60+r+i:n*60-r-i}var B=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(R(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),U(this,NaN),H(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-R(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),H(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},V=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!V.test(e))return;let t=e.replace(V,`$1UTC`);B.prototype[t]&&(e.startsWith(`get`)?B.prototype[e]=function(){return this.internal[t]()}:(B.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),ke(this),+this},B.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),H(this),+this}))});function H(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-R(e.timeZone,e)*60))}function ke(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),U(e)}function U(e){let t=R(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(R(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=R(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=R(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var W=class e extends B{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${Ee(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};window.pktTz=window.pktTz===void 0?`Europe/Oslo`:window.pktTz;var Ae=(e=window.pktTz)=>{let t=new W(new Date().toISOString(),e);return t.setHours(0,0,0,0),isNaN(t.getTime())?new Date:new Date(t.getFullYear(),t.getMonth(),t.getDate())};function G(e){if(!e||e===``)return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)}if(/^\d{4}-\d{2}$/.test(e)){let[t,n]=e.split(`-`).map(Number);return new Date(t,n-1,1)}return/^\d{4}$/.test(e)?new Date(Number(e),0,1):new Date(e)}var K=e=>!e||isNaN(e.getTime())?``:`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,q=e=>{if(!e)return null;let t=G(e);return isNaN(t.getTime())?null:t},je=(e,t)=>{let n=J(e);return isNaN(n.getTime())?``:we(n,t)},J=(e=``,t)=>{let n=typeof e==`string`?G(e):e;return!n||isNaN(n.getTime())?new Date:t?t===`end`?re(n):m(n):n},Me=(e,t,n=1)=>{if(typeof e!=`number`||typeof t!=`number`||typeof n!=`number`||isNaN(e)||isNaN(t)||isNaN(n))return new Date;let r=new Date(e,t,n);return isNaN(r.getTime())?new Date:r},Ne=e=>{let t;return t=new W(e,window.pktTz),t.setHours(12,0,0,0),t},Y=null,X=void 0,Pe=e=>{if(!e||isNaN(e.getTime()))return``;let t=typeof window<`u`?window.pktTz:void 0;return(!Y||X!==t)&&(Y=new Intl.DateTimeFormat(`no`,{dateStyle:`full`,timeZone:t}),X=t),Y.format(e)},Fe=(e,t,n)=>{if(!e||isNaN(e.getTime()))return!1;let r=t?J(t):null,i=n?J(n):null;return!(r&&e<r||i&&e>i)},Ie=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;let n=K(e);return t.includes(n)},Le=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;let n=e.getDay().toString();return t.includes(n)},Z=(e,t,n,r,i)=>!(!e||isNaN(e.getTime())||!Fe(e,t,n)||r&&Ie(e,r)||i&&Le(e,i)),Re=(e,t,n,r,i)=>e.filter(e=>{let a=q(e);return a&&Z(a,t,n,r,i)}),Q=e=>e.slice().sort((e,t)=>{let n=q(e),r=q(t);return!n||!r?0:n.getTime()-r.getTime()}),ze=(e,t)=>{let n=q(e),r=q(t);return!n||!r?!1:n<=r},$=e=>{if(!e)return[];if(Array.isArray(e))return e.filter(Boolean);if(typeof e==`string`&&e.trimStart().startsWith(`[`))try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Boolean)}catch{}return String(e).split(`,`).map(e=>e.trim()).filter(Boolean)},Be=e=>e.join(`,`),Ve={csvToArray:e=>$(e),stringToDate:e=>e?G(e):null,stringsToDate:e=>{if(typeof e==`string`)return e.split(`,`).map(e=>G(e));if(Array.isArray(e))return e.map(e=>G(e))}};Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return o}});