@oslokommune/punkt-react 16.0.0 → 16.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,7 +87,7 @@
87
87
  * @license
88
88
  * Copyright 2020 Google LLC
89
89
  * SPDX-License-Identifier: BSD-3-Clause
90
- */const Z=()=>new Ec;let Ec=class{};const cr=new WeakMap,X=Es(class extends Oc{render(s){return x}update(s,[e]){var t;const n=e!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=e,this.ht=(t=s.options)==null?void 0:t.host,this.rt(this.ct=s.element)),x}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=cr.get(e);t===void 0&&(t=new WeakMap,cr.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){var s,e;return typeof this.G=="function"?(s=cr.get(this.ht??globalThis))==null?void 0:s.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Pa(s,e,t){const n=s.getAttribute("class")||"",i=new Set(n.split(/\s+/).filter(Boolean));t?i.add(e):i.delete(e),s.setAttribute("class",Array.from(i).join(" "))}/**
90
+ */const Q=()=>new Ec;let Ec=class{};const cr=new WeakMap,G=Es(class extends Oc{render(s){return x}update(s,[e]){var t;const n=e!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=e,this.ht=(t=s.options)==null?void 0:t.host,this.rt(this.ct=s.element)),x}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=cr.get(e);t===void 0&&(t=new WeakMap,cr.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){var s,e;return typeof this.G=="function"?(s=cr.get(this.ht??globalThis))==null?void 0:s.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Pa(s,e,t){const n=s.getAttribute("class")||"",i=new Set(n.split(/\s+/).filter(Boolean));t?i.add(e):i.delete(e),s.setAttribute("class",Array.from(i).join(" "))}/**
91
91
  * @license
92
92
  * Copyright 2017 Google LLC
93
93
  * SPDX-License-Identifier: BSD-3-Clause
@@ -99,7 +99,7 @@
99
99
  * @license
100
100
  * Copyright 2018 Google LLC
101
101
  * SPDX-License-Identifier: BSD-3-Clause
102
- */const A=s=>s??x;var Vc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,ut=(s,e,t,n)=>{for(var i=n>1?void 0:n?Uc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vc(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";let rt=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=window.pktAnimationPath,this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="disabled"&&n==="false"&&(this.disabled=!1),(e==="isloading"||e==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(e){super.firstUpdated(e),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const e=this.form??this.getAttribute("form")??void 0,t={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return y`
102
+ */const A=s=>s??x;var Vc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,ut=(s,e,t,n)=>{for(var i=n>1?void 0:n?Uc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vc(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";let rt=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin="primary",this.variant="label-only",this.state="normal",this.type="button",this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=window.pktAnimationPath,this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="disabled"&&n==="false"&&(this.disabled=!1),(e==="isloading"||e==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(e){super.firstUpdated(e),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const e=this.form??this.getAttribute("form")??void 0,t={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return y`
103
103
  <button
104
104
  class=${z(t)}
105
105
  type=${this.type}
@@ -118,14 +118,14 @@
118
118
  name=${this.iconName}
119
119
  path=${A(this.iconPath)}
120
120
  ></pkt-icon>`:x}
121
- <span class="pkt-btn__text" ${X(this.defaultSlot)}></span>
121
+ <span class="pkt-btn__text" ${G(this.defaultSlot)}></span>
122
122
  ${this.variant==="icons-right-and-left"?y`<pkt-icon
123
123
  class="pkt-btn__icon"
124
124
  name=${this.secondIconName}
125
125
  path=${A(this.secondIconPath)}
126
126
  ></pkt-icon>`:x}
127
127
  </button>
128
- `}};ut([u({type:String})],rt.prototype,"iconName",2),ut([u({type:String})],rt.prototype,"secondIconName",2),ut([u({type:String})],rt.prototype,"iconPath",2),ut([u({type:String})],rt.prototype,"secondIconPath",2),ut([u({type:String})],rt.prototype,"mode",2),ut([u({type:String})],rt.prototype,"size",2),ut([u({type:Boolean,attribute:"full-width"})],rt.prototype,"fullWidth",2),ut([u({type:Boolean,attribute:"full-width-on-mobile"})],rt.prototype,"fullWidthOnMobile",2),ut([u({type:String})],rt.prototype,"color",2),ut([u({type:String})],rt.prototype,"skin",2),ut([u({type:String})],rt.prototype,"variant",2),ut([u({type:String,reflect:!0})],rt.prototype,"state",2),ut([u({type:String,reflect:!0})],rt.prototype,"type",2),ut([u({type:String})],rt.prototype,"form",2),ut([u({type:Boolean,reflect:!0})],rt.prototype,"isLoading",2),ut([u({type:Boolean,reflect:!0})],rt.prototype,"disabled",2),ut([u({type:String})],rt.prototype,"loadingAnimationPath",2),rt=ut([ge("pkt-button")],rt);const Hc={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},Si={props:Hc};var jc=Object.defineProperty,qc=Object.getOwnPropertyDescriptor,Qt=(s,e,t,n)=>{for(var i=n>1?void 0:n?qc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&jc(e,t,i),i};let jt=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.compact=Si.props.compact.default,this.title="",this.skin=Si.props.skin.default,this.ariaLive=Si.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=Si.props.closeAlert.default,this.date=null,this.role="status",this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,t,n){e==="ariaLive"&&(this["aria-live"]=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive),e.has("_isClosed")&&Pa(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed},t={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return y`
128
+ `}};ut([u({type:String})],rt.prototype,"iconName",2),ut([u({type:String})],rt.prototype,"secondIconName",2),ut([u({type:String})],rt.prototype,"iconPath",2),ut([u({type:String})],rt.prototype,"secondIconPath",2),ut([u({type:String})],rt.prototype,"mode",2),ut([u({type:String})],rt.prototype,"size",2),ut([u({type:Boolean,attribute:"full-width"})],rt.prototype,"fullWidth",2),ut([u({type:Boolean,attribute:"full-width-on-mobile"})],rt.prototype,"fullWidthOnMobile",2),ut([u({type:String})],rt.prototype,"color",2),ut([u({type:String})],rt.prototype,"skin",2),ut([u({type:String})],rt.prototype,"variant",2),ut([u({type:String,reflect:!0})],rt.prototype,"state",2),ut([u({type:String,reflect:!0})],rt.prototype,"type",2),ut([u({type:String})],rt.prototype,"form",2),ut([u({type:Boolean,reflect:!0})],rt.prototype,"isLoading",2),ut([u({type:Boolean,reflect:!0})],rt.prototype,"disabled",2),ut([u({type:String})],rt.prototype,"loadingAnimationPath",2),rt=ut([ge("pkt-button")],rt);const Hc={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},Si={props:Hc};var jc=Object.defineProperty,qc=Object.getOwnPropertyDescriptor,Qt=(s,e,t,n)=>{for(var i=n>1?void 0:n?qc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&jc(e,t,i),i};let jt=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.compact=Si.props.compact.default,this.title="",this.skin=Si.props.skin.default,this.ariaLive=Si.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=Si.props.closeAlert.default,this.date=null,this.role="status",this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,t,n){e==="ariaLive"&&(this["aria-live"]=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive),e.has("_isClosed")&&Pa(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed},t={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return y`
129
129
  <div class=${z(e)} aria-live=${this["aria-live"]}>
130
130
  <div class=${z(t)}>
131
131
  <pkt-icon
@@ -152,7 +152,7 @@
152
152
  `:x}
153
153
  ${this.title?y`<div class="pkt-alert__title">${this.title}</div>`:x}
154
154
 
155
- <div class="pkt-alert__text" ${X(this.defaultSlot)}></div>
155
+ <div class="pkt-alert__text" ${G(this.defaultSlot)}></div>
156
156
 
157
157
  ${this.date?y`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:x}
158
158
  </div>
@@ -166,12 +166,12 @@
166
166
  >
167
167
  <slot></slot>
168
168
  </div>
169
- `}};Bn([u({type:String,reflect:!0,attribute:"aria-labelledby"})],an.prototype,"ariaLabelledBy",2),Bn([u({type:Boolean,reflect:!0,attribute:"compact"})],an.prototype,"compact",2),Bn([u({type:String,reflect:!0,attribute:"skin"})],an.prototype,"skin",2),Bn([u({type:String,reflect:!0,attribute:"name"})],an.prototype,"name",2),an=Bn([ge("pkt-accordion")],an);var Yc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Is=(s,e,t,n)=>{for(var i=n>1?void 0:n?Kc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Yc(e,t,i),i};let vs=class extends Oe{constructor(){super(),this.defaultOpen=!1,this.title="",this.skin=void 0,this.compact=!1,this.isOpen=!1,this.name=void 0,this.accordionItemRef=Z(),this.defaultSlot=Z(),this.slotController=new Qe(this,this.defaultSlot)}firstUpdated(e){this.defaultOpen&&(this.isOpen=!0)}render(){const e={"pkt-accordion-item":!0,"pkt-accordion-item--compact":this.compact,[`pkt-accordion-item--${this.skin}`]:!!this.skin};return y`
169
+ `}};Bn([u({type:String,reflect:!0,attribute:"aria-labelledby"})],an.prototype,"ariaLabelledBy",2),Bn([u({type:Boolean,reflect:!0,attribute:"compact"})],an.prototype,"compact",2),Bn([u({type:String,reflect:!0,attribute:"skin"})],an.prototype,"skin",2),Bn([u({type:String,reflect:!0,attribute:"name"})],an.prototype,"name",2),an=Bn([ge("pkt-accordion")],an);var Yc=Object.defineProperty,Kc=Object.getOwnPropertyDescriptor,Is=(s,e,t,n)=>{for(var i=n>1?void 0:n?Kc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Yc(e,t,i),i};let vs=class extends Oe{constructor(){super(),this.defaultOpen=!1,this.title="",this.skin=void 0,this.compact=!1,this.isOpen=!1,this.name=void 0,this.accordionItemRef=Q(),this.defaultSlot=Q(),this.slotController=new Qe(this,this.defaultSlot)}firstUpdated(e){this.defaultOpen&&(this.isOpen=!0)}render(){const e={"pkt-accordion-item":!0,"pkt-accordion-item--compact":this.compact,[`pkt-accordion-item--${this.skin}`]:!!this.skin};return y`
170
170
  <details
171
171
  class=${z(e)}
172
172
  id=${this.id}
173
173
  ?open=${this.isOpen}
174
- ${X(this.accordionItemRef)}
174
+ ${G(this.accordionItemRef)}
175
175
  name=${A(this.name)}
176
176
  >
177
177
  <summary class="pkt-accordion-item__title" id=${`pkt-accordion-item-summary-${this.id}`}>
@@ -187,7 +187,7 @@
187
187
  id="pkt-accordion-item__content-${this.id}"
188
188
  role="region"
189
189
  >
190
- <div class="pkt-accordion-item__content-inner" ${X(this.defaultSlot)}></div>
190
+ <div class="pkt-accordion-item__content-inner" ${G(this.defaultSlot)}></div>
191
191
  </div>
192
192
  </details>
193
193
  `}};Is([u({type:Boolean})],vs.prototype,"defaultOpen",2),Is([u({type:String})],vs.prototype,"title",2),Is([u({type:String,reflect:!0})],vs.prototype,"skin",2),Is([u({type:Boolean,reflect:!0})],vs.prototype,"compact",2),Is([u({type:Boolean,reflect:!0})],vs.prototype,"isOpen",2),Is([u({type:String,reflect:!0})],vs.prototype,"name",2),vs=Is([ge("pkt-accordion-item")],vs);var Gc=Object.defineProperty,Xc=Object.getOwnPropertyDescriptor,Ci=(s,e,t,n)=>{for(var i=n>1?void 0:n?Xc(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Gc(e,t,i),i};let on=class extends Oe{constructor(){super(...arguments),this.href="",this.text="Forsiden",this.ariaLabel=""}attributeChangedCallback(e,t,n){e==="arialabel"&&this.removeAttribute("arialabel"),e==="href"&&this.removeAttribute("href"),e==="text"&&this.removeAttribute("text"),super.attributeChangedCallback(e,t,n)}render(){return y`<nav
@@ -291,7 +291,7 @@
291
291
  >
292
292
  <span class="pkt-btn__text pkt-txt-14-light">${e}</span>
293
293
  </div>
294
- </td>`}renderWeekRow(e){return y`<tr class="pkt-cal-week-row" role="row">${e}</tr>`}renderCalendarBody(){const e=this.todayDate,t=wd(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let n=1;this.week=t.initialWeek;const i=[];for(let r=0;r<t.numRows;r++){const a=[];this.weeknumbers&&a.push(y`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let l=0;l<zn;l++){const c=$d(r,l,n,t);if(c==="current-month")a.push(this.renderDayView(n,e)),n++;else{const p=xd(c,l,n,t);a.push(this.renderEmptyDayCell(p)),c==="next-month"&&n++}}i.push(this.renderWeekRow(a))}return i}isExcluded(e){return ro(e,this.getDateConstraints())}isPrevMonthAllowed(){return kd(this.year,this.month,this.earliest)}prevMonth(){const e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){return yd(this.year,this.month,this.latest)}nextMonth(){const e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=typeof e=="string"?parseInt(e):e,this.month=typeof t=="string"?parseInt(t):t,this.currentmonth=qn(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected=="string"?this.selected.split(","):this.selected}addToSelected(e){this.selected=br(e,this.normalizeSelected()),this._selected=un(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(e){this.selected=vr(e,this.normalizeSelected()),this._selected=un(this.selected)}toggleSelected(e){this.selected=Sd(e,this.normalizeSelected(),this.maxMultiple),this._selected=un(this.selected)}isRangeAllowed(e){return oo(e,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(e){return this.selected=Cd(e,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=un(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(e){if(!this.range||this._selected.length!==1||!this.isRangeAllowed(e)||this._selected[0]>=e){this.rangeHovered=null;return}this.rangeHovered=e,this.inRange=ao(this._selected[0],e)}handleDateSelect(e){return e&&(this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(at(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0}))),Promise.resolve()}focusOnCurrentDate(){const e=at(qn(this.todayDate)),t=this.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){this.focusedDate=e,t.focus();return}const n=this.selectableDates.find(i=>!i.isDisabled);if(n){const i=this.querySelector(`button[data-date="${n.currentDateISO}"]`);i instanceof HTMLButtonElement&&(this.focusedDate=n.currentDateISO,i.focus())}}closeEvent(e){!this.contains(e.relatedTarget)&&!e.target.classList.contains("pkt-invisible")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};Ee([u({converter:cn.csvToArray})],Ne.prototype,"selected",2),Ee([u({type:Boolean})],Ne.prototype,"multiple",2),Ee([u({type:Number,attribute:"max-multiple"})],Ne.prototype,"maxMultiple",2),Ee([u({type:Boolean})],Ne.prototype,"range",2),Ee([u({type:String})],Ne.prototype,"earliest",2),Ee([u({type:String})],Ne.prototype,"latest",2),Ee([u({converter:cn.stringsToDate})],Ne.prototype,"excludedates",2),Ee([u({converter:cn.csvToArray})],Ne.prototype,"excludeweekdays",2),Ee([u({type:Boolean})],Ne.prototype,"weeknumbers",2),Ee([u({type:Boolean})],Ne.prototype,"withcontrols",2),Ee([u({converter:cn.stringToDate})],Ne.prototype,"currentmonth",2),Ee([u({type:String})],Ne.prototype,"today",2),Ee([u({type:Array,attribute:"day-strings"})],Ne.prototype,"dayStrings",2),Ee([u({type:Array,attribute:"day-strings-long"})],Ne.prototype,"dayStringsLong",2),Ee([u({type:Array,attribute:"month-strings"})],Ne.prototype,"monthStrings",2),Ee([u({type:String,attribute:"week-string"})],Ne.prototype,"weekString",2),Ee([u({type:String,attribute:"prev-month-string"})],Ne.prototype,"prevMonthString",2),Ee([u({type:String,attribute:"next-month-string"})],Ne.prototype,"nextMonthString",2),Ee([u({type:Array})],Ne.prototype,"_selected",2),Ee([ce()],Ne.prototype,"inRange",2),Ee([u({type:Date})],Ne.prototype,"rangeHovered",2),Ee([u({type:Number})],Ne.prototype,"year",2),Ee([u({type:Number})],Ne.prototype,"month",2),Ee([u({type:Number})],Ne.prototype,"week",2),Ee([ce()],Ne.prototype,"currentmonthtouched",2),Ee([ce()],Ne.prototype,"focusedDate",2),Ne=Ee([ge("pkt-calendar")],Ne);const Pd={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},Mi={props:Pd};var Ad=Object.defineProperty,Id=Object.getOwnPropertyDescriptor,qt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Id(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ad(e,t,i),i};let It=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.closeTag=Mi.props.closeTag.default,this.size=Mi.props.size.default,this.skin=Mi.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=Mi.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var t,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(t=this.defaultSlot.value)==null?void 0:t.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},t={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?y`
294
+ </td>`}renderWeekRow(e){return y`<tr class="pkt-cal-week-row" role="row">${e}</tr>`}renderCalendarBody(){const e=this.todayDate,t=wd(this.year,this.month);this.selectableDates=[],this.tabIndexSet=0;let n=1;this.week=t.initialWeek;const i=[];for(let r=0;r<t.numRows;r++){const a=[];this.weeknumbers&&a.push(y`<td class="pkt-cal-week">${this.week}</td>`),this.week++;for(let l=0;l<zn;l++){const c=$d(r,l,n,t);if(c==="current-month")a.push(this.renderDayView(n,e)),n++;else{const p=xd(c,l,n,t);a.push(this.renderEmptyDayCell(p)),c==="next-month"&&n++}}i.push(this.renderWeekRow(a))}return i}isExcluded(e){return ro(e,this.getDateConstraints())}isPrevMonthAllowed(){return kd(this.year,this.month,this.earliest)}prevMonth(){const e=this.month===0?11:this.month-1,t=this.month===0?this.year-1:this.year;this.changeMonth(t,e)}isNextMonthAllowed(){return yd(this.year,this.month,this.latest)}nextMonth(){const e=this.month===11?0:this.month+1,t=this.month===11?this.year+1:this.year;this.changeMonth(t,e)}changeMonth(e,t){this.year=typeof e=="string"?parseInt(e):e,this.month=typeof t=="string"?parseInt(t):t,this.currentmonth=qn(new Date(this.year,this.month,1)),this.tabIndexSet=0,this.focusedDate=null,this.selectableDates=[]}emptySelected(){this.selected=[],this._selected=[],this.inRange={}}normalizeSelected(){return typeof this.selected=="string"?this.selected.split(","):this.selected}addToSelected(e){this.selected=br(e,this.normalizeSelected()),this._selected=un(this.selected),this.range&&this.selected.length===2&&(this.convertSelected(),this.close())}removeFromSelected(e){this.selected=vr(e,this.normalizeSelected()),this._selected=un(this.selected)}toggleSelected(e){this.selected=Sd(e,this.normalizeSelected(),this.maxMultiple),this._selected=un(this.selected)}isRangeAllowed(e){return oo(e,this._selected,this.excludedates,this.excludeweekdays)}handleRangeSelect(e){return this.selected=Cd(e,this.normalizeSelected(),{excludedates:this.excludedates,excludeweekdays:this.excludeweekdays}),this._selected=un(this.selected),this.selected.length===2?(this.convertSelected(),this.close()):this.selected.length===1&&(this.inRange={}),Promise.resolve()}handleRangeHover(e){if(!this.range||this._selected.length!==1||!this.isRangeAllowed(e)||this._selected[0]>=e){this.rangeHovered=null;return}this.rangeHovered=e,this.inRange=ao(this._selected[0],e)}handleDateSelect(e){return e&&(this.range?this.handleRangeSelect(e):this.multiple?this.toggleSelected(e):(this.selected.includes(at(e))?this.emptySelected():(this.emptySelected(),this.addToSelected(e)),this.close()),this.dispatchEvent(new CustomEvent("date-selected",{detail:this.selected,bubbles:!0,composed:!0}))),Promise.resolve()}focusOnCurrentDate(){const e=at(qn(this.todayDate)),t=this.querySelector(`button[data-date="${e}"]`);if(t instanceof HTMLButtonElement){this.focusedDate=e,t.focus();return}const n=this.selectableDates.find(i=>!i.isDisabled);if(n){const i=this.querySelector(`button[data-date="${n.currentDateISO}"]`);i instanceof HTMLButtonElement&&(this.focusedDate=n.currentDateISO,i.focus())}}closeEvent(e){!this.contains(e.relatedTarget)&&!e.target.classList.contains("pkt-invisible")&&this.close()}close(){this.dispatchEvent(new CustomEvent("close",{detail:!0,bubbles:!0,composed:!0}))}};Ee([u({converter:cn.csvToArray})],Ne.prototype,"selected",2),Ee([u({type:Boolean})],Ne.prototype,"multiple",2),Ee([u({type:Number,attribute:"max-multiple"})],Ne.prototype,"maxMultiple",2),Ee([u({type:Boolean})],Ne.prototype,"range",2),Ee([u({type:String})],Ne.prototype,"earliest",2),Ee([u({type:String})],Ne.prototype,"latest",2),Ee([u({converter:cn.stringsToDate})],Ne.prototype,"excludedates",2),Ee([u({converter:cn.csvToArray})],Ne.prototype,"excludeweekdays",2),Ee([u({type:Boolean})],Ne.prototype,"weeknumbers",2),Ee([u({type:Boolean})],Ne.prototype,"withcontrols",2),Ee([u({converter:cn.stringToDate})],Ne.prototype,"currentmonth",2),Ee([u({type:String})],Ne.prototype,"today",2),Ee([u({type:Array,attribute:"day-strings"})],Ne.prototype,"dayStrings",2),Ee([u({type:Array,attribute:"day-strings-long"})],Ne.prototype,"dayStringsLong",2),Ee([u({type:Array,attribute:"month-strings"})],Ne.prototype,"monthStrings",2),Ee([u({type:String,attribute:"week-string"})],Ne.prototype,"weekString",2),Ee([u({type:String,attribute:"prev-month-string"})],Ne.prototype,"prevMonthString",2),Ee([u({type:String,attribute:"next-month-string"})],Ne.prototype,"nextMonthString",2),Ee([u({type:Array})],Ne.prototype,"_selected",2),Ee([ce()],Ne.prototype,"inRange",2),Ee([u({type:Date})],Ne.prototype,"rangeHovered",2),Ee([u({type:Number})],Ne.prototype,"year",2),Ee([u({type:Number})],Ne.prototype,"month",2),Ee([u({type:Number})],Ne.prototype,"week",2),Ee([ce()],Ne.prototype,"currentmonthtouched",2),Ee([ce()],Ne.prototype,"focusedDate",2),Ne=Ee([ge("pkt-calendar")],Ne);const Pd={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},Mi={props:Pd};var Ad=Object.defineProperty,Id=Object.getOwnPropertyDescriptor,qt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Id(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ad(e,t,i),i};let It=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.closeTag=Mi.props.closeTag.default,this.size=Mi.props.size.default,this.skin=Mi.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=Mi.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var t,n;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(n=(t=this.defaultSlot.value)==null?void 0:t.textContent)==null?void 0:n.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},t={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?y`
295
295
  <button
296
296
  class=${z(t)}
297
297
  type=${this.type}
@@ -305,7 +305,7 @@
305
305
  name=${this.iconName}
306
306
  aria-hidden="true"
307
307
  ></pkt-icon>`}
308
- <span ${X(this.defaultSlot)}></span>
308
+ <span ${G(this.defaultSlot)}></span>
309
309
  <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
310
310
  </button>
311
311
  `:y`
@@ -315,9 +315,9 @@
315
315
  name=${this.iconName}
316
316
  aria-hidden="true"
317
317
  ></pkt-icon>`}
318
- <span ${X(this.defaultSlot)}></span>
318
+ <span ${G(this.defaultSlot)}></span>
319
319
  </span>
320
- `}};qt([u({type:Boolean,reflect:!0})],It.prototype,"closeTag",2),qt([u({type:String,reflect:!0})],It.prototype,"size",2),qt([u({type:String,reflect:!0})],It.prototype,"skin",2),qt([u({type:String,reflect:!0})],It.prototype,"textStyle",2),qt([u({type:String,reflect:!0})],It.prototype,"iconName",2),qt([u({type:String})],It.prototype,"type",2),qt([u({type:String})],It.prototype,"ariaLabel",2),qt([u({type:Number,attribute:"button-tabindex"})],It.prototype,"buttonTabindex",2),qt([ce()],It.prototype,"_isClosed",2),qt([ce()],It.prototype,"_ariaDescription",2),It=qt([ge("pkt-tag")],It);var Ld=Object.defineProperty,Bd=Object.getOwnPropertyDescriptor,dn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Bd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ld(e,t,i),i};let _s=class extends _i{constructor(){super(...arguments),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute("role","heading"),this.setAttribute("aria-level",String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="level"&&n&&this.setLevel(Number(n)),e==="visuallyHidden"&&(this.visuallyHidden=n!==null&&n!=="false"),(e==="size"||e==="visuallyHidden"||e==="align"||e==="weight")&&this.updateHostClasses()}updated(e){super.updated(e),e.has("level")&&(this.setLevel(this.level),this.hasAttribute("size")||(this.size=this.defaultSizeForLevel),this.hasAttribute("weight")||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute("size")&&(e.has("level")||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has("size")||e.has("visuallyHidden")||e.has("align")||e.has("weight"))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute("aria-level",String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return"xlarge";case 2:return"large";case 3:return"medium";case 4:return"small";case 5:return"xsmall";case 6:return"xsmall";default:return"medium"}}get defaultWeightForLevel(){switch(this.level){case 1:return"regular";case 2:return"regular";case 3:return"medium";case 4:return"medium";case 5:return"medium";case 6:return"medium";default:return"medium"}}updateHostClasses(){this.classList.remove("pkt-heading","pkt-heading--xsmall","pkt-heading--small","pkt-heading--medium","pkt-heading--large","pkt-heading--xlarge","pkt-sr-only","pkt-heading--start","pkt-heading--center","pkt-heading--end","pkt-heading--light","pkt-heading--regular","pkt-heading--medium","pkt-heading--bold"),this.classList.add("pkt-heading"),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add("pkt-sr-only"),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return y`<slot></slot>`}};dn([u({type:String,reflect:!0})],_s.prototype,"size",2),dn([u({type:Number,reflect:!0})],_s.prototype,"level",2),dn([u({type:String,reflect:!0})],_s.prototype,"weight",2),dn([u({type:Boolean,reflect:!0})],_s.prototype,"visuallyHidden",2),dn([u({type:String,reflect:!0})],_s.prototype,"align",2),_s=dn([ge("pkt-heading")],_s);const Fd={layout:{default:"vertical"},skin:{type:["outlined","outlined-beige","gray","blue","beige","green"],default:"outlined"},padding:{default:"default"}},hn={props:Fd};var Vd=Object.defineProperty,Ud=Object.getOwnPropertyDescriptor,ht=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ud(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vd(e,t,i),i};let ot=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.ariaLabel="",this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=hn.props.layout.default,this.heading="",this.headinglevel=3,this.image={src:"",alt:""},this.imageShape="square",this.openLinkInNewTab=!1,this.padding=hn.props.padding.default,this.skin=hn.props.skin.default,this.subheading="",this.tagPosition="top",this.tags=[],this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){var e,t;const n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover},i=((e=this.ariaLabel)==null?void 0:e.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),r=((t=this.ariaLabel)==null?void 0:t.trim())||(this.heading?this.heading:"kort");return y`
320
+ `}};qt([u({type:Boolean,reflect:!0})],It.prototype,"closeTag",2),qt([u({type:String,reflect:!0})],It.prototype,"size",2),qt([u({type:String,reflect:!0})],It.prototype,"skin",2),qt([u({type:String,reflect:!0})],It.prototype,"textStyle",2),qt([u({type:String,reflect:!0})],It.prototype,"iconName",2),qt([u({type:String})],It.prototype,"type",2),qt([u({type:String})],It.prototype,"ariaLabel",2),qt([u({type:Number,attribute:"button-tabindex"})],It.prototype,"buttonTabindex",2),qt([ce()],It.prototype,"_isClosed",2),qt([ce()],It.prototype,"_ariaDescription",2),It=qt([ge("pkt-tag")],It);var Ld=Object.defineProperty,Bd=Object.getOwnPropertyDescriptor,dn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Bd(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ld(e,t,i),i};let _s=class extends _i{constructor(){super(...arguments),this.size=void 0,this.level=2,this.weight=void 0,this.visuallyHidden=!1,this.align=void 0}connectedCallback(){super.connectedCallback(),this.setAttribute("role","heading"),this.setAttribute("aria-level",String(this.level)),this.updateHostClasses()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e==="level"&&n&&this.setLevel(Number(n)),e==="visuallyHidden"&&(this.visuallyHidden=n!==null&&n!=="false"),(e==="size"||e==="visuallyHidden"||e==="align"||e==="weight")&&this.updateHostClasses()}updated(e){super.updated(e),e.has("level")&&(this.setLevel(this.level),this.hasAttribute("size")||(this.size=this.defaultSizeForLevel),this.hasAttribute("weight")||(this.weight=this.defaultWeightForLevel)),!this.hasAttribute("size")&&(e.has("level")||this.size===void 0)&&(this.size=this.defaultSizeForLevel),(e.has("size")||e.has("visuallyHidden")||e.has("align")||e.has("weight"))&&this.updateHostClasses()}setLevel(e){e>=1&&e<=6?(this.level=e,this.setAttribute("aria-level",String(e))):console.warn(`Invalid heading level: ${e}. Must be between 1 and 6.`)}get defaultSizeForLevel(){switch(this.level){case 1:return"xlarge";case 2:return"large";case 3:return"medium";case 4:return"small";case 5:return"xsmall";case 6:return"xsmall";default:return"medium"}}get defaultWeightForLevel(){switch(this.level){case 1:return"regular";case 2:return"regular";case 3:return"medium";case 4:return"medium";case 5:return"medium";case 6:return"medium";default:return"medium"}}updateHostClasses(){this.classList.remove("pkt-heading","pkt-heading--xsmall","pkt-heading--small","pkt-heading--medium","pkt-heading--large","pkt-heading--xlarge","pkt-sr-only","pkt-heading--start","pkt-heading--center","pkt-heading--end","pkt-heading--light","pkt-heading--regular","pkt-heading--medium","pkt-heading--bold"),this.classList.add("pkt-heading"),this.size&&this.classList.add(`pkt-heading--${this.size}`),this.weight&&this.classList.add(`pkt-heading--fw-${this.weight}`),this.visuallyHidden&&this.classList.add("pkt-sr-only"),this.align&&this.classList.add(`pkt-heading--${this.align}`)}render(){return y`<slot></slot>`}};dn([u({type:String,reflect:!0})],_s.prototype,"size",2),dn([u({type:Number,reflect:!0})],_s.prototype,"level",2),dn([u({type:String,reflect:!0})],_s.prototype,"weight",2),dn([u({type:Boolean,reflect:!0})],_s.prototype,"visuallyHidden",2),dn([u({type:String,reflect:!0})],_s.prototype,"align",2),_s=dn([ge("pkt-heading")],_s);const Fd={layout:{default:"vertical"},skin:{type:["outlined","outlined-beige","gray","blue","beige","green"],default:"outlined"},padding:{default:"default"}},hn={props:Fd};var Vd=Object.defineProperty,Ud=Object.getOwnPropertyDescriptor,ht=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ud(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vd(e,t,i),i};let ot=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.ariaLabel="",this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=hn.props.layout.default,this.heading="",this.headinglevel=3,this.image={src:"",alt:""},this.imageShape="square",this.openLinkInNewTab=!1,this.padding=hn.props.padding.default,this.skin=hn.props.skin.default,this.subheading="",this.tagPosition="top",this.tags=[],this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){var e,t;const n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover},i=((e=this.ariaLabel)==null?void 0:e.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),r=((t=this.ariaLabel)==null?void 0:t.trim())||(this.heading?this.heading:"kort");return y`
321
321
  <article
322
322
  class=${z(n)}
323
323
  aria-label=${A(this.clickCardLink?i:r)}
@@ -397,7 +397,7 @@
397
397
  </div>
398
398
  `:x}
399
399
  `}renderSlot(){return y`
400
- ${this.defaultSlot&&y`<section class="pkt-card__content" ${X(this.defaultSlot)}></section>`}
400
+ ${this.defaultSlot&&y`<section class="pkt-card__content" ${G(this.defaultSlot)}></section>`}
401
401
  `}renderMetadata(){return y`
402
402
  ${this.metaLead||this.metaTrail?y`
403
403
  <footer class="pkt-card__metadata">
@@ -509,7 +509,7 @@
509
509
  role="searchbox"
510
510
  />
511
511
  </div>
512
- `:x}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":this.focusFirstOrSelectedOption();break;case"Tab":this.tabClose();break}}handleOptionKeydown(e){const t=e.currentTarget,n=t.dataset.value,i=t.dataset.type,r=t.dataset.selected==="true";if(!(!Yn(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&i!=="new-option"&&i!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":n&&(r?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":this.closeOptions(),e.preventDefault();break;case"Tab":this.tabClose();break;case"ArrowDown":e.altKey?po(this):i==="searchbox"||i==="new-option"?yr(this):Gd(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)yr(this);else if(t.dataset.index==="0"&&this.includeSearch){const a=this.querySelector('[role="searchbox"]');a&&a.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const a=this.querySelector('[data-type="new-option"]');a&&a.focus()}else Xd(t,this,this.includeSearch);e.preventDefault();break;case"Home":yr(this),e.preventDefault();break;case"End":po(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),zd(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){Qd(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const n=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent("tab-close",{bubbles:!1}))}filterOptions(){this._filteredOptions=jd(this.options,this.searchValue)}handleTypeAhead(e){const t=this.typeahead.append(e),n=Yn(this),i=Kd(n,t);i>=0&&cs(n[i])}};bt([u({type:String})],pt.prototype,"id",2),bt([u({type:String})],pt.prototype,"label",2),bt([u({type:Array})],pt.prototype,"options",2),bt([u({type:Boolean,reflect:!0,attribute:"is-open"})],pt.prototype,"isOpen",2),bt([u({type:Boolean})],pt.prototype,"disabled",2),bt([u({type:Boolean,attribute:"include-search"})],pt.prototype,"includeSearch",2),bt([u({type:Boolean,attribute:"is-multi-select"})],pt.prototype,"isMultiSelect",2),bt([u({type:Boolean,attribute:"allow-user-input"})],pt.prototype,"allowUserInput",2),bt([u({type:Boolean,attribute:"max-is-reached"})],pt.prototype,"maxIsReached",2),bt([u({type:String,attribute:"custom-user-input"})],pt.prototype,"customUserInput",2),bt([u({type:String,attribute:"search-placeholder"})],pt.prototype,"searchPlaceholder",2),bt([u({type:String,attribute:"search-value"})],pt.prototype,"searchValue",2),bt([u({type:Number,attribute:"max-length"})],pt.prototype,"maxLength",2),bt([u({type:String,attribute:"user-message"})],pt.prototype,"userMessage",2),bt([ce()],pt.prototype,"_filteredOptions",2),pt=bt([ge("pkt-listbox")],pt);const xt={fromAttribute(s){return s==null?!1:s===""||s==="true"||s===!0?!0:s==="false"||s===!1?!1:!!s},toAttribute(s){return s?"true":"false"}},Rd={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Dt={props:Rd};var eh={},fo;function th(){return fo||(fo=1,(function(){(function(s){const e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,p=new WeakMap,g=new WeakMap,b=new WeakMap,f=new WeakMap,k=new WeakMap,v=new WeakMap,$=new WeakMap,M={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},S=(m,h)=>{for(let _ in M){h[_]=null;let C=null;const j=M[_];Object.defineProperty(h,_,{get(){return C},set(W){C=W,m.isConnected?N(m,j,W):g.set(m,h)}})}};function T(m){const h=i.get(m),{form:_}=h;Ue(m,_,h),ae(m,h.labels)}const L=(m,h=!1)=>{const _=document.createTreeWalker(m,NodeFilter.SHOW_ELEMENT,{acceptNode(W){return i.has(W)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let C=_.nextNode();const j=!h||m.disabled;for(;C;)C.formDisabledCallback&&j&&q(C,m.disabled),C=_.nextNode()},D={attributes:!0,attributeFilter:["disabled","name"]},Y=ne()?new MutationObserver(m=>{for(const h of m){const _=h.target;if(h.attributeName==="disabled"&&(_.constructor.formAssociated?q(_,_.hasAttribute("disabled")):_.localName==="fieldset"&&L(_)),h.attributeName==="name"&&_.constructor.formAssociated){const C=i.get(_),j=p.get(_);C.setFormValue(j)}}}):{};function ee(m){m.forEach(h=>{const{addedNodes:_,removedNodes:C}=h,j=Array.from(_),W=Array.from(C);j.forEach(de=>{var it;if(i.has(de)&&de.constructor.formAssociated&&T(de),g.has(de)){const Re=g.get(de);Object.keys(M).filter(Le=>Re[Le]!==null).forEach(Le=>{N(de,M[Le],Re[Le])}),g.delete(de)}if($.has(de)){const Re=$.get(de);N(de,"internals-valid",Re.validity.valid.toString()),N(de,"internals-invalid",(!Re.validity.valid).toString()),N(de,"aria-invalid",(!Re.validity.valid).toString()),$.delete(de)}if(de.localName==="form"){const Re=c.get(de),Le=document.createTreeWalker(de,NodeFilter.SHOW_ELEMENT,{acceptNode(Gt){return i.has(Gt)&&Gt.constructor.formAssociated&&!(Re&&Re.has(Gt))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let Kt=Le.nextNode();for(;Kt;)T(Kt),Kt=Le.nextNode()}de.localName==="fieldset"&&((it=Y.observe)===null||it===void 0||it.call(Y,de,D),L(de,!0))}),W.forEach(de=>{const it=i.get(de);it&&n.get(it)&&B(it),l.has(de)&&l.get(de).disconnect()})})}function oe(m){m.forEach(h=>{const{removedNodes:_}=h;_.forEach(C=>{const j=k.get(h.target);i.has(C)&&De(C),j.disconnect()})})}const ye=m=>{var h,_;const C=new MutationObserver(oe);!((h=window==null?void 0:window.ShadyDOM)===null||h===void 0)&&h.inUse&&m.mode&&m.host&&(m=m.host),(_=C.observe)===null||_===void 0||_.call(C,m,{childList:!0}),k.set(m,C)};ne()&&new MutationObserver(ee);const K={childList:!0,subtree:!0},N=(m,h,_)=>{m.getAttribute(h)!==_&&m.setAttribute(h,_)},q=(m,h)=>{m.toggleAttribute("internals-disabled",h),h?N(m,"aria-disabled","true"):m.removeAttribute("aria-disabled"),m.formDisabledCallback&&m.formDisabledCallback.apply(m,[h])},B=m=>{n.get(m).forEach(h=>{h.remove()}),n.set(m,[])},G=(m,h)=>{const _=document.createElement("input");return _.type="hidden",_.name=m.getAttribute("name"),m.after(_),n.get(h).push(_),_},le=(m,h)=>{var _;n.set(h,[]),(_=Y.observe)===null||_===void 0||_.call(Y,m,D)},ae=(m,h)=>{if(h.length){Array.from(h).forEach(C=>C.addEventListener("click",m.click.bind(m)));let _=h[0].id;h[0].id||(_=`${h[0].htmlFor}_Label`,h[0].id=_),N(m,"aria-labelledby",_)}},pe=m=>{const h=Array.from(m.elements).filter(W=>!W.tagName.includes("-")&&W.validity).map(W=>W.validity.valid),_=c.get(m)||[],C=Array.from(_).filter(W=>W.isConnected).map(W=>i.get(W).validity.valid),j=[...h,...C].includes(!1);m.toggleAttribute("internals-invalid",j),m.toggleAttribute("internals-valid",!j)},ue=m=>{pe(Q(m.target))},be=m=>{pe(Q(m.target))},se=m=>{const h=["button[type=submit]","input[type=submit]","button:not([type])"].map(_=>`${_}:not([disabled])`).map(_=>`${_}:not([form])${m.id?`,${_}[form='${m.id}']`:""}`).join(",");m.addEventListener("click",_=>{if(_.target.closest(h)){const C=c.get(m);if(m.noValidate)return;C.size&&Array.from(C).reverse().map(j=>i.get(j).reportValidity()).includes(!1)&&_.preventDefault()}})},re=m=>{const h=c.get(m.target);h&&h.size&&h.forEach(_=>{_.constructor.formAssociated&&_.formResetCallback&&_.formResetCallback.apply(_)})},Ue=(m,h,_)=>{if(h){const C=c.get(h);if(C)C.add(m);else{const j=new Set;j.add(m),c.set(h,j),se(h),h.addEventListener("reset",re),h.addEventListener("input",ue),h.addEventListener("change",be)}a.set(h,{ref:m,internals:_}),m.constructor.formAssociated&&m.formAssociatedCallback&&setTimeout(()=>{m.formAssociatedCallback.apply(m,[h])},0),pe(h)}},Q=m=>{let h=m.parentNode;return h&&h.tagName!=="FORM"&&(h=Q(h)),h},P=(m,h,_=DOMException)=>{if(!m.constructor.formAssociated)throw new _(h)},Me=(m,h,_)=>{const C=c.get(m);return C&&C.size&&C.forEach(j=>{i.get(j)[_]()||(h=!1)}),h},De=m=>{if(m.constructor.formAssociated){const h=i.get(m),{labels:_,form:C}=h;ae(m,_),Ue(m,C,h)}};function ne(){return typeof MutationObserver<"u"}class He{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const Pe=m=>(m.badInput=!1,m.customError=!1,m.patternMismatch=!1,m.rangeOverflow=!1,m.rangeUnderflow=!1,m.stepMismatch=!1,m.tooLong=!1,m.tooShort=!1,m.typeMismatch=!1,m.valid=!0,m.valueMissing=!1,m),$e=(m,h,_)=>(m.valid=Te(h),Object.keys(h).forEach(C=>m[C]=h[C]),_&&pe(_),m),Te=m=>{let h=!0;for(let _ in m)_!=="valid"&&m[_]!==!1&&(h=!1);return h},Ae=new WeakMap;function ze(m,h){m.toggleAttribute(h,!0),m.part&&m.part.add(h)}class We extends Set{static get isPolyfilled(){return!0}constructor(h){if(super(),!h||!h.tagName||h.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");Ae.set(this,h)}add(h){if(!/^--/.test(h)||typeof h!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${h} must start with '--'.`);const _=super.add(h),C=Ae.get(this),j=`state${h}`;return C.isConnected?ze(C,j):setTimeout(()=>{ze(C,j)}),_}clear(){for(let[h]of this.entries())this.delete(h);super.clear()}delete(h){const _=super.delete(h),C=Ae.get(this);return C.isConnected?(C.toggleAttribute(`state${h}`,!1),C.part&&C.part.remove(`state${h}`)):setTimeout(()=>{C.toggleAttribute(`state${h}`,!1),C.part&&C.part.remove(`state${h}`)}),_}}function ve(m,h,_,C){if(typeof h=="function"?m!==h||!C:!h.has(m))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?C:_==="a"?C.call(m):C?C.value:h.get(m)}function E(m,h,_,C,j){if(typeof h=="function"?m!==h||!0:!h.has(m))throw new TypeError("Cannot write private member to an object whose class did not declare it");return h.set(m,_),_}var Ie;class Ye{constructor(h){Ie.set(this,void 0),E(this,Ie,h);for(let _=0;_<h.length;_++){let C=h[_];this[_]=C,C.hasAttribute("name")&&(this[C.getAttribute("name")]=C)}Object.freeze(this)}get length(){return ve(this,Ie,"f").length}[(Ie=new WeakMap,Symbol.iterator)](){return ve(this,Ie,"f")[Symbol.iterator]()}item(h){return this[h]==null?null:this[h]}namedItem(h){return this[h]==null?null:this[h]}}function U(){const m=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=_;const h=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=C;function _(...W){let de=m.apply(this,W);return Me(this,de,"checkValidity")}function C(...W){let de=h.apply(this,W);return Me(this,de,"reportValidity")}const{get:j}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...W){const de=j.call(this,...W),it=Array.from(c.get(this)||[]);if(it.length===0)return de;const Re=Array.from(de).concat(it).sort((Le,Kt)=>Le.compareDocumentPosition?Le.compareDocumentPosition(Kt)&2?1:-1:0);return new Ye(Re)}})}class V{static get isPolyfilled(){return!0}constructor(h){if(!h||!h.tagName||h.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const _=h.getRootNode(),C=new He;this.states=new We(h),e.set(this,h),t.set(this,C),i.set(h,this),S(h,this),le(h,this),Object.seal(this),_ instanceof DocumentFragment&&ye(_)}checkValidity(){const h=e.get(this);if(P(h,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=t.get(this);if(!_.valid){const C=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});h.dispatchEvent(C)}return _.valid}get form(){const h=e.get(this);P(h,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let _;return h.constructor.formAssociated===!0&&(_=Q(h)),_}get labels(){const h=e.get(this);P(h,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const _=h.getAttribute("id"),C=h.getRootNode();return C&&_?C.querySelectorAll(`[for="${_}"]`):[]}reportValidity(){const h=e.get(this);if(P(h,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=this.checkValidity(),C=f.get(this);if(C&&!h.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!_&&C&&(h.focus(),C.focus()),_}setFormValue(h){const _=e.get(this);if(P(_,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),B(this),h!=null&&!(h instanceof FormData)){if(_.getAttribute("name")){const C=G(_,this);C.value=h}}else h!=null&&h instanceof FormData&&Array.from(h).reverse().forEach(([C,j])=>{if(typeof j=="string"){const W=G(_,this);W.name=C,W.value=j}});p.set(_,h)}setValidity(h,_,C){const j=e.get(this);if(P(j,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!h)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");f.set(this,C);const W=t.get(this),de={};for(const Le in h)de[Le]=h[Le];Object.keys(de).length===0&&Pe(W);const it=Object.assign(Object.assign({},W),de);delete it.valid;const{valid:Re}=$e(W,it,this.form);if(!Re&&!_)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,Re?"":_),j.isConnected?(j.toggleAttribute("internals-invalid",!Re),j.toggleAttribute("internals-valid",Re),N(j,"aria-invalid",`${!Re}`)):$.set(j,this)}get shadowRoot(){const h=e.get(this);return b.get(h)||null}get validationMessage(){const h=e.get(this);return P(h,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const h=e.get(this);return P(h,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),t.get(this)}get willValidate(){const h=e.get(this);return P(h,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(h.disabled||h.hasAttribute("disabled")||h.hasAttribute("readonly"))}}function te(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class m extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const h=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(h,m);const _=new m;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(C=>C in _.internals)}let me=!1,fe=!1;function Xe(m){fe||(fe=!0,window.CustomStateSet=We,m&&(HTMLElement.prototype.attachInternals=function(...h){const _=m.call(this,h);return _.states=new We(this),_}))}function Ke(m=!0){if(!me){if(me=!0,typeof window<"u"&&(window.ElementInternals=V),typeof CustomElementRegistry<"u"){const h=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(_,C,j){if(C.formAssociated){const W=C.prototype.connectedCallback;C.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute("disabled")&&q(this,!0)),W!=null&&W.apply(this),De(this)}}h.call(this,_,C,j)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(i.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new V(this)}),typeof Element<"u"){let h=function(...C){const j=_.apply(this,C);if(b.set(this,j),ne()){const W=new MutationObserver(ee);window.ShadyDOM?W.observe(this,K):W.observe(j,K),l.set(this,W)}return j};const _=Element.prototype.attachShadow;Element.prototype.attachShadow=h}ne()&&typeof document<"u"&&new MutationObserver(ee).observe(document.documentElement,K),typeof HTMLFormElement<"u"&&U(),(m||typeof window<"u"&&!window.CustomStateSet)&&Xe()}}return customElements.polyfillWrapFlushCallback||(te()?typeof window<"u"&&!window.CustomStateSet&&Xe(HTMLElement.prototype.attachInternals):Ke(!1)),s.forceCustomStateSetPolyfill=Xe,s.forceElementInternalsPolyfill=Ke,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})()),eh}th();var sh=Object.defineProperty,he=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&sh(e,t,i),i};const go="on",_r="--checked",Oi=",";let ie=class extends Oe{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=ws(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.label=null,this.optionalText=$t.forms.labels.optional,this.requiredText=$t.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(e){var t,n,i,r,a,l,c,p,g,b,f;if(!e){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,e):(t=e.validity)!=null&&t.typeMismatch||(n=e.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,e):(i=e.validity)!=null&&i.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,e):(r=e.validity)!=null&&r.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,e):(a=e.validity)!=null&&a.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,e):(l=e.validity)!=null&&l.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?$t.forms.messages.rangeUnderflowMin.replace("{min}",(c=this.min)==null?void 0:c.toString()):$t.forms.messages.rangeUnderflow,e):(p=e.validity)!=null&&p.stepMismatch?this.internals.setValidity({stepMismatch:!0},$t.forms.messages.invalid,e):(g=e.validity)!=null&&g.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?$t.forms.messages.rangeOverflowMax.replace("{max}",(b=this.max)==null?void 0:b.toString()):$t.forms.messages.rangeOverflow,e):(f=e.validity)!=null&&f.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){const t=new FormData;e.forEach(n=>{t.append(this.name,n)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(t=>{var n;if(t!==this&&t.getAttribute("name")===this.name&&t.getAttribute("value")!==this.value){const i=t;i.checked&&(i.checked=!1,i.internals&&(i.internals.setFormValue(null),(n=i.internals.states)==null||n.delete(_r)))}})}valueChecked(e){if(!this.touched)return;const t=this.internals.form||this.closest("form"),n=t?new FormData(t):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof e=="string"?(this.checked=e==="true",this.internals.ariaChecked=String(e==="true")):typeof e=="boolean"&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){const i=(typeof this.value=="string"?this.value:"")||go;this.internals.setFormValue(i),n&&n.append(this.name,i),this.internals.states.add(_r)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(_r);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e=="string"?((this.multiple||this.range)&&e.includes(Oi)&&(e=e.split(Oi)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(t==null?void 0:t.toString())&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){const e=this.multiple||this.range?[]:"";this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e=="string"&&e.includes(Oi)?e.split(Oi):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||"":e}validate(){var e,t;(e=this.inputRef)!=null&&e.value&&this.manageValidity(this.inputRef.value),(t=this.inputRefTo)!=null&&t.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e);return}if(typeof e!="string"&&!Array.isArray(e))return;const t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){var e;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{"selected"in t&&(t.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(e=this.inputRef)!=null&&e.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const t=this.defaultValue||(this.multiple||this.range?[]:"");this.value=t,this._value=Array.isArray(t)?t:[t],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(e){super.updated(e),e.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(e){if(super.firstUpdated(e),!this.form){const t=this.internals.form||this.closest("form");this.form=t}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const t=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(t);const n=t?(typeof this.value=="string"?this.value:"")||go:null;this.internals.setFormValue(n)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};he([u({type:Boolean,reflect:!0})],ie.prototype,"checked"),he([u({type:Boolean})],ie.prototype,"defaultChecked"),he([u({type:Boolean})],ie.prototype,"multiple"),he([u({type:Boolean})],ie.prototype,"range"),he([u({type:String,reflect:!0})],ie.prototype,"type"),he([u()],ie.prototype,"defaultValue"),he([u({type:Boolean,reflect:!0})],ie.prototype,"disabled"),he([u({type:Boolean,reflect:!0})],ie.prototype,"readonly"),he([u({type:Boolean,reflect:!0})],ie.prototype,"required"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"max"),he([u({type:Number,reflect:!0})],ie.prototype,"maxlength"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"min"),he([u({type:Number,reflect:!0})],ie.prototype,"minlength"),he([u({type:Number,reflect:!0})],ie.prototype,"step"),he([u({type:String})],ie.prototype,"ariaDescribedBy"),he([u({type:String})],ie.prototype,"ariaLabelledby"),he([u({type:String,reflect:!0})],ie.prototype,"name"),he([u({type:String,reflect:!0})],ie.prototype,"pattern"),he([u({type:String,reflect:!0})],ie.prototype,"placeholder"),he([u({type:String,reflect:!0})],ie.prototype,"id"),he([u({type:Boolean})],ie.prototype,"counter"),he([u({type:Boolean})],ie.prototype,"hasError"),he([u({type:Boolean})],ie.prototype,"inline"),he([u({type:Boolean})],ie.prototype,"hasFieldset"),he([u({type:Boolean})],ie.prototype,"optionalTag"),he([u({type:Boolean})],ie.prototype,"requiredTag"),he([u({type:Boolean})],ie.prototype,"skipForwardTestid"),he([u({type:Boolean,reflect:!0,converter:xt})],ie.prototype,"useWrapper"),he([u({type:Boolean,reflect:!0})],ie.prototype,"fullwidth"),he([u({type:Number})],ie.prototype,"counterMaxLength"),he([u({type:String})],ie.prototype,"errorMessage"),he([u({type:String})],ie.prototype,"helptext"),he([u({type:String})],ie.prototype,"helptextDropdown"),he([u({type:String,reflect:!1})],ie.prototype,"helptextDropdownButton"),he([u({type:String})],ie.prototype,"label"),he([u({type:String,reflect:!1})],ie.prototype,"optionalText"),he([u({type:String,reflect:!1})],ie.prototype,"requiredText"),he([u({type:String,reflect:!1})],ie.prototype,"tagText"),he([u({type:String,attribute:"data-testid"})],ie.prototype,"dataTestid");let mo=class{constructor(e){this.nodes=[],this.options=[],this.generation=0,this.host=e,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(t=>this.handleMutations(t))}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{(e.nodeName==="OPTION"||e.nodeName==="DATA")&&this.addNode(e)}),this.createOptions(),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(e){(e.nodeName==="OPTION"||e.nodeName==="DATA")&&(e.hasAttribute("hidden")&&!e.hasAttribute("data-skip")&&e.setAttribute("data-hidden","true"),!e.hasAttribute("hidden")&&e.hasAttribute("data-skip")&&e.hasAttribute("data-hidden")&&e.removeAttribute("data-hidden"),e.setAttribute("class","pkt-hide"),e.setAttribute("data-skip","true"),e.setAttribute("hidden","true"),this.nodes.push(e))}createOptions(){this.options=this.nodes.map(e=>({value:e.hasAttribute("value")?e.getAttribute("value")??"":e.textContent??"",label:e.textContent||e.getAttribute("value")||"",selected:e.hasAttribute("selected"),disabled:e.hasAttribute("disabled"),hidden:e.hasAttribute("data-hidden")})),this.generation++,this.host.requestUpdate()}handleMutations(e){let t=!1;e.forEach(n=>{n.type==="childList"&&(n.addedNodes.forEach(i=>{rn(i)&&(this.addNode(i),t=!0)}),n.removedNodes.forEach(i=>{rn(i)&&(this.nodes=this.nodes.filter(r=>r!==i),t=!0)})),n.type==="attributes"&&rn(n.target)&&(this.addNode(n.target),t=!0)}),t&&this.createOptions()}};var nh=Object.defineProperty,ih=Object.getOwnPropertyDescriptor,Us=(s,e,t,n)=>{for(var i=n>1?void 0:n?ih(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&nh(e,t,i),i};let us=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.forId=ws(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.filledSlots=new Set,this.slotController=new Qe(this,this.defaultSlot)}updateSlots(e){this.filledSlots=new Set(e)}render(){const e=()=>{const i=!this.isHelpTextOpen;this.isHelpTextOpen=i,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:i}}))},t=z({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.filledSlots.size>0}),n=()=>this.helptextDropdown?y`<div class="pkt-inputwrapper__helptext-expandable">
512
+ `:x}handleSearchInput(e){this.searchValue=e.target.value,this.dispatchEvent(new CustomEvent("search",{detail:this.searchValue,bubbles:!1}))}handleSearchKeydown(e){switch(e.key){case"Enter":e.preventDefault();break;case"ArrowUp":case"Escape":this.closeOptions(),e.preventDefault();break;case"ArrowDown":this.focusFirstOrSelectedOption();break;case"Tab":this.tabClose();break}}handleOptionKeydown(e){const t=e.currentTarget,n=t.dataset.value,i=t.dataset.type,r=t.dataset.selected==="true";if(!(!Yn(this).length&&(!this.customUserInput||!this.allowUserInput&&this.customUserInput)&&i!=="new-option"&&i!=="searchbox"))switch(e.key){case" ":case"Enter":this.toggleOption(t),e.preventDefault();break;case"Backspace":n&&(r?this.toggleOption(t):this.closeOptions()),e.preventDefault();break;case"Escape":this.closeOptions(),e.preventDefault();break;case"Tab":this.tabClose();break;case"ArrowDown":e.altKey?po(this):i==="searchbox"||i==="new-option"?yr(this):Gd(t),e.preventDefault();break;case"ArrowUp":if(e.altKey)yr(this);else if(t.dataset.index==="0"&&this.includeSearch){const a=this.querySelector('[role="searchbox"]');a&&a.focus()}else if(t.dataset.index==="0"&&this.customUserInput){const a=this.querySelector('[data-type="new-option"]');a&&a.focus()}else Xd(t,this,this.includeSearch);e.preventDefault();break;case"Home":yr(this),e.preventDefault();break;case"End":po(this),e.preventDefault();break;default:(e.metaKey||e.ctrlKey)&&e.key==="a"&&(this.selectAll(),e.preventDefault()),zd(e.key)&&(this.handleTypeAhead(e.key),e.preventDefault());break}}focusFirstOrSelectedOption(){Qd(this,{disabled:this.disabled,allowUserInput:this.allowUserInput,customUserInput:this.customUserInput,includeSearch:this.includeSearch})}toggleOption(e){const t=e instanceof HTMLElement?e.dataset.disabled:e.disabled;if(this.disabled||t)return;const n=e instanceof HTMLElement?e.dataset.value:e.value;this.dispatchEvent(new CustomEvent("option-toggle",{detail:n,bubbles:!1}))}selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!1}))}closeOptions(){this.dispatchEvent(new CustomEvent("close-options",{bubbles:!1}))}tabClose(){this.dispatchEvent(new CustomEvent("tab-close",{bubbles:!1}))}filterOptions(){this._filteredOptions=jd(this.options,this.searchValue)}handleTypeAhead(e){const t=this.typeahead.append(e),n=Yn(this),i=Kd(n,t);i>=0&&cs(n[i])}};bt([u({type:String})],pt.prototype,"id",2),bt([u({type:String})],pt.prototype,"label",2),bt([u({type:Array})],pt.prototype,"options",2),bt([u({type:Boolean,reflect:!0,attribute:"is-open"})],pt.prototype,"isOpen",2),bt([u({type:Boolean})],pt.prototype,"disabled",2),bt([u({type:Boolean,attribute:"include-search"})],pt.prototype,"includeSearch",2),bt([u({type:Boolean,attribute:"is-multi-select"})],pt.prototype,"isMultiSelect",2),bt([u({type:Boolean,attribute:"allow-user-input"})],pt.prototype,"allowUserInput",2),bt([u({type:Boolean,attribute:"max-is-reached"})],pt.prototype,"maxIsReached",2),bt([u({type:String,attribute:"custom-user-input"})],pt.prototype,"customUserInput",2),bt([u({type:String,attribute:"search-placeholder"})],pt.prototype,"searchPlaceholder",2),bt([u({type:String,attribute:"search-value"})],pt.prototype,"searchValue",2),bt([u({type:Number,attribute:"max-length"})],pt.prototype,"maxLength",2),bt([u({type:String,attribute:"user-message"})],pt.prototype,"userMessage",2),bt([ce()],pt.prototype,"_filteredOptions",2),pt=bt([ge("pkt-listbox")],pt);const xt={fromAttribute(s){return s==null?!1:s===""||s==="true"||s===!0?!0:s==="false"||s===!1?!1:!!s},toAttribute(s){return s?"true":"false"}},Rd={helptextDropdownButton:{default:"Les mer <span class='pkt-sr-only'>om feltet</span>"},counter:{default:!1},optionalTag:{default:!1},optionalText:{default:"Valgfritt"},requiredTag:{default:!1},requiredText:{default:"Må fylles ut"},hasError:{default:!1},disabled:{default:!1},inline:{default:!1},hasFieldset:{default:!1},useWrapper:{default:!0}},Dt={props:Rd};var eh={},fo;function th(){return fo||(fo=1,(function(){(function(s){const e=new WeakMap,t=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,a=new WeakMap,l=new WeakMap,c=new WeakMap,p=new WeakMap,g=new WeakMap,b=new WeakMap,f=new WeakMap,k=new WeakMap,v=new WeakMap,$=new WeakMap,M={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},S=(m,h)=>{for(let _ in M){h[_]=null;let C=null;const j=M[_];Object.defineProperty(h,_,{get(){return C},set(W){C=W,m.isConnected?N(m,j,W):g.set(m,h)}})}};function T(m){const h=i.get(m),{form:_}=h;je(m,_,h),ae(m,h.labels)}const L=(m,h=!1)=>{const _=document.createTreeWalker(m,NodeFilter.SHOW_ELEMENT,{acceptNode(W){return i.has(W)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let C=_.nextNode();const j=!h||m.disabled;for(;C;)C.formDisabledCallback&&j&&q(C,m.disabled),C=_.nextNode()},D={attributes:!0,attributeFilter:["disabled","name"]},Y=te()?new MutationObserver(m=>{for(const h of m){const _=h.target;if(h.attributeName==="disabled"&&(_.constructor.formAssociated?q(_,_.hasAttribute("disabled")):_.localName==="fieldset"&&L(_)),h.attributeName==="name"&&_.constructor.formAssociated){const C=i.get(_),j=p.get(_);C.setFormValue(j)}}}):{};function ee(m){m.forEach(h=>{const{addedNodes:_,removedNodes:C}=h,j=Array.from(_),W=Array.from(C);j.forEach(de=>{var it;if(i.has(de)&&de.constructor.formAssociated&&T(de),g.has(de)){const Re=g.get(de);Object.keys(M).filter(Fe=>Re[Fe]!==null).forEach(Fe=>{N(de,M[Fe],Re[Fe])}),g.delete(de)}if($.has(de)){const Re=$.get(de);N(de,"internals-valid",Re.validity.valid.toString()),N(de,"internals-invalid",(!Re.validity.valid).toString()),N(de,"aria-invalid",(!Re.validity.valid).toString()),$.delete(de)}if(de.localName==="form"){const Re=c.get(de),Fe=document.createTreeWalker(de,NodeFilter.SHOW_ELEMENT,{acceptNode(Gt){return i.has(Gt)&&Gt.constructor.formAssociated&&!(Re&&Re.has(Gt))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let Kt=Fe.nextNode();for(;Kt;)T(Kt),Kt=Fe.nextNode()}de.localName==="fieldset"&&((it=Y.observe)===null||it===void 0||it.call(Y,de,D),L(de,!0))}),W.forEach(de=>{const it=i.get(de);it&&n.get(it)&&B(it),l.has(de)&&l.get(de).disconnect()})})}function oe(m){m.forEach(h=>{const{removedNodes:_}=h;_.forEach(C=>{const j=k.get(h.target);i.has(C)&&De(C),j.disconnect()})})}const ye=m=>{var h,_;const C=new MutationObserver(oe);!((h=window==null?void 0:window.ShadyDOM)===null||h===void 0)&&h.inUse&&m.mode&&m.host&&(m=m.host),(_=C.observe)===null||_===void 0||_.call(C,m,{childList:!0}),k.set(m,C)};te()&&new MutationObserver(ee);const K={childList:!0,subtree:!0},N=(m,h,_)=>{m.getAttribute(h)!==_&&m.setAttribute(h,_)},q=(m,h)=>{m.toggleAttribute("internals-disabled",h),h?N(m,"aria-disabled","true"):m.removeAttribute("aria-disabled"),m.formDisabledCallback&&m.formDisabledCallback.apply(m,[h])},B=m=>{n.get(m).forEach(h=>{h.remove()}),n.set(m,[])},Z=(m,h)=>{const _=document.createElement("input");return _.type="hidden",_.name=m.getAttribute("name"),m.after(_),n.get(h).push(_),_},le=(m,h)=>{var _;n.set(h,[]),(_=Y.observe)===null||_===void 0||_.call(Y,m,D)},ae=(m,h)=>{if(h.length){Array.from(h).forEach(C=>C.addEventListener("click",m.click.bind(m)));let _=h[0].id;h[0].id||(_=`${h[0].htmlFor}_Label`,h[0].id=_),N(m,"aria-labelledby",_)}},pe=m=>{const h=Array.from(m.elements).filter(W=>!W.tagName.includes("-")&&W.validity).map(W=>W.validity.valid),_=c.get(m)||[],C=Array.from(_).filter(W=>W.isConnected).map(W=>i.get(W).validity.valid),j=[...h,...C].includes(!1);m.toggleAttribute("internals-invalid",j),m.toggleAttribute("internals-valid",!j)},ue=m=>{pe(X(m.target))},be=m=>{pe(X(m.target))},ne=m=>{const h=["button[type=submit]","input[type=submit]","button:not([type])"].map(_=>`${_}:not([disabled])`).map(_=>`${_}:not([form])${m.id?`,${_}[form='${m.id}']`:""}`).join(",");m.addEventListener("click",_=>{if(_.target.closest(h)){const C=c.get(m);if(m.noValidate)return;C.size&&Array.from(C).reverse().map(j=>i.get(j).reportValidity()).includes(!1)&&_.preventDefault()}})},re=m=>{const h=c.get(m.target);h&&h.size&&h.forEach(_=>{_.constructor.formAssociated&&_.formResetCallback&&_.formResetCallback.apply(_)})},je=(m,h,_)=>{if(h){const C=c.get(h);if(C)C.add(m);else{const j=new Set;j.add(m),c.set(h,j),ne(h),h.addEventListener("reset",re),h.addEventListener("input",ue),h.addEventListener("change",be)}a.set(h,{ref:m,internals:_}),m.constructor.formAssociated&&m.formAssociatedCallback&&setTimeout(()=>{m.formAssociatedCallback.apply(m,[h])},0),pe(h)}},X=m=>{let h=m.parentNode;return h&&h.tagName!=="FORM"&&(h=X(h)),h},P=(m,h,_=DOMException)=>{if(!m.constructor.formAssociated)throw new _(h)},Me=(m,h,_)=>{const C=c.get(m);return C&&C.size&&C.forEach(j=>{i.get(j)[_]()||(h=!1)}),h},De=m=>{if(m.constructor.formAssociated){const h=i.get(m),{labels:_,form:C}=h;ae(m,_),je(m,C,h)}};function te(){return typeof MutationObserver<"u"}class Le{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const Pe=m=>(m.badInput=!1,m.customError=!1,m.patternMismatch=!1,m.rangeOverflow=!1,m.rangeUnderflow=!1,m.stepMismatch=!1,m.tooLong=!1,m.tooShort=!1,m.typeMismatch=!1,m.valid=!0,m.valueMissing=!1,m),$e=(m,h,_)=>(m.valid=Te(h),Object.keys(h).forEach(C=>m[C]=h[C]),_&&pe(_),m),Te=m=>{let h=!0;for(let _ in m)_!=="valid"&&m[_]!==!1&&(h=!1);return h},Ae=new WeakMap;function qe(m,h){m.toggleAttribute(h,!0),m.part&&m.part.add(h)}class Ie extends Set{static get isPolyfilled(){return!0}constructor(h){if(super(),!h||!h.tagName||h.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");Ae.set(this,h)}add(h){if(!/^--/.test(h)||typeof h!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${h} must start with '--'.`);const _=super.add(h),C=Ae.get(this),j=`state${h}`;return C.isConnected?qe(C,j):setTimeout(()=>{qe(C,j)}),_}clear(){for(let[h]of this.entries())this.delete(h);super.clear()}delete(h){const _=super.delete(h),C=Ae.get(this);return C.isConnected?(C.toggleAttribute(`state${h}`,!1),C.part&&C.part.remove(`state${h}`)):setTimeout(()=>{C.toggleAttribute(`state${h}`,!1),C.part&&C.part.remove(`state${h}`)}),_}}function ve(m,h,_,C){if(typeof h=="function"?m!==h||!C:!h.has(m))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?C:_==="a"?C.call(m):C?C.value:h.get(m)}function E(m,h,_,C,j){if(typeof h=="function"?m!==h||!0:!h.has(m))throw new TypeError("Cannot write private member to an object whose class did not declare it");return h.set(m,_),_}var Be;class Ye{constructor(h){Be.set(this,void 0),E(this,Be,h);for(let _=0;_<h.length;_++){let C=h[_];this[_]=C,C.hasAttribute("name")&&(this[C.getAttribute("name")]=C)}Object.freeze(this)}get length(){return ve(this,Be,"f").length}[(Be=new WeakMap,Symbol.iterator)](){return ve(this,Be,"f")[Symbol.iterator]()}item(h){return this[h]==null?null:this[h]}namedItem(h){return this[h]==null?null:this[h]}}function U(){const m=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=_;const h=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=C;function _(...W){let de=m.apply(this,W);return Me(this,de,"checkValidity")}function C(...W){let de=h.apply(this,W);return Me(this,de,"reportValidity")}const{get:j}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...W){const de=j.call(this,...W),it=Array.from(c.get(this)||[]);if(it.length===0)return de;const Re=Array.from(de).concat(it).sort((Fe,Kt)=>Fe.compareDocumentPosition?Fe.compareDocumentPosition(Kt)&2?1:-1:0);return new Ye(Re)}})}class V{static get isPolyfilled(){return!0}constructor(h){if(!h||!h.tagName||h.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const _=h.getRootNode(),C=new Le;this.states=new Ie(h),e.set(this,h),t.set(this,C),i.set(h,this),S(h,this),le(h,this),Object.seal(this),_ instanceof DocumentFragment&&ye(_)}checkValidity(){const h=e.get(this);if(P(h,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=t.get(this);if(!_.valid){const C=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});h.dispatchEvent(C)}return _.valid}get form(){const h=e.get(this);P(h,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let _;return h.constructor.formAssociated===!0&&(_=X(h)),_}get labels(){const h=e.get(this);P(h,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const _=h.getAttribute("id"),C=h.getRootNode();return C&&_?C.querySelectorAll(`[for="${_}"]`):[]}reportValidity(){const h=e.get(this);if(P(h,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const _=this.checkValidity(),C=f.get(this);if(C&&!h.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!_&&C&&(h.focus(),C.focus()),_}setFormValue(h){const _=e.get(this);if(P(_,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),B(this),h!=null&&!(h instanceof FormData)){if(_.getAttribute("name")){const C=Z(_,this);C.value=h}}else h!=null&&h instanceof FormData&&Array.from(h).reverse().forEach(([C,j])=>{if(typeof j=="string"){const W=Z(_,this);W.name=C,W.value=j}});p.set(_,h)}setValidity(h,_,C){const j=e.get(this);if(P(j,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!h)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");f.set(this,C);const W=t.get(this),de={};for(const Fe in h)de[Fe]=h[Fe];Object.keys(de).length===0&&Pe(W);const it=Object.assign(Object.assign({},W),de);delete it.valid;const{valid:Re}=$e(W,it,this.form);if(!Re&&!_)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");r.set(this,Re?"":_),j.isConnected?(j.toggleAttribute("internals-invalid",!Re),j.toggleAttribute("internals-valid",Re),N(j,"aria-invalid",`${!Re}`)):$.set(j,this)}get shadowRoot(){const h=e.get(this);return b.get(h)||null}get validationMessage(){const h=e.get(this);return P(h,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),r.get(this)}get validity(){const h=e.get(this);return P(h,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),t.get(this)}get willValidate(){const h=e.get(this);return P(h,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(h.disabled||h.hasAttribute("disabled")||h.hasAttribute("readonly"))}}function se(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class m extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const h=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(h,m);const _=new m;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(C=>C in _.internals)}let me=!1,fe=!1;function Xe(m){fe||(fe=!0,window.CustomStateSet=Ie,m&&(HTMLElement.prototype.attachInternals=function(...h){const _=m.call(this,h);return _.states=new Ie(this),_}))}function Ke(m=!0){if(!me){if(me=!0,typeof window<"u"&&(window.ElementInternals=V),typeof CustomElementRegistry<"u"){const h=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(_,C,j){if(C.formAssociated){const W=C.prototype.connectedCallback;C.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute("disabled")&&q(this,!0)),W!=null&&W.apply(this),De(this)}}h.call(this,_,C,j)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(i.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new V(this)}),typeof Element<"u"){let h=function(...C){const j=_.apply(this,C);if(b.set(this,j),te()){const W=new MutationObserver(ee);window.ShadyDOM?W.observe(this,K):W.observe(j,K),l.set(this,W)}return j};const _=Element.prototype.attachShadow;Element.prototype.attachShadow=h}te()&&typeof document<"u"&&new MutationObserver(ee).observe(document.documentElement,K),typeof HTMLFormElement<"u"&&U(),(m||typeof window<"u"&&!window.CustomStateSet)&&Xe()}}return customElements.polyfillWrapFlushCallback||(se()?typeof window<"u"&&!window.CustomStateSet&&Xe(HTMLElement.prototype.attachInternals):Ke(!1)),s.forceCustomStateSetPolyfill=Xe,s.forceElementInternalsPolyfill=Ke,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})()),eh}th();var sh=Object.defineProperty,he=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&sh(e,t,i),i};const go="on",_r="--checked",Oi=",";let ie=class extends Oe{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=ws(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.label=null,this.optionalText=$t.forms.labels.optional,this.requiredText=$t.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(e){var t,n,i,r,a,l,c,p,g,b,f;if(!e){console.warn("manageValidity called without valid input element");return}this.required&&!this.value?this.internals.setValidity({valueMissing:!0},$t.forms.messages.required,e):(t=e.validity)!=null&&t.typeMismatch||(n=e.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},$t.forms.messages.invalid,e):(i=e.validity)!=null&&i.patternMismatch?this.internals.setValidity({patternMismatch:!0},$t.forms.messages.invalidPattern,e):(r=e.validity)!=null&&r.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},$t.forms.messages.tooShort,e):(a=e.validity)!=null&&a.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},$t.forms.messages.tooLong,e):(l=e.validity)!=null&&l.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?$t.forms.messages.rangeUnderflowMin.replace("{min}",(c=this.min)==null?void 0:c.toString()):$t.forms.messages.rangeUnderflow,e):(p=e.validity)!=null&&p.stepMismatch?this.internals.setValidity({stepMismatch:!0},$t.forms.messages.invalid,e):(g=e.validity)!=null&&g.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?$t.forms.messages.rangeOverflowMax.replace("{max}",(b=this.max)==null?void 0:b.toString()):$t.forms.messages.rangeOverflow,e):(f=e.validity)!=null&&f.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals)if(Array.isArray(e)){const t=new FormData;e.forEach(n=>{t.append(this.name,n)}),this.internals.setFormValue(t)}else this.internals.setFormValue(e)}coordinateRadioGroup(){if(!this.form||!this.name||this.type!=="radio")return;const e=`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`;this.form.querySelectorAll(e).forEach(t=>{var n;if(t!==this&&t.getAttribute("name")===this.name&&t.getAttribute("value")!==this.value){const i=t;i.checked&&(i.checked=!1,i.internals&&(i.internals.setFormValue(null),(n=i.internals.states)==null||n.delete(_r)))}})}valueChecked(e){if(!this.touched)return;const t=this.internals.form||this.closest("form"),n=t?new FormData(t):null;if(this.type==="radio"&&this.coordinateRadioGroup(),typeof e=="string"?(this.checked=e==="true",this.internals.ariaChecked=String(e==="true")):typeof e=="boolean"&&(this.checked=e,this.internals.ariaChecked=String(e)),this.checked){const i=(typeof this.value=="string"?this.value:"")||go;this.internals.setFormValue(i),n&&n.append(this.name,i),this.internals.states.add(_r)}else this.internals.setFormValue(null),n&&n.delete(this.name),this.internals.states.delete(_r);this.dispatchChangeEvents(this.checked),this.internals.reportValidity()}valueChanged(e,t){(t!==this.value||t!==this._value)&&(typeof e=="string"?((this.multiple||this.range)&&e.includes(Oi)&&(e=e.split(Oi)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(t==null?void 0:t.toString())&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){const e=this.multiple||this.range?[]:"";this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e=="string"&&e.includes(Oi)?e.split(Oi):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||"":e}validate(){var e,t;(e=this.inputRef)!=null&&e.value&&this.manageValidity(this.inputRef.value),(t=this.inputRefTo)!=null&&t.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(!this.touched){this.touched=!0,e&&this.setFormValue(e);return}if(typeof e!="string"&&!Array.isArray(e))return;const t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this.dispatchChangeEvents(t)}formResetCallback(){var e;if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(t=>{"selected"in t&&(t.selected=!1)}),this.checked!==void 0)this.checked=!1,this.internals.ariaChecked="false",this.internals.setFormValue(""),(e=this.inputRef)!=null&&e.value&&"checked"in this.inputRef.value&&(this.inputRef.value.checked=!1),this.valueChecked(this.checked);else{this.internals.setFormValue("");const t=this.defaultValue||(this.multiple||this.range?[]:"");this.value=t,this._value=Array.isArray(t)?t:[t],this.valueChanged(this.value,null)}this.internals.ariaInvalid="false"}updated(e){super.updated(e),e.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(e){if(super.firstUpdated(e),!this.form){const t=this.internals.form||this.closest("form");this.form=t}if(this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked="true",this.checked=!0),this.required&&(this.internals.ariaRequired="true"),this.disabled&&(this.internals.ariaDisabled="true"),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const t=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=String(t);const n=t?(typeof this.value=="string"?this.value:"")||go:null;this.internals.setFormValue(n)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}};he([u({type:Boolean,reflect:!0})],ie.prototype,"checked"),he([u({type:Boolean})],ie.prototype,"defaultChecked"),he([u({type:Boolean})],ie.prototype,"multiple"),he([u({type:Boolean})],ie.prototype,"range"),he([u({type:String,reflect:!0})],ie.prototype,"type"),he([u()],ie.prototype,"defaultValue"),he([u({type:Boolean,reflect:!0})],ie.prototype,"disabled"),he([u({type:Boolean,reflect:!0})],ie.prototype,"readonly"),he([u({type:Boolean,reflect:!0})],ie.prototype,"required"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"max"),he([u({type:Number,reflect:!0})],ie.prototype,"maxlength"),he([u({reflect:!0,converter:{fromAttribute:s=>s,toAttribute:s=>(s==null?void 0:s.toString())??null}})],ie.prototype,"min"),he([u({type:Number,reflect:!0})],ie.prototype,"minlength"),he([u({type:Number,reflect:!0})],ie.prototype,"step"),he([u({type:String})],ie.prototype,"ariaDescribedBy"),he([u({type:String})],ie.prototype,"ariaLabelledby"),he([u({type:String,reflect:!0})],ie.prototype,"name"),he([u({type:String,reflect:!0})],ie.prototype,"pattern"),he([u({type:String,reflect:!0})],ie.prototype,"placeholder"),he([u({type:String,reflect:!0})],ie.prototype,"id"),he([u({type:Boolean})],ie.prototype,"counter"),he([u({type:Boolean})],ie.prototype,"hasError"),he([u({type:Boolean})],ie.prototype,"inline"),he([u({type:Boolean})],ie.prototype,"hasFieldset"),he([u({type:Boolean})],ie.prototype,"optionalTag"),he([u({type:Boolean})],ie.prototype,"requiredTag"),he([u({type:Boolean})],ie.prototype,"skipForwardTestid"),he([u({type:Boolean,reflect:!0,converter:xt})],ie.prototype,"useWrapper"),he([u({type:Boolean,reflect:!0})],ie.prototype,"fullwidth"),he([u({type:Number})],ie.prototype,"counterMaxLength"),he([u({type:String})],ie.prototype,"errorMessage"),he([u({type:String})],ie.prototype,"helptext"),he([u({type:String})],ie.prototype,"helptextDropdown"),he([u({type:String,reflect:!1})],ie.prototype,"helptextDropdownButton"),he([u({type:String})],ie.prototype,"label"),he([u({type:String,reflect:!1})],ie.prototype,"optionalText"),he([u({type:String,reflect:!1})],ie.prototype,"requiredText"),he([u({type:String,reflect:!1})],ie.prototype,"tagText"),he([u({type:String,attribute:"data-testid"})],ie.prototype,"dataTestid");let mo=class{constructor(e){this.nodes=[],this.options=[],this.generation=0,this.host=e,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(t=>this.handleMutations(t))}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{(e.nodeName==="OPTION"||e.nodeName==="DATA")&&this.addNode(e)}),this.createOptions(),this.observer.observe(this.host,{childList:!0,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(e){(e.nodeName==="OPTION"||e.nodeName==="DATA")&&(e.hasAttribute("hidden")&&!e.hasAttribute("data-skip")&&e.setAttribute("data-hidden","true"),!e.hasAttribute("hidden")&&e.hasAttribute("data-skip")&&e.hasAttribute("data-hidden")&&e.removeAttribute("data-hidden"),e.setAttribute("class","pkt-hide"),e.setAttribute("data-skip","true"),e.setAttribute("hidden","true"),this.nodes.push(e))}createOptions(){this.options=this.nodes.map(e=>({value:e.hasAttribute("value")?e.getAttribute("value")??"":e.textContent??"",label:e.textContent||e.getAttribute("value")||"",selected:e.hasAttribute("selected"),disabled:e.hasAttribute("disabled"),hidden:e.hasAttribute("data-hidden")})),this.generation++,this.host.requestUpdate()}handleMutations(e){let t=!1;e.forEach(n=>{n.type==="childList"&&(n.addedNodes.forEach(i=>{rn(i)&&(this.addNode(i),t=!0)}),n.removedNodes.forEach(i=>{rn(i)&&(this.nodes=this.nodes.filter(r=>r!==i),t=!0)})),n.type==="attributes"&&rn(n.target)&&(this.addNode(n.target),t=!0)}),t&&this.createOptions()}};var nh=Object.defineProperty,ih=Object.getOwnPropertyDescriptor,Us=(s,e,t,n)=>{for(var i=n>1?void 0:n?ih(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&nh(e,t,i),i};let us=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.forId=ws(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=Dt.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.filledSlots=new Set,this.slotController=new Qe(this,this.defaultSlot)}updateSlots(e){this.filledSlots=new Set(e)}render(){const e=()=>{const i=!this.isHelpTextOpen;this.isHelpTextOpen=i,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:i}}))},t=z({"pkt-inputwrapper__helptext-container":!0,"pkt-inputwrapper__has-helptext":this.helptext||this.helptextDropdown||this.filledSlots.size>0}),n=()=>this.helptextDropdown?y`<div class="pkt-inputwrapper__helptext-expandable">
513
513
  <button
514
514
  class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
515
515
  type="button"
@@ -528,11 +528,11 @@
528
528
  </div>
529
529
  </div>`:x;return y`${y`<div class="${t}">
530
530
  <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
531
- <div class="pkt-contents" ${X(this.defaultSlot)} name="helptext"></div>
531
+ <div class="pkt-contents" ${G(this.defaultSlot)} name="helptext"></div>
532
532
  ${this.helptext&&xi(this.helptext)}
533
533
  </div>
534
534
  ${n()}
535
- </div>`}`}};Us([u({type:String,reflect:!0})],us.prototype,"forId",2),Us([u({type:String})],us.prototype,"helptext",2),Us([u({type:String})],us.prototype,"helptextDropdown",2),Us([u({type:String})],us.prototype,"helptextDropdownButton",2),Us([ce()],us.prototype,"isHelpTextOpen",2),Us([ce()],us.prototype,"filledSlots",2),us=Us([ge("pkt-helptext")],us);var rh=Object.defineProperty,ah=Object.getOwnPropertyDescriptor,je=(s,e,t,n)=>{for(var i=n>1?void 0:n?ah(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rh(e,t,i),i};let Fe=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.helptextSlot=Z(),this.forId=ws(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=Dt.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=Dt.props.optionalTag.default,this.optionalText=Dt.props.optionalText.default,this.requiredTag=Dt.props.requiredTag.default,this.requiredText=Dt.props.requiredText.default,this.tagText=null,this.hasError=Dt.props.hasError.default,this.errorMessage="",this.disabled=Dt.props.disabled.default,this.inline=Dt.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=Dt.props.hasFieldset.default,this.role="group",this.useWrapper=Dt.props.useWrapper.default,this.slotController=new Qe(this,this.defaultSlot,this.helptextSlot)}updated(e){super.updated(e)}render(){const e={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},t="pkt-tag pkt-tag--small pkt-tag--thin-text",n=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:x,i=()=>y`
535
+ </div>`}`}};Us([u({type:String,reflect:!0})],us.prototype,"forId",2),Us([u({type:String})],us.prototype,"helptext",2),Us([u({type:String})],us.prototype,"helptextDropdown",2),Us([u({type:String})],us.prototype,"helptextDropdownButton",2),Us([ce()],us.prototype,"isHelpTextOpen",2),Us([ce()],us.prototype,"filledSlots",2),us=Us([ge("pkt-helptext")],us);var rh=Object.defineProperty,ah=Object.getOwnPropertyDescriptor,We=(s,e,t,n)=>{for(var i=n>1?void 0:n?ah(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rh(e,t,i),i};let Ue=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.helptextSlot=Q(),this.forId=ws(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=Dt.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.counterError=null,this.counterPosition="bottom",this.optionalTag=Dt.props.optionalTag.default,this.optionalText=Dt.props.optionalText.default,this.requiredTag=Dt.props.requiredTag.default,this.requiredText=Dt.props.requiredText.default,this.tagText=null,this.hasError=Dt.props.hasError.default,this.errorMessage="",this.disabled=Dt.props.disabled.default,this.inline=Dt.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=Dt.props.hasFieldset.default,this.role="group",this.useWrapper=Dt.props.useWrapper.default,this.slotController=new Qe(this,this.defaultSlot,this.helptextSlot)}updated(e){super.updated(e)}render(){const e={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},t="pkt-tag pkt-tag--small pkt-tag--thin-text",n=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:x,i=()=>y`
536
536
  ${this.tagText?y`<span class=${t+" pkt-tag--gray"}>${this.tagText}</span>`:x}
537
537
  ${this.optionalTag?y`<span class=${t+" pkt-tag--blue-light"}>${this.optionalText}</span>`:x}
538
538
  ${this.requiredTag?y`<span class=${t+" pkt-tag--beige"}>${this.requiredText}</span>`:x}
@@ -564,7 +564,7 @@
564
564
  .helptextDropdown=${this.helptextDropdown}
565
565
  .helptextDropdownButton=${this.helptextDropdownButton||Dt.props.helptextDropdownButton.default}
566
566
  @toggleHelpText=${b=>{this.toggleDropdown(b)}}
567
- ${X(this.helptextSlot)}
567
+ ${G(this.helptextSlot)}
568
568
  name="helptext"
569
569
  ></pkt-helptext>
570
570
  `,l=()=>this.counter?y`<div class="pkt-input__counter" aria-live="polite" aria-atomic="true">
@@ -582,12 +582,12 @@
582
582
  ${r()}
583
583
  ${a()}
584
584
  ${this.counterPosition==="top"?l():x}
585
- <div class="pkt-contents" ${X(this.defaultSlot)}></div>
585
+ <div class="pkt-contents" ${G(this.defaultSlot)}></div>
586
586
  ${this.counterPosition==="bottom"?l():x}
587
587
  ${c()}
588
588
  `,g=()=>this.hasFieldset?y`<fieldset class="pkt-inputwrapper__fieldset" aria-describedby="${n}">
589
589
  ${p()}
590
- </fieldset>`:y`<div class="pkt-inputwrapper__fieldset">${p()}</div>`;return y`<div class=${z(e)}>${g()}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};je([u({type:String})],Fe.prototype,"forId",2),je([u({type:String})],Fe.prototype,"label",2),je([u({type:String})],Fe.prototype,"helptext",2),je([u({type:String})],Fe.prototype,"helptextDropdown",2),je([u({type:String})],Fe.prototype,"helptextDropdownButton",2),je([u({type:Boolean})],Fe.prototype,"counter",2),je([u({type:Number})],Fe.prototype,"counterCurrent",2),je([u({type:Number})],Fe.prototype,"counterMaxLength",2),je([u({type:String})],Fe.prototype,"counterError",2),je([u({type:String,reflect:!1})],Fe.prototype,"counterPosition",2),je([u({type:Boolean})],Fe.prototype,"optionalTag",2),je([u({type:String})],Fe.prototype,"optionalText",2),je([u({type:Boolean})],Fe.prototype,"requiredTag",2),je([u({type:String})],Fe.prototype,"requiredText",2),je([u({type:String})],Fe.prototype,"tagText",2),je([u({type:Boolean})],Fe.prototype,"hasError",2),je([u({type:String})],Fe.prototype,"errorMessage",2),je([u({type:Boolean})],Fe.prototype,"disabled",2),je([u({type:Boolean})],Fe.prototype,"inline",2),je([u({type:String})],Fe.prototype,"ariaDescribedby",2),je([u({type:Boolean})],Fe.prototype,"hasFieldset",2),je([u({type:String,reflect:!0})],Fe.prototype,"role",2),je([u({type:Boolean,reflect:!0,converter:xt})],Fe.prototype,"useWrapper",2),Fe=je([ge("pkt-input-wrapper")],Fe);const oh=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},lh=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=Jt(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ch=(s,e,t,n,i)=>s.trim().toLowerCase()?{...Wd(s,e,t,n),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:"",shouldRemoveValue:!i&&!!e[0],shouldResetInput:!0},Ei=(s,e,t)=>{const n=Jt(e,s);return t==="label"&&n!=null&&n.label?n.label:s},Kn={markOptionSelected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!0;break}}},markOptionDeselected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!1;break}}},markAllSelected(s){for(const e of s)e.selected=!0},markAllDeselected(s){for(const e of s)e.selected=!1},removeUserAddedOptions(s){return s.filter(e=>!e.userAdded)}},bo={parseOptionsFromSlot(s){const e=[];return s.forEach(t=>{if(!t.textContent&&!t.getAttribute("value"))return;const n={value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||""};t.getAttribute("data-prefix")&&(n.prefix=t.getAttribute("data-prefix")||void 0),t.getAttribute("tagskincolor")&&(n.tagSkinColor=t.getAttribute("tagskincolor")),t.getAttribute("description")&&(n.description=t.getAttribute("description")||void 0),n.fulltext=ho(n),e.push(n)}),e}},wr={syncOptionsWithValues(s,e){const t=[...e];return s.forEach(n=>{n.value&&!n.label&&(n.label=n.value),n.selected&&!t.includes(n.value)&&t.push(n.value),n.fulltext=ho(n),n.selected=n.selected||t.includes(n.value)}),{options:s,newValues:t}},mergeWithUserAdded(s,e){return[...e.filter(t=>(t==null?void 0:t.userAdded)&&t.selected).filter(t=>!(Array.isArray(s)?s:[]).some(n=>n.value===t.value)),...s]}},uh={displayValueAs:{default:"label"}},dh={props:uh};var hh=Object.defineProperty,st=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&hh(e,t,i),i};let Ze=class extends ie{constructor(){super(),this.helptextSlot=Z(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=dh.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=Z(),this.triggerRef=Z(),this.listboxRef=Z(),this.optionsController=new mo(this),this.slotController=new Qe(this,this.helptextSlot),this.slotController.skipOptions=!0}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){var e,t;this._hasTextInput?(e=this.inputRef.value)==null||e.focus():(t=this.triggerRef.value)==null||t.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(","):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=Di(this._value.length,this.maxlength)}syncValueAndDispatch(e){const t=this._value,n=this.multiple?t.join(","):t[0]||"",i=Array.isArray(this.value)?this.value.join(","):String(this.value||"");if(n!==i&&(this._internalValueSync=!0,this.value=n),(e==null?void 0:e.join(","))!==t.join(",")){const r=this.multiple?[...t]:t[0]||"";this.onChange(r)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};st([u({type:String,reflect:!0})],Ze.prototype,"value"),st([u({type:Array})],Ze.prototype,"options"),st([u({type:Array,attribute:"default-options"})],Ze.prototype,"defaultOptions"),st([u({type:Boolean,attribute:"allow-user-input"})],Ze.prototype,"allowUserInput"),st([u({type:Boolean})],Ze.prototype,"typeahead"),st([u({type:Boolean,attribute:"include-search"})],Ze.prototype,"includeSearch"),st([u({type:String,attribute:"search-placeholder"})],Ze.prototype,"searchPlaceholder"),st([u({type:Boolean})],Ze.prototype,"multiple"),st([u({type:Number})],Ze.prototype,"maxlength"),st([u({type:String,attribute:"display-value-as"})],Ze.prototype,"displayValueAs"),st([u({type:String,attribute:"tag-placement"})],Ze.prototype,"tagPlacement"),st([u({type:Boolean,attribute:"open"})],Ze.prototype,"isOpen"),st([ce()],Ze.prototype,"_options"),st([ce()],Ze.prototype,"_value"),st([ce()],Ze.prototype,"_isOptionsOpen"),st([ce()],Ze.prototype,"_userInfoMessage"),st([ce()],Ze.prototype,"_addValueText"),st([ce()],Ze.prototype,"_maxIsReached"),st([ce()],Ze.prototype,"_search"),st([ce()],Ze.prototype,"_inputFocus");class ph extends Ze{toggleValue(e){var t,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const i=((t=Jt(this.options,e))==null?void 0:t.value)||null,r=this._value.includes(e||i||""),a=!!i,l=((n=this._options.find(M=>M.value===e))==null?void 0:n.disabled)||!1,c=!(e!=null&&e.trim()),p=!this.multiple,g=this.multiple,b=Di(this._value.length,this.maxlength);let f=!1,k=!0,v="",$="";l||(!a&&this.allowUserInput&&!c?(this.addNewUserValue(e),v="Ny verdi lagt til",f=g):!a&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),k=!1,f=!0,v="Ingen treff i søket"):r?(this.removeValue(i),f=!0,p&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="")):c&&p?(this.removeAllSelected(),f=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(i),f=!1):g&&!b?(this.setSelected(i),f=!0):g&&b?(v="Maks antall valg nådd",k=!1,$=e):(p&&this.removeAllSelected(),v="Ingen gyldig verdi valgt",k=!1,f=!0,$=e),this._isOptionsOpen=f,f||(p&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=v,this._search=$||"",this.resetComboboxInput(k),g&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&Di(this._value.length,this.maxlength)){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,Kn.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(n=>n!==e);const t=Jt(this.options,e);t&&(Kn.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(n=>n.value!==e)],this.options=[...this.options.filter(n=>n.value!==e)]):this._options.some(n=>n.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(e=>e.value),Kn.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],Kn.markAllDeselected(this._options),this._options=Kn.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";if(this._search=t,t&&this._value.includes(t)){this.resetComboboxInput(!0),this._userInfoMessage="Verdien er allerede valgt";return}this.toggleValue(t)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!Jt(this.options,e)){if(Di(this._value.length,this.maxlength))return;this._value=[...this._value,e]}const t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&e&&(this._search="",this.multiple?this.inputRef.value.value="":(this.inputRef.value.value=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"",this._userInfoMessage="")),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();const t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}}class fh extends ph{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead)if(this._search){const{filtered:n,suggestion:i}=qd(this.options,this._search);this._options=n,e.inputType!=="deleteContentBackward"&&i!=null&&i.label&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(t.value=i.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection="backward")}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){var t,n;if(this.disabled||!this._isOptionsOpen)return;const i=e.relatedTarget;((t=i==null?void 0:i.closest("pkt-combobox"))==null?void 0:t.id)===this.id||((n=e.target)==null?void 0:n.getAttribute("data-focusfix"))===this.id||i===this.inputRef.value||i===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"){const e=this.inputRef.value.value;if(this.multiple){if(e!==""){const{action:t,value:n}=lh(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case"addUserValue":this.addNewUserValue(n);break;case"selectOption":this.setSelected(n);break;case"removeValue":this.removeValue(n);break}}}else if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{const t=Jt(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}!this.multiple&&this._value[0]?this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){var t,n;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?((t=this.inputRef.value)==null||t.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption()))}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){var t,n;if(!this.disabled)switch(e.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,(t=this.listboxRef.value)==null||t.focusFirstOrSelectedOption());break;case"Escape":this._isOptionsOpen&&(e.preventDefault(),this._isOptionsOpen=!1);break;case"Home":case"End":e.preventDefault(),this._isOptionsOpen||(this._isOptionsOpen=!0),(n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption();break;case"ArrowLeft":this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case"Backspace":case"Delete":this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]));break}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){var t,n,i;if(e.key==="Backspace"){const a=!((t=this.inputRef.value)!=null&&t.value);!this._search&&a&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key==="ArrowLeft"&&this.multiple&&this._value.length>0){const a=this.inputRef.value;if(a&&a.selectionStart===0&&!a.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}const r=oh(e.key,e.shiftKey,this.multiple);if(r&&!(e.key==="Tab"&&!this._isOptionsOpen)){if(r==="focusListbox"&&e.key==="Tab"&&!((n=this.listboxRef.value)!=null&&n.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){this.closeAndProcessInput();return}switch(e.preventDefault(),r){case"addValue":this.addValue();break;case"focusListbox":(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption();break;case"closeOptions":this._isOptionsOpen=!1;break}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(".pkt-combobox__input .pkt-combobox__tag-list pkt-tag"))}focusTag(e){var t;const n=this.getInsideTags();n.forEach((r,a)=>{r.buttonTabindex=a===e?0:-1});const i=(t=n[e])==null?void 0:t.querySelector("button");i==null||i.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();const n=()=>{var i;this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():(i=this.triggerRef.value)==null||i.focus()};switch(e.key){case"ArrowLeft":e.preventDefault(),t>0&&this.focusTag(t-1);break;case"ArrowRight":e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case"Backspace":case"Delete":e.preventDefault();{const i=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(i),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case"Tab":this.resetTagTabindices();break;case"Escape":e.preventDefault(),n();break}}checkForMatches(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value)||this._search||"",n=ch(t,this._value,this.options,this.allowUserInput,this.multiple);if(n.shouldRemoveValue&&this.removeValue(this._value[0]),n.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=n.addValueText,this._userInfoMessage=n.userInfoMessage}}var gh=(s,e,t,n)=>{for(var i=e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(i)||i);return i};let vo=class extends fh{constructor(){super(...arguments),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){var e,t;if(super.connectedCallback(),document==null||document.body.addEventListener("click",this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){const n=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...n,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((t=this.optionsController)!=null&&t.nodes&&this.optionsController.nodes.length){const n=bo.parseOptionsFromSlot(this.optionsController.nodes);n.length&&(this.options=[...n],this._options=[...n],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){const t=this.optionsController.generation;if(t!==this._lastSlotGeneration){this._lastSlotGeneration=t;const n=bo.parseOptionsFromSlot(this.optionsController.nodes),i=this._options.filter(r=>r.userAdded);this.options=[...i,...n]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document==null||document.body.removeEventListener("click",this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has("isOpen")&&(this._isOptionsOpen=this.isOpen);const t=e.has("value"),n=e.has("_value");if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get("_value"));else if(t){const i=[...this._value],r=this.parseValue();r.join(",")!==this._value.join(",")&&(this._value=r),this.updateMaxReached(),this.syncValueAndDispatch(i)}else n&&this.syncValueAndDispatch(e.get("_value"));if(e.has("defaultOptions")&&this.defaultOptions.length){const i=(Array.isArray(this.options)?this.options:[]).filter(r=>r.userAdded)||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const i=e.get("options")||this._options||[],r=wr.mergeWithUserAdded(this.options,i);this._options=r,r.length>this.options.length&&(this.options=r);const a=wr.syncOptionsWithValues(this._options,this._value);if(this._options=a.options,a.newValues.length>this._value.length){const l=[...this._value];this._value=a.newValues,this.syncValueAndDispatch(l)}}if(e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&!this.multiple&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const i=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"";this.inputRef.value.value!==i&&(this.inputRef.value.value=i)}super.updated(e)}formResetCallback(){this.touched=!1;const e=this.defaultValue||(this.multiple,"");this.value=e,this._value=this.parseValue(),this._options=this._options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this.options=this.options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this._search="",this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=""),this.internals.setFormValue(""),this.internals.ariaInvalid="false",this.requestUpdate()}attributeChangedCallback(e,t,n){if(e==="options"){this._options=Array.isArray(this.options)?[...this.options]:[];const i=wr.syncOptionsWithValues(this._options,this._value);this._options=i.options,i.newValues.length>this._value.length&&(this._value=i.newValues),this._search=""}super.attributeChangedCallback(e,t,n)}render(){return y`
590
+ </fieldset>`:y`<div class="pkt-inputwrapper__fieldset">${p()}</div>`;return y`<div class=${z(e)}>${g()}</div> `}toggleDropdown(e){this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!1,detail:{isOpen:e.detail.isOpen}}))}handleLabelClick(){this.dispatchEvent(new CustomEvent("labelClick",{bubbles:!0,composed:!0,detail:"label clicked"}))}};We([u({type:String})],Ue.prototype,"forId",2),We([u({type:String})],Ue.prototype,"label",2),We([u({type:String})],Ue.prototype,"helptext",2),We([u({type:String})],Ue.prototype,"helptextDropdown",2),We([u({type:String})],Ue.prototype,"helptextDropdownButton",2),We([u({type:Boolean})],Ue.prototype,"counter",2),We([u({type:Number})],Ue.prototype,"counterCurrent",2),We([u({type:Number})],Ue.prototype,"counterMaxLength",2),We([u({type:String})],Ue.prototype,"counterError",2),We([u({type:String,reflect:!1})],Ue.prototype,"counterPosition",2),We([u({type:Boolean})],Ue.prototype,"optionalTag",2),We([u({type:String})],Ue.prototype,"optionalText",2),We([u({type:Boolean})],Ue.prototype,"requiredTag",2),We([u({type:String})],Ue.prototype,"requiredText",2),We([u({type:String})],Ue.prototype,"tagText",2),We([u({type:Boolean})],Ue.prototype,"hasError",2),We([u({type:String})],Ue.prototype,"errorMessage",2),We([u({type:Boolean})],Ue.prototype,"disabled",2),We([u({type:Boolean})],Ue.prototype,"inline",2),We([u({type:String})],Ue.prototype,"ariaDescribedby",2),We([u({type:Boolean})],Ue.prototype,"hasFieldset",2),We([u({type:String,reflect:!0})],Ue.prototype,"role",2),We([u({type:Boolean,reflect:!0,converter:xt})],Ue.prototype,"useWrapper",2),Ue=We([ge("pkt-input-wrapper")],Ue);const oh=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},lh=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=Jt(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ch=(s,e,t,n,i)=>s.trim().toLowerCase()?{...Wd(s,e,t,n),shouldRemoveValue:!1,shouldResetInput:!1}:{addValueText:null,userInfoMessage:"",shouldRemoveValue:!i&&!!e[0],shouldResetInput:!0},Ei=(s,e,t)=>{const n=Jt(e,s);return t==="label"&&n!=null&&n.label?n.label:s},Kn={markOptionSelected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!0;break}}},markOptionDeselected(s,e){if(e){for(const t of s)if(t.value===e){t.selected=!1;break}}},markAllSelected(s){for(const e of s)e.selected=!0},markAllDeselected(s){for(const e of s)e.selected=!1},removeUserAddedOptions(s){return s.filter(e=>!e.userAdded)}},bo={parseOptionsFromSlot(s){const e=[];return s.forEach(t=>{if(!t.textContent&&!t.getAttribute("value"))return;const n={value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||""};t.getAttribute("data-prefix")&&(n.prefix=t.getAttribute("data-prefix")||void 0),t.getAttribute("tagskincolor")&&(n.tagSkinColor=t.getAttribute("tagskincolor")),t.getAttribute("description")&&(n.description=t.getAttribute("description")||void 0),n.fulltext=ho(n),e.push(n)}),e}},wr={syncOptionsWithValues(s,e){const t=[...e];return s.forEach(n=>{n.value&&!n.label&&(n.label=n.value),n.selected&&!t.includes(n.value)&&t.push(n.value),n.fulltext=ho(n),n.selected=n.selected||t.includes(n.value)}),{options:s,newValues:t}},mergeWithUserAdded(s,e){return[...e.filter(t=>(t==null?void 0:t.userAdded)&&t.selected).filter(t=>!(Array.isArray(s)?s:[]).some(n=>n.value===t.value)),...s]}},uh={displayValueAs:{default:"label"}},dh={props:uh};var hh=Object.defineProperty,st=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&hh(e,t,i),i};let Ze=class extends ie{constructor(){super(),this.helptextSlot=Q(),this.value="",this.options=[],this.defaultOptions=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=dh.props.displayValueAs.default,this.tagPlacement=null,this.isOpen=!1,this._options=[],this._value=[],this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._internalValueSync=!1,this._optionsFromSlot=!1,this._lastSlotGeneration=0,this._suppressNextOpen=!1,this.inputRef=Q(),this.triggerRef=Q(),this.listboxRef=Q(),this.optionsController=new mo(this),this.slotController=new Qe(this,this.helptextSlot),this.slotController.skipOptions=!0}get _hasTextInput(){return this.typeahead||this.allowUserInput}get _selectionDescription(){if(!(!this.multiple||this._value.length===0))return`${this._value.length} valgt`}focusTrigger(){var e,t;this._hasTextInput?(e=this.inputRef.value)==null||e.focus():(t=this.triggerRef.value)==null||t.focus()}parseValue(){return Array.isArray(this.value)?this.multiple?this.value:this.value.length>0?[this.value[0]]:[]:this.value&&this.multiple?this.value.split(","):this.value?[this.value]:[]}updateMaxReached(){this._maxIsReached=Di(this._value.length,this.maxlength)}syncValueAndDispatch(e){const t=this._value,n=this.multiple?t.join(","):t[0]||"",i=Array.isArray(this.value)?this.value.join(","):String(this.value||"");if(n!==i&&(this._internalValueSync=!0,this.value=n),(e==null?void 0:e.join(","))!==t.join(",")){const r=this.multiple?[...t]:t[0]||"";this.onChange(r)}else t.length===0&&e&&e.length>0&&this.clearInputValue()}onChange(e){this.touched=!0,super.onChange(e)}valueChanged(){}};st([u({type:String,reflect:!0})],Ze.prototype,"value"),st([u({type:Array})],Ze.prototype,"options"),st([u({type:Array,attribute:"default-options"})],Ze.prototype,"defaultOptions"),st([u({type:Boolean,attribute:"allow-user-input"})],Ze.prototype,"allowUserInput"),st([u({type:Boolean})],Ze.prototype,"typeahead"),st([u({type:Boolean,attribute:"include-search"})],Ze.prototype,"includeSearch"),st([u({type:String,attribute:"search-placeholder"})],Ze.prototype,"searchPlaceholder"),st([u({type:Boolean})],Ze.prototype,"multiple"),st([u({type:Number})],Ze.prototype,"maxlength"),st([u({type:String,attribute:"display-value-as"})],Ze.prototype,"displayValueAs"),st([u({type:String,attribute:"tag-placement"})],Ze.prototype,"tagPlacement"),st([u({type:Boolean,attribute:"open"})],Ze.prototype,"isOpen"),st([ce()],Ze.prototype,"_options"),st([ce()],Ze.prototype,"_value"),st([ce()],Ze.prototype,"_isOptionsOpen"),st([ce()],Ze.prototype,"_userInfoMessage"),st([ce()],Ze.prototype,"_addValueText"),st([ce()],Ze.prototype,"_maxIsReached"),st([ce()],Ze.prototype,"_search"),st([ce()],Ze.prototype,"_inputFocus");class ph extends Ze{toggleValue(e){var t,n;if(this.disabled)return;this.touched=!0,this._userInfoMessage="",this._addValueText=null;const i=((t=Jt(this.options,e))==null?void 0:t.value)||null,r=this._value.includes(e||i||""),a=!!i,l=((n=this._options.find(M=>M.value===e))==null?void 0:n.disabled)||!1,c=!(e!=null&&e.trim()),p=!this.multiple,g=this.multiple,b=Di(this._value.length,this.maxlength);let f=!1,k=!0,v="",$="";l||(!a&&this.allowUserInput&&!c?(this.addNewUserValue(e),v="Ny verdi lagt til",f=g):!a&&!this.allowUserInput?(p&&this._value[0]&&this.removeValue(this._value[0]),k=!1,f=!0,v="Ingen treff i søket"):r?(this.removeValue(i),f=!0,p&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value="")):c&&p?(this.removeAllSelected(),f=!0):p?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(i),f=!1):g&&!b?(this.setSelected(i),f=!0):g&&b?(v="Maks antall valg nådd",k=!1,$=e):(p&&this.removeAllSelected(),v="Ingen gyldig verdi valgt",k=!1,f=!0,$=e),this._isOptionsOpen=f,f||(p&&this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this._userInfoMessage=v,this._search=$||"",this.resetComboboxInput(k),g&&this.updateMaxReached())}setSelected(e){if(!this._value.includes(e)){if(this.multiple&&Di(this._value.length,this.maxlength)){this._userInfoMessage="Maks antall valg nådd";return}!this.multiple&&this.removeAllSelected(),this._value=e?[...this._value,e]:this._value,Kn.markOptionSelected(this._options,e),this.resetComboboxInput(!0)}}removeSelected(e){if(!e)return;this._value=this._value.filter(n=>n!==e);const t=Jt(this.options,e);t&&(Kn.markOptionDeselected(this.options,e),t.userAdded?(this._options=[...this._options.filter(n=>n.value!==e)],this.options=[...this.options.filter(n=>n.value!==e)]):this._options.some(n=>n.value===e)||(this._options=[...this._options,t]))}addAllOptions(){if(this.multiple){if(this.maxlength&&this._options.length>this.maxlength){this._userInfoMessage="For mange valgt";return}this._value=this._options.map(e=>e.value),Kn.markAllSelected(this._options),this.requestUpdate()}}removeAllSelected(){this._value=[],Kn.markAllDeselected(this._options),this._options=Kn.removeUserAddedOptions(this._options),this.requestUpdate()}addValue(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value.trim())||"";if(this._search=t,t&&this._value.includes(t)){this.resetComboboxInput(!0),this._userInfoMessage="Verdien er allerede valgt";return}this.toggleValue(t)}removeValue(e){this._value=this.multiple?this._value.filter(t=>t!==e):[],this.removeSelected(e)}addNewUserValue(e){if(!e||e.trim()==="")return;if(!this.multiple)this._value[0]&&this.removeSelected(this._value[0]),this._value=[e];else if(!Jt(this.options,e)){if(Di(this._value.length,this.maxlength))return;this._value=[...this._value,e]}const t={value:e,label:e,userAdded:!0,selected:!0};this.options=[t,...this.options],this._options=[t,...this._options],this.resetComboboxInput(!0),this.multiple||(this._isOptionsOpen=!1,this._hasTextInput&&(this._suppressNextOpen=!0),window.setTimeout(()=>{this.focusTrigger()},0)),this.requestUpdate()}resetComboboxInput(e=!0){this._addValueText=null,this.inputRef.value&&this.inputRef.value.type!=="hidden"&&e&&(this._search="",this.multiple?this.inputRef.value.value="":(this.inputRef.value.value=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"",this._userInfoMessage="")),this._options=[...this.options]}removeLastValue(e){if(this._value.length===0)return;e.preventDefault();const t=this._value[this._value.length-1];t&&this.removeSelected(t),this.updateMaxReached()}}class fh extends ph{handleInput(e){if(e.stopPropagation(),e.stopImmediatePropagation(),this.disabled)return;this.touched=!0;const t=e.target;if(this._search=t.value,this.checkForMatches(),this.typeahead)if(this._search){const{filtered:n,suggestion:i}=qd(this.options,this._search);this._options=n,e.inputType!=="deleteContentBackward"&&i!=null&&i.label&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(t.value=i.label,window.setTimeout(()=>t.setSelectionRange(this._search.length,t.value.length),0),t.selectionDirection="backward")}else this._options=[...this.options]}handleFocus(){if(!this.disabled){if(this._suppressNextOpen){this._suppressNextOpen=!1,this._inputFocus=!0,this.requestUpdate();return}!this.multiple&&this._value[0]&&this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs)),this._inputFocus=!0,this._search="",this._options=[...this.options],this._isOptionsOpen=!0,this.onFocus(),this.requestUpdate()}}handleFocusOut(e){var t,n;if(this.disabled||!this._isOptionsOpen)return;const i=e.relatedTarget;((t=i==null?void 0:i.closest("pkt-combobox"))==null?void 0:t.id)===this.id||((n=e.target)==null?void 0:n.getAttribute("data-focusfix"))===this.id||i===this.inputRef.value||i===this.triggerRef.value||this.closeAndProcessInput()}closeAndProcessInput(){if(this._inputFocus=!1,this._addValueText=null,this._userInfoMessage="",this._search="",this.inputRef.value&&this.inputRef.value.type!=="hidden"){const e=this.inputRef.value.value;if(this.multiple){if(e!==""){const{action:t,value:n}=lh(e,this._value,this.options,this.allowUserInput,this.multiple);switch(t){case"addUserValue":this.addNewUserValue(n);break;case"selectOption":this.setSelected(n);break;case"removeValue":this.removeValue(n);break}}}else if(!e)this._value[0]&&this.removeSelected(this._value[0]);else{const t=Jt(this.options,e);t&&t.value!==this._value[0]?(this._value[0]&&this.removeSelected(this._value[0]),this.setSelected(t.value)):!t&&this.allowUserInput&&(this._value[0]&&this.removeSelected(this._value[0]),this.addNewUserValue(e))}!this.multiple&&this._value[0]?this.inputRef.value.value=Ei(this._value[0],this.options,this.displayValueAs):this.inputRef.value.value=""}this._isOptionsOpen=!1,this.onBlur()}handleBlur(){this._inputFocus=!1,this.onBlur()}handleInputClick(e){var t,n;if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}this._hasTextInput?((t=this.inputRef.value)==null||t.focus(),this.requestUpdate()):(e.stopImmediatePropagation(),e.preventDefault(),this._isOptionsOpen=!this._isOptionsOpen,this._isOptionsOpen&&((n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption()))}handlePlaceholderClick(e){this.disabled||(e.stopPropagation(),this._hasTextInput&&this.inputRef.value?(this.inputRef.value.focus(),this._inputFocus=!0,this.requestUpdate()):(this._isOptionsOpen=!this._isOptionsOpen,this.requestUpdate()))}handleSelectOnlyKeydown(e){var t,n;if(!this.disabled)switch(e.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":e.preventDefault(),this._isOptionsOpen?this._isOptionsOpen=!1:(this._isOptionsOpen=!0,(t=this.listboxRef.value)==null||t.focusFirstOrSelectedOption());break;case"Escape":this._isOptionsOpen&&(e.preventDefault(),this._isOptionsOpen=!1);break;case"Home":case"End":e.preventDefault(),this._isOptionsOpen||(this._isOptionsOpen=!0),(n=this.listboxRef.value)==null||n.focusFirstOrSelectedOption();break;case"ArrowLeft":this.multiple&&this._value.length>0&&(e.preventDefault(),this.focusTag(this._value.length-1));break;case"Backspace":case"Delete":this.multiple&&this._value.length>0&&(e.preventDefault(),this.removeSelected(this._value[this._value.length-1]));break}}handleOptionToggled(e){this.toggleValue(e.detail)}handleSearch(e){e.stopPropagation(),this._search=e.detail.toLowerCase(),this.checkForMatches()}handleInputKeydown(e){var t,n,i;if(e.key==="Backspace"){const a=!((t=this.inputRef.value)!=null&&t.value);!this._search&&a&&this.multiple&&this._value.length>0&&this.removeLastValue(e);return}if(e.key==="ArrowLeft"&&this.multiple&&this._value.length>0){const a=this.inputRef.value;if(a&&a.selectionStart===0&&!a.value){e.preventDefault(),this.focusTag(this._value.length-1);return}}const r=oh(e.key,e.shiftKey,this.multiple);if(r&&!(e.key==="Tab"&&!this._isOptionsOpen)){if(r==="focusListbox"&&e.key==="Tab"&&!((n=this.listboxRef.value)!=null&&n.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){this.closeAndProcessInput();return}switch(e.preventDefault(),r){case"addValue":this.addValue();break;case"focusListbox":(i=this.listboxRef.value)==null||i.focusFirstOrSelectedOption();break;case"closeOptions":this._isOptionsOpen=!1;break}}}handleTagRemove(e){this.removeSelected(e),this._hasTextInput&&this.inputRef.value&&(this._inputFocus=!0,this.inputRef.value.focus(),this.requestUpdate())}getInsideTags(){return Array.from(this.querySelectorAll(".pkt-combobox__input .pkt-combobox__tag-list pkt-tag"))}focusTag(e){var t;const n=this.getInsideTags();n.forEach((r,a)=>{r.buttonTabindex=a===e?0:-1});const i=(t=n[e])==null?void 0:t.querySelector("button");i==null||i.focus()}resetTagTabindices(){this.getInsideTags().forEach(e=>{e.buttonTabindex=-1})}handleTagKeydown(e,t){e.stopPropagation();const n=()=>{var i;this.resetTagTabindices(),this._hasTextInput&&this.inputRef.value?this.inputRef.value.focus():(i=this.triggerRef.value)==null||i.focus()};switch(e.key){case"ArrowLeft":e.preventDefault(),t>0&&this.focusTag(t-1);break;case"ArrowRight":e.preventDefault(),t<this._value.length-1?this.focusTag(t+1):n();break;case"Backspace":case"Delete":e.preventDefault();{const i=this._value[t],r=t>=this._value.length-1?t-1:t;this.removeSelected(i),r>=0?(this.requestUpdate(),this.updateComplete.then(()=>this.focusTag(r))):n()}break;case"Tab":this.resetTagTabindices();break;case"Escape":e.preventDefault(),n();break}}checkForMatches(){var e;const t=((e=this.inputRef.value)==null?void 0:e.value)||this._search||"",n=ch(t,this._value,this.options,this.allowUserInput,this.multiple);if(n.shouldRemoveValue&&this.removeValue(this._value[0]),n.shouldResetInput){this.resetComboboxInput(!1);return}this._addValueText=n.addValueText,this._userInfoMessage=n.userInfoMessage}}var gh=(s,e,t,n)=>{for(var i=e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(i)||i);return i};let vo=class extends fh{constructor(){super(...arguments),this.handleBodyClick=e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.closeAndProcessInput()}}connectedCallback(){var e,t;if(super.connectedCallback(),document==null||document.body.addEventListener("click",this.handleBodyClick),this._options=[],this.defaultOptions&&this.defaultOptions.length){const n=((e=this.options)==null?void 0:e.filter(i=>i.userAdded))||[];this.options=[...n,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if((t=this.optionsController)!=null&&t.nodes&&this.optionsController.nodes.length){const n=bo.parseOptionsFromSlot(this.optionsController.nodes);n.length&&(this.options=[...n],this._options=[...n],this._optionsFromSlot=!0,this._lastSlotGeneration=this.optionsController.generation)}}willUpdate(e){if(this._optionsFromSlot&&this.optionsController){const t=this.optionsController.generation;if(t!==this._lastSlotGeneration){this._lastSlotGeneration=t;const n=bo.parseOptionsFromSlot(this.optionsController.nodes),i=this._options.filter(r=>r.userAdded);this.options=[...i,...n]}}super.willUpdate(e)}disconnectedCallback(){super.disconnectedCallback(),document==null||document.body.removeEventListener("click",this.handleBodyClick)}firstUpdated(e){this.defaultValue!==null&&!this.value&&(this.value=this.defaultValue),super.firstUpdated(e)}updated(e){e.has("isOpen")&&(this._isOptionsOpen=this.isOpen);const t=e.has("value"),n=e.has("_value");if(t&&this._internalValueSync)this._internalValueSync=!1,n&&this.syncValueAndDispatch(e.get("_value"));else if(t){const i=[...this._value],r=this.parseValue();r.join(",")!==this._value.join(",")&&(this._value=r),this.updateMaxReached(),this.syncValueAndDispatch(i)}else n&&this.syncValueAndDispatch(e.get("_value"));if(e.has("defaultOptions")&&this.defaultOptions.length){const i=(Array.isArray(this.options)?this.options:[]).filter(r=>r.userAdded)||[];this.options=[...i,...JSON.parse(JSON.stringify(this.defaultOptions))],this._options=Array.isArray(this.options)?[...this.options]:[]}if(e.has("options")){const i=e.get("options")||this._options||[],r=wr.mergeWithUserAdded(this.options,i);this._options=r,r.length>this.options.length&&(this.options=r);const a=wr.syncOptionsWithValues(this._options,this._value);if(this._options=a.options,a.newValues.length>this._value.length){const l=[...this._value];this._value=a.newValues,this.syncValueAndDispatch(l)}}if(e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),!this._isOptionsOpen&&!this.multiple&&this._hasTextInput&&this.inputRef.value&&this.inputRef.value.type!=="hidden"){const i=this._value[0]?Ei(this._value[0],this.options,this.displayValueAs):"";this.inputRef.value.value!==i&&(this.inputRef.value.value=i)}super.updated(e)}formResetCallback(){this.touched=!1;const e=this.defaultValue||(this.multiple,"");this.value=e,this._value=this.parseValue(),this._options=this._options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this.options=this.options.filter(t=>!t.userAdded).map(t=>({...t,selected:this._value.includes(t.value)})),this._search="",this._isOptionsOpen=!1,this._userInfoMessage="",this._addValueText=null,this._inputFocus=!1,this.updateMaxReached(),this.inputRef.value&&this.inputRef.value.type!=="hidden"&&(this.inputRef.value.value=""),this.internals.setFormValue(""),this.internals.ariaInvalid="false",this.requestUpdate()}attributeChangedCallback(e,t,n){if(e==="options"){this._options=Array.isArray(this.options)?[...this.options]:[];const i=wr.syncOptionsWithValues(this._options,this._value);this._options=i.options,i.newValues.length>this._value.length&&(this._value=i.newValues),this._search=""}super.attributeChangedCallback(e,t,n)}render(){return y`
591
591
  <pkt-input-wrapper
592
592
  .label=${this.label}
593
593
  .helptext=${this.helptext}
@@ -609,7 +609,7 @@
609
609
  class="pkt-combobox__wrapper"
610
610
  @labelClick=${this.handleInputClick}
611
611
  >
612
- <div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
612
+ <div class="pkt-contents" ${G(this.helptextSlot)} name="helptext" slot="helptext"></div>
613
613
  <div class="pkt-combobox" @focusout=${this.handleFocusOut}>
614
614
  <div
615
615
  class=${z({"pkt-combobox__input":!0,"pkt-combobox__input--fullwidth":this.fullwidth,"pkt-combobox__input--open":this._isOptionsOpen,"pkt-combobox__input--error":this.hasError,"pkt-combobox__input--disabled":this.disabled})}
@@ -624,7 +624,7 @@
624
624
  tabindex=${this._hasTextInput||this.disabled?"-1":"0"}
625
625
  @click=${this.handleInputClick}
626
626
  @keydown=${this._hasTextInput?x:this.handleSelectOnlyKeydown}
627
- ${X(this.triggerRef)}
627
+ ${G(this.triggerRef)}
628
628
  >
629
629
  ${!this._hasTextInput&&this.placeholder&&(!this._value.length||this.multiple&&this.tagPlacement=="outside")&&!this._inputFocus?y`<span class="pkt-combobox__placeholder" @click=${this.handlePlaceholderClick}
630
630
  >${this.placeholder}</span
@@ -656,7 +656,7 @@
656
656
  @tab-close=${()=>this.closeAndProcessInput()}
657
657
  .searchValue=${this._search||null}
658
658
  .maxLength=${this.maxlength||0}
659
- ${X(this.listboxRef)}
659
+ ${G(this.listboxRef)}
660
660
  ></pkt-listbox>
661
661
  </div>
662
662
 
@@ -684,7 +684,7 @@
684
684
  aria-controls="${this.id}-listbox"
685
685
  aria-activedescendant=${A(this._value[0]&&Jt(this.options,this._value[0])?`${this.id}-listbox-${uo(this._options,this._value[0])}`:void 0)}
686
686
  aria-description=${A(this._selectionDescription||void 0)}
687
- ${X(this.inputRef)}
687
+ ${G(this.inputRef)}
688
688
  />
689
689
  </div>
690
690
  `:y`
@@ -693,7 +693,7 @@
693
693
  id="${this.id}-input"
694
694
  name=${(this.name||this.id)+"-input"}
695
695
  .value=${this._value.join(",")}
696
- ${X(this.inputRef)}
696
+ ${G(this.inputRef)}
697
697
  />
698
698
  `}renderSingleOrMultipleValues(){if(!this.multiple&&this._hasTextInput)return x;const e=!this.multiple,t=this.renderValueTag(Jt(this.options,this._value[0])),n=this.tagPlacement==="outside",i=y`
699
699
  <ul role="list" class="pkt-combobox__tag-list">
@@ -731,7 +731,7 @@
731
731
  @click=${this.openModal}
732
732
  >
733
733
  >${this.triggerText}</pkt-button
734
- >`:y`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};Rt([u({type:Boolean})],Lt.prototype,"devMode",2),Rt([u({type:String})],Lt.prototype,"hotjarId",2),Rt([u({type:String})],Lt.prototype,"googleAnalyticsId",2),Rt([u({type:String})],Lt.prototype,"cookieDomain",2),Rt([u({type:String})],Lt.prototype,"cookieSecure",2),Rt([u({type:String})],Lt.prototype,"cookieExpiryDays",2),Rt([u({type:String})],Lt.prototype,"triggerType",2),Rt([u({type:String})],Lt.prototype,"triggerText",2),Rt([u({type:String})],Lt.prototype,"i18nLanguage",2),Lt=Rt([ge("pkt-consent")],Lt);var yh=Object.defineProperty,_h=Object.getOwnPropertyDescriptor,vt=(s,e,t,n)=>{for(var i=n>1?void 0:n?_h(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&yh(e,t,i),i};let ft=class extends ie{constructor(){super(...arguments),this.inputRef=Z(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.indeterminate=!1,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e==="indeterminate"&&(this.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.firstUpdated(e)}updated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),e.has("checked")&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===""||this.checked==="true"||this.checked===!0),e.has("indeterminate")&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.updated(e)}render(){const e=z({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=z({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=z({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),i="pkt-tag pkt-tag--small pkt-tag--thin-text",r=()=>y`
734
+ >`:y`<pkt-button @click=${this.openModal}>${this.triggerText}</pkt-button>`}};Rt([u({type:Boolean})],Lt.prototype,"devMode",2),Rt([u({type:String})],Lt.prototype,"hotjarId",2),Rt([u({type:String})],Lt.prototype,"googleAnalyticsId",2),Rt([u({type:String})],Lt.prototype,"cookieDomain",2),Rt([u({type:String})],Lt.prototype,"cookieSecure",2),Rt([u({type:String})],Lt.prototype,"cookieExpiryDays",2),Rt([u({type:String})],Lt.prototype,"triggerType",2),Rt([u({type:String})],Lt.prototype,"triggerText",2),Rt([u({type:String})],Lt.prototype,"i18nLanguage",2),Lt=Rt([ge("pkt-consent")],Lt);var yh=Object.defineProperty,_h=Object.getOwnPropertyDescriptor,vt=(s,e,t,n)=>{for(var i=n>1?void 0:n?_h(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&yh(e,t,i),i};let ft=class extends ie{constructor(){super(...arguments),this.inputRef=Q(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.indeterminate=!1,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e==="indeterminate"&&(this.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.firstUpdated(e)}updated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),e.has("checked")&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===""||this.checked==="true"||this.checked===!0),e.has("indeterminate")&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.updated(e)}render(){const e=z({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),t=z({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),n=z({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),i="pkt-tag pkt-tag--small pkt-tag--thin-text",r=()=>y`
735
735
  ${this.tagText?y`<span class=${i+" pkt-tag--gray"}>${this.tagText}</span>`:x}
736
736
  ${this.optionalTag?y`<span class=${i+" pkt-tag--blue-light"}>${this.optionalText}</span>`:x}
737
737
  ${this.requiredTag?y`<span class=${i+" pkt-tag--beige"}>${this.requiredText}</span>`:x}
@@ -750,7 +750,7 @@
750
750
  type="checkbox"
751
751
  ?disabled=${this.disabled}
752
752
  name=${this.name+"-internal"}
753
- ${X(this.inputRef)}
753
+ ${G(this.inputRef)}
754
754
  @change=${this.handleChange}
755
755
  @click=${this.handleClick}
756
756
  @blur=${this.onBlur}
@@ -772,16 +772,16 @@
772
772
  <time datetime=${e}>${to(e,this.dateformat)}</time>
773
773
  </pkt-tag>`}):x}
774
774
  </div>
775
- `}};Gn([u({type:Array})],pn.prototype,"dates",2),Gn([u({type:String})],pn.prototype,"dateformat",2),Gn([u({type:String,attribute:"class"})],pn.prototype,"className",2),Gn([u({type:String,attribute:"id-base"})],pn.prototype,"idBase",2),pn=Gn([ge("pkt-date-tags")],pn);const Sh={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},Xn={props:Sh},Hs=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Ch=()=>Hs()?"text":"date",Th=s=>!s||s.length!==2?!0:hd(s[0],s[1]),Nh=s=>io(s),Mh=(s,e,t,n,i)=>dd(s,e,t,n,i),Dh=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),Oh=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),Eh=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),Ph=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Ah=(s,e,t=!1)=>{var n;if(!s||!e)return;const i=((n=e.parentElement)==null?void 0:n.getBoundingClientRect())||e.getBoundingClientRect(),r=t?i.height+30:i.height,a=s.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(l=`calc(100% - ${r}px - ${a}px)`),s.style.top=l},Ih=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Lh=(s,e)=>{const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))},yo={validateRangeOrder:Th,sortDates:Nh,filterSelectableDates:Mh},Bh={getInputType:Ch},Qn={submitForm(s){var e;const t=(e=s.internals)==null?void 0:e.form;t&&t.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,n,i){var r,a,l,c;const p=s.value;p&&(t&&t>p?e.setValidity({rangeUnderflow:!0},((a=(r=i==null?void 0:i.forms)==null?void 0:r.messages)==null?void 0:a.rangeUnderflow)||"Value is below minimum",s):n&&n<p&&e.setValidity({rangeOverflow:!0},((c=(l=i==null?void 0:i.forms)==null?void 0:l.messages)==null?void 0:c.rangeOverflow)||"Value is above maximum",s))}},Pi={addToSelected(s,e,t,n){const i=s.target;if(!i.value)return;const r=t?At(t):null,a=n?At(n):null,l=At(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&e.value&&e.value.handleDateSelect(l),i.value=""},handleCalendarPosition(s,e,t=!1){Ah(s.value??null,e.value??null,t)}},xr={getInputClasses:Dh,getButtonClasses:Oh,getRangeLabelClasses:Eh},Sr={processDateSelection:Ph,updateInputValues(s,e,t,n,i,r){s.value&&(n&&e!=null&&e.value?(s.value.value=t[0]??"",e.value.value=t[1]??"",r(s.value),r(e.value)):i||(s.value.value=t.length?t[0]:"",r(s.value)))},processRangeBlur(s,e,t,n,i){var r;const a=s.target;if(a.value){i(a);const l=ys(a.value);l&&((r=t==null?void 0:t.value)==null||r.handleDateSelect(l))}else e[0]&&n()}},Ai={handleInputKeydown:Ih,handleButtonKeydown:Lh};var Fh=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,_t=(s,e,t,n)=>{for(var i=n>1?void 0:n?Vh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Fh(e,t,i),i};let kt=class extends Oe{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=Z(),this.calendarRef=Z(),this.handleDocumentClick=e=>{if(!this.open)return;const t=e.composedPath(),n=this.parentElement,i=this.popupRef.value;!t.includes(this)&&!t.includes(i)&&!(n&&t.includes(n))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}updated(e){super.updated(e),e.has("open")&&(this.open?(this._hasBeenOpened=!0,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)):(document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var e;this.open=!0,(e=this.calendarRef.value)==null||e.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){var t;return!!e&&!!((t=this.popupRef.value)!=null&&t.contains(e))}focusOnCurrentDate(){const e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate=="function"&&e.focusOnCurrentDate()}addToSelected(e,t,n){if(this.calendarRef.value&&typeof Pi.addToSelected=="function")return Pi.addToSelected(e,this.calendarRef,t,n);const i=e.target;if(!i.value)return;const r=t?At(t):null,a=n?At(n):null,l=At(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&this.handleDateSelect(l),i.value=""}handleDateSelect(e){const t=this.calendarRef.value;if(t&&typeof t.handleDateSelect=="function")return t.handleDateSelect(e);const n=at(e),i=this.selected.indexOf(n)>=0?this.selected.filter(r=>r!==n):[...this.selected,n];this.selected=i,this.dispatchEvent(new CustomEvent("date-selected",{detail:i,bubbles:!0,composed:!0}))}render(){const e={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return y`
775
+ `}};Gn([u({type:Array})],pn.prototype,"dates",2),Gn([u({type:String})],pn.prototype,"dateformat",2),Gn([u({type:String,attribute:"class"})],pn.prototype,"className",2),Gn([u({type:String,attribute:"id-base"})],pn.prototype,"idBase",2),pn=Gn([ge("pkt-date-tags")],pn);const Sh={dateformat:{default:"dd.MM.yyyy"},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},Xn={props:Sh},Hs=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Ch=()=>Hs()?"text":"date",Th=s=>!s||s.length!==2?!0:hd(s[0],s[1]),Nh=s=>io(s),Mh=(s,e,t,n,i)=>dd(s,e,t,n,i),Dh=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),Oh=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),Eh=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),Ph=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Ah=(s,e,t=!1)=>{var n;if(!s||!e)return;const i=((n=e.parentElement)==null?void 0:n.getBoundingClientRect())||e.getBoundingClientRect(),r=t?i.height+30:i.height,a=s.getBoundingClientRect().height;let l=t?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(l=`calc(100% - ${r}px - ${a}px)`),s.style.top=l},Ih=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Lh=(s,e)=>{const{key:t}=s;(t==="Enter"||t===" "||t==="Space")&&(s.preventDefault(),e(s))},yo={validateRangeOrder:Th,sortDates:Nh,filterSelectableDates:Mh},Bh={getInputType:Ch},Qn={submitForm(s){var e;const t=(e=s.internals)==null?void 0:e.form;t&&t.requestSubmit()},submitFormOrFallback(s,e){const t=s==null?void 0:s.form;t?t.requestSubmit():e()},validateDateInput(s,e,t,n,i){var r,a,l,c;const p=s.value;p&&(t&&t>p?e.setValidity({rangeUnderflow:!0},((a=(r=i==null?void 0:i.forms)==null?void 0:r.messages)==null?void 0:a.rangeUnderflow)||"Value is below minimum",s):n&&n<p&&e.setValidity({rangeOverflow:!0},((c=(l=i==null?void 0:i.forms)==null?void 0:l.messages)==null?void 0:c.rangeOverflow)||"Value is above maximum",s))}},Pi={addToSelected(s,e,t,n){const i=s.target;if(!i.value)return;const r=t?At(t):null,a=n?At(n):null,l=At(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&e.value&&e.value.handleDateSelect(l),i.value=""},handleCalendarPosition(s,e,t=!1){Ah(s.value??null,e.value??null,t)}},xr={getInputClasses:Dh,getButtonClasses:Oh,getRangeLabelClasses:Eh},Sr={processDateSelection:Ph,updateInputValues(s,e,t,n,i,r){s.value&&(n&&e!=null&&e.value?(s.value.value=t[0]??"",e.value.value=t[1]??"",r(s.value),r(e.value)):i||(s.value.value=t.length?t[0]:"",r(s.value)))},processRangeBlur(s,e,t,n,i){var r;const a=s.target;if(a.value){i(a);const l=ys(a.value);l&&((r=t==null?void 0:t.value)==null||r.handleDateSelect(l))}else e[0]&&n()}},Ai={handleInputKeydown:Ih,handleButtonKeydown:Lh};var Fh=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,_t=(s,e,t,n)=>{for(var i=n>1?void 0:n?Vh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Fh(e,t,i),i};let kt=class extends Oe{constructor(){super(...arguments),this.open=!1,this.multiple=!1,this.range=!1,this.weeknumbers=!1,this.withcontrols=!1,this.maxMultiple=null,this.selected=[],this.earliest=null,this.latest=null,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this._hasBeenOpened=!1,this.popupRef=Q(),this.calendarRef=Q(),this.handleDocumentClick=e=>{if(!this.open)return;const t=e.composedPath(),n=this.parentElement,i=this.popupRef.value;!t.includes(this)&&!t.includes(i)&&!(n&&t.includes(n))&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))},this.handleDocumentKeydown=e=>{this.open&&e.key==="Escape"&&(this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}}firstUpdated(){this.calRef=this.calendarRef}updated(e){super.updated(e),e.has("open")&&(this.open?(this._hasBeenOpened=!0,document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("click",this.handleDocumentClick)):(document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("keydown",this.handleDocumentKeydown)}show(){var e;this.open=!0,(e=this.calendarRef.value)==null||e.focus()}hide(){this.open=!1}toggle(){this.open?this.hide():this.show()}contains(e){var t;return!!e&&!!((t=this.popupRef.value)!=null&&t.contains(e))}focusOnCurrentDate(){const e=this.calendarRef.value;e&&typeof e.focusOnCurrentDate=="function"&&e.focusOnCurrentDate()}addToSelected(e,t,n){if(this.calendarRef.value&&typeof Pi.addToSelected=="function")return Pi.addToSelected(e,this.calendarRef,t,n);const i=e.target;if(!i.value)return;const r=t?At(t):null,a=n?At(n):null,l=At(i.value.split(",")[0]);l&&!isNaN(l.getTime())&&(!r||l>=r)&&(!a||l<=a)&&this.handleDateSelect(l),i.value=""}handleDateSelect(e){const t=this.calendarRef.value;if(t&&typeof t.handleDateSelect=="function")return t.handleDateSelect(e);const n=at(e),i=this.selected.indexOf(n)>=0?this.selected.filter(r=>r!==n):[...this.selected,n];this.selected=i,this.dispatchEvent(new CustomEvent("date-selected",{detail:i,bubbles:!0,composed:!0}))}render(){const e={"pkt-calendar-popup":!0,show:this.open,hide:!this.open};return y`
776
776
  <div
777
777
  class="${z(e)}"
778
- ${X(this.popupRef)}
778
+ ${G(this.popupRef)}
779
779
  id="date-popup"
780
780
  ?hidden=${!this.open}
781
781
  aria-hidden="${!this.open}"
782
782
  >
783
783
  ${this.open||this._hasBeenOpened?y`<pkt-calendar
784
- ${X(this.calendarRef)}
784
+ ${G(this.calendarRef)}
785
785
  ?multiple=${this.multiple}
786
786
  ?range=${this.range}
787
787
  ?weeknumbers=${this.weeknumbers}
@@ -798,7 +798,7 @@
798
798
  @close=${()=>{this.hide(),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}
799
799
  ></pkt-calendar>`:x}
800
800
  </div>
801
- `}};_t([u({type:Boolean,reflect:!0})],kt.prototype,"open",2),_t([u({type:Boolean})],kt.prototype,"multiple",2),_t([u({type:Boolean})],kt.prototype,"range",2),_t([u({type:Boolean})],kt.prototype,"weeknumbers",2),_t([u({type:Boolean})],kt.prototype,"withcontrols",2),_t([u({type:Number})],kt.prototype,"maxMultiple",2),_t([u({type:Array})],kt.prototype,"selected",2),_t([u({type:String})],kt.prototype,"earliest",2),_t([u({type:String})],kt.prototype,"latest",2),_t([u({type:Array})],kt.prototype,"excludedates",2),_t([u({type:Array})],kt.prototype,"excludeweekdays",2),_t([u({type:String})],kt.prototype,"currentmonth",2),_t([u({type:String})],kt.prototype,"today",2),_t([ce()],kt.prototype,"_hasBeenOpened",2),kt=_t([ge("pkt-datepicker-popup")],kt);var Uh=Object.defineProperty,ds=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Uh(e,t,i),i};let Bt=class extends Oe{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=Z(),this.btnRef=Z()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return y`
801
+ `}};_t([u({type:Boolean,reflect:!0})],kt.prototype,"open",2),_t([u({type:Boolean})],kt.prototype,"multiple",2),_t([u({type:Boolean})],kt.prototype,"range",2),_t([u({type:Boolean})],kt.prototype,"weeknumbers",2),_t([u({type:Boolean})],kt.prototype,"withcontrols",2),_t([u({type:Number})],kt.prototype,"maxMultiple",2),_t([u({type:Array})],kt.prototype,"selected",2),_t([u({type:String})],kt.prototype,"earliest",2),_t([u({type:String})],kt.prototype,"latest",2),_t([u({type:Array})],kt.prototype,"excludedates",2),_t([u({type:Array})],kt.prototype,"excludeweekdays",2),_t([u({type:String})],kt.prototype,"currentmonth",2),_t([u({type:String})],kt.prototype,"today",2),_t([ce()],kt.prototype,"_hasBeenOpened",2),kt=_t([ge("pkt-datepicker-popup")],kt);var Uh=Object.defineProperty,ds=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Uh(e,t,i),i};let Bt=class extends Oe{constructor(){super(...arguments),this.inputType="date",this.id="",this.readonly=!1,this.disabled=!1,this.inputClasses={},this.inputRef=Q(),this.btnRef=Q()}get inputElement(){return this.inputRef.value}get buttonElement(){return this.btnRef.value}get isInputReadonly(){return this.readonly||this.inputType==="text"}dispatchToggleCalendar(e){this.readonly||this.dispatchEvent(new CustomEvent("toggle-calendar",{detail:e,bubbles:!0,composed:!0}))}dispatchInput(e){this.dispatchEvent(new CustomEvent("input-change",{detail:e,bubbles:!0,composed:!0}))}dispatchFocus(){this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0}))}dispatchBlur(e){this.dispatchEvent(new CustomEvent("input-blur",{detail:e,bubbles:!0,composed:!0}))}dispatchChange(e){this.dispatchEvent(new CustomEvent("input-changed",{detail:e,bubbles:!0,composed:!0}))}renderCalendarButton(){var e;return y`
802
802
  <button
803
803
  class="${z(xr.getButtonClasses())}"
804
804
  type="button"
@@ -830,11 +830,11 @@
830
830
  @focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
831
831
  @blur=${e=>{this.dispatchBlur(e),this.dispatchManageValidity(e.target),this.dispatchEvent(new CustomEvent("value-change",{detail:e.target.value,bubbles:!0,composed:!0}))}}
832
832
  @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
833
- ${X(this.inputRef)}
833
+ ${G(this.inputRef)}
834
834
  />
835
835
  ${this.renderCalendarButton()}
836
836
  </div>
837
- `}};Cr([u({type:String})],Ii.prototype,"value",2),Cr([u({type:Object})],Ii.prototype,"strings",2),Ii=Cr([ge("pkt-datepicker-single")],Ii);var qh=Object.defineProperty,Wh=Object.getOwnPropertyDescriptor,Zn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Wh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qh(e,t,i),i};let fn=class extends Bt{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=wh,this.inputRefTo=Z()}get inputElementTo(){return this.inputRefTo.value}render(){var e,t,n,i;const r=xr.getRangeLabelClasses(this.showRangeLabels);return y`
837
+ `}};Cr([u({type:String})],Ii.prototype,"value",2),Cr([u({type:Object})],Ii.prototype,"strings",2),Ii=Cr([ge("pkt-datepicker-single")],Ii);var qh=Object.defineProperty,Wh=Object.getOwnPropertyDescriptor,Zn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Wh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qh(e,t,i),i};let fn=class extends Bt{constructor(){super(...arguments),this.value=[],this.label="",this.showRangeLabels=!1,this.strings=wh,this.inputRefTo=Q()}get inputElementTo(){return this.inputRefTo.value}render(){var e,t,n,i;const r=xr.getRangeLabelClasses(this.showRangeLabels);return y`
838
838
  <div class="pkt-input__container">
839
839
  ${this.showRangeLabels?y` <div class="pkt-input-prefix">${(e=this.strings.generic)==null?void 0:e.from}</div> `:x}
840
840
  <input
@@ -855,7 +855,7 @@
855
855
  @focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
856
856
  @blur=${a=>{this.dispatchBlur(a),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:a,values:this.value,inputType:"from"},bubbles:!0,composed:!0}))}}
857
857
  @change=${a=>{this.dispatchChange(a),a.stopImmediatePropagation()}}
858
- ${X(this.inputRef)}
858
+ ${G(this.inputRef)}
859
859
  />
860
860
  <div class="${z(r)}" id="${this.id}-to-label">
861
861
  ${(n=this.strings.generic)==null?void 0:n.to}
@@ -879,7 +879,7 @@
879
879
  @focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
880
880
  @blur=${a=>{this.dispatchBlur(a),this.dispatchEvent(new CustomEvent("range-blur",{detail:{event:a,values:this.value,inputType:"to"},bubbles:!0,composed:!0}))}}
881
881
  @change=${a=>{this.dispatchChange(a),a.stopImmediatePropagation()}}
882
- ${X(this.inputRefTo)}
882
+ ${G(this.inputRefTo)}
883
883
  />
884
884
  ${this.renderCalendarButton()}
885
885
  </div>
@@ -901,11 +901,11 @@
901
901
  @focus=${()=>{this.dispatchFocus(),Hs()&&this.dispatchToggleCalendar(new Event("focus"))}}
902
902
  @keydown=${e=>Ai.handleInputKeydown(e,t=>this.dispatchToggleCalendar(t),()=>Qn.submitFormOrFallback(this.internals,()=>{var t;return(t=this.inputRef.value)==null?void 0:t.blur()}),void 0,void 0,t=>this.dispatchAddToSelected(t))}
903
903
  @change=${e=>{this.dispatchChange(e),e.stopImmediatePropagation()}}
904
- ${X(this.inputRef)}
904
+ ${G(this.inputRef)}
905
905
  />
906
906
  ${this.renderCalendarButton()}
907
907
  </div>
908
- `}};Li([u({type:Array})],Jn.prototype,"value",2),Li([u({type:Number})],Jn.prototype,"maxlength",2),Li([u({type:Object})],Jn.prototype,"strings",2),Jn=Li([ge("pkt-datepicker-multiple")],Jn);var Kh=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,lt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Gh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Kh(e,t,i),i};let nt=class extends ie{constructor(){super(),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=Z(),this._value=[],this.label="Datovelger",this.dateformat=Xn.props.dateformat.default,this.multiple=Xn.props.multiple.default,this.maxlength=null,this.range=Xn.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=Xn.props.weeknumbers.default,this.withcontrols=Xn.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=Z(),this.popupRef=Z(),this.helptextSlot=Z(),this.singleInputRef=Z(),this.rangeInputRef=Z(),this.multipleInputRef=Z(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):Pi.addToSelected(e,this.calRef,this.min,this.max)},this.slotController=new Qe(this,this.helptextSlot)}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return Bh.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone)}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(!(this._valueProcessing||e===t)){this._valueProcessing=!0;try{const n=Wn(e),i=this.multiple&&n.length>1?yo.filterSelectableDates(n,this.min,this.max,this.excludedates,this.excludeweekdays):n;if(this.range&&!yo.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const r=pd(i);if(this._valueProperty!==r&&(this._valueProperty=r),this.range&&i.length<2)return;super.valueChanged(r,t)}finally{this._valueProcessing=!1}}}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&this.valueChanged(n,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=Wn(n||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=Wn(n||"")),super.attributeChangedCallback(e,t,n)}updated(e){if(e.has("value")&&(e.has("multiple")||e.has("range"))){const t=Array.isArray(this.value)?this.value.join(","):this.value,n=e.get("value"),i=Array.isArray(n)?n.join(","):n;this.valueChanged(t,i)}e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=Wn(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(n=this.singleInputRef.value)==null?void 0:n.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(n=this.singleInputRef.value)==null?void 0:n.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return y`
908
+ `}};Li([u({type:Array})],Jn.prototype,"value",2),Li([u({type:Number})],Jn.prototype,"maxlength",2),Li([u({type:Object})],Jn.prototype,"strings",2),Jn=Li([ge("pkt-datepicker-multiple")],Jn);var Kh=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,lt=(s,e,t,n)=>{for(var i=n>1?void 0:n?Gh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Kh(e,t,i),i};let nt=class extends ie{constructor(){super(),this._valueProperty="",this._valueProcessing=!1,this.datepickerPopupRef=Q(),this._value=[],this.label="Datovelger",this.dateformat=Xn.props.dateformat.default,this.multiple=Xn.props.multiple.default,this.maxlength=null,this.range=Xn.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=Xn.props.weeknumbers.default,this.withcontrols=Xn.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.today=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.calRef=Q(),this.popupRef=Q(),this.helptextSlot=Q(),this.singleInputRef=Q(),this.rangeInputRef=Q(),this.multipleInputRef=Q(),this.addToSelected=e=>{const t=this.datepickerPopupRef.value;return t&&typeof t.addToSelected=="function"?t.addToSelected(e,this.min,this.max):Pi.addToSelected(e,this.calRef,this.min,this.max)},this.slotController=new Qe(this,this.helptextSlot)}get value(){return this._valueProperty}set value(e){const t=this._valueProperty;this._valueProperty=Array.isArray(e)?e.join(","):e||"",this.valueChanged(this._valueProperty,t),this.requestUpdate("value",t)}get inputType(){return Bh.getInputType()}connectedCallback(){super.connectedCallback(),this.timezone&&this.timezone!==window.pktTz&&(window.pktTz=this.timezone)}disconnectedCallback(){super.disconnectedCallback()}onInput(){this.dispatchEvent(new Event("input",{bubbles:!0}))}valueChanged(e,t){if(!(this._valueProcessing||e===t)){this._valueProcessing=!0;try{const n=Wn(e),i=this.multiple&&n.length>1?yo.filterSelectableDates(n,this.min,this.max,this.excludedates,this.excludeweekdays):n;if(this.range&&!yo.validateRangeOrder(i)){this._value=[],this._valueProperty="",super.valueChanged("",t);return}this._value=i;const r=pd(i);if(this._valueProperty!==r&&(this._valueProperty=r),this.range&&i.length<2)return;super.valueChanged(r,t)}finally{this._valueProcessing=!1}}}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&this.valueChanged(n,t),e==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=Wn(n||"")),e==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=Wn(n||"")),super.attributeChangedCallback(e,t,n)}updated(e){if(e.has("value")&&(e.has("multiple")||e.has("range"))){const t=Array.isArray(this.value)?this.value.join(","):this.value,n=e.get("value"),i=Array.isArray(n)?n.join(","):n;this.valueChanged(t,i)}e.has("multiple")&&(this.multiple&&!Array.isArray(this._value)?this._value=Wn(this.value):!this.multiple&&Array.isArray(this._value)&&(this._value=this._value.filter(Boolean)),!this.multiple&&!this.range&&Array.isArray(this._value)&&(this._value=[this._value[0]??""])),super.updated(e)}get inputRef(){return{value:this.currentInputElement}}get inputRefTo(){return{value:this.currentInputElementTo}}get currentInputElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.inputElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.inputElement:(n=this.singleInputRef.value)==null?void 0:n.inputElement}get currentInputElementTo(){var e;if(this.range)return(e=this.rangeInputRef.value)==null?void 0:e.inputElementTo}get currentButtonElement(){var e,t,n;return this.multiple?(e=this.multipleInputRef.value)==null?void 0:e.buttonElement:this.range?(t=this.rangeInputRef.value)==null?void 0:t.buttonElement:(n=this.singleInputRef.value)==null?void 0:n.buttonElement}get btnRef(){return{value:this.currentButtonElement}}renderInput(){return y`
909
909
  <pkt-datepicker-single
910
910
  .value=${this._value[0]??""}
911
911
  .inputType=${this.inputType}
@@ -925,7 +925,7 @@
925
925
  @manage-validity=${e=>this.manageValidity(e.detail)}
926
926
  @value-change=${e=>{this.value=e.detail}}
927
927
  @input-changed=${()=>{this.touched=!0}}
928
- ${X(this.singleInputRef)}
928
+ ${G(this.singleInputRef)}
929
929
  ></pkt-datepicker-single>
930
930
  `}renderRangeInput(){return y`
931
931
  <pkt-datepicker-range
@@ -951,7 +951,7 @@
951
951
  @validate-date-input=${e=>{Qn.validateDateInput(e.detail,this.internals,this.min,this.max,this.strings)}}
952
952
  @handle-date-select=${e=>{var t,n;const i=ys(e.detail);if(i){const r=at(i);this._value[0]!==r&&this._value[1]!==r&&((n=(t=this.calRef)==null?void 0:t.value)==null||n.handleDateSelect(i))}}}
953
953
  @input-changed=${()=>{this.touched=!0}}
954
- ${X(this.rangeInputRef)}
954
+ ${G(this.rangeInputRef)}
955
955
  ></pkt-datepicker-range>
956
956
  `}renderMultipleInput(){return y`
957
957
  <pkt-datepicker-multiple
@@ -973,7 +973,7 @@
973
973
  @input-blur=${e=>{var t;(t=this.calRef.value)!=null&&t.contains(e.detail.relatedTarget)||this.onBlur()}}
974
974
  @add-to-selected=${e=>this.addToSelected(e.detail)}
975
975
  @input-changed=${()=>{this.touched=!0}}
976
- ${X(this.multipleInputRef)}
976
+ ${G(this.multipleInputRef)}
977
977
  ></pkt-datepicker-multiple>
978
978
  `}renderCalendar(){return y`
979
979
  <pkt-datepicker-popup
@@ -993,7 +993,7 @@
993
993
  .today=${this.today}
994
994
  @date-selected=${e=>{this.value=Sr.processDateSelection(e.detail,this.multiple,this.range),this._value=e.detail,Sr.updateInputValues(this.inputRef,this.inputRefTo,this._value,this.range,this.multiple,t=>this.manageValidity(t))}}
995
995
  @close=${()=>{this.onBlur(),this.hideCalendar()}}
996
- ${X(this.datepickerPopupRef)}
996
+ ${G(this.datepickerPopupRef)}
997
997
  ></pkt-datepicker-popup>
998
998
  `}render(){return this.inputClasses=xr.getInputClasses(this.fullwidth,this.showRangeLabels,this.multiple,this.range,this.readonly,this.inputType),y`
999
999
  <pkt-input-wrapper
@@ -1020,7 +1020,7 @@
1020
1020
  .ariaDescribedBy=${this.ariaDescribedBy}
1021
1021
  class="pkt-datepicker"
1022
1022
  >
1023
- <div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
1023
+ <div class="pkt-contents" ${G(this.helptextSlot)} name="helptext" slot="helptext"></div>
1024
1024
  ${this.multiple?y`<pkt-date-tags
1025
1025
  .dates=${this._value}
1026
1026
  dateformat=${this.dateformat}
@@ -1033,13 +1033,13 @@
1033
1033
  </div>
1034
1034
  </pkt-input-wrapper>
1035
1035
  ${this.renderCalendar()}
1036
- `}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;Pi.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var e;const t=this.datepickerPopupRef.value;if(this.calendarOpen=!0,t&&typeof t.show=="function"){t.show(),Hs()&&t.focusOnCurrentDate();return}await Hd(20),this.handleCalendarPosition(),Hs()&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){const e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide=="function")return e.hide()}async toggleCalendar(e){e.preventDefault();const t=this.datepickerPopupRef.value;if(t&&typeof t.toggle=="function"){const n=!!t.open;t.toggle(),this.calendarOpen=!n;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value="",this.internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this._value,bubbles:!0,composed:!0}))}};lt([u({type:String,reflect:!0})],nt.prototype,"value",1),lt([u({type:String,reflect:!0})],nt.prototype,"label",2),lt([u({type:String})],nt.prototype,"dateformat",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"multiple",2),lt([u({type:Number,reflect:!0})],nt.prototype,"maxlength",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"range",2),lt([u({type:Boolean,attribute:"show-range-labels"})],nt.prototype,"showRangeLabels",2),lt([u({type:String,reflect:!0})],nt.prototype,"min",2),lt([u({type:String,reflect:!0})],nt.prototype,"max",2),lt([u({type:Boolean})],nt.prototype,"weeknumbers",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"withcontrols",2),lt([u({converter:cn.csvToArray})],nt.prototype,"excludedates",2),lt([u({converter:cn.csvToArray})],nt.prototype,"excludeweekdays",2),lt([u({type:String})],nt.prototype,"currentmonth",2),lt([u({type:String})],nt.prototype,"today",2),lt([u({type:Boolean,reflect:!0,attribute:"calendar-open"})],nt.prototype,"calendarOpen",2),lt([u({type:String})],nt.prototype,"timezone",2),lt([ce()],nt.prototype,"inputClasses",2),nt=lt([ge("pkt-datepicker")],nt);const Xh={href:{default:"#"},target:{default:"_self"}},_o={props:Xh};var Qh=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Zh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Qh(e,t,i),i};let js=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.href=_o.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=_o.props.target.default,this.slotController=new Qe(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return y`<a
1036
+ `}handleCalendarPosition(){const e=this.multiple&&!!this.maxlength;Pi.handleCalendarPosition(this.popupRef,this.inputRef,e)}async showCalendar(){var e;const t=this.datepickerPopupRef.value;if(this.calendarOpen=!0,t&&typeof t.show=="function"){t.show(),Hs()&&t.focusOnCurrentDate();return}await Hd(20),this.handleCalendarPosition(),Hs()&&((e=this.calRef.value)==null||e.focusOnCurrentDate())}hideCalendar(){const e=this.datepickerPopupRef.value;if(this.calendarOpen=!1,e&&typeof e.hide=="function")return e.hide()}async toggleCalendar(e){e.preventDefault();const t=this.datepickerPopupRef.value;if(t&&typeof t.toggle=="function"){const n=!!t.open;t.toggle(),this.calendarOpen=!n;return}this.calendarOpen?this.hideCalendar():this.showCalendar()}clearInputValue(){this._value=[],this.value="",this.internals.setFormValue(this.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this._value,bubbles:!0,composed:!0}))}};lt([u({type:String,reflect:!0})],nt.prototype,"value",1),lt([u({type:String,reflect:!0})],nt.prototype,"label",2),lt([u({type:String})],nt.prototype,"dateformat",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"multiple",2),lt([u({type:Number,reflect:!0})],nt.prototype,"maxlength",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"range",2),lt([u({type:Boolean,attribute:"show-range-labels"})],nt.prototype,"showRangeLabels",2),lt([u({type:String,reflect:!0})],nt.prototype,"min",2),lt([u({type:String,reflect:!0})],nt.prototype,"max",2),lt([u({type:Boolean})],nt.prototype,"weeknumbers",2),lt([u({type:Boolean,reflect:!0})],nt.prototype,"withcontrols",2),lt([u({converter:cn.csvToArray})],nt.prototype,"excludedates",2),lt([u({converter:cn.csvToArray})],nt.prototype,"excludeweekdays",2),lt([u({type:String})],nt.prototype,"currentmonth",2),lt([u({type:String})],nt.prototype,"today",2),lt([u({type:Boolean,reflect:!0,attribute:"calendar-open"})],nt.prototype,"calendarOpen",2),lt([u({type:String})],nt.prototype,"timezone",2),lt([ce()],nt.prototype,"inputClasses",2),nt=lt([ge("pkt-datepicker")],nt);const Xh={href:{default:"#"},target:{default:"_self"}},_o={props:Xh};var Qh=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Zh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Qh(e,t,i),i};let js=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.href=_o.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=_o.props.target.default,this.slotController=new Qe(this,this.defaultSlot)}render(){const e={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return y`<a
1037
1037
  class=${z(e)}
1038
1038
  href=${this.href}
1039
1039
  .target=${this.target}
1040
1040
  .rel=${this.external?"noopener noreferrer":x}
1041
- >${this.iconName?y`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${X(this.defaultSlot)}>Link</span></a
1042
- >`}};gn([u({type:String,reflect:!0})],js.prototype,"href",2),gn([u({type:String,reflect:!0})],js.prototype,"iconName",2),gn([u({type:String,reflect:!0})],js.prototype,"iconPosition",2),gn([u({type:Boolean,reflect:!0})],js.prototype,"external",2),gn([u({type:String,reflect:!0})],js.prototype,"target",2),js=gn([ge("pkt-link")],js);var Jh=Object.defineProperty,Rh=Object.getOwnPropertyDescriptor,es=(s,e,t,n)=>{for(var i=n>1?void 0:n?Rh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jh(e,t,i),i};let Wt=class extends ie{constructor(){super(),this.inputRef=Z(),this.helptextSlot=Z(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new Qe(this,this.helptextSlot)}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}updated(e){var t;super.updated(e),e.has("value")&&(this.counterCurrent=((t=this.value)==null?void 0:t.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,t=z({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return y`
1041
+ >${this.iconName?y`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${G(this.defaultSlot)}>Link</span></a
1042
+ >`}};gn([u({type:String,reflect:!0})],js.prototype,"href",2),gn([u({type:String,reflect:!0})],js.prototype,"iconName",2),gn([u({type:String,reflect:!0})],js.prototype,"iconPosition",2),gn([u({type:Boolean,reflect:!0})],js.prototype,"external",2),gn([u({type:String,reflect:!0})],js.prototype,"target",2),js=gn([ge("pkt-link")],js);var Jh=Object.defineProperty,Rh=Object.getOwnPropertyDescriptor,es=(s,e,t,n)=>{for(var i=n>1?void 0:n?Rh(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jh(e,t,i),i};let Wt=class extends ie{constructor(){super(),this.inputRef=Q(),this.helptextSlot=Q(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new Qe(this,this.helptextSlot)}attributeChangedCallback(e,t,n){e==="value"&&this.value!==t&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,t)),super.attributeChangedCallback(e,t,n)}updated(e){var t;super.updated(e),e.has("value")&&(this.counterCurrent=((t=this.value)==null?void 0:t.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,t=z({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),n=this.ariaLabelledby||`${this.id}-input-label`;return y`
1043
1043
  <pkt-input-wrapper
1044
1044
  label="${this.label}"
1045
1045
  ?counter=${this.counter}
@@ -1064,11 +1064,11 @@
1064
1064
  .tagText=${this.tagText}
1065
1065
  class="pkt-textinput"
1066
1066
  >
1067
- <div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
1067
+ <div class="pkt-contents" ${G(this.helptextSlot)} name="helptext" slot="helptext"></div>
1068
1068
  <div class="pkt-input__container">
1069
1069
  ${this.prefix?y`<div class="pkt-input-prefix">${this.prefix}</div>`:x}
1070
1070
  <input
1071
- ${X(this.inputRef)}
1071
+ ${G(this.inputRef)}
1072
1072
  class=${t}
1073
1073
  type=${this.type}
1074
1074
  name=${(this.name||this.id)+"-input"}
@@ -1190,7 +1190,7 @@
1190
1190
  `:x}
1191
1191
  </ul>
1192
1192
  </nav>
1193
- `}};qs([u({type:Object})],$s.prototype,"user",2),qs([u({type:String,attribute:"formatted-last-logged-in"})],$s.prototype,"formattedLastLoggedIn",2),qs([u({type:Object})],$s.prototype,"representing",2),qs([u({type:Array,attribute:"user-menu"})],$s.prototype,"userMenu",2),qs([u({type:Boolean,attribute:"can-change-representation",converter:xt})],$s.prototype,"canChangeRepresentation",2),qs([u({type:Boolean,attribute:"logout-on-click",converter:xt})],$s.prototype,"logoutOnClick",2),$s=qs([ge("pkt-header-user-menu")],$s);var rp=Object.defineProperty,ap=Object.getOwnPropertyDescriptor,xe=(s,e,t,n)=>{for(var i=n>1?void 0:n?ap(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rp(e,t,i),i};const op="https://punkt-cdn.oslo.kommune.no/16.0/logos/";let we=class extends Oe{constructor(){super(),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.isMobile=!1,this.isTablet=!1,this.openMenu="none",this.isHidden=!1,this.componentWidth=typeof window<"u"?window.innerWidth:0,this.hasSlotContent=!1,this.alignSlotRight=!1,this.alignSearchRight=!1,this.defaultSlot=Z(),this.headerRef=Z(),this.userContainerRef=Z(),this.slotContainerRef=Z(),this.searchContainerRef=Z(),this.slotContentRef=Z(),this.searchMenuRef=Z(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;const e=window.pageYOffset||document.documentElement.scrollTop;e<0||Math.abs(e-this.lastScrollPosition)<60||(this.isHidden=e>this.lastScrollPosition,this.lastScrollPosition=e)},this.handleClickOutside=e=>{const t=e.target;this.user&&this.openMenu==="user"&&!t.closest(".pkt-header-service__user-container")&&(this.openMenu="none"),this.openMenu==="slot"&&!t.closest(".pkt-header-service__slot-container")&&(this.openMenu="none"),this.openMenu==="search"&&!t.closest(".pkt-header-service__search-container")&&!t.closest(".pkt-header-service__search-input")&&(this.openMenu="none")},this.handleFocusOut=(e,t)=>{const n=e.relatedTarget;let i;switch(t){case"user":i=this.userContainerRef;break;case"slot":i=this.slotContainerRef;break;case"search":i=this.searchContainerRef;break;default:return}const r=i.value;r&&(!n||!r.contains(n))&&(this.openMenu="none")},this.handleEscapeKey=e=>{e.key==="Escape"&&this.openMenu!=="none"&&(e.preventDefault(),this.shouldRestoreFocus=!0,this.openMenu="none")},this.slotController=new Qe(this,this.defaultSlot)}updateSlots(e){this.hasSlotContent=e.has(null)||e.has(void 0)}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.resizeObserver)==null||e.disconnect(),window.removeEventListener("scroll",this.handleScroll),this.unlockScroll()}firstUpdated(){this.setupResizeObserver()}updated(e){if(super.updated(e),e.has("openedMenu")&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has("mobileBreakpoint")||e.has("tabletBreakpoint"))&&(this.updateIsMobile(),this.updateIsTablet()),e.has("openMenu")){const t=e.get("openMenu");this.openMenu!=="none"&&(t==="none"||t===void 0)?(document.addEventListener("mousedown",this.handleClickOutside),document.addEventListener("keydown",this.handleEscapeKey),(this.openMenu==="slot"||this.openMenu==="search")&&requestAnimationFrame(()=>{this.checkDropdownAlignment(this.openMenu)})):this.openMenu==="none"&&t!=="none"&&(document.removeEventListener("mousedown",this.handleClickOutside),document.removeEventListener("keydown",this.handleEscapeKey),this.restoreFocus())}(e.has("openMenu")||e.has("isMobile"))&&this.updateScrollLock()}setupResizeObserver(){const e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(t=>{for(const n of t)n.borderBoxSize&&n.borderBoxSize.length>0?this.componentWidth=n.borderBoxSize[0].inlineSize:this.componentWidth=n.contentRect.width,this.updateIsMobile(),this.updateIsTablet()}),this.resizeObserver.observe(e))}updateIsMobile(){this.isMobile=this.componentWidth<this.mobileBreakpoint}updateIsTablet(){this.isTablet=this.componentWidth<this.tabletBreakpoint}updateScrollLock(){this.position==="fixed"&&this.isMobile&&this.openMenu!=="none"?this.lockScroll():this.unlockScroll()}lockScroll(){const e=document.body,t=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;const n=window.innerWidth-t.clientWidth;n>0&&(e.style.paddingRight=`${n}px`),e.style.position="fixed",e.style.top=`-${this.savedScrollY}px`,e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden",t.classList.add("is-scroll-locked")}unlockScroll(){const e=document.body,t=document.documentElement;t.classList.contains("is-scroll-locked")&&(e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("right"),e.style.removeProperty("width"),e.style.removeProperty("overflow"),e.style.removeProperty("padding-right"),t.classList.remove("is-scroll-locked"),window.scrollTo({top:this.savedScrollY}))}setupScrollListener(){window.addEventListener("scroll",this.handleScroll)}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}checkDropdownAlignment(e){const t=e==="slot"?this.slotContainerRef:this.searchContainerRef,n=e==="slot"?this.slotContentRef:this.searchMenuRef;if(!t.value||!n.value||!this.isTablet||this.isMobile)return;const i=t.value.getBoundingClientRect(),r=n.value.offsetWidth,a=i.left+r>window.innerWidth;e==="slot"?this.alignSlotRight=a:this.alignSearchRight=a}handleMenuToggle(e){this.openMenu!=="none"?this.openMenu="none":(this.lastFocusedElement=document.activeElement,this.openMenu=e)}handleLogoClick(e){this.dispatchEvent(new CustomEvent("logo-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleServiceClick(e){this.dispatchEvent(new CustomEvent("service-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent("search",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchChange(e){this.dispatchEvent(new CustomEvent("search-change",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchInputChange(e){const t=e.target.value;this.handleSearchChange(t)}handleSearchKeyDown(e){e.key==="Enter"&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){var e;return sp((e=this.user)==null?void 0:e.lastLoggedIn)}get isFixed(){return this.position==="fixed"}get shouldHideOnScroll(){return this.scrollBehavior==="hide"}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement==="header"||this.logOutButtonPlacement==="both")}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement==="userMenu"||this.logOutButtonPlacement==="both")}renderLogo(){if(this.hideLogo)return x;const e=y`
1193
+ `}};qs([u({type:Object})],$s.prototype,"user",2),qs([u({type:String,attribute:"formatted-last-logged-in"})],$s.prototype,"formattedLastLoggedIn",2),qs([u({type:Object})],$s.prototype,"representing",2),qs([u({type:Array,attribute:"user-menu"})],$s.prototype,"userMenu",2),qs([u({type:Boolean,attribute:"can-change-representation",converter:xt})],$s.prototype,"canChangeRepresentation",2),qs([u({type:Boolean,attribute:"logout-on-click",converter:xt})],$s.prototype,"logoutOnClick",2),$s=qs([ge("pkt-header-user-menu")],$s);var rp=Object.defineProperty,ap=Object.getOwnPropertyDescriptor,xe=(s,e,t,n)=>{for(var i=n>1?void 0:n?ap(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rp(e,t,i),i};const op="https://punkt-cdn.oslo.kommune.no/16.0/logos/";let we=class extends Oe{constructor(){super(),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.isMobile=!1,this.isTablet=!1,this.openMenu="none",this.isHidden=!1,this.componentWidth=typeof window<"u"?window.innerWidth:0,this.hasSlotContent=!1,this.alignSlotRight=!1,this.alignSearchRight=!1,this.defaultSlot=Q(),this.headerRef=Q(),this.userContainerRef=Q(),this.slotContainerRef=Q(),this.searchContainerRef=Q(),this.slotContentRef=Q(),this.searchMenuRef=Q(),this.lastScrollPosition=0,this.savedScrollY=0,this.lastFocusedElement=null,this.shouldRestoreFocus=!1,this.handleScroll=()=>{if(!this.shouldHideOnScroll)return;const e=window.pageYOffset||document.documentElement.scrollTop;e<0||Math.abs(e-this.lastScrollPosition)<60||(this.isHidden=e>this.lastScrollPosition,this.lastScrollPosition=e)},this.handleClickOutside=e=>{const t=e.target;this.user&&this.openMenu==="user"&&!t.closest(".pkt-header-service__user-container")&&(this.openMenu="none"),this.openMenu==="slot"&&!t.closest(".pkt-header-service__slot-container")&&(this.openMenu="none"),this.openMenu==="search"&&!t.closest(".pkt-header-service__search-container")&&!t.closest(".pkt-header-service__search-input")&&(this.openMenu="none")},this.handleFocusOut=(e,t)=>{const n=e.relatedTarget;let i;switch(t){case"user":i=this.userContainerRef;break;case"slot":i=this.slotContainerRef;break;case"search":i=this.searchContainerRef;break;default:return}const r=i.value;r&&(!n||!r.contains(n))&&(this.openMenu="none")},this.handleEscapeKey=e=>{e.key==="Escape"&&this.openMenu!=="none"&&(e.preventDefault(),this.shouldRestoreFocus=!0,this.openMenu="none")},this.slotController=new Qe(this,this.defaultSlot)}updateSlots(e){this.hasSlotContent=e.has(null)||e.has(void 0)}connectedCallback(){super.connectedCallback(),this.setupScrollListener()}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.resizeObserver)==null||e.disconnect(),window.removeEventListener("scroll",this.handleScroll),this.unlockScroll()}firstUpdated(){this.setupResizeObserver()}updated(e){if(super.updated(e),e.has("openedMenu")&&this.openedMenu!==this.openMenu&&(this.openMenu=this.openedMenu),(e.has("mobileBreakpoint")||e.has("tabletBreakpoint"))&&(this.updateIsMobile(),this.updateIsTablet()),e.has("openMenu")){const t=e.get("openMenu");this.openMenu!=="none"&&(t==="none"||t===void 0)?(document.addEventListener("mousedown",this.handleClickOutside),document.addEventListener("keydown",this.handleEscapeKey),(this.openMenu==="slot"||this.openMenu==="search")&&requestAnimationFrame(()=>{this.checkDropdownAlignment(this.openMenu)})):this.openMenu==="none"&&t!=="none"&&(document.removeEventListener("mousedown",this.handleClickOutside),document.removeEventListener("keydown",this.handleEscapeKey),this.restoreFocus())}(e.has("openMenu")||e.has("isMobile"))&&this.updateScrollLock()}setupResizeObserver(){const e=this.headerRef.value;e&&(this.componentWidth=e.offsetWidth,this.updateIsMobile(),this.updateIsTablet(),this.resizeObserver=new ResizeObserver(t=>{for(const n of t)n.borderBoxSize&&n.borderBoxSize.length>0?this.componentWidth=n.borderBoxSize[0].inlineSize:this.componentWidth=n.contentRect.width,this.updateIsMobile(),this.updateIsTablet()}),this.resizeObserver.observe(e))}updateIsMobile(){this.isMobile=this.componentWidth<this.mobileBreakpoint}updateIsTablet(){this.isTablet=this.componentWidth<this.tabletBreakpoint}updateScrollLock(){this.position==="fixed"&&this.isMobile&&this.openMenu!=="none"?this.lockScroll():this.unlockScroll()}lockScroll(){const e=document.body,t=document.documentElement;this.savedScrollY=window.scrollY||window.pageYOffset;const n=window.innerWidth-t.clientWidth;n>0&&(e.style.paddingRight=`${n}px`),e.style.position="fixed",e.style.top=`-${this.savedScrollY}px`,e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden",t.classList.add("is-scroll-locked")}unlockScroll(){const e=document.body,t=document.documentElement;t.classList.contains("is-scroll-locked")&&(e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("right"),e.style.removeProperty("width"),e.style.removeProperty("overflow"),e.style.removeProperty("padding-right"),t.classList.remove("is-scroll-locked"),window.scrollTo({top:this.savedScrollY}))}setupScrollListener(){window.addEventListener("scroll",this.handleScroll)}restoreFocus(){this.shouldRestoreFocus&&this.lastFocusedElement&&document.contains(this.lastFocusedElement)&&this.lastFocusedElement.focus(),this.lastFocusedElement=null,this.shouldRestoreFocus=!1}checkDropdownAlignment(e){const t=e==="slot"?this.slotContainerRef:this.searchContainerRef,n=e==="slot"?this.slotContentRef:this.searchMenuRef;if(!t.value||!n.value||!this.isTablet||this.isMobile)return;const i=t.value.getBoundingClientRect(),r=n.value.offsetWidth,a=i.left+r>window.innerWidth;e==="slot"?this.alignSlotRight=a:this.alignSearchRight=a}handleMenuToggle(e){this.openMenu!=="none"?this.openMenu="none":(this.lastFocusedElement=document.activeElement,this.openMenu=e)}handleLogoClick(e){this.dispatchEvent(new CustomEvent("logo-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleServiceClick(e){this.dispatchEvent(new CustomEvent("service-click",{bubbles:!0,composed:!0,detail:{originalEvent:e}}))}handleLogout(){this.dispatchEvent(new CustomEvent("log-out",{bubbles:!0,composed:!0}))}handleSearch(e){this.dispatchEvent(new CustomEvent("search",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchChange(e){this.dispatchEvent(new CustomEvent("search-change",{detail:{query:e},bubbles:!0,composed:!0}))}handleSearchInputChange(e){const t=e.target.value;this.handleSearchChange(t)}handleSearchKeyDown(e){e.key==="Enter"&&this.handleSearch(e.target.value)}get formattedLastLoggedIn(){var e;return sp((e=this.user)==null?void 0:e.lastLoggedIn)}get isFixed(){return this.position==="fixed"}get shouldHideOnScroll(){return this.scrollBehavior==="hide"}get showLogoutInHeader(){return this.hasLogOut&&(this.logOutButtonPlacement==="header"||this.logOutButtonPlacement==="both")}get showLogoutInUserMenu(){return this.hasLogOut&&(this.logOutButtonPlacement==="userMenu"||this.logOutButtonPlacement==="both")}renderLogo(){if(this.hideLogo)return x;const e=y`
1194
1194
  <pkt-icon name="oslologo" aria-hidden="true" path=${op}></pkt-icon>
1195
1195
  `;return this.logoLink&&typeof this.logoLink=="string"?y`
1196
1196
  <span class="pkt-header-service__logo">
@@ -1237,7 +1237,7 @@
1237
1237
  <div
1238
1238
  class=${e}
1239
1239
  @focusout=${n=>this.handleFocusOut(n,"slot")}
1240
- ${X(this.slotContainerRef)}
1240
+ ${G(this.slotContainerRef)}
1241
1241
  >
1242
1242
  ${this.isTablet&&this.hasSlotContent?y`
1243
1243
  <pkt-button
@@ -1259,15 +1259,15 @@
1259
1259
  id="mobile-slot-menu"
1260
1260
  role=${this.isTablet?"menu":x}
1261
1261
  aria-label=${this.isTablet?"Meny":x}
1262
- ${X(this.slotContentRef)}
1263
- ${X(this.defaultSlot)}
1262
+ ${G(this.slotContentRef)}
1263
+ ${G(this.defaultSlot)}
1264
1264
  ></div>
1265
1265
  </div>
1266
1266
  `}renderSearch(){if(!this.showSearch)return x;if(this.isTablet){const e=z({"pkt-header-service__search-container":!0,"is-open":this.openMenu==="search"}),t=z({"pkt-header-service__mobile-menu":!0,"is-open":this.openMenu==="search","align-right":this.alignSearchRight});return y`
1267
1267
  <div
1268
1268
  class=${e}
1269
1269
  @focusout=${n=>this.handleFocusOut(n,"search")}
1270
- ${X(this.searchContainerRef)}
1270
+ ${G(this.searchContainerRef)}
1271
1271
  >
1272
1272
  <pkt-button
1273
1273
  skin="secondary"
@@ -1282,7 +1282,7 @@
1282
1282
  >
1283
1283
  Søk
1284
1284
  </pkt-button>
1285
- <div class=${t} ${X(this.searchMenuRef)}>
1285
+ <div class=${t} ${G(this.searchMenuRef)}>
1286
1286
  ${this.openMenu==="search"?y`
1287
1287
  <pkt-textinput
1288
1288
  id="mobile-search-menu"
@@ -1316,7 +1316,7 @@
1316
1316
  <div
1317
1317
  class="pkt-header-service__user-container"
1318
1318
  @focusout=${n=>this.handleFocusOut(n,"user")}
1319
- ${X(this.userContainerRef)}
1319
+ ${G(this.userContainerRef)}
1320
1320
  >
1321
1321
  <pkt-button
1322
1322
  class=${z({"pkt-header-service__user-button":!0,"pkt-header-service__user-button--mobile":this.isMobile})}
@@ -1347,7 +1347,7 @@
1347
1347
  `:x}
1348
1348
  </div>
1349
1349
  `}renderHeader(){const e=z({"pkt-header-service":!0,"pkt-header-service--compact":this.compact,"pkt-header-service--mobile":this.isMobile,"pkt-header-service--tablet":this.isTablet,"pkt-header-service--fixed":this.isFixed,"pkt-header-service--scroll-to-hide":this.shouldHideOnScroll,"pkt-header-service--hidden":this.isHidden}),t=z({"pkt-header-service__logo-area":!0,"pkt-header-service__logo-area--without-service":!this.serviceName});return y`
1350
- <header class=${e} ${X(this.headerRef)}>
1350
+ <header class=${e} ${G(this.headerRef)}>
1351
1351
  <div class=${t}>${this.renderLogo()} ${this.renderServiceName()}</div>
1352
1352
 
1353
1353
  <div class="pkt-header-service__content">
@@ -1385,7 +1385,7 @@
1385
1385
  ${e}
1386
1386
  <div class=${t}></div>
1387
1387
  </div>
1388
- `}return e}};xe([u({type:String,attribute:"service-name"})],we.prototype,"serviceName",2),xe([u({type:String,attribute:"service-link"})],we.prototype,"serviceLink",2),xe([u({type:String,attribute:"logo-link"})],we.prototype,"logoLink",2),xe([u({type:String,attribute:"search-placeholder"})],we.prototype,"searchPlaceholder",2),xe([u({type:String,attribute:"search-value"})],we.prototype,"searchValue",2),xe([u({type:Number,attribute:"mobile-breakpoint"})],we.prototype,"mobileBreakpoint",2),xe([u({type:Number,attribute:"tablet-breakpoint"})],we.prototype,"tabletBreakpoint",2),xe([u({type:String,attribute:"opened-menu"})],we.prototype,"openedMenu",2),xe([u({type:String,attribute:"log-out-button-placement"})],we.prototype,"logOutButtonPlacement",2),xe([u({type:String})],we.prototype,"position",2),xe([u({type:String,attribute:"scroll-behavior"})],we.prototype,"scrollBehavior",2),xe([u({type:String,attribute:"slot-menu-variant"})],we.prototype,"slotMenuVariant",2),xe([u({type:String,attribute:"slot-menu-text"})],we.prototype,"slotMenuText",2),xe([u({type:Boolean,attribute:"hide-logo",converter:xt})],we.prototype,"hideLogo",2),xe([u({type:Boolean,converter:xt})],we.prototype,"compact",2),xe([u({type:Boolean,attribute:"show-search",converter:xt})],we.prototype,"showSearch",2),xe([u({type:Boolean,attribute:"can-change-representation",converter:xt})],we.prototype,"canChangeRepresentation",2),xe([u({type:Boolean,attribute:"has-log-out",converter:xt})],we.prototype,"hasLogOut",2),xe([u({type:Object})],we.prototype,"user",2),xe([u({type:Array,attribute:"user-menu"})],we.prototype,"userMenu",2),xe([u({type:Object})],we.prototype,"representing",2),xe([ce()],we.prototype,"isMobile",2),xe([ce()],we.prototype,"isTablet",2),xe([ce()],we.prototype,"openMenu",2),xe([ce()],we.prototype,"isHidden",2),xe([ce()],we.prototype,"componentWidth",2),xe([ce()],we.prototype,"hasSlotContent",2),xe([ce()],we.prototype,"alignSlotRight",2),xe([ce()],we.prototype,"alignSearchRight",2),we=xe([ge("pkt-header-service")],we);var lp=Object.defineProperty,cp=Object.getOwnPropertyDescriptor,qe=(s,e,t,n)=>{for(var i=n>1?void 0:n?cp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&lp(e,t,i),i};let Ve=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.slotController=new Qe(this,this.defaultSlot)}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn("[PktHeader] userMenuFooter is deprecated. Use userMenu instead."),this.userOptions!==void 0&&console.warn("[PktHeader] userOptions is deprecated. Use userMenu instead.")}get effectiveUserMenu(){const e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}render(){return y`
1388
+ `}return e}};xe([u({type:String,attribute:"service-name"})],we.prototype,"serviceName",2),xe([u({type:String,attribute:"service-link"})],we.prototype,"serviceLink",2),xe([u({type:String,attribute:"logo-link"})],we.prototype,"logoLink",2),xe([u({type:String,attribute:"search-placeholder"})],we.prototype,"searchPlaceholder",2),xe([u({type:String,attribute:"search-value"})],we.prototype,"searchValue",2),xe([u({type:Number,attribute:"mobile-breakpoint"})],we.prototype,"mobileBreakpoint",2),xe([u({type:Number,attribute:"tablet-breakpoint"})],we.prototype,"tabletBreakpoint",2),xe([u({type:String,attribute:"opened-menu"})],we.prototype,"openedMenu",2),xe([u({type:String,attribute:"log-out-button-placement"})],we.prototype,"logOutButtonPlacement",2),xe([u({type:String})],we.prototype,"position",2),xe([u({type:String,attribute:"scroll-behavior"})],we.prototype,"scrollBehavior",2),xe([u({type:String,attribute:"slot-menu-variant"})],we.prototype,"slotMenuVariant",2),xe([u({type:String,attribute:"slot-menu-text"})],we.prototype,"slotMenuText",2),xe([u({type:Boolean,attribute:"hide-logo",converter:xt})],we.prototype,"hideLogo",2),xe([u({type:Boolean,converter:xt})],we.prototype,"compact",2),xe([u({type:Boolean,attribute:"show-search",converter:xt})],we.prototype,"showSearch",2),xe([u({type:Boolean,attribute:"can-change-representation",converter:xt})],we.prototype,"canChangeRepresentation",2),xe([u({type:Boolean,attribute:"has-log-out",converter:xt})],we.prototype,"hasLogOut",2),xe([u({type:Object})],we.prototype,"user",2),xe([u({type:Array,attribute:"user-menu"})],we.prototype,"userMenu",2),xe([u({type:Object})],we.prototype,"representing",2),xe([ce()],we.prototype,"isMobile",2),xe([ce()],we.prototype,"isTablet",2),xe([ce()],we.prototype,"openMenu",2),xe([ce()],we.prototype,"isHidden",2),xe([ce()],we.prototype,"componentWidth",2),xe([ce()],we.prototype,"hasSlotContent",2),xe([ce()],we.prototype,"alignSlotRight",2),xe([ce()],we.prototype,"alignSearchRight",2),we=xe([ge("pkt-header-service")],we);var lp=Object.defineProperty,cp=Object.getOwnPropertyDescriptor,ze=(s,e,t,n)=>{for(var i=n>1?void 0:n?cp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&lp(e,t,i),i};let He=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.searchPlaceholder="Søk",this.searchValue="",this.mobileBreakpoint=768,this.tabletBreakpoint=1280,this.openedMenu="none",this.logOutButtonPlacement="none",this.position="fixed",this.scrollBehavior="hide",this.slotMenuVariant="icon-only",this.slotMenuText="Meny",this.hideLogo=!1,this.compact=!1,this.showSearch=!1,this.canChangeRepresentation=!1,this.hasLogOut=!1,this.slotController=new Qe(this,this.defaultSlot)}firstUpdated(e){super.firstUpdated(e),this.emitDeprecationWarnings()}emitDeprecationWarnings(){this.userMenuFooter!==void 0&&console.warn("[PktHeader] userMenuFooter is deprecated. Use userMenu instead."),this.userOptions!==void 0&&console.warn("[PktHeader] userOptions is deprecated. Use userMenu instead.")}get effectiveUserMenu(){const e=this.userMenu||[],t=this.userMenuFooter||[],n=this.userOptions||[];return t.length||n.length?[...e,...n,...t]:this.userMenu}render(){return y`
1389
1389
  <pkt-header-service
1390
1390
  service-name=${A(this.serviceName)}
1391
1391
  service-link=${A(this.serviceLink)}
@@ -1409,9 +1409,9 @@
1409
1409
  .userMenu=${this.effectiveUserMenu}
1410
1410
  .representing=${this.representing}
1411
1411
  >
1412
- <div class="pkt-contents" ${X(this.defaultSlot)}></div>
1412
+ <div class="pkt-contents" ${G(this.defaultSlot)}></div>
1413
1413
  </pkt-header-service>
1414
- `}};qe([u({type:String,attribute:"service-name"})],Ve.prototype,"serviceName",2),qe([u({type:String,attribute:"service-link"})],Ve.prototype,"serviceLink",2),qe([u({type:String,attribute:"logo-link"})],Ve.prototype,"logoLink",2),qe([u({type:String,attribute:"search-placeholder"})],Ve.prototype,"searchPlaceholder",2),qe([u({type:String,attribute:"search-value"})],Ve.prototype,"searchValue",2),qe([u({type:Number,attribute:"mobile-breakpoint"})],Ve.prototype,"mobileBreakpoint",2),qe([u({type:Number,attribute:"tablet-breakpoint"})],Ve.prototype,"tabletBreakpoint",2),qe([u({type:String,attribute:"opened-menu"})],Ve.prototype,"openedMenu",2),qe([u({type:String,attribute:"log-out-button-placement"})],Ve.prototype,"logOutButtonPlacement",2),qe([u({type:String})],Ve.prototype,"position",2),qe([u({type:String,attribute:"scroll-behavior"})],Ve.prototype,"scrollBehavior",2),qe([u({type:String,attribute:"slot-menu-variant"})],Ve.prototype,"slotMenuVariant",2),qe([u({type:String,attribute:"slot-menu-text"})],Ve.prototype,"slotMenuText",2),qe([u({type:Boolean,attribute:"hide-logo",converter:xt})],Ve.prototype,"hideLogo",2),qe([u({type:Boolean,converter:xt})],Ve.prototype,"compact",2),qe([u({type:Boolean,attribute:"show-search",converter:xt})],Ve.prototype,"showSearch",2),qe([u({type:Boolean,attribute:"can-change-representation",converter:xt})],Ve.prototype,"canChangeRepresentation",2),qe([u({type:Boolean,attribute:"has-log-out",converter:xt})],Ve.prototype,"hasLogOut",2),qe([u({type:Object})],Ve.prototype,"user",2),qe([u({type:Array,attribute:"user-menu"})],Ve.prototype,"userMenu",2),qe([u({type:Object})],Ve.prototype,"representing",2),qe([u({type:Array,attribute:"user-menu-footer"})],Ve.prototype,"userMenuFooter",2),qe([u({type:Array,attribute:"user-options"})],Ve.prototype,"userOptions",2),Ve=qe([ge("pkt-header")],Ve);var up=Object.defineProperty,dp=Object.getOwnPropertyDescriptor,Ws=(s,e,t,n)=>{for(var i=n>1?void 0:n?dp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&up(e,t,i),i};let xs=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new Qe(this,this.defaultSlot)}render(){const e=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),t=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return y`
1414
+ `}};ze([u({type:String,attribute:"service-name"})],He.prototype,"serviceName",2),ze([u({type:String,attribute:"service-link"})],He.prototype,"serviceLink",2),ze([u({type:String,attribute:"logo-link"})],He.prototype,"logoLink",2),ze([u({type:String,attribute:"search-placeholder"})],He.prototype,"searchPlaceholder",2),ze([u({type:String,attribute:"search-value"})],He.prototype,"searchValue",2),ze([u({type:Number,attribute:"mobile-breakpoint"})],He.prototype,"mobileBreakpoint",2),ze([u({type:Number,attribute:"tablet-breakpoint"})],He.prototype,"tabletBreakpoint",2),ze([u({type:String,attribute:"opened-menu"})],He.prototype,"openedMenu",2),ze([u({type:String,attribute:"log-out-button-placement"})],He.prototype,"logOutButtonPlacement",2),ze([u({type:String})],He.prototype,"position",2),ze([u({type:String,attribute:"scroll-behavior"})],He.prototype,"scrollBehavior",2),ze([u({type:String,attribute:"slot-menu-variant"})],He.prototype,"slotMenuVariant",2),ze([u({type:String,attribute:"slot-menu-text"})],He.prototype,"slotMenuText",2),ze([u({type:Boolean,attribute:"hide-logo",converter:xt})],He.prototype,"hideLogo",2),ze([u({type:Boolean,converter:xt})],He.prototype,"compact",2),ze([u({type:Boolean,attribute:"show-search",converter:xt})],He.prototype,"showSearch",2),ze([u({type:Boolean,attribute:"can-change-representation",converter:xt})],He.prototype,"canChangeRepresentation",2),ze([u({type:Boolean,attribute:"has-log-out",converter:xt})],He.prototype,"hasLogOut",2),ze([u({type:Object})],He.prototype,"user",2),ze([u({type:Array,attribute:"user-menu"})],He.prototype,"userMenu",2),ze([u({type:Object})],He.prototype,"representing",2),ze([u({type:Array,attribute:"user-menu-footer"})],He.prototype,"userMenuFooter",2),ze([u({type:Array,attribute:"user-options"})],He.prototype,"userOptions",2),He=ze([ge("pkt-header")],He);var up=Object.defineProperty,dp=Object.getOwnPropertyDescriptor,Ws=(s,e,t,n)=>{for(var i=n>1?void 0:n?dp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&up(e,t,i),i};let xs=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new Qe(this,this.defaultSlot)}render(){const e=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),t=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return y`
1415
1415
  <a
1416
1416
  href=${this.href}
1417
1417
  class=${e}
@@ -1421,9 +1421,9 @@
1421
1421
  ${this.iconName&&y`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
1422
1422
  ${this.title&&y`<div class=${t}>${this.title}</div>`}
1423
1423
 
1424
- <div class="pkt-linkcard__text" ${X(this.defaultSlot)}></div>
1424
+ <div class="pkt-linkcard__text" ${G(this.defaultSlot)}></div>
1425
1425
  </a>
1426
- `}};Ws([u({type:String,reflect:!0})],xs.prototype,"title",2),Ws([u({type:String,reflect:!0})],xs.prototype,"href",2),Ws([u({type:String,reflect:!0})],xs.prototype,"iconName",2),Ws([u({type:Boolean,reflect:!0})],xs.prototype,"external",2),Ws([u({type:Boolean,reflect:!0})],xs.prototype,"openInNewTab",2),Ws([u({type:String,reflect:!0})],xs.prototype,"skin",2),xs=Ws([ge("pkt-linkcard")],xs);var hp=Object.defineProperty,pp=Object.getOwnPropertyDescriptor,hs=(s,e,t,n)=>{for(var i=n>1?void 0:n?pp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&hp(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";let zt=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1,this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has("delay")&&this.setupLoader()}render(){const e=z({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),t=z({"pkt-contents":!0,"pkt-hide":this.isLoading});return y`<div
1426
+ `}};Ws([u({type:String,reflect:!0})],xs.prototype,"title",2),Ws([u({type:String,reflect:!0})],xs.prototype,"href",2),Ws([u({type:String,reflect:!0})],xs.prototype,"iconName",2),Ws([u({type:Boolean,reflect:!0})],xs.prototype,"external",2),Ws([u({type:Boolean,reflect:!0})],xs.prototype,"openInNewTab",2),Ws([u({type:String,reflect:!0})],xs.prototype,"skin",2),xs=Ws([ge("pkt-linkcard")],xs);var hp=Object.defineProperty,pp=Object.getOwnPropertyDescriptor,hs=(s,e,t,n)=>{for(var i=n>1?void 0:n?pp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&hp(e,t,i),i};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";let zt=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this.loadingAnimationPath=window.pktAnimationPath,this._shouldDisplayLoader=!1,this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(e){e.has("delay")&&this.setupLoader()}render(){const e=z({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),t=z({"pkt-contents":!0,"pkt-hide":this.isLoading});return y`<div
1427
1427
  role="status"
1428
1428
  aria-live="polite"
1429
1429
  aria-busy=${this.isLoading?"true":"false"}
@@ -1437,8 +1437,8 @@
1437
1437
  ></pkt-icon>
1438
1438
  ${this.message&&y`<p>${this.message}</p>`}
1439
1439
  </div>`:x}
1440
- <div class=${t} ${X(this.defaultSlot)}></div>
1441
- </div>`}getVariant(e){switch(e){case"blue":return"spinner-blue";case"rainbow":return"spinner";default:return"loader"}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};hs([u({type:Number})],zt.prototype,"delay",2),hs([u({type:Boolean})],zt.prototype,"inline",2),hs([u({type:Boolean})],zt.prototype,"isLoading",2),hs([u({type:String})],zt.prototype,"message",2),hs([u({type:String})],zt.prototype,"size",2),hs([u({type:String})],zt.prototype,"variant",2),hs([u({type:String})],zt.prototype,"loadingAnimationPath",2),hs([ce()],zt.prototype,"_shouldDisplayLoader",2),zt=hs([ge("pkt-loader")],zt);const fp={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},Tr={props:fp};var gp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,mn=(s,e,t,n)=>{for(var i=n>1?void 0:n?mp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&gp(e,t,i),i};let zs=class extends Oe{constructor(){super(),this.defaultSlot=Z(),this.closable=Tr.props.closable.default,this.compact=Tr.props.compact.default,this.title="",this.skin=Tr.props.skin.default,this._isClosed=!1,this.close=s=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:s},bubbles:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}updated(s){super.updated(s),s.has("_isClosed")&&Pa(this,"pkt-hide",this._isClosed)}render(){const s={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return y`<div class=${z(s)}>
1440
+ <div class=${t} ${G(this.defaultSlot)}></div>
1441
+ </div>`}getVariant(e){switch(e){case"blue":return"spinner-blue";case"rainbow":return"spinner";default:return"loader"}}setupLoader(){this.delay>0&&(this._shouldDisplayLoader=!1,setTimeout(()=>{this._shouldDisplayLoader=!0,this.requestUpdate()},this.delay))}};hs([u({type:Number})],zt.prototype,"delay",2),hs([u({type:Boolean})],zt.prototype,"inline",2),hs([u({type:Boolean})],zt.prototype,"isLoading",2),hs([u({type:String})],zt.prototype,"message",2),hs([u({type:String})],zt.prototype,"size",2),hs([u({type:String})],zt.prototype,"variant",2),hs([u({type:String})],zt.prototype,"loadingAnimationPath",2),hs([ce()],zt.prototype,"_shouldDisplayLoader",2),zt=hs([ge("pkt-loader")],zt);const fp={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},Tr={props:fp};var gp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,mn=(s,e,t,n)=>{for(var i=n>1?void 0:n?mp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&gp(e,t,i),i};let zs=class extends Oe{constructor(){super(),this.defaultSlot=Q(),this.closable=Tr.props.closable.default,this.compact=Tr.props.compact.default,this.title="",this.skin=Tr.props.skin.default,this._isClosed=!1,this.close=s=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:s},bubbles:!0}))},this.slotController=new Qe(this,this.defaultSlot),this._isClosed=!1}updated(s){super.updated(s),s.has("_isClosed")&&Pa(this,"pkt-hide",this._isClosed)}render(){const s={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return y`<div class=${z(s)}>
1442
1442
  ${this.closable?y`<div class="pkt-messagebox__close">
1443
1443
  <button
1444
1444
  @click=${this.close}
@@ -1449,11 +1449,11 @@
1449
1449
  </button>
1450
1450
  </div>`:x}
1451
1451
  ${this.title?y`<div class="pkt-messagebox__title">${this.title}</div>`:x}
1452
- <div class="pkt-messagebox__text" ${X(this.defaultSlot)}></div>
1453
- </div>`}};mn([u({type:Boolean,reflect:!0})],zs.prototype,"closable",2),mn([u({type:Boolean,reflect:!0})],zs.prototype,"compact",2),mn([u({type:String,reflect:!0})],zs.prototype,"title",2),mn([u({type:String,reflect:!0})],zs.prototype,"skin",2),mn([ce()],zs.prototype,"_isClosed",2),zs=mn([ge("pkt-messagebox")],zs);const bp={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},Nr={props:bp};var vp=Object.defineProperty,kp=Object.getOwnPropertyDescriptor,Yt=(s,e,t,n)=>{for(var i=n>1?void 0:n?kp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&vp(e,t,i),i};let Ot=class extends Oe{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=Nr.props.hideCloseButton.default,this.closeOnBackdropClick=Nr.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=Nr.props.size.default,this.variant="dialog",this.drawerPosition="right",this.transparentBackdrop=!1,this.defaultSlot=Z(),this.dialogRef=Z(),this._isOpen=!1,this.close=(s,e=!1)=>{var t;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0,composed:!0})),e||(t=this.dialogRef.value)==null||t.close(),this.requestUpdate()},this.showModal=(s=null)=>{var e;this._isOpen=!0,(e=this.dialogRef.value)==null||e.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var n;this.dialogRef.value&&((n=this.dialogRef.value)==null||n.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:s},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new Qe(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}async firstUpdated(s){super.firstUpdated(s),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&("document"in window&&"createElement"in document&&(await Promise.resolve().then(()=>mb).then(e=>e.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener("close",()=>{this.close(new Event("close"),!0)}))}handleKeyDown(s){s.key==="Escape"&&this.close(s)}handleBackdropClick(s){var e;this.closeOnBackdropClick&&s.target===((e=this.dialogRef)==null?void 0:e.value)&&this.close(s)}isElementInViewport(s){const e=s.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const s={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,"pkt-modal--noShadow":this.closeButtonSkin==="yellow-filled","pkt-modal--transparentBackdrop":this.transparentBackdrop??!1,[`pkt-modal--${this.size}`]:this.size!==void 0,[`pkt-modal__${this.variant}`]:this.variant!==void 0,[`pkt-modal__drawer--${this.drawerPosition}`]:this.variant==="drawer"},e={"pkt-modal__headingText":!0,"pkt-txt-24":!0},t={"pkt-modal__content":!0,"pkt-txt-18-light":!0},n=this.closeButtonSkin==="blue",i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return y`
1452
+ <div class="pkt-messagebox__text" ${G(this.defaultSlot)}></div>
1453
+ </div>`}};mn([u({type:Boolean,reflect:!0})],zs.prototype,"closable",2),mn([u({type:Boolean,reflect:!0})],zs.prototype,"compact",2),mn([u({type:String,reflect:!0})],zs.prototype,"title",2),mn([u({type:String,reflect:!0})],zs.prototype,"skin",2),mn([ce()],zs.prototype,"_isClosed",2),zs=mn([ge("pkt-messagebox")],zs);const bp={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},Nr={props:bp};var vp=Object.defineProperty,kp=Object.getOwnPropertyDescriptor,Yt=(s,e,t,n)=>{for(var i=n>1?void 0:n?kp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&vp(e,t,i),i};let Ot=class extends Oe{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=Nr.props.hideCloseButton.default,this.closeOnBackdropClick=Nr.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=Nr.props.size.default,this.variant="dialog",this.drawerPosition="right",this.transparentBackdrop=!1,this.defaultSlot=Q(),this.dialogRef=Q(),this._isOpen=!1,this.close=(s,e=!1)=>{var t;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:s},bubbles:!0,composed:!0})),e||(t=this.dialogRef.value)==null||t.close(),this.requestUpdate()},this.showModal=(s=null)=>{var e;this._isOpen=!0,(e=this.dialogRef.value)==null||e.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var n;this.dialogRef.value&&((n=this.dialogRef.value)==null||n.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:s},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new Qe(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}async firstUpdated(s){super.firstUpdated(s),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&("document"in window&&"createElement"in document&&(await Promise.resolve().then(()=>mb).then(e=>e.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener("close",()=>{this.close(new Event("close"),!0)}))}handleKeyDown(s){s.key==="Escape"&&this.close(s)}handleBackdropClick(s){var e;this.closeOnBackdropClick&&s.target===((e=this.dialogRef)==null?void 0:e.value)&&this.close(s)}isElementInViewport(s){const e=s.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const s={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,"pkt-modal--noShadow":this.closeButtonSkin==="yellow-filled","pkt-modal--transparentBackdrop":this.transparentBackdrop??!1,[`pkt-modal--${this.size}`]:this.size!==void 0,[`pkt-modal__${this.variant}`]:this.variant!==void 0,[`pkt-modal__drawer--${this.drawerPosition}`]:this.variant==="drawer"},e={"pkt-modal__headingText":!0,"pkt-txt-24":!0},t={"pkt-modal__content":!0,"pkt-txt-18-light":!0},n=this.closeButtonSkin==="blue",i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return y`
1454
1454
  <dialog
1455
1455
  class=${z(s)}
1456
- ${X(this.dialogRef)}
1456
+ ${G(this.dialogRef)}
1457
1457
  aria-labelledby="pkt-modal__headingText"
1458
1458
  aria-describedby="pkt-modal__content"
1459
1459
  @close=${r=>this.close(r,!0)}
@@ -1481,7 +1481,7 @@
1481
1481
  <div
1482
1482
  id="pkt-modal__content"
1483
1483
  class=${z(t)}
1484
- ${X(this.defaultSlot)}
1484
+ ${G(this.defaultSlot)}
1485
1485
  ></div>
1486
1486
  </div>
1487
1487
  </div>
@@ -1490,7 +1490,7 @@
1490
1490
  * @license
1491
1491
  * Copyright 2018 Google LLC
1492
1492
  * SPDX-License-Identifier: BSD-3-Clause
1493
- */const wo="important",yp=" !"+wo,_p=Es(class extends nn{constructor(s){var e;if(super(s),s.type!==Ht.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(yp);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?wo:""):t[n]=i}}return wt}});var wp=Object.defineProperty,$p=Object.getOwnPropertyDescriptor,ct=(s,e,t,n)=>{for(var i=n>1?void 0:n?$p(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&wp(e,t,i),i};let Je=class extends Oe{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=ws(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=Z(),this.progressBarRef=Z()}firstUpdated(e){super.firstUpdated(e),this.setComputedValues(),this.syncAttributes()}updated(e){super.updated(e),e.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),e.has("id")&&this.id&&(this.progressBarId=this.id),(e.has("statusType")||e.has("id")||e.has("ariaLabelledby"))&&(this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(e.has("ariaValueText")||e.has("valueCurrent")||e.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const e=this.statusType!=="none",t=this.valueMax-this.valueMin,n=this.valueCurrent/t*100,i=this.statusType==="fraction"?Math.round(n):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),r=`${this.valueCurrent} av ${t}`,a=z({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),l=z({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),c=z({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),p=z({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return y` <div
1493
+ */const wo="important",yp=" !"+wo,_p=Es(class extends nn{constructor(s){var e;if(super(s),s.type!==Ht.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(yp);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?wo:""):t[n]=i}}return wt}});var wp=Object.defineProperty,$p=Object.getOwnPropertyDescriptor,ct=(s,e,t,n)=>{for(var i=n>1?void 0:n?$p(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&wp(e,t,i),i};let Je=class extends Oe{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=ws(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=Q(),this.progressBarRef=Q()}firstUpdated(e){super.firstUpdated(e),this.setComputedValues(),this.syncAttributes()}updated(e){super.updated(e),e.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),e.has("id")&&this.id&&(this.progressBarId=this.id),(e.has("statusType")||e.has("id")||e.has("ariaLabelledby"))&&(this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(e.has("ariaValueText")||e.has("valueCurrent")||e.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const e=this.statusType!=="none",t=this.valueMax-this.valueMin,n=this.valueCurrent/t*100,i=this.statusType==="fraction"?Math.round(n):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),r=`${this.valueCurrent} av ${t}`,a=z({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),l=z({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),c=z({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),p=z({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return y` <div
1494
1494
  class="pkt-progressbar__container"
1495
1495
  .ref=${this.progressBarRef}
1496
1496
  style=${_p({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${i}%`})}
@@ -1502,11 +1502,11 @@
1502
1502
  </div>
1503
1503
 
1504
1504
  ${e?y`<div class=${c}>
1505
- <span class=${p} ${X(this.labelRef)}>
1505
+ <span class=${p} ${G(this.labelRef)}>
1506
1506
  ${this.statusType==="percentage"?`${i}%`:r}
1507
1507
  </span>
1508
1508
  </div>`:x}
1509
- </div>`}setComputedValues(){this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(e,t){t==null||t===""?this.removeAttribute(e):this.setAttribute(e,String(t))}};ct([u({type:String})],Je.prototype,"ariaLabel",2),ct([u({type:String,reflect:!0})],Je.prototype,"ariaLabelledby",2),ct([u({type:String,reflect:!0})],Je.prototype,"ariaValueText",2),ct([u({type:String})],Je.prototype,"ariaLive",2),ct([u({type:String,reflect:!0})],Je.prototype,"id",2),ct([u({type:String})],Je.prototype,"role",2),ct([u({type:String})],Je.prototype,"skin",2),ct([u({type:String})],Je.prototype,"statusPlacement",2),ct([u({type:String})],Je.prototype,"statusType",2),ct([u({type:String,reflect:!0})],Je.prototype,"title",2),ct([u({type:String})],Je.prototype,"titlePosition",2),ct([u({type:Number,reflect:!0})],Je.prototype,"valueCurrent",2),ct([u({type:Number})],Je.prototype,"valueMax",2),ct([u({type:Number})],Je.prototype,"valueMin",2),ct([ce()],Je.prototype,"labelWidth",2),ct([ce()],Je.prototype,"progressbarId",2),ct([ce()],Je.prototype,"computedAriaLabelledby",2),ct([ce()],Je.prototype,"computedAriaValueText",2),Je=ct([ge("pkt-progressbar")],Je);var xp=Object.defineProperty,Sp=Object.getOwnPropertyDescriptor,Et=(s,e,t,n)=>{for(var i=n>1?void 0:n?Sp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&xp(e,t,i),i};let St=class extends ie{constructor(){super(...arguments),this.inputRef=Z(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(s,e,t){s==="defaultChecked"&&(this._checked=this.defaultChecked),s==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(s,e,t)}render(){const s=z({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),e=z({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),t=z({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),n="pkt-tag pkt-tag--small pkt-tag--thin-text",i=()=>y`
1509
+ </div>`}setComputedValues(){this.progressbarId=this.id||ws(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(e,t){t==null||t===""?this.removeAttribute(e):this.setAttribute(e,String(t))}};ct([u({type:String})],Je.prototype,"ariaLabel",2),ct([u({type:String,reflect:!0})],Je.prototype,"ariaLabelledby",2),ct([u({type:String,reflect:!0})],Je.prototype,"ariaValueText",2),ct([u({type:String})],Je.prototype,"ariaLive",2),ct([u({type:String,reflect:!0})],Je.prototype,"id",2),ct([u({type:String})],Je.prototype,"role",2),ct([u({type:String})],Je.prototype,"skin",2),ct([u({type:String})],Je.prototype,"statusPlacement",2),ct([u({type:String})],Je.prototype,"statusType",2),ct([u({type:String,reflect:!0})],Je.prototype,"title",2),ct([u({type:String})],Je.prototype,"titlePosition",2),ct([u({type:Number,reflect:!0})],Je.prototype,"valueCurrent",2),ct([u({type:Number})],Je.prototype,"valueMax",2),ct([u({type:Number})],Je.prototype,"valueMin",2),ct([ce()],Je.prototype,"labelWidth",2),ct([ce()],Je.prototype,"progressbarId",2),ct([ce()],Je.prototype,"computedAriaLabelledby",2),ct([ce()],Je.prototype,"computedAriaValueText",2),Je=ct([ge("pkt-progressbar")],Je);var xp=Object.defineProperty,Sp=Object.getOwnPropertyDescriptor,Et=(s,e,t,n)=>{for(var i=n>1?void 0:n?Sp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&xp(e,t,i),i};let St=class extends ie{constructor(){super(...arguments),this.inputRef=Q(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(s,e,t){s==="defaultChecked"&&(this._checked=this.defaultChecked),s==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(s,e,t)}render(){const s=z({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),e=z({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),t=z({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),n="pkt-tag pkt-tag--small pkt-tag--thin-text",i=()=>y`
1510
1510
  ${this.tagText?y`<span class=${n+" pkt-tag--gray"}>${this.tagText}</span>`:x}
1511
1511
  ${this.optionalTag?y`<span class=${n+" pkt-tag--blue-light"}>${this.optionalText}</span>`:x}
1512
1512
  ${this.requiredTag?y`<span class=${n+" pkt-tag--beige"}>${this.requiredText}</span>`:x}
@@ -1526,7 +1526,7 @@
1526
1526
  ?disabled=${this.disabled}
1527
1527
  form=""
1528
1528
  name=${this.name+"-internal"}
1529
- ${X(this.inputRef)}
1529
+ ${G(this.inputRef)}
1530
1530
  @change=${this.toggleChecked}
1531
1531
  @input=${this.onInput}
1532
1532
  @blur=${this.onBlur}
@@ -1564,17 +1564,17 @@
1564
1564
  * @license
1565
1565
  * Copyright 2022 Google LLC
1566
1566
  * SPDX-License-Identifier: BSD-3-Clause
1567
- */function Mp({context:s,subscribe:e}){return(t,n)=>{typeof n=="object"?n.addInitializer((function(){new xo(this,{context:s,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new xo(i,{context:s,callback:r=>{i[n]=r},subscribe:e})}))}}const Co=Symbol("pkt-tabs-context");var Dp=Object.defineProperty,Op=Object.getOwnPropertyDescriptor,bn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Op(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Dp(e,t,i),i};let Ys=class extends Oe{constructor(){super(),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],this.tabCount=0,this.defaultSlot=Z(),this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)},this.slotController=new Qe(this,this.defaultSlot)}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has("arrowNav")||e.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(e,t){this.tabRefs[t]=e,this.tabCount=Math.max(this.tabCount,t+1)}handleClick(e){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){var n,i;this.useArrowNav&&(e.code==="ArrowLeft"&&t!==0&&((n=this.tabRefs[t-1])==null||n.focus()),e.code==="ArrowRight"&&t<this.tabCount-1&&((i=this.tabRefs[t+1])==null||i.focus()),(e.code==="ArrowDown"||e.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0})))}render(){const e=this.useArrowNav?"tablist":"navigation";return y`
1567
+ */function Mp({context:s,subscribe:e}){return(t,n)=>{typeof n=="object"?n.addInitializer((function(){new xo(this,{context:s,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new xo(i,{context:s,callback:r=>{i[n]=r},subscribe:e})}))}}const Co=Symbol("pkt-tabs-context");var Dp=Object.defineProperty,Op=Object.getOwnPropertyDescriptor,bn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Op(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Dp(e,t,i),i};let Ys=class extends Oe{constructor(){super(),this.arrowNav=!0,this.disableArrowNav=!1,this.tabRefs=[],this.tabCount=0,this.defaultSlot=Q(),this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)},this.slotController=new Qe(this,this.defaultSlot)}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}updated(e){(e.has("arrowNav")||e.has("disableArrowNav"))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}registerTab(e,t){this.tabRefs[t]=e,this.tabCount=Math.max(this.tabCount,t+1)}handleClick(e){this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){var n,i;this.useArrowNav&&(e.code==="ArrowLeft"&&t!==0&&((n=this.tabRefs[t-1])==null||n.focus()),e.code==="ArrowRight"&&t<this.tabCount-1&&((i=this.tabRefs[t+1])==null||i.focus()),(e.code==="ArrowDown"||e.code==="Space")&&this.dispatchEvent(new CustomEvent("tab-selected",{detail:{index:t},bubbles:!0,composed:!0})))}render(){const e=this.useArrowNav?"tablist":"navigation";return y`
1568
1568
  <div class="pkt-tabs">
1569
- <div class="pkt-tabs__list" role=${e} ${X(this.defaultSlot)}></div>
1569
+ <div class="pkt-tabs__list" role=${e} ${G(this.defaultSlot)}></div>
1570
1570
  </div>
1571
- `}};bn([u({type:Boolean,reflect:!0,attribute:"arrow-nav"})],Ys.prototype,"arrowNav",2),bn([u({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],Ys.prototype,"disableArrowNav",2),bn([ce()],Ys.prototype,"tabRefs",2),bn([ce()],Ys.prototype,"tabCount",2),bn([Np({context:Co}),ce()],Ys.prototype,"context",2),Ys=bn([ge("pkt-tabs")],Ys);var Ep=Object.defineProperty,Pp=Object.getOwnPropertyDescriptor,ps=(s,e,t,n)=>{for(var i=n>1?void 0:n?Pp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ep(e,t,i),i};let ts=class extends Oe{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=Z(),this.defaultSlot=Z(),this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(e){this.context&&this.context.handleKeyUp(e,this.index)}render(){var e;const t=((e=this.context)==null?void 0:e.useArrowNav)??!0,n=this.active?"active":"",i=t?"tab":void 0,r=t?this.active:void 0,a=this.active||!t?void 0:-1,l=y`
1571
+ `}};bn([u({type:Boolean,reflect:!0,attribute:"arrow-nav"})],Ys.prototype,"arrowNav",2),bn([u({type:Boolean,reflect:!0,attribute:"disable-arrow-nav"})],Ys.prototype,"disableArrowNav",2),bn([ce()],Ys.prototype,"tabRefs",2),bn([ce()],Ys.prototype,"tabCount",2),bn([Np({context:Co}),ce()],Ys.prototype,"context",2),Ys=bn([ge("pkt-tabs")],Ys);var Ep=Object.defineProperty,Pp=Object.getOwnPropertyDescriptor,ps=(s,e,t,n)=>{for(var i=n>1?void 0:n?Pp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ep(e,t,i),i};let ts=class extends Oe{constructor(){super(),this.active=!1,this.href="",this.icon="",this.controls="",this.tag="",this.tagSkin="blue",this.index=0,this.elementRef=Q(),this.defaultSlot=Q(),this.slotController=new Qe(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index)})}handleClick(){this.context&&this.context.handleClick(this.index)}handleKeyUp(e){this.context&&this.context.handleKeyUp(e,this.index)}render(){var e;const t=((e=this.context)==null?void 0:e.useArrowNav)??!0,n=this.active?"active":"",i=t?"tab":void 0,r=t?this.active:void 0,a=this.active||!t?void 0:-1,l=y`
1572
1572
  ${this.icon?y`<pkt-icon name=${this.icon} class="pkt-icon--small"></pkt-icon>`:""}
1573
- <span ${X(this.defaultSlot)}></span>
1573
+ <span ${G(this.defaultSlot)}></span>
1574
1574
  ${this.tag?y`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:""}
1575
1575
  `;return this.href?y`
1576
1576
  <a
1577
- ${X(this.elementRef)}
1577
+ ${G(this.elementRef)}
1578
1578
  href=${this.href}
1579
1579
  class="pkt-tabs__link ${n}"
1580
1580
  role=${A(i)}
@@ -1588,7 +1588,7 @@
1588
1588
  </a>
1589
1589
  `:y`
1590
1590
  <button
1591
- ${X(this.elementRef)}
1591
+ ${G(this.elementRef)}
1592
1592
  type="button"
1593
1593
  class="pkt-tabs__button pkt-link-button ${n}"
1594
1594
  role=${A(i)}
@@ -1604,7 +1604,7 @@
1604
1604
  * @license
1605
1605
  * Copyright 2020 Google LLC
1606
1606
  * SPDX-License-Identifier: BSD-3-Clause
1607
- */const Ap=Es(class extends nn{constructor(s){if(super(s),s.type!==Ht.PROPERTY&&s.type!==Ht.ATTRIBUTE&&s.type!==Ht.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ma(s))throw Error("`live` bindings can only contain a single expression")}render(s){return s}update(s,[e]){if(e===wt||e===x)return e;const t=s.element,n=s.name;if(s.type===Ht.PROPERTY){if(e===t[n])return wt}else if(s.type===Ht.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return wt}else if(s.type===Ht.ATTRIBUTE&&t.getAttribute(n)===e+"")return wt;return Oa(s),e}});var Ip=Object.defineProperty,Lp=Object.getOwnPropertyDescriptor,Rn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Lp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ip(e,t,i),i};let vn=class extends ie{constructor(){super(),this.inputRef=Z(),this.helptextSlot=Z(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0,this.slotController=new Qe(this,this.helptextSlot)}attributeChangedCallback(s,e,t){s==="value"&&this.value!==e&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}updated(s){var e;super.updated(s),s.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const s=z({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),e=this.ariaLabelledby||`${this.id}-input-label`;return y`<pkt-input-wrapper
1607
+ */const Ap=Es(class extends nn{constructor(s){if(super(s),s.type!==Ht.PROPERTY&&s.type!==Ht.ATTRIBUTE&&s.type!==Ht.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ma(s))throw Error("`live` bindings can only contain a single expression")}render(s){return s}update(s,[e]){if(e===wt||e===x)return e;const t=s.element,n=s.name;if(s.type===Ht.PROPERTY){if(e===t[n])return wt}else if(s.type===Ht.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return wt}else if(s.type===Ht.ATTRIBUTE&&t.getAttribute(n)===e+"")return wt;return Oa(s),e}});var Ip=Object.defineProperty,Lp=Object.getOwnPropertyDescriptor,Rn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Lp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ip(e,t,i),i};let vn=class extends ie{constructor(){super(),this.inputRef=Q(),this.helptextSlot=Q(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0,this.slotController=new Qe(this,this.helptextSlot)}attributeChangedCallback(s,e,t){s==="value"&&this.value!==e&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}updated(s){var e;super.updated(s),s.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const s=z({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),e=this.ariaLabelledby||`${this.id}-input-label`;return y`<pkt-input-wrapper
1608
1608
  label=${this.label}
1609
1609
  ?counter=${this.counter}
1610
1610
  ?disabled=${this.disabled}
@@ -1627,9 +1627,9 @@
1627
1627
  .tagText=${this.tagText}
1628
1628
  class="pkt-textarea"
1629
1629
  >
1630
- <div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
1630
+ <div class="pkt-contents" ${G(this.helptextSlot)} name="helptext" slot="helptext"></div>
1631
1631
  <textarea
1632
- ${X(this.inputRef)}
1632
+ ${G(this.inputRef)}
1633
1633
  class=${s}
1634
1634
  id=${this.id+"-input"}
1635
1635
  name=${(this.name||this.id)+"-input"}
@@ -1649,7 +1649,7 @@
1649
1649
  @focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
1650
1650
  @blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
1651
1651
  ></textarea>
1652
- </pkt-input-wrapper>`}};Rn([u({type:String,reflect:!0})],vn.prototype,"value",2),Rn([u({type:String})],vn.prototype,"autocomplete",2),Rn([u({type:Number})],vn.prototype,"rows",2),Rn([ce()],vn.prototype,"counterCurrent",2),vn=Rn([ge("pkt-textarea")],vn);var Bp=Object.defineProperty,To=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Bp(e,t,i),i};let Mr=class extends ie{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){var e,t;const n=this._optionsProp.length>0,i=((t=(e=this.optionsController)==null?void 0:e.nodes)==null?void 0:t.length)&&this.optionsController.nodes.length>0;n?this._options=this._optionsProp:i&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};To([u({type:Array,attribute:"options"})],Mr.prototype,"_optionsProp"),To([ce()],Mr.prototype,"_options");var Fp=Object.defineProperty,Vp=Object.getOwnPropertyDescriptor,No=(s,e,t,n)=>{for(var i=n>1?void 0:n?Vp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Fp(e,t,i),i};let Dr=class extends Mr{constructor(){super(),this.inputRef=Z(),this.helptextSlot=Z(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new mo(this),this.slotController=new Qe(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)})}add(s,e){const t={value:s.value||s.text,label:s.text||s.value,selected:s.selected,disabled:s.disabled};if(e===void 0)this._options.push(t);else if(typeof e=="number")this._options.splice(e,0,t);else{const n=e.value||e.text,i=this._options.findIndex(r=>r.value===n);i>=0?this._options.splice(i,0,t):this._options.push(t)}s.selected&&(this.value=s.value||s.text,this.selectedIndex=this._options.findIndex(n=>n.value===this.value)),this.requestUpdate()}remove(s){var e;typeof s=="number"&&(this.selectedIndex===s&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(s,1),this.requestUpdate())}item(s){var e;return(e=this.inputRef.value)==null?void 0:e.item(s)}namedItem(s){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(s)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(s,e,t){var n,i;s==="options"&&(this._options=t?JSON.parse(t):[]),s==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((n=this.inputRef.value)==null?void 0:n.selectedIndex):this._options.findIndex(r=>r.value===t),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}update(s){var e,t;super.update(s),s.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),s.has("value")&&this.value!==s.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(n=>n.value===this.value),this.selectedOptions=(t=this.inputRef.value)==null?void 0:t.selectedOptions,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(s){var e;super.firstUpdated(s),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(t=>t.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const s=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return y`
1652
+ </pkt-input-wrapper>`}};Rn([u({type:String,reflect:!0})],vn.prototype,"value",2),Rn([u({type:String})],vn.prototype,"autocomplete",2),Rn([u({type:Number})],vn.prototype,"rows",2),Rn([ce()],vn.prototype,"counterCurrent",2),vn=Rn([ge("pkt-textarea")],vn);var Bp=Object.defineProperty,To=(s,e,t,n)=>{for(var i=void 0,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=a(e,t,i)||i);return i&&Bp(e,t,i),i};let Mr=class extends ie{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(e=>({...e,selected:this.isOptionSelected(e)}))}set options(e){this._optionsProp=e,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(e){return Array.isArray(this.value)?this.value.includes(e.value):e.value===this.value}findOptionByValue(e){return this._options.find(t=>t.value===e)}getSelectedOptions(){return this._options.filter(e=>this.isOptionSelected(e))}parseOptions(){var e,t;const n=this._optionsProp.length>0,i=((t=(e=this.optionsController)==null?void 0:e.nodes)==null?void 0:t.length)&&this.optionsController.nodes.length>0;n?this._options=this._optionsProp:i&&(this._options=this.optionsController.options)}willUpdate(e){super.willUpdate(e),this.parseOptions()}};To([u({type:Array,attribute:"options"})],Mr.prototype,"_optionsProp"),To([ce()],Mr.prototype,"_options");var Fp=Object.defineProperty,Vp=Object.getOwnPropertyDescriptor,No=(s,e,t,n)=>{for(var i=n>1?void 0:n?Vp(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Fp(e,t,i),i};let Dr=class extends Mr{constructor(){super(),this.inputRef=Q(),this.helptextSlot=Q(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new mo(this),this.slotController=new Qe(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)})}add(s,e){const t={value:s.value||s.text,label:s.text||s.value,selected:s.selected,disabled:s.disabled};if(e===void 0)this._options.push(t);else if(typeof e=="number")this._options.splice(e,0,t);else{const n=e.value||e.text,i=this._options.findIndex(r=>r.value===n);i>=0?this._options.splice(i,0,t):this._options.push(t)}s.selected&&(this.value=s.value||s.text,this.selectedIndex=this._options.findIndex(n=>n.value===this.value)),this.requestUpdate()}remove(s){var e;typeof s=="number"&&(this.selectedIndex===s&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(s,1),this.requestUpdate())}item(s){var e;return(e=this.inputRef.value)==null?void 0:e.item(s)}namedItem(s){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(s)}showPicker(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(s,e,t){var n,i;s==="options"&&(this._options=t?JSON.parse(t):[]),s==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((n=this.inputRef.value)==null?void 0:n.selectedIndex):this._options.findIndex(r=>r.value===t),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.selectedOptions,this.valueChanged(t,e)),super.attributeChangedCallback(s,e,t)}update(s){var e,t;super.update(s),s.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),s.has("value")&&this.value!==s.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this._options.findIndex(n=>n.value===this.value),this.selectedOptions=(t=this.inputRef.value)==null?void 0:t.selectedOptions,this.valueChanged(this.value,s.get("value"))),s.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(s){var e;super.firstUpdated(s),this._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(t=>t.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const s=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return y`
1653
1653
  <pkt-input-wrapper
1654
1654
  ?counter=${this.counter}
1655
1655
  ?disabled=${this.disabled}
@@ -1684,7 +1684,7 @@
1684
1684
  @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
1685
1685
  @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
1686
1686
  @blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
1687
- ${X(this.inputRef)}
1687
+ ${G(this.inputRef)}
1688
1688
  >
1689
1689
  ${this._options.length>0?this._options.map(e=>y`<option
1690
1690
  value=${e.value}
@@ -1695,10 +1695,10 @@
1695
1695
  ${e.label}
1696
1696
  </option>`):""}
1697
1697
  </select>
1698
- <div class="pkt-contents" ${X(this.helptextSlot)} name="helptext" slot="helptext"></div>
1698
+ <div class="pkt-contents" ${G(this.helptextSlot)} name="helptext" slot="helptext"></div>
1699
1699
  </pkt-input-wrapper>
1700
1700
  `}returnNumberOrNull(s){return s==null||isNaN(s)?null:s}};No([u({type:String})],Dr.prototype,"value",2),Dr=No([ge("pkt-select")],Dr);const R=os({tagName:"pkt-icon",elementClass:As,react:d,displayName:"PktIcon",events:{}}),Mo=d.forwardRef(({defaultOpen:s=!1,id:e,title:t,skin:n,compact:i=!1,isOpen:r,children:a,name:l,className:c,onClick:p,onToggle:g},b)=>{const[f,k]=d.useState(s),{name:v}=Kl(),$=l||v,M=r!==void 0?r:f;d.useEffect(()=>{r===void 0&&k(s)},[s,r]);const S=D=>{const ee=D.currentTarget.open;r===void 0&&k(ee),g==null||g(D)},T=D=>{setTimeout(()=>{p==null||p(D)},0)},L=["pkt-accordion-item",i&&"pkt-accordion-item--compact",n&&`pkt-accordion-item--${n}`,c].filter(Boolean).join(" ");return o.jsxs("details",{ref:b,className:L,id:e,open:M,onClick:T,name:$,onToggle:S,children:[o.jsxs("summary",{className:"pkt-accordion-item__title",id:`pkt-accordion-item-summary-${e}`,children:[t,o.jsx(R,{name:"chevron-thin-down",className:"pkt-accordion-item__icon","aria-hidden":"true"})]}),o.jsx("div",{className:"pkt-accordion-item__content",id:`pkt-accordion-item__content-${e}`,role:"region",children:o.jsx("div",{className:"pkt-accordion-item__content-inner",children:a})})]})});Mo.displayName="PktAccordionItem";function Up(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Or={exports:{}};/*!
1701
1701
  Copyright (c) 2018 Jed Watson.
1702
1702
  Licensed under the MIT License (MIT), see
1703
1703
  http://jedwatson.github.io/classnames
1704
- */var Do;function Hp(){return Do||(Do=1,(function(s){(function(){var e={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(r=i(r,n(l)))}return r}function n(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var l in r)e.call(r,l)&&r[l]&&(a=i(a,l));return a}function i(r,a){return a?r?r+" "+a:r+a:r}s.exports?(t.default=t,s.exports=t):window.classNames=t})()})(Or)),Or.exports}var jp=Hp();const ke=Up(jp),Bi=({children:s,closeAlert:e,compact:t,title:n,date:i,ariaLive:r,"aria-live":a="polite",role:l="status",skin:c="info",className:p,...g})=>{const[b,f]=d.useState(!1),k={"pkt-alert":!0,"pkt-alert--compact":t,[`pkt-alert--${c}`]:c,"pkt-hide":b},v={"pkt-alert__grid":!0,"pkt-alert__noTitle":!n,"pkt-alert__noDate":!i},$=d.useCallback(()=>{f(!0),g.onClose&&g.onClose(new CustomEvent("close",{detail:{origin:event},bubbles:!0,composed:!0}))},[g.onClose,f]),M=r||a;return o.jsx("div",{...g,"aria-live":M,role:l,className:ke(k,p),children:o.jsxs("div",{className:ke(v),children:[o.jsx(R,{className:"pkt-alert__icon","aria-hidden":"true",name:c==="info"?"alert-information":`alert-${c}`}),e&&o.jsx("div",{className:"pkt-alert__close",children:o.jsx(gt,{tabIndex:0,"aria-label":"close",size:t?"small":"medium",type:"button",skin:"tertiary",iconName:"close",variant:"icon-only",onClick:$,children:o.jsx("span",{className:"sr-only",children:"Lukk"})})}),n&&o.jsx("div",{className:"pkt-alert__title",children:n}),o.jsx("div",{className:"pkt-alert__text",children:s}),i&&o.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",i]})]})})};Bi.displayName="PktAlert";const Oo=os({tagName:"pkt-backlink",elementClass:on,react:d,displayName:"PktBackLink"});Oo.displayName="PktBackLink";const Eo=d.forwardRef(({breadcrumbs:s,navigationType:e,renderLink:t,className:n,...i},r)=>{const a=s,l=a[a.length-2],c=[n,"pkt-breadcrumbs"].filter(Boolean).join(" "),p=t||(e==="router"?({href:g,className:b,children:f,props:k})=>o.jsx(Yl.Link,{to:g,className:b,...k,children:f}):({href:g,className:b,children:f,props:k})=>o.jsx("a",{href:g,className:b,...k,children:f}));return o.jsxs("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[o.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((g,b)=>o.jsx("li",{className:"pkt-breadcrumbs__item",children:b===a.length-1?o.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})}):p({href:g.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})]}),props:i})},`breadcrumb-${b}`))}),p({href:l.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:l.text})]}),props:i})]})});Eo.displayName="PktBreadcrumbs",window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";const gt=d.forwardRef(({children:s,className:e,iconName:t="user",secondIconName:n="user",iconPath:i,secondIconPath:r,size:a="medium",fullWidth:l=!1,fullWidthOnMobile:c=!1,skin:p="primary",type:g="button",variant:b="label-only",state:f,color:k,isLoading:v=void 0,disabled:$=void 0,loadingAnimationPath:M=window.pktAnimationPath,...S},T)=>{const L=[e,"pkt-btn",a&&`pkt-btn--${a}`,l&&"pkt-btn--full",c&&"pkt-btn--full-small",p&&`pkt-btn--${p}`,b&&`pkt-btn--${b}`,k&&`pkt-btn--${k}`,f&&`pkt-btn--${f}`,v&&"pkt-btn--isLoading"].filter(Boolean).join(" ");return o.jsxs("button",{...S,"aria-busy":v||void 0,"aria-disabled":$||void 0,disabled:$,className:L,type:g,ref:T,children:[v&&o.jsx(R,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:M}),b!=="label-only"&&o.jsx(R,{className:"pkt-btn__icon",name:t,...i&&{path:i}}),o.jsx("span",{className:"pkt-btn__text",children:s}),b==="icons-right-and-left"&&o.jsx(R,{className:"pkt-btn__icon",name:n,...r&&{path:r}})]})});gt.displayName="PktButton";const Po=6048e5,qp=864e5,Ao=Symbol.for("constructDateFrom");function ss(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Ao in s?s[Ao](e):s instanceof Date?new s.constructor(e):new Date(e)}function Ct(s,e){return ss(e||s,s)}function Io(s,e,t){const n=Ct(s,t==null?void 0:t.in);return isNaN(e)?ss(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let Wp={};function Fi(){return Wp}function ei(s,e){var l,c,p,g;const t=Fi(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((g=(p=t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??0,i=Ct(s,e==null?void 0:e.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Vi(s,e){return ei(s,{...e,weekStartsOn:1})}function Lo(s,e){const t=Ct(s,e==null?void 0:e.in),n=t.getFullYear(),i=ss(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Vi(i),a=ss(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Vi(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Bo(s){const e=Ct(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Fo(s,...e){const t=ss.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Er(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function zp(s,e,t){const[n,i]=Fo(t==null?void 0:t.in,s,e),r=Er(n),a=Er(i),l=+r-Bo(r),c=+a-Bo(a);return Math.round((l-c)/qp)}function Yp(s,e){const t=Lo(s,e),n=ss(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Vi(n)}function Kp(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Gp(s){return!(!Kp(s)&&typeof s!="number"||isNaN(+Ct(s)))}function Xp(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Qp(s,e){const[t,n]=Fo(s,e.start,e.end);return{start:t,end:n}}function Vo(s,e){const{start:t,end:n}=Qp(e==null?void 0:e.in,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(ss(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function Zp(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Jp={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"}},Rp=(s,e,t)=>{let n;const i=Jp[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Pr(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const ef={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},tf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},sf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},nf={date:Pr({formats:ef,defaultWidth:"full"}),time:Pr({formats:tf,defaultWidth:"full"}),dateTime:Pr({formats:sf,defaultWidth:"full"})},rf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},af=(s,e,t,n)=>rf[s];function ti(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const of={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lf={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},cf={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"]},uf={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"]},df={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"}},hf={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"}},pf={ordinalNumber:(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:ti({values:of,defaultWidth:"wide"}),quarter:ti({values:lf,defaultWidth:"wide",argumentCallback:s=>s-1}),month:ti({values:cf,defaultWidth:"wide"}),day:ti({values:uf,defaultWidth:"wide"}),dayPeriod:ti({values:df,defaultWidth:"wide",formattingValues:hf,defaultFormattingWidth:"wide"})};function si(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?gf(l,b=>b.test(a)):ff(l,b=>b.test(a));let p;p=s.valueCallback?s.valueCallback(c):c,p=t.valueCallback?t.valueCallback(p):p;const g=e.slice(a.length);return{value:p,rest:g}}}function ff(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function gf(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function mf(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const bf=/^(\d+)(th|st|nd|rd)?/i,vf=/\d+/i,kf={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},yf={any:[/^b/i,/^(a|c)/i]},_f={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},wf={any:[/1/i,/2/i,/3/i,/4/i]},$f={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},xf={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]},Sf={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},Cf={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]},Tf={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},Nf={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}},Mf={ordinalNumber:mf({matchPattern:bf,parsePattern:vf,valueCallback:s=>parseInt(s,10)}),era:si({matchPatterns:kf,defaultMatchWidth:"wide",parsePatterns:yf,defaultParseWidth:"any"}),quarter:si({matchPatterns:_f,defaultMatchWidth:"wide",parsePatterns:wf,defaultParseWidth:"any",valueCallback:s=>s+1}),month:si({matchPatterns:$f,defaultMatchWidth:"wide",parsePatterns:xf,defaultParseWidth:"any"}),day:si({matchPatterns:Sf,defaultMatchWidth:"wide",parsePatterns:Cf,defaultParseWidth:"any"}),dayPeriod:si({matchPatterns:Tf,defaultMatchWidth:"any",parsePatterns:Nf,defaultParseWidth:"any"})},Df={code:"en-US",formatDistance:Rp,formatLong:nf,formatRelative:af,localize:pf,match:Mf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Of(s,e){const t=Ct(s,e==null?void 0:e.in);return zp(t,Zp(t))+1}function Ef(s,e){const t=Ct(s,e==null?void 0:e.in),n=+Vi(t)-+Yp(t);return Math.round(n/Po)+1}function Uo(s,e){var g,b,f,k;const t=Ct(s,e==null?void 0:e.in),n=t.getFullYear(),i=Fi(),r=(e==null?void 0:e.firstWeekContainsDate)??((b=(g=e==null?void 0:e.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(f=i.locale)==null?void 0:f.options)==null?void 0:k.firstWeekContainsDate)??1,a=ss((e==null?void 0:e.in)||s,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=ei(a,e),c=ss((e==null?void 0:e.in)||s,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const p=ei(c,e);return+t>=+l?n+1:+t>=+p?n:n-1}function Pf(s,e){var l,c,p,g;const t=Fi(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((g=(p=t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??1,i=Uo(s,e),r=ss((e==null?void 0:e.in)||s,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),ei(r,e)}function Ho(s,e){const t=Ct(s,e==null?void 0:e.in),n=+ei(t,e)-+Pf(t,e);return Math.round(n/Po)+1}function Ce(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const Ss={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return Ce(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):Ce(t+1,2)},d(s,e){return Ce(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return Ce(s.getHours()%12||12,e.length)},H(s,e){return Ce(s.getHours(),e.length)},m(s,e){return Ce(s.getMinutes(),e.length)},s(s,e){return Ce(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return Ce(i,e.length)}},kn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jo={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return Ss.y(s,e)},Y:function(s,e,t,n){const i=Uo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Ce(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Ce(r,e.length)},R:function(s,e){const t=Lo(s);return Ce(t,e.length)},u:function(s,e){const t=s.getFullYear();return Ce(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ce(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ce(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return Ss.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ce(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=Ho(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):Ce(i,e.length)},I:function(s,e,t){const n=Ef(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Ce(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):Ss.d(s,e)},D:function(s,e,t){const n=Of(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Ce(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Ce(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Ce(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Ce(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const i=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=kn.noon:n===0?i=kn.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=kn.evening:n>=12?i=kn.afternoon:n>=4?i=kn.morning:i=kn.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return Ss.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):Ss.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Ce(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Ce(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):Ss.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):Ss.s(s,e)},S:function(s,e){return Ss.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Wo(n);case"XXXX":case"XX":return Ks(n);case"XXXXX":case"XXX":default:return Ks(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return Wo(n);case"xxxx":case"xx":return Ks(n);case"xxxxx":case"xxx":default:return Ks(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+qo(n,":");case"OOOO":default:return"GMT"+Ks(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+qo(n,":");case"zzzz":default:return"GMT"+Ks(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return Ce(n,e.length)},T:function(s,e,t){return Ce(+s,e.length)}};function qo(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+Ce(r,2)}function Wo(s,e){return s%60===0?(s>0?"-":"+")+Ce(Math.abs(s)/60,2):Ks(s,e)}function Ks(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Ce(Math.trunc(n/60),2),r=Ce(n%60,2);return t+i+e+r}const zo=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Yo=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Af={p:Yo,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return zo(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",zo(n,e)).replace("{{time}}",Yo(i,e))}},If=/^D+$/,Lf=/^Y+$/,Bf=["D","DD","YY","YYYY"];function Ff(s){return If.test(s)}function Vf(s){return Lf.test(s)}function Uf(s,e,t){const n=Hf(s,e,t);if(console.warn(n),Bf.includes(s))throw new RangeError(n)}function Hf(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const jf=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qf=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wf=/^'([^]*?)'?$/,zf=/''/g,Yf=/[a-zA-Z]/;function Kf(s,e,t){var g,b,f,k;const n=Fi(),i=n.locale??Df,r=n.firstWeekContainsDate??((b=(g=n.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??1,a=n.weekStartsOn??((k=(f=n.locale)==null?void 0:f.options)==null?void 0:k.weekStartsOn)??0,l=Ct(s,t==null?void 0:t.in);if(!Gp(l))throw new RangeError("Invalid time value");let c=e.match(qf).map(v=>{const $=v[0];if($==="p"||$==="P"){const M=Af[$];return M(v,i.formatLong)}return v}).join("").match(jf).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:Gf(v)};if(jo[$])return{isToken:!0,value:v};if($.match(Yf))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const p={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(v=>{if(!v.isToken)return v.value;const $=v.value;(Vf($)||Ff($))&&Uf($,e,String(s));const M=jo[$[0]];return M(l,$,i.localize,p)}).join("")}function Gf(s){const e=s.match(Wf);return e?e[1].replace(zf,"'"):s}function Xf(s,e){const t=Ct(s,e==null?void 0:e.in).getDay();return t===0?7:t}function Qf(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Ar={},ni={};function Gs(s,e){try{const n=(Ar[s]||(Ar[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return n in ni?ni[n]:Ko(n,n.split(":"))}catch{if(s in ni)return ni[s];const t=s==null?void 0:s.match(Zf);return t?Ko(s,t.slice(1)):NaN}}const Zf=/([+-]\d\d):?(\d\d)?/;function Ko(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return ni[s]=t*60+n>0?t*60+n+i:t*60-n-i}class ns extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gs(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)),Xo(this),Ir(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new ns(...t,e):new ns(Date.now(),e)}withTimeZone(e){return new ns(+this,e)}getTimezoneOffset(){const e=-Gs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Ir(this),+this}[Symbol.for("constructDateFrom")](e){return new ns(+new Date(e),this.timeZone)}}const Go=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Go.test(s))return;const e=s.replace(Go,"$1UTC");ns.prototype[e]&&(s.startsWith("get")?ns.prototype[s]=function(){return this.internal[e]()}:(ns.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),Jf(this),+this},ns.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Ir(this),+this}))});function Ir(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Gs(s.timeZone,s)*60))}function Jf(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),Xo(s)}function Xo(s){const e=Gs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const p=new Date(+s);p.setUTCSeconds(0);const g=i>0?p.getSeconds():(p.getSeconds()-60)%60,b=Math.round(-(Gs(s.timeZone,s)*60))%60;(b||g)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+b+g));const f=Gs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),$=-new Date(+s).getTimezoneOffset()-k,M=k!==t,S=$-c;if(M&&S){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+S);const T=Gs(s.timeZone,s),L=T>0?Math.floor(T):Math.ceil(T),D=k-L;D&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+D),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+D))}}class Cs extends ns{static tz(e,...t){return t.length?new Cs(...t,e):new Cs(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${Qf(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new Cs(+this,e)}[Symbol.for("constructDateFrom")](e){return new Cs(+new Date(e),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const Rf=(s=window.pktTz)=>{const e=new Cs(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function is(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const mt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ii=s=>{if(!s)return null;const e=is(s);return isNaN(e.getTime())?null:e},eg=(s,e)=>{const t=fs(s);return isNaN(t.getTime())?"":Kf(t,e)},fs=(s="",e)=>{const t=typeof s=="string"?is(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?Xp(t):Er(t):t},yn=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},ri=s=>{let e;return typeof s=="number"?e=new Cs(s,window.pktTz):e=new Cs(s,window.pktTz),e.setHours(12,0,0,0),e};let Lr=null,Qo;const tg=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Lr||Qo!==e)&&(Lr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),Qo=e),Lr.format(s)},sg=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?fs(e):null,i=t?fs(t):null;return!(n&&s<n||i&&s>i)},ng=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=mt(s);return e.includes(t)},ig=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},Zo=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!sg(s,e,t)||n&&ng(s,n)||i&&ig(s,i)),rg=(s,e,t,n,i)=>s.filter(r=>{const a=ii(r);return a&&Zo(a,e,t,n,i)}),ag=s=>s.slice().sort((e,t)=>{const n=ii(e),i=ii(t);return!n||!i?0:n.getTime()-i.getTime()}),og=(s,e)=>{const t=ii(s),n=ii(e);return!t||!n?!1:t<=n};function Jo(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:mt(n));return!Zo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function lg(s,e,t,n){return!!(Jo(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function cg(s,e,t){const n=yn(s,e,0);return!(t&&fs(t)>n)}function ug(s,e,t){const n=yn(e===11?s+1:s,e===11?0:e+1,1);return!(t&&fs(t)<n)}function Ro(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>is(e))}function el(s,e){const t=Vo({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[mt(r)]=a}return n}function tl(s,e,t,n){if(e.length!==1)return!0;const i=Vo({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(Xf(i[r]).toString()))return!1}return!0}function Br(s,e){const t=mt(s);return e.includes(t)?e:[...e,t]}function Fr(s,e){const t=mt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function sl(s,e,t){const n=mt(s);return e.includes(n)?Fr(s,e):t>0&&e.length>=t?e:Br(s,e)}function dg(s,e,t){const n=mt(s),i=Ro(e);if(e.includes(n))return e.indexOf(n)===0?[]:Fr(s,e);if(e.length>1)return[n];if(e.length===1){if(!tl(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return Br(s,e)}const ai=7,hg=6;function pg(s,e){const t=yn(s,e,1),n=yn(s,e+1,0),i=(t.getDay()+hg)%ai,r=n.getDate(),a=Math.ceil((r+i)/ai),c=yn(s,e,0).getDate(),p=Ho(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:c,initialWeek:p}}function fg(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function gg(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}const mg={ArrowLeft:-1,ArrowRight:1,ArrowUp:-ai,ArrowDown:ai};function bg(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function vg(s,e,t){let n=Io(s,e);if(!n)return null;let i=t(`button[data-date="${mt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=Io(n,e),i=t(`button[data-date="${mt(n)}"]`),!i)return null;return n}function kg(s){return mg[s]??null}const yg={month:"Måned",year:"År",days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"};function _g(s){const{selected:e,multiple:t=!1,maxMultiple:n=0,range:i=!1,earliest:r=null,latest:a=null,excludedates:l,excludeweekdays:c=[],weeknumbers:p=!1,withcontrols:g=!1,currentmonth:b,today:f,strings:k,onDateSelected:v,onClose:$,id:M,className:S}=s,T=d.useId(),L=M??T,D=d.useMemo(()=>({...yg,...k}),[k]),Y=d.useMemo(()=>f?is(f):Rf(),[f]),ee=d.useMemo(()=>l?l.map(m=>typeof m=="string"?is(m):m):[],[l]),oe=e!==void 0,[ye,K]=d.useState([]),N=oe?e:ye,q=d.useMemo(()=>Ro(N),[N]),[B,G]=d.useState(0),[le,ae]=d.useState(0),[pe,ue]=d.useState({}),[be,se]=d.useState(null),[re,Ue]=d.useState(null),Q=d.useRef(null),P=d.useRef([]),Me=d.useRef(0),De=d.useRef(!1),ne=d.useRef(!1),He=d.useMemo(()=>({earliest:r,latest:a,excludedates:ee,excludeweekdays:c}),[r,a,ee,c]);d.useEffect(()=>{let m=null;if(b!=null&&(b instanceof Date?m=ri(b):typeof b=="string"&&(m=is(b))),!m||isNaN(m.getTime()))if(N.length>0&&N[0]!==""){const h=is(N[N.length-1]);m=isNaN(h.getTime())?ri(Y):h}else m=ri(Y);if((!m||isNaN(m.getTime()))&&(m=ri(Y)),a){const h=typeof a=="string"?is(a):a;!isNaN(h.getTime())&&m>h&&(m=h)}if(r){const h=typeof r=="string"?is(r):r;!isNaN(h.getTime())&&m<h&&(m=h)}G(m.getFullYear()),ae(m.getMonth()),ne.current=!0},[]),d.useEffect(()=>{if(ne.current&&!De.current&&N.length>0&&N[0]!==""){const m=is(N[N.length-1]);isNaN(m.getTime())||(G(m.getFullYear()),ae(m.getMonth()))}},[N]),d.useEffect(()=>{i&&q.length===2?ue(el(q[0],q[1])):(!i||q.length<2)&&ue({})},[i,q]);const Pe=d.useCallback(m=>{oe||K(m),v==null||v(m)},[oe,v]),$e=d.useCallback(()=>{$==null||$()},[$]),Te=d.useCallback((m,h)=>{G(typeof m=="string"?parseInt(m):m),ae(typeof h=="string"?parseInt(h):h),Me.current=0,Ue(null),P.current=[],De.current=!0},[]),Ae=d.useCallback(()=>{const m=le===0?11:le-1,h=le===0?B-1:B;Te(h,m)},[B,le,Te]),ze=d.useCallback(()=>{const m=le===11?0:le+1,h=le===11?B+1:B;Te(h,m)},[B,le,Te]),We=d.useCallback(m=>Jo(m,He),[He]),ve=d.useCallback((m,h)=>lg(m,h,He,{multiple:t,maxMultiple:n,selectedCount:N.length}),[He,t,n,N.length]),E=d.useCallback(()=>typeof N=="string"?N.split(","):N,[N]),Ie=d.useCallback(m=>{if(!i||q.length!==1||!tl(m,q,ee,c)||q[0]>=m){se(null);return}se(m),ue(el(q[0],m))},[i,q,ee,c]),Ye=d.useCallback(m=>{if(!m)return;let h;if(i)h=dg(m,E(),{excludedates:ee,excludeweekdays:c}),oe||K(h),h.length===2?(v==null||v(h),$e()):(h.length===1&&ue({}),v==null||v(h));else if(t)h=sl(m,E(),n),Pe(h);else{const _=mt(m);N.includes(_)?h=[]:h=[_],Pe(h),$e()}},[i,t,n,E,N,ee,c,oe,Pe,$e,v]),U=d.useCallback(m=>{const h=Br(m,E());oe||K(h),i&&h.length===2&&(v==null||v(h),$e())},[E,oe,i,v,$e]),V=d.useCallback(m=>{const h=Fr(m,E());oe||K(h)},[E,oe]),te=d.useCallback(m=>{const h=sl(m,E(),n);oe||K(h)},[E,n,oe]),me=d.useCallback(()=>{var C,j;const m=mt(ri(Y)),h=(C=Q.current)==null?void 0:C.querySelector(`button[data-date="${m}"]`);if(h instanceof HTMLButtonElement){Ue(m),h.focus();return}const _=P.current.find(W=>!W.isDisabled);if(_){const W=(j=Q.current)==null?void 0:j.querySelector(`button[data-date="${_.currentDateISO}"]`);W instanceof HTMLButtonElement&&(Ue(_.currentDateISO),W.focus())}},[]),fe=d.useCallback((m,h)=>{const _=m.target;if(bg(_))return;if(m.preventDefault(),!re){me();return}const C=fs(re),j=vg(C,h,Q.current.querySelector.bind(Q.current));if(j){const W=Q.current.querySelector(`button[data-date="${mt(j)}"]`);W instanceof HTMLButtonElement&&!W.dataset.disabled&&(Ue(mt(j)),W.focus())}},[re,me]),Xe=d.useCallback(m=>{if(m.key==="Escape"){m.preventDefault(),$e();return}const h=kg(m.key);h!==null&&fe(m.nativeEvent,h)},[$e,fe]),Ke=d.useCallback(m=>{Q.current&&!Q.current.contains(m.relatedTarget)&&!m.target.classList.contains("pkt-hide")&&$e()},[$e]);return{componentId:L,strings:D,todayDate:Y,year:B,month:le,activeSelected:N,_selected:q,inRange:pe,rangeHovered:be,focusedDate:re,range:i,multiple:t,weeknumbers:p,withcontrols:g,earliest:r,latest:a,excludedates:ee,excludeweekdays:c,className:S,dateConstraints:He,calendarRef:Q,selectableDatesRef:P,tabIndexSetRef:Me,prevMonth:Ae,nextMonth:ze,changeMonth:Te,handleDateSelect:Ye,addToSelected:U,removeFromSelected:V,toggleSelectedDate:te,handleRangeHover:Ie,isExcluded:We,isDayDisabled:ve,focusOnCurrentDate:me,handleKeydown:Xe,handleFocusOut:Ke,close:$e,setFocusedDate:Ue}}const wg=({componentId:s,strings:e,year:t,month:n,earliest:i,latest:r,withcontrols:a,prevMonth:l,nextMonth:c,changeMonth:p})=>{const g=f=>{const k=f==="prev",v=k?cg(t,n,i):ug(t,n,r),$=k?e.prevMonth:e.nextMonth,M=k?"chevron-thin-left":"chevron-thin-right",S=k?"pkt-calendar__prev-month":"pkt-calendar__next-month",T=k?l:c;return o.jsx("div",{children:o.jsxs("button",{type:"button","aria-label":$,onClick:()=>v&&T(),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),v&&T())},className:["pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",S,!v&&"pkt-invisible"].filter(Boolean).join(" "),"data-disabled":v?void 0:"disabled","aria-disabled":!v||void 0,tabIndex:v?0:-1,children:[o.jsx(R,{className:"pkt-btn__icon",name:M}),o.jsx("span",{className:"pkt-btn__text",children:$})]})})},b=()=>a?o.jsxs("div",{className:"pkt-cal-month-picker",children:[o.jsx("label",{htmlFor:`${s}-monthnav`,className:"pkt-hide",children:e.month}),o.jsx("select",{"aria-label":e.month,className:"pkt-input pkt-input-compact",id:`${s}-monthnav`,value:n,onChange:f=>{f.stopPropagation(),p(t,parseInt(f.target.value))},children:e.months.map((f,k)=>o.jsx("option",{value:k,children:f},k))}),o.jsx("label",{htmlFor:`${s}-yearnav`,className:"pkt-hide",children:e.year}),o.jsx("input",{"aria-label":e.year,className:"pkt-input pkt-cal-input-year pkt-input-compact",id:`${s}-yearnav`,type:"number",size:4,placeholder:"0000",value:t,onChange:f=>{f.stopPropagation(),p(parseInt(f.target.value),n)}})]}):o.jsxs("div",{className:"pkt-txt-16-medium pkt-calendar__month-title","aria-live":"polite",children:[e.months[n]," ",t]});return o.jsxs("nav",{className:"pkt-cal-month-nav",children:[g("prev"),b(),g("next")]})};function $g(s,e,t){const n=yn(t.year,t.month,s),i=mt(n),r=i===mt(e),a=t.activeSelected.includes(i),l=t.isDayDisabled(n,a);let c;return t.focusedDate?c=t.focusedDate===i&&!l?"0":"-1":!l&&t.tabIndexSetRef.current===0?(t.tabIndexSetRef.current=s,c="0"):c=t.tabIndexSetRef.current===s?"0":"-1",{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:tg(n),tabindex:c}}function xg(s,e){const{currentDateISO:t,isToday:n,isSelected:i}=s,r=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],a=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return ke({"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":e.inRange[t],"pkt-cal-excluded":e.isExcluded(s.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":e.rangeHovered!==null&&t===mt(e.rangeHovered)})}function Sg(s,e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=s,a=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],l=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return ke({"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":e.inRange[t],"pkt-calendar__date--in-range-hover":e.rangeHovered!==null&&t===mt(e.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l})}const Cg=({state:s})=>{const{strings:e,year:t,month:n,activeSelected:i,focusedDate:r,inRange:a,rangeHovered:l,range:c,multiple:p,weeknumbers:g,selectableDatesRef:b,tabIndexSetRef:f,handleDateSelect:k,handleRangeHover:v,isExcluded:$,isDayDisabled:M,setFocusedDate:S,todayDate:T}=s,L={year:t,month:n,activeSelected:i,focusedDate:r,tabIndexSetRef:f,isDayDisabled:M},D={range:c,activeSelected:i,rangeHovered:l,inRange:a,isExcluded:$},Y=()=>{const K=[];g&&K.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__week-number",children:e.week})},"week-header"));for(let N=0;N<e.daysShort.length;N++)K.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__day-name","aria-label":e.days[N],children:e.daysShort[N]})},`day-${N}`));return o.jsx("tr",{className:"pkt-cal-week-row",children:K})},ee=(K,N)=>{const q=$g(K,N,L),{currentDate:B,currentDateISO:G,isSelected:le,isDisabled:ae,ariaLabel:pe,tabindex:ue}=q;b.current.push({currentDateISO:G,isDisabled:ae,tabindex:ue});const be=xg(q,D),se=Sg(q,D);return o.jsx("td",{className:be,children:o.jsx("button",{type:"button","aria-pressed":le?"true":"false",disabled:ae,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${se}`,onMouseOver:()=>c&&!$(B)&&v(B),onFocus:()=>{c&&!$(B)&&v(B),S(G)},"aria-label":pe,tabIndex:parseInt(ue),"data-disabled":ae?"disabled":void 0,"data-date":G,onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),k(B))},onClick:re=>{ae||(re.preventDefault(),k(B))},children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:K})})},G)},oe=(K,N)=>o.jsx("td",{className:"pkt-cal-other",children:o.jsx("div",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only","data-disabled":"disabled",children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:K})})},N),ye=()=>{const K=T,N=pg(t,n);b.current=[],f.current=0;let q=1,B=N.initialWeek;const G=[];for(let le=0;le<N.numRows;le++){const ae=[];g&&ae.push(o.jsx("td",{className:"pkt-cal-week",children:B},`week-${B}`)),B++;for(let pe=0;pe<ai;pe++){const ue=fg(le,pe,q,N);if(ue==="current-month")ae.push(ee(q,K)),q++;else{const be=gg(ue,pe,q,N);ae.push(oe(be,`${ue}-${le}-${pe}`)),ue==="next-month"&&q++}}G.push(o.jsx("tr",{className:"pkt-cal-week-row",role:"row",children:ae},`row-${le}`))}return G};return o.jsxs("table",{className:"pkt-cal-days pkt-txt-12-medium pkt-calendar__body",role:"grid","aria-multiselectable":c||p||void 0,children:[o.jsx("thead",{children:Y()}),o.jsx("tbody",{children:ye()})]})},Vr=d.forwardRef((s,e)=>{const t=_g(s);return d.useImperativeHandle(e,()=>({handleDateSelect:t.handleDateSelect,addToSelected:t.addToSelected,removeFromSelected:t.removeFromSelected,toggleSelected:t.toggleSelectedDate,focusOnCurrentDate:t.focusOnCurrentDate,close:t.close}),[t.handleDateSelect,t.addToSelected,t.removeFromSelected,t.toggleSelectedDate,t.focusOnCurrentDate,t.close]),o.jsxs("div",{ref:t.calendarRef,className:["pkt-calendar",t.weeknumbers&&"pkt-cal-weeknumbers",t.className].filter(Boolean).join(" "),onBlur:t.handleFocusOut,onKeyDown:t.handleKeydown,children:[o.jsx(wg,{componentId:t.componentId,strings:t.strings,year:t.year,month:t.month,earliest:t.earliest,latest:t.latest,withcontrols:t.withcontrols,prevMonth:t.prevMonth,nextMonth:t.nextMonth,changeMonth:t.changeMonth}),o.jsx(Cg,{state:t})]})});Vr.displayName="PktCalendar";const Tg=os({tagName:"pkt-card",elementClass:ot,react:d,displayName:"PktCard",events:{}}),nl=d.forwardRef(({children:s,...e},t)=>o.jsx(Tg,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));nl.displayName="PktCard";const il=d.forwardRef(({id:s,hasTile:e=!1,disabled:t=!1,label:n,checkHelptext:i,hasError:r=!1,className:a,isSwitch:l=!1,hideLabel:c=!1,labelPosition:p="right",defaultChecked:g,checked:b,indeterminate:f,optionalTag:k,optionalText:v="Valgfritt",requiredTag:$,requiredText:M="Må fylles ut",tagText:S,...T},L)=>{const D=d.useRef(null);d.useEffect(()=>{D.current&&f!==void 0&&(D.current.indeterminate=f)},[f]),d.useEffect(()=>{typeof L=="function"?L(D.current):L&&(L.current=D.current)},[L]);const Y=[a,"pkt-input-check"].filter(Boolean).join(" "),ee=["pkt-input-check__input-label",t?"pkt-input-check__input-label--disabled":"",`pkt-input-check__input-label--${p}`,c?"pkt-sr-only":""].filter(Boolean).join(" "),oe=["pkt-input-check__input",e?"pkt-input-check__input--tile":"",t&&e?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),ye=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),K=()=>o.jsxs(o.Fragment,{children:[S&&o.jsx("span",{className:ye+" pkt-tag--gray",children:S}),k&&o.jsx("span",{className:ye+" pkt-tag--blue-light",children:v}),$&&o.jsx("span",{className:ye+" pkt-tag--beige",children:M})]});return o.jsx("div",{className:Y,children:o.jsxs("div",{className:oe,children:[p==="left"&&o.jsxs("label",{className:ee,htmlFor:s,children:[n," ",K(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]}),o.jsx("input",{role:l?"switch":"checkbox",ref:D,className:`pkt-input-check__input-checkbox ${r?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:s,disabled:t,...b!==void 0?{checked:b}:{defaultChecked:g},...T}),p==="right"&&o.jsxs("label",{className:ee,htmlFor:s,children:[n," ",K(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]})]})})});il.displayName="PktCheckbox";const Ts=d.forwardRef(({forId:s,label:e,helptext:t,helptextDropdown:n,helptextDropdownButton:i,counter:r,counterCurrent:a=0,counterMaxLength:l,optionalTag:c=!1,optionalText:p="Valgfritt",requiredTag:g=!1,requiredText:b="Må fylles ut",tagText:f=null,hasError:k=!1,errorMessage:v,disabled:$=!1,inline:M=!1,ariaDescribedby:S,useWrapper:T=!0,children:L,className:D="",hasFieldset:Y=!1,role:ee="group",counterPosition:oe="bottom"},ye)=>{const[K,N]=d.useState(!1),q=S||(t?`${s}-helptext`:void 0),B=!!r,G=B&&oe==="top",le=B&&oe==="bottom",ae=()=>N(P=>!P),pe=["pkt-inputwrapper",D,k?"pkt-inputwrapper--error":"",$?"pkt-inputwrapper--disabled":"",M?"pkt-inputwrapper--inline":""].filter(Boolean).join(" "),ue=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),be=()=>B?o.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":"true",children:[a,l?`/${l}`:""]}):null,se=()=>o.jsxs(o.Fragment,{children:[f&&o.jsx("span",{className:ue+" pkt-tag--gray",children:f}),c&&o.jsx("span",{className:ue+" pkt-tag--blue-light",children:p}),g&&o.jsx("span",{className:ue+" pkt-tag--beige",children:b})]}),re=()=>{const P=o.jsxs(o.Fragment,{children:[e," ",se()]});return T?Y?o.jsx("legend",{className:"pkt-inputwrapper__legend",id:`${s}-label`,children:P}):o.jsx("label",{className:"pkt-inputwrapper__label",htmlFor:s,"aria-describedby":q,id:`${s}-label`,children:P}):o.jsx("label",{htmlFor:s,className:"pkt-sr-only","aria-describedby":q,id:`${s}-label`,children:e})},Ue=()=>!t&&!n?null:o.jsxs(o.Fragment,{children:[t&&T&&o.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${s}-helptext`,children:t}),n&&o.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[o.jsx(gt,{skin:"tertiary",size:"small",variant:"icon-right",iconName:K?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:ae,children:o.jsx("span",{dangerouslySetInnerHTML:{__html:i??'Les mer <span class="pkt-sr-only">om inputfeltet</span>'}})}),o.jsx("div",{className:`pkt-inputwrapper__helptext ${K?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:n})]})]}),Q=o.jsxs(o.Fragment,{children:[re(),Ue(),G&&o.jsx(be,{}),L,le&&o.jsx(be,{}),k&&v&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:v})})]});return o.jsx("div",{className:pe,ref:ye,role:ee,children:Y?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":q,children:Q}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:Q})})});Ts.displayName="PktInputWrapper";const gs=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,Ng=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},Mg=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},Ui=s=>s.value+(s.label||"")+(s.prefix||""),Hi=(s,e)=>e!==null&&s>=e,rl=(s,e)=>{if(!s)return"";switch(e){case"prefixAndValue":return`${s.prefix||""} ${s.value}`.trim();case"value":return s.value;case"label":default:return s.label||s.value}},Ur=(s,e)=>s?Array.isArray(s)?e?s:s.length>0?[s[0]]:[]:e?s.split(",").filter(Boolean):[s]:[],al=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},Dg=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},Og=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},Eg=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=gs(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ji=(s,e,t)=>{const n=gs(e,s);return t==="label"&&(n!=null&&n.label)?n.label:s},Xs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},ol=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),Pg=s=>{const e=s.nextElementSibling;e&&Xs(e)},ll=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&Xs(i)}else n&&Xs(n)},Ag=s=>{const e=ol(s);e[0]&&Xs(e[0])},qi=(s,e)=>{if(e.disabled)return;const t=ol(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){Xs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){Xs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&Xs(t[0])},Qs=d.forwardRef(({children:s,skin:e,textStyle:t,size:n,closeTag:i,className:r,iconName:a,ariaLabel:l,onClose:c,type:p,"aria-description":g,...b},f)=>{const[k,v]=d.useState(!1),$=d.useCallback(()=>{v(!0),c&&c()},[c]),M=d.useRef(null),[S,T]=d.useState("");d.useEffect(()=>{var ee,oe;T(((oe=(ee=M.current)==null?void 0:ee.textContent)==null?void 0:oe.trim())??"")},[s]);const L=d.useMemo(()=>{if(i&&!l)return S&&`Klikk for å fjerne ${S}`||g},[i,l,S,g]),D={"pkt-tag":!0,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,[`pkt-tag--${t}`]:!!t},Y={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${t}`]:!!t,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,"pkt-btn--icons-right-and-left":i&&!!a,"pkt-hide":k};return i?o.jsxs("button",{...b,className:ke(Y,r),type:p,onClick:$,"aria-label":l,"aria-description":L,ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a}),o.jsx("span",{ref:M,children:s}),o.jsx(R,{className:"pkt-tag__close-btn",name:"close"})]}):o.jsxs("span",{...b,className:ke(D,r),ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a,"aria-hidden":"true"}),o.jsx("span",{ref:M,children:s})]})});Qs.displayName="PktTag";const cl=({state:s,outside:e=!1})=>{const{values:t,options:n,disabled:i,displayValueAs:r,handleTagRemove:a,handleTagKeydown:l,focusedTagIndex:c}=s,p=d.useRef([]);if(d.useEffect(()=>{var f;!e&&c>=0&&c<t.length&&((f=p.current[c])==null||f.focus())},[e,c,t.length]),t.length===0)return null;const g=(f,k)=>{const v=gs(n,f),$=v==null?void 0:v.tagSkinColor,M=v?rl(v,r):f;return i?o.jsx("li",{role:"listitem",children:o.jsx(Qs,{skin:$||"blue-dark",children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f):e?o.jsx("li",{role:"listitem",children:o.jsx(Qs,{skin:$||"blue-dark",closeTag:!0,onClose:()=>a(f),children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f):o.jsx("li",{role:"listitem",onClick:S=>S.stopPropagation(),onMouseDown:S=>S.preventDefault(),children:o.jsx(Qs,{ref:S=>{p.current[k]=S},skin:$||"blue-dark",closeTag:!0,tabIndex:c===k?0:-1,onClose:()=>a(f),onKeyDown:S=>l(S,k),children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f)},b=t.map(g);return e?o.jsx("div",{className:"pkt-combobox__tags-outside",children:o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:b})}):o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:b})},Ig=({state:s})=>{const{values:e,options:t,editingSingleValue:n,displayValueAs:i}=s;if(n||e.length===0)return null;const r=gs(t,e[0]);if(!r)return null;const a=rl(r,i);return o.jsx("span",{className:"pkt-combobox__value",children:a})},Lg=({state:s})=>{const{id:e,inputId:t,listboxId:n,values:i,options:r,isOpen:a,multiple:l,typeahead:c,allowUserInput:p,tagPlacement:g,placeholder:b,disabled:f,fullwidth:k,hasError:v,label:$,inputFocus:M,inputRef:S,triggerRef:T,handleInputChange:L,handleInputKeydown:D,handleInputFocus:Y,handleInputBlur:ee,handleInputClick:oe,handlePlaceholderClick:ye,handleSelectOnlyKeydown:K,name:N}=s,q=["pkt-combobox__input",k&&"pkt-combobox__input--fullwidth",a&&"pkt-combobox__input--open",v&&"pkt-combobox__input--error",f&&"pkt-combobox__input--disabled"].filter(Boolean).join(" "),B=["pkt-combobox__arrow-icon",a&&"pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "),G=c||p,le=!G&&b&&(!i.length||l&&g==="outside")&&!M,ae=g!=="outside",pe=i[0]&&gs(r,i[0])?`${n}-${Ng(r,i[0])}`:void 0,ue=l&&i.length>0?`${i.length} valgt`:void 0,be=G?{tabIndex:-1}:{id:`${e}-combobox`,role:"combobox","aria-expanded":a?"true":"false","aria-controls":n,"aria-haspopup":"listbox","aria-labelledby":`${e}-combobox-label`,"aria-activedescendant":pe,"aria-description":ue,tabIndex:f?-1:0,onKeyDown:K};return o.jsxs("div",{ref:T,className:q,onClick:oe,...be,children:[le?o.jsx("span",{className:"pkt-combobox__placeholder",onClick:ye,children:b}):ae?l?o.jsx(cl,{state:s}):G?null:o.jsx(Ig,{state:s}):null,G?o.jsx("div",{className:"pkt-combobox__input-div combobox__input",children:o.jsx("input",{ref:S,type:"text",id:t,name:`${N||e}-input`,onChange:L,onKeyDown:D,onFocus:Y,onBlur:ee,placeholder:!i.length||l&&g==="outside"?b:void 0,autoComplete:"off",role:"combobox","aria-expanded":a?"true":"false","aria-label":$,"aria-autocomplete":c?"both":p?"list":"none","aria-controls":n,"aria-activedescendant":pe,"aria-description":ue,disabled:f})}):o.jsx("input",{ref:S,type:"hidden",id:t,name:`${N||e}-input`,value:i.join(","),readOnly:!0}),o.jsx(R,{className:B,name:"chevron-thin-down","aria-hidden":"true"})]})},Bg=({state:s})=>{const{listboxId:e,label:t,isOpen:n,options:i,filteredOptions:r,multiple:a,disabled:l,maxIsReached:c,maxlength:p,includeSearch:g,allowUserInput:b,addValueText:f,userInfoMessage:k,searchPlaceholder:v,searchValue:$,handleOptionClick:M,handleOptionKeydown:S,handleSearchInput:T,handleSearchKeydown:L,handleNewOptionClick:D,handleNewOptionKeydown:Y,listboxRef:ee}=s,oe=r.filter(B=>B.selected).length,ye=a&&oe>0&&p!=null&&p>0,K=b&&f&&!c,N=!!k,q=["pkt-listbox",n&&"pkt-listbox__open","pkt-txt-16-light"].filter(Boolean).join(" ");return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:ee,id:e,className:q,role:r.length>0?"listbox":void 0,"aria-label":r.length>0?`Liste: ${t||""}`:void 0,"aria-multiselectable":r.length>0&&a?"true":void 0,children:[o.jsxs("div",{className:"pkt-listbox__banners",children:[g&&o.jsxs("div",{className:"pkt-listbox__search",children:[o.jsx("span",{className:"pkt-listbox__search-icon",children:o.jsx(R,{name:"magnifying-glass-small"})}),o.jsx("input",{className:"pkt-txt-16-light",type:"text","aria-label":"Søk i listen",form:"",placeholder:v||"Søk...",onChange:T,onKeyDown:L,value:$,"data-type":"searchbox",disabled:l,readOnly:l,role:"searchbox"})]}),ye&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--maximum-reached",children:[oe," av maks ",p," mulige er valgt."]}),N&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--user-message",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),k]}),K&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option","data-type":"new-option","data-value":f,"data-selected":"false",tabIndex:0,onClick:()=>D(f),onKeyDown:Y,children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"plus-sign"}),'Legg til "',f,'"']}),i.length===0&&r.length===0&&!N&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--empty",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),"Tom liste"]})]}),o.jsx("ul",{className:"pkt-listbox__options",role:"presentation",children:r.map((B,G)=>{const le=["pkt-listbox__option",!a&&B.selected&&"pkt-listbox__option--selected",a&&"pkt-listbox__option--checkBox"].filter(Boolean).join(" "),ae=l||B.disabled||c&&!B.selected;return o.jsxs("li",{className:le,onClick:()=>M(B.value),onKeyDown:pe=>S(pe,B.value),"aria-selected":B.selected?"true":"false",tabIndex:ae?-1:0,"data-index":G,"data-value":B.value,"data-selected":B.selected?"true":"false","data-disabled":ae||void 0,"aria-disabled":ae?"true":"false",role:"option",id:`${e}-${G}`,children:[a?o.jsx("input",{className:"pkt-input-check__input-checkbox",type:"checkbox",tabIndex:-1,value:B.value,checked:B.selected||!1,readOnly:!0,"aria-hidden":"true",disabled:ae}):B.selected?o.jsx(R,{name:"check-big"}):null,o.jsxs("span",{className:"pkt-listbox__option-label",id:`${e}-option-label-${G}`,children:[B.prefix&&o.jsx("span",{className:"pkt-listbox__option-prefix",children:B.prefix}),B.label||B.value]}),B.description&&o.jsx("span",{className:"pkt-listbox__option-description pkt-txt-14-light",children:B.description})]},`${B.value}-${G}`)})})]}),o.jsx("div",{"aria-live":"polite",className:"pkt-visually-hidden",children:k})]})};function Fg(s,e){return s.map(t=>({...t,label:t.label||t.value,fulltext:Ui(t),selected:e.includes(t.value)}))}function Vg(s,e){const{id:t="",label:n,value:i,defaultValue:r,options:a,defaultOptions:l,multiple:c=!1,maxlength:p,typeahead:g=!1,includeSearch:b=!1,allowUserInput:f=!1,displayValueAs:k="label",tagPlacement:v,searchPlaceholder:$,placeholder:M,disabled:S=!1,required:T=!1,fullwidth:L=!1,hasError:D=!1,errorMessage:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,optionalTag:K=!1,optionalText:N,requiredTag:q=!1,requiredText:B,tagText:G,useWrapper:le=!0,name:ae,className:pe,onChange:ue,onValueChange:be,children:se}=s,re=`${t}-input`,Ue=`${t}-listbox`,Q=g||f,P=d.useRef(null),Me=d.useRef(null),De=d.useRef(null),ne=d.useRef(null),He=d.useRef(null),Pe=d.useCallback(()=>{var w,O;Q?(w=P.current)==null||w.focus():(O=De.current)==null||O.focus()},[Q]),$e=d.useMemo(()=>{const w=[];return d.Children.forEach(se,O=>{if(d.isValidElement(O)&&O.type==="option"){const J=O.props;w.push({value:J.value??J.children??"",label:J.children??J.value??"",selected:J.selected,disabled:J.disabled})}}),w},[se]),Te=d.useMemo(()=>l&&l.length>0?l.map(w=>({...w,fulltext:Ui(w)})):a&&a.length>0?a.map(w=>({...w,fulltext:Ui(w)})):$e.length>0?$e.map(w=>({...w,fulltext:Ui(w)})):[],[l,a,$e]),Ae=i!==void 0,[ze,We]=d.useState(()=>Ur(i??r,c)),ve=d.useRef(ze);d.useEffect(()=>{Ae&&We(Ur(i,c))},[i,Ae,c]);const E=Ae?Ur(i,c):ze,[Ie,Ye]=d.useState([]),U=d.useMemo(()=>{const w=[...Ie.filter(O=>!Te.some(J=>J.value===O.value)),...Te];return Fg(w,E)},[Te,Ie,E]),[V,te]=d.useState(!1),[me,fe]=d.useState(""),[Xe,Ke]=d.useState(""),[m,h]=d.useState(""),[_,C]=d.useState(null),[j,W]=d.useState(!1),[de,it]=d.useState(!1),[Re,Le]=d.useState(-1),Kt=d.useRef(!1),Gt=Hi(E.length,p??null),yt=c&&p!=null,ci=d.useMemo(()=>me?g?al(U,me).filtered:Mg(U,me):U,[U,me,g]),dt=d.useMemo(()=>{var w;return(w=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:w.set},[]),Ft=d.useCallback(w=>{const O=Me.current;if(!O||!dt)return;const J=c?w.join(","):w[0]||"";dt.call(O,J),O.dispatchEvent(new Event("input",{bubbles:!0}))},[dt,c]),Xt=c?E.join(","):E[0]||"";d.useEffect(()=>{Me.current&&(Me.current.value=Xt)},[Xt]),d.useEffect(()=>{if(V||c||!P.current)return;const w=E[0]?ji(E[0],U,k):"";P.current.value!==w&&(P.current.value=w)},[E,U,k,c,V]);const rs=d.useCallback((w,O=!0)=>{Ae||We(w),O&&(be==null||be(w),Ft(w))},[Ae,be,Ft]),Ns=d.useCallback(w=>{if(!w||E.includes(w))return;if(c&&Hi(E.length,p??null)){h("Maks antall valg nådd");return}const O=c?[...E,w]:[w];rs(O)},[E,c,p,rs]),et=d.useCallback(w=>{if(!w)return;const O=E.filter(Be=>Be!==w),J=gs(U,w);J!=null&&J.userAdded&&Ye(Be=>Be.filter(Nt=>Nt.value!==w)),rs(O)},[E,U,rs]),ui=d.useCallback(()=>{Ye([]),rs([])},[rs]),Zs=d.useCallback(w=>{if(!w||w.trim()==="")return;let O;if(!c)O=[w];else{if(gs(U,w)||Hi(E.length,p??null))return;O=[...E,w]}const J={value:w,label:w,userAdded:!0,selected:!0};Ye(Be=>[J,...Be.filter(Nt=>Nt.value!==w)]),rs(O)},[c,U,E,p,rs]),di=d.useCallback((w=!0,O)=>{if(C(null),w&&P.current&&P.current.type!=="hidden"){fe(""),Ke("");const J=O!==void 0?O:E[0];!c&&J?P.current.value=ji(J,U,k):P.current.value="",c||(it(!1),h(""))}},[c,E,U,k]),Vt=d.useCallback(w=>{var jl,ql;if(S)return;h(""),C(null);const O=((jl=gs(U,w))==null?void 0:jl.value)||null,J=E.includes(w||O||""),Be=!!O,Nt=((ql=U.find(yb=>yb.value===w))==null?void 0:ql.disabled)||!1,Js=!(w!=null&&w.trim()),Pt=!c,Ut=c,Ri=Hi(E.length,p??null);let ms=!1,er=!0,hi="",ta="",Sn;Nt||(!Be&&f&&!Js?(Zs(w),hi="Ny verdi lagt til",ms=Ut,Pt&&(Sn=w||"")):!Be&&!f?(Pt&&E[0]&&et(E[0]),er=!1,ms=!0,hi="Ingen treff i søket"):J?(et(O),ms=!0,Sn="",Pt&&Q&&P.current&&P.current.type!=="hidden"&&(P.current.value="")):Js&&Pt?(ui(),ms=!0,Sn=""):Pt?(E[0]&&et(E[0]),Ns(O),ms=!1,Sn=O||""):Ut&&!Ri?(Ns(O),ms=!0):Ut&&Ri?(hi="Maks antall valg nådd",er=!1,ta=w||""):(Pt&&ui(),hi="Ingen gyldig verdi valgt",er=!1,ms=!0,ta=w||"",Sn=""),te(ms),h(hi),fe(ta),di(er,Sn),ms||(Pt&&Q&&(Kt.current=!0),window.setTimeout(()=>{Pe()},0)))},[S,U,E,c,p,f,Zs,et,ui,Ns,di,Pe]),Tt=d.useCallback(()=>{if(W(!1),C(null),h(""),fe(""),P.current&&P.current.type!=="hidden"){const w=P.current.value;let O=E[0];if(c){if(w!==""){const{action:J,value:Be}=Eg(w,E,U,f,c);switch(J){case"addUserValue":Zs(Be);break;case"selectOption":Ns(Be);break;case"removeValue":et(Be);break}}}else if(!w)E[0]&&et(E[0]),O=void 0;else{const J=gs(U,w);J&&J.value!==E[0]?(E[0]&&et(E[0]),Ns(J.value),O=J.value):!J&&f&&(E[0]&&et(E[0]),Zs(w),O=w)}!c&&O?P.current.value=ji(O,U,k):P.current.value=""}te(!1),it(!1)},[E,U,f,c,k,Zs,Ns,et]),$n=d.useCallback(w=>{if(!w.trim().toLowerCase()){C(null),h(""),!c&&E[0]&&et(E[0]);return}const J=Dg(w,E,U,f);C(J.addValueText),h(J.userInfoMessage)},[E,U,f,c,et]),Zi=d.useCallback(w=>{var J;if(S)return;const O=w.target.value;if(Ke(O),fe(O),$n(O),g&&O){const{suggestion:Be}=al(U,O);Be!=null&&Be.label&&P.current&&!((J=w.nativeEvent.inputType)!=null&&J.includes("deleteContent"))&&(P.current.value=Be.label,window.setTimeout(()=>{var Nt;return(Nt=P.current)==null?void 0:Nt.setSelectionRange(O.length,Be.label.length)},0))}},[S,g,U,$n]),Qr=d.useCallback(w=>{var J,Be,Nt,Js,Pt;if(w.key==="Backspace"){const Ut=!((J=P.current)!=null&&J.value);if(!me&&Ut&&c&&E.length>0){w.preventDefault();const Ri=E[E.length-1];et(Ri)}return}if(w.key==="ArrowLeft"&&c&&E.length>0&&(((Be=P.current)==null?void 0:Be.selectionStart)??0)===0&&!((Nt=P.current)!=null&&Nt.value)){w.preventDefault(),Le(E.length-1);return}const O=Og(w.key,w.shiftKey,c);if(O&&!(w.key==="Tab"&&!V)){if(O==="focusListbox"&&w.key==="Tab"&&!((Js=ne.current)==null?void 0:Js.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){Tt();return}switch(w.preventDefault(),O){case"addValue":{const Ut=((Pt=P.current)==null?void 0:Pt.value.trim())||"";if(fe(Ut),Ut&&E.includes(Ut)){di(!0),h("Verdien er allerede valgt");break}Vt(Ut);break}case"focusListbox":ne.current&&(V||te(!0),qi(ne.current,{disabled:S,allowUserInput:f,customUserInput:_,includeSearch:b}));break;case"closeOptions":te(!1);break}}},[me,E,c,S,f,_,b,V,et,Vt,Pe]),as=d.useCallback(()=>{if(!S){if(Kt.current){Kt.current=!1,W(!0);return}!c&&E[0]&&P.current&&P.current.type!=="hidden"&&(it(!0),P.current.value=ji(E[0],U,k)),W(!0),fe(""),te(!0)}},[S,c,E,U,k]),Zr=d.useCallback(()=>{W(!1),it(!1)},[]),Jr=d.useCallback(w=>{if(S||!V)return;const O=w.relatedTarget,J=He.current;J&&O&&J.contains(O)||Tt()},[S,V,Tt]),Rr=d.useCallback(w=>{var O;if(S){w.preventDefault(),w.stopPropagation();return}if(Q)(O=P.current)==null||O.focus();else{w.stopPropagation(),w.preventDefault();const J=!V;te(J),J&&ne.current&&qi(ne.current,{disabled:S,allowUserInput:f,customUserInput:_,includeSearch:b})}},[S,Q,V,f,_,b]),ea=d.useCallback(w=>{S||(w.stopPropagation(),Q&&P.current?(P.current.focus(),W(!0)):te(O=>!O))},[S,Q]),I=d.useCallback(w=>{if(!S)switch(w.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":w.preventDefault(),V?te(!1):(te(!0),ne.current&&window.setTimeout(()=>{ne.current&&qi(ne.current,{disabled:S,allowUserInput:f&&!Gt,customUserInput:_,includeSearch:b})},0));break;case"Escape":V&&(w.preventDefault(),te(!1));break;case"Home":case"End":w.preventDefault(),V||te(!0),ne.current&&window.setTimeout(()=>{ne.current&&qi(ne.current,{disabled:S,allowUserInput:f&&!Gt,customUserInput:_,includeSearch:b})},0);break;case"ArrowLeft":c&&E.length>0&&(w.preventDefault(),Le(E.length-1));break;case"Backspace":case"Delete":if(c&&E.length>0){w.preventDefault();const O=E[E.length-1];et(O)}break}},[S,V,f,Gt,_,b,c,E,et]),F=d.useCallback(w=>{Vt(w)},[Vt]),Ge=d.useCallback((w,O)=>{switch(w.key){case"Enter":case" ":w.preventDefault(),Vt(O);break;case"ArrowDown":w.preventDefault(),Pg(w.currentTarget);break;case"ArrowUp":w.preventDefault(),ne.current&&ll(w.currentTarget,ne.current,b);break;case"Escape":w.preventDefault(),te(!1),Pe();break;case"Tab":Tt();break}},[Vt,b,Pe,Tt]),tt=d.useCallback(w=>{et(w),Le(-1),Q&&P.current&&(W(!0),P.current.focus())},[et,Q]),xn=d.useCallback((w,O)=>{var J,Be,Nt;switch(w.stopPropagation(),w.key){case"ArrowLeft":w.preventDefault(),O>0&&Le(O-1);break;case"ArrowRight":w.preventDefault(),O<E.length-1?Le(O+1):(Le(-1),Q&&P.current?P.current.focus():(J=De.current)==null||J.focus());break;case"Backspace":case"Delete":w.preventDefault();{const Js=E[O],Pt=O>=E.length-1?O-1:O;et(Js),Pt>=0?Le(Pt):(Le(-1),Q&&P.current?P.current.focus():(Be=De.current)==null||Be.focus())}break;case"Tab":Le(-1);break;case"Escape":w.preventDefault(),Le(-1),Q&&P.current?P.current.focus():(Nt=De.current)==null||Nt.focus();break}},[E,Q,et]),Ji=d.useCallback(w=>{fe(w.target.value),$n(w.target.value)},[$n]),bb=d.useCallback(w=>{switch(w.key){case"ArrowDown":if(w.preventDefault(),ne.current){const O=ne.current.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]');O==null||O.focus()}break;case"Tab":Tt();break;case"Escape":w.preventDefault(),te(!1),Pe();break}},[Pe,Tt]),vb=d.useCallback(w=>{Vt(w)},[Vt]),kb=d.useCallback(w=>{switch(w.key){case"Enter":case" ":w.preventDefault(),Vt(w.currentTarget.dataset.value||"");break;case"ArrowDown":w.preventDefault(),ne.current&&Ag(ne.current);break;case"ArrowUp":w.preventDefault(),ne.current&&ll(w.currentTarget,ne.current,b);break;case"Escape":w.preventDefault(),te(!1),Pe();break}},[Vt,b,Pe]);return d.useEffect(()=>{if(!V)return;const w=O=>{const J=O.target;He.current&&!He.current.contains(J)&&Tt()};return document.addEventListener("click",w,!0),()=>{document.removeEventListener("click",w,!0)}},[V,Tt]),d.useEffect(()=>{var J;const w=(J=He.current)==null?void 0:J.closest("form");if(!w)return;const O=()=>{window.setTimeout(()=>{if(We(ve.current),Ye([]),Ke(""),fe(""),C(null),h(""),Me.current){const Be=c?ve.current.join(","):ve.current[0]||"";Me.current.value=Be}},0)};return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)},[c]),d.useImperativeHandle(e,()=>({get value(){var w;return((w=Me.current)==null?void 0:w.value)??""},set value(w){const O=Array.isArray(w)?w:w?String(w).split(",").filter(Boolean):[];Ae||We(O),Me.current&&(Me.current.value=O.join(","))},focus(){var w,O;Q?(w=P.current)==null||w.focus():(O=De.current)==null||O.focus()},blur(){var w,O;Q?(w=P.current)==null||w.blur():(O=De.current)==null||O.blur()}}),[Ae]),{id:t,inputId:re,listboxId:Ue,values:E,inputValue:Xe,searchValue:me,options:U,filteredOptions:ci,isOpen:V,userInfoMessage:m,addValueText:_,maxIsReached:Gt,editingSingleValue:de,inputFocus:j,focusedTagIndex:Re,label:n,multiple:c,maxlength:p,typeahead:g,includeSearch:b,allowUserInput:f,displayValueAs:k,tagPlacement:v,searchPlaceholder:$,placeholder:M,disabled:S,required:T,fullwidth:L,hasError:D,errorMessage:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,optionalTag:K,optionalText:N,requiredTag:q,requiredText:B,tagText:G,useWrapper:le,name:ae,className:pe,hasCounter:yt,inputRef:P,changeInputRef:Me,triggerRef:De,listboxRef:ne,wrapperRef:He,handleInputChange:Zi,handleInputKeydown:Qr,handleInputFocus:as,handleInputBlur:Zr,handleFocusOut:Jr,handleInputClick:Rr,handlePlaceholderClick:ea,handleSelectOnlyKeydown:I,handleOptionClick:F,handleOptionKeydown:Ge,handleTagRemove:tt,handleTagKeydown:xn,handleSearchInput:Ji,handleSearchKeydown:bb,handleNewOptionClick:vb,handleNewOptionKeydown:kb,onChange:ue}}const ul=d.forwardRef((s,e)=>{const t=Vg(s,e),n=["pkt-combobox-component",t.fullwidth&&"pkt-combobox-component--fullwidth",t.className].filter(Boolean).join(" "),i=t.allowUserInput||t.typeahead,r=i?t.inputId:`${t.id}-combobox`;return o.jsxs("div",{className:n,ref:t.wrapperRef,children:[o.jsxs(Ts,{forId:r,hasFieldset:!i,label:t.label||"",helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,className:"pkt-combobox__wrapper",children:[o.jsxs("div",{className:"pkt-combobox",onBlur:t.handleFocusOut,children:[o.jsx(Lg,{state:t}),o.jsx(Bg,{state:t})]}),t.tagPlacement==="outside"&&t.multiple&&o.jsx(cl,{state:t,outside:!0})]}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name||t.id,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});ul.displayName="PktCombobox";const Wi=os({tagName:"pkt-consent",elementClass:Lt,react:d,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});Wi.displayName="PktConsent";const dl=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Ug=()=>dl()?"text":"date",Hg=s=>!s||s.length!==2?!0:og(s[0],s[1]),jg=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),qg=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),Wg=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),zg=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Yg=(s,e,t=!1)=>{var l;if(!s||!e)return;const n=((l=e.parentElement)==null?void 0:l.getBoundingClientRect())||e.getBoundingClientRect(),i=t?n.height+30:n.height,r=s.getBoundingClientRect().height;let a=t?"calc(100% - 30px)":"100%";n&&n.top+r>window.innerHeight&&n.top-r>0&&(a=`calc(100% - ${i}px - ${r}px)`),s.style.top=a},zi=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Kg=({open:s,multiple:e=!1,range:t=!1,weeknumbers:n=!1,withcontrols:i=!1,selected:r=[],earliest:a,latest:l,excludedates:c,excludeweekdays:p,maxMultiple:g,currentmonth:b,today:f,inputRef:k,hasCounter:v=!1,onDateSelected:$,onClose:M})=>{const S=d.useRef(null),T=d.useRef(!1);s&&(T.current=!0),d.useEffect(()=>{s&&Yg(S.current,(k==null?void 0:k.current)??null,v)},[s,k,v]);const L=["pkt-calendar-popup",s?"show":"hide"].join(" "),D=s||T.current;return o.jsx("div",{ref:S,className:L,hidden:!s,"aria-hidden":!s,children:D&&o.jsx(Vr,{multiple:e,range:t,weeknumbers:n,withcontrols:i,selected:r,earliest:a,latest:l,excludedates:c,excludeweekdays:p,maxMultiple:g,currentmonth:b,today:f,onDateSelected:$,onClose:M})})},Gg=({dates:s,dateformat:e,idBase:t,strings:n,onDateRemoved:i})=>{var l;const r=ag(s),a=((l=n==null?void 0:n.calendar)==null?void 0:l.buttonAltText)??"Slett dato";return o.jsx("div",{className:"pkt-date-tags pkt-datepicker__tags","aria-live":"polite",children:r.map(c=>{const p=eg(c,e);return o.jsx(Qs,{id:`${t}${c}-tag`,closeTag:!0,ariaLabel:`${a} ${p}`,onClose:()=>i(c),children:o.jsx("time",{dateTime:c,children:p})},c)})})},Xg=({state:s})=>{var He,Pe,$e,Te;const{id:e,inputId:t,values:n,dateformat:i,multiple:r,range:a,showRangeLabels:l,disabled:c,readOnly:p,required:g,label:b,name:f,placeholder:k,hasError:v,helptext:$,minStr:M,maxStr:S,inputType:T,isIOSDevice:L,strings:D,inputClasses:Y,buttonClasses:ee,rangeLabelClasses:oe,datepickerInputsClasses:ye,isInputDisabled:K,inputRef:N,inputRefTo:q,btnRef:B,toggleCalendar:G,handleFocus:le,handleSingleInputChange:ae,handleRangeFromChange:pe,handleRangeToChange:ue,handleRangeBlur:be,handleMultipleBlur:se,handleTagRemoved:re,handleSingleKeydown:Ue,handleRangeFromKeydown:Q,handleRangeToKeydown:P,handleMultipleKeydown:Me,restProps:De}=s,ne=()=>{var Ae,ze;return o.jsxs("button",{ref:B,className:ee,type:"button",onClick:G,disabled:c,"aria-label":((Ae=D.calendar)==null?void 0:Ae.buttonAltText)??"Åpne kalender",children:[o.jsx(R,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((ze=D.calendar)==null?void 0:ze.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx(Gg,{dates:n,dateformat:i,idBase:e,strings:D,onDateRemoved:re}),o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f??e,placeholder:k,readOnly:p||L&&!p,disabled:K,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:G,onKeyDown:Me,onFocus:le,onBlur:se}),ne()]})})]}):a?o.jsx("div",{className:ye,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((He=D.generic)==null?void 0:He.from)??"Fra"}),o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f?`${f}-from`:`${e}-from`,value:n[0]??"",min:M,max:S,placeholder:k,readOnly:p||L&&!p,disabled:c,required:g,"aria-label":`${b} ${((Pe=D.generic)==null?void 0:Pe.from)??"Fra"}`,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:G,onKeyDown:Q,onFocus:le,onBlur:be,onChange:pe}),o.jsx("div",{className:oe,id:`${e}-to-label`,children:(($e=D.generic)==null?void 0:$e.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:q,className:Y,type:T,id:`${e}-to`,name:f?`${f}-to`:`${e}-to`,value:n[1]??"",min:M,max:S,readOnly:p||L&&!p,disabled:c,"aria-label":`${b} ${((Te=D.generic)==null?void 0:Te.to)??"Til"}`,"aria-invalid":v,onClick:G,onKeyDown:P,onFocus:le,onBlur:be,onChange:ue}),ne()]})}):o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f??e,value:n[0]??"",min:M,max:S,placeholder:k,readOnly:p||L&&!p,disabled:c,required:g,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:G,onKeyDown:Ue,onFocus:le,onBlur:void 0,onChange:ae}),ne()]})})},Qg={calendar:{buttonAltText:"Åpne kalender"}},Zg={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},hl=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[];function Jg(s,e){const{id:t,label:n,value:i,defaultValue:r,dateformat:a="dd.MM.yyyy",multiple:l=!1,maxlength:c,range:p=!1,showRangeLabels:g=!1,weeknumbers:b=!1,withcontrols:f=!1,excludedates:k,excludeweekdays:v,currentmonth:$,today:M,calendarOpen:S,timezone:T,fullwidth:L=!1,hasFieldset:D=!1,inline:Y=!1,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,hasError:K=!1,errorMessage:N,optionalTag:q=!1,optionalText:B,requiredTag:G=!1,requiredText:le,tagText:ae,useWrapper:pe=!0,strings:ue,disabled:be=!1,readOnly:se=!1,required:re=!1,name:Ue,min:Q,max:P,placeholder:Me,onChange:De,onValueChange:ne,className:He,...Pe}=s,$e=d.useCallback(I=>I===void 0?[]:hl(I),[]),Te=i!==void 0,Ae=typeof r=="number"?void 0:r,[ze,We]=d.useState(()=>$e(i??Ae)),ve=Te?$e(i):ze,E=d.useRef(ze);d.useEffect(()=>{Te&&We($e(i))},[i,Te,$e]);const[Ie,Ye]=d.useState(S??!1);d.useEffect(()=>{S!==void 0&&Ye(S)},[S]);const U=d.useRef(null),V=d.useRef(null),te=d.useRef(null),me=d.useRef(null),fe=d.useRef(null),Xe=d.useMemo(()=>Ug(),[]),Ke=d.useMemo(()=>dl(),[]),m=d.useMemo(()=>ue??(p?Zg:Qg),[ue,p]),h=typeof Q=="string"?Q:Q!==void 0?String(Q):void 0,_=typeof P=="string"?P:P!==void 0?String(P):void 0,C=d.useMemo(()=>{const I=jg(L,g,l,p,se,Xe);return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[L,g,l,p,se,Xe]),j=d.useMemo(()=>{const I=qg();return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[]),W=d.useMemo(()=>{const I=Wg(g);return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[g]),de=d.useMemo(()=>["pkt-datepicker__inputs",p&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[p,g]),it=d.useMemo(()=>{if($)return $;if(_)return _.slice(0,7)},[$,_]),Re=be||l&&c!=null&&ve.length>=c,Le=l&&c!=null,Kt=`${t}-input`,Gt=ve.join(",");d.useEffect(()=>{te.current&&(te.current.value=Gt)},[Gt]),d.useEffect(()=>{T&&typeof window<"u"&&T!==window.pktTz&&(window.pktTz=T)},[T]);const yt=d.useCallback((I,F=!0)=>{Te||We(I),F&&(ne==null||ne(I))},[Te,ne]),ci=d.useMemo(()=>{var I;return(I=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:I.set},[]),dt=d.useCallback(I=>{const F=te.current;!F||!ci||(ci.call(F,I.join(",")),F.dispatchEvent(new Event("input",{bubbles:!0})))},[ci]),Ft=d.useCallback(()=>{be||Ye(I=>!I)},[be]),Xt=d.useCallback(()=>{Ye(!1)},[]);d.useEffect(()=>{if(!Ie)return;const I=Ge=>{var xn;const tt=Ge.target;fe.current&&!fe.current.contains(tt)&&!((xn=tt.closest)!=null&&xn.call(tt,".pkt-calendar-popup"))&&Xt()},F=Ge=>{var tt;Ge.key==="Escape"&&(Xt(),(tt=U.current)==null||tt.focus())};return document.addEventListener("click",I,!0),document.addEventListener("keydown",F),()=>{document.removeEventListener("click",I,!0),document.removeEventListener("keydown",F)}},[Ie,Xt]);const rs=d.useCallback(()=>{Ke&&!Ie&&Ye(!0)},[Ke,Ie]),Ns=d.useCallback(I=>{var tt;const F=zg(I,l,p),Ge=hl(F);yt(Ge),dt(Ge),!l&&!p&&(Xt(),(tt=U.current)==null||tt.focus())},[l,p,yt,dt,Xt]),et=d.useCallback(()=>{var I;Xt(),(I=U.current)==null||I.focus()},[Xt]),ui=d.useCallback(I=>{const F=I.target.value,Ge=F?[F]:[];yt(Ge),dt(Ge)},[yt,dt]),Zs=d.useCallback(I=>{const F=I.target.value,Ge=ve[1]??"",tt=[F,Ge].filter(Boolean);yt(tt),dt(tt)},[ve,yt,dt]),di=d.useCallback(I=>{const F=ve[0]??"",Ge=I.target.value,tt=[F,Ge].filter(Boolean);yt(tt),dt(tt)},[ve,yt,dt]),Vt=d.useCallback(()=>{ve.length===2&&!Hg(ve)&&(yt([ve[0]]),dt([ve[0]]))},[ve,yt,dt]),Tt=d.useCallback(I=>{const F=fs(I),Ge=h?fs(h):null,tt=_?fs(_):null;if(F&&!isNaN(F.getTime())&&(!Ge||F>=Ge)&&(!tt||F<=tt)){const xn=rg([...ve,I],h,_,k,v),Ji=[...new Set(xn)];yt(Ji),dt(Ji)}},[ve,h,_,k,v,yt,dt]),$n=d.useCallback(I=>{const F=I.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Zi=d.useCallback(I=>{const F=I.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Qr=d.useCallback(I=>{const F=ve.filter(Ge=>Ge!==I);yt(F),dt(F)},[ve,yt,dt]),as=d.useCallback(I=>{const F=I==null?void 0:I.closest("form");F?F.requestSubmit():I==null||I.blur()},[]),Zr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ft,as]),Jr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),()=>{var F;return(F=V.current)==null?void 0:F.focus()},()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ft,as]),Rr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(V.current),void 0,()=>{var F;return(F=V.current)==null?void 0:F.blur()})},[Ft,as]),ea=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()},Zi)},[Ft,as,Zi]);return d.useEffect(()=>{var Ge;const I=(Ge=fe.current)==null?void 0:Ge.closest("form");if(!I)return;const F=()=>{window.setTimeout(()=>{We(E.current),Ye(!1),te.current&&(te.current.value=E.current.join(","))},0)};return I.addEventListener("reset",F),()=>I.removeEventListener("reset",F)},[]),d.useImperativeHandle(e,()=>({get value(){var I;return((I=te.current)==null?void 0:I.value)??""},set value(I){const F=I?I.split(",").filter(Boolean):[];We(F),te.current&&(te.current.value=I??"")},focus(){var I;(I=U.current)==null||I.focus()},blur(){var I;(I=U.current)==null||I.blur()}}),[]),{id:t,inputId:Kt,label:n,values:ve,calendarOpen:Ie,dateformat:a,multiple:l,maxlength:c,range:p,showRangeLabels:g,weeknumbers:b,withcontrols:f,excludedates:k,excludeweekdays:v,disabled:be,readOnly:se,required:re,name:Ue,placeholder:Me,fullwidth:L,hasFieldset:D,inline:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,hasError:K,errorMessage:N,optionalTag:q,optionalText:B,requiredTag:G,requiredText:le,tagText:ae,useWrapper:pe,className:He,minStr:h,maxStr:_,effectiveCurrentMonth:it,today:M,inputType:Xe,isIOSDevice:Ke,strings:m,inputClasses:C,buttonClasses:j,rangeLabelClasses:W,datepickerInputsClasses:de,isInputDisabled:Re,hasCounter:Le,inputRef:U,inputRefTo:V,changeInputRef:te,btnRef:me,wrapperRef:fe,onChange:De,toggleCalendar:Ft,hideCalendar:Xt,handleDateSelected:Ns,handleCalendarClose:et,handleFocus:rs,handleSingleInputChange:ui,handleRangeFromChange:Zs,handleRangeToChange:di,handleRangeBlur:Vt,handleMultipleBlur:$n,handleTagRemoved:Qr,handleSingleKeydown:Zr,handleRangeFromKeydown:Jr,handleRangeToKeydown:Rr,handleMultipleKeydown:ea,restProps:Pe}}const pl=d.forwardRef((s,e)=>{const t=Jg(s,e),n=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:n,children:[o.jsx(Ts,{ref:t.wrapperRef,forId:t.inputId,label:t.label,hasFieldset:t.hasFieldset,inline:t.inline,helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,children:o.jsx(Xg,{state:t})}),o.jsx(Kg,{open:t.calendarOpen,multiple:t.multiple,range:t.range,weeknumbers:t.weeknumbers,withcontrols:t.withcontrols,selected:t.values,earliest:t.minStr,latest:t.maxStr,excludedates:t.excludedates,excludeweekdays:t.excludeweekdays,maxMultiple:t.maxlength,currentmonth:t.effectiveCurrentMonth,today:t.today,inputRef:t.inputRef,hasCounter:t.hasCounter,onDateSelected:t.handleDateSelected,onClose:t.handleCalendarClose}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});pl.displayName="PktDatepicker";const Rg={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},em={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},tm={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},sm={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},fl=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),nm=()=>{const s=fl(),e=fl();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class gl{constructor(e,t){tr(this,"fileId");tr(this,"file");tr(this,"attributes",{});this.fileId=t||nm(),this.file=e,this.attributes={targetFilename:e.name}}}const Hr=d.createContext({}),im=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",rm=d.forwardRef(({id:s,multiple:e,value:t,onFilesAdded:n=()=>{},name:i,uploadStrategy:r,accept:a,isThumbnailView:l=!1,disabled:c=!1,srAnnouncementIds:p,...g},b)=>{const f=d.useRef(null),k=typeof a=="string"&&a.trim().length>0?a:void 0,v=d.useMemo(()=>k?k.split(/\s*,\s*/).map(N=>N.trim()).filter(Boolean).join(", ").toUpperCase():im,[k]);d.useImperativeHandle(b,()=>f.current);const[$,M]=d.useState(!1),S=d.useMemo(()=>l?e?tm:sm:e?Rg:em,[e,l]),T=d.useCallback(N=>{if(f.current)try{f.current.files=am(N)}catch{}},[f.current,t]);d.useEffect(()=>{T(t)},[f,t]);const L=d.useCallback(N=>{const q=N.map(B=>new gl(B));n(q),f.current&&(f.current.value="")},[n]),D=N=>{const q=N.target.files;if(q.length===0){e&&T(t);return}L(Array.from(q))},Y=N=>{L(N)},ee=N=>{if(N.preventDefault(),M(!1),c)return;const q=N.dataTransfer.files,B=Array.from(q);Y(B)},oe=N=>{N.preventDefault(),!c&&M(!0)},ye=()=>{M(!1)},K=d.useCallback(N=>{var B;c||N.target.closest(".pkt-fileupload__drop-zone__placeholder__title__open-file-dialog")||(B=f.current)==null||B.click()},[c]);return o.jsxs("div",{onDrop:ee,onDragOver:oe,onDragLeave:ye,onClick:K,className:ke("pkt-fileupload__drop-zone",{"pkt-fileupload__drop-zone--drag-active":$,"pkt-fileupload__drop-zone--disabled":c}),children:[o.jsx("input",{...g,id:s,type:"file",ref:f,multiple:e,onChange:D,accept:k,disabled:c,name:r==="form"&&i||void 0,"aria-label":e?"Velg filer":"Velg fil"}),r==="custom"&&o.jsx(o.Fragment,{children:t==null?void 0:t.map(N=>o.jsx("input",{type:"hidden",name:i,value:N.fileId},N.fileId))}),o.jsxs("div",{className:"pkt-fileupload__drop-zone__placeholder",children:[o.jsx(R,{name:"attachment",className:"pkt-fileupload__drop-zone__placeholder__icon","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__drop-zone__placeholder__title",children:$?`${S.dropFilesHere} ...`:o.jsxs(o.Fragment,{children:[S.selectOrDragFiles," ",o.jsx("button",{className:"pkt-fileupload__drop-zone__placeholder__title__open-file-dialog",onClick:N=>{var q;N.preventDefault(),N.stopPropagation(),(q=f.current)==null||q.click()},type:"button",children:S.chooseFiles})]})}),o.jsxs("p",{className:"pkt-fileupload__drop-zone__placeholder__formats",children:["Format: ",v]})]})]})}),am=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},jr=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,counter:n,counterMaxLength:i,className:r,disabled:a,errorMessage:l,hasError:c,helptext:p,helptextDropdown:g,helptextDropdownButton:b,inline:f,fullwidth:k=!1,label:v,name:$,optionalTag:M=!1,optionalText:S,requiredTag:T=!1,requiredText:L,tagText:D=null,placeholder:Y,rows:ee,useWrapper:oe=!0,onChange:ye,value:K,autoComplete:N="off",minLength:q,maxLength:B,readOnly:G,skipForwardTestid:le=!1,...ae},pe)=>{const ue=[r,"pkt-textinput","pkt-textarea"].join(" "),be=`${s}-input`,se=`${be}-label`,re=t||se,[Ue,Q]=d.useState(0),P=Me=>{var De,ne;n&&Q(((ne=(De=Me.currentTarget)==null?void 0:De.value)==null?void 0:ne.length)||0),ye&&ye(Me)};return d.useEffect(()=>{K!==void 0&&Q((K==null?void 0:K.length)||0)},[K]),o.jsx(Ts,{ariaDescribedby:e,className:ue,disabled:a,errorMessage:l,forId:be,hasError:c,helptext:p,helptextDropdown:g,helptextDropdownButton:b,inline:f,label:v,optionalTag:M,optionalText:S,requiredTag:T,requiredText:L,tagText:D,useWrapper:oe,counter:n,counterCurrent:Ue,counterMaxLength:i,children:o.jsx("textarea",{ref:pe,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${i&&Ue>i?"pkt-input--counter-error":""}`,name:`${$||s}`,id:be,placeholder:Y,disabled:a,rows:ee,"aria-labelledby":re,"aria-invalid":c,"aria-errormessage":`${s}-error`,...ae,onChange:P,value:K,autoComplete:N,minLength:q,maxLength:B,readOnly:G,"data-skip-forward-testid":le?"true":void 0})})});jr.displayName="PktTextarea";const om=Symbol("comment"),lm=s=>{const e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),n=s.getFullYear(),i=String(s.getHours()).padStart(2,"0"),r=String(s.getMinutes()).padStart(2,"0");return`${e}.${t}.${n} kl. ${i}:${r}`},cm=({fileItem:s,closeOperationUi:e,onAddComment:t,existingComment:n})=>{const i=d.useRef(null),r=!!n,a=()=>{var c,p;const l=(p=(c=i.current)==null?void 0:c.value)==null?void 0:p.trim();l&&t({text:l,timestamp:new Date}),e()};return d.useLayoutEffect(()=>{const l=setTimeout(()=>{var c;return(c=i.current)==null?void 0:c.focus({preventScroll:!0})},0);return()=>clearTimeout(l)},[s.fileId]),o.jsxs(o.Fragment,{children:[o.jsx(jr,{autoFocus:!0,label:r?"Rediger kommentar":"Legg til kommentar",name:`comment-${s.fileId}`,className:"pkt-fileupload__queue-display__item__comment-input",placeholder:"Skriv inn kommentar",rows:2,id:`comment-${s.fileId}`,ref:i,defaultValue:n==null?void 0:n.text}),o.jsx(gt,{skin:"secondary",size:"small",onClick:a,children:r?"Lagre kommentar":"Legg til kommentar"}),o.jsx(gt,{skin:"tertiary",size:"small",onClick:e,children:"Avbryt"})]})},um=({comments:s,onDeleteComment:e,onEditComment:t})=>s&&s.length>0?o.jsx("div",{className:"pkt-fileupload__queue-display__item__comments",children:s.map((n,i)=>o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment",children:[o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__content",children:[o.jsx("span",{className:"pkt-fileupload__queue-display__item__comment__text","aria-label":"Kommentar tekst",children:n.text}),o.jsx("time",{className:"pkt-fileupload__queue-display__item__comment__time",children:lm(n.timestamp)})]}),o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__actions",children:[e&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>e(i),"aria-label":"Slett kommentar",children:o.jsx(R,{name:"trash-can"})}),t&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>t(i),"aria-label":"Rediger kommentar",children:o.jsx(R,{name:"edit"})})]})]},i))}):null,dm=s=>{const e=d.useContext(Hr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},hm=s=>{const e=s("comments"),t=(i,r)=>{e.set(i,[r])},n=(i,r)=>{const l=(e.get(i)||[]).filter((c,p)=>p!==r);e.set(i,l.length>0?l:void 0)};return{title:i=>{const r=e.get(i.fileId);return r&&r.length>0?"":"Legg til kommentar"},renderExtendedUI:(i,r)=>{const a=e.get(i.fileId),l=a==null?void 0:a[0];return o.jsx(cm,{fileItem:i,closeOperationUi:r,onAddComment:c=>t(i.fileId,c),existingComment:l})},renderContent:(i,r,a)=>{if(a)return null;const l=e.get(i.fileId);return o.jsx(um,{comments:l,onDeleteComment:c=>n(i.fileId,c),onEditComment:r?()=>r():void 0})},renderHidden:i=>o.jsx(dm,{comments:e.get(i.fileId)},`comments${i.fileId}`),symbol:om}},pm=Symbol("deleteFile"),fm=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:pm}),gm=Symbol("renameFile"),mm=s=>{const e=d.useRef(null),t=d.useId(),n=()=>{var i;s.onSave(((i=e.current)==null?void 0:i.value)??"")};return o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:t,className:"pkt-sr-only",children:"Endre filnavn"}),o.jsx("input",{id:t,ref:e,type:"text",autoFocus:!0,defaultValue:s.value,className:"pkt-fileupload__queue-display__item__rename-input",onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),i.stopPropagation(),n()),i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),s.onCancel())}}),o.jsx(gt,{skin:"secondary",size:"small",onClick:()=>s.onSave(e.current.value),children:"Lagre"}),o.jsx(gt,{skin:"tertiary",size:"small",onClick:s.onCancel,children:"Avbryt"})]})},bm=s=>{const e=d.useContext(Hr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},vm=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,n)=>o.jsx(mm,{value:e.get(t.fileId)||void 0,onSave:i=>{e.set(t.fileId,i),n()},onCancel:n}),renderHidden:t=>o.jsx(bm,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:gm}},km=(s,e)=>{const t=d.useCallback((r,a,l)=>{const c=s.find(g=>g.fileId===r),p=c.attributes||{};c.attributes={...p,[a]:l},e(r,{attributes:c.attributes})},[e,s]),n=d.useCallback((r,a)=>(s.find(p=>p.fileId===r).attributes||{})[a],[s]);return{fileAttributes:d.useCallback(r=>({get:a=>n(a,r),set:(a,l)=>{t(a,r,l)}}),[n,t])}},ym=s=>{const[e,t]=d.useState(!1),[n,i]=d.useState(0),r=d.useRef(null),a=d.useCallback(p=>{var b;const g=s.findIndex(f=>f.fileId===p);g>=0&&(i(g),t(!0),(b=r.current)==null||b.showModal())},[s]),l=d.useCallback(()=>{var p;t(!1),(p=r.current)==null||p.close()},[]),c=d.useCallback(p=>{s.length!==0&&i(g=>p==="prev"?g<=0?s.length-1:g-1:g>=s.length-1?0:g+1)},[s.length]);return{isOpen:e,currentIndex:n,modalRef:r,open:a,close:l,navigate:c}},_m=s=>{const[e,t]=d.useState({}),n=d.useCallback(a=>{const l=e[a];if(l)return s.find(c=>c.symbol===l)},[e,s]),i=d.useCallback((a,l)=>{t(c=>({...c,[a]:l.symbol}))},[]),r=d.useCallback(a=>{t(l=>{const c={...l};return delete c[a],c})},[]);return{getActivated:n,activate:i,close:r}},wm=os({tagName:"pkt-modal",elementClass:Ot,react:d,displayName:"PktModal",events:{}}),qr=d.forwardRef(({children:s,...e},t)=>o.jsx(wm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));qr.displayName="PktModal";const ml=2,$m=s=>{const e=window.getComputedStyle(s),t=parseFloat(e.lineHeight);if(!Number.isNaN(t)&&t>0)return t;const n=parseFloat(e.fontSize);return(!Number.isNaN(n)&&n>0?n:16)*1.2},xm=(s,e,t)=>{const n=e*t;return s.getBoundingClientRect().height>n+.5},bl=d.createContext({tail:5}),oi=({children:s,tail:e,...t})=>{const n=s,i=d.useContext(bl),r=e!==void 0?e:i.tail||0,a=s.length<=r+3?null:s.slice(-r),l=d.useRef(null),c=d.useRef(null),[p,g]=d.useState(!1),b=d.useCallback(()=>{const k=l.current,v=c.current;if(!k||!v)return;const $=$m(k);g(xm(v,$,ml))},[]),f=d.useMemo(()=>new ResizeObserver(k=>{k.some(v=>v.target===l.current)&&b()}),[b]);return d.useLayoutEffect(()=>(l.current&&f.observe(l.current),b(),()=>f.disconnect()),[s,f,b]),o.jsxs("span",{ref:l,...t,"data-pkt-truncate-part":"wrapper",style:{maxWidth:"100%",width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"end",columnGap:"0.25rem",overflow:"hidden",position:"relative",...t.style},children:[o.jsx("span",{"data-pkt-truncate-part":"first",style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:ml,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",overflowWrap:"anywhere"},children:n}),r!==0&&o.jsx("span",{"data-pkt-truncate-part":"tail",style:{whiteSpace:"nowrap",display:p?"inline":"none",paddingRight:"0.5rem"},"aria-hidden":!0,children:a}),o.jsx("span",{ref:c,"aria-hidden":!0,"data-pkt-truncate-part":"measure",style:{position:"absolute",top:0,left:0,width:"100%",visibility:"hidden",pointerEvents:"none",whiteSpace:"normal",overflowWrap:"anywhere"},children:s})]})},Sm=s=>{if(typeof s=="number")return s;const e=s.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!e)return console.warn(`PktFileUpload: Invalid maxFileSize format "${s}". Use format like "5MB", "500KB", or a number in bytes.`),0;const t=parseFloat(e[1]);switch(e[2].toUpperCase()){case"B":return t;case"KB":return t*1024;case"MB":return t*1024*1024;case"GB":return t*1024*1024*1024;default:return t}},Yi=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:s<1024*1024*1024?`${Math.round(s/(1024*1024))} MB`:`${Math.round(s/(1024*1024*1024))} GB`,Wr=s=>o.jsx("button",{onClick:s.onClick,className:"pkt-fileupload__queue-display__item__cancel-button","aria-label":s.ariaLabel||"Avbryt opplasting",children:s.label||"Avbryt"}),Cm=()=>{const[s,e]=d.useState(1);return d.useEffect(()=>{const t=setInterval(()=>{e(n=>n>=3?1:n+1)},400);return()=>clearInterval(t)},[]),o.jsxs("span",{className:"pkt-fileupload__queue-display__item__loading-text","aria-label":"Laster opp fil",children:["Laster opp",".".repeat(s)]})},Tm=({cancelTransfer:s,transferItem:e})=>{const t=e.showProgress??e.progress!==0;return o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title","aria-label":"Filnavn",children:o.jsx(oi,{children:e.attributes.targetFilename})}),o.jsx(Wr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(Qi,{valueCurrent:e.progress*100,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(Cm,{})]})},Nm=({transferItem:s,onRemove:e})=>{const t=(s.lastProgress??1)*100;return o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Wr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(Qi,{valueCurrent:t,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},Mm=({transferItem:s,onRemove:e})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Wr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]}),Dm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(Nm,{transferItem:s,onRemove:e}):o.jsx(Mm,{transferItem:s,onRemove:e}),Om=({operation:s,onActivate:e,transferItem:t})=>{const n=typeof s.title=="function"?s.title(t):s.title;if(!n)return null;const i=()=>{(s.renderInlineUI||s.renderExtendedUI)&&e(t.fileId,s),s.onClick&&s.onClick(t)};return o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__operation",onClick:i,"aria-label":typeof s.ariaLabel=="function"?s.ariaLabel(t):s.ariaLabel,children:n})},vl=({transferItem:s})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)})]}),Em=({transferItem:s,onPreviewClick:e})=>{const[t,n]=d.useState(null),[i,r]=d.useState(!1),a=s.file;d.useEffect(()=>{if(r(!1),a.type.startsWith("image/")){const g=URL.createObjectURL(a);return n(g),()=>{URL.revokeObjectURL(g)}}n(null)},[a]);const l=t&&!i&&o.jsx("img",{src:t,alt:s.attributes.targetFilename,onError:()=>r(!0)})||o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"}),c=!!e,p=!!t&&!i;return o.jsxs("div",{className:`pkt-fileupload__queue-display__item__thumbnail${p?"":" pkt-fileupload__queue-display__item__thumbnail--fallback"}`,children:[o.jsxs(gt,{className:"pkt-fileupload__queue-display__item__thumbnail__image-wrapper","aria-label":`Forhåndsvis bilde ${s.attributes.targetFilename}`,type:"button",skin:"secondary",onClick:e,children:[c&&o.jsx(R,{name:"expand",className:"pkt-fileupload__queue-display__item__thumbnail__expand-icon","aria-hidden":"true"}),l]}),o.jsx(oi,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},kl=d.forwardRef(({isOpen:s,images:e,currentIndex:t,onClose:n,onNavigate:i},r)=>{const[a,l]=d.useState(null),[c,p]=d.useState(!1),g=e[t],b=e.length>1;return d.useEffect(()=>{if(p(!1),g&&g.file.type.startsWith("image/")){const f=URL.createObjectURL(g.file);return l(f),()=>URL.revokeObjectURL(f)}l(null)},[g]),d.useEffect(()=>{if(!s)return;const f=k=>{switch(k.key){case"ArrowLeft":k.preventDefault(),i("prev");break;case"ArrowRight":k.preventDefault(),i("next");break;case"Escape":k.preventDefault(),n();break}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,i,n]),g?o.jsx(qr,{ref:r,headingText:g.attributes.targetFilename,closeOnBackdropClick:!0,className:"pkt-fileupload__image-preview-modal",children:o.jsxs("div",{className:"pkt-fileupload__image-preview",children:[b&&o.jsx(gt,{variant:"icon-only",iconName:"chevron-thin-left",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev",onClick:()=>i("prev"),"aria-label":`Forrige bilde ${t} / ${e.length}`}),o.jsx("div",{className:"pkt-fileupload__image-preview__content",children:a&&!c?o.jsx("img",{src:a,alt:`${g.attributes.targetFilename} - ${t+1} av ${e.length}`,className:"pkt-fileupload__image-preview__image",onError:()=>p(!0)}):o.jsx(R,{name:"picture",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"})}),b&&o.jsxs("span",{className:"pkt-fileupload__image-preview__counter",children:[t+1," / ",e.length]}),b&&o.jsx(gt,{variant:"icon-only",iconName:"chevron-thin-right",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next",onClick:()=>i("next"),"aria-label":`Neste bilde ${t+2} / ${e.length}`})]})}):null});kl.displayName="ImagePreviewModal";const Pm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},zr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",Am=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__actions",children:s.filter(i=>!e||i.symbol!==e.symbol).map(i=>o.jsx(Om,{operation:i,onActivate:t,transferItem:n},i.symbol.toString()))}),Im=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx(o.Fragment,{children:s.filter(i=>i.renderContent).map(i=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__operation-content",children:i.renderContent(n,()=>t(n.fileId,i),(e==null?void 0:e.symbol)===i.symbol)},i.symbol.toString()))}),Lm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:i,onClose:r,onPreviewClick:a})=>{const l=()=>r(s.fileId),p=(e==null?void 0:e.renderInlineUI)||(e==null?void 0:e.renderExtendedUI)?[]:t;return o.jsxs(o.Fragment,{children:[e!=null&&e.renderInlineUI?o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon"}),o.jsx("div",{className:"pkt-fileupload__queue-display__item__inline-ui",children:e.renderInlineUI(s,l)})]}):o.jsx(n,{transferItem:s,queueItemOperations:t,onPreviewClick:a}),p.length>0&&o.jsx(Am,{operations:p,activatedOperation:e,onActivate:i,transferItem:s}),o.jsx(Im,{operations:t,activatedOperation:e,onActivate:i,transferItem:s}),(e==null?void 0:e.renderExtendedUI)&&o.jsx("div",{className:"pkt-fileupload__queue-display__item__expanded-operation-ui",children:e.renderExtendedUI(s,l)})]})},Bm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,enableImagePreview:i,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:c})=>{const p=zr(s.progress),g=i&&s.progress==="done"&&Pm(s);switch(p){case"in-progress":return o.jsx(Tm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(Dm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(Lm,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:r,onClose:a,onPreviewClick:g?()=>c(s.fileId):void 0})}},Fm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Vm=(s,e,t)=>d.useMemo(()=>{const n=s.map(r=>{const a=e.find(l=>l.fileId===r.fileId);return{...r,progress:(a==null?void 0:a.progress)??(t==="form"?"done":"queued"),errorMessage:a==null?void 0:a.errorMessage,showProgress:a==null?void 0:a.showProgress,lastProgress:a==null?void 0:a.lastProgress}}),i={"in-progress":0,error:1,idle:2};return n.sort((r,a)=>i[zr(r.progress)]-i[zr(a.progress)])},[s,e,t]),Um=(s,e)=>d.useMemo(()=>e?s.filter(t=>t.progress==="done"&&Fm(t)):[],[s,e]),Hm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:n=[],ItemRenderer:i=vl,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const c=Vm(s,t,l),p=Um(c,a),g=_m(n),b=ym(p);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(bl.Provider,{value:{tail:r},children:c.map(f=>o.jsxs("li",{className:ke("pkt-fileupload__queue-display__item",{"pkt-fileupload__queue-display__item--in-progress":typeof f.progress=="number",[`pkt-fileupload__queue-display__item--${f.progress}`]:typeof f.progress=="string"}),children:[n.filter(k=>k.renderHidden).map(k=>k.renderHidden(f)),o.jsx(Bm,{transferItem:f,activatedOperation:g.getActivated(f.fileId),operations:n,ItemRenderer:i,enableImagePreview:a,onActivate:g.activate,onClose:g.close,onCancelTransfer:e,onOpenPreview:b.open})]},f.fileId))})}),a&&p.length>0&&o.jsx(kl,{ref:b.modalRef,isOpen:b.isOpen,images:p,currentIndex:b.currentIndex,onClose:b.close,onNavigate:b.navigate})]})},Yr={filename:vl,thumbnail:Em},yl=d.forwardRef(({value:s,defaultValue:e,id:t="fileupload-id",multiple:n=!1,uploadStrategy:i="form",addCommentsEnabled:r=!1,renameFilesEnabled:a=!1,truncateTail:l,onFilesChanged:c,onFileUploadRequested:p,extraOperations:g=[],itemRenderer:b=Yr.filename,fullWidth:f=!1,allowedFormats:k,formatErrorMessage:v,maxFileSize:$,sizeErrorMessage:M,onFileValidation:S,errorMessage:T,hasError:L=!1,disabled:D=!1,label:Y,helptext:ee,optionalTag:oe,requiredTag:ye,enableImagePreview:K=!1,...N},q)=>{const B="transfers"in N?N.transfers:void 0,[G,le]=d.useState(null),ae=L||!!G,pe=T||G,ue=$?Sm($):void 0,be=d.useCallback(V=>{var te;if(k&&k.length>0){const me=((te=V.name.split(".").pop())==null?void 0:te.toLowerCase())||"",fe=V.type.toLowerCase();if(!k.some(Ke=>{const m=Ke.toLowerCase().replace(/^\./,"");if(m.includes("/")){if(m.endsWith("/*")){const h=m.replace("/*","");return fe.startsWith(h+"/")}return fe===m}return me===m})){const Ke=k.join(", "),m=`Ugyldig filtype. Tillatte formater: ${Ke}`;return(v==null?void 0:v.replace("{formats}",Ke))||m}}if(ue&&V.size>ue){const me=Yi(ue),fe=`Filen er for stor. Maks størrelse er ${me}.`;return(M==null?void 0:M.replace("{maxSize}",me))||fe}return S?S(V):null},[k,v,ue,M,S]);s!==void 0&&e!==void 0&&console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"),s!==void 0&&c===void 0&&console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");const re=s!==void 0?s:e||[],Ue=typeof b=="string"?Yr[b]:b,Q=b==="thumbnail",P=typeof N.accept=="string"?N.accept.trim():void 0,Me=d.useMemo(()=>{if(!(!k||k.length===0))return k.map(V=>V.trim()).filter(Boolean).map(V=>{const te=V.toLowerCase();return te.includes("/")||te.startsWith(".")?te:`.${te}`}).join(", ")},[k]),De=P||Me,ne=a&&!Q,He=r&&!Q,Pe=d.useCallback(V=>{for(const me of V){const fe=be(me.file);if(fe){le(fe);return}}le(null);const te=n?[...re,...V]:[V[0]];c&&c(te),i==="custom"&&p&&V.forEach(me=>{p==null||p(me)})},[c,re,n,i,p,be]),$e=d.useCallback((V,te)=>{const me=re.map(fe=>fe.fileId===V?{...fe,...te}:fe);c&&c(me)},[c,re]),Te=d.useCallback(V=>{var me;const te=re.filter(fe=>fe.fileId!==V);c&&c(te),"onTransferCancelled"in N&&N.onTransferCancelled&&((me=N.onTransferCancelled)==null||me.call(N,V))},[c,re,N]),{fileAttributes:Ae}=km(re,$e),ze=d.useMemo(()=>[{op:vm,enabled:ne},{op:V=>hm(V),enabled:He}].filter(({enabled:V})=>V).map(({op:V})=>V).concat(...g),[ne,He]),We=d.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ve,uploadedCount:E,failedCount:Ie}=d.useMemo(()=>{const V=re.length;if(!B)return{totalCount:V,uploadedCount:0,failedCount:0};let te=0,me=0;for(const fe of re){const Xe=B.find(Ke=>Ke.fileId===fe.fileId);(Xe==null?void 0:Xe.progress)==="done"&&te++,(Xe==null?void 0:Xe.progress)==="error"&&me++}return{totalCount:V,uploadedCount:te,failedCount:me}},[re,B]),Ye=ve===1?"fil":"filer",U=o.jsx("div",{className:ke("pkt-fileupload",{"pkt-fileupload--full-width":f,"pkt-fileupload--error":ae,"pkt-fileupload--disabled":D}),"aria-disabled":D,...D?{inert:""}:{},children:o.jsxs(Hr.Provider,{value:{name:N.name||"",multiple:!!n,id:t},children:[o.jsx("div",{id:We.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ve>0&&E>0&&`${E} av ${ve} ${Ye} lastet opp`}),o.jsx("div",{id:We.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ve>0&&Ie>0&&`Feil ved opplasting: ${Ie} av ${ve} ${Ye} feilet`}),o.jsx(rm,{id:t,name:N.name||"",value:re,onFilesAdded:Pe,multiple:n,uploadStrategy:i,ref:q,accept:Q?".jpeg, .jpg, .png, .gif, .webp, .heic":De,isThumbnailView:Q,disabled:D,srAnnouncementIds:We}),ae&&pe&&o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:pe}),o.jsx(Hm,{files:re,cancelTransfer:Te,truncateTail:l,transfers:B,uploadStrategy:i,ItemRenderer:Ue,enableImagePreview:Q&&K,queueItemOperations:ze.map(V=>V(Ae)).concat(fm(Te))})]})});return Y?o.jsx(Ts,{forId:t,label:Y,helptext:ee,disabled:D,hasError:ae,optionalTag:oe,requiredTag:ye,className:ke("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":f}),children:U}):U});yl.displayName="PktFileUpload";const jm=({columnOne:s,columnTwo:e,socialLinks:t,className:n,openLinksInNewTab:i=!1,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:l=!1,hotjarId:c=null,googleAnalyticsId:p=null,devMode:g=!1,cookieDomain:b=null,cookieSecure:f=null,cookieExpiryDays:k=null,onToggleConsent:v=$=>{console.log($.detail)}})=>{var M,S;const $=[n,"pkt-footer"].filter(Boolean).join(" ");return o.jsx("footer",{className:$,"data-mode":"dark",children:o.jsxs("div",{className:"pkt-footer__container",children:[o.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:s.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[s.text&&o.jsx("li",{className:"pkt-footer__text",children:s.text}),(M=s.links)==null?void 0:M.map((T,L)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${L}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:e.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[e.text&&o.jsx("li",{className:"pkt-footer__text",children:e.text}),(S=e.links)==null?void 0:S.map((T,L)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${L}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o.jsxs("ul",{className:"pkt-footer__list",children:[o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:r,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:a,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),l&&o.jsx("li",{className:"pkt-footer__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:c,googleAnalyticsId:p,devMode:g,cookieDomain:b,cookieSecure:f,cookieExpiryDays:k,onToggleConsent:v})})]})]})]}),t&&o.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o.jsx("div",{className:"pkt-footer__social-languages",children:t.filter(T=>T.language).map((T,L)=>o.jsx("div",{className:"pkt-footer__social-language",children:o.jsx("a",{href:T.href,"aria-label":`til ${T.language} versjon av nettsiden`,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:T.language})},`sociallinks-language-${L}`))}),o.jsx("div",{className:"pkt-footer__social-icons",children:t.filter(T=>T.iconName).map((T,L)=>o.jsx(d.Fragment,{children:o.jsx("a",{href:T.href,"aria-label":`til ${T.iconName}`,className:"pkt-footer__social-icon-link",target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:o.jsx(R,{className:"pkt-footer__social-icon",name:T.iconName})})},`sociallinks-${L}`))})]})]})})},qm=({links:s=[],openLinksInNewTab:e=!1,personvernOgInfoLink:t="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:n="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:i=!1,hotjarId:r=null,googleAnalyticsId:a=null,devMode:l=!1,cookieDomain:c=null,cookieSecure:p=null,cookieExpiryDays:g=null,onToggleConsent:b=k=>{console.log(k.detail)},className:f})=>{const k=[f,"pkt-footer-simple"].filter(Boolean).join(" ");return o.jsx("footer",{className:k,"data-mode":"dark",children:o.jsx("div",{className:"pkt-footer-simple__container",children:o.jsxs("ul",{className:"pkt-footer-simple__list",children:[s.map((v,$)=>o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:`pkt-footer-simple__link ${v.external?" pkt-link--external":""}`,href:v.href,target:v.openInNewTab||e?"_blank":"_self",rel:v.openInNewTab||e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),v.text]})},$)),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:t,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:n,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),i&&o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:c,cookieSecure:p,cookieExpiryDays:g,onToggleConsent:b})})]})})})},Wm=(s,e)=>{const t=()=>typeof window>"u"?0:window.innerWidth,[n,i]=d.useState(t);return d.useEffect(()=>{const r=s.current;if(!r)return;if(i(r.offsetWidth),typeof ResizeObserver>"u"){const l=()=>{r&&i(r.offsetWidth)};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}const a=new ResizeObserver(l=>{for(const c of l)c.borderBoxSize&&c.borderBoxSize.length>0?i(c.borderBoxSize[0].inlineSize):i(c.contentRect.width)});return a.observe(r),()=>{a.disconnect()}},[s]),n};function zm(s){const e=d.useRef(0);d.useEffect(()=>{const t=document.body,n=document.documentElement;if(s){e.current=window.scrollY||window.pageYOffset;const i=window.innerWidth-n.clientWidth;i>0&&(t.style.paddingRight=`${i}px`),t.style.position="fixed",t.style.top=`-${e.current}px`,t.style.left="0",t.style.right="0",t.style.width="100%",t.style.overflow="hidden",n.classList.add("is-scroll-locked")}else t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("overflow"),t.style.removeProperty("padding-right"),document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current});return()=>{s&&(t.style.cssText="",document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current}))}},[s])}const Ki=({href:s,iconName:e,className:t,iconPosition:n,external:i,target:r,children:a,...l})=>{const c={"pkt-link":!0,"pkt-link--icon-left":!!e&&n==="left"||!!(e&&!n),"pkt-link--icon-right":!!e&&n==="right","pkt-link--external":i};return o.jsxs("a",{...l,className:ke(c,t),href:s,target:r,rel:i?"noopener noreferrer":void 0,children:[e&&o.jsx(R,{name:e,className:"pkt-link__icon"}),a]})};Ki.displayName="PktLink";const Ym=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},Gi=({item:s,className:e})=>"href"in s?o.jsx(Ki,{iconName:s.iconName,href:s.href,"aria-hidden":"true",className:ke("pkt-user-menu__link",e),children:s.title}):o.jsxs("button",{className:ke("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left",e),type:"button",onClick:()=>{"onClick"in s&&typeof s.onClick=="function"?s.onClick():console.error("UserMenuButton item is missing onClick handler or onClick is not a function:",s)},children:[s.iconName&&o.jsx(R,{name:s.iconName,className:"pkt-link__icon","aria-hidden":"true"}),s.title]}),Km=({links:s})=>o.jsx("ul",{className:"pkt-user-menu__sublist",children:s.map((e,t)=>o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:e})},t))}),_l=d.forwardRef(({user:s,formattedLastLoggedIn:e,representing:t,userMenu:n,canChangeRepresentation:i,changeRepresentation:r,logoutOnClick:a},l)=>{const c=n==null?void 0:n.map(Ym);return o.jsx("nav",{className:"pkt-user-menu",ref:l,"aria-label":"Meny for innlogget bruker",children:o.jsxs("ul",{className:"pkt-user-menu__list",children:[s&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:s.name}),e&&o.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o.jsx("time",{children:e})]})]}),c&&c.length>0&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Km,{links:c})}),t&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:t.name}),t.orgNumber&&o.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",t.orgNumber]}),i&&r&&o.jsx("ul",{className:"pkt-user-menu__sublist mt-size-16",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})]}),!t&&i&&r&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx("ul",{className:"pkt-user-menu__sublist",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Gi,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});_l.displayName="PktHeaderUserMenu";const Xi=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,autocomplete:n="off",counter:i,counterMaxLength:r,className:a,disabled:l=!1,errorMessage:c,hasError:p=!1,helptext:g,helptextDropdown:b,helptextDropdownButton:f,iconNameRight:k,inline:v=!1,fullwidth:$=!1,label:M,name:S,optionalTag:T=!1,optionalText:L,requiredTag:D=!1,requiredText:Y,tagText:ee=null,placeholder:oe,prefix:ye,suffix:K,type:N="text",useWrapper:q=!0,omitSearchIcon:B=!1,value:G,minLength:le,maxLength:ae,min:pe,max:ue,step:be,size:se,readonly:re,required:Ue,dataTestid:Q,onChange:P,skipForwardTestid:Me=!1,...De},ne)=>{const He=[a,"pkt-textinput"].join(" "),Pe=N==="search"&&!k&&!B,$e=N==="date"&&G?G.slice(0,10):G,[Te,Ae]=d.useState((G==null?void 0:G.length)||0),ze=`${s}`,We=`${ze}-label`,ve=t||We,E=Ie=>{var Ye,U;i&&Ae(((U=(Ye=Ie.currentTarget)==null?void 0:Ye.value)==null?void 0:U.length)||0),P&&P(Ie)};return d.useEffect(()=>{G!==void 0&&Ae((G==null?void 0:G.length)||0)},[G]),o.jsx(Ts,{ariaDescribedby:e,className:He,disabled:l,errorMessage:c,forId:ze,hasError:p,helptext:g,helptextDropdown:b,helptextDropdownButton:f,inline:v,label:M,optionalTag:T,optionalText:L,requiredTag:D,requiredText:Y,tagText:ee,useWrapper:q,counter:i,counterCurrent:Te,counterMaxLength:r,children:o.jsxs("div",{className:"pkt-input__container","data-testid":Q,"data-skip-forward-testid":Me?"true":void 0,children:[ye&&o.jsx("div",{className:"pkt-input-prefix",children:ye}),o.jsx("input",{...De,ref:ne,className:`pkt-input ${$?"pkt-input--fullwidth":""} ${r&&Te>r?"pkt-input--counter-error":""}`,type:N,name:`${S||s}`,value:$e,id:ze,placeholder:oe,autoComplete:n,disabled:l,"aria-invalid":p,"aria-errormessage":`${s}-error`,"aria-labelledby":ve,min:pe,max:ue,onChange:E,step:be,minLength:le,maxLength:ae,size:se,readOnly:re,required:Ue}),K&&o.jsxs("p",{className:"pkt-input-suffix",children:[K,k&&o.jsx(R,{className:"pkt-input-suffix-icon",name:k}),Pe&&o.jsx(R,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!K&&k&&o.jsx(R,{className:"pkt-input-icon",name:k}),!K&&Pe&&o.jsx(R,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});Xi.displayName="PktTextinput";const Kr=d.forwardRef(({mobileBreakpoint:s=768,tabletBreakpoint:e=1280,children:t,className:n,compact:i=!1,"data-mode":r,logOutButtonPlacement:a="none",logOut:l,openedMenu:c,showSearch:p=!1,onSearch:g,onSearchChange:b,searchValue:f,searchPlaceholder:k="Søk",representing:v,serviceLink:$,serviceClick:M,serviceName:S,user:T,userMenu:L,userMenuFooter:D,userOptions:Y,canChangeRepresentation:ee=!1,changeRepresentation:oe,hideLogo:ye=!1,logoLink:K,logoClick:N,position:q="fixed",scrollBehavior:B="hide",slotMenuVariant:G="icon-only",slotMenuText:le="Meny"},ae)=>{const pe=q==="fixed",ue=B==="hide";d.useEffect(()=>{D&&console.warn('PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.')},[D]),d.useEffect(()=>{Y&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[Y]),d.useEffect(()=>{T!=null&&T.shortname&&console.warn('PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.'),v!=null&&v.shortname&&console.warn('PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.')},[T==null?void 0:T.shortname,v==null?void 0:v.shortname]);const be=d.useMemo(()=>{if(T!=null&&T.lastLoggedIn)return typeof T.lastLoggedIn=="string"?T.lastLoggedIn:new Date(T.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"})},[T==null?void 0:T.lastLoggedIn]),[se,re]=d.useState(c||"none");d.useEffect(()=>{c!==void 0&&re(c)},[c]);const[Ue,Q]=d.useState(!1),[P,Me]=d.useState(0),[De,ne]=d.useState(!1),[He,Pe]=d.useState(!1),$e=d.useRef(null),Te=d.useRef(null),Ae=d.useRef(null),ze=d.useRef(null),We=d.useRef(null),ve=d.useRef(null),E=d.useRef(null),Ie=d.useRef(!1),Ye=Wm($e),U=Ye<s,V=Ye<e,te=d.useCallback(h=>{$e.current=h,typeof ae=="function"?ae(h):ae&&(ae.current=h)},[ae]);zm(pe&&U&&se!=="none");const me=d.useCallback((h,_)=>{const C=h.relatedTarget;let j;switch(_){case"user":j=Te;break;case"slot":j=Ae;break;case"search":j=ze;break;default:return}const W=j.current;W&&(!C||!W.contains(C))&&re("none")},[]),fe=d.useCallback(()=>{Ie.current&&E.current&&document.contains(E.current)&&E.current.focus(),E.current=null,Ie.current=!1},[]);d.useEffect(()=>{const h=C=>{T&&se==="user"&&!C.target.closest(".pkt-header-service__user-container")&&re("none"),se==="slot"&&!C.target.closest(".pkt-header-service__slot-container")&&re("none"),se==="search"&&!C.target.closest(".pkt-header-service__search-container")&&!C.target.closest(".pkt-header-service__search-input")&&re("none")},_=C=>{C.key==="Escape"&&se!=="none"&&(C.preventDefault(),Ie.current=!0,re("none"))};if(se!=="none")return document.addEventListener("mousedown",h),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",_)};fe()},[se,T,fe]),d.useEffect(()=>{const h=()=>{if(ue){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-P)<60)return;Q(_>P),Me(_)}};return document&&window.addEventListener("scroll",h),()=>{document&&window.removeEventListener("scroll",h)}},[ue,P]);const Xe=d.useCallback(h=>{const _=h==="slot"?Ae:ze,C=h==="slot"?We:ve;if(!_.current||!C.current||!V||U)return;const j=_.current.getBoundingClientRect(),W=C.current.offsetWidth,de=j.left+W>window.innerWidth;h==="slot"?ne(de):Pe(de)},[V,U]),Ke=d.useCallback(h=>{se!=="none"?re("none"):(E.current=document.activeElement,re(h))},[se]);d.useEffect(()=>{(se==="slot"||se==="search")&&requestAnimationFrame(()=>{Xe(se)})},[se,Xe]);const m=o.jsxs("header",{className:ke("pkt-header-service",i&&"pkt-header-service--compact",U&&"pkt-header-service--mobile",V&&"pkt-header-service--tablet",pe&&"pkt-header-service--fixed",ue&&"pkt-header-service--scroll-to-hide",Ue&&"pkt-header-service--hidden",n),"data-mode":r,ref:te,children:[o.jsxs("div",{className:ke("pkt-header-service__logo-area",(!S||S==="")&&"pkt-header-service__logo-area--without-service"),children:[!ye&&o.jsx("span",{className:"pkt-header-service__logo",children:K?o.jsx("a",{href:K,"aria-label":"Tilbake til forside",children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}):N?o.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header-service__logo-link",onClick:N,children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}):o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}),S&&o.jsx("span",{className:"pkt-header-service__service-name",children:$?o.jsx(Ki,{href:$,className:"pkt-header-service__service-link ",children:S}):M?o.jsx("button",{className:"pkt-link-button pkt-link pkt-header-service__service-link",onClick:M,children:S}):o.jsx("span",{className:"pkt-header-service__service-link",children:S})})]}),o.jsxs("div",{className:"pkt-header-service__content",children:[o.jsxs("div",{className:ke("pkt-header-service__slot-container",se==="slot"&&"is-open"),onBlur:h=>me(h,"slot"),ref:Ae,children:[V&&t&&o.jsx(gt,{skin:"secondary",variant:G,iconName:"menu",size:U?"small":"medium",state:se==="slot"?"active":"normal",onClick:()=>Ke("slot"),"aria-expanded":se==="slot","aria-controls":"mobile-slot-menu","aria-label":"Åpne meny",children:le}),o.jsx("div",{className:ke("pkt-header-service__slot-content",De&&"align-right"),id:"mobile-slot-menu",role:V?"menu":void 0,"aria-label":V?"Meny":void 0,ref:We,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),p&&o.jsx(o.Fragment,{children:V?o.jsxs("div",{className:ke("pkt-header-service__search-container",se==="search"&&"is-open"),onBlur:h=>me(h,"search"),ref:ze,children:[o.jsx(gt,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:U?"small":"medium",onClick:()=>Ke("search"),state:se==="search"?"active":"normal","aria-expanded":se==="search","aria-controls":"mobile-search-menu","aria-label":"Åpne søkefelt",children:"Søk"}),o.jsx("div",{className:ke("pkt-header-service__mobile-menu",se==="search"&&"is-open",He&&"align-right"),ref:ve,children:se==="search"&&o.jsx(Xi,{id:"mobile-search-menu",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,autoFocus:!0,fullwidth:!0,onChange:h=>b==null?void 0:b(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(g==null||g(h.target.value))}})})]}):o.jsx(Xi,{id:"header-service-search",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,onChange:h=>b==null?void 0:b(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(g==null||g(h.target.value))}})}),V&&l&&(a==="header"||a==="both")&&o.jsx(gt,{skin:"secondary",size:U?"small":"medium",variant:"icon-only",iconName:"exit",onClick:l,children:"Logg ut"})]}),o.jsxs("div",{className:"pkt-header-service__user",children:[T&&o.jsxs("div",{className:"pkt-header-service__user-container",onBlur:h=>me(h,"user"),ref:Te,children:[o.jsxs(gt,{className:ke("pkt-header-service__user-button",U&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:U?"small":"medium",state:se==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:se==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>Ke("user"),children:[o.jsx("span",{className:"pkt-sr-only",children:"Brukermeny: "}),(v==null?void 0:v.name)||T.name]}),se==="user"&&T&&o.jsx("div",{className:ke(U?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(_l,{user:T,formattedLastLoggedIn:be,representing:v,userMenu:L,canChangeRepresentation:ee,changeRepresentation:oe,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!U&&l&&(a==="header"||a==="both")&&o.jsx(gt,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return pe?o.jsxs("div",{className:"pkt-header-service-wrapper",children:[m,o.jsx("div",{className:ke("pkt-header-service-spacer",i&&"pkt-header-service-spacer--compact",T&&"pkt-header-service-spacer--has-user",U&&"pkt-header-service-spacer--mobile",V&&"pkt-header-service-spacer--tablet")})]}):m});Kr.displayName="PktHeaderService";const wl=d.forwardRef((s,e)=>o.jsx(Kr,{...s,ref:e}));wl.displayName="PktHeader";const Gm=os({tagName:"pkt-heading",elementClass:_s,react:d,displayName:"PktHeading"}),$l=d.forwardRef(({children:s,...e},t)=>o.jsx(Gm,{"data-testid":"pkt-heading",...e,ref:t,children:s}));$l.displayName="PktHeading";const Xm=os({tagName:"pkt-helptext",elementClass:us,react:d,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),xl=d.forwardRef(({children:s,...e},t)=>o.jsx(Xm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));xl.displayName="PktHelptext";const Sl=d.forwardRef(({label:s,id:e,children:t,...n},i)=>o.jsxs("div",{className:"pkt-form-group",children:[o.jsx("label",{htmlFor:e,className:"pkt-form-label",children:s}),o.jsx("input",{className:"pkt-form-input",id:e,...n,ref:i}),t]}));Sl.displayName="PktInput";const Cl=({children:s,skin:e,title:t,href:n,iconName:i,openInNewTab:r,external:a,className:l,...c})=>{const p=["pkt-linkcard",e&&`pkt-linkcard--${e}`].filter(Boolean).join(" "),g=["pkt-linkcard__title",a&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return o.jsxs("a",{...c,href:n,className:ke(p,l),target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:[i&&o.jsx(R,{className:"pkt-link__icon",name:i}),t&&o.jsx("div",{className:ke(g),children:t}),o.jsx("div",{className:"pkt-linkcard__text",children:s})]})};Cl.displayName="PktLinkCard";const Qm=os({tagName:"pkt-loader",elementClass:zt,react:d,displayName:"PktLoader",events:{}}),Tl=d.forwardRef(({children:s,...e},t)=>o.jsx(Qm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Tl.displayName="PktLoader";const Nl=({children:s,className:e,skin:t,title:n,compact:i,closable:r,onClose:a,...l})=>{const[c,p]=d.useState(!1),g={"pkt-messagebox":!0,"pkt-messagebox--compact":i,[`pkt-messagebox--${t}`]:t,"pkt-messagebox--closable":r,"pkt-hide":c},b=d.createRef(),f=d.useCallback(()=>{p(!0),a&&a()},[p,a]);return o.jsxs("div",{...l,className:ke(g,e),ref:b,children:[r&&o.jsx("div",{className:"pkt-messagebox__close",children:o.jsx("button",{onClick:f,className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only","aria-label":"Lukk",children:o.jsx(R,{name:"close",className:"pkt-link__icon"})})}),n&&o.jsx("div",{className:"pkt-messagebox__title",children:n}),o.jsx("div",{className:"pkt-messagebox__text",children:s})]})};Nl.displayName="PktMessagebox";const Zm=os({tagName:"pkt-progressbar",elementClass:Je,react:d,displayName:"PktProgressbar",events:{}}),Qi=d.forwardRef(({children:s,...e},t)=>o.jsx(Zm,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));Qi.displayName="PktProgressbar";const Ml=d.forwardRef(({id:s,name:e,label:t,className:n,hasTile:i=!1,disabled:r=!1,checkHelptext:a,hasError:l=!1,defaultChecked:c,checked:p,optionalTag:g,optionalText:b,requiredTag:f,requiredText:k,tagText:v,...$},M)=>{const S=[n,"pkt-input-check"].filter(Boolean).join(" "),T=["pkt-input-check__input",i?"pkt-input-check__input--tile":"",r&&i?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),L=["pkt-input-check__input-checkbox",l?"pkt-input-check__input-checkbox--error":""].filter(Boolean).join(" "),D=["pkt-input-check__input-label",r?"pkt-input-check__input-label--disabled":""].filter(Boolean).join(" "),Y=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),ee=()=>o.jsxs(o.Fragment,{children:[v&&o.jsx("span",{className:Y+" pkt-tag--gray",children:v}),g&&o.jsx("span",{className:Y+" pkt-tag--blue-light",children:b}),f&&o.jsx("span",{className:Y+" pkt-tag--beige",children:k})]});return o.jsx("div",{className:S,children:o.jsxs("div",{className:T,children:[o.jsx("input",{ref:M,id:s,type:"radio",name:e,disabled:r,className:L,...p!==void 0?{checked:p}:{defaultChecked:c},...$}),o.jsxs("label",{className:D,htmlFor:s,children:[t," ",ee(),a&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});Ml.displayName="PktRadioButton";const Dl=d.forwardRef(({appearance:s="local",disabled:e=!1,fullwidth:t=!1,id:n,label:i,name:r,placeholder:a="Søk…",suggestions:l,value:c="",action:p,method:g,onChange:b,onSearch:f,onSuggestionClick:k,...v},$)=>{const M=(D,Y)=>{D?D():k&&k(Y)},S=D=>{c=D.target.value},T=`pkt-searchinput pkt-searchinput--${s} ${t?"pkt-searchinput--fullwidth":""}`;let L;return p?L=D=>o.jsx("form",{role:"search",className:T,action:p,method:g,children:D}):L=D=>o.jsx("div",{role:"search",className:T,children:D}),L(o.jsxs(o.Fragment,{children:[i&&o.jsx("label",{htmlFor:i?n:void 0,className:i?"pkt-inputwrapper__label":"",children:i}),o.jsxs("div",{className:s==="local"?"pkt-input__container":"pkt-searchinput__field",children:[o.jsx("input",{className:`pkt-input ${t?"pkt-input--fullwidth":""}`,type:"search",name:r||n,id:n,placeholder:a,defaultValue:c,disabled:e,autoComplete:"off","aria-autocomplete":"list",ref:$,"aria-controls":`${n}-suggestions`,onChange:b||S,onKeyUp:f&&(D=>{D.key==="Enter"&&(D.preventDefault(),f(c))}),...v}),o.jsx(gt,{className:`pkt-searchinput__button ${s==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:s==="local"?"tertiary":"primary",color:s==="global"?"yellow":void 0,type:"submit",disabled:e,onClick:f&&(D=>{D.preventDefault(),f(c)}),children:i||a})]}),l&&o.jsx("ul",{id:`${n}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:l.map((D,Y)=>o.jsx("li",{children:d.createElement(D.href?"a":D.onClick?"button":"div",{href:D.href,className:`pkt-searchinput__suggestion ${D.onClick?"pkt-link-button":""} ${D.href||D.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:D.onClick?"button":void 0,onClick:()=>M(D.onClick,Y),onKeyUp:ee=>ee.key==="Enter"&&M(D.onClick,Y)},o.jsxs(o.Fragment,{children:[D.title&&o.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:D.title}),D.text&&o.jsx("p",{className:"pkt-searchinput__suggestion-text",children:D.text})]}))},`search-suggestion-${Y}`))})]}))});Dl.displayName="PktSearchInput";const Ol=d.forwardRef(({ariaDescribedby:s,ariaLabelledby:e,children:t,className:n,disabled:i=!1,errorMessage:r,hasError:a,helptext:l,helptextDropdown:c,helptextDropdownButton:p,id:g,inline:b=!1,fullwidth:f=!1,label:k,name:v,optionalTag:$=!1,optionalText:M,requiredTag:S=!1,requiredText:T,tagText:L,...D},Y)=>{const ee=[n,"pkt-select"].join(" ");return o.jsx(Ts,{className:ee,forId:`${g}-input`,label:k,helptext:l,helptextDropdown:c,helptextDropdownButton:p,optionalTag:$,optionalText:M,requiredTag:S,requiredText:T,tagText:L,hasError:a,errorMessage:r,disabled:i,inline:b,ariaDescribedby:s,children:o.jsx("select",{ref:Y,className:`pkt-input ${f?"pkt-input--fullwidth":""}`,"aria-invalid":a,"aria-errormessage":`${g}-error`,"aria-labelledby":e||void 0,disabled:i,id:`${g}-input`,name:v||g,...D,children:t})})});Ol.displayName="PktSelect";const Jm=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:o.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),Rm=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),o.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),eb=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),o.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),tb=({children:s,className:e,status:t="incomplete",title:n})=>o.jsxs("li",{className:ke("pkt-step",e,`pkt-step--${t}`),"data-testid":"pkt-step",children:[o.jsx("span",{className:"pkt-step__line pkt-step__line--1","aria-hidden":!0}),o.jsx("span",{className:"pkt-step__line pkt-step__line--2","aria-hidden":!0}),o.jsx("span",{className:ke("pkt-step__indicator"),children:t==="current"?Rm:t==="completed"?eb:Jm}),o.jsx("span",{className:"pkt-step__line pkt-step__line--3","aria-hidden":!0}),o.jsxs("div",{className:"pkt-step__wrapper",children:[o.jsx("div",{className:"pkt-step__title",children:n}),o.jsx("div",{className:"pkt-step__content",children:s})]})]}),El=d.forwardRef(({activeStep:s,className:e,children:t,hideNonActiveSteps:n=!1,hideNonActiveStepsContent:i=!0,orientation:r="vertical",...a},l)=>{const c=ke(e,"pkt-stepper",r==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),p=d.Children.map(t,(g,b)=>d.isValidElement(g)?d.cloneElement(g,{className:ke(g.props.className,{"pkt-step--hideStep":n&&b!==s,"pkt-step--hideContent":i&&b!==s})}):g);return o.jsx("ol",{"data-testid":"pkt-stepper",className:c,ref:l,...a,children:p})});El.displayName="PktStepper";const sb=({className:s,compact:e=!1,skin:t="basic",responsiveView:n=!0,children:i,...r})=>o.jsx("table",{"data-testid":"pkt-table",className:ke(s,"pkt-table",{"pkt-table--responsive":n,"pkt-table--compact":e,"pkt-table--basic":t==="basic","pkt-table--zebra-blue":t==="zebra-blue"}),role:"table",...r,children:i}),nb=({id:s,children:e,className:t,...n})=>o.jsx("tbody",{id:s,className:ke(t,"pkt-table__body",{}),...n,role:"rowgroup",children:e}),ib=({children:s,className:e,dataLabel:t,...n})=>o.jsx("td",{className:ke(e,"pkt-table__data-cell",{}),"data-label":t,role:"cell","data-testid":"pkt-table__data-cell",...n,children:s}),rb=({className:s,children:e,...t})=>o.jsx("thead",{className:ke(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),ab=({className:s,children:e,...t})=>o.jsx("th",{className:ke(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),ob=({className:s,children:e,...t})=>o.jsx("tr",{className:ke(s,"pkt-table__row",{}),role:"row",...t,children:e}),Gr=d.forwardRef(({children:s,active:e,href:t,onClick:n,icon:i,controls:r,tag:a,tagSkin:l,index:c=0},p)=>{const{arrowNav:g,registerTabRef:b,handleKeyPress:f,selectTab:k}=lb(),$={"aria-selected":g?!!e:void 0,"aria-controls":r,role:g?"tab":void 0,onKeyUp:S=>f(c,S),onClick:S=>{k(c),n==null||n(S)},tabIndex:e||!g?void 0:-1,ref:S=>{b(c,S),typeof p=="function"?p(S):p&&(p.current=S)}},M=o.jsxs(o.Fragment,{children:[i&&o.jsx(R,{name:i,className:"pkt-icon--small"}),s,a&&o.jsx(Qs,{skin:l,size:"small",children:a})]});return t?o.jsx("a",{...$,href:t,className:`pkt-tabs__link ${e?"active":""}`,children:M}):o.jsx("button",{...$,type:"button",className:`pkt-tabs__button pkt-link-button ${e?"active":""}`,children:M})});Gr.displayName="PktTabItem";const Pl=d.createContext(null),lb=()=>{const s=d.useContext(Pl);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Al=d.forwardRef(({arrowNav:s=!0,disableArrowNav:e=!1,tabs:t,onTabSelected:n,children:i},r)=>{const a=d.useRef([]),l=s&&!e,p=i&&d.Children.count(i)>0?d.Children.count(i):(t==null?void 0:t.length)||0;d.useEffect(()=>{a.current=a.current.slice(0,p)},[p]);const g=v=>{const $=t==null?void 0:t[v];$!=null&&$.action&&$.action(v),n&&n(v)},b=(v,$)=>{var M,S;l&&($.code==="ArrowLeft"&&v!==0&&((M=a.current[v-1])==null||M.focus()),$.code==="ArrowRight"&&v<p-1&&((S=a.current[v+1])==null||S.focus()),($.code==="ArrowDown"||$.code==="Space")&&g(v))},f=(v,$)=>{a.current[v]=$},k=t==null?void 0:t.map((v,$)=>{var M,S;return o.jsx(Gr,{active:v.active,href:v.href,onClick:()=>g($),icon:v.icon,controls:v.controls,tag:(M=v.tag)==null?void 0:M.text,tagSkin:(S=v.tag)==null?void 0:S.skin,index:$,children:v.text},$)});return o.jsx(Pl.Provider,{value:{arrowNav:l,registerTabRef:f,handleKeyPress:b,selectTab:g},children:o.jsx("div",{className:"pkt-tabs",ref:r,children:o.jsx("div",{className:"pkt-tabs__list",role:l?"tablist":"navigation",children:i||k})})})});Al.displayName="PktTabs";var _n=window.CustomEvent;(!_n||typeof _n=="object")&&(_n=function(s,e){e=e||{};var t=document.createEvent("CustomEvent");return t.initCustomEvent(s,!!e.bubbles,!!e.cancelable,e.detail||null),t},_n.prototype=window.Event.prototype);function Il(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function cb(s){for(;s&&s!==document.body;){var e=window.getComputedStyle(s),t=function(n,i){return!(e[n]===void 0||e[n]===i)};if(e.opacity<1||t("zIndex","auto")||t("transform","none")||t("mixBlendMode","normal")||t("filter","none")||t("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;s=s.parentElement}return!1}function li(s){for(;s;){if(s.localName==="dialog")return s;s.parentElement?s=s.parentElement:s.parentNode?s=s.parentNode.host:s=null}return null}function Ll(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function ub(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function Xr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Bl(s){var e=["button","input","keygen","select","textarea"],t=e.map(function(a){return a+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');var n=s.querySelector(t.join(", "));if(!n&&"attachShadow"in Element.prototype)for(var i=s.querySelectorAll("*"),r=0;r<i.length&&!(i[r].tagName&&i[r].shadowRoot&&(n=Bl(i[r].shadowRoot),n));r++);return n}function Fl(s){return s.isConnected||document.body.contains(s)}function Vl(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=_e.formSubmitter;if(!t){var n=s.target,i="getRootNode"in n&&n.getRootNode()||document;t=i.activeElement}return!t||t.form!==e?null:t}function db(s){if(!s.defaultPrevented){var e=s.target,t=_e.imagemapUseValue,n=Vl(s);t===null&&n&&(t=n.value);var i=li(e);if(i){var r=n&&n.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?i.close(t):i.close())}}}function Ul(s){if(this.dialog_=s,this.replacedStyleTop_=!1,this.openAsModal_=!1,s.hasAttribute("role")||s.setAttribute("role","dialog"),s.show=this.show.bind(this),s.showModal=this.showModal.bind(this),s.close=this.close.bind(this),s.addEventListener("submit",db,!1),"returnValue"in s||(s.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(s,{attributes:!0,attributeFilter:["open"]})}else{var t=!1,n=(function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}).bind(this),i,r=function(a){if(a.target===s){var l="DOMNodeRemoved";t|=a.type.substr(0,l.length)===l,window.clearTimeout(i),i=window.setTimeout(n,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){s.addEventListener(a,r)})}Object.defineProperty(s,"open",{set:this.setOpen.bind(this),get:s.hasAttribute.bind(s,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Ul.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Fl(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),_e.dm.removeDialog(this))},setOpen:function(s){s?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(s){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var t=document.createEvent("MouseEvents");t.initMouseEvent(s.type,s.bubbles,s.cancelable,window,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget),this.dialog_.dispatchEvent(t),s.stopPropagation()},focus_:function(){var s=this.dialog_.querySelector("[autofocus]:not([disabled])");!s&&this.dialog_.tabIndex>=0&&(s=this.dialog_),s||(s=Bl(this.dialog_)),Ll(document.activeElement),s&&s.focus()},updateZIndex:function(s,e){if(s<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=s,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Fl(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!_e.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");cb(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,_e.needsCentering(this.dialog_)?(_e.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(s){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),s!==void 0&&(this.dialog_.returnValue=s);var e=new _n("close",{bubbles:!1,cancelable:!1});Il(this.dialog_,e)}};var _e={};if(_e.reposition=function(s){var e=document.body.scrollTop||document.documentElement.scrollTop,t=e+(window.innerHeight-s.offsetHeight)/2;s.style.top=Math.max(e,t)+"px"},_e.isInlinePositionSetByStylesheet=function(s){for(var e=0;e<document.styleSheets.length;++e){var t=document.styleSheets[e],n=null;try{n=t.cssRules}catch{}if(n)for(var i=0;i<n.length;++i){var r=n[i],a=null;try{a=document.querySelectorAll(r.selectorText)}catch{}if(!(!a||!ub(a,s))){var l=r.style.getPropertyValue("top"),c=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||c&&c!=="auto")return!0}}}return!1},_e.needsCentering=function(s){var e=window.getComputedStyle(s);return e.position!=="absolute"||s.style.top!=="auto"&&s.style.top!==""||s.style.bottom!=="auto"&&s.style.bottom!==""?!1:!_e.isInlinePositionSetByStylesheet(s)},_e.forceRegisterDialog=function(s){if((window.HTMLDialogElement||s.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",s),s.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Ul(s)},_e.registerDialog=function(s){s.showModal||_e.forceRegisterDialog(s)},_e.DialogManager=function(){this.pendingDialogStack=[];var s=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(e){this.forwardTab_=void 0,e.stopPropagation(),s([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var t=[];e.forEach(function(n){for(var i=0,r;r=n.removedNodes[i];++i){if(r instanceof Element)r.localName==="dialog"&&t.push(r);else continue;t=t.concat(r.querySelectorAll("dialog"))}}),t.length&&s(t)}))},_e.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},_e.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},_e.DialogManager.prototype.updateStacking=function(){for(var s=this.zIndexHigh_,e=0,t;t=this.pendingDialogStack[e];++e)t.updateZIndex(--s,--s),e===0&&(this.overlay.style.zIndex=--s);var n=this.pendingDialogStack[0];if(n){var i=n.dialog.parentNode||document.body;i.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},_e.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=li(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},_e.DialogManager.prototype.handleFocus_=function(s){var e=s.composedPath?s.composedPath()[0]:s.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(s.preventDefault(),s.stopPropagation(),Ll(e),this.forwardTab_!==void 0)){var t=this.pendingDialogStack[0],n=t.dialog,i=n.compareDocumentPosition(e);return i&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?t.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},_e.DialogManager.prototype.handleKey_=function(s){if(this.forwardTab_=void 0,s.keyCode===27){s.preventDefault(),s.stopPropagation();var e=new _n("cancel",{bubbles:!1,cancelable:!0}),t=this.pendingDialogStack[0];t&&Il(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},_e.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},_e.DialogManager.prototype.pushDialog=function(s){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(s)===1&&this.blockDocument(),this.updateStacking(),!0)},_e.DialogManager.prototype.removeDialog=function(s){var e=this.pendingDialogStack.indexOf(s);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},_e.dm=new _e.DialogManager,_e.formSubmitter=null,_e.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Hl=document.createElement("form");if(Hl.setAttribute("method","dialog"),Hl.method!=="dialog"){var wn=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(wn){var hb=wn.get;wn.get=function(){return Xr(this)?"dialog":hb.call(this)};var pb=wn.set;wn.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):pb.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",wn)}}document.addEventListener("click",function(s){if(_e.formSubmitter=null,_e.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!Xr(e.form))){var n=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!n){if(!(e.localName==="input"&&e.type==="image"))return;_e.imagemapUseValue=s.offsetX+","+s.offsetY}var i=li(e);i&&(_e.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=li(e);if(!t){var n=Vl(s),i=n&&n.getAttribute("formmethod")||e.getAttribute("method");i==="dialog"&&s.preventDefault()}});var fb=HTMLFormElement.prototype.submit,gb=function(){if(!Xr(this))return fb.call(this);var s=li(this);s&&s.close()};HTMLFormElement.prototype.submit=gb}const mb=Object.freeze(Object.defineProperty({__proto__:null,default:_e},Symbol.toStringTag,{value:"Module"}));H.FileItem=gl,H.ItemRenderers=Yr,H.PktAccordion=na,H.PktAccordionItem=Mo,H.PktAlert=Bi,H.PktBackLink=Oo,H.PktBreadcrumbs=Eo,H.PktButton=gt,H.PktCalendar=Vr,H.PktCard=nl,H.PktCheckbox=il,H.PktCombobox=ul,H.PktConsent=Wi,H.PktDatepicker=pl,H.PktFileUpload=yl,H.PktFooter=jm,H.PktFooterSimple=qm,H.PktHeader=wl,H.PktHeaderService=Kr,H.PktHeading=$l,H.PktHelptext=xl,H.PktIcon=R,H.PktInput=Sl,H.PktInputWrapper=Ts,H.PktLink=Ki,H.PktLinkCard=Cl,H.PktLoader=Tl,H.PktMessagebox=Nl,H.PktModal=qr,H.PktProgressbar=Qi,H.PktRadioButton=Ml,H.PktSearchInput=Dl,H.PktSelect=Ol,H.PktStep=tb,H.PktStepper=El,H.PktTabItem=Gr,H.PktTable=sb,H.PktTableBody=nb,H.PktTableDataCell=ib,H.PktTableHeader=rb,H.PktTableHeaderCell=ab,H.PktTableRow=ob,H.PktTabs=Al,H.PktTag=Qs,H.PktTextarea=jr,H.PktTextinput=Xi,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
1704
+ */var Do;function Hp(){return Do||(Do=1,(function(s){(function(){var e={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(r=i(r,n(l)))}return r}function n(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var l in r)e.call(r,l)&&r[l]&&(a=i(a,l));return a}function i(r,a){return a?r?r+" "+a:r+a:r}s.exports?(t.default=t,s.exports=t):window.classNames=t})()})(Or)),Or.exports}var jp=Hp();const ke=Up(jp),Bi=({children:s,closeAlert:e,compact:t,title:n,date:i,ariaLive:r,"aria-live":a="polite",role:l="status",skin:c="info",className:p,...g})=>{const[b,f]=d.useState(!1),k={"pkt-alert":!0,"pkt-alert--compact":t,[`pkt-alert--${c}`]:c,"pkt-hide":b},v={"pkt-alert__grid":!0,"pkt-alert__noTitle":!n,"pkt-alert__noDate":!i},$=d.useCallback(()=>{f(!0),g.onClose&&g.onClose(new CustomEvent("close",{detail:{origin:event},bubbles:!0,composed:!0}))},[g.onClose,f]),M=r||a;return o.jsx("div",{...g,"aria-live":M,role:l,className:ke(k,p),children:o.jsxs("div",{className:ke(v),children:[o.jsx(R,{className:"pkt-alert__icon","aria-hidden":"true",name:c==="info"?"alert-information":`alert-${c}`}),e&&o.jsx("div",{className:"pkt-alert__close",children:o.jsx(gt,{tabIndex:0,"aria-label":"close",size:t?"small":"medium",type:"button",skin:"tertiary",iconName:"close",variant:"icon-only",onClick:$,children:o.jsx("span",{className:"sr-only",children:"Lukk"})})}),n&&o.jsx("div",{className:"pkt-alert__title",children:n}),o.jsx("div",{className:"pkt-alert__text",children:s}),i&&o.jsxs("div",{className:"pkt-alert__date",children:["Sist oppdatert: ",i]})]})})};Bi.displayName="PktAlert";const Oo=os({tagName:"pkt-backlink",elementClass:on,react:d,displayName:"PktBackLink"});Oo.displayName="PktBackLink";const Eo=d.forwardRef(({breadcrumbs:s,navigationType:e,renderLink:t,className:n,...i},r)=>{const a=s,l=a[a.length-2],c=[n,"pkt-breadcrumbs"].filter(Boolean).join(" "),p=t||(e==="router"?({href:g,className:b,children:f,props:k})=>o.jsx(Yl.Link,{to:g,className:b,...k,children:f}):({href:g,className:b,children:f,props:k})=>o.jsx("a",{href:g,className:b,...k,children:f}));return o.jsxs("nav",{ref:r,"aria-label":"brødsmulemeny",className:c,children:[o.jsx("ol",{className:"pkt-breadcrumbs__list pkt-breadcrumbs--desktop",children:a.map((g,b)=>o.jsx("li",{className:"pkt-breadcrumbs__item",children:b===a.length-1?o.jsx("span",{className:"pkt-breadcrumbs__label","aria-current":"true",children:o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})}):p({href:g.href,className:"pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-icon pkt-breadcrumbs__icon pkt-link__icon",name:"chevron-thin-right"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:g.text})]}),props:i})},`breadcrumb-${b}`))}),p({href:l.href,className:"pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile",children:o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-back-link__icon pkt-icon pkt-link__icon",name:"chevron-thin-left"}),o.jsx("span",{className:"pkt-breadcrumbs__text",children:l.text})]}),props:i})]})});Eo.displayName="PktBreadcrumbs",window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/16.0/animations/";const gt=d.forwardRef(({children:s,className:e,iconName:t="user",secondIconName:n="user",iconPath:i,secondIconPath:r,size:a="medium",fullWidth:l=!1,fullWidthOnMobile:c=!1,skin:p="primary",type:g="button",variant:b="label-only",state:f,color:k,isLoading:v=void 0,disabled:$=void 0,loadingAnimationPath:M=window.pktAnimationPath,...S},T)=>{const L=[e,"pkt-btn",a&&`pkt-btn--${a}`,l&&"pkt-btn--full",c&&"pkt-btn--full-small",p&&`pkt-btn--${p}`,b&&`pkt-btn--${b}`,k&&`pkt-btn--${k}`,f&&`pkt-btn--${f}`,v&&"pkt-btn--isLoading"].filter(Boolean).join(" ");return o.jsxs("button",{...S,"aria-busy":v||void 0,"aria-disabled":$||void 0,disabled:$,className:L,type:g,ref:T,children:[v&&o.jsx(R,{className:"pkt-btn__icon pkt-btn__spinner",name:"spinner-blue",path:M}),b!=="label-only"&&o.jsx(R,{className:"pkt-btn__icon",name:t,...i&&{path:i}}),o.jsx("span",{className:"pkt-btn__text",children:s}),b==="icons-right-and-left"&&o.jsx(R,{className:"pkt-btn__icon",name:n,...r&&{path:r}})]})});gt.displayName="PktButton";const Po=6048e5,qp=864e5,Ao=Symbol.for("constructDateFrom");function ss(s,e){return typeof s=="function"?s(e):s&&typeof s=="object"&&Ao in s?s[Ao](e):s instanceof Date?new s.constructor(e):new Date(e)}function Ct(s,e){return ss(e||s,s)}function Io(s,e,t){const n=Ct(s,t==null?void 0:t.in);return isNaN(e)?ss(s,NaN):(e&&n.setDate(n.getDate()+e),n)}let Wp={};function Fi(){return Wp}function ei(s,e){var l,c,p,g;const t=Fi(),n=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((g=(p=t.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??0,i=Ct(s,e==null?void 0:e.in),r=i.getDay(),a=(r<n?7:0)+r-n;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function Vi(s,e){return ei(s,{...e,weekStartsOn:1})}function Lo(s,e){const t=Ct(s,e==null?void 0:e.in),n=t.getFullYear(),i=ss(t,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const r=Vi(i),a=ss(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const l=Vi(a);return t.getTime()>=r.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Bo(s){const e=Ct(s),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+s-+t}function Fo(s,...e){const t=ss.bind(null,e.find(n=>typeof n=="object"));return e.map(t)}function Er(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function zp(s,e,t){const[n,i]=Fo(t==null?void 0:t.in,s,e),r=Er(n),a=Er(i),l=+r-Bo(r),c=+a-Bo(a);return Math.round((l-c)/qp)}function Yp(s,e){const t=Lo(s,e),n=ss(s,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Vi(n)}function Kp(s){return s instanceof Date||typeof s=="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Gp(s){return!(!Kp(s)&&typeof s!="number"||isNaN(+Ct(s)))}function Xp(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Qp(s,e){const[t,n]=Fo(s,e.start,e.end);return{start:t,end:n}}function Vo(s,e){const{start:t,end:n}=Qp(e==null?void 0:e.in,s);let i=+t>+n;const r=i?+t:+n,a=i?n:t;a.setHours(0,0,0,0);let l=1;const c=[];for(;+a<=r;)c.push(ss(t,a)),a.setDate(a.getDate()+l),a.setHours(0,0,0,0);return i?c.reverse():c}function Zp(s,e){const t=Ct(s,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Jp={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"}},Rp=(s,e,t)=>{let n;const i=Jp[s];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Pr(s){return(e={})=>{const t=e.width?String(e.width):s.defaultWidth;return s.formats[t]||s.formats[s.defaultWidth]}}const ef={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},tf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},sf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},nf={date:Pr({formats:ef,defaultWidth:"full"}),time:Pr({formats:tf,defaultWidth:"full"}),dateTime:Pr({formats:sf,defaultWidth:"full"})},rf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},af=(s,e,t,n)=>rf[s];function ti(s){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let i;if(n==="formatting"&&s.formattingValues){const a=s.defaultFormattingWidth||s.defaultWidth,l=t!=null&&t.width?String(t.width):a;i=s.formattingValues[l]||s.formattingValues[a]}else{const a=s.defaultWidth,l=t!=null&&t.width?String(t.width):s.defaultWidth;i=s.values[l]||s.values[a]}const r=s.argumentCallback?s.argumentCallback(e):e;return i[r]}}const of={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lf={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},cf={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"]},uf={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"]},df={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"}},hf={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"}},pf={ordinalNumber:(s,e)=>{const t=Number(s),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:ti({values:of,defaultWidth:"wide"}),quarter:ti({values:lf,defaultWidth:"wide",argumentCallback:s=>s-1}),month:ti({values:cf,defaultWidth:"wide"}),day:ti({values:uf,defaultWidth:"wide"}),dayPeriod:ti({values:df,defaultWidth:"wide",formattingValues:hf,defaultFormattingWidth:"wide"})};function si(s){return(e,t={})=>{const n=t.width,i=n&&s.matchPatterns[n]||s.matchPatterns[s.defaultMatchWidth],r=e.match(i);if(!r)return null;const a=r[0],l=n&&s.parsePatterns[n]||s.parsePatterns[s.defaultParseWidth],c=Array.isArray(l)?gf(l,b=>b.test(a)):ff(l,b=>b.test(a));let p;p=s.valueCallback?s.valueCallback(c):c,p=t.valueCallback?t.valueCallback(p):p;const g=e.slice(a.length);return{value:p,rest:g}}}function ff(s,e){for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&e(s[t]))return t}function gf(s,e){for(let t=0;t<s.length;t++)if(e(s[t]))return t}function mf(s){return(e,t={})=>{const n=e.match(s.matchPattern);if(!n)return null;const i=n[0],r=e.match(s.parsePattern);if(!r)return null;let a=s.valueCallback?s.valueCallback(r[0]):r[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(i.length);return{value:a,rest:l}}}const bf=/^(\d+)(th|st|nd|rd)?/i,vf=/\d+/i,kf={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},yf={any:[/^b/i,/^(a|c)/i]},_f={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},wf={any:[/1/i,/2/i,/3/i,/4/i]},$f={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},xf={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]},Sf={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},Cf={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]},Tf={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},Nf={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}},Mf={ordinalNumber:mf({matchPattern:bf,parsePattern:vf,valueCallback:s=>parseInt(s,10)}),era:si({matchPatterns:kf,defaultMatchWidth:"wide",parsePatterns:yf,defaultParseWidth:"any"}),quarter:si({matchPatterns:_f,defaultMatchWidth:"wide",parsePatterns:wf,defaultParseWidth:"any",valueCallback:s=>s+1}),month:si({matchPatterns:$f,defaultMatchWidth:"wide",parsePatterns:xf,defaultParseWidth:"any"}),day:si({matchPatterns:Sf,defaultMatchWidth:"wide",parsePatterns:Cf,defaultParseWidth:"any"}),dayPeriod:si({matchPatterns:Tf,defaultMatchWidth:"any",parsePatterns:Nf,defaultParseWidth:"any"})},Df={code:"en-US",formatDistance:Rp,formatLong:nf,formatRelative:af,localize:pf,match:Mf,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Of(s,e){const t=Ct(s,e==null?void 0:e.in);return zp(t,Zp(t))+1}function Ef(s,e){const t=Ct(s,e==null?void 0:e.in),n=+Vi(t)-+Yp(t);return Math.round(n/Po)+1}function Uo(s,e){var g,b,f,k;const t=Ct(s,e==null?void 0:e.in),n=t.getFullYear(),i=Fi(),r=(e==null?void 0:e.firstWeekContainsDate)??((b=(g=e==null?void 0:e.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??i.firstWeekContainsDate??((k=(f=i.locale)==null?void 0:f.options)==null?void 0:k.firstWeekContainsDate)??1,a=ss((e==null?void 0:e.in)||s,0);a.setFullYear(n+1,0,r),a.setHours(0,0,0,0);const l=ei(a,e),c=ss((e==null?void 0:e.in)||s,0);c.setFullYear(n,0,r),c.setHours(0,0,0,0);const p=ei(c,e);return+t>=+l?n+1:+t>=+p?n:n-1}function Pf(s,e){var l,c,p,g;const t=Fi(),n=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((g=(p=t.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??1,i=Uo(s,e),r=ss((e==null?void 0:e.in)||s,0);return r.setFullYear(i,0,n),r.setHours(0,0,0,0),ei(r,e)}function Ho(s,e){const t=Ct(s,e==null?void 0:e.in),n=+ei(t,e)-+Pf(t,e);return Math.round(n/Po)+1}function Ce(s,e){const t=s<0?"-":"",n=Math.abs(s).toString().padStart(e,"0");return t+n}const Ss={y(s,e){const t=s.getFullYear(),n=t>0?t:1-t;return Ce(e==="yy"?n%100:n,e.length)},M(s,e){const t=s.getMonth();return e==="M"?String(t+1):Ce(t+1,2)},d(s,e){return Ce(s.getDate(),e.length)},a(s,e){const t=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(s,e){return Ce(s.getHours()%12||12,e.length)},H(s,e){return Ce(s.getHours(),e.length)},m(s,e){return Ce(s.getMinutes(),e.length)},s(s,e){return Ce(s.getSeconds(),e.length)},S(s,e){const t=e.length,n=s.getMilliseconds(),i=Math.trunc(n*Math.pow(10,t-3));return Ce(i,e.length)}},kn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jo={G:function(s,e,t){const n=s.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(s,e,t){if(e==="yo"){const n=s.getFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return Ss.y(s,e)},Y:function(s,e,t,n){const i=Uo(s,n),r=i>0?i:1-i;if(e==="YY"){const a=r%100;return Ce(a,2)}return e==="Yo"?t.ordinalNumber(r,{unit:"year"}):Ce(r,e.length)},R:function(s,e){const t=Lo(s);return Ce(t,e.length)},u:function(s,e){const t=s.getFullYear();return Ce(t,e.length)},Q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Ce(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(s,e,t){const n=Math.ceil((s.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Ce(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(s,e,t){const n=s.getMonth();switch(e){case"M":case"MM":return Ss.M(s,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(s,e,t){const n=s.getMonth();switch(e){case"L":return String(n+1);case"LL":return Ce(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(s,e,t,n){const i=Ho(s,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):Ce(i,e.length)},I:function(s,e,t){const n=Ef(s);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Ce(n,e.length)},d:function(s,e,t){return e==="do"?t.ordinalNumber(s.getDate(),{unit:"date"}):Ss.d(s,e)},D:function(s,e,t){const n=Of(s);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Ce(n,e.length)},E:function(s,e,t){const n=s.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return Ce(r,2);case"eo":return t.ordinalNumber(r,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(s,e,t,n){const i=s.getDay(),r=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return Ce(r,e.length);case"co":return t.ordinalNumber(r,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(s,e,t){const n=s.getDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return Ce(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(s,e,t){const i=s.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(s,e,t){const n=s.getHours();let i;switch(n===12?i=kn.noon:n===0?i=kn.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(s,e,t){const n=s.getHours();let i;switch(n>=17?i=kn.evening:n>=12?i=kn.afternoon:n>=4?i=kn.morning:i=kn.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(s,e,t){if(e==="ho"){let n=s.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return Ss.h(s,e)},H:function(s,e,t){return e==="Ho"?t.ordinalNumber(s.getHours(),{unit:"hour"}):Ss.H(s,e)},K:function(s,e,t){const n=s.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Ce(n,e.length)},k:function(s,e,t){let n=s.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Ce(n,e.length)},m:function(s,e,t){return e==="mo"?t.ordinalNumber(s.getMinutes(),{unit:"minute"}):Ss.m(s,e)},s:function(s,e,t){return e==="so"?t.ordinalNumber(s.getSeconds(),{unit:"second"}):Ss.s(s,e)},S:function(s,e){return Ss.S(s,e)},X:function(s,e,t){const n=s.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return Wo(n);case"XXXX":case"XX":return Ks(n);case"XXXXX":case"XXX":default:return Ks(n,":")}},x:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"x":return Wo(n);case"xxxx":case"xx":return Ks(n);case"xxxxx":case"xxx":default:return Ks(n,":")}},O:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+qo(n,":");case"OOOO":default:return"GMT"+Ks(n,":")}},z:function(s,e,t){const n=s.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+qo(n,":");case"zzzz":default:return"GMT"+Ks(n,":")}},t:function(s,e,t){const n=Math.trunc(+s/1e3);return Ce(n,e.length)},T:function(s,e,t){return Ce(+s,e.length)}};function qo(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Math.trunc(n/60),r=n%60;return r===0?t+String(i):t+String(i)+e+Ce(r,2)}function Wo(s,e){return s%60===0?(s>0?"-":"+")+Ce(Math.abs(s)/60,2):Ks(s,e)}function Ks(s,e=""){const t=s>0?"-":"+",n=Math.abs(s),i=Ce(Math.trunc(n/60),2),r=Ce(n%60,2);return t+i+e+r}const zo=(s,e)=>{switch(s){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Yo=(s,e)=>{switch(s){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Af={p:Yo,P:(s,e)=>{const t=s.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return zo(s,e);let r;switch(n){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",zo(n,e)).replace("{{time}}",Yo(i,e))}},If=/^D+$/,Lf=/^Y+$/,Bf=["D","DD","YY","YYYY"];function Ff(s){return If.test(s)}function Vf(s){return Lf.test(s)}function Uf(s,e,t){const n=Hf(s,e,t);if(console.warn(n),Bf.includes(s))throw new RangeError(n)}function Hf(s,e,t){const n=s[0]==="Y"?"years":"days of the month";return`Use \`${s.toLowerCase()}\` instead of \`${s}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const jf=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qf=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wf=/^'([^]*?)'?$/,zf=/''/g,Yf=/[a-zA-Z]/;function Kf(s,e,t){var g,b,f,k;const n=Fi(),i=n.locale??Df,r=n.firstWeekContainsDate??((b=(g=n.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??1,a=n.weekStartsOn??((k=(f=n.locale)==null?void 0:f.options)==null?void 0:k.weekStartsOn)??0,l=Ct(s,t==null?void 0:t.in);if(!Gp(l))throw new RangeError("Invalid time value");let c=e.match(qf).map(v=>{const $=v[0];if($==="p"||$==="P"){const M=Af[$];return M(v,i.formatLong)}return v}).join("").match(jf).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const $=v[0];if($==="'")return{isToken:!1,value:Gf(v)};if(jo[$])return{isToken:!0,value:v};if($.match(Yf))throw new RangeError("Format string contains an unescaped latin alphabet character `"+$+"`");return{isToken:!1,value:v}});i.localize.preprocessor&&(c=i.localize.preprocessor(l,c));const p={firstWeekContainsDate:r,weekStartsOn:a,locale:i};return c.map(v=>{if(!v.isToken)return v.value;const $=v.value;(Vf($)||Ff($))&&Uf($,e,String(s));const M=jo[$[0]];return M(l,$,i.localize,p)}).join("")}function Gf(s){const e=s.match(Wf);return e?e[1].replace(zf,"'"):s}function Xf(s,e){const t=Ct(s,e==null?void 0:e.in).getDay();return t===0?7:t}function Qf(s,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:s,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const Ar={},ni={};function Gs(s,e){try{const n=(Ar[s]||(Ar[s]=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"longOffset"}).format))(e).split("GMT")[1];return n in ni?ni[n]:Ko(n,n.split(":"))}catch{if(s in ni)return ni[s];const t=s==null?void 0:s.match(Zf);return t?Ko(s,t.slice(1)):NaN}}const Zf=/([+-]\d\d):?(\d\d)?/;function Ko(s,e){const t=+(e[0]||0),n=+(e[1]||0),i=+(e[2]||0)/60;return ni[s]=t*60+n>0?t*60+n+i:t*60-n-i}class ns extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Gs(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)),Xo(this),Ir(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new ns(...t,e):new ns(Date.now(),e)}withTimeZone(e){return new ns(+this,e)}getTimezoneOffset(){const e=-Gs(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Ir(this),+this}[Symbol.for("constructDateFrom")](e){return new ns(+new Date(e),this.timeZone)}}const Go=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(s=>{if(!Go.test(s))return;const e=s.replace(Go,"$1UTC");ns.prototype[e]&&(s.startsWith("get")?ns.prototype[s]=function(){return this.internal[e]()}:(ns.prototype[s]=function(){return Date.prototype[e].apply(this.internal,arguments),Jf(this),+this},ns.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Ir(this),+this}))});function Ir(s){s.internal.setTime(+s),s.internal.setUTCSeconds(s.internal.getUTCSeconds()-Math.round(-Gs(s.timeZone,s)*60))}function Jf(s){Date.prototype.setFullYear.call(s,s.internal.getUTCFullYear(),s.internal.getUTCMonth(),s.internal.getUTCDate()),Date.prototype.setHours.call(s,s.internal.getUTCHours(),s.internal.getUTCMinutes(),s.internal.getUTCSeconds(),s.internal.getUTCMilliseconds()),Xo(s)}function Xo(s){const e=Gs(s.timeZone,s),t=e>0?Math.floor(e):Math.ceil(e),n=new Date(+s);n.setUTCHours(n.getUTCHours()-1);const i=-new Date(+s).getTimezoneOffset(),r=-new Date(+n).getTimezoneOffset(),a=i-r,l=Date.prototype.getHours.apply(s)!==s.internal.getUTCHours();a&&l&&s.internal.setUTCMinutes(s.internal.getUTCMinutes()+a);const c=i-t;c&&Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+c);const p=new Date(+s);p.setUTCSeconds(0);const g=i>0?p.getSeconds():(p.getSeconds()-60)%60,b=Math.round(-(Gs(s.timeZone,s)*60))%60;(b||g)&&(s.internal.setUTCSeconds(s.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(s,Date.prototype.getUTCSeconds.call(s)+b+g));const f=Gs(s.timeZone,s),k=f>0?Math.floor(f):Math.ceil(f),$=-new Date(+s).getTimezoneOffset()-k,M=k!==t,S=$-c;if(M&&S){Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+S);const T=Gs(s.timeZone,s),L=T>0?Math.floor(T):Math.ceil(T),D=k-L;D&&(s.internal.setUTCMinutes(s.internal.getUTCMinutes()+D),Date.prototype.setUTCMinutes.call(s,Date.prototype.getUTCMinutes.call(s)+D))}}class Cs extends ns{static tz(e,...t){return t.length?new Cs(...t,e):new Cs(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),i=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,i]=this.internal.toUTCString().split(" ");return`${e==null?void 0:e.slice(0,-1)} ${n} ${t} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,i]=this.tzComponents();return`${e} GMT${t}${n}${i} (${Qf(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:(t==null?void 0:t.timeZone)||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",n=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[t,n,i]}withTimeZone(e){return new Cs(+this,e)}[Symbol.for("constructDateFrom")](e){return new Cs(+new Date(e),this.timeZone)}}window.pktTz=window.pktTz===void 0?"Europe/Oslo":window.pktTz;const Rf=(s=window.pktTz)=>{const e=new Cs(new Date().toISOString(),s);return e.setHours(0,0,0,0),isNaN(e.getTime())?new Date:new Date(e.getFullYear(),e.getMonth(),e.getDate())};function is(s){if(!s||s==="")return new Date;if(/^\d{4}-\d{2}-\d{2}$/.test(s)){const[e,t,n]=s.split("-").map(Number);return new Date(e,t-1,n)}if(/^\d{4}-\d{2}$/.test(s)){const[e,t]=s.split("-").map(Number);return new Date(e,t-1,1)}return/^\d{4}$/.test(s)?new Date(Number(s),0,1):new Date(s)}const mt=s=>{if(!s||isNaN(s.getTime()))return"";const e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${e}-${t}-${n}`},ii=s=>{if(!s)return null;const e=is(s);return isNaN(e.getTime())?null:e},eg=(s,e)=>{const t=fs(s);return isNaN(t.getTime())?"":Kf(t,e)},fs=(s="",e)=>{const t=typeof s=="string"?is(s):s;return!t||isNaN(t.getTime())?new Date:e?e==="end"?Xp(t):Er(t):t},yn=(s,e,t=1)=>{if(typeof s!="number"||typeof e!="number"||typeof t!="number"||isNaN(s)||isNaN(e)||isNaN(t))return new Date;const n=new Date(s,e,t);return isNaN(n.getTime())?new Date:n},ri=s=>{let e;return typeof s=="number"?e=new Cs(s,window.pktTz):e=new Cs(s,window.pktTz),e.setHours(12,0,0,0),e};let Lr=null,Qo;const tg=s=>{if(!s||isNaN(s.getTime()))return"";const e=typeof window<"u"?window.pktTz:void 0;return(!Lr||Qo!==e)&&(Lr=new Intl.DateTimeFormat("no",{dateStyle:"full",timeZone:e}),Qo=e),Lr.format(s)},sg=(s,e,t)=>{if(!s||isNaN(s.getTime()))return!1;const n=e?fs(e):null,i=t?fs(t):null;return!(n&&s<n||i&&s>i)},ng=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=mt(s);return e.includes(t)},ig=(s,e)=>{if(!s||isNaN(s.getTime())||!Array.isArray(e))return!1;const t=s.getDay().toString();return e.includes(t)},Zo=(s,e,t,n,i)=>!(!s||isNaN(s.getTime())||!sg(s,e,t)||n&&ng(s,n)||i&&ig(s,i)),rg=(s,e,t,n,i)=>s.filter(r=>{const a=ii(r);return a&&Zo(a,e,t,n,i)}),ag=s=>s.slice().sort((e,t)=>{const n=ii(e),i=ii(t);return!n||!i?0:n.getTime()-i.getTime()}),og=(s,e)=>{const t=ii(s),n=ii(e);return!t||!n?!1:t<=n};function Jo(s,e){const t=(e.excludedates??[]).map(n=>typeof n=="string"?n:mt(n));return!Zo(s,e.earliest,e.latest,t,e.excludeweekdays??[])}function lg(s,e,t,n){return!!(Jo(s,t)||!e&&n.multiple&&n.maxMultiple>0&&n.selectedCount>=n.maxMultiple)}function cg(s,e,t){const n=yn(s,e,0);return!(t&&fs(t)>n)}function ug(s,e,t){const n=yn(e===11?s+1:s,e===11?0:e+1,1);return!(t&&fs(t)<n)}function Ro(s){return typeof s=="string"&&(s=s.split(",")),s.length===1&&s[0]===""?[]:s.map(e=>is(e))}function el(s,e){const t=Vo({start:s,end:e}),n={};if(Array.isArray(t)&&t.length)for(let i=0;i<t.length;i++){const r=t[i],a=r>s&&r<e;n[mt(r)]=a}return n}function tl(s,e,t,n){if(e.length!==1)return!0;const i=Vo({start:e[0],end:s});if(!Array.isArray(i)||!i.length)return!0;for(let r=0;r<i.length;r++){for(const a of t??[])if(a>e[0]&&a<s)return!1;if((n??[]).includes(Xf(i[r]).toString()))return!1}return!0}function Br(s,e){const t=mt(s);return e.includes(t)?e:[...e,t]}function Fr(s,e){const t=mt(s),n=e.indexOf(t);if(n===-1)return e;if(e.length===1)return[];const i=[...e];return i.splice(n,1),i}function sl(s,e,t){const n=mt(s);return e.includes(n)?Fr(s,e):t>0&&e.length>=t?e:Br(s,e)}function dg(s,e,t){const n=mt(s),i=Ro(e);if(e.includes(n))return e.indexOf(n)===0?[]:Fr(s,e);if(e.length>1)return[n];if(e.length===1){if(!tl(s,i,t.excludedates,t.excludeweekdays))return[n];if(i[0]>s)return[n]}return Br(s,e)}const ai=7,hg=6;function pg(s,e){const t=yn(s,e,1),n=yn(s,e+1,0),i=(t.getDay()+hg)%ai,r=n.getDate(),a=Math.ceil((r+i)/ai),c=yn(s,e,0).getDate(),p=Ho(t);return{firstDayOfMonth:t,lastDayOfMonth:n,startingDay:i,numDays:r,numRows:a,numDaysPrevMonth:c,initialWeek:p}}function fg(s,e,t,n){const{startingDay:i,numDays:r}=n;return s===0&&e<i?"prev-month":t>r?"next-month":"current-month"}function gg(s,e,t,n){const{startingDay:i,numDaysPrevMonth:r,numDays:a}=n;return s==="prev-month"?r-(i-e-1):s==="next-month"?t-a:t}const mg={ArrowLeft:-1,ArrowRight:1,ArrowUp:-ai,ArrowDown:ai};function bg(s){var t;const e=s.nodeName;return e==="INPUT"||e==="SELECT"||e==="BUTTON"&&!((t=s.dataset)!=null&&t.date)}function vg(s,e,t){let n=Io(s,e);if(!n)return null;let i=t(`button[data-date="${mt(n)}"]`);for(;i instanceof HTMLButtonElement&&i.dataset.disabled;)if(n=Io(n,e),i=t(`button[data-date="${mt(n)}"]`),!i)return null;return n}function kg(s){return mg[s]??null}const yg={month:"Måned",year:"År",days:["Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag","Søndag"],daysShort:["Man","Tir","Ons","Tor","Fre","Lør","Søn"],months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],week:"Uke",prevMonth:"Forrige måned",nextMonth:"Neste måned"};function _g(s){const{selected:e,multiple:t=!1,maxMultiple:n=0,range:i=!1,earliest:r=null,latest:a=null,excludedates:l,excludeweekdays:c=[],weeknumbers:p=!1,withcontrols:g=!1,currentmonth:b,today:f,strings:k,onDateSelected:v,onClose:$,id:M,className:S}=s,T=d.useId(),L=M??T,D=d.useMemo(()=>({...yg,...k}),[k]),Y=d.useMemo(()=>f?is(f):Rf(),[f]),ee=d.useMemo(()=>l?l.map(m=>typeof m=="string"?is(m):m):[],[l]),oe=e!==void 0,[ye,K]=d.useState([]),N=oe?e:ye,q=d.useMemo(()=>Ro(N),[N]),[B,Z]=d.useState(0),[le,ae]=d.useState(0),[pe,ue]=d.useState({}),[be,ne]=d.useState(null),[re,je]=d.useState(null),X=d.useRef(null),P=d.useRef([]),Me=d.useRef(0),De=d.useRef(!1),te=d.useRef(!1),Le=d.useMemo(()=>({earliest:r,latest:a,excludedates:ee,excludeweekdays:c}),[r,a,ee,c]);d.useEffect(()=>{let m=null;if(b!=null&&(b instanceof Date?m=ri(b):typeof b=="string"&&(m=is(b))),!m||isNaN(m.getTime()))if(N.length>0&&N[0]!==""){const h=is(N[N.length-1]);m=isNaN(h.getTime())?ri(Y):h}else m=ri(Y);if((!m||isNaN(m.getTime()))&&(m=ri(Y)),a){const h=typeof a=="string"?is(a):a;!isNaN(h.getTime())&&m>h&&(m=h)}if(r){const h=typeof r=="string"?is(r):r;!isNaN(h.getTime())&&m<h&&(m=h)}Z(m.getFullYear()),ae(m.getMonth()),te.current=!0},[]),d.useEffect(()=>{if(te.current&&!De.current&&N.length>0&&N[0]!==""){const m=is(N[N.length-1]);isNaN(m.getTime())||(Z(m.getFullYear()),ae(m.getMonth()))}},[N]),d.useEffect(()=>{i&&q.length===2?ue(el(q[0],q[1])):(!i||q.length<2)&&ue({})},[i,q]);const Pe=d.useCallback(m=>{oe||K(m),v==null||v(m)},[oe,v]),$e=d.useCallback(()=>{$==null||$()},[$]),Te=d.useCallback((m,h)=>{Z(typeof m=="string"?parseInt(m):m),ae(typeof h=="string"?parseInt(h):h),Me.current=0,je(null),P.current=[],De.current=!0},[]),Ae=d.useCallback(()=>{const m=le===0?11:le-1,h=le===0?B-1:B;Te(h,m)},[B,le,Te]),qe=d.useCallback(()=>{const m=le===11?0:le+1,h=le===11?B+1:B;Te(h,m)},[B,le,Te]),Ie=d.useCallback(m=>Jo(m,Le),[Le]),ve=d.useCallback((m,h)=>lg(m,h,Le,{multiple:t,maxMultiple:n,selectedCount:N.length}),[Le,t,n,N.length]),E=d.useCallback(()=>typeof N=="string"?N.split(","):N,[N]),Be=d.useCallback(m=>{if(!i||q.length!==1||!tl(m,q,ee,c)||q[0]>=m){ne(null);return}ne(m),ue(el(q[0],m))},[i,q,ee,c]),Ye=d.useCallback(m=>{if(!m)return;let h;if(i)h=dg(m,E(),{excludedates:ee,excludeweekdays:c}),oe||K(h),h.length===2?(v==null||v(h),$e()):(h.length===1&&ue({}),v==null||v(h));else if(t)h=sl(m,E(),n),Pe(h);else{const _=mt(m);N.includes(_)?h=[]:h=[_],Pe(h),$e()}},[i,t,n,E,N,ee,c,oe,Pe,$e,v]),U=d.useCallback(m=>{const h=Br(m,E());oe||K(h),i&&h.length===2&&(v==null||v(h),$e())},[E,oe,i,v,$e]),V=d.useCallback(m=>{const h=Fr(m,E());oe||K(h)},[E,oe]),se=d.useCallback(m=>{const h=sl(m,E(),n);oe||K(h)},[E,n,oe]),me=d.useCallback(()=>{var C,j;const m=mt(ri(Y)),h=(C=X.current)==null?void 0:C.querySelector(`button[data-date="${m}"]`);if(h instanceof HTMLButtonElement){je(m),h.focus();return}const _=P.current.find(W=>!W.isDisabled);if(_){const W=(j=X.current)==null?void 0:j.querySelector(`button[data-date="${_.currentDateISO}"]`);W instanceof HTMLButtonElement&&(je(_.currentDateISO),W.focus())}},[]),fe=d.useCallback((m,h)=>{const _=m.target;if(bg(_))return;if(m.preventDefault(),!re){me();return}const C=fs(re),j=vg(C,h,X.current.querySelector.bind(X.current));if(j){const W=X.current.querySelector(`button[data-date="${mt(j)}"]`);W instanceof HTMLButtonElement&&!W.dataset.disabled&&(je(mt(j)),W.focus())}},[re,me]),Xe=d.useCallback(m=>{if(m.key==="Escape"){m.preventDefault(),$e();return}const h=kg(m.key);h!==null&&fe(m.nativeEvent,h)},[$e,fe]),Ke=d.useCallback(m=>{X.current&&!X.current.contains(m.relatedTarget)&&!m.target.classList.contains("pkt-hide")&&$e()},[$e]);return{componentId:L,strings:D,todayDate:Y,year:B,month:le,activeSelected:N,_selected:q,inRange:pe,rangeHovered:be,focusedDate:re,range:i,multiple:t,weeknumbers:p,withcontrols:g,earliest:r,latest:a,excludedates:ee,excludeweekdays:c,className:S,dateConstraints:Le,calendarRef:X,selectableDatesRef:P,tabIndexSetRef:Me,prevMonth:Ae,nextMonth:qe,changeMonth:Te,handleDateSelect:Ye,addToSelected:U,removeFromSelected:V,toggleSelectedDate:se,handleRangeHover:Be,isExcluded:Ie,isDayDisabled:ve,focusOnCurrentDate:me,handleKeydown:Xe,handleFocusOut:Ke,close:$e,setFocusedDate:je}}const wg=({componentId:s,strings:e,year:t,month:n,earliest:i,latest:r,withcontrols:a,prevMonth:l,nextMonth:c,changeMonth:p})=>{const g=f=>{const k=f==="prev",v=k?cg(t,n,i):ug(t,n,r),$=k?e.prevMonth:e.nextMonth,M=k?"chevron-thin-left":"chevron-thin-right",S=k?"pkt-calendar__prev-month":"pkt-calendar__next-month",T=k?l:c;return o.jsx("div",{children:o.jsxs("button",{type:"button","aria-label":$,onClick:()=>v&&T(),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),v&&T())},className:["pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only",S,!v&&"pkt-invisible"].filter(Boolean).join(" "),"data-disabled":v?void 0:"disabled","aria-disabled":!v||void 0,tabIndex:v?0:-1,children:[o.jsx(R,{className:"pkt-btn__icon",name:M}),o.jsx("span",{className:"pkt-btn__text",children:$})]})})},b=()=>a?o.jsxs("div",{className:"pkt-cal-month-picker",children:[o.jsx("label",{htmlFor:`${s}-monthnav`,className:"pkt-hide",children:e.month}),o.jsx("select",{"aria-label":e.month,className:"pkt-input pkt-input-compact",id:`${s}-monthnav`,value:n,onChange:f=>{f.stopPropagation(),p(t,parseInt(f.target.value))},children:e.months.map((f,k)=>o.jsx("option",{value:k,children:f},k))}),o.jsx("label",{htmlFor:`${s}-yearnav`,className:"pkt-hide",children:e.year}),o.jsx("input",{"aria-label":e.year,className:"pkt-input pkt-cal-input-year pkt-input-compact",id:`${s}-yearnav`,type:"number",size:4,placeholder:"0000",value:t,onChange:f=>{f.stopPropagation(),p(parseInt(f.target.value),n)}})]}):o.jsxs("div",{className:"pkt-txt-16-medium pkt-calendar__month-title","aria-live":"polite",children:[e.months[n]," ",t]});return o.jsxs("nav",{className:"pkt-cal-month-nav",children:[g("prev"),b(),g("next")]})};function $g(s,e,t){const n=yn(t.year,t.month,s),i=mt(n),r=i===mt(e),a=t.activeSelected.includes(i),l=t.isDayDisabled(n,a);let c;return t.focusedDate?c=t.focusedDate===i&&!l?"0":"-1":!l&&t.tabIndexSetRef.current===0?(t.tabIndexSetRef.current=s,c="0"):c=t.tabIndexSetRef.current===s?"0":"-1",{currentDate:n,currentDateISO:i,isToday:r,isSelected:a,isDisabled:l,ariaLabel:tg(n),tabindex:c}}function xg(s,e){const{currentDateISO:t,isToday:n,isSelected:i}=s,r=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],a=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return ke({"pkt-cal-today":n,"pkt-cal-selected":i,"pkt-cal-in-range":e.inRange[t],"pkt-cal-excluded":e.isExcluded(s.currentDate),"pkt-cal-in-range-first":r,"pkt-cal-in-range-last":a,"pkt-cal-range-hover":e.rangeHovered!==null&&t===mt(e.rangeHovered)})}function Sg(s,e){const{currentDateISO:t,isToday:n,isSelected:i,isDisabled:r}=s,a=e.range&&(e.activeSelected.length===2||e.rangeHovered!==null)&&t===e.activeSelected[0],l=e.range&&e.activeSelected.length===2&&t===e.activeSelected[1];return ke({"pkt-calendar__date":!0,"pkt-calendar__date--today":n,"pkt-calendar__date--selected":i,"pkt-calendar__date--disabled":r,"pkt-calendar__date--in-range":e.inRange[t],"pkt-calendar__date--in-range-hover":e.rangeHovered!==null&&t===mt(e.rangeHovered),"pkt-calendar__date--range-start":a,"pkt-calendar__date--range-end":l})}const Cg=({state:s})=>{const{strings:e,year:t,month:n,activeSelected:i,focusedDate:r,inRange:a,rangeHovered:l,range:c,multiple:p,weeknumbers:g,selectableDatesRef:b,tabIndexSetRef:f,handleDateSelect:k,handleRangeHover:v,isExcluded:$,isDayDisabled:M,setFocusedDate:S,todayDate:T}=s,L={year:t,month:n,activeSelected:i,focusedDate:r,tabIndexSetRef:f,isDayDisabled:M},D={range:c,activeSelected:i,rangeHovered:l,inRange:a,isExcluded:$},Y=()=>{const K=[];g&&K.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__week-number",children:e.week})},"week-header"));for(let N=0;N<e.daysShort.length;N++)K.push(o.jsx("th",{children:o.jsx("div",{className:"pkt-calendar__day-name","aria-label":e.days[N],children:e.daysShort[N]})},`day-${N}`));return o.jsx("tr",{className:"pkt-cal-week-row",children:K})},ee=(K,N)=>{const q=$g(K,N,L),{currentDate:B,currentDateISO:Z,isSelected:le,isDisabled:ae,ariaLabel:pe,tabindex:ue}=q;b.current.push({currentDateISO:Z,isDisabled:ae,tabindex:ue});const be=xg(q,D),ne=Sg(q,D);return o.jsx("td",{className:be,children:o.jsx("button",{type:"button","aria-pressed":le?"true":"false",disabled:ae,className:`pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only ${ne}`,onMouseOver:()=>c&&!$(B)&&v(B),onFocus:()=>{c&&!$(B)&&v(B),S(Z)},"aria-label":pe,tabIndex:parseInt(ue),"data-disabled":ae?"disabled":void 0,"data-date":Z,onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),k(B))},onClick:re=>{ae||(re.preventDefault(),k(B))},children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:K})})},Z)},oe=(K,N)=>o.jsx("td",{className:"pkt-cal-other",children:o.jsx("div",{className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only","data-disabled":"disabled",children:o.jsx("span",{className:"pkt-btn__text pkt-txt-14-light",children:K})})},N),ye=()=>{const K=T,N=pg(t,n);b.current=[],f.current=0;let q=1,B=N.initialWeek;const Z=[];for(let le=0;le<N.numRows;le++){const ae=[];g&&ae.push(o.jsx("td",{className:"pkt-cal-week",children:B},`week-${B}`)),B++;for(let pe=0;pe<ai;pe++){const ue=fg(le,pe,q,N);if(ue==="current-month")ae.push(ee(q,K)),q++;else{const be=gg(ue,pe,q,N);ae.push(oe(be,`${ue}-${le}-${pe}`)),ue==="next-month"&&q++}}Z.push(o.jsx("tr",{className:"pkt-cal-week-row",role:"row",children:ae},`row-${le}`))}return Z};return o.jsxs("table",{className:"pkt-cal-days pkt-txt-12-medium pkt-calendar__body",role:"grid","aria-multiselectable":c||p||void 0,children:[o.jsx("thead",{children:Y()}),o.jsx("tbody",{children:ye()})]})},Vr=d.forwardRef((s,e)=>{const t=_g(s);return d.useImperativeHandle(e,()=>({handleDateSelect:t.handleDateSelect,addToSelected:t.addToSelected,removeFromSelected:t.removeFromSelected,toggleSelected:t.toggleSelectedDate,focusOnCurrentDate:t.focusOnCurrentDate,close:t.close}),[t.handleDateSelect,t.addToSelected,t.removeFromSelected,t.toggleSelectedDate,t.focusOnCurrentDate,t.close]),o.jsxs("div",{ref:t.calendarRef,className:["pkt-calendar",t.weeknumbers&&"pkt-cal-weeknumbers",t.className].filter(Boolean).join(" "),onBlur:t.handleFocusOut,onKeyDown:t.handleKeydown,children:[o.jsx(wg,{componentId:t.componentId,strings:t.strings,year:t.year,month:t.month,earliest:t.earliest,latest:t.latest,withcontrols:t.withcontrols,prevMonth:t.prevMonth,nextMonth:t.nextMonth,changeMonth:t.changeMonth}),o.jsx(Cg,{state:t})]})});Vr.displayName="PktCalendar";const Tg=os({tagName:"pkt-card",elementClass:ot,react:d,displayName:"PktCard",events:{}}),nl=d.forwardRef(({children:s,...e},t)=>o.jsx(Tg,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));nl.displayName="PktCard";const il=d.forwardRef(({id:s,hasTile:e=!1,disabled:t=!1,label:n,checkHelptext:i,hasError:r=!1,className:a,isSwitch:l=!1,hideLabel:c=!1,labelPosition:p="right",defaultChecked:g,checked:b,indeterminate:f,optionalTag:k,optionalText:v="Valgfritt",requiredTag:$,requiredText:M="Må fylles ut",tagText:S,...T},L)=>{const D=d.useRef(null);d.useEffect(()=>{D.current&&f!==void 0&&(D.current.indeterminate=f)},[f]),d.useEffect(()=>{typeof L=="function"?L(D.current):L&&(L.current=D.current)},[L]);const Y=[a,"pkt-input-check"].filter(Boolean).join(" "),ee=["pkt-input-check__input-label",t?"pkt-input-check__input-label--disabled":"",`pkt-input-check__input-label--${p}`,c?"pkt-sr-only":""].filter(Boolean).join(" "),oe=["pkt-input-check__input",e?"pkt-input-check__input--tile":"",t&&e?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),ye=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),K=()=>o.jsxs(o.Fragment,{children:[S&&o.jsx("span",{className:ye+" pkt-tag--gray",children:S}),k&&o.jsx("span",{className:ye+" pkt-tag--blue-light",children:v}),$&&o.jsx("span",{className:ye+" pkt-tag--beige",children:M})]});return o.jsx("div",{className:Y,children:o.jsxs("div",{className:oe,children:[p==="left"&&o.jsxs("label",{className:ee,htmlFor:s,children:[n," ",K(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]}),o.jsx("input",{role:l?"switch":"checkbox",ref:D,className:`pkt-input-check__input-checkbox ${r?"pkt-input-check__input-checkbox--error":""}`,type:"checkbox",id:s,disabled:t,...b!==void 0?{checked:b}:{defaultChecked:g},...T}),p==="right"&&o.jsxs("label",{className:ee,htmlFor:s,children:[n," ",K(),i&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:i})]})]})})});il.displayName="PktCheckbox";const Ts=d.forwardRef(({forId:s,label:e,helptext:t,helptextDropdown:n,helptextDropdownButton:i,counter:r,counterCurrent:a=0,counterMaxLength:l,optionalTag:c=!1,optionalText:p="Valgfritt",requiredTag:g=!1,requiredText:b="Må fylles ut",tagText:f=null,hasError:k=!1,errorMessage:v,disabled:$=!1,inline:M=!1,ariaDescribedby:S,useWrapper:T=!0,children:L,className:D="",hasFieldset:Y=!1,role:ee="group",counterPosition:oe="bottom"},ye)=>{const[K,N]=d.useState(!1),q=S||(t?`${s}-helptext`:void 0),B=!!r,Z=B&&oe==="top",le=B&&oe==="bottom",ae=()=>N(P=>!P),pe=["pkt-inputwrapper",D,k?"pkt-inputwrapper--error":"",$?"pkt-inputwrapper--disabled":"",M?"pkt-inputwrapper--inline":""].filter(Boolean).join(" "),ue=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),be=()=>B?o.jsxs("div",{className:"pkt-input__counter","aria-live":"polite","aria-atomic":"true",children:[a,l?`/${l}`:""]}):null,ne=()=>o.jsxs(o.Fragment,{children:[f&&o.jsx("span",{className:ue+" pkt-tag--gray",children:f}),c&&o.jsx("span",{className:ue+" pkt-tag--blue-light",children:p}),g&&o.jsx("span",{className:ue+" pkt-tag--beige",children:b})]}),re=()=>{const P=o.jsxs(o.Fragment,{children:[e," ",ne()]});return T?Y?o.jsx("legend",{className:"pkt-inputwrapper__legend",id:`${s}-label`,children:P}):o.jsx("label",{className:"pkt-inputwrapper__label",htmlFor:s,"aria-describedby":q,id:`${s}-label`,children:P}):o.jsx("label",{htmlFor:s,className:"pkt-sr-only","aria-describedby":q,id:`${s}-label`,children:e})},je=()=>!t&&!n?null:o.jsxs(o.Fragment,{children:[t&&T&&o.jsx("div",{className:"pkt-inputwrapper__helptext",id:`${s}-helptext`,children:t}),n&&o.jsxs("div",{className:"pkt-inputwrapper__helptext-expandable",children:[o.jsx(gt,{skin:"tertiary",size:"small",variant:"icon-right",iconName:K?"chevron-thin-up":"chevron-thin-down",className:"pkt-link pkt-link--icon-right",onClick:ae,children:o.jsx("span",{dangerouslySetInnerHTML:{__html:i??'Les mer <span class="pkt-sr-only">om inputfeltet</span>'}})}),o.jsx("div",{className:`pkt-inputwrapper__helptext ${K?"pkt-inputwrapper__helptext-expandable-open":"pkt-inputwrapper__helptext-expandable-closed"}`,children:n})]})]}),X=o.jsxs(o.Fragment,{children:[re(),je(),Z&&o.jsx(be,{}),L,le&&o.jsx(be,{}),k&&v&&o.jsx("div",{className:"pkt-inputwrapper__alert-wrapper",children:o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",id:`${s}-error`,compact:!0,children:v})})]});return o.jsx("div",{className:pe,ref:ye,role:ee,children:Y?o.jsx("fieldset",{className:"pkt-inputwrapper__fieldset","aria-describedby":q,children:X}):o.jsx("div",{className:"pkt-inputwrapper__fieldset",children:X})})});Ts.displayName="PktInputWrapper";const gs=(s,e)=>e&&(s.find(t=>t.value===e)||s.find(t=>t.label===e))||null,Ng=(s,e)=>{if(!e)return-1;const t=s.findIndex(n=>n.value===e);return t>=0?t:s.findIndex(n=>n.label===e)},Mg=(s,e)=>{if(!e)return[...s];const t=e.toLowerCase();return s.filter(n=>(n.fulltext||n.value+(n.label||"")+(n.prefix||"")).toLowerCase().includes(t))},Ui=s=>s.value+(s.label||"")+(s.prefix||""),Hi=(s,e)=>e!==null&&s>=e,rl=(s,e)=>{if(!s)return"";switch(e){case"prefixAndValue":return`${s.prefix||""} ${s.value}`.trim();case"value":return s.value;case"label":default:return s.label||s.value}},Ur=(s,e)=>s?Array.isArray(s)?e?s:s.length>0?[s[0]]:[]:e?s.split(",").filter(Boolean):[s]:[],al=(s,e)=>{if(!e)return{filtered:[...s],suggestion:null};const t=e.toLowerCase(),n=s.filter(r=>{var a;return(a=r.fulltext)==null?void 0:a.toLowerCase().includes(t)}),i=n.find(r=>{var a;return!r.selected&&((a=r.label)==null?void 0:a.toLowerCase().startsWith(t))})||null;return{filtered:n,suggestion:i}},Dg=(s,e,t,n)=>{if(!s.trim())return{addValueText:null,userInfoMessage:""};const i=s.trim().toLowerCase(),r=e.find(c=>c.toLowerCase()===i),a=t.filter(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase().includes(i))||c.value.toLowerCase().includes(i)}),l=a.find(c=>{var p;return((p=c.label)==null?void 0:p.toLowerCase())===i||c.value.toLowerCase()===i});return(a.length===0||!l)&&n?{addValueText:s,userInfoMessage:""}:a.length===0&&!n?{addValueText:null,userInfoMessage:"Ingen treff i søket"}:r?{addValueText:null,userInfoMessage:"Verdien er allerede valgt"}:{addValueText:null,userInfoMessage:""}},Og=(s,e,t)=>{switch(s){case",":return t?"addValue":null;case"Enter":return"addValue";case"Tab":case"ArrowDown":return e?null:"focusListbox";case"Escape":return"closeOptions";default:return null}},Eg=(s,e,t,n,i)=>{if(!s)return{action:"none",value:null};const r=gs(t,s);return!e.includes(s)&&!r?n?{action:"addUserValue",value:s}:i?{action:"none",value:null}:{action:"removeValue",value:e[0]}:r&&!e.includes(r.value)?{action:"selectOption",value:r.value}:{action:"none",value:null}},ji=(s,e,t)=>{const n=gs(e,s);return t==="label"&&(n!=null&&n.label)?n.label:s},Xs=s=>{s.scrollIntoView({block:"nearest"}),window.setTimeout(()=>s.focus(),0)},ol=s=>Array.from(s.querySelectorAll('[role="option"]:not([data-disabled])')||[]),Pg=s=>{const e=s.nextElementSibling;e&&Xs(e)},ll=(s,e,t)=>{const n=s.previousElementSibling;if(s.dataset.index==="0"&&t){const i=e.querySelector('[role="searchbox"]');i&&Xs(i)}else n&&Xs(n)},Ag=s=>{const e=ol(s);e[0]&&Xs(e[0])},qi=(s,e)=>{if(e.disabled)return;const t=ol(s);if(e.allowUserInput&&e.customUserInput){const i=s.querySelector('[data-type="new-option"]');if(i){Xs(i);return}}const n=t.find(i=>i.dataset.selected==="true");if(n){Xs(n);return}if(e.includeSearch&&!(document.activeElement instanceof HTMLInputElement)){const i=s.querySelector('[role="searchbox"]');if(i){window.setTimeout(()=>i.focus(),0);return}}t[0]&&Xs(t[0])},Qs=d.forwardRef(({children:s,skin:e,textStyle:t,size:n,closeTag:i,className:r,iconName:a,ariaLabel:l,onClose:c,type:p,"aria-description":g,...b},f)=>{const[k,v]=d.useState(!1),$=d.useCallback(()=>{v(!0),c&&c()},[c]),M=d.useRef(null),[S,T]=d.useState("");d.useEffect(()=>{var ee,oe;T(((oe=(ee=M.current)==null?void 0:ee.textContent)==null?void 0:oe.trim())??"")},[s]);const L=d.useMemo(()=>{if(i&&!l)return S&&`Klikk for å fjerne ${S}`||g},[i,l,S,g]),D={"pkt-tag":!0,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,[`pkt-tag--${t}`]:!!t},Y={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${t}`]:!!t,[`pkt-tag--${n}`]:!!n,[`pkt-tag--${e}`]:!!e,"pkt-btn--icons-right-and-left":i&&!!a,"pkt-hide":k};return i?o.jsxs("button",{...b,className:ke(Y,r),type:p,onClick:$,"aria-label":l,"aria-description":L,ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a}),o.jsx("span",{ref:M,children:s}),o.jsx(R,{className:"pkt-tag__close-btn",name:"close"})]}):o.jsxs("span",{...b,className:ke(D,r),ref:f,children:[a&&o.jsx(R,{className:"pkt-tag__icon",name:a,"aria-hidden":"true"}),o.jsx("span",{ref:M,children:s})]})});Qs.displayName="PktTag";const cl=({state:s,outside:e=!1})=>{const{values:t,options:n,disabled:i,displayValueAs:r,handleTagRemove:a,handleTagKeydown:l,focusedTagIndex:c}=s,p=d.useRef([]);if(d.useEffect(()=>{var f;!e&&c>=0&&c<t.length&&((f=p.current[c])==null||f.focus())},[e,c,t.length]),t.length===0)return null;const g=(f,k)=>{const v=gs(n,f),$=v==null?void 0:v.tagSkinColor,M=v?rl(v,r):f;return i?o.jsx("li",{role:"listitem",children:o.jsx(Qs,{skin:$||"blue-dark",children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f):e?o.jsx("li",{role:"listitem",children:o.jsx(Qs,{skin:$||"blue-dark",closeTag:!0,onClose:()=>a(f),children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f):o.jsx("li",{role:"listitem",onClick:S=>S.stopPropagation(),onMouseDown:S=>S.preventDefault(),children:o.jsx(Qs,{ref:S=>{p.current[k]=S},skin:$||"blue-dark",closeTag:!0,tabIndex:c===k?0:-1,onClose:()=>a(f),onKeyDown:S=>l(S,k),children:o.jsx("span",{className:"pkt-combobox__value",children:M})})},f)},b=t.map(g);return e?o.jsx("div",{className:"pkt-combobox__tags-outside",children:o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:b})}):o.jsx("ul",{role:"list",className:"pkt-combobox__tag-list",children:b})},Ig=({state:s})=>{const{values:e,options:t,editingSingleValue:n,displayValueAs:i}=s;if(n||e.length===0)return null;const r=gs(t,e[0]);if(!r)return null;const a=rl(r,i);return o.jsx("span",{className:"pkt-combobox__value",children:a})},Lg=({state:s})=>{const{id:e,inputId:t,listboxId:n,values:i,options:r,isOpen:a,multiple:l,typeahead:c,allowUserInput:p,tagPlacement:g,placeholder:b,disabled:f,fullwidth:k,hasError:v,label:$,inputFocus:M,inputRef:S,triggerRef:T,handleInputChange:L,handleInputKeydown:D,handleInputFocus:Y,handleInputBlur:ee,handleInputClick:oe,handlePlaceholderClick:ye,handleSelectOnlyKeydown:K,name:N}=s,q=["pkt-combobox__input",k&&"pkt-combobox__input--fullwidth",a&&"pkt-combobox__input--open",v&&"pkt-combobox__input--error",f&&"pkt-combobox__input--disabled"].filter(Boolean).join(" "),B=["pkt-combobox__arrow-icon",a&&"pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "),Z=c||p,le=!Z&&b&&(!i.length||l&&g==="outside")&&!M,ae=g!=="outside",pe=i[0]&&gs(r,i[0])?`${n}-${Ng(r,i[0])}`:void 0,ue=l&&i.length>0?`${i.length} valgt`:void 0,be=Z?{tabIndex:-1}:{id:`${e}-combobox`,role:"combobox","aria-expanded":a?"true":"false","aria-controls":n,"aria-haspopup":"listbox","aria-labelledby":`${e}-combobox-label`,"aria-activedescendant":pe,"aria-description":ue,tabIndex:f?-1:0,onKeyDown:K};return o.jsxs("div",{ref:T,className:q,onClick:oe,...be,children:[le?o.jsx("span",{className:"pkt-combobox__placeholder",onClick:ye,children:b}):ae?l?o.jsx(cl,{state:s}):Z?null:o.jsx(Ig,{state:s}):null,Z?o.jsx("div",{className:"pkt-combobox__input-div combobox__input",children:o.jsx("input",{ref:S,type:"text",id:t,name:`${N||e}-input`,onChange:L,onKeyDown:D,onFocus:Y,onBlur:ee,placeholder:!i.length||l&&g==="outside"?b:void 0,autoComplete:"off",role:"combobox","aria-expanded":a?"true":"false","aria-label":$,"aria-autocomplete":c?"both":p?"list":"none","aria-controls":n,"aria-activedescendant":pe,"aria-description":ue,disabled:f})}):o.jsx("input",{ref:S,type:"hidden",id:t,name:`${N||e}-input`,value:i.join(","),readOnly:!0}),o.jsx(R,{className:B,name:"chevron-thin-down","aria-hidden":"true"})]})},Bg=({state:s})=>{const{listboxId:e,label:t,isOpen:n,options:i,filteredOptions:r,multiple:a,disabled:l,maxIsReached:c,maxlength:p,includeSearch:g,allowUserInput:b,addValueText:f,userInfoMessage:k,searchPlaceholder:v,searchValue:$,handleOptionClick:M,handleOptionKeydown:S,handleSearchInput:T,handleSearchKeydown:L,handleNewOptionClick:D,handleNewOptionKeydown:Y,listboxRef:ee}=s,oe=r.filter(B=>B.selected).length,ye=a&&oe>0&&p!=null&&p>0,K=b&&f&&!c,N=!!k,q=["pkt-listbox",n&&"pkt-listbox__open","pkt-txt-16-light"].filter(Boolean).join(" ");return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:ee,id:e,className:q,role:r.length>0?"listbox":void 0,"aria-label":r.length>0?`Liste: ${t||""}`:void 0,"aria-multiselectable":r.length>0&&a?"true":void 0,children:[o.jsxs("div",{className:"pkt-listbox__banners",children:[g&&o.jsxs("div",{className:"pkt-listbox__search",children:[o.jsx("span",{className:"pkt-listbox__search-icon",children:o.jsx(R,{name:"magnifying-glass-small"})}),o.jsx("input",{className:"pkt-txt-16-light",type:"text","aria-label":"Søk i listen",form:"",placeholder:v||"Søk...",onChange:T,onKeyDown:L,value:$,"data-type":"searchbox",disabled:l,readOnly:l,role:"searchbox"})]}),ye&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--maximum-reached",children:[oe," av maks ",p," mulige er valgt."]}),N&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--user-message",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),k]}),K&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--new-option pkt-listbox__option","data-type":"new-option","data-value":f,"data-selected":"false",tabIndex:0,onClick:()=>D(f),onKeyDown:Y,children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"plus-sign"}),'Legg til "',f,'"']}),i.length===0&&r.length===0&&!N&&o.jsxs("div",{className:"pkt-listbox__banner pkt-listbox__banner--empty",children:[o.jsx(R,{className:"pkt-listbox__banner-icon",name:"exclamation-mark-circle"}),"Tom liste"]})]}),o.jsx("ul",{className:"pkt-listbox__options",role:"presentation",children:r.map((B,Z)=>{const le=["pkt-listbox__option",!a&&B.selected&&"pkt-listbox__option--selected",a&&"pkt-listbox__option--checkBox"].filter(Boolean).join(" "),ae=l||B.disabled||c&&!B.selected;return o.jsxs("li",{className:le,onClick:()=>M(B.value),onKeyDown:pe=>S(pe,B.value),"aria-selected":B.selected?"true":"false",tabIndex:ae?-1:0,"data-index":Z,"data-value":B.value,"data-selected":B.selected?"true":"false","data-disabled":ae||void 0,"aria-disabled":ae?"true":"false",role:"option",id:`${e}-${Z}`,children:[a?o.jsx("input",{className:"pkt-input-check__input-checkbox",type:"checkbox",tabIndex:-1,value:B.value,checked:B.selected||!1,readOnly:!0,"aria-hidden":"true",disabled:ae}):B.selected?o.jsx(R,{name:"check-big"}):null,o.jsxs("span",{className:"pkt-listbox__option-label",id:`${e}-option-label-${Z}`,children:[B.prefix&&o.jsx("span",{className:"pkt-listbox__option-prefix",children:B.prefix}),B.label||B.value]}),B.description&&o.jsx("span",{className:"pkt-listbox__option-description pkt-txt-14-light",children:B.description})]},`${B.value}-${Z}`)})})]}),o.jsx("div",{"aria-live":"polite",className:"pkt-visually-hidden",children:k})]})};function Fg(s,e){return s.map(t=>({...t,label:t.label||t.value,fulltext:Ui(t),selected:e.includes(t.value)}))}function Vg(s,e){const{id:t="",label:n,value:i,defaultValue:r,options:a,defaultOptions:l,multiple:c=!1,maxlength:p,typeahead:g=!1,includeSearch:b=!1,allowUserInput:f=!1,displayValueAs:k="label",tagPlacement:v,searchPlaceholder:$,placeholder:M,disabled:S=!1,required:T=!1,fullwidth:L=!1,hasError:D=!1,errorMessage:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,optionalTag:K=!1,optionalText:N,requiredTag:q=!1,requiredText:B,tagText:Z,useWrapper:le=!0,name:ae,className:pe,onChange:ue,onValueChange:be,children:ne}=s,re=`${t}-input`,je=`${t}-listbox`,X=g||f,P=d.useRef(null),Me=d.useRef(null),De=d.useRef(null),te=d.useRef(null),Le=d.useRef(null),Pe=d.useCallback(()=>{var w,O;X?(w=P.current)==null||w.focus():(O=De.current)==null||O.focus()},[X]),$e=d.useMemo(()=>{const w=[];return d.Children.forEach(ne,O=>{if(d.isValidElement(O)&&O.type==="option"){const J=O.props;w.push({value:J.value??J.children??"",label:J.children??J.value??"",selected:J.selected,disabled:J.disabled})}}),w},[ne]),Te=d.useMemo(()=>l&&l.length>0?l.map(w=>({...w,fulltext:Ui(w)})):a&&a.length>0?a.map(w=>({...w,fulltext:Ui(w)})):$e.length>0?$e.map(w=>({...w,fulltext:Ui(w)})):[],[l,a,$e]),Ae=i!==void 0,[qe,Ie]=d.useState(()=>Ur(i??r,c)),ve=d.useRef(qe);d.useEffect(()=>{Ae&&Ie(Ur(i,c))},[i,Ae,c]);const E=Ae?Ur(i,c):qe,[Be,Ye]=d.useState([]),U=d.useMemo(()=>{const w=[...Be.filter(O=>!Te.some(J=>J.value===O.value)),...Te];return Fg(w,E)},[Te,Be,E]),[V,se]=d.useState(!1),[me,fe]=d.useState(""),[Xe,Ke]=d.useState(""),[m,h]=d.useState(""),[_,C]=d.useState(null),[j,W]=d.useState(!1),[de,it]=d.useState(!1),[Re,Fe]=d.useState(-1),Kt=d.useRef(!1),Gt=Hi(E.length,p??null),yt=c&&p!=null,ci=d.useMemo(()=>me?g?al(U,me).filtered:Mg(U,me):U,[U,me,g]),dt=d.useMemo(()=>{var w;return(w=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:w.set},[]),Ft=d.useCallback(w=>{const O=Me.current;if(!O||!dt)return;const J=c?w.join(","):w[0]||"";dt.call(O,J),O.dispatchEvent(new Event("input",{bubbles:!0}))},[dt,c]),Xt=c?E.join(","):E[0]||"";d.useEffect(()=>{Me.current&&(Me.current.value=Xt)},[Xt]),d.useEffect(()=>{if(V||c||!P.current)return;const w=E[0]?ji(E[0],U,k):"";P.current.value!==w&&(P.current.value=w)},[E,U,k,c,V]);const rs=d.useCallback((w,O=!0)=>{Ae||Ie(w),O&&(be==null||be(w),Ft(w))},[Ae,be,Ft]),Ns=d.useCallback(w=>{if(!w||E.includes(w))return;if(c&&Hi(E.length,p??null)){h("Maks antall valg nådd");return}const O=c?[...E,w]:[w];rs(O)},[E,c,p,rs]),et=d.useCallback(w=>{if(!w)return;const O=E.filter(Ve=>Ve!==w),J=gs(U,w);J!=null&&J.userAdded&&Ye(Ve=>Ve.filter(Nt=>Nt.value!==w)),rs(O)},[E,U,rs]),ui=d.useCallback(()=>{Ye([]),rs([])},[rs]),Zs=d.useCallback(w=>{if(!w||w.trim()==="")return;let O;if(!c)O=[w];else{if(gs(U,w)||Hi(E.length,p??null))return;O=[...E,w]}const J={value:w,label:w,userAdded:!0,selected:!0};Ye(Ve=>[J,...Ve.filter(Nt=>Nt.value!==w)]),rs(O)},[c,U,E,p,rs]),di=d.useCallback((w=!0,O)=>{if(C(null),w&&P.current&&P.current.type!=="hidden"){fe(""),Ke("");const J=O!==void 0?O:E[0];!c&&J?P.current.value=ji(J,U,k):P.current.value="",c||(it(!1),h(""))}},[c,E,U,k]),Vt=d.useCallback(w=>{var jl,ql;if(S)return;h(""),C(null);const O=((jl=gs(U,w))==null?void 0:jl.value)||null,J=E.includes(w||O||""),Ve=!!O,Nt=((ql=U.find(yb=>yb.value===w))==null?void 0:ql.disabled)||!1,Js=!(w!=null&&w.trim()),Pt=!c,Ut=c,Ri=Hi(E.length,p??null);let ms=!1,er=!0,hi="",ta="",Sn;Nt||(!Ve&&f&&!Js?(Zs(w),hi="Ny verdi lagt til",ms=Ut,Pt&&(Sn=w||"")):!Ve&&!f?(Pt&&E[0]&&et(E[0]),er=!1,ms=!0,hi="Ingen treff i søket"):J?(et(O),ms=!0,Sn="",Pt&&X&&P.current&&P.current.type!=="hidden"&&(P.current.value="")):Js&&Pt?(ui(),ms=!0,Sn=""):Pt?(E[0]&&et(E[0]),Ns(O),ms=!1,Sn=O||""):Ut&&!Ri?(Ns(O),ms=!0):Ut&&Ri?(hi="Maks antall valg nådd",er=!1,ta=w||""):(Pt&&ui(),hi="Ingen gyldig verdi valgt",er=!1,ms=!0,ta=w||"",Sn=""),se(ms),h(hi),fe(ta),di(er,Sn),ms||(Pt&&X&&(Kt.current=!0),window.setTimeout(()=>{Pe()},0)))},[S,U,E,c,p,f,Zs,et,ui,Ns,di,Pe]),Tt=d.useCallback(()=>{if(W(!1),C(null),h(""),fe(""),P.current&&P.current.type!=="hidden"){const w=P.current.value;let O=E[0];if(c){if(w!==""){const{action:J,value:Ve}=Eg(w,E,U,f,c);switch(J){case"addUserValue":Zs(Ve);break;case"selectOption":Ns(Ve);break;case"removeValue":et(Ve);break}}}else if(!w)E[0]&&et(E[0]),O=void 0;else{const J=gs(U,w);J&&J.value!==E[0]?(E[0]&&et(E[0]),Ns(J.value),O=J.value):!J&&f&&(E[0]&&et(E[0]),Zs(w),O=w)}!c&&O?P.current.value=ji(O,U,k):P.current.value=""}se(!1),it(!1)},[E,U,f,c,k,Zs,Ns,et]),$n=d.useCallback(w=>{if(!w.trim().toLowerCase()){C(null),h(""),!c&&E[0]&&et(E[0]);return}const J=Dg(w,E,U,f);C(J.addValueText),h(J.userInfoMessage)},[E,U,f,c,et]),Zi=d.useCallback(w=>{var J;if(S)return;const O=w.target.value;if(Ke(O),fe(O),$n(O),g&&O){const{suggestion:Ve}=al(U,O);Ve!=null&&Ve.label&&P.current&&!((J=w.nativeEvent.inputType)!=null&&J.includes("deleteContent"))&&(P.current.value=Ve.label,window.setTimeout(()=>{var Nt;return(Nt=P.current)==null?void 0:Nt.setSelectionRange(O.length,Ve.label.length)},0))}},[S,g,U,$n]),Qr=d.useCallback(w=>{var J,Ve,Nt,Js,Pt;if(w.key==="Backspace"){const Ut=!((J=P.current)!=null&&J.value);if(!me&&Ut&&c&&E.length>0){w.preventDefault();const Ri=E[E.length-1];et(Ri)}return}if(w.key==="ArrowLeft"&&c&&E.length>0&&(((Ve=P.current)==null?void 0:Ve.selectionStart)??0)===0&&!((Nt=P.current)!=null&&Nt.value)){w.preventDefault(),Fe(E.length-1);return}const O=Og(w.key,w.shiftKey,c);if(O&&!(w.key==="Tab"&&!V)){if(O==="focusListbox"&&w.key==="Tab"&&!((Js=te.current)==null?void 0:Js.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]'))){Tt();return}switch(w.preventDefault(),O){case"addValue":{const Ut=((Pt=P.current)==null?void 0:Pt.value.trim())||"";if(fe(Ut),Ut&&E.includes(Ut)){di(!0),h("Verdien er allerede valgt");break}Vt(Ut);break}case"focusListbox":te.current&&(V||se(!0),qi(te.current,{disabled:S,allowUserInput:f,customUserInput:_,includeSearch:b}));break;case"closeOptions":se(!1);break}}},[me,E,c,S,f,_,b,V,et,Vt,Pe]),as=d.useCallback(()=>{if(!S){if(Kt.current){Kt.current=!1,W(!0);return}!c&&E[0]&&P.current&&P.current.type!=="hidden"&&(it(!0),P.current.value=ji(E[0],U,k)),W(!0),fe(""),se(!0)}},[S,c,E,U,k]),Zr=d.useCallback(()=>{W(!1),it(!1)},[]),Jr=d.useCallback(w=>{if(S||!V)return;const O=w.relatedTarget,J=Le.current;J&&O&&J.contains(O)||Tt()},[S,V,Tt]),Rr=d.useCallback(w=>{var O;if(S){w.preventDefault(),w.stopPropagation();return}if(X)(O=P.current)==null||O.focus();else{w.stopPropagation(),w.preventDefault();const J=!V;se(J),J&&te.current&&qi(te.current,{disabled:S,allowUserInput:f,customUserInput:_,includeSearch:b})}},[S,X,V,f,_,b]),ea=d.useCallback(w=>{S||(w.stopPropagation(),X&&P.current?(P.current.focus(),W(!0)):se(O=>!O))},[S,X]),I=d.useCallback(w=>{if(!S)switch(w.key){case"Enter":case" ":case"ArrowDown":case"ArrowUp":w.preventDefault(),V?se(!1):(se(!0),te.current&&window.setTimeout(()=>{te.current&&qi(te.current,{disabled:S,allowUserInput:f&&!Gt,customUserInput:_,includeSearch:b})},0));break;case"Escape":V&&(w.preventDefault(),se(!1));break;case"Home":case"End":w.preventDefault(),V||se(!0),te.current&&window.setTimeout(()=>{te.current&&qi(te.current,{disabled:S,allowUserInput:f&&!Gt,customUserInput:_,includeSearch:b})},0);break;case"ArrowLeft":c&&E.length>0&&(w.preventDefault(),Fe(E.length-1));break;case"Backspace":case"Delete":if(c&&E.length>0){w.preventDefault();const O=E[E.length-1];et(O)}break}},[S,V,f,Gt,_,b,c,E,et]),F=d.useCallback(w=>{Vt(w)},[Vt]),Ge=d.useCallback((w,O)=>{switch(w.key){case"Enter":case" ":w.preventDefault(),Vt(O);break;case"ArrowDown":w.preventDefault(),Pg(w.currentTarget);break;case"ArrowUp":w.preventDefault(),te.current&&ll(w.currentTarget,te.current,b);break;case"Escape":w.preventDefault(),se(!1),Pe();break;case"Tab":Tt();break}},[Vt,b,Pe,Tt]),tt=d.useCallback(w=>{et(w),Fe(-1),X&&P.current&&(W(!0),P.current.focus())},[et,X]),xn=d.useCallback((w,O)=>{var J,Ve,Nt;switch(w.stopPropagation(),w.key){case"ArrowLeft":w.preventDefault(),O>0&&Fe(O-1);break;case"ArrowRight":w.preventDefault(),O<E.length-1?Fe(O+1):(Fe(-1),X&&P.current?P.current.focus():(J=De.current)==null||J.focus());break;case"Backspace":case"Delete":w.preventDefault();{const Js=E[O],Pt=O>=E.length-1?O-1:O;et(Js),Pt>=0?Fe(Pt):(Fe(-1),X&&P.current?P.current.focus():(Ve=De.current)==null||Ve.focus())}break;case"Tab":Fe(-1);break;case"Escape":w.preventDefault(),Fe(-1),X&&P.current?P.current.focus():(Nt=De.current)==null||Nt.focus();break}},[E,X,et]),Ji=d.useCallback(w=>{fe(w.target.value),$n(w.target.value)},[$n]),bb=d.useCallback(w=>{switch(w.key){case"ArrowDown":if(w.preventDefault(),te.current){const O=te.current.querySelector('[role="option"]:not([data-disabled]), [data-type="new-option"]');O==null||O.focus()}break;case"Tab":Tt();break;case"Escape":w.preventDefault(),se(!1),Pe();break}},[Pe,Tt]),vb=d.useCallback(w=>{Vt(w)},[Vt]),kb=d.useCallback(w=>{switch(w.key){case"Enter":case" ":w.preventDefault(),Vt(w.currentTarget.dataset.value||"");break;case"ArrowDown":w.preventDefault(),te.current&&Ag(te.current);break;case"ArrowUp":w.preventDefault(),te.current&&ll(w.currentTarget,te.current,b);break;case"Escape":w.preventDefault(),se(!1),Pe();break}},[Vt,b,Pe]);return d.useEffect(()=>{if(!V)return;const w=O=>{const J=O.target;Le.current&&!Le.current.contains(J)&&Tt()};return document.addEventListener("click",w,!0),()=>{document.removeEventListener("click",w,!0)}},[V,Tt]),d.useEffect(()=>{var J;const w=(J=Le.current)==null?void 0:J.closest("form");if(!w)return;const O=()=>{window.setTimeout(()=>{if(Ie(ve.current),Ye([]),Ke(""),fe(""),C(null),h(""),Me.current){const Ve=c?ve.current.join(","):ve.current[0]||"";Me.current.value=Ve}},0)};return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)},[c]),d.useImperativeHandle(e,()=>({get value(){var w;return((w=Me.current)==null?void 0:w.value)??""},set value(w){const O=Array.isArray(w)?w:w?String(w).split(",").filter(Boolean):[];Ae||Ie(O),Me.current&&(Me.current.value=O.join(","))},focus(){var w,O;X?(w=P.current)==null||w.focus():(O=De.current)==null||O.focus()},blur(){var w,O;X?(w=P.current)==null||w.blur():(O=De.current)==null||O.blur()}}),[Ae]),{id:t,inputId:re,listboxId:je,values:E,inputValue:Xe,searchValue:me,options:U,filteredOptions:ci,isOpen:V,userInfoMessage:m,addValueText:_,maxIsReached:Gt,editingSingleValue:de,inputFocus:j,focusedTagIndex:Re,label:n,multiple:c,maxlength:p,typeahead:g,includeSearch:b,allowUserInput:f,displayValueAs:k,tagPlacement:v,searchPlaceholder:$,placeholder:M,disabled:S,required:T,fullwidth:L,hasError:D,errorMessage:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,optionalTag:K,optionalText:N,requiredTag:q,requiredText:B,tagText:Z,useWrapper:le,name:ae,className:pe,hasCounter:yt,inputRef:P,changeInputRef:Me,triggerRef:De,listboxRef:te,wrapperRef:Le,handleInputChange:Zi,handleInputKeydown:Qr,handleInputFocus:as,handleInputBlur:Zr,handleFocusOut:Jr,handleInputClick:Rr,handlePlaceholderClick:ea,handleSelectOnlyKeydown:I,handleOptionClick:F,handleOptionKeydown:Ge,handleTagRemove:tt,handleTagKeydown:xn,handleSearchInput:Ji,handleSearchKeydown:bb,handleNewOptionClick:vb,handleNewOptionKeydown:kb,onChange:ue}}const ul=d.forwardRef((s,e)=>{const t=Vg(s,e),n=["pkt-combobox-component",t.fullwidth&&"pkt-combobox-component--fullwidth",t.className].filter(Boolean).join(" "),i=t.allowUserInput||t.typeahead,r=i?t.inputId:`${t.id}-combobox`;return o.jsxs("div",{className:n,ref:t.wrapperRef,children:[o.jsxs(Ts,{forId:r,hasFieldset:!i,label:t.label||"",helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,className:"pkt-combobox__wrapper",children:[o.jsxs("div",{className:"pkt-combobox",onBlur:t.handleFocusOut,children:[o.jsx(Lg,{state:t}),o.jsx(Bg,{state:t})]}),t.tagPlacement==="outside"&&t.multiple&&o.jsx(cl,{state:t,outside:!0})]}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name||t.id,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});ul.displayName="PktCombobox";const Wi=os({tagName:"pkt-consent",elementClass:Lt,react:d,displayName:"PktConsent",events:{onToggleConsent:"toggle-consent"}});Wi.displayName="PktConsent";const dl=()=>{const s=navigator.userAgent;return!!(/iP(hone|od|ad)/.test(s)||/Macintosh/.test(s)&&"ontouchend"in document)},Ug=()=>dl()?"text":"date",Hg=s=>!s||s.length!==2?!0:og(s[0],s[1]),jg=(s,e,t,n,i,r)=>({"pkt-input":!0,"pkt-datepicker__input":!0,"pkt-input--fullwidth":s,"pkt-datepicker--hasrangelabels":e,"pkt-datepicker--multiple":t,"pkt-datepicker--range":n,"ios-readonly-hack":i===!1&&r==="text"}),qg=()=>({"pkt-input-icon":!0,"pkt-btn":!0,"pkt-btn--icon-only":!0,"pkt-btn--tertiary":!0,"pkt-datepicker__calendar-button":!0}),Wg=s=>({"pkt-input-prefix":s,"pkt-hide":!s}),zg=(s,e,t)=>!e&&!t?Array.isArray(s)?s[0]||"":s:Array.isArray(s)?s.join(","):s,Yg=(s,e,t=!1)=>{var l;if(!s||!e)return;const n=((l=e.parentElement)==null?void 0:l.getBoundingClientRect())||e.getBoundingClientRect(),i=t?n.height+30:n.height,r=s.getBoundingClientRect().height;let a=t?"calc(100% - 30px)":"100%";n&&n.top+r>window.innerHeight&&n.top-r>0&&(a=`calc(100% - ${i}px - ${r}px)`),s.style.top=a},zi=(s,e,t,n,i,r)=>{const{key:a}=s;a===","&&(s.preventDefault(),r?r(s):i&&i()),(a==="Space"||a===" ")&&(s.preventDefault(),e(s)),a==="Enter"&&(s.preventDefault(),t?t():n?n():i&&i())},Kg=({open:s,multiple:e=!1,range:t=!1,weeknumbers:n=!1,withcontrols:i=!1,selected:r=[],earliest:a,latest:l,excludedates:c,excludeweekdays:p,maxMultiple:g,currentmonth:b,today:f,inputRef:k,hasCounter:v=!1,onDateSelected:$,onClose:M})=>{const S=d.useRef(null),T=d.useRef(!1);s&&(T.current=!0),d.useEffect(()=>{s&&Yg(S.current,(k==null?void 0:k.current)??null,v)},[s,k,v]);const L=["pkt-calendar-popup",s?"show":"hide"].join(" "),D=s||T.current;return o.jsx("div",{ref:S,className:L,hidden:!s,"aria-hidden":!s,children:D&&o.jsx(Vr,{multiple:e,range:t,weeknumbers:n,withcontrols:i,selected:r,earliest:a,latest:l,excludedates:c,excludeweekdays:p,maxMultiple:g,currentmonth:b,today:f,onDateSelected:$,onClose:M})})},Gg=({dates:s,dateformat:e,idBase:t,strings:n,onDateRemoved:i})=>{var l;const r=ag(s),a=((l=n==null?void 0:n.calendar)==null?void 0:l.buttonAltText)??"Slett dato";return o.jsx("div",{className:"pkt-date-tags pkt-datepicker__tags","aria-live":"polite",children:r.map(c=>{const p=eg(c,e);return o.jsx(Qs,{id:`${t}${c}-tag`,closeTag:!0,ariaLabel:`${a} ${p}`,onClose:()=>i(c),children:o.jsx("time",{dateTime:c,children:p})},c)})})},Xg=({state:s})=>{var Pe,$e,Te,Ae;const{id:e,inputId:t,values:n,dateformat:i,multiple:r,range:a,showRangeLabels:l,disabled:c,readOnly:p,required:g,label:b,name:f,placeholder:k,hasError:v,helptext:$,minStr:M,maxStr:S,inputType:T,isIOSDevice:L,strings:D,inputClasses:Y,buttonClasses:ee,rangeLabelClasses:oe,datepickerInputsClasses:ye,isInputDisabled:K,inputRef:N,inputRefTo:q,btnRef:B,toggleCalendar:Z,handleFocus:le,handleSingleInputChange:ae,handleRangeFromChange:pe,handleRangeToChange:ue,handleRangeBlur:be,handleMultipleBlur:ne,handleTagRemoved:re,handleSingleKeydown:je,handleRangeFromKeydown:X,handleRangeToKeydown:P,handleMultipleKeydown:Me,restProps:De}=s,te=qe=>{qe.preventDefault(),Z()},Le=()=>{var qe,Ie;return o.jsxs("button",{ref:B,className:ee,type:"button",onClick:Z,disabled:c,"aria-label":((qe=D.calendar)==null?void 0:qe.buttonAltText)??"Åpne kalender",children:[o.jsx(R,{name:"calendar"}),o.jsx("span",{className:"pkt-btn__text",children:((Ie=D.calendar)==null?void 0:Ie.buttonAltText)??"Åpne kalender"})]})};return r?o.jsxs(o.Fragment,{children:[o.jsx(Gg,{dates:n,dateformat:i,idBase:e,strings:D,onDateRemoved:re}),o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f??e,placeholder:k,readOnly:p||L&&!p,disabled:K,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:Me,onFocus:le,onBlur:ne}),Le()]})})]}):a?o.jsx("div",{className:ye,children:o.jsxs("div",{className:"pkt-input__container",children:[l&&o.jsx("div",{className:"pkt-input-prefix",children:((Pe=D.generic)==null?void 0:Pe.from)??"Fra"}),o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f?`${f}-from`:`${e}-from`,value:n[0]??"",min:M,max:S,placeholder:k,readOnly:p||L&&!p,disabled:c,required:g,"aria-label":`${b} ${(($e=D.generic)==null?void 0:$e.from)??"Fra"}`,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:X,onFocus:le,onBlur:be,onChange:pe}),o.jsx("div",{className:oe,id:`${e}-to-label`,children:((Te=D.generic)==null?void 0:Te.to)??"Til"}),!l&&o.jsx("div",{className:"pkt-input-separator",children:"–"}),o.jsx("input",{ref:q,className:Y,type:T,id:`${e}-to`,name:f?`${f}-to`:`${e}-to`,value:n[1]??"",min:M,max:S,readOnly:p||L&&!p,disabled:c,"aria-label":`${b} ${((Ae=D.generic)==null?void 0:Ae.to)??"Til"}`,"aria-invalid":v,onClick:te,onKeyDown:P,onFocus:le,onBlur:be,onChange:ue}),Le()]})}):o.jsx("div",{className:"pkt-datepicker__inputs",children:o.jsxs("div",{className:"pkt-input__container",children:[o.jsx("input",{...De,ref:N,className:Y,type:T,id:t,name:f??e,value:n[0]??"",min:M,max:S,placeholder:k,readOnly:p||L&&!p,disabled:c,required:g,"aria-describedby":$?`${e}-helptext`:void 0,"aria-invalid":v,"aria-errormessage":v?`${e}-error`:void 0,onClick:te,onKeyDown:je,onFocus:le,onBlur:void 0,onChange:ae}),Le()]})})},Qg={calendar:{buttonAltText:"Åpne kalender"}},Zg={calendar:{buttonAltText:"Åpne kalender"},generic:{from:"Fra",to:"Til"}},hl=s=>s?Array.isArray(s)?s.filter(Boolean):String(s).split(",").map(e=>e.trim()).filter(Boolean):[];function Jg(s,e){const{id:t,label:n,value:i,defaultValue:r,dateformat:a="dd.MM.yyyy",multiple:l=!1,maxlength:c,range:p=!1,showRangeLabels:g=!1,weeknumbers:b=!1,withcontrols:f=!1,excludedates:k,excludeweekdays:v,currentmonth:$,today:M,calendarOpen:S,timezone:T,fullwidth:L=!1,hasFieldset:D=!1,inline:Y=!1,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,hasError:K=!1,errorMessage:N,optionalTag:q=!1,optionalText:B,requiredTag:Z=!1,requiredText:le,tagText:ae,useWrapper:pe=!0,strings:ue,disabled:be=!1,readOnly:ne=!1,required:re=!1,name:je,min:X,max:P,placeholder:Me,onChange:De,onValueChange:te,className:Le,...Pe}=s,$e=d.useCallback(I=>I===void 0?[]:hl(I),[]),Te=i!==void 0,Ae=typeof r=="number"?void 0:r,[qe,Ie]=d.useState(()=>$e(i??Ae)),ve=Te?$e(i):qe,E=d.useRef(qe);d.useEffect(()=>{Te&&Ie($e(i))},[i,Te,$e]);const[Be,Ye]=d.useState(S??!1);d.useEffect(()=>{S!==void 0&&Ye(S)},[S]);const U=d.useRef(null),V=d.useRef(null),se=d.useRef(null),me=d.useRef(null),fe=d.useRef(null),Xe=d.useMemo(()=>Ug(),[]),Ke=d.useMemo(()=>dl(),[]),m=d.useMemo(()=>ue??(p?Zg:Qg),[ue,p]),h=typeof X=="string"?X:X!==void 0?String(X):void 0,_=typeof P=="string"?P:P!==void 0?String(P):void 0,C=d.useMemo(()=>{const I=jg(L,g,l,p,ne,Xe);return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[L,g,l,p,ne,Xe]),j=d.useMemo(()=>{const I=qg();return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[]),W=d.useMemo(()=>{const I=Wg(g);return Object.entries(I).filter(([,F])=>F).map(([F])=>F).join(" ")},[g]),de=d.useMemo(()=>["pkt-datepicker__inputs",p&&"pkt-input__range-inputs"].filter(Boolean).join(" "),[p,g]),it=d.useMemo(()=>{if($)return $;if(_)return _.slice(0,7)},[$,_]),Re=be||l&&c!=null&&ve.length>=c,Fe=l&&c!=null,Kt=`${t}-input`,Gt=ve.join(",");d.useEffect(()=>{se.current&&(se.current.value=Gt)},[Gt]),d.useEffect(()=>{T&&typeof window<"u"&&T!==window.pktTz&&(window.pktTz=T)},[T]);const yt=d.useCallback((I,F=!0)=>{Te||Ie(I),F&&(te==null||te(I))},[Te,te]),ci=d.useMemo(()=>{var I;return(I=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"))==null?void 0:I.set},[]),dt=d.useCallback(I=>{const F=se.current;!F||!ci||(ci.call(F,I.join(",")),F.dispatchEvent(new Event("input",{bubbles:!0})))},[ci]),Ft=d.useCallback(()=>{be||Ye(I=>!I)},[be]),Xt=d.useCallback(()=>{Ye(!1)},[]);d.useEffect(()=>{if(!Be)return;const I=Ge=>{var xn;const tt=Ge.target;fe.current&&!fe.current.contains(tt)&&!((xn=tt.closest)!=null&&xn.call(tt,".pkt-calendar-popup"))&&Xt()},F=Ge=>{var tt;Ge.key==="Escape"&&(Xt(),(tt=U.current)==null||tt.focus())};return document.addEventListener("click",I,!0),document.addEventListener("keydown",F),()=>{document.removeEventListener("click",I,!0),document.removeEventListener("keydown",F)}},[Be,Xt]);const rs=d.useCallback(()=>{Ke&&!Be&&Ye(!0)},[Ke,Be]),Ns=d.useCallback(I=>{var tt;const F=zg(I,l,p),Ge=hl(F);yt(Ge),dt(Ge),!l&&!p&&(Xt(),(tt=U.current)==null||tt.focus())},[l,p,yt,dt,Xt]),et=d.useCallback(()=>{var I;Xt(),(I=U.current)==null||I.focus()},[Xt]),ui=d.useCallback(I=>{const F=I.target.value,Ge=F?[F]:[];yt(Ge),dt(Ge)},[yt,dt]),Zs=d.useCallback(I=>{const F=I.target.value,Ge=ve[1]??"",tt=[F,Ge].filter(Boolean);yt(tt),dt(tt)},[ve,yt,dt]),di=d.useCallback(I=>{const F=ve[0]??"",Ge=I.target.value,tt=[F,Ge].filter(Boolean);yt(tt),dt(tt)},[ve,yt,dt]),Vt=d.useCallback(()=>{ve.length===2&&!Hg(ve)&&(yt([ve[0]]),dt([ve[0]]))},[ve,yt,dt]),Tt=d.useCallback(I=>{const F=fs(I),Ge=h?fs(h):null,tt=_?fs(_):null;if(F&&!isNaN(F.getTime())&&(!Ge||F>=Ge)&&(!tt||F<=tt)){const xn=rg([...ve,I],h,_,k,v),Ji=[...new Set(xn)];yt(Ji),dt(Ji)}},[ve,h,_,k,v,yt,dt]),$n=d.useCallback(I=>{const F=I.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Zi=d.useCallback(I=>{const F=I.target;F.value&&(Tt(F.value.split(",")[0]),F.value="")},[Tt]),Qr=d.useCallback(I=>{const F=ve.filter(Ge=>Ge!==I);yt(F),dt(F)},[ve,yt,dt]),as=d.useCallback(I=>{const F=I==null?void 0:I.closest("form");F?F.requestSubmit():I==null||I.blur()},[]),Zr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ft,as]),Jr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),()=>{var F;return(F=V.current)==null?void 0:F.focus()},()=>{var F;return(F=U.current)==null?void 0:F.blur()})},[Ft,as]),Rr=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(V.current),void 0,()=>{var F;return(F=V.current)==null?void 0:F.blur()})},[Ft,as]),ea=d.useCallback(I=>{zi(I.nativeEvent,()=>Ft(),()=>as(U.current),void 0,()=>{var F;return(F=U.current)==null?void 0:F.blur()},Zi)},[Ft,as,Zi]);return d.useEffect(()=>{var Ge;const I=(Ge=fe.current)==null?void 0:Ge.closest("form");if(!I)return;const F=()=>{window.setTimeout(()=>{Ie(E.current),Ye(!1),se.current&&(se.current.value=E.current.join(","))},0)};return I.addEventListener("reset",F),()=>I.removeEventListener("reset",F)},[]),d.useImperativeHandle(e,()=>({get value(){var I;return((I=se.current)==null?void 0:I.value)??""},set value(I){const F=I?I.split(",").filter(Boolean):[];Ie(F),se.current&&(se.current.value=I??"")},focus(){var I;(I=U.current)==null||I.focus()},blur(){var I;(I=U.current)==null||I.blur()}}),[]),{id:t,inputId:Kt,label:n,values:ve,calendarOpen:Be,dateformat:a,multiple:l,maxlength:c,range:p,showRangeLabels:g,weeknumbers:b,withcontrols:f,excludedates:k,excludeweekdays:v,disabled:be,readOnly:ne,required:re,name:je,placeholder:Me,fullwidth:L,hasFieldset:D,inline:Y,helptext:ee,helptextDropdown:oe,helptextDropdownButton:ye,hasError:K,errorMessage:N,optionalTag:q,optionalText:B,requiredTag:Z,requiredText:le,tagText:ae,useWrapper:pe,className:Le,minStr:h,maxStr:_,effectiveCurrentMonth:it,today:M,inputType:Xe,isIOSDevice:Ke,strings:m,inputClasses:C,buttonClasses:j,rangeLabelClasses:W,datepickerInputsClasses:de,isInputDisabled:Re,hasCounter:Fe,inputRef:U,inputRefTo:V,changeInputRef:se,btnRef:me,wrapperRef:fe,onChange:De,toggleCalendar:Ft,hideCalendar:Xt,handleDateSelected:Ns,handleCalendarClose:et,handleFocus:rs,handleSingleInputChange:ui,handleRangeFromChange:Zs,handleRangeToChange:di,handleRangeBlur:Vt,handleMultipleBlur:$n,handleTagRemoved:Qr,handleSingleKeydown:Zr,handleRangeFromKeydown:Jr,handleRangeToKeydown:Rr,handleMultipleKeydown:ea,restProps:Pe}}const pl=d.forwardRef((s,e)=>{const t=Jg(s,e),n=["pkt-datepicker",t.className].filter(Boolean).join(" ");return o.jsxs("div",{className:n,children:[o.jsx(Ts,{ref:t.wrapperRef,forId:t.inputId,label:t.label,hasFieldset:t.hasFieldset,inline:t.inline,helptext:t.helptext,helptextDropdown:t.helptextDropdown,helptextDropdownButton:t.helptextDropdownButton,hasError:t.hasError,errorMessage:t.errorMessage,disabled:t.disabled,optionalTag:t.optionalTag,optionalText:t.optionalText,requiredTag:t.requiredTag,requiredText:t.requiredText,tagText:t.tagText,useWrapper:t.useWrapper,counter:t.hasCounter,counterCurrent:t.values.length,counterMaxLength:t.maxlength,children:o.jsx(Xg,{state:t})}),o.jsx(Kg,{open:t.calendarOpen,multiple:t.multiple,range:t.range,weeknumbers:t.weeknumbers,withcontrols:t.withcontrols,selected:t.values,earliest:t.minStr,latest:t.maxStr,excludedates:t.excludedates,excludeweekdays:t.excludeweekdays,maxMultiple:t.maxlength,currentmonth:t.effectiveCurrentMonth,today:t.today,inputRef:t.inputRef,hasCounter:t.hasCounter,onDateSelected:t.handleDateSelected,onClose:t.handleCalendarClose}),o.jsx("input",{ref:t.changeInputRef,type:"text",name:t.name,onChange:t.onChange,tabIndex:-1,"aria-hidden":"true",className:"pkt-visually-hidden"})]})});pl.displayName="PktDatepicker";const Rg={dropFilesHere:"Slipp filene her ...",selectOrDragFiles:"Dra filer hit for å laste dem opp eller ",chooseFiles:"velg filer"},em={dropFilesHere:"Slipp filen her ...",selectOrDragFiles:"Dra en fil for å laste den opp eller ",chooseFiles:"velg en fil"},tm={dropFilesHere:"Slipp bildene her ...",selectOrDragFiles:"Dra bilder hit for å laste dem opp eller ",chooseFiles:"velg fra kamerarull"},sm={dropFilesHere:"Slipp bildet her ...",selectOrDragFiles:"Dra et bilde for å laste det opp eller ",chooseFiles:"velg fra kamerarull"},fl=()=>("00000000000000000"+(Math.random()*18446744073709552e3).toString(16)).slice(-16),nm=()=>{const s=fl(),e=fl();return s.slice(0,8)+"-"+s.slice(8,12)+"-4"+s.slice(13)+"-a"+e.slice(1,4)+"-"+e.slice(4)};class gl{constructor(e,t){tr(this,"fileId");tr(this,"file");tr(this,"attributes",{});this.fileId=t||nm(),this.file=e,this.attributes={targetFilename:e.name}}}const Hr=d.createContext({}),im=".PDF, .JPEG, .JPG, .PNG, .HEIC, .DOC, .DOCX, .ODT",rm=d.forwardRef(({id:s,multiple:e,value:t,onFilesAdded:n=()=>{},name:i,uploadStrategy:r,accept:a,isThumbnailView:l=!1,disabled:c=!1,srAnnouncementIds:p,...g},b)=>{const f=d.useRef(null),k=typeof a=="string"&&a.trim().length>0?a:void 0,v=d.useMemo(()=>k?k.split(/\s*,\s*/).map(N=>N.trim()).filter(Boolean).join(", ").toUpperCase():im,[k]);d.useImperativeHandle(b,()=>f.current);const[$,M]=d.useState(!1),S=d.useMemo(()=>l?e?tm:sm:e?Rg:em,[e,l]),T=d.useCallback(N=>{if(f.current)try{f.current.files=am(N)}catch{}},[f.current,t]);d.useEffect(()=>{T(t)},[f,t]);const L=d.useCallback(N=>{const q=N.map(B=>new gl(B));n(q),f.current&&(f.current.value="")},[n]),D=N=>{const q=N.target.files;if(q.length===0){e&&T(t);return}L(Array.from(q))},Y=N=>{L(N)},ee=N=>{if(N.preventDefault(),M(!1),c)return;const q=N.dataTransfer.files,B=Array.from(q);Y(B)},oe=N=>{N.preventDefault(),!c&&M(!0)},ye=()=>{M(!1)},K=d.useCallback(N=>{var B;c||N.target.closest(".pkt-fileupload__drop-zone__placeholder__title__open-file-dialog")||(B=f.current)==null||B.click()},[c]);return o.jsxs("div",{onDrop:ee,onDragOver:oe,onDragLeave:ye,onClick:K,className:ke("pkt-fileupload__drop-zone",{"pkt-fileupload__drop-zone--drag-active":$,"pkt-fileupload__drop-zone--disabled":c}),children:[o.jsx("input",{...g,id:s,type:"file",ref:f,multiple:e,onChange:D,accept:k,disabled:c,name:r==="form"&&i||void 0,"aria-label":e?"Velg filer":"Velg fil"}),r==="custom"&&o.jsx(o.Fragment,{children:t==null?void 0:t.map(N=>o.jsx("input",{type:"hidden",name:i,value:N.fileId},N.fileId))}),o.jsxs("div",{className:"pkt-fileupload__drop-zone__placeholder",children:[o.jsx(R,{name:"attachment",className:"pkt-fileupload__drop-zone__placeholder__icon","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__drop-zone__placeholder__title",children:$?`${S.dropFilesHere} ...`:o.jsxs(o.Fragment,{children:[S.selectOrDragFiles," ",o.jsx("button",{className:"pkt-fileupload__drop-zone__placeholder__title__open-file-dialog",onClick:N=>{var q;N.preventDefault(),N.stopPropagation(),(q=f.current)==null||q.click()},type:"button",children:S.chooseFiles})]})}),o.jsxs("p",{className:"pkt-fileupload__drop-zone__placeholder__formats",children:["Format: ",v]})]})]})}),am=s=>{const e=new DataTransfer;for(const t of s)e.items.add(t.file);return e.files},jr=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,counter:n,counterMaxLength:i,className:r,disabled:a,errorMessage:l,hasError:c,helptext:p,helptextDropdown:g,helptextDropdownButton:b,inline:f,fullwidth:k=!1,label:v,name:$,optionalTag:M=!1,optionalText:S,requiredTag:T=!1,requiredText:L,tagText:D=null,placeholder:Y,rows:ee,useWrapper:oe=!0,onChange:ye,value:K,autoComplete:N="off",minLength:q,maxLength:B,readOnly:Z,skipForwardTestid:le=!1,...ae},pe)=>{const ue=[r,"pkt-textinput","pkt-textarea"].join(" "),be=`${s}-input`,ne=`${be}-label`,re=t||ne,[je,X]=d.useState(0),P=Me=>{var De,te;n&&X(((te=(De=Me.currentTarget)==null?void 0:De.value)==null?void 0:te.length)||0),ye&&ye(Me)};return d.useEffect(()=>{K!==void 0&&X((K==null?void 0:K.length)||0)},[K]),o.jsx(Ts,{ariaDescribedby:e,className:ue,disabled:a,errorMessage:l,forId:be,hasError:c,helptext:p,helptextDropdown:g,helptextDropdownButton:b,inline:f,label:v,optionalTag:M,optionalText:S,requiredTag:T,requiredText:L,tagText:D,useWrapper:oe,counter:n,counterCurrent:je,counterMaxLength:i,children:o.jsx("textarea",{ref:pe,className:`pkt-input ${k?"pkt-input--fullwidth":""} ${i&&je>i?"pkt-input--counter-error":""}`,name:`${$||s}`,id:be,placeholder:Y,disabled:a,rows:ee,"aria-labelledby":re,"aria-invalid":c,"aria-errormessage":`${s}-error`,...ae,onChange:P,value:K,autoComplete:N,minLength:q,maxLength:B,readOnly:Z,"data-skip-forward-testid":le?"true":void 0})})});jr.displayName="PktTextarea";const om=Symbol("comment"),lm=s=>{const e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),n=s.getFullYear(),i=String(s.getHours()).padStart(2,"0"),r=String(s.getMinutes()).padStart(2,"0");return`${e}.${t}.${n} kl. ${i}:${r}`},cm=({fileItem:s,closeOperationUi:e,onAddComment:t,existingComment:n})=>{const i=d.useRef(null),r=!!n,a=()=>{var c,p;const l=(p=(c=i.current)==null?void 0:c.value)==null?void 0:p.trim();l&&t({text:l,timestamp:new Date}),e()};return d.useLayoutEffect(()=>{const l=setTimeout(()=>{var c;return(c=i.current)==null?void 0:c.focus({preventScroll:!0})},0);return()=>clearTimeout(l)},[s.fileId]),o.jsxs(o.Fragment,{children:[o.jsx(jr,{autoFocus:!0,label:r?"Rediger kommentar":"Legg til kommentar",name:`comment-${s.fileId}`,className:"pkt-fileupload__queue-display__item__comment-input",placeholder:"Skriv inn kommentar",rows:2,id:`comment-${s.fileId}`,ref:i,defaultValue:n==null?void 0:n.text}),o.jsx(gt,{skin:"secondary",size:"small",onClick:a,children:r?"Lagre kommentar":"Legg til kommentar"}),o.jsx(gt,{skin:"tertiary",size:"small",onClick:e,children:"Avbryt"})]})},um=({comments:s,onDeleteComment:e,onEditComment:t})=>s&&s.length>0?o.jsx("div",{className:"pkt-fileupload__queue-display__item__comments",children:s.map((n,i)=>o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment",children:[o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__content",children:[o.jsx("span",{className:"pkt-fileupload__queue-display__item__comment__text","aria-label":"Kommentar tekst",children:n.text}),o.jsx("time",{className:"pkt-fileupload__queue-display__item__comment__time",children:lm(n.timestamp)})]}),o.jsxs("div",{className:"pkt-fileupload__queue-display__item__comment__actions",children:[e&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>e(i),"aria-label":"Slett kommentar",children:o.jsx(R,{name:"trash-can"})}),t&&o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__comment__action",onClick:()=>t(i),"aria-label":"Rediger kommentar",children:o.jsx(R,{name:"edit"})})]})]},i))}):null,dm=s=>{const e=d.useContext(Hr);return o.jsx("input",{type:"hidden",name:`${e.name}-comments`,value:s.comments?JSON.stringify(s.comments):""})},hm=s=>{const e=s("comments"),t=(i,r)=>{e.set(i,[r])},n=(i,r)=>{const l=(e.get(i)||[]).filter((c,p)=>p!==r);e.set(i,l.length>0?l:void 0)};return{title:i=>{const r=e.get(i.fileId);return r&&r.length>0?"":"Legg til kommentar"},renderExtendedUI:(i,r)=>{const a=e.get(i.fileId),l=a==null?void 0:a[0];return o.jsx(cm,{fileItem:i,closeOperationUi:r,onAddComment:c=>t(i.fileId,c),existingComment:l})},renderContent:(i,r,a)=>{if(a)return null;const l=e.get(i.fileId);return o.jsx(um,{comments:l,onDeleteComment:c=>n(i.fileId,c),onEditComment:r?()=>r():void 0})},renderHidden:i=>o.jsx(dm,{comments:e.get(i.fileId)},`comments${i.fileId}`),symbol:om}},pm=Symbol("deleteFile"),fm=s=>({title:"Slett",ariaLabel:"Slett fil",onClick:e=>s(e.fileId),symbol:pm}),gm=Symbol("renameFile"),mm=s=>{const e=d.useRef(null),t=d.useId(),n=()=>{var i;s.onSave(((i=e.current)==null?void 0:i.value)??"")};return o.jsxs(o.Fragment,{children:[o.jsx("label",{htmlFor:t,className:"pkt-sr-only",children:"Endre filnavn"}),o.jsx("input",{id:t,ref:e,type:"text",autoFocus:!0,defaultValue:s.value,className:"pkt-fileupload__queue-display__item__rename-input",onKeyDown:i=>{i.key==="Enter"&&(i.preventDefault(),i.stopPropagation(),n()),i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),s.onCancel())}}),o.jsx(gt,{skin:"secondary",size:"small",onClick:()=>s.onSave(e.current.value),children:"Lagre"}),o.jsx(gt,{skin:"tertiary",size:"small",onClick:s.onCancel,children:"Avbryt"})]})},bm=s=>{const e=d.useContext(Hr);return o.jsx("input",{type:"hidden",name:`${e.name}-targetFilename`,value:s.targetFilename})},vm=s=>{const e=s("targetFilename");return{title:"Rediger",ariaLabel:"Rediger filnavn",renderInlineUI:(t,n)=>o.jsx(mm,{value:e.get(t.fileId)||void 0,onSave:i=>{e.set(t.fileId,i),n()},onCancel:n}),renderHidden:t=>o.jsx(bm,{targetFilename:e.get(t.fileId)||t.file.name},`rename${t.fileId}`),symbol:gm}},km=(s,e)=>{const t=d.useCallback((r,a,l)=>{const c=s.find(g=>g.fileId===r),p=c.attributes||{};c.attributes={...p,[a]:l},e(r,{attributes:c.attributes})},[e,s]),n=d.useCallback((r,a)=>(s.find(p=>p.fileId===r).attributes||{})[a],[s]);return{fileAttributes:d.useCallback(r=>({get:a=>n(a,r),set:(a,l)=>{t(a,r,l)}}),[n,t])}},ym=s=>{const[e,t]=d.useState(!1),[n,i]=d.useState(0),r=d.useRef(null),a=d.useCallback(p=>{var b;const g=s.findIndex(f=>f.fileId===p);g>=0&&(i(g),t(!0),(b=r.current)==null||b.showModal())},[s]),l=d.useCallback(()=>{var p;t(!1),(p=r.current)==null||p.close()},[]),c=d.useCallback(p=>{s.length!==0&&i(g=>p==="prev"?g<=0?s.length-1:g-1:g>=s.length-1?0:g+1)},[s.length]);return{isOpen:e,currentIndex:n,modalRef:r,open:a,close:l,navigate:c}},_m=s=>{const[e,t]=d.useState({}),n=d.useCallback(a=>{const l=e[a];if(l)return s.find(c=>c.symbol===l)},[e,s]),i=d.useCallback((a,l)=>{t(c=>({...c,[a]:l.symbol}))},[]),r=d.useCallback(a=>{t(l=>{const c={...l};return delete c[a],c})},[]);return{getActivated:n,activate:i,close:r}},wm=os({tagName:"pkt-modal",elementClass:Ot,react:d,displayName:"PktModal",events:{}}),qr=d.forwardRef(({children:s,...e},t)=>o.jsx(wm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));qr.displayName="PktModal";const ml=2,$m=s=>{const e=window.getComputedStyle(s),t=parseFloat(e.lineHeight);if(!Number.isNaN(t)&&t>0)return t;const n=parseFloat(e.fontSize);return(!Number.isNaN(n)&&n>0?n:16)*1.2},xm=(s,e,t)=>{const n=e*t;return s.getBoundingClientRect().height>n+.5},bl=d.createContext({tail:5}),oi=({children:s,tail:e,...t})=>{const n=s,i=d.useContext(bl),r=e!==void 0?e:i.tail||0,a=s.length<=r+3?null:s.slice(-r),l=d.useRef(null),c=d.useRef(null),[p,g]=d.useState(!1),b=d.useCallback(()=>{const k=l.current,v=c.current;if(!k||!v)return;const $=$m(k);g(xm(v,$,ml))},[]),f=d.useMemo(()=>new ResizeObserver(k=>{k.some(v=>v.target===l.current)&&b()}),[b]);return d.useLayoutEffect(()=>(l.current&&f.observe(l.current),b(),()=>f.disconnect()),[s,f,b]),o.jsxs("span",{ref:l,...t,"data-pkt-truncate-part":"wrapper",style:{maxWidth:"100%",width:"100%",display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"end",columnGap:"0.25rem",overflow:"hidden",position:"relative",...t.style},children:[o.jsx("span",{"data-pkt-truncate-part":"first",style:{minWidth:0,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:ml,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",overflowWrap:"anywhere"},children:n}),r!==0&&o.jsx("span",{"data-pkt-truncate-part":"tail",style:{whiteSpace:"nowrap",display:p?"inline":"none",paddingRight:"0.5rem"},"aria-hidden":!0,children:a}),o.jsx("span",{ref:c,"aria-hidden":!0,"data-pkt-truncate-part":"measure",style:{position:"absolute",top:0,left:0,width:"100%",visibility:"hidden",pointerEvents:"none",whiteSpace:"normal",overflowWrap:"anywhere"},children:s})]})},Sm=s=>{if(typeof s=="number")return s;const e=s.trim().match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);if(!e)return console.warn(`PktFileUpload: Invalid maxFileSize format "${s}". Use format like "5MB", "500KB", or a number in bytes.`),0;const t=parseFloat(e[1]);switch(e[2].toUpperCase()){case"B":return t;case"KB":return t*1024;case"MB":return t*1024*1024;case"GB":return t*1024*1024*1024;default:return t}},Yi=s=>s<1024?`${s} B`:s<1024*1024?`${Math.round(s/1024)} KB`:s<1024*1024*1024?`${Math.round(s/(1024*1024))} MB`:`${Math.round(s/(1024*1024*1024))} GB`,Wr=s=>o.jsx("button",{onClick:s.onClick,className:"pkt-fileupload__queue-display__item__cancel-button","aria-label":s.ariaLabel||"Avbryt opplasting",children:s.label||"Avbryt"}),Cm=()=>{const[s,e]=d.useState(1);return d.useEffect(()=>{const t=setInterval(()=>{e(n=>n>=3?1:n+1)},400);return()=>clearInterval(t)},[]),o.jsxs("span",{className:"pkt-fileupload__queue-display__item__loading-text","aria-label":"Laster opp fil",children:["Laster opp",".".repeat(s)]})},Tm=({cancelTransfer:s,transferItem:e})=>{const t=e.showProgress??e.progress!==0;return o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title","aria-label":"Filnavn",children:o.jsx(oi,{children:e.attributes.targetFilename})}),o.jsx(Wr,{onClick:s}),t?o.jsxs(o.Fragment,{children:[o.jsx(Qi,{valueCurrent:e.progress*100,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(e.file.size)}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__percentage","aria-hidden":"true",children:`${Math.round(e.progress*100)}%`})]}):o.jsx(Cm,{})]})},Nm=({transferItem:s,onRemove:e})=>{const t=(s.lastProgress??1)*100;return o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Wr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),o.jsx(Qi,{valueCurrent:t,statusType:"none",valueMax:100,statusPlacement:"following",className:"pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]})},Mm=({transferItem:s,onRemove:e})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium",name:"alert-error","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx(Wr,{onClick:e,label:"Fjern",ariaLabel:"Fjern fil som feilet under opplasting"}),s.errorMessage&&o.jsx("span",{className:"pkt-fileupload__queue-display__item__error-message",children:s.errorMessage})]}),Dm=({transferItem:s,onRemove:e})=>s.showProgress?o.jsx(Nm,{transferItem:s,onRemove:e}):o.jsx(Mm,{transferItem:s,onRemove:e}),Om=({operation:s,onActivate:e,transferItem:t})=>{const n=typeof s.title=="function"?s.title(t):s.title;if(!n)return null;const i=()=>{(s.renderInlineUI||s.renderExtendedUI)&&e(t.fileId,s),s.onClick&&s.onClick(t)};return o.jsx("button",{type:"button",className:"pkt-fileupload__queue-display__item__operation",onClick:i,"aria-label":typeof s.ariaLabel=="function"?s.ariaLabel(t):s.ariaLabel,children:n})},vl=({transferItem:s})=>o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium","aria-hidden":"true"}),o.jsx("p",{className:"pkt-fileupload__queue-display__item__title",children:o.jsx(oi,{children:s.attributes.targetFilename})}),o.jsx("span",{className:"pkt-fileupload__queue-display__item__filesize",children:Yi(s.file.size)})]}),Em=({transferItem:s,onPreviewClick:e})=>{const[t,n]=d.useState(null),[i,r]=d.useState(!1),a=s.file;d.useEffect(()=>{if(r(!1),a.type.startsWith("image/")){const g=URL.createObjectURL(a);return n(g),()=>{URL.revokeObjectURL(g)}}n(null)},[a]);const l=t&&!i&&o.jsx("img",{src:t,alt:s.attributes.targetFilename,onError:()=>r(!0)})||o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"}),c=!!e,p=!!t&&!i;return o.jsxs("div",{className:`pkt-fileupload__queue-display__item__thumbnail${p?"":" pkt-fileupload__queue-display__item__thumbnail--fallback"}`,children:[o.jsxs(gt,{className:"pkt-fileupload__queue-display__item__thumbnail__image-wrapper","aria-label":`Forhåndsvis bilde ${s.attributes.targetFilename}`,type:"button",skin:"secondary",onClick:e,children:[c&&o.jsx(R,{name:"expand",className:"pkt-fileupload__queue-display__item__thumbnail__expand-icon","aria-hidden":"true"}),l]}),o.jsx(oi,{className:"pkt-fileupload__queue-display__item__thumbnail__title",children:s.attributes.targetFilename})]})},kl=d.forwardRef(({isOpen:s,images:e,currentIndex:t,onClose:n,onNavigate:i},r)=>{const[a,l]=d.useState(null),[c,p]=d.useState(!1),g=e[t],b=e.length>1;return d.useEffect(()=>{if(p(!1),g&&g.file.type.startsWith("image/")){const f=URL.createObjectURL(g.file);return l(f),()=>URL.revokeObjectURL(f)}l(null)},[g]),d.useEffect(()=>{if(!s)return;const f=k=>{switch(k.key){case"ArrowLeft":k.preventDefault(),i("prev");break;case"ArrowRight":k.preventDefault(),i("next");break;case"Escape":k.preventDefault(),n();break}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,i,n]),g?o.jsx(qr,{ref:r,headingText:g.attributes.targetFilename,closeOnBackdropClick:!0,className:"pkt-fileupload__image-preview-modal",children:o.jsxs("div",{className:"pkt-fileupload__image-preview",children:[b&&o.jsx(gt,{variant:"icon-only",iconName:"chevron-thin-left",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev",onClick:()=>i("prev"),"aria-label":`Forrige bilde ${t} / ${e.length}`}),o.jsx("div",{className:"pkt-fileupload__image-preview__content",children:a&&!c?o.jsx("img",{src:a,alt:`${g.attributes.targetFilename} - ${t+1} av ${e.length}`,className:"pkt-fileupload__image-preview__image",onError:()=>p(!0)}):o.jsx(R,{name:"picture",className:"pkt-fileupload__queue-display__item__icon pkt-icon--medium"})}),b&&o.jsxs("span",{className:"pkt-fileupload__image-preview__counter",children:[t+1," / ",e.length]}),b&&o.jsx(gt,{variant:"icon-only",iconName:"chevron-thin-right",skin:"secondary",size:"small",className:"pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next",onClick:()=>i("next"),"aria-label":`Neste bilde ${t+2} / ${e.length}`})]})}):null});kl.displayName="ImagePreviewModal";const Pm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},zr=s=>typeof s=="number"?"in-progress":s==="error"?"error":"idle",Am=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__actions",children:s.filter(i=>!e||i.symbol!==e.symbol).map(i=>o.jsx(Om,{operation:i,onActivate:t,transferItem:n},i.symbol.toString()))}),Im=({operations:s,activatedOperation:e,onActivate:t,transferItem:n})=>o.jsx(o.Fragment,{children:s.filter(i=>i.renderContent).map(i=>o.jsx("div",{className:"pkt-fileupload__queue-display__item__operation-content",children:i.renderContent(n,()=>t(n.fileId,i),(e==null?void 0:e.symbol)===i.symbol)},i.symbol.toString()))}),Lm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:i,onClose:r,onPreviewClick:a})=>{const l=()=>r(s.fileId),p=(e==null?void 0:e.renderInlineUI)||(e==null?void 0:e.renderExtendedUI)?[]:t;return o.jsxs(o.Fragment,{children:[e!=null&&e.renderInlineUI?o.jsxs(o.Fragment,{children:[o.jsx(R,{name:"document-text",className:"pkt-fileupload__queue-display__item__icon"}),o.jsx("div",{className:"pkt-fileupload__queue-display__item__inline-ui",children:e.renderInlineUI(s,l)})]}):o.jsx(n,{transferItem:s,queueItemOperations:t,onPreviewClick:a}),p.length>0&&o.jsx(Am,{operations:p,activatedOperation:e,onActivate:i,transferItem:s}),o.jsx(Im,{operations:t,activatedOperation:e,onActivate:i,transferItem:s}),(e==null?void 0:e.renderExtendedUI)&&o.jsx("div",{className:"pkt-fileupload__queue-display__item__expanded-operation-ui",children:e.renderExtendedUI(s,l)})]})},Bm=({transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,enableImagePreview:i,onActivate:r,onClose:a,onCancelTransfer:l,onOpenPreview:c})=>{const p=zr(s.progress),g=i&&s.progress==="done"&&Pm(s);switch(p){case"in-progress":return o.jsx(Tm,{"aria-live":"off",transferItem:s,cancelTransfer:()=>l(s.fileId)});case"error":return o.jsx(Dm,{transferItem:s,onRemove:()=>l(s.fileId)});case"idle":return o.jsx(Lm,{transferItem:s,activatedOperation:e,operations:t,ItemRenderer:n,onActivate:r,onClose:a,onPreviewClick:g?()=>c(s.fileId):void 0})}},Fm=s=>{var e;return(e=s.file.type)!=null&&e.startsWith("image/")?!0:/\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(s.file.name||"")},Vm=(s,e,t)=>d.useMemo(()=>{const n=s.map(r=>{const a=e.find(l=>l.fileId===r.fileId);return{...r,progress:(a==null?void 0:a.progress)??(t==="form"?"done":"queued"),errorMessage:a==null?void 0:a.errorMessage,showProgress:a==null?void 0:a.showProgress,lastProgress:a==null?void 0:a.lastProgress}}),i={"in-progress":0,error:1,idle:2};return n.sort((r,a)=>i[zr(r.progress)]-i[zr(a.progress)])},[s,e,t]),Um=(s,e)=>d.useMemo(()=>e?s.filter(t=>t.progress==="done"&&Fm(t)):[],[s,e]),Hm=({files:s,cancelTransfer:e,transfers:t=[],queueItemOperations:n=[],ItemRenderer:i=vl,truncateTail:r,enableImagePreview:a=!1,uploadStrategy:l="form"})=>{const c=Vm(s,t,l),p=Um(c,a),g=_m(n),b=ym(p);return o.jsxs(o.Fragment,{children:[o.jsx("ul",{className:"pkt-fileupload__queue-display",children:o.jsx(bl.Provider,{value:{tail:r},children:c.map(f=>o.jsxs("li",{className:ke("pkt-fileupload__queue-display__item",{"pkt-fileupload__queue-display__item--in-progress":typeof f.progress=="number",[`pkt-fileupload__queue-display__item--${f.progress}`]:typeof f.progress=="string"}),children:[n.filter(k=>k.renderHidden).map(k=>k.renderHidden(f)),o.jsx(Bm,{transferItem:f,activatedOperation:g.getActivated(f.fileId),operations:n,ItemRenderer:i,enableImagePreview:a,onActivate:g.activate,onClose:g.close,onCancelTransfer:e,onOpenPreview:b.open})]},f.fileId))})}),a&&p.length>0&&o.jsx(kl,{ref:b.modalRef,isOpen:b.isOpen,images:p,currentIndex:b.currentIndex,onClose:b.close,onNavigate:b.navigate})]})},Yr={filename:vl,thumbnail:Em},yl=d.forwardRef(({value:s,defaultValue:e,id:t="fileupload-id",multiple:n=!1,uploadStrategy:i="form",addCommentsEnabled:r=!1,renameFilesEnabled:a=!1,truncateTail:l,onFilesChanged:c,onFileUploadRequested:p,extraOperations:g=[],itemRenderer:b=Yr.filename,fullWidth:f=!1,allowedFormats:k,formatErrorMessage:v,maxFileSize:$,sizeErrorMessage:M,onFileValidation:S,errorMessage:T,hasError:L=!1,disabled:D=!1,label:Y,helptext:ee,optionalTag:oe,requiredTag:ye,enableImagePreview:K=!1,...N},q)=>{const B="transfers"in N?N.transfers:void 0,[Z,le]=d.useState(null),ae=L||!!Z,pe=T||Z,ue=$?Sm($):void 0,be=d.useCallback(V=>{var se;if(k&&k.length>0){const me=((se=V.name.split(".").pop())==null?void 0:se.toLowerCase())||"",fe=V.type.toLowerCase();if(!k.some(Ke=>{const m=Ke.toLowerCase().replace(/^\./,"");if(m.includes("/")){if(m.endsWith("/*")){const h=m.replace("/*","");return fe.startsWith(h+"/")}return fe===m}return me===m})){const Ke=k.join(", "),m=`Ugyldig filtype. Tillatte formater: ${Ke}`;return(v==null?void 0:v.replace("{formats}",Ke))||m}}if(ue&&V.size>ue){const me=Yi(ue),fe=`Filen er for stor. Maks størrelse er ${me}.`;return(M==null?void 0:M.replace("{maxSize}",me))||fe}return S?S(V):null},[k,v,ue,M,S]);s!==void 0&&e!==void 0&&console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"),s!==void 0&&c===void 0&&console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");const re=s!==void 0?s:e||[],je=typeof b=="string"?Yr[b]:b,X=b==="thumbnail",P=typeof N.accept=="string"?N.accept.trim():void 0,Me=d.useMemo(()=>{if(!(!k||k.length===0))return k.map(V=>V.trim()).filter(Boolean).map(V=>{const se=V.toLowerCase();return se.includes("/")||se.startsWith(".")?se:`.${se}`}).join(", ")},[k]),De=P||Me,te=a&&!X,Le=r&&!X,Pe=d.useCallback(V=>{for(const me of V){const fe=be(me.file);if(fe){le(fe);return}}le(null);const se=n?[...re,...V]:[V[0]];c&&c(se),i==="custom"&&p&&V.forEach(me=>{p==null||p(me)})},[c,re,n,i,p,be]),$e=d.useCallback((V,se)=>{const me=re.map(fe=>fe.fileId===V?{...fe,...se}:fe);c&&c(me)},[c,re]),Te=d.useCallback(V=>{var me;const se=re.filter(fe=>fe.fileId!==V);c&&c(se),"onTransferCancelled"in N&&N.onTransferCancelled&&((me=N.onTransferCancelled)==null||me.call(N,V))},[c,re,N]),{fileAttributes:Ae}=km(re,$e),qe=d.useMemo(()=>[{op:vm,enabled:te},{op:V=>hm(V),enabled:Le}].filter(({enabled:V})=>V).map(({op:V})=>V).concat(...g),[te,Le]),Ie=d.useMemo(()=>({uploaded:`${t}-uploaded`,errors:`${t}-errors`}),[t]),{totalCount:ve,uploadedCount:E,failedCount:Be}=d.useMemo(()=>{const V=re.length;if(!B)return{totalCount:V,uploadedCount:0,failedCount:0};let se=0,me=0;for(const fe of re){const Xe=B.find(Ke=>Ke.fileId===fe.fileId);(Xe==null?void 0:Xe.progress)==="done"&&se++,(Xe==null?void 0:Xe.progress)==="error"&&me++}return{totalCount:V,uploadedCount:se,failedCount:me}},[re,B]),Ye=ve===1?"fil":"filer",U=o.jsx("div",{className:ke("pkt-fileupload",{"pkt-fileupload--full-width":f,"pkt-fileupload--error":ae,"pkt-fileupload--disabled":D}),"aria-disabled":D,...D?{inert:""}:{},children:o.jsxs(Hr.Provider,{value:{name:N.name||"",multiple:!!n,id:t},children:[o.jsx("div",{id:Ie.uploaded,className:"pkt-sr-only","aria-live":"polite","aria-atomic":"true",children:ve>0&&E>0&&`${E} av ${ve} ${Ye} lastet opp`}),o.jsx("div",{id:Ie.errors,className:"pkt-sr-only","aria-live":"assertive","aria-atomic":"true",children:ve>0&&Be>0&&`Feil ved opplasting: ${Be} av ${ve} ${Ye} feilet`}),o.jsx(rm,{id:t,name:N.name||"",value:re,onFilesAdded:Pe,multiple:n,uploadStrategy:i,ref:q,accept:X?".jpeg, .jpg, .png, .gif, .webp, .heic":De,isThumbnailView:X,disabled:D,srAnnouncementIds:Ie}),ae&&pe&&o.jsx(Bi,{skin:"error","aria-live":"assertive",role:"alert",compact:!0,children:pe}),o.jsx(Hm,{files:re,cancelTransfer:Te,truncateTail:l,transfers:B,uploadStrategy:i,ItemRenderer:je,enableImagePreview:X&&K,queueItemOperations:qe.map(V=>V(Ae)).concat(fm(Te))})]})});return Y?o.jsx(Ts,{forId:t,label:Y,helptext:ee,disabled:D,hasError:ae,optionalTag:oe,requiredTag:ye,className:ke("pkt-fileupload-wrapper",{"pkt-fileupload-wrapper--full-width":f}),children:U}):U});yl.displayName="PktFileUpload";const jm=({columnOne:s,columnTwo:e,socialLinks:t,className:n,openLinksInNewTab:i=!1,personvernOgInfoLink:r="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:a="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:l=!1,hotjarId:c=null,googleAnalyticsId:p=null,devMode:g=!1,cookieDomain:b=null,cookieSecure:f=null,cookieExpiryDays:k=null,onToggleConsent:v=$=>{console.log($.detail)}})=>{var M,S;const $=[n,"pkt-footer"].filter(Boolean).join(" ");return o.jsx("footer",{className:$,"data-mode":"dark",children:o.jsxs("div",{className:"pkt-footer__container",children:[o.jsxs("div",{className:"pkt-grid pkt-grid--rowgap-size-32 pkt-grid--gap-size-16",children:[o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:s.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[s.text&&o.jsx("li",{className:"pkt-footer__text",children:s.text}),(M=s.links)==null?void 0:M.map((T,L)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${L}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:e.title}),o.jsxs("ul",{className:"pkt-footer__list",children:[e.text&&o.jsx("li",{className:"pkt-footer__text",children:e.text}),(S=e.links)==null?void 0:S.map((T,L)=>o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:`pkt-footer__link ${T.external?"pkt-link--external":""}`,href:T.href,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),T.text]})},`links-${L}`))]})]}),o.jsxs("div",{className:"pkt-footer__column pkt-cell pkt-cell--span12 pkt-cell--span4-laptop-up",children:[o.jsx("h2",{className:"pkt-footer__title",children:"Om nettstedet"}),o.jsxs("ul",{className:"pkt-footer__list",children:[o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:r,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer__list-item",children:o.jsxs("a",{className:"pkt-footer__link",href:a,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),l&&o.jsx("li",{className:"pkt-footer__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:c,googleAnalyticsId:p,devMode:g,cookieDomain:b,cookieSecure:f,cookieExpiryDays:k,onToggleConsent:v})})]})]})]}),t&&o.jsxs("div",{className:"pkt-footer__social","aria-label":"standard lenker",children:[o.jsx("div",{className:"pkt-footer__social-languages",children:t.filter(T=>T.language).map((T,L)=>o.jsx("div",{className:"pkt-footer__social-language",children:o.jsx("a",{href:T.href,"aria-label":`til ${T.language} versjon av nettsiden`,target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:T.language})},`sociallinks-language-${L}`))}),o.jsx("div",{className:"pkt-footer__social-icons",children:t.filter(T=>T.iconName).map((T,L)=>o.jsx(d.Fragment,{children:o.jsx("a",{href:T.href,"aria-label":`til ${T.iconName}`,className:"pkt-footer__social-icon-link",target:T.openInNewTab||i?"_blank":"_self",rel:T.openInNewTab||i?"noopener noreferrer":void 0,children:o.jsx(R,{className:"pkt-footer__social-icon",name:T.iconName})})},`sociallinks-${L}`))})]})]})})},qm=({links:s=[],openLinksInNewTab:e=!1,personvernOgInfoLink:t="https://www.oslo.kommune.no/personvern-og-informasjonskapsler/",tilgjengelighetLink:n="https://www.oslo.kommune.no/tilgjengelighet/",includeConsent:i=!1,hotjarId:r=null,googleAnalyticsId:a=null,devMode:l=!1,cookieDomain:c=null,cookieSecure:p=null,cookieExpiryDays:g=null,onToggleConsent:b=k=>{console.log(k.detail)},className:f})=>{const k=[f,"pkt-footer-simple"].filter(Boolean).join(" ");return o.jsx("footer",{className:k,"data-mode":"dark",children:o.jsx("div",{className:"pkt-footer-simple__container",children:o.jsxs("ul",{className:"pkt-footer-simple__list",children:[s.map((v,$)=>o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:`pkt-footer-simple__link ${v.external?" pkt-link--external":""}`,href:v.href,target:v.openInNewTab||e?"_blank":"_self",rel:v.openInNewTab||e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),v.text]})},$)),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:t,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Personvern og informasjonskapsler"]})}),o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsxs("a",{className:"pkt-footer-simple__link",href:n,target:e?"_blank":"_self",rel:e?"noopener noreferrer":void 0,children:[o.jsx(R,{className:"pkt-footer-simple__link-icon",name:"chevron-right"}),"Tilgjengelighet"]})}),i&&o.jsx("li",{className:"pkt-footer-simple__list-item",children:o.jsx(Wi,{triggerType:"footerlink",hotjarId:r,googleAnalyticsId:a,devMode:l,cookieDomain:c,cookieSecure:p,cookieExpiryDays:g,onToggleConsent:b})})]})})})},Wm=(s,e)=>{const t=()=>typeof window>"u"?0:window.innerWidth,[n,i]=d.useState(t);return d.useEffect(()=>{const r=s.current;if(!r)return;if(i(r.offsetWidth),typeof ResizeObserver>"u"){const l=()=>{r&&i(r.offsetWidth)};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}const a=new ResizeObserver(l=>{for(const c of l)c.borderBoxSize&&c.borderBoxSize.length>0?i(c.borderBoxSize[0].inlineSize):i(c.contentRect.width)});return a.observe(r),()=>{a.disconnect()}},[s]),n};function zm(s){const e=d.useRef(0);d.useEffect(()=>{const t=document.body,n=document.documentElement;if(s){e.current=window.scrollY||window.pageYOffset;const i=window.innerWidth-n.clientWidth;i>0&&(t.style.paddingRight=`${i}px`),t.style.position="fixed",t.style.top=`-${e.current}px`,t.style.left="0",t.style.right="0",t.style.width="100%",t.style.overflow="hidden",n.classList.add("is-scroll-locked")}else t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("left"),t.style.removeProperty("right"),t.style.removeProperty("width"),t.style.removeProperty("overflow"),t.style.removeProperty("padding-right"),document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current});return()=>{s&&(t.style.cssText="",document.documentElement.classList.remove("is-scroll-locked"),window.scrollTo({top:e.current}))}},[s])}const Ki=({href:s,iconName:e,className:t,iconPosition:n,external:i,target:r,children:a,...l})=>{const c={"pkt-link":!0,"pkt-link--icon-left":!!e&&n==="left"||!!(e&&!n),"pkt-link--icon-right":!!e&&n==="right","pkt-link--external":i};return o.jsxs("a",{...l,className:ke(c,t),href:s,target:r,rel:i?"noopener noreferrer":void 0,children:[e&&o.jsx(R,{name:e,className:"pkt-link__icon"}),a]})};Ki.displayName="PktLink";const Ym=s=>typeof s.target=="string"?{title:s.title,iconName:s.iconName,href:s.target}:{title:s.title,iconName:s.iconName,onClick:s.target},Gi=({item:s,className:e})=>"href"in s?o.jsx(Ki,{iconName:s.iconName,href:s.href,"aria-hidden":"true",className:ke("pkt-user-menu__link",e),children:s.title}):o.jsxs("button",{className:ke("pkt-user-menu__link pkt-link-button pkt-link pkt-link--icon-left",e),type:"button",onClick:()=>{"onClick"in s&&typeof s.onClick=="function"?s.onClick():console.error("UserMenuButton item is missing onClick handler or onClick is not a function:",s)},children:[s.iconName&&o.jsx(R,{name:s.iconName,className:"pkt-link__icon","aria-hidden":"true"}),s.title]}),Km=({links:s})=>o.jsx("ul",{className:"pkt-user-menu__sublist",children:s.map((e,t)=>o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:e})},t))}),_l=d.forwardRef(({user:s,formattedLastLoggedIn:e,representing:t,userMenu:n,canChangeRepresentation:i,changeRepresentation:r,logoutOnClick:a},l)=>{const c=n==null?void 0:n.map(Ym);return o.jsx("nav",{className:"pkt-user-menu",ref:l,"aria-label":"Meny for innlogget bruker",children:o.jsxs("ul",{className:"pkt-user-menu__list",children:[s&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Pålogget som"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:s.name}),e&&o.jsxs("div",{className:"pkt-user-menu__last-logged-in",children:["Sist pålogget: ",o.jsx("time",{children:e})]})]}),c&&c.length>0&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Km,{links:c})}),t&&o.jsxs("li",{className:"pkt-user-menu__item",children:[o.jsx("div",{className:"pkt-user-menu__label",children:"Representerer"}),o.jsx("div",{className:"pkt-user-menu__name",translate:"no",children:t.name}),t.orgNumber&&o.jsxs("div",{className:"pkt-user-menu__org-number",children:["Org.nr. ",t.orgNumber]}),i&&r&&o.jsx("ul",{className:"pkt-user-menu__sublist mt-size-16",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})]}),!t&&i&&r&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx("ul",{className:"pkt-user-menu__sublist",children:o.jsx("li",{className:"pkt-user-menu__subitem",children:o.jsx(Gi,{item:{title:"Endre organisasjon",iconName:"cogwheel",onClick:r}})})})}),a&&o.jsx("li",{className:"pkt-user-menu__item",children:o.jsx(Gi,{item:{title:"Logg ut",iconName:"exit",onClick:a}})})]})})});_l.displayName="PktHeaderUserMenu";const Xi=d.forwardRef(({id:s,ariaDescribedby:e,ariaLabelledby:t,autocomplete:n="off",counter:i,counterMaxLength:r,className:a,disabled:l=!1,errorMessage:c,hasError:p=!1,helptext:g,helptextDropdown:b,helptextDropdownButton:f,iconNameRight:k,inline:v=!1,fullwidth:$=!1,label:M,name:S,optionalTag:T=!1,optionalText:L,requiredTag:D=!1,requiredText:Y,tagText:ee=null,placeholder:oe,prefix:ye,suffix:K,type:N="text",useWrapper:q=!0,omitSearchIcon:B=!1,value:Z,minLength:le,maxLength:ae,min:pe,max:ue,step:be,size:ne,readonly:re,required:je,dataTestid:X,onChange:P,skipForwardTestid:Me=!1,...De},te)=>{const Le=[a,"pkt-textinput"].join(" "),Pe=N==="search"&&!k&&!B,$e=N==="date"&&Z?Z.slice(0,10):Z,[Te,Ae]=d.useState((Z==null?void 0:Z.length)||0),qe=`${s}`,Ie=`${qe}-label`,ve=t||Ie,E=Be=>{var Ye,U;i&&Ae(((U=(Ye=Be.currentTarget)==null?void 0:Ye.value)==null?void 0:U.length)||0),P&&P(Be)};return d.useEffect(()=>{Z!==void 0&&Ae((Z==null?void 0:Z.length)||0)},[Z]),o.jsx(Ts,{ariaDescribedby:e,className:Le,disabled:l,errorMessage:c,forId:qe,hasError:p,helptext:g,helptextDropdown:b,helptextDropdownButton:f,inline:v,label:M,optionalTag:T,optionalText:L,requiredTag:D,requiredText:Y,tagText:ee,useWrapper:q,counter:i,counterCurrent:Te,counterMaxLength:r,children:o.jsxs("div",{className:"pkt-input__container","data-testid":X,"data-skip-forward-testid":Me?"true":void 0,children:[ye&&o.jsx("div",{className:"pkt-input-prefix",children:ye}),o.jsx("input",{...De,ref:te,className:`pkt-input ${$?"pkt-input--fullwidth":""} ${r&&Te>r?"pkt-input--counter-error":""}`,type:N,name:`${S||s}`,value:$e,id:qe,placeholder:oe,autoComplete:n,disabled:l,"aria-invalid":p,"aria-errormessage":`${s}-error`,"aria-labelledby":ve,min:pe,max:ue,onChange:E,step:be,minLength:le,maxLength:ae,size:ne,readOnly:re,required:je}),K&&o.jsxs("p",{className:"pkt-input-suffix",children:[K,k&&o.jsx(R,{className:"pkt-input-suffix-icon",name:k}),Pe&&o.jsx(R,{className:"pkt-input-suffix-icon",name:"magnifying-glass-big"})]}),!K&&k&&o.jsx(R,{className:"pkt-input-icon",name:k}),!K&&Pe&&o.jsx(R,{className:"pkt-input-icon",name:"magnifying-glass-big"})]})})});Xi.displayName="PktTextinput";const Kr=d.forwardRef(({mobileBreakpoint:s=768,tabletBreakpoint:e=1280,children:t,className:n,compact:i=!1,"data-mode":r,logOutButtonPlacement:a="none",logOut:l,openedMenu:c,showSearch:p=!1,onSearch:g,onSearchChange:b,searchValue:f,searchPlaceholder:k="Søk",representing:v,serviceLink:$,serviceClick:M,serviceName:S,user:T,userMenu:L,userMenuFooter:D,userOptions:Y,canChangeRepresentation:ee=!1,changeRepresentation:oe,hideLogo:ye=!1,logoLink:K,logoClick:N,position:q="fixed",scrollBehavior:B="hide",slotMenuVariant:Z="icon-only",slotMenuText:le="Meny"},ae)=>{const pe=q==="fixed",ue=B==="hide";d.useEffect(()=>{D&&console.warn('PktHeaderService: The "userMenuFooter" prop is deprecated and will be removed in a future version. Please use "userMenu" instead.')},[D]),d.useEffect(()=>{Y&&console.warn('PktHeaderService: The "userOptions" prop is no longer available. Please use "userMenu" instead.')},[Y]),d.useEffect(()=>{T!=null&&T.shortname&&console.warn('PktHeaderService: The "shortname" property on the user object is deprecated and will be removed in a future version.'),v!=null&&v.shortname&&console.warn('PktHeaderService: The "shortname" property on the representing object is deprecated and will be removed in a future version.')},[T==null?void 0:T.shortname,v==null?void 0:v.shortname]);const be=d.useMemo(()=>{if(T!=null&&T.lastLoggedIn)return typeof T.lastLoggedIn=="string"?T.lastLoggedIn:new Date(T.lastLoggedIn).toLocaleString("nb-NO",{year:"numeric",month:"long",day:"numeric"})},[T==null?void 0:T.lastLoggedIn]),[ne,re]=d.useState(c||"none");d.useEffect(()=>{c!==void 0&&re(c)},[c]);const[je,X]=d.useState(!1),[P,Me]=d.useState(0),[De,te]=d.useState(!1),[Le,Pe]=d.useState(!1),$e=d.useRef(null),Te=d.useRef(null),Ae=d.useRef(null),qe=d.useRef(null),Ie=d.useRef(null),ve=d.useRef(null),E=d.useRef(null),Be=d.useRef(!1),Ye=Wm($e),U=Ye<s,V=Ye<e,se=d.useCallback(h=>{$e.current=h,typeof ae=="function"?ae(h):ae&&(ae.current=h)},[ae]);zm(pe&&U&&ne!=="none");const me=d.useCallback((h,_)=>{const C=h.relatedTarget;let j;switch(_){case"user":j=Te;break;case"slot":j=Ae;break;case"search":j=qe;break;default:return}const W=j.current;W&&(!C||!W.contains(C))&&re("none")},[]),fe=d.useCallback(()=>{Be.current&&E.current&&document.contains(E.current)&&E.current.focus(),E.current=null,Be.current=!1},[]);d.useEffect(()=>{const h=C=>{T&&ne==="user"&&!C.target.closest(".pkt-header-service__user-container")&&re("none"),ne==="slot"&&!C.target.closest(".pkt-header-service__slot-container")&&re("none"),ne==="search"&&!C.target.closest(".pkt-header-service__search-container")&&!C.target.closest(".pkt-header-service__search-input")&&re("none")},_=C=>{C.key==="Escape"&&ne!=="none"&&(C.preventDefault(),Be.current=!0,re("none"))};if(ne!=="none")return document.addEventListener("mousedown",h),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",_)};fe()},[ne,T,fe]),d.useEffect(()=>{const h=()=>{if(ue){const _=window.pageYOffset||document.documentElement.scrollTop;if(_<0||Math.abs(_-P)<60)return;X(_>P),Me(_)}};return document&&window.addEventListener("scroll",h),()=>{document&&window.removeEventListener("scroll",h)}},[ue,P]);const Xe=d.useCallback(h=>{const _=h==="slot"?Ae:qe,C=h==="slot"?Ie:ve;if(!_.current||!C.current||!V||U)return;const j=_.current.getBoundingClientRect(),W=C.current.offsetWidth,de=j.left+W>window.innerWidth;h==="slot"?te(de):Pe(de)},[V,U]),Ke=d.useCallback(h=>{ne!=="none"?re("none"):(E.current=document.activeElement,re(h))},[ne]);d.useEffect(()=>{(ne==="slot"||ne==="search")&&requestAnimationFrame(()=>{Xe(ne)})},[ne,Xe]);const m=o.jsxs("header",{className:ke("pkt-header-service",i&&"pkt-header-service--compact",U&&"pkt-header-service--mobile",V&&"pkt-header-service--tablet",pe&&"pkt-header-service--fixed",ue&&"pkt-header-service--scroll-to-hide",je&&"pkt-header-service--hidden",n),"data-mode":r,ref:se,children:[o.jsxs("div",{className:ke("pkt-header-service__logo-area",(!S||S==="")&&"pkt-header-service__logo-area--without-service"),children:[!ye&&o.jsx("span",{className:"pkt-header-service__logo",children:K?o.jsx("a",{href:K,"aria-label":"Tilbake til forside",children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}):N?o.jsx("button",{"aria-label":"Tilbake til forside",className:"pkt-link-button pkt-link pkt-header-service__logo-link",onClick:N,children:o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}):o.jsx(R,{name:"oslologo","aria-hidden":"true",path:"https://punkt-cdn.oslo.kommune.no/16.0/logos/"})}),S&&o.jsx("span",{className:"pkt-header-service__service-name",children:$?o.jsx(Ki,{href:$,className:"pkt-header-service__service-link ",children:S}):M?o.jsx("button",{className:"pkt-link-button pkt-link pkt-header-service__service-link",onClick:M,children:S}):o.jsx("span",{className:"pkt-header-service__service-link",children:S})})]}),o.jsxs("div",{className:"pkt-header-service__content",children:[o.jsxs("div",{className:ke("pkt-header-service__slot-container",ne==="slot"&&"is-open"),onBlur:h=>me(h,"slot"),ref:Ae,children:[V&&t&&o.jsx(gt,{skin:"secondary",variant:Z,iconName:"menu",size:U?"small":"medium",state:ne==="slot"?"active":"normal",onClick:()=>Ke("slot"),"aria-expanded":ne==="slot","aria-controls":"mobile-slot-menu","aria-label":"Åpne meny",children:le}),o.jsx("div",{className:ke("pkt-header-service__slot-content",De&&"align-right"),id:"mobile-slot-menu",role:V?"menu":void 0,"aria-label":V?"Meny":void 0,ref:Ie,children:o.jsx("div",{className:"pkt-contents",children:t})})]}),p&&o.jsx(o.Fragment,{children:V?o.jsxs("div",{className:ke("pkt-header-service__search-container",ne==="search"&&"is-open"),onBlur:h=>me(h,"search"),ref:qe,children:[o.jsx(gt,{skin:"secondary",variant:"icon-only",iconName:"magnifying-glass-big",size:U?"small":"medium",onClick:()=>Ke("search"),state:ne==="search"?"active":"normal","aria-expanded":ne==="search","aria-controls":"mobile-search-menu","aria-label":"Åpne søkefelt",children:"Søk"}),o.jsx("div",{className:ke("pkt-header-service__mobile-menu",ne==="search"&&"is-open",Le&&"align-right"),ref:ve,children:ne==="search"&&o.jsx(Xi,{id:"mobile-search-menu",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,autoFocus:!0,fullwidth:!0,onChange:h=>b==null?void 0:b(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(g==null||g(h.target.value))}})})]}):o.jsx(Xi,{id:"header-service-search",className:"pkt-header-service__search-input",type:"search",label:"Søk",useWrapper:!1,placeholder:k,value:f,onChange:h=>b==null?void 0:b(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(g==null||g(h.target.value))}})}),V&&l&&(a==="header"||a==="both")&&o.jsx(gt,{skin:"secondary",size:U?"small":"medium",variant:"icon-only",iconName:"exit",onClick:l,children:"Logg ut"})]}),o.jsxs("div",{className:"pkt-header-service__user",children:[T&&o.jsxs("div",{className:"pkt-header-service__user-container",onBlur:h=>me(h,"user"),ref:Te,children:[o.jsxs(gt,{className:ke("pkt-header-service__user-button",U&&"pkt-header-service__user-button--mobile"),skin:"secondary",size:U?"small":"medium",state:ne==="user"?"active":"normal",variant:"icons-right-and-left",iconName:"user",secondIconName:ne==="user"?"chevron-thin-up":"chevron-thin-down",onClick:()=>Ke("user"),children:[o.jsx("span",{className:"pkt-sr-only",children:"Brukermeny: "}),(v==null?void 0:v.name)||T.name]}),ne==="user"&&T&&o.jsx("div",{className:ke(U?"pkt-header-service__mobile-menu":"pkt-header-service__user-menu","is-open"),children:o.jsx(_l,{user:T,formattedLastLoggedIn:be,representing:v,userMenu:L,canChangeRepresentation:ee,changeRepresentation:oe,logoutOnClick:a==="userMenu"||a==="both"?l:void 0})})]}),!U&&l&&(a==="header"||a==="both")&&o.jsx(gt,{skin:"tertiary",size:"medium",variant:"icon-right",iconName:"exit",onClick:l,children:"Logg ut"})]})]});return pe?o.jsxs("div",{className:"pkt-header-service-wrapper",children:[m,o.jsx("div",{className:ke("pkt-header-service-spacer",i&&"pkt-header-service-spacer--compact",T&&"pkt-header-service-spacer--has-user",U&&"pkt-header-service-spacer--mobile",V&&"pkt-header-service-spacer--tablet")})]}):m});Kr.displayName="PktHeaderService";const wl=d.forwardRef((s,e)=>o.jsx(Kr,{...s,ref:e}));wl.displayName="PktHeader";const Gm=os({tagName:"pkt-heading",elementClass:_s,react:d,displayName:"PktHeading"}),$l=d.forwardRef(({children:s,...e},t)=>o.jsx(Gm,{"data-testid":"pkt-heading",...e,ref:t,children:s}));$l.displayName="PktHeading";const Xm=os({tagName:"pkt-helptext",elementClass:us,react:d,displayName:"PktHelptext",events:{onToggleHelpText:"toggleHelpText"}}),xl=d.forwardRef(({children:s,...e},t)=>o.jsx(Xm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));xl.displayName="PktHelptext";const Sl=d.forwardRef(({label:s,id:e,children:t,...n},i)=>o.jsxs("div",{className:"pkt-form-group",children:[o.jsx("label",{htmlFor:e,className:"pkt-form-label",children:s}),o.jsx("input",{className:"pkt-form-input",id:e,...n,ref:i}),t]}));Sl.displayName="PktInput";const Cl=({children:s,skin:e,title:t,href:n,iconName:i,openInNewTab:r,external:a,className:l,...c})=>{const p=["pkt-linkcard",e&&`pkt-linkcard--${e}`].filter(Boolean).join(" "),g=["pkt-linkcard__title",a&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return o.jsxs("a",{...c,href:n,className:ke(p,l),target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:[i&&o.jsx(R,{className:"pkt-link__icon",name:i}),t&&o.jsx("div",{className:ke(g),children:t}),o.jsx("div",{className:"pkt-linkcard__text",children:s})]})};Cl.displayName="PktLinkCard";const Qm=os({tagName:"pkt-loader",elementClass:zt,react:d,displayName:"PktLoader",events:{}}),Tl=d.forwardRef(({children:s,...e},t)=>o.jsx(Qm,{...e,ref:t,children:o.jsx("div",{className:"pkt-contents",children:s})}));Tl.displayName="PktLoader";const Nl=({children:s,className:e,skin:t,title:n,compact:i,closable:r,onClose:a,...l})=>{const[c,p]=d.useState(!1),g={"pkt-messagebox":!0,"pkt-messagebox--compact":i,[`pkt-messagebox--${t}`]:t,"pkt-messagebox--closable":r,"pkt-hide":c},b=d.createRef(),f=d.useCallback(()=>{p(!0),a&&a()},[p,a]);return o.jsxs("div",{...l,className:ke(g,e),ref:b,children:[r&&o.jsx("div",{className:"pkt-messagebox__close",children:o.jsx("button",{onClick:f,className:"pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only","aria-label":"Lukk",children:o.jsx(R,{name:"close",className:"pkt-link__icon"})})}),n&&o.jsx("div",{className:"pkt-messagebox__title",children:n}),o.jsx("div",{className:"pkt-messagebox__text",children:s})]})};Nl.displayName="PktMessagebox";const Zm=os({tagName:"pkt-progressbar",elementClass:Je,react:d,displayName:"PktProgressbar",events:{}}),Qi=d.forwardRef(({children:s,...e},t)=>o.jsx(Zm,{ref:t,...e,children:o.jsx("div",{className:"pkt-contents",children:s})}));Qi.displayName="PktProgressbar";const Ml=d.forwardRef(({id:s,name:e,label:t,className:n,hasTile:i=!1,disabled:r=!1,checkHelptext:a,hasError:l=!1,defaultChecked:c,checked:p,optionalTag:g,optionalText:b,requiredTag:f,requiredText:k,tagText:v,...$},M)=>{const S=[n,"pkt-input-check"].filter(Boolean).join(" "),T=["pkt-input-check__input",i?"pkt-input-check__input--tile":"",r&&i?"pkt-input-check__input--tile-disabled":""].filter(Boolean).join(" "),L=["pkt-input-check__input-checkbox",l?"pkt-input-check__input-checkbox--error":""].filter(Boolean).join(" "),D=["pkt-input-check__input-label",r?"pkt-input-check__input-label--disabled":""].filter(Boolean).join(" "),Y=["pkt-tag","pkt-tag--small","pkt-tag--thin-text"].join(" "),ee=()=>o.jsxs(o.Fragment,{children:[v&&o.jsx("span",{className:Y+" pkt-tag--gray",children:v}),g&&o.jsx("span",{className:Y+" pkt-tag--blue-light",children:b}),f&&o.jsx("span",{className:Y+" pkt-tag--beige",children:k})]});return o.jsx("div",{className:S,children:o.jsxs("div",{className:T,children:[o.jsx("input",{ref:M,id:s,type:"radio",name:e,disabled:r,className:L,...p!==void 0?{checked:p}:{defaultChecked:c},...$}),o.jsxs("label",{className:D,htmlFor:s,children:[t," ",ee(),a&&o.jsx("div",{className:"pkt-input-check__input-helptext",children:a})]})]})})});Ml.displayName="PktRadioButton";const Dl=d.forwardRef(({appearance:s="local",disabled:e=!1,fullwidth:t=!1,id:n,label:i,name:r,placeholder:a="Søk…",suggestions:l,value:c="",action:p,method:g,onChange:b,onSearch:f,onSuggestionClick:k,...v},$)=>{const M=(D,Y)=>{D?D():k&&k(Y)},S=D=>{c=D.target.value},T=`pkt-searchinput pkt-searchinput--${s} ${t?"pkt-searchinput--fullwidth":""}`;let L;return p?L=D=>o.jsx("form",{role:"search",className:T,action:p,method:g,children:D}):L=D=>o.jsx("div",{role:"search",className:T,children:D}),L(o.jsxs(o.Fragment,{children:[i&&o.jsx("label",{htmlFor:i?n:void 0,className:i?"pkt-inputwrapper__label":"",children:i}),o.jsxs("div",{className:s==="local"?"pkt-input__container":"pkt-searchinput__field",children:[o.jsx("input",{className:`pkt-input ${t?"pkt-input--fullwidth":""}`,type:"search",name:r||n,id:n,placeholder:a,defaultValue:c,disabled:e,autoComplete:"off","aria-autocomplete":"list",ref:$,"aria-controls":`${n}-suggestions`,onChange:b||S,onKeyUp:f&&(D=>{D.key==="Enter"&&(D.preventDefault(),f(c))}),...v}),o.jsx(gt,{className:`pkt-searchinput__button ${s==="local"?"pkt-input-icon":""}`,variant:"icon-only",iconName:"magnifying-glass-big",skin:s==="local"?"tertiary":"primary",color:s==="global"?"yellow":void 0,type:"submit",disabled:e,onClick:f&&(D=>{D.preventDefault(),f(c)}),children:i||a})]}),l&&o.jsx("ul",{id:`${n}-suggestions`,className:"pkt-searchinput__suggestions","aria-live":"assertive",children:l.map((D,Y)=>o.jsx("li",{children:d.createElement(D.href?"a":D.onClick?"button":"div",{href:D.href,className:`pkt-searchinput__suggestion ${D.onClick?"pkt-link-button":""} ${D.href||D.onClick?"pkt-searchinput__suggestion--has-hover":""}`,type:D.onClick?"button":void 0,onClick:()=>M(D.onClick,Y),onKeyUp:ee=>ee.key==="Enter"&&M(D.onClick,Y)},o.jsxs(o.Fragment,{children:[D.title&&o.jsx("h3",{className:"pkt-searchinput__suggestion-title",children:D.title}),D.text&&o.jsx("p",{className:"pkt-searchinput__suggestion-text",children:D.text})]}))},`search-suggestion-${Y}`))})]}))});Dl.displayName="PktSearchInput";const Ol=d.forwardRef(({ariaDescribedby:s,ariaLabelledby:e,children:t,className:n,disabled:i=!1,errorMessage:r,hasError:a,helptext:l,helptextDropdown:c,helptextDropdownButton:p,id:g,inline:b=!1,fullwidth:f=!1,label:k,name:v,optionalTag:$=!1,optionalText:M,requiredTag:S=!1,requiredText:T,tagText:L,...D},Y)=>{const ee=[n,"pkt-select"].join(" ");return o.jsx(Ts,{className:ee,forId:`${g}-input`,label:k,helptext:l,helptextDropdown:c,helptextDropdownButton:p,optionalTag:$,optionalText:M,requiredTag:S,requiredText:T,tagText:L,hasError:a,errorMessage:r,disabled:i,inline:b,ariaDescribedby:s,children:o.jsx("select",{ref:Y,className:`pkt-input ${f?"pkt-input--fullwidth":""}`,"aria-invalid":a,"aria-errormessage":`${g}-error`,"aria-labelledby":e||void 0,disabled:i,id:`${g}-input`,name:v||g,...D,children:t})})});Ol.displayName="PktSelect";const Jm=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:o.jsx("circle",{cx:"12",cy:"12",r:"7",style:{fill:"var(--pkt-color-grays-grey-200, #CCC)"}})}),Rm=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("circle",{opacity:".15",cx:"12",cy:"12",r:"12",fill:"#2A2859"}),o.jsx("circle",{cx:"12",cy:"12",r:"6",fill:"#2A2859"})]}),eb=o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",children:[o.jsx("path",{fill:"#2A2859",d:"M3 3h18v18H3z"}),o.jsx("path",{d:"m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",fill:"#F1FDFF"})]}),tb=({children:s,className:e,status:t="incomplete",title:n})=>o.jsxs("li",{className:ke("pkt-step",e,`pkt-step--${t}`),"data-testid":"pkt-step",children:[o.jsx("span",{className:"pkt-step__line pkt-step__line--1","aria-hidden":!0}),o.jsx("span",{className:"pkt-step__line pkt-step__line--2","aria-hidden":!0}),o.jsx("span",{className:ke("pkt-step__indicator"),children:t==="current"?Rm:t==="completed"?eb:Jm}),o.jsx("span",{className:"pkt-step__line pkt-step__line--3","aria-hidden":!0}),o.jsxs("div",{className:"pkt-step__wrapper",children:[o.jsx("div",{className:"pkt-step__title",children:n}),o.jsx("div",{className:"pkt-step__content",children:s})]})]}),El=d.forwardRef(({activeStep:s,className:e,children:t,hideNonActiveSteps:n=!1,hideNonActiveStepsContent:i=!0,orientation:r="vertical",...a},l)=>{const c=ke(e,"pkt-stepper",r==="horizontal"?"pkt-stepper--horizontal":"pkt-stepper--vertical"),p=d.Children.map(t,(g,b)=>d.isValidElement(g)?d.cloneElement(g,{className:ke(g.props.className,{"pkt-step--hideStep":n&&b!==s,"pkt-step--hideContent":i&&b!==s})}):g);return o.jsx("ol",{"data-testid":"pkt-stepper",className:c,ref:l,...a,children:p})});El.displayName="PktStepper";const sb=({className:s,compact:e=!1,skin:t="basic",responsiveView:n=!0,children:i,...r})=>o.jsx("table",{"data-testid":"pkt-table",className:ke(s,"pkt-table",{"pkt-table--responsive":n,"pkt-table--compact":e,"pkt-table--basic":t==="basic","pkt-table--zebra-blue":t==="zebra-blue"}),role:"table",...r,children:i}),nb=({id:s,children:e,className:t,...n})=>o.jsx("tbody",{id:s,className:ke(t,"pkt-table__body",{}),...n,role:"rowgroup",children:e}),ib=({children:s,className:e,dataLabel:t,...n})=>o.jsx("td",{className:ke(e,"pkt-table__data-cell",{}),"data-label":t,role:"cell","data-testid":"pkt-table__data-cell",...n,children:s}),rb=({className:s,children:e,...t})=>o.jsx("thead",{className:ke(s,"pkt-table__header",{}),role:"rowgroup",...t,children:e}),ab=({className:s,children:e,...t})=>o.jsx("th",{className:ke(s,"pkt-table__header-cell",{}),role:"columnheader",...t,children:e}),ob=({className:s,children:e,...t})=>o.jsx("tr",{className:ke(s,"pkt-table__row",{}),role:"row",...t,children:e}),Gr=d.forwardRef(({children:s,active:e,href:t,onClick:n,icon:i,controls:r,tag:a,tagSkin:l,index:c=0},p)=>{const{arrowNav:g,registerTabRef:b,handleKeyPress:f,selectTab:k}=lb(),$={"aria-selected":g?!!e:void 0,"aria-controls":r,role:g?"tab":void 0,onKeyUp:S=>f(c,S),onClick:S=>{k(c),n==null||n(S)},tabIndex:e||!g?void 0:-1,ref:S=>{b(c,S),typeof p=="function"?p(S):p&&(p.current=S)}},M=o.jsxs(o.Fragment,{children:[i&&o.jsx(R,{name:i,className:"pkt-icon--small"}),s,a&&o.jsx(Qs,{skin:l,size:"small",children:a})]});return t?o.jsx("a",{...$,href:t,className:`pkt-tabs__link ${e?"active":""}`,children:M}):o.jsx("button",{...$,type:"button",className:`pkt-tabs__button pkt-link-button ${e?"active":""}`,children:M})});Gr.displayName="PktTabItem";const Pl=d.createContext(null),lb=()=>{const s=d.useContext(Pl);if(!s)throw new Error("TabItem must be used within a Tabs component");return s},Al=d.forwardRef(({arrowNav:s=!0,disableArrowNav:e=!1,tabs:t,onTabSelected:n,children:i},r)=>{const a=d.useRef([]),l=s&&!e,p=i&&d.Children.count(i)>0?d.Children.count(i):(t==null?void 0:t.length)||0;d.useEffect(()=>{a.current=a.current.slice(0,p)},[p]);const g=v=>{const $=t==null?void 0:t[v];$!=null&&$.action&&$.action(v),n&&n(v)},b=(v,$)=>{var M,S;l&&($.code==="ArrowLeft"&&v!==0&&((M=a.current[v-1])==null||M.focus()),$.code==="ArrowRight"&&v<p-1&&((S=a.current[v+1])==null||S.focus()),($.code==="ArrowDown"||$.code==="Space")&&g(v))},f=(v,$)=>{a.current[v]=$},k=t==null?void 0:t.map((v,$)=>{var M,S;return o.jsx(Gr,{active:v.active,href:v.href,onClick:()=>g($),icon:v.icon,controls:v.controls,tag:(M=v.tag)==null?void 0:M.text,tagSkin:(S=v.tag)==null?void 0:S.skin,index:$,children:v.text},$)});return o.jsx(Pl.Provider,{value:{arrowNav:l,registerTabRef:f,handleKeyPress:b,selectTab:g},children:o.jsx("div",{className:"pkt-tabs",ref:r,children:o.jsx("div",{className:"pkt-tabs__list",role:l?"tablist":"navigation",children:i||k})})})});Al.displayName="PktTabs";var _n=window.CustomEvent;(!_n||typeof _n=="object")&&(_n=function(s,e){e=e||{};var t=document.createEvent("CustomEvent");return t.initCustomEvent(s,!!e.bubbles,!!e.cancelable,e.detail||null),t},_n.prototype=window.Event.prototype);function Il(s,e){var t="on"+e.type.toLowerCase();return typeof s[t]=="function"&&s[t](e),s.dispatchEvent(e)}function cb(s){for(;s&&s!==document.body;){var e=window.getComputedStyle(s),t=function(n,i){return!(e[n]===void 0||e[n]===i)};if(e.opacity<1||t("zIndex","auto")||t("transform","none")||t("mixBlendMode","normal")||t("filter","none")||t("perspective","none")||e.isolation==="isolate"||e.position==="fixed"||e.webkitOverflowScrolling==="touch")return!0;s=s.parentElement}return!1}function li(s){for(;s;){if(s.localName==="dialog")return s;s.parentElement?s=s.parentElement:s.parentNode?s=s.parentNode.host:s=null}return null}function Ll(s){for(;s&&s.shadowRoot&&s.shadowRoot.activeElement;)s=s.shadowRoot.activeElement;s&&s.blur&&s!==document.body&&s.blur()}function ub(s,e){for(var t=0;t<s.length;++t)if(s[t]===e)return!0;return!1}function Xr(s){return!s||!s.hasAttribute("method")?!1:s.getAttribute("method").toLowerCase()==="dialog"}function Bl(s){var e=["button","input","keygen","select","textarea"],t=e.map(function(a){return a+":not([disabled])"});t.push('[tabindex]:not([disabled]):not([tabindex=""])');var n=s.querySelector(t.join(", "));if(!n&&"attachShadow"in Element.prototype)for(var i=s.querySelectorAll("*"),r=0;r<i.length&&!(i[r].tagName&&i[r].shadowRoot&&(n=Bl(i[r].shadowRoot),n));r++);return n}function Fl(s){return s.isConnected||document.body.contains(s)}function Vl(s){if(s.submitter)return s.submitter;var e=s.target;if(!(e instanceof HTMLFormElement))return null;var t=_e.formSubmitter;if(!t){var n=s.target,i="getRootNode"in n&&n.getRootNode()||document;t=i.activeElement}return!t||t.form!==e?null:t}function db(s){if(!s.defaultPrevented){var e=s.target,t=_e.imagemapUseValue,n=Vl(s);t===null&&n&&(t=n.value);var i=li(e);if(i){var r=n&&n.getAttribute("formmethod")||e.getAttribute("method");r==="dialog"&&(s.preventDefault(),t!=null?i.close(t):i.close())}}}function Ul(s){if(this.dialog_=s,this.replacedStyleTop_=!1,this.openAsModal_=!1,s.hasAttribute("role")||s.setAttribute("role","dialog"),s.show=this.show.bind(this),s.showModal=this.showModal.bind(this),s.close=this.close.bind(this),s.addEventListener("submit",db,!1),"returnValue"in s||(s.returnValue=""),"MutationObserver"in window){var e=new MutationObserver(this.maybeHideModal.bind(this));e.observe(s,{attributes:!0,attributeFilter:["open"]})}else{var t=!1,n=(function(){t?this.downgradeModal():this.maybeHideModal(),t=!1}).bind(this),i,r=function(a){if(a.target===s){var l="DOMNodeRemoved";t|=a.type.substr(0,l.length)===l,window.clearTimeout(i),i=window.setTimeout(n,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(a){s.addEventListener(a,r)})}Object.defineProperty(s,"open",{set:this.setOpen.bind(this),get:s.hasAttribute.bind(s,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}Ul.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&Fl(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),_e.dm.removeDialog(this))},setOpen:function(s){s?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(s){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var e=document.createElement("div");this.dialog_.insertBefore(e,this.dialog_.firstChild),e.tabIndex=-1,e.focus(),this.dialog_.removeChild(e)}var t=document.createEvent("MouseEvents");t.initMouseEvent(s.type,s.bubbles,s.cancelable,window,s.detail,s.screenX,s.screenY,s.clientX,s.clientY,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.button,s.relatedTarget),this.dialog_.dispatchEvent(t),s.stopPropagation()},focus_:function(){var s=this.dialog_.querySelector("[autofocus]:not([disabled])");!s&&this.dialog_.tabIndex>=0&&(s=this.dialog_),s||(s=Bl(this.dialog_)),Ll(document.activeElement),s&&s.focus()},updateZIndex:function(s,e){if(s<e)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=s,this.backdrop_.style.zIndex=e},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!Fl(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!_e.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");cb(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,_e.needsCentering(this.dialog_)?(_e.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(s){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),s!==void 0&&(this.dialog_.returnValue=s);var e=new _n("close",{bubbles:!1,cancelable:!1});Il(this.dialog_,e)}};var _e={};if(_e.reposition=function(s){var e=document.body.scrollTop||document.documentElement.scrollTop,t=e+(window.innerHeight-s.offsetHeight)/2;s.style.top=Math.max(e,t)+"px"},_e.isInlinePositionSetByStylesheet=function(s){for(var e=0;e<document.styleSheets.length;++e){var t=document.styleSheets[e],n=null;try{n=t.cssRules}catch{}if(n)for(var i=0;i<n.length;++i){var r=n[i],a=null;try{a=document.querySelectorAll(r.selectorText)}catch{}if(!(!a||!ub(a,s))){var l=r.style.getPropertyValue("top"),c=r.style.getPropertyValue("bottom");if(l&&l!=="auto"||c&&c!=="auto")return!0}}}return!1},_e.needsCentering=function(s){var e=window.getComputedStyle(s);return e.position!=="absolute"||s.style.top!=="auto"&&s.style.top!==""||s.style.bottom!=="auto"&&s.style.bottom!==""?!1:!_e.isInlinePositionSetByStylesheet(s)},_e.forceRegisterDialog=function(s){if((window.HTMLDialogElement||s.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",s),s.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new Ul(s)},_e.registerDialog=function(s){s.showModal||_e.forceRegisterDialog(s)},_e.DialogManager=function(){this.pendingDialogStack=[];var s=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(e){this.forwardTab_=void 0,e.stopPropagation(),s([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(e){var t=[];e.forEach(function(n){for(var i=0,r;r=n.removedNodes[i];++i){if(r instanceof Element)r.localName==="dialog"&&t.push(r);else continue;t=t.concat(r.querySelectorAll("dialog"))}}),t.length&&s(t)}))},_e.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},_e.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},_e.DialogManager.prototype.updateStacking=function(){for(var s=this.zIndexHigh_,e=0,t;t=this.pendingDialogStack[e];++e)t.updateZIndex(--s,--s),e===0&&(this.overlay.style.zIndex=--s);var n=this.pendingDialogStack[0];if(n){var i=n.dialog.parentNode||document.body;i.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},_e.DialogManager.prototype.containedByTopDialog_=function(s){for(;s=li(s);){for(var e=0,t;t=this.pendingDialogStack[e];++e)if(t.dialog===s)return e===0;s=s.parentElement}return!1},_e.DialogManager.prototype.handleFocus_=function(s){var e=s.composedPath?s.composedPath()[0]:s.target;if(!this.containedByTopDialog_(e)&&document.activeElement!==document.documentElement&&(s.preventDefault(),s.stopPropagation(),Ll(e),this.forwardTab_!==void 0)){var t=this.pendingDialogStack[0],n=t.dialog,i=n.compareDocumentPosition(e);return i&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?t.focus_():e!==document.documentElement&&document.documentElement.focus()),!1}},_e.DialogManager.prototype.handleKey_=function(s){if(this.forwardTab_=void 0,s.keyCode===27){s.preventDefault(),s.stopPropagation();var e=new _n("cancel",{bubbles:!1,cancelable:!0}),t=this.pendingDialogStack[0];t&&Il(t.dialog,e)&&t.dialog.close()}else s.keyCode===9&&(this.forwardTab_=!s.shiftKey)},_e.DialogManager.prototype.checkDOM_=function(s){var e=this.pendingDialogStack.slice();e.forEach(function(t){s.indexOf(t.dialog)!==-1?t.downgradeModal():t.maybeHideModal()})},_e.DialogManager.prototype.pushDialog=function(s){var e=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=e?!1:(this.pendingDialogStack.unshift(s)===1&&this.blockDocument(),this.updateStacking(),!0)},_e.DialogManager.prototype.removeDialog=function(s){var e=this.pendingDialogStack.indexOf(s);e!==-1&&(this.pendingDialogStack.splice(e,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())},_e.dm=new _e.DialogManager,_e.formSubmitter=null,_e.imagemapUseValue=null,window.HTMLDialogElement===void 0){var Hl=document.createElement("form");if(Hl.setAttribute("method","dialog"),Hl.method!=="dialog"){var wn=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(wn){var hb=wn.get;wn.get=function(){return Xr(this)?"dialog":hb.call(this)};var pb=wn.set;wn.set=function(s){return typeof s=="string"&&s.toLowerCase()==="dialog"?this.setAttribute("method",s):pb.call(this,s)},Object.defineProperty(HTMLFormElement.prototype,"method",wn)}}document.addEventListener("click",function(s){if(_e.formSubmitter=null,_e.imagemapUseValue=null,!s.defaultPrevented){var e=s.target;if("composedPath"in s){var t=s.composedPath();e=t.shift()||e}if(!(!e||!Xr(e.form))){var n=e.type==="submit"&&["button","input"].indexOf(e.localName)>-1;if(!n){if(!(e.localName==="input"&&e.type==="image"))return;_e.imagemapUseValue=s.offsetX+","+s.offsetY}var i=li(e);i&&(_e.formSubmitter=e)}}},!1),document.addEventListener("submit",function(s){var e=s.target,t=li(e);if(!t){var n=Vl(s),i=n&&n.getAttribute("formmethod")||e.getAttribute("method");i==="dialog"&&s.preventDefault()}});var fb=HTMLFormElement.prototype.submit,gb=function(){if(!Xr(this))return fb.call(this);var s=li(this);s&&s.close()};HTMLFormElement.prototype.submit=gb}const mb=Object.freeze(Object.defineProperty({__proto__:null,default:_e},Symbol.toStringTag,{value:"Module"}));H.FileItem=gl,H.ItemRenderers=Yr,H.PktAccordion=na,H.PktAccordionItem=Mo,H.PktAlert=Bi,H.PktBackLink=Oo,H.PktBreadcrumbs=Eo,H.PktButton=gt,H.PktCalendar=Vr,H.PktCard=nl,H.PktCheckbox=il,H.PktCombobox=ul,H.PktConsent=Wi,H.PktDatepicker=pl,H.PktFileUpload=yl,H.PktFooter=jm,H.PktFooterSimple=qm,H.PktHeader=wl,H.PktHeaderService=Kr,H.PktHeading=$l,H.PktHelptext=xl,H.PktIcon=R,H.PktInput=Sl,H.PktInputWrapper=Ts,H.PktLink=Ki,H.PktLinkCard=Cl,H.PktLoader=Tl,H.PktMessagebox=Nl,H.PktModal=qr,H.PktProgressbar=Qi,H.PktRadioButton=Ml,H.PktSearchInput=Dl,H.PktSelect=Ol,H.PktStep=tb,H.PktStepper=El,H.PktTabItem=Gr,H.PktTable=sb,H.PktTableBody=nb,H.PktTableDataCell=ib,H.PktTableHeader=rb,H.PktTableHeaderCell=ab,H.PktTableRow=ob,H.PktTabs=Al,H.PktTag=Qs,H.PktTextarea=jr,H.PktTextinput=Xi,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));