@oslokommune/punkt-elements 13.6.15 → 13.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/{accordionitem-B_h5XGCo.js → accordionitem-C_URrDjP.js} +4 -4
  3. package/dist/{accordionitem-BOmnm80g.cjs → accordionitem-DCZrHVNR.cjs} +1 -1
  4. package/dist/{alert-ZP5-fqlt.cjs → alert-Ci7WvRXi.cjs} +1 -1
  5. package/dist/{alert-CTTm6ugp.js → alert-Dh1YhaBq.js} +13 -26
  6. package/dist/{backlink-BT7DO6rV.cjs → backlink-BzEvli8m.cjs} +1 -1
  7. package/dist/{backlink-Bq8O2bt8.js → backlink-CI_jMGzZ.js} +3 -3
  8. package/dist/{button-x6Xw-5w0.js → button-CCFAUJa0.js} +5 -5
  9. package/dist/{button-BfqxLnMT.cjs → button-CXJQ_Wgl.cjs} +1 -1
  10. package/dist/calendar-BaMrdMDZ.cjs +115 -0
  11. package/dist/{calendar-CodWwTHM.js → calendar-DtJh7UYD.js} +532 -480
  12. package/dist/{card-B9RPShvV.cjs → card-Cf-UcGAP.cjs} +1 -1
  13. package/dist/{card-en2KhOPO.js → card-M1X36b6i.js} +8 -26
  14. package/dist/{checkbox-CH8xeK-0.cjs → checkbox-CTxc8wQe.cjs} +1 -1
  15. package/dist/{checkbox-DSAcMC-D.js → checkbox-_5LbXU7N.js} +4 -4
  16. package/dist/class-map-C_erArZz.cjs +5 -0
  17. package/dist/{class-map-Dw6Wrxwi.js → class-map-wy7PUk0P.js} +3 -3
  18. package/dist/{combobox-BFOjlFIj.cjs → combobox-BJ1gA0f0.cjs} +1 -1
  19. package/dist/{combobox-DaiEdUKx.js → combobox-Ct0NNY1p.js} +12 -16
  20. package/dist/{consent-CXp0bLvg.js → consent-B2hIQh4b.js} +3 -3
  21. package/dist/{consent-DFrsiYGQ.cjs → consent-BeOjxQdR.cjs} +1 -1
  22. package/dist/{datepicker-CbVSKaOY.js → datepicker-B8mifBAm.js} +12 -28
  23. package/dist/{datepicker-BR1imflE.cjs → datepicker-DVqmQAOe.cjs} +1 -1
  24. package/dist/directive-helpers-4oOjKnGY.cjs +5 -0
  25. package/dist/directive-helpers-BzAtj9by.js +38 -0
  26. package/dist/{element-D62wHiNU.cjs → element-CJ_QKaki.cjs} +6 -6
  27. package/dist/{element-DJZPsA_J.js → element-CRDRygXu.js} +47 -132
  28. package/dist/{heading-H_FWjo2k.cjs → heading--JKFppLS.cjs} +1 -1
  29. package/dist/{heading-DQ0R34j4.js → heading-Cs5yGnJg.js} +1 -1
  30. package/dist/{helptext-D1fkGmfT.cjs → helptext-CVQP3pis.cjs} +1 -1
  31. package/dist/{helptext-8ykxyegi.js → helptext-DuvVSH7d.js} +6 -6
  32. package/dist/icon-1dy7UZcu.js +89 -0
  33. package/dist/icon-BGuizDwk.cjs +9 -0
  34. package/dist/{if-defined-D3lgJqT7.js → if-defined-BWZGb3bh.js} +1 -1
  35. package/dist/{if-defined-CkVc_RJD.cjs → if-defined-Bc9-_I01.cjs} +1 -1
  36. package/dist/index.d.ts +3 -2
  37. package/dist/input-element-BcFmygSF.js +707 -0
  38. package/dist/input-element-j9znzLWz.cjs +1 -0
  39. package/dist/{input-wrapper-DVjNwf8-.cjs → input-wrapper-BsQ7oFMd.cjs} +1 -1
  40. package/dist/input-wrapper-CDgenrYA.js +6 -0
  41. package/dist/{input-wrapper-CQzXG44g.js → input-wrapper-CKJU0QWG.js} +8 -8
  42. package/dist/{link-CyiVlb-7.cjs → link-Da3pZ_CW.cjs} +1 -1
  43. package/dist/{link-DSSJYrtn.js → link-DzZCw8j2.js} +9 -16
  44. package/dist/{linkcard-fH9uydjS.cjs → linkcard-BM23gzhS.cjs} +1 -1
  45. package/dist/{linkcard-g8JtooPU.js → linkcard-RIK5xqbd.js} +4 -4
  46. package/dist/{listbox-L-iOSF7M.cjs → listbox-CsGiqzD0.cjs} +1 -1
  47. package/dist/{listbox-n4wjlLqD.js → listbox-DlJevu8O.js} +5 -5
  48. package/dist/{loader-Bzf1sPSg.js → loader-BVvBzaPI.js} +5 -5
  49. package/dist/{loader-C-3l7kb9.cjs → loader-Bo8RCbCJ.cjs} +1 -1
  50. package/dist/{messagebox---xPIAwR.cjs → messagebox-C76IcXTl.cjs} +1 -1
  51. package/dist/{messagebox-okJLeSpj.js → messagebox-DwdMXoAe.js} +6 -16
  52. package/dist/{modal-pohCsr_x.js → modal-BGXk3f9u.js} +6 -16
  53. package/dist/{modal-IjDRQfX1.cjs → modal-Cdz9JcCX.cjs} +1 -1
  54. package/dist/pkt-accordion.cjs +1 -1
  55. package/dist/pkt-accordion.js +2 -2
  56. package/dist/pkt-alert.cjs +1 -1
  57. package/dist/pkt-alert.js +1 -1
  58. package/dist/pkt-backlink.cjs +1 -1
  59. package/dist/pkt-backlink.js +1 -1
  60. package/dist/pkt-button.cjs +1 -1
  61. package/dist/pkt-button.js +1 -1
  62. package/dist/pkt-calendar.cjs +1 -1
  63. package/dist/pkt-calendar.js +1 -1
  64. package/dist/pkt-card.cjs +1 -1
  65. package/dist/pkt-card.js +1 -1
  66. package/dist/pkt-checkbox.cjs +1 -1
  67. package/dist/pkt-checkbox.js +1 -1
  68. package/dist/pkt-combobox.cjs +1 -1
  69. package/dist/pkt-combobox.js +1 -1
  70. package/dist/pkt-consent.cjs +1 -1
  71. package/dist/pkt-consent.js +1 -1
  72. package/dist/pkt-datepicker.cjs +1 -1
  73. package/dist/pkt-datepicker.js +2 -2
  74. package/dist/pkt-heading.cjs +1 -1
  75. package/dist/pkt-heading.js +1 -1
  76. package/dist/pkt-helptext.cjs +1 -1
  77. package/dist/pkt-helptext.js +1 -1
  78. package/dist/pkt-icon.cjs +1 -1
  79. package/dist/pkt-icon.js +1 -1
  80. package/dist/pkt-index.cjs +1 -1
  81. package/dist/pkt-index.js +29 -29
  82. package/dist/pkt-input-wrapper.cjs +1 -1
  83. package/dist/pkt-input-wrapper.js +1 -1
  84. package/dist/pkt-link.cjs +1 -1
  85. package/dist/pkt-link.js +1 -1
  86. package/dist/pkt-linkcard.cjs +1 -1
  87. package/dist/pkt-linkcard.js +1 -1
  88. package/dist/pkt-listbox.cjs +1 -1
  89. package/dist/pkt-listbox.js +1 -1
  90. package/dist/pkt-loader.cjs +1 -1
  91. package/dist/pkt-loader.js +1 -1
  92. package/dist/pkt-messagebox.cjs +1 -1
  93. package/dist/pkt-messagebox.js +1 -1
  94. package/dist/pkt-modal.cjs +1 -1
  95. package/dist/pkt-modal.js +1 -1
  96. package/dist/pkt-progressbar.cjs +1 -1
  97. package/dist/pkt-progressbar.js +2 -2
  98. package/dist/pkt-radiobutton.cjs +1 -1
  99. package/dist/pkt-radiobutton.js +1 -1
  100. package/dist/pkt-select.cjs +1 -1
  101. package/dist/pkt-select.js +1 -1
  102. package/dist/pkt-tag.cjs +1 -1
  103. package/dist/pkt-tag.js +1 -1
  104. package/dist/pkt-textarea.cjs +1 -1
  105. package/dist/pkt-textarea.js +1 -1
  106. package/dist/pkt-textinput.cjs +1 -1
  107. package/dist/pkt-textinput.js +1 -1
  108. package/dist/{progressbar-DjsupQ7Y.js → progressbar-BbVei20_.js} +7 -7
  109. package/dist/{progressbar-DJzEC7cx.cjs → progressbar-CazcIzVT.cjs} +2 -2
  110. package/dist/{radiobutton-DEboKECm.cjs → radiobutton-D1fihs8R.cjs} +1 -1
  111. package/dist/{radiobutton-Bz_qApF3.js → radiobutton-DODROIBF.js} +5 -5
  112. package/dist/{ref-BfgcOXko.cjs → ref-BFa5Utho.cjs} +1 -1
  113. package/dist/{ref-BCGCor-j.js → ref-Xa5dbh--.js} +2 -2
  114. package/dist/repeat-BZb41H64.cjs +5 -0
  115. package/dist/{repeat-B6qPUgAq.js → repeat-CJ79egkN.js} +8 -8
  116. package/dist/{select-DKkoxmgj.js → select-BG2MBQbh.js} +6 -6
  117. package/dist/{select-DynzsPo0.cjs → select-D-m1PhpA.cjs} +1 -1
  118. package/dist/{state-CPQXJ4Ct.js → state-DS_kr2Fy.js} +1 -1
  119. package/dist/{state-BkE_Rxl7.cjs → state-DSjcvzDN.cjs} +1 -1
  120. package/dist/{tag-NZ5oeGfw.js → tag-CqMgt01I.js} +7 -20
  121. package/dist/{tag-BKq07hGI.cjs → tag-EFUKrc8q.cjs} +2 -2
  122. package/dist/{textarea-COG1CH_s.js → textarea-DCKKhs1B.js} +9 -9
  123. package/dist/{textarea-BS1tgktz.cjs → textarea-aUG3S7C2.cjs} +1 -1
  124. package/dist/{textinput-CTOtfcTR.js → textinput-B5Ai5R8L.js} +8 -8
  125. package/dist/{textinput-CCK8ti2y.cjs → textinput-mUERucRy.cjs} +1 -1
  126. package/package.json +14 -6
  127. package/src/components/combobox/combobox.ts +1 -1
  128. package/src/components/icon/icon.ts +16 -7
  129. package/src/components/select/select.ts +1 -1
  130. package/dist/calendar-DH-fCGyW.cjs +0 -115
  131. package/dist/class-map-CG3vIaNm.cjs +0 -5
  132. package/dist/directive-helpers-_qHew-gi.cjs +0 -5
  133. package/dist/directive-helpers-cAOIHg9K.js +0 -45
  134. package/dist/icon-B1-mkmwB.js +0 -88
  135. package/dist/icon-__Hjt2XZ.cjs +0 -9
  136. package/dist/input-element-DQOVrqUZ.js +0 -703
  137. package/dist/input-element-Y8sdrq9C.cjs +0 -1
  138. package/dist/input-wrapper-8iKEzDRZ.js +0 -40
  139. package/dist/repeat-DzibMwhi.cjs +0 -5
@@ -5,9 +5,13 @@ import { html, PropertyValues } from 'lit'
5
5
  import { customElement, property } from 'lit/decorators.js'
6
6
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
7
7
 
8
+ const defaultPath = 'https://punkt-cdn.oslo.kommune.no/latest/icons/'
9
+
8
10
  // Allow global override of icon fetch
9
- window.pktFetch = window.pktFetch === undefined ? fetch : window.pktFetch
10
- window.pktIconPath = window.pktIconPath || 'https://punkt-cdn.oslo.kommune.no/latest/icons/'
11
+ if (typeof window !== 'undefined') {
12
+ window.pktFetch = window.pktFetch === undefined ? fetch : window.pktFetch
13
+ window.pktIconPath = window.pktIconPath || defaultPath
14
+ }
11
15
 
12
16
  const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
13
17
  const errorSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>'
@@ -23,9 +27,14 @@ const downloadIconOrGetFromCache = async (
23
27
  if (i > 50) break
24
28
  await sleep(50)
25
29
  }
26
- if (localStorage.getItem(path + name + '.svg')) {
30
+
31
+ // Check if localStorage is available before using it
32
+ const isLocalStorageAvailable =
33
+ typeof Storage !== 'undefined' && typeof localStorage !== 'undefined'
34
+
35
+ if (isLocalStorageAvailable && localStorage.getItem(path + name + '.svg')) {
27
36
  return Promise.resolve(localStorage.getItem(path + name + '.svg'))
28
- } else if (typeof window.pktFetch === 'function') {
37
+ } else if (typeof window !== 'undefined' && typeof window.pktFetch === 'function') {
29
38
  dlStatus[path + name + '.svg'] = 'fetching'
30
39
  return Promise.resolve(
31
40
  window
@@ -40,7 +49,7 @@ const downloadIconOrGetFromCache = async (
40
49
  }
41
50
  })
42
51
  .then((text) => {
43
- if (text !== errorSvg) {
52
+ if (text !== errorSvg && isLocalStorageAvailable) {
44
53
  localStorage.setItem(path + name + '.svg', text)
45
54
  }
46
55
  dlStatus[path + name + '.svg'] = 'fetched'
@@ -56,7 +65,7 @@ type Props = ElementProps<PktIcon, 'path' | 'name'>
56
65
  @customElement('pkt-icon')
57
66
  export class PktIcon extends PktElement<Props> {
58
67
  @property({ type: String, reflect: false })
59
- path: string | undefined = window.pktIconPath
68
+ path: string | undefined = typeof window !== 'undefined' ? window.pktIconPath : defaultPath
60
69
 
61
70
  @property({ type: String, reflect: true })
62
71
  name: PktIconName = ''
@@ -85,7 +94,7 @@ export class PktIcon extends PktElement<Props> {
85
94
 
86
95
  protected async getIcon(name: PktIconName = '') {
87
96
  if (this._updatedProps.length > 0) {
88
- if (!this.path) this.path === window.pktIconPath
97
+ if (!this.path) this.path = typeof window !== 'undefined' ? window.pktIconPath : defaultPath
89
98
  this.icon = unsafeSVG(
90
99
  await downloadIconOrGetFromCache(this.name || '', this.path).then((res) => res),
91
100
  ) as SVGElement
@@ -46,7 +46,7 @@ export class PktSelect extends PktInputElement implements IPktSelect {
46
46
  @property({ type: Array, attribute: 'options' }) private _optionsProp: TSelectOption[] = []
47
47
  @property({ type: String }) value: string = ''
48
48
 
49
- @state() private _options: TSelectOption[] = []
49
+ @state() _options: TSelectOption[] = []
50
50
 
51
51
  public selectedIndex: number | null = -1
52
52
  public selectedOptions: HTMLCollectionOf<HTMLOptionElement> | undefined = undefined
@@ -1,115 +0,0 @@
1
- "use strict";const G=require("./class-map-CG3vIaNm.cjs"),c=require("./element-D62wHiNU.cjs"),H=require("./state-BkE_Rxl7.cjs");require("./icon-__Hjt2XZ.cjs");const at=6048e5,ft=864e5,X=Symbol.for("constructDateFrom");function S(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&X in e?e[X](t):e instanceof Date?new e.constructor(t):new Date(t)}function k(e,t){return S(t||e,e)}function U(e,t,n){const r=k(e,n==null?void 0:n.in);return isNaN(t)?S(e,NaN):(t&&r.setDate(r.getDate()+t),r)}let mt={};function R(){return mt}function F(e,t){var l,o,h,f;const n=R(),r=(t==null?void 0:t.weekStartsOn)??((o=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:o.weekStartsOn)??n.weekStartsOn??((f=(h=n.locale)==null?void 0:h.options)==null?void 0:f.weekStartsOn)??0,a=k(e,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 q(e,t){return F(e,{...t,weekStartsOn:1})}function st(e,t){const n=k(e,t==null?void 0:t.in),r=n.getFullYear(),a=S(n,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const s=q(a),i=S(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=q(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function V(e){const t=k(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 it(e,...t){const n=S.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function J(e,t){const n=k(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function gt(e,t,n){const[r,a]=it(n==null?void 0:n.in,e,t),s=J(r),i=J(a),l=+s-V(s),o=+i-V(i);return Math.round((l-o)/ft)}function yt(e,t){const n=st(e,t),r=S(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),q(r)}function pt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function wt(e){return!(!pt(e)&&typeof e!="number"||isNaN(+k(e)))}function bt(e,t){const[n,r]=it(e,t.start,t.end);return{start:n,end:r}}function B(e,t){const{start:n,end:r}=bt(t==null?void 0:t.in,e);let a=+n>+r;const s=a?+n:+r,i=a?r:n;i.setHours(0,0,0,0);let l=1;const o=[];for(;+i<=s;)o.push(S(n,i)),i.setDate(i.getDate()+l),i.setHours(0,0,0,0);return a?o.reverse():o}function kt(e,t){const n=k(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Dt={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"}},St=(e,t,n)=>{let r;const a=Dt[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function z(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const vt={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}}"},Tt={date:z({formats:vt,defaultWidth:"full"}),time:z({formats:Mt,defaultWidth:"full"}),dateTime:z({formats:xt,defaultWidth:"full"})},Pt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ot=(e,t,n,r)=>Pt[e];function _(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):i;a=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return a[s]}}const Ct={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Nt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$t={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"]},_t={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"]},Et={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"}},Wt={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"}},Yt=(e,t)=>{const 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"},At={ordinalNumber:Yt,era:_({values:Ct,defaultWidth:"wide"}),quarter:_({values:Nt,defaultWidth:"wide",argumentCallback:e=>e-1}),month:_({values:$t,defaultWidth:"wide"}),day:_({values:_t,defaultWidth:"wide"}),dayPeriod:_({values:Et,defaultWidth:"wide",formattingValues:Wt,defaultFormattingWidth:"wide"})};function E(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;const i=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(l)?Ht(l,m=>m.test(i)):Ft(l,m=>m.test(i));let h;h=e.valueCallback?e.valueCallback(o):o,h=n.valueCallback?n.valueCallback(h):h;const f=t.slice(i.length);return{value:h,rest:f}}}function Ft(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Ht(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function It(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const l=t.slice(a.length);return{value:i,rest:l}}}const qt=/^(\d+)(th|st|nd|rd)?/i,Rt=/\d+/i,Lt={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]},Bt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zt={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:Rt,valueCallback:e=>parseInt(e,10)}),era:E({matchPatterns:Lt,defaultMatchWidth:"wide",parsePatterns:Ut,defaultParseWidth:"any"}),quarter:E({matchPatterns:Bt,defaultMatchWidth:"wide",parsePatterns:zt,defaultParseWidth:"any",valueCallback:e=>e+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:St,formatLong:Tt,formatRelative:Ot,localize:At,match:Kt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function te(e,t){const n=k(e,t==null?void 0:t.in);return gt(n,kt(n))+1}function ee(e,t){const n=k(e,t==null?void 0:t.in),r=+q(n)-+yt(n);return Math.round(r/at)+1}function ot(e,t){var f,m,w,g;const n=k(e,t==null?void 0:t.in),r=n.getFullYear(),a=R(),s=(t==null?void 0:t.firstWeekContainsDate)??((m=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((g=(w=a.locale)==null?void 0:w.options)==null?void 0:g.firstWeekContainsDate)??1,i=S((t==null?void 0:t.in)||e,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const l=F(i,t),o=S((t==null?void 0:t.in)||e,0);o.setFullYear(r,0,s),o.setHours(0,0,0,0);const h=F(o,t);return+n>=+l?r+1:+n>=+h?r:r-1}function ne(e,t){var l,o,h,f;const n=R(),r=(t==null?void 0:t.firstWeekContainsDate)??((o=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:o.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(h=n.locale)==null?void 0:h.options)==null?void 0:f.firstWeekContainsDate)??1,a=ot(e,t),s=S((t==null?void 0:t.in)||e,0);return s.setFullYear(a,0,r),s.setHours(0,0,0,0),F(s,t)}function ct(e,t){const n=k(e,t==null?void 0:t.in),r=+F(n,t)-+ne(n,t);return Math.round(r/at)+1}function u(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const v={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return u(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):u(n+1,2)},d(e,t){return u(e.getDate(),t.length)},a(e,t){const 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];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return u(e.getHours()%12||12,t.length)},H(e,t){return u(e.getHours(),t.length)},m(e,t){return u(e.getMinutes(),t.length)},s(e,t){return u(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return u(a,t.length)}},N={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},K={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return v.y(e,t)},Y:function(e,t,n,r){const a=ot(e,r),s=a>0?a:1-a;if(t==="YY"){const i=s%100;return u(i,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):u(s,t.length)},R:function(e,t){const n=st(e);return u(n,t.length)},u:function(e,t){const n=e.getFullYear();return u(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return u(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"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return u(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"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return v.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"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return u(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"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=ct(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):u(a,t.length)},I:function(e,t,n){const r=ee(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):u(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):v.d(e,t)},D:function(e,t,n){const r=te(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):u(r,t.length)},E:function(e,t,n){const 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"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return u(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),s=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return u(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return u(a,t.length);case"io":return n.ordinalNumber(a,{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"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=N.noon:r===0?a=N.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=N.evening:r>=12?a=N.afternoon:r>=4?a=N.morning:a=N.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return v.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):v.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):v.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):v.s(e,t)},S:function(e,t){return v.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return tt(r);case"XXXX":case"XX":return O(r);case"XXXXX":case"XXX":default:return O(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return tt(r);case"xxxx":case"xx":return O(r);case"xxxxx":case"xxx":default:return O(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Z(r,":");case"OOOO":default:return"GMT"+O(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Z(r,":");case"zzzz":default:return"GMT"+O(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return u(r,t.length)},T:function(e,t,n){return u(+e,t.length)}};function Z(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),s=r%60;return s===0?n+String(a):n+String(a)+t+u(s,2)}function tt(e,t){return e%60===0?(e>0?"-":"+")+u(Math.abs(e)/60,2):O(e,t)}function O(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=u(Math.trunc(r/60),2),s=u(r%60,2);return n+a+t+s}const et=(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"});case"PPPP":default:return t.date({width:"full"})}},lt=(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"});case"pppp":default:return t.time({width:"full"})}},re=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return et(e,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}}",et(r,t)).replace("{{time}}",lt(a,t))},ae={p:lt,P:re},se=/^D+$/,ie=/^Y+$/,oe=["D","DD","YY","YYYY"];function ce(e){return se.test(e)}function le(e){return ie.test(e)}function ue(e,t,n){const r=he(e,t,n);if(console.warn(r),oe.includes(e))throw new RangeError(r)}function he(e,t,n){const 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`}const de=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,me=/^'([^]*?)'?$/,ge=/''/g,ye=/[a-zA-Z]/;function pe(e,t,n){var f,m,w,g;const r=R(),a=r.locale??Zt,s=r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,i=r.weekStartsOn??((g=(w=r.locale)==null?void 0:w.options)==null?void 0:g.weekStartsOn)??0,l=k(e,n==null?void 0:n.in);if(!wt(l))throw new RangeError("Invalid time value");let o=t.match(fe).map(p=>{const b=p[0];if(b==="p"||b==="P"){const L=ae[b];return L(p,a.formatLong)}return p}).join("").match(de).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const b=p[0];if(b==="'")return{isToken:!1,value:we(p)};if(K[b])return{isToken:!0,value:p};if(b.match(ye))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:p}});a.localize.preprocessor&&(o=a.localize.preprocessor(l,o));const h={firstWeekContainsDate:s,weekStartsOn:i,locale:a};return o.map(p=>{if(!p.isToken)return p.value;const b=p.value;(le(b)||ce(b))&&ue(b,t,String(e));const L=K[b[0]];return L(l,b,a.localize,h)}).join("")}function we(e){const t=e.match(me);return t?t[1].replace(ge,"'"):e}function be(e,t){const n=k(e,t==null?void 0:t.in).getDay();return n===0?7:n}const j={},Y={};function A(e,t){try{const r=(j[e]||(j[e]=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return r in Y?Y[r]:nt(r,r.split(":"))}catch{if(e in Y)return Y[e];const n=e==null?void 0:e.match(ke);return n?nt(e,n.slice(1)):NaN}}const ke=/([+-]\d\d):?(\d\d)?/;function nt(e,t){const n=+t[0],r=+(t[1]||0);return Y[e]=n>0?n*60+r:n*60-r}class D extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(A(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)),ut(this),Q(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new D(...n,t):new D(Date.now(),t)}withTimeZone(t){return new D(+this,t)}getTimezoneOffset(){return-A(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Q(this),+this}[Symbol.for("constructDateFrom")](t){return new D(+new Date(t),this.timeZone)}}const rt=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!rt.test(e))return;const t=e.replace(rt,"$1UTC");D.prototype[t]&&(e.startsWith("get")?D.prototype[e]=function(){return this.internal[t]()}:(D.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),De(this),+this},D.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Q(this),+this}))});function Q(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function De(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()),ut(e)}function ut(e){const t=A(e.timeZone,e),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const r=-new Date(+e).getTimezoneOffset(),a=-new Date(+n).getTimezoneOffset(),s=r-a,i=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();s&&i&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+s);const l=r-t;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const o=A(e.timeZone,e),f=-new Date(+e).getTimezoneOffset()-o,m=o!==t,w=f-l;if(m&&w){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w);const g=A(e.timeZone,e),p=o-g;p&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+p),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+p))}}class x extends D{static tz(t,...n){return n.length?new x(...n,t):new x(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),a=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,a]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${t} GMT${n}${r}${a} (${Se(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),a=String(Math.abs(t)%60).padStart(2,"0");return[n,r,a]}withTimeZone(t){return new x(+this,t)}[Symbol.for("constructDateFrom")](t){return new x(+new Date(t),this.timeZone)}}function Se(e,t){return new Intl.DateTimeFormat("en-GB",{timeZone:e,timeZoneName:"long"}).format(t).slice(12)}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const ve=(e=window.pktTz)=>{const t=new x(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 T(e){if(!e||e==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r)}if(/^\d{4}-\d{2}$/.test(e)){const[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)}const y=e=>{if(!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`},$=e=>{if(!e)return null;const t=T(e);return isNaN(t.getTime())?null:t},Me=(e,t)=>{const n=C(e);return isNaN(n.getTime())?"":pe(n,t)},C=(e="",t)=>{const n=typeof e=="string"?T(e):e;return!n||isNaN(n.getTime())?new Date:n},M=(e,t,n=1)=>{if(typeof e!="number"||typeof t!="number"||typeof n!="number"||isNaN(e)||isNaN(t)||isNaN(n))return new Date;const r=new Date(e,t,n);return isNaN(r.getTime())?new Date:r},W=e=>{let t;return typeof e=="number"?t=new x(e,window.pktTz):t=new x(e,window.pktTz),t.setHours(12,0,0,0),t},xe=e=>!e||isNaN(e.getTime())?"":new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:window.pktTz}).format(e),Te=(e,t,n)=>{if(!e||isNaN(e.getTime()))return!1;const r=t?C(t):null,a=n?C(n):null;return!(r&&e<r||a&&e>a)},Pe=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;const n=y(e);return t.includes(n)},Oe=(e,t)=>{if(!e||isNaN(e.getTime())||!Array.isArray(t))return!1;const n=e.getDay().toString();return t.includes(n)},ht=(e,t,n,r,a)=>!(!e||isNaN(e.getTime())||!Te(e,t,n)||r&&Pe(e,r)||a&&Oe(e,a)),Ce=(e,t,n,r,a)=>e.filter(s=>{const i=$(s);return i&&ht(i,t,n,r,a)}),Ne=e=>e.slice().sort((t,n)=>{const r=$(t),a=$(n);return!r||!a?0:r.getTime()-a.getTime()}),$e=(e,t)=>{const n=$(e),r=$(t);return!n||!r?!1:n<=r},dt=e=>{if(Array.isArray(e))return e;if(typeof e=="string")return e.split(",")},_e=e=>e?T(e):null,Ee=e=>{if(typeof e=="string")return e.split(",").map(t=>T(t));if(Array.isArray(e))return e.map(t=>T(t))},I={csvToArray:dt,stringToDate:_e,stringsToDate:Ee},We={earliest:{default:null},latest:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},maxMultiple:{default:4},range:{default:!1}},P={props:We};var Ye=Object.defineProperty,Ae=Object.getOwnPropertyDescriptor,d=(e,t,n,r)=>{for(var a=r>1?void 0:r?Ae(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(a=(r?i(t,n,a):i(a))||a);return r&&a&&Ye(t,n,a),a};exports.PktCalendar=class extends c.PktElement{constructor(){super(...arguments),this.multiple=P.props.multiple.default,this.maxMultiple=P.props.maxMultiple.default,this.range=P.props.range.default,this.weeknumbers=P.props.weeknumbers.default,this.withcontrols=P.props.withcontrols.default,this.selected=[],this.earliest=P.props.earliest.default,this.latest=P.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,n,r){t==="selected"&&r&&this.convertSelected(),super.attributeChangedCallback(t,n,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=>T(t)),this.range&&this.selected.length===2){const t=B({start:this._selected[0],end:this._selected[1]});if(this.inRange={},Array.isArray(t)&&t.length){const n={};for(let r=0;r<t.length;r++){const a=t[r],s=a>this._selected[0]&&a<this._selected[1];n[y(a)]=s}this.inRange=n}}this.setCurrentMonth()}setCurrentMonth(){if(this.currentmonth===null&&!this.currentmonthtouched&&(this.currentmonthtouched=!0),this.selected.length&&this.selected[0]!==""){const t=T(this.selected[this.selected.length-1]);this.currentmonth=isNaN(t.getTime())?W(new Date):t}else this.currentmonth===null&&(this.currentmonth=W(new Date));(!this.currentmonth||isNaN(this.currentmonth.getTime()))&&(this.currentmonth=W(new Date)),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,n){var s,i,l,o,h;if(((s=t.target)==null?void 0:s.nodeName)==="INPUT"||((i=t.target)==null?void 0:i.nodeName)==="SELECT"||((l=t.target)==null?void 0:l.nodeName)==="BUTTON"&&!((h=(o=t.target)==null?void 0:o.dataset)!=null&&h.date))return;t.preventDefault(),this.focusedDate||this.focusOnCurrentDate();const r=this.focusedDate?C(this.focusedDate):M(this.year,this.month,1);let a=U(r,n);if(a){let f=this.querySelector(`button[data-date="${y(a)}"]`);if(f instanceof HTMLButtonElement){if(f.dataset.disabled){a=U(a,n);let m=this.querySelector(`button[data-date="${y(a)}"]`);for(;m&&m instanceof HTMLButtonElement&&m.dataset.disabled;)a=U(a,n),m=this.querySelector(`button[data-date="${y(a)}"]`);f=m}f instanceof HTMLButtonElement&&!f.dataset.disabled&&(this.focusedDate=y(a),f.focus())}}}render(){return c.x`
2
- <div
3
- class="pkt-calendar ${this.weeknumbers?"pkt-cal-weeknumbers":""}"
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
- aria-label="${this.prevMonthString}"
12
- @click=${()=>this.isPrevMonthAllowed()&&this.prevMonth()}
13
- @keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isPrevMonthAllowed()&&this.prevMonth())}}
14
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__prev-month ${this.isPrevMonthAllowed()?"":"pkt-hide"}"
15
- .data-disabled=${this.isPrevMonthAllowed()?c.E:"disabled"}
16
- ?aria-disabled=${!this.isPrevMonthAllowed()}
17
- tabindex=${this.isPrevMonthAllowed()?"0":"-1"}
18
- >
19
- <pkt-icon class="pkt-btn__icon" name="chevron-thin-left"></pkt-icon>
20
- <span class="pkt-btn__text">${this.prevMonthString}</span>
21
- </button>
22
- </div>
23
- ${this.renderMonthNav()}
24
- <div>
25
- <button
26
- type="button"
27
- aria-label="${this.nextMonthString}"
28
- @click=${()=>this.isNextMonthAllowed()&&this.nextMonth()}
29
- @keydown=${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.isNextMonthAllowed()&&this.nextMonth())}}
30
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only pkt-calendar__next-month ${this.isNextMonthAllowed()?"":"pkt-hide"}"
31
- .data-disabled=${this.isNextMonthAllowed()?c.E:"disabled"}
32
- ?aria-disabled=${!this.isNextMonthAllowed()}
33
- tabindex=${this.isNextMonthAllowed()?"0":"-1"}
34
- >
35
- <pkt-icon class="pkt-btn__icon" name="chevron-thin-right"></pkt-icon>
36
- <span class="pkt-btn__text">${this.nextMonthString}</span>
37
- </button>
38
- </div>
39
- </nav>
40
- <table
41
- class="pkt-cal-days pkt-txt-12-medium pkt-calendar__body"
42
- role="grid"
43
- ?aria-multiselectable=${this.range||this.multiple}
44
- >
45
- <thead>
46
- ${this.renderDayNames()}
47
- </thead>
48
- <tbody>
49
- ${this.renderCalendarBody()}
50
- </tbody>
51
- </table>
52
- </div>
53
- `}renderDayNames(){const t=[];this.weeknumbers&&t.push(c.x`<th><div class="pkt-calendar__week-number">${this.weekString}</div></th>`);for(let n=0;n<this.dayStrings.length;n++)t.push(c.x`<th>
54
- <div class="pkt-calendar__day-name" aria-label="${this.dayStringsLong[n]}">
55
- ${this.dayStrings[n]}
56
- </div>
57
- </th>`);return c.x`<tr class="pkt-cal-week-row">
58
- ${t}
59
- </tr>`}renderMonthNav(){let t=[];return this.withcontrols?t.push(c.x`<div class="pkt-cal-month-picker">
60
- <label for="${this.id}-monthnav" class="pkt-hide">${this.strings.dates.month}</label>
61
- <select
62
- aria-label="${this.strings.dates.month}"
63
- class="pkt-input pkt-input-compact"
64
- id="${this.id}-monthnav"
65
- @change=${n=>{n.stopImmediatePropagation(),this.changeMonth(this.year,n.target.value)}}
66
- >
67
- ${this.monthStrings.map((n,r)=>c.x`<option value=${r} ?selected=${this.month===r}>${n}</option>`)}
68
- </select>
69
- <label for="${this.id}-yearnav" class="pkt-hide">${this.strings.dates.year}</label>
70
- <input
71
- aria-label="${this.strings.dates.year}"
72
- class="pkt-input pkt-cal-input-year pkt-input-compact"
73
- id="${this.id}-yearnav"
74
- type="number"
75
- size="4"
76
- placeholder="0000"
77
- @change=${n=>{n.stopImmediatePropagation(),this.changeMonth(n.target.value,this.month)}}
78
- .value=${this.year}
79
- />
80
- </div> `):t.push(c.x`<div class="pkt-txt-16-medium pkt-calendar__month-title" aria-live="polite">
81
- ${this.monthStrings[this.month]} ${this.year}
82
- </div>`),t}renderDayView(t,n){var w;const r=M(this.year,this.month,t),a=y(r),s=a===y(n),i=this.selected.includes(a),l=xe(r),o=this.isExcluded(r)||!i&&this.multiple&&this.maxMultiple>0&&this.selected.length>=this.maxMultiple,h=this.focusedDate?this.focusedDate===a&&!o?"0":"-1":!o&&this.tabIndexSet===0||this.tabIndexSet===t?"0":"-1";h==="0"&&(this.tabIndexSet=t),this.selectableDates.push({currentDateISO:a,isDisabled:o,tabindex:h});const f={"pkt-cal-today":s,"pkt-cal-selected":i,"pkt-cal-in-range":this.inRange[a],"pkt-cal-excluded":this.isExcluded(r),"pkt-cal-in-range-first":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&a===this.selected[0],"pkt-cal-in-range-last":this.range&&this.selected.length===2&&a===this.selected[1],"pkt-cal-range-hover":this.rangeHovered!==null&&a===y(this.rangeHovered)},m={"pkt-calendar__date":!0,"pkt-calendar__date--today":s,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":o,"pkt-calendar__date--in-range":this.inRange[a],"pkt-calendar__date--in-range-hover":this.rangeHovered!==null&&a===y(this.rangeHovered),"pkt-calendar__date--range-start":this.range&&(this.selected.length===2||this.rangeHovered!==null)&&a===this.selected[0],"pkt-calendar__date--range-end":this.range&&this.selected.length===2&&a===this.selected[1]};return c.x`<td class=${G.e(f)}>
83
- <button
84
- type="button"
85
- aria-pressed=${i?"true":"false"}
86
- ?disabled=${o}
87
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${G.e(m)}"
88
- @mouseover=${()=>this.range&&!this.isExcluded(r)&&this.handleRangeHover(r)}
89
- @focus=${()=>{this.range&&!this.isExcluded(r)&&this.handleRangeHover(r),this.focusedDate=a}}
90
- aria-label="${l}"
91
- tabindex=${(w=this.selectableDates.find(g=>g.currentDateISO===a))==null?void 0:w.tabindex}
92
- data-disabled=${o?"disabled":c.E}
93
- data-date=${a}
94
- @keydown=${g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.handleDateSelect(r))}}
95
- @click=${g=>{o||(g.preventDefault(),this.handleDateSelect(r))}}
96
- >
97
- <span class="pkt-btn__text pkt-txt-14-light">${t}</span>
98
- </button>
99
- </td>`}renderCalendarBody(){const t=ve(),n=M(this.year,this.month,1),r=M(this.year,this.month+1,0),a=(n.getDay()+6)%7,s=r.getDate(),i=Math.ceil((s+a)/7),o=M(this.year,this.month,0).getDate();let h=1;this.week=ct(M(this.year,this.month,1));const f=[];for(let m=0;m<i;m++){const w=[];this.weeknumbers&&w.push(c.x`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let g=1;g<8;g++)if(m===0&&g<a+1){const p=o-(a-g);w.push(c.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">${p}</span>
105
- </div>
106
- </td>`)}else h>s?(w.push(c.x`<td class="pkt-cal-other">
107
- <div
108
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only"
109
- data-disabled="disabled"
110
- >
111
- <span class="pkt-btn__text pkt-txt-14-light">${h-s}</span>
112
- </div>
113
- </td>`),h++):(w.push(this.renderDayView(h,t)),h++);f.push(c.x`<tr class="pkt-cal-week-row" role="row">
114
- ${w}
115
- </tr>`)}return f}isExcluded(t){const n=this.excludedates.map(r=>typeof r=="string"?r:y(r));return!ht(t,this.earliest,this.latest,n,this.excludeweekdays)}isPrevMonthAllowed(){const t=M(this.year,this.month,0);return!(this.earliest&&C(this.earliest)>t)}prevMonth(){const t=this.month===0?11:this.month-1,n=this.month===0?this.year-1:this.year;this.changeMonth(n,t)}isNextMonthAllowed(){const t=M(this.month===11?this.year+1:this.year,this.month===11?0:this.month+1,1);return!(this.latest&&C(this.latest)<t)}nextMonth(){const t=this.month===11?0:this.month+1,n=this.month===11?this.year+1:this.year;this.changeMonth(n,t)}changeMonth(t,n){this.year=typeof t=="string"?parseInt(t):t,this.month=typeof n=="string"?parseInt(n):n,this.currentmonth=W(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}isRangeAllowed(t){let n=!0;if(this._selected.length===1){const r=B({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&&(n=!1)}),this.excludeweekdays.includes(be(r[a]).toString())&&(n=!1)}return n}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}addToSelected(t){this.selected.includes(y(t))||(this.selected=[...this.selected,y(t)],this._selected=[...this._selected,t],this.range&&this.selected.length===2&&(this.convertSelected(),this.close()))}removeFromSelected(t){if(this.selected.length===1)this.emptySelected();else{const n=this.selected.indexOf(y(t)),r=[...this.selected],a=[...this._selected];r.splice(n,1),a.splice(n,1),this.selected=r,this._selected=a}}toggleSelected(t){const n=y(t);this.selected.includes(n)?this.removeFromSelected(t):this.maxMultiple&&this.selected.length>=this.maxMultiple||this.addToSelected(t)}handleRangeSelect(t){const n=y(t);return this.selected.includes(n)?this.selected.indexOf(n)===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 n=B({start:this._selected[0],end:t});if(Array.isArray(n)&&n.length)for(let r=0;r<n.length;r++){const a=n[r],s=a>this._selected[0]&&a<t;this.inRange[y(a)]=s}}else this.rangeHovered=null}handleDateSelect(t){if(t)return this.range?this.handleRangeSelect(t):this.multiple?this.toggleSelected(t):(this.selected.includes(y(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=y(W(new Date)),n=this.querySelector(`button[data-date="${t}"]`);if(n instanceof HTMLButtonElement)this.focusedDate=t,n.focus();else{const r=this.selectableDates.find(a=>!a.isDisabled);if(r){const a=this.querySelector(`button[data-date="${r.currentDateISO}"]`);a instanceof HTMLButtonElement&&(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([c.n({type:Boolean})],exports.PktCalendar.prototype,"multiple",2);d([c.n({type:Number})],exports.PktCalendar.prototype,"maxMultiple",2);d([c.n({type:Boolean})],exports.PktCalendar.prototype,"range",2);d([c.n({type:Boolean})],exports.PktCalendar.prototype,"weeknumbers",2);d([c.n({type:Boolean})],exports.PktCalendar.prototype,"withcontrols",2);d([c.n({converter:I.csvToArray})],exports.PktCalendar.prototype,"selected",2);d([c.n({type:String})],exports.PktCalendar.prototype,"earliest",2);d([c.n({type:String})],exports.PktCalendar.prototype,"latest",2);d([c.n({converter:I.stringsToDate})],exports.PktCalendar.prototype,"excludedates",2);d([c.n({converter:I.csvToArray})],exports.PktCalendar.prototype,"excludeweekdays",2);d([c.n({converter:I.stringToDate})],exports.PktCalendar.prototype,"currentmonth",2);d([c.n({type:Array})],exports.PktCalendar.prototype,"dayStrings",2);d([c.n({type:Array})],exports.PktCalendar.prototype,"dayStringsLong",2);d([c.n({type:Array})],exports.PktCalendar.prototype,"monthStrings",2);d([c.n({type:String})],exports.PktCalendar.prototype,"weekString",2);d([c.n({type:String})],exports.PktCalendar.prototype,"prevMonthString",2);d([c.n({type:String})],exports.PktCalendar.prototype,"nextMonthString",2);d([c.n({type:Array})],exports.PktCalendar.prototype,"_selected",2);d([c.n({type:Number})],exports.PktCalendar.prototype,"year",2);d([c.n({type:Number})],exports.PktCalendar.prototype,"month",2);d([c.n({type:Number})],exports.PktCalendar.prototype,"week",2);d([c.n({type:Date})],exports.PktCalendar.prototype,"rangeHovered",2);d([H.r()],exports.PktCalendar.prototype,"inRange",2);d([H.r()],exports.PktCalendar.prototype,"focusedDate",2);d([H.r()],exports.PktCalendar.prototype,"selectableDates",2);d([H.r()],exports.PktCalendar.prototype,"currentmonthtouched",2);d([H.r()],exports.PktCalendar.prototype,"tabIndexSet",2);exports.PktCalendar=d([c.t("pkt-calendar")],exports.PktCalendar);exports.converters=I;exports.csvToArray=dt;exports.filterSelectableDates=Ce;exports.formatISODate=y;exports.fromISOToDate=$;exports.fromISOtoLocal=Me;exports.isValidDateRange=$e;exports.newDate=C;exports.parseISODateString=T;exports.sortDateStrings=Ne;
@@ -1,5 +0,0 @@
1
- "use strict";const a=require("./element-D62wHiNU.cjs"),r=require("./directive-C7oCP5Bh.cjs");/**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const c=r.e(class extends r.i{constructor(s){var e;if(super(s),s.type!==r.t.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,o;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>t!=="")));for(const t in e)e[t]&&!((i=this.nt)!=null&&i.has(t))&&this.st.add(t);return this.render(e)}const n=s.element.classList;for(const t of this.st)t in e||(n.remove(t),this.st.delete(t));for(const t in e){const h=!!e[t];h===this.st.has(t)||(o=this.nt)!=null&&o.has(t)||(h?(n.add(t),this.st.add(t)):(n.remove(t),this.st.delete(t)))}return a.T}});exports.e=c;
@@ -1,5 +0,0 @@
1
- "use strict";const o=require("./element-D62wHiNU.cjs");/**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const{I:m}=o.Z,v=e=>e.strings===void 0,f=()=>document.createComment(""),d=(e,i,t)=>{var n;const r=e._$AA.parentNode,s=i===void 0?e._$AB:i._$AA;if(t===void 0){const $=r.insertBefore(f(),s),_=r.insertBefore(f(),s);t=new m($,_,e,e.options)}else{const $=t._$AB.nextSibling,_=t._$AM,c=_!==e;if(c){let A;(n=t._$AQ)==null||n.call(t,e),t._$AM=e,t._$AP!==void 0&&(A=e._$AU)!==_._$AU&&t._$AP(A)}if($!==s||c){let A=t._$AA;for(;A!==$;){const l=A.nextSibling;r.insertBefore(A,s),A=l}}}return t},u=(e,i,t=e)=>(e._$AI(i,t),e),B={},g=(e,i=B)=>e._$AH=i,b=e=>e._$AH,p=e=>{var r;(r=e._$AP)==null||r.call(e,!1,!0);let i=e._$AA;const t=e._$AB.nextSibling;for(;i!==t;){const s=i.nextSibling;i.remove(),i=s}};exports.M=p;exports.f=v;exports.m=g;exports.p=b;exports.r=d;exports.v=u;
@@ -1,45 +0,0 @@
1
- import { Z as l } from "./element-DJZPsA_J.js";
2
- /**
3
- * @license
4
- * Copyright 2020 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- const { I: m } = l, B = (e) => e.strings === void 0, o = () => document.createComment(""), g = (e, i, t) => {
8
- var f;
9
- const r = e._$AA.parentNode, $ = i === void 0 ? e._$AB : i._$AA;
10
- if (t === void 0) {
11
- const _ = r.insertBefore(o(), $), s = r.insertBefore(o(), $);
12
- t = new m(_, s, e, e.options);
13
- } else {
14
- const _ = t._$AB.nextSibling, s = t._$AM, n = s !== e;
15
- if (n) {
16
- let A;
17
- (f = t._$AQ) == null || f.call(t, e), t._$AM = e, t._$AP !== void 0 && (A = e._$AU) !== s._$AU && t._$AP(A);
18
- }
19
- if (_ !== $ || n) {
20
- let A = t._$AA;
21
- for (; A !== _; ) {
22
- const c = A.nextSibling;
23
- r.insertBefore(A, $), A = c;
24
- }
25
- }
26
- }
27
- return t;
28
- }, p = (e, i, t = e) => (e._$AI(i, t), e), d = {}, x = (e, i = d) => e._$AH = i, a = (e) => e._$AH, b = (e) => {
29
- var r;
30
- (r = e._$AP) == null || r.call(e, !1, !0);
31
- let i = e._$AA;
32
- const t = e._$AB.nextSibling;
33
- for (; i !== t; ) {
34
- const $ = i.nextSibling;
35
- i.remove(), i = $;
36
- }
37
- };
38
- export {
39
- b as M,
40
- B as f,
41
- x as m,
42
- a as p,
43
- g as r,
44
- p as v
45
- };
@@ -1,88 +0,0 @@
1
- import { E as f, T as v, P as m, x as y, n as h, a as P } from "./element-DJZPsA_J.js";
2
- import { e as g, i as k, t as _ } from "./directive-oAbCiebi.js";
3
- /**
4
- * @license
5
- * Copyright 2017 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- class a extends k {
9
- constructor(t) {
10
- if (super(t), this.it = f, t.type !== _.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
11
- }
12
- render(t) {
13
- if (t === f || t == null) return this._t = void 0, this.it = t;
14
- if (t === v) return t;
15
- if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
16
- if (t === this.it) return this._t;
17
- this.it = t;
18
- const s = [t];
19
- return s.raw = s, this._t = { _$litType$: this.constructor.resultType, strings: s, values: [] };
20
- }
21
- }
22
- a.directiveName = "unsafeHTML", a.resultType = 1;
23
- const x = g(a);
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */
29
- class d extends a {
30
- }
31
- d.directiveName = "unsafeSVG", d.resultType = 2;
32
- const w = g(d);
33
- var I = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (e, t, s, o) => {
34
- for (var i = o > 1 ? void 0 : o ? b(t, s) : t, p = e.length - 1, l; p >= 0; p--)
35
- (l = e[p]) && (i = (o ? l(t, s, i) : l(i)) || i);
36
- return o && i && I(t, s, i), i;
37
- };
38
- window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch;
39
- window.pktIconPath = window.pktIconPath || "https://punkt-cdn.oslo.kommune.no/latest/icons/";
40
- const C = (e) => new Promise((t) => setTimeout(t, e)), c = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>', u = {}, S = async (e, t) => {
41
- let s = 0;
42
- for (; u[t + e + ".svg"] === "fetching" && (s++, !(s > 50)); )
43
- await C(50);
44
- return localStorage.getItem(t + e + ".svg") ? Promise.resolve(localStorage.getItem(t + e + ".svg")) : typeof window.pktFetch == "function" ? (u[t + e + ".svg"] = "fetching", Promise.resolve(
45
- window.pktFetch(t + e + ".svg").then((o) => o.ok ? o.text() : (console.error("Missing icon: " + t + e + ".svg"), c)).then((o) => (o !== c && localStorage.setItem(t + e + ".svg", o), u[t + e + ".svg"] = "fetched", o))
46
- )) : Promise.resolve(c);
47
- };
48
- let r = class extends m {
49
- constructor() {
50
- super(...arguments), this.path = window.pktIconPath, this.name = "", this.icon = w(c), this._updatedProps = [];
51
- }
52
- connectedCallback() {
53
- super.connectedCallback(), this.classList.add("pkt-icon");
54
- }
55
- async attributeChangedCallback(e, t, s) {
56
- super.attributeChangedCallback(e, t, s), (e === "name" || e === "path") && this.getIcon(this.name);
57
- }
58
- async updated(e) {
59
- super.updated(e), (e.has("name") || e.has("path")) && this.getIcon(this.name);
60
- }
61
- async getIcon(e = "") {
62
- this._updatedProps.length > 0 ? (this.path || (this.path, window.pktIconPath), this.icon = w(
63
- await S(this.name || "", this.path).then((t) => t)
64
- ), this._updatedProps = []) : this._updatedProps.includes(e) || this._updatedProps.push(e);
65
- }
66
- render() {
67
- return y`${this.name && this.icon}`;
68
- }
69
- };
70
- n([
71
- h({ type: String, reflect: !1 })
72
- ], r.prototype, "path", 2);
73
- n([
74
- h({ type: String, reflect: !0 })
75
- ], r.prototype, "name", 2);
76
- n([
77
- h({ type: SVGElement })
78
- ], r.prototype, "icon", 2);
79
- n([
80
- h({ type: Array, noAccessor: !0 })
81
- ], r.prototype, "_updatedProps", 2);
82
- r = n([
83
- P("pkt-icon")
84
- ], r);
85
- export {
86
- r as P,
87
- x as o
88
- };
@@ -1,9 +0,0 @@
1
- "use strict";const o=require("./element-D62wHiNU.cjs"),a=require("./directive-C7oCP5Bh.cjs");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */class h extends a.i{constructor(t){if(super(t),this.it=o.E,t.type!==a.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===o.E||t==null)return this._t=void 0,this.it=t;if(t===o.T)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}h.directiveName="unsafeHTML",h.resultType=1;const f=a.e(h);/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */class d extends h{}d.directiveName="unsafeSVG",d.resultType=2;const w=a.e(d);var g=Object.defineProperty,v=Object.getOwnPropertyDescriptor,r=(e,t,s,n)=>{for(var i=n>1?void 0:n?v(t,s):t,l=e.length-1,p;l>=0;l--)(p=e[l])&&(i=(n?p(t,s,i):p(i))||i);return n&&i&&g(t,s,i),i};window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch;window.pktIconPath=window.pktIconPath||"https://punkt-cdn.oslo.kommune.no/latest/icons/";const P=e=>new Promise(t=>setTimeout(t,e)),c='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',u={},k=async(e,t)=>{let s=0;for(;u[t+e+".svg"]==="fetching"&&(s++,!(s>50));)await P(50);return localStorage.getItem(t+e+".svg")?Promise.resolve(localStorage.getItem(t+e+".svg")):typeof window.pktFetch=="function"?(u[t+e+".svg"]="fetching",Promise.resolve(window.pktFetch(t+e+".svg").then(n=>n.ok?n.text():(console.error("Missing icon: "+t+e+".svg"),c)).then(n=>(n!==c&&localStorage.setItem(t+e+".svg",n),u[t+e+".svg"]="fetched",n)))):Promise.resolve(c)};exports.PktIcon=class extends o.PktElement{constructor(){super(...arguments),this.path=window.pktIconPath,this.name="",this.icon=w(c),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(t,s,n){super.attributeChangedCallback(t,s,n),(t==="name"||t==="path")&&this.getIcon(this.name)}async updated(t){super.updated(t),(t.has("name")||t.has("path"))&&this.getIcon(this.name)}async getIcon(t=""){this._updatedProps.length>0?(this.path||(this.path,window.pktIconPath),this.icon=w(await k(this.name||"",this.path).then(s=>s)),this._updatedProps=[]):this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return o.x`${this.name&&this.icon}`}};r([o.n({type:String,reflect:!1})],exports.PktIcon.prototype,"path",2);r([o.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);r([o.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);r([o.n({type:Array,noAccessor:!0})],exports.PktIcon.prototype,"_updatedProps",2);exports.PktIcon=r([o.t("pkt-icon")],exports.PktIcon);exports.o=f;